diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index d3f9af6b5..52fca0687 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1004,6 +1004,11 @@ Pos=60,60\n\ Size=395,171\n\ Collapsed=0\n\ \n\ +[Window][Tuner]\n\ +Pos=60,60\n\ +Size=395,171\n\ +Collapsed=0\n\ +\n\ [Window][Warning##Export AudioFileDialogOverWriteDialog]\n\ Pos=381,351\n\ Size=500,71\n\ @@ -3748,6 +3753,7 @@ bool FurnaceGUI::loop() { DECLARE_METRIC(compatFlags) DECLARE_METRIC(piano) DECLARE_METRIC(notes) + DECLARE_METRIC(tuner) DECLARE_METRIC(channels) DECLARE_METRIC(patManager) DECLARE_METRIC(sysManager) @@ -4339,6 +4345,7 @@ bool FurnaceGUI::loop() { IMPORT_CLOSE(compatFlagsOpen); IMPORT_CLOSE(pianoOpen); IMPORT_CLOSE(notesOpen); + IMPORT_CLOSE(tunerOpen); IMPORT_CLOSE(channelsOpen); IMPORT_CLOSE(regViewOpen); IMPORT_CLOSE(logOpen); @@ -4704,6 +4711,7 @@ bool FurnaceGUI::loop() { if (ImGui::MenuItem(_("oscilloscope (per-channel)"),BIND_FOR(GUI_ACTION_WINDOW_CHAN_OSC),chanOscOpen)) chanOscOpen=!chanOscOpen; if (ImGui::MenuItem(_("oscilloscope (X-Y)"),BIND_FOR(GUI_ACTION_WINDOW_XY_OSC),xyOscOpen)) xyOscOpen=!xyOscOpen; if (ImGui::MenuItem(_("volume meter"),BIND_FOR(GUI_ACTION_WINDOW_VOL_METER),volMeterOpen)) volMeterOpen=!volMeterOpen; + if (ImGui::MenuItem(_("tuner"), BIND_FOR(GUI_ACTION_WINDOW_TUNER), tunerOpen)) tunerOpen = !tunerOpen; ImGui::EndMenu(); } if (ImGui::BeginMenu(_("tempo"))) { @@ -4978,6 +4986,7 @@ bool FurnaceGUI::loop() { MEASURE(compatFlags,drawCompatFlags()); MEASURE(piano,drawPiano()); MEASURE(notes,drawNotes()); + MEASURE(tuner, drawTuner()); MEASURE(channels,drawChannels()); MEASURE(patManager,drawPatManager()); MEASURE(sysManager,drawSysManager()); @@ -8058,6 +8067,7 @@ void FurnaceGUI::syncState() { pianoOpen=e->getConfBool("pianoOpen",false); #endif notesOpen=e->getConfBool("notesOpen",false); + tunerOpen = e->getConfBool("tunerOpen", false); channelsOpen=e->getConfBool("channelsOpen",false); patManagerOpen=e->getConfBool("patManagerOpen",false); sysManagerOpen=e->getConfBool("sysManagerOpen",false); @@ -8216,6 +8226,7 @@ void FurnaceGUI::commitState(DivConfig& conf) { conf.set("compatFlagsOpen",compatFlagsOpen); conf.set("pianoOpen",pianoOpen); conf.set("notesOpen",notesOpen); + conf.set("tunerOpen", tunerOpen); conf.set("channelsOpen",channelsOpen); conf.set("patManagerOpen",patManagerOpen); conf.set("sysManagerOpen",sysManagerOpen); @@ -8610,6 +8621,7 @@ FurnaceGUI::FurnaceGUI(): compatFlagsOpen(false), pianoOpen(false), notesOpen(false), + tunerOpen(false), channelsOpen(false), regViewOpen(false), logOpen(false), diff --git a/src/gui/gui.h b/src/gui/gui.h index 46d541299..5125fe3b6 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -542,6 +542,7 @@ enum FurnaceGUIWindows { GUI_WINDOW_COMPAT_FLAGS, GUI_WINDOW_PIANO, GUI_WINDOW_NOTES, + GUI_WINDOW_TUNER, GUI_WINDOW_CHANNELS, GUI_WINDOW_PAT_MANAGER, GUI_WINDOW_SYS_MANAGER, @@ -746,6 +747,7 @@ enum FurnaceGUIActions { GUI_ACTION_WINDOW_COMPAT_FLAGS, GUI_ACTION_WINDOW_PIANO, GUI_ACTION_WINDOW_NOTES, + GUI_ACTION_WINDOW_TUNER, GUI_ACTION_WINDOW_CHANNELS, GUI_ACTION_WINDOW_PAT_MANAGER, GUI_ACTION_WINDOW_SYS_MANAGER, @@ -2360,7 +2362,7 @@ class FurnaceGUI { bool editControlsOpen, ordersOpen, insListOpen, songInfoOpen, patternOpen, insEditOpen; bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen; bool mixerOpen, debugOpen, inspectorOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen; - bool pianoOpen, notesOpen, channelsOpen, regViewOpen, logOpen, effectListOpen, chanOscOpen; + bool pianoOpen, notesOpen, tunerOpen, channelsOpen, regViewOpen, logOpen, effectListOpen, chanOscOpen; bool subSongsOpen, findOpen, spoilerOpen, patManagerOpen, sysManagerOpen, clockOpen, speedOpen; bool groovesOpen, xyOscOpen, memoryOpen, csPlayerOpen, cvOpen, userPresetsOpen; @@ -2932,6 +2934,7 @@ class FurnaceGUI { void drawCompatFlags(); void drawPiano(); void drawNotes(bool asChild=false); + void drawTuner(bool asChild=false); void drawChannels(); void drawPatManager(); void drawSysManager(); diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index da769cbd1..f3ce7fb6e 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -640,6 +640,7 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={ D("WINDOW_COMPAT_FLAGS", _N("Compatibility Flags"), 0), D("WINDOW_PIANO", _N("Piano"), 0), D("WINDOW_NOTES", _N("Song Comments"), 0), + D("WINDOW_TUNER", _N("Tuner"), 0), D("WINDOW_CHANNELS", _N("Channels"), 0), D("WINDOW_PAT_MANAGER", _N("Pattern Manager"), 0), D("WINDOW_SYS_MANAGER", _N("Chip Manager"), 0), diff --git a/src/gui/tuner.cpp b/src/gui/tuner.cpp new file mode 100644 index 000000000..57c532142 --- /dev/null +++ b/src/gui/tuner.cpp @@ -0,0 +1,33 @@ +/** + * Furnace Tracker - multi-system chiptune tracker + * Copyright (C) 2021-2025 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 "misc/cpp/imgui_stdlib.h" + +// NOTE: please don't ask me to enable text wrap. +// Dear ImGui doesn't have that feature. D: +void FurnaceGUI::drawTuner(bool asChild) { + if (nextWindow==GUI_WINDOW_TUNER) { + tunerOpen=true; + ImGui::SetNextWindowFocus(); + nextWindow=GUI_WINDOW_NOTHING; + } + if (!tunerOpen&&!asChild) return; + bool began=asChild?ImGui::BeginChild("Song Info##Song Information"):ImGui::Begin("Song Comments",&tunerOpen,globalWinFlags,_("Tuner")); +}