From 720f046f28fda0c14fae146e82d42de26892d344 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 13 Apr 2022 17:42:55 -0500 Subject: [PATCH] GUI: implement no-nibble-push value input --- src/gui/gui.cpp | 6 +++++- src/gui/gui.h | 2 ++ src/gui/guiConst.cpp | 4 ++-- src/gui/settings.cpp | 8 ++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 9787a4da..fec3b6ed 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -967,7 +967,11 @@ void FurnaceGUI::valueInput(int num, bool direct, int target) { pat->data[cursor.y][target]=num&0xff; } else { if (pat->data[cursor.y][target]==-1) pat->data[cursor.y][target]=0; - pat->data[cursor.y][target]=((pat->data[cursor.y][target]<<4)|num)&0xff; + if (!settings.pushNibble && !curNibble) { + pat->data[cursor.y][target]=num; + } else { + pat->data[cursor.y][target]=((pat->data[cursor.y][target]<<4)|num)&0xff; + } } if (cursor.xFine==1) { // instrument if (pat->data[cursor.y][target]>=(int)e->song.ins.size()) { diff --git a/src/gui/gui.h b/src/gui/gui.h index 4b9ca05a..d9a15162 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -811,6 +811,7 @@ class FurnaceGUI { int separateFMColors; int insEditColorize; int metroVol; + int pushNibble; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -878,6 +879,7 @@ class FurnaceGUI { separateFMColors(0), insEditColorize(0), metroVol(100), + pushNibble(0), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index 481ce6f2..10b00442 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -454,8 +454,8 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={ D(GUI_COLOR_CHANNEL_FM,"",ImVec4(0.2f,0.8f,1.0f,1.0f)), D(GUI_COLOR_CHANNEL_PULSE,"",ImVec4(0.4f,1.0f,0.2f,1.0f)), D(GUI_COLOR_CHANNEL_NOISE,"",ImVec4(0.8f,0.8f,0.8f,1.0f)), - D(GUI_COLOR_CHANNEL_WAVE,"",ImVec4(1.0f,0.9f,0.2f,1.0f)), - D(GUI_COLOR_CHANNEL_PCM,"",ImVec4(1.0f,0.5f,0.2f,1.0f)), + D(GUI_COLOR_CHANNEL_WAVE,"",ImVec4(1.0f,0.5f,0.2f,1.0f)), + D(GUI_COLOR_CHANNEL_PCM,"",ImVec4(1.0f,0.9f,0.2f,1.0f)), D(GUI_COLOR_CHANNEL_OP,"",ImVec4(0.2f,0.4f,1.0f,1.0f)), D(GUI_COLOR_CHANNEL_MUTED,"",ImVec4(0.5f,0.5f,0.5f,1.0f)), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 7dc6478e..8804a612 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -236,6 +236,11 @@ void FurnaceGUI::drawSettings() { settings.soloAction=2; } + bool pushNibbleB=settings.pushNibble; + if (ImGui::Checkbox("Push value when overwriting instead of clearing it",&pushNibbleB)) { + settings.pushNibble=pushNibbleB; + } + bool pullDeleteBehaviorB=settings.pullDeleteBehavior; if (ImGui::Checkbox("Move cursor up on backspace-delete",&pullDeleteBehaviorB)) { settings.pullDeleteBehavior=pullDeleteBehaviorB; @@ -1568,6 +1573,7 @@ void FurnaceGUI::syncSettings() { settings.separateFMColors=e->getConfInt("separateFMColors",0); settings.insEditColorize=e->getConfInt("insEditColorize",0); settings.metroVol=e->getConfInt("metroVol",100); + settings.pushNibble=e->getConfInt("pushNibble",0); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -1624,6 +1630,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.separateFMColors,0,1); clampSetting(settings.insEditColorize,0,1); clampSetting(settings.metroVol,0,200); + clampSetting(settings.pushNibble,0,1); // keybinds for (int i=0; isetConf("separateFMColors",settings.separateFMColors); e->setConf("insEditColorize",settings.insEditColorize); e->setConf("metroVol",settings.metroVol); + e->setConf("pushNibble",settings.pushNibble); // colors for (int i=0; i