From 90bbc4229034e40bc3782fabe173788dbd3e4e77 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 3 Apr 2022 19:20:30 -0500 Subject: [PATCH] GUI: more usability improvements - move cursor to end of clipboard when pasting - better effect input --- src/gui/editing.cpp | 3 +++ src/gui/gui.cpp | 13 ++++++++++++- src/gui/gui.h | 4 ++++ src/gui/settings.cpp | 16 ++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/gui/editing.cpp b/src/gui/editing.cpp index 59c1fc342..58069528a 100644 --- a/src/gui/editing.cpp +++ b/src/gui/editing.cpp @@ -556,6 +556,9 @@ void FurnaceGUI::doPaste(PasteMode mode) { i=1; } } + if (settings.cursorPastePos) { + cursor.y=j; + } makeUndo(GUI_UNDO_PATTERN_PASTE); } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 2d7a42225..f30c820fe 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -976,7 +976,18 @@ void FurnaceGUI::valueInput(int num, bool direct, int target) { curNibble=false; } else { curNibble=!curNibble; - if (!curNibble) editAdvance(); + if (!curNibble) { + if (!settings.effectCursorDir) { + editAdvance(); + } else { + if (cursor.xFine&1) { + cursor.xFine++; + } else { + editAdvance(); + cursor.xFine--; + } + } + } } } } diff --git a/src/gui/gui.h b/src/gui/gui.h index 80397db81..abefee8bf 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -731,6 +731,8 @@ class FurnaceGUI { int loadJapanese; int fmLayout; int susPosition; + int effectCursorDir; + int cursorPastePos; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -785,6 +787,8 @@ class FurnaceGUI { loadJapanese(0), fmLayout(0), susPosition(0), + effectCursorDir(1), + cursorPastePos(1), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index ac77896f2..9768792a2 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -237,6 +237,16 @@ void FurnaceGUI::drawSettings() { settings.stepOnInsert=stepOnInsertB; } + bool effectCursorDirB=settings.effectCursorDir; + if (ImGui::Checkbox("Move cursor to effect value on effect input",&effectCursorDirB)) { + settings.effectCursorDir=effectCursorDirB; + } + + bool cursorPastePosB=settings.cursorPastePos; + if (ImGui::Checkbox("Move cursor to end of clipboard content when pasting",&cursorPastePosB)) { + settings.cursorPastePos=cursorPastePosB; + } + bool allowEditDockingB=settings.allowEditDocking; if (ImGui::Checkbox("Allow docking editors",&allowEditDockingB)) { settings.allowEditDocking=allowEditDockingB; @@ -1357,6 +1367,8 @@ void FurnaceGUI::syncSettings() { settings.loadJapanese=e->getConfInt("loadJapanese",0); settings.fmLayout=e->getConfInt("fmLayout",0); settings.susPosition=e->getConfInt("susPosition",0); + settings.effectCursorDir=e->getConfInt("effectCursorDir",1); + settings.cursorPastePos=e->getConfInt("cursorPastePos",1); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -1403,6 +1415,8 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.loadJapanese,0,1); clampSetting(settings.fmLayout,0,3); clampSetting(settings.susPosition,0,1); + clampSetting(settings.effectCursorDir,0,1); + clampSetting(settings.cursorPastePos,0,1); // keybinds LOAD_KEYBIND(GUI_ACTION_OPEN,FURKMOD_CMD|SDLK_o); @@ -1646,6 +1660,8 @@ void FurnaceGUI::commitSettings() { e->setConf("loadJapanese",settings.loadJapanese); e->setConf("fmLayout",settings.fmLayout); e->setConf("susPosition",settings.susPosition); + e->setConf("effectCursorDir",settings.effectCursorDir); + e->setConf("cursorPastePos",settings.cursorPastePos); PUT_UI_COLOR(GUI_COLOR_BACKGROUND); PUT_UI_COLOR(GUI_COLOR_FRAME_BACKGROUND);