diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d064ac07..74d622bea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -510,6 +510,7 @@ src/gui/sampleEdit.cpp src/gui/settings.cpp src/gui/songInfo.cpp src/gui/songNotes.cpp +src/gui/spoiler.cpp src/gui/stats.cpp src/gui/subSongs.cpp src/gui/sysConf.cpp diff --git a/src/gui/debugWindow.cpp b/src/gui/debugWindow.cpp index 7d6d057f1..22527a7b8 100644 --- a/src/gui/debugWindow.cpp +++ b/src/gui/debugWindow.cpp @@ -369,6 +369,9 @@ void FurnaceGUI::drawDebug() { if (ImGui::Button("Inspect")) { inspectorOpen=!inspectorOpen; } + if (ImGui::Button("Spoiler")) { + spoilerOpen=!spoilerOpen; + } ImGui::TreePop(); } if (ImGui::TreeNode("Performance")) { diff --git a/src/gui/findReplace.cpp b/src/gui/findReplace.cpp index f16ccd7ae..78abce7cb 100644 --- a/src/gui/findReplace.cpp +++ b/src/gui/findReplace.cpp @@ -1,3 +1,22 @@ +/** + * Furnace Tracker - multi-system chiptune tracker + * Copyright (C) 2021-2022 tildearrow and contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #include "gui.h" #include "imgui.h" #include "IconsFontAwesome4.h" diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index dc45acf49..9b37f987c 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3006,6 +3006,7 @@ bool FurnaceGUI::loop() { if (ImGui::MenuItem("register view",BIND_FOR(GUI_ACTION_WINDOW_REGISTER_VIEW),regViewOpen)) regViewOpen=!regViewOpen; if (ImGui::MenuItem("log viewer",BIND_FOR(GUI_ACTION_WINDOW_LOG),logOpen)) logOpen=!logOpen; if (ImGui::MenuItem("statistics",BIND_FOR(GUI_ACTION_WINDOW_STATS),statsOpen)) statsOpen=!statsOpen; + if (spoilerOpen) if (ImGui::MenuItem("spoiler",NULL,spoilerOpen)) spoilerOpen=!spoilerOpen; ImGui::EndMenu(); } @@ -4035,6 +4036,7 @@ bool FurnaceGUI::init() { effectListOpen=e->getConfBool("effectListOpen",false); subSongsOpen=e->getConfBool("subSongsOpen",true); findOpen=e->getConfBool("findOpen",false); + spoilerOpen=e->getConfBool("spoilerOpen",false); tempoView=e->getConfBool("tempoView",true); waveHex=e->getConfBool("waveHex",false); @@ -4258,6 +4260,7 @@ bool FurnaceGUI::finish() { e->setConf("effectListOpen",effectListOpen); e->setConf("subSongsOpen",subSongsOpen); e->setConf("findOpen",findOpen); + e->setConf("spoilerOpen",spoilerOpen); // commit last window size e->setConf("lastWindowWidth",scrW); @@ -4407,6 +4410,7 @@ FurnaceGUI::FurnaceGUI(): chanOscOpen(false), subSongsOpen(true), findOpen(false), + spoilerOpen(false), selecting(false), selectingFull(false), dragging(false), diff --git a/src/gui/gui.h b/src/gui/gui.h index ac15d5a8a..271b8eaa4 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -246,7 +246,8 @@ enum FurnaceGUIWindows { GUI_WINDOW_EFFECT_LIST, GUI_WINDOW_CHAN_OSC, GUI_WINDOW_SUBSONGS, - GUI_WINDOW_FIND + GUI_WINDOW_FIND, + GUI_WINDOW_SPOILER }; enum FurnaceGUIFileDialogs { @@ -1149,7 +1150,7 @@ class FurnaceGUI { bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen; bool mixerOpen, debugOpen, inspectorOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen; bool pianoOpen, notesOpen, channelsOpen, regViewOpen, logOpen, effectListOpen, chanOscOpen; - bool subSongsOpen, findOpen; + bool subSongsOpen, findOpen, spoilerOpen; SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd; bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI; @@ -1445,6 +1446,7 @@ class FurnaceGUI { void drawEffectList(); void drawSubSongs(); void drawFindReplace(); + void drawSpoiler(); void parseKeybinds(); void promptKey(int which); diff --git a/src/gui/spoiler.cpp b/src/gui/spoiler.cpp new file mode 100644 index 000000000..dc64b14ce --- /dev/null +++ b/src/gui/spoiler.cpp @@ -0,0 +1,37 @@ +/** + * Furnace Tracker - multi-system chiptune tracker + * Copyright (C) 2021-2022 tildearrow and contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "gui.h" +#include "imgui.h" + +void FurnaceGUI::drawSpoiler() { + if (nextWindow==GUI_WINDOW_SPOILER) { + spoilerOpen=true; + ImGui::SetNextWindowFocus(); + nextWindow=GUI_WINDOW_NOTHING; + } + if (!spoilerOpen) return; + if (ImGui::Begin("Spoiler",&spoilerOpen,globalWinFlags|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_AlwaysAutoResize)) { + ImGui::PushFont(bigFont); + ImGui::Text("SPOILER"); + ImGui::PopFont(); + } + if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_SPOILER; + ImGui::End(); +}