From be483470efad394ef871d2540d65d66595dffba4 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 14 Apr 2022 21:57:39 -0500 Subject: [PATCH] GUI: add "Use standard OPL waveform names" option --- src/gui/gui.h | 4 ++++ src/gui/insEdit.cpp | 8 ++++++-- src/gui/settings.cpp | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 4711ce17b..136b666d7 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -816,6 +816,8 @@ class FurnaceGUI { int metroVol; int pushNibble; int scrollChangesOrder; + int oplStandardWaveNames; + int cursorMoveNoScroll; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -885,6 +887,8 @@ class FurnaceGUI { metroVol(100), pushNibble(0), scrollChangesOrder(0), + oplStandardWaveNames(0), + cursorMoveNoScroll(0), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index c4a3126ed..1f84fea10 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -67,6 +67,10 @@ const char* oplWaveforms[8]={ "Sine", "Half Sine", "Absolute Sine", "Quarter Sine", "Squished Sine", "Squished AbsSine", "Square", "Derived Square" }; +const char* oplWaveformsStandard[8]={ + "Sine", "Half Sine", "Absolute Sine", "Pulse Sine", "Sine (Even Periods)", "AbsSine (Even Periods)", "Square", "Derived Square" +}; + const char* opzWaveforms[8]={ "Sine", "Triangle", "Cut Sine", "Cut Triangle", "Squished Sine", "Squished Triangle", "Squished AbsSine", "Squished AbsTriangle" }; @@ -1832,7 +1836,7 @@ void FurnaceGUI::drawInsEdit() { drawWaveform(op.ws&7,ins->type==DIV_INS_OPZ,ImVec2(ImGui::GetContentRegionAvail().x,sliderHeight-ImGui::GetFrameHeightWithSpacing())); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - P(CWSliderScalar("##WS",ImGuiDataType_U8,&op.ws,&_ZERO,&_SEVEN,(ins->type==DIV_INS_OPZ)?opzWaveforms[op.ws&7]:oplWaveforms[op.ws&7])); rightClickable + P(CWSliderScalar("##WS",ImGuiDataType_U8,&op.ws,&_ZERO,&_SEVEN,(ins->type==DIV_INS_OPZ)?opzWaveforms[op.ws&7]:(settings.oplStandardWaveNames?oplWaveformsStandard[op.ws&7]:oplWaveforms[op.ws&7]))); rightClickable if (ins->type==DIV_INS_OPL && ImGui::IsItemHovered()) { ImGui::SetTooltip("OPL2/3 only (last 4 waveforms are OPL3 only)"); } @@ -2086,7 +2090,7 @@ void FurnaceGUI::drawInsEdit() { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - P(CWSliderScalar("##WS",ImGuiDataType_U8,&op.ws,&_ZERO,&_SEVEN,(ins->type==DIV_INS_OPZ)?opzWaveforms[op.ws&7]:oplWaveforms[op.ws&7])); rightClickable + P(CWSliderScalar("##WS",ImGuiDataType_U8,&op.ws,&_ZERO,&_SEVEN,(ins->type==DIV_INS_OPZ)?opzWaveforms[op.ws&7]:(settings.oplStandardWaveNames?oplWaveformsStandard[op.ws&7]:oplWaveforms[op.ws&7]))); rightClickable if (ins->type==DIV_INS_OPL && ImGui::IsItemHovered()) { ImGui::SetTooltip("OPL2/3 only (last 4 waveforms are OPL3 only)"); } diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index b31a62ffc..bb7e76cec 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -271,6 +271,11 @@ void FurnaceGUI::drawSettings() { settings.cursorPastePos=cursorPastePosB; } + bool cursorMoveNoScrollB=settings.cursorMoveNoScroll; + if (ImGui::Checkbox("Don't scroll when moving cursor",&cursorMoveNoScrollB)) { + settings.cursorMoveNoScroll=cursorMoveNoScrollB; + } + bool allowEditDockingB=settings.allowEditDocking; if (ImGui::Checkbox("Allow docking editors",&allowEditDockingB)) { settings.allowEditDocking=allowEditDockingB; @@ -885,6 +890,11 @@ void FurnaceGUI::drawSettings() { settings.chipNames=chipNamesB; } + bool oplStandardWaveNamesB=settings.oplStandardWaveNames; + if (ImGui::Checkbox("Use standard OPL waveform names",&oplStandardWaveNamesB)) { + settings.oplStandardWaveNames=oplStandardWaveNamesB; + } + bool overflowHighlightB=settings.overflowHighlight; if (ImGui::Checkbox("Overflow pattern highlights",&overflowHighlightB)) { settings.overflowHighlight=overflowHighlightB; @@ -1588,6 +1598,8 @@ void FurnaceGUI::syncSettings() { settings.metroVol=e->getConfInt("metroVol",100); settings.pushNibble=e->getConfInt("pushNibble",0); settings.scrollChangesOrder=e->getConfInt("scrollChangesOrder",0); + settings.oplStandardWaveNames=e->getConfInt("oplStandardWaveNames",0); + settings.cursorMoveNoScroll=e->getConfInt("cursorMoveNoScroll",0); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -1646,6 +1658,8 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.metroVol,0,200); clampSetting(settings.pushNibble,0,1); clampSetting(settings.scrollChangesOrder,0,1); + clampSetting(settings.oplStandardWaveNames,0,1); + clampSetting(settings.cursorMoveNoScroll,0,1); // keybinds for (int i=0; isetConf("metroVol",settings.metroVol); e->setConf("pushNibble",settings.pushNibble); e->setConf("scrollChangesOrder",settings.scrollChangesOrder); + e->setConf("oplStandardWaveNames",settings.oplStandardWaveNames); + e->setConf("cursorMoveNoScroll",settings.cursorMoveNoScroll); // colors for (int i=0; i