GUI: add spoiler window

This commit is contained in:
tildearrow 2022-06-20 15:20:02 -05:00
parent 6772159d5f
commit 60334fb03c
6 changed files with 68 additions and 2 deletions

View file

@ -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

View file

@ -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")) {

View file

@ -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"

View file

@ -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),

View file

@ -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);

37
src/gui/spoiler.cpp Normal file
View file

@ -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();
}