From ad49ff1571ee5a0e1914810879fa605d13775375 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 20 Mar 2024 23:07:46 -0500 Subject: [PATCH] GUI: add option to set amount of cursor follows wh discussion #1811 --- src/gui/gui.h | 2 ++ src/gui/pattern.cpp | 8 +++++++- src/gui/settings.cpp | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index c7a4c8c05..27f9b9527 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1814,6 +1814,7 @@ class FurnaceGUI { int basicColors; int playbackTime; int shaderOsc; + int cursorWheelStep; unsigned int maxUndoSteps; String mainFontPath; String headFontPath; @@ -2018,6 +2019,7 @@ class FurnaceGUI { basicColors(1), playbackTime(1), shaderOsc(1), + cursorWheelStep(0), maxUndoSteps(100), mainFontPath(""), headFontPath(""), diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 8c73b0645..f675f8e29 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -1179,7 +1179,13 @@ void FurnaceGUI::drawPattern() { // cursor follows wheel if (settings.cursorFollowsWheel && (!e->isPlaying() || !followPattern) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) { if (wheelX!=0 || wheelY!=0) { - moveCursor(wheelX,(settings.cursorFollowsWheel==2)?wheelY:-wheelY,false); + int xAmount=wheelX; + int yAmount=(settings.cursorFollowsWheel==2)?wheelY:-wheelY; + if (settings.cursorWheelStep==1) { + xAmount*=MAX(1,editStep); + yAmount*=MAX(1,editStep); + } + moveCursor(xAmount,yAmount,false); } } diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 33550f62f..ea069044a 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -2423,6 +2423,18 @@ void FurnaceGUI::drawSettings() { } ImGui::Unindent(); + if (settings.cursorFollowsWheel) { + ImGui::Text("How many steps to move with each scroll wheel step?"); + if (ImGui::RadioButton("One##cws0",settings.cursorWheelStep==0)) { + settings.cursorWheelStep=0; + settingsChanged=true; + } + if (ImGui::RadioButton("Edit Step##cws1",settings.cursorWheelStep==1)) { + settings.cursorWheelStep=1; + settingsChanged=true; + } + } + // SUBSECTION ASSETS CONFIG_SUBSECTION("Assets"); @@ -3992,6 +4004,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { settings.insertBehavior=conf.getInt("insertBehavior",1); settings.pullDeleteRow=conf.getInt("pullDeleteRow",1); settings.cursorFollowsWheel=conf.getInt("cursorFollowsWheel",0); + settings.cursorWheelStep=conf.getInt("cursorWheelStep",0); settings.removeInsOff=conf.getInt("removeInsOff",0); settings.removeVolOff=conf.getInt("removeVolOff",0); settings.insTypeMenu=conf.getInt("insTypeMenu",1); @@ -4323,6 +4336,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { clampSetting(settings.playbackTime,0,1); clampSetting(settings.shaderOsc,0,1); clampSetting(settings.oscLineSize,0.25f,16.0f); + clampSetting(settings.cursorWheelStep,0,1); if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; @@ -4462,6 +4476,7 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { conf.set("insertBehavior",settings.insertBehavior); conf.set("pullDeleteRow",settings.pullDeleteRow); conf.set("cursorFollowsWheel",settings.cursorFollowsWheel); + conf.set("cursorWheelStep",settings.cursorWheelStep); conf.set("removeInsOff",settings.removeInsOff); conf.set("removeVolOff",settings.removeVolOff); conf.set("insTypeMenu",settings.insTypeMenu);