GUI: add option to set amount of cursor follows wh

discussion #1811
This commit is contained in:
tildearrow 2024-03-20 23:07:46 -05:00
parent 94ae06dd6e
commit ad49ff1571
3 changed files with 24 additions and 1 deletions

View file

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

View file

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

View file

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