From 2f0f30f2f46ac82f161c67edb9d8ade70f8a0898 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 21 Jul 2023 16:15:20 -0500 Subject: [PATCH] GUI: options to wrap around song both for order change on scroll and vertical cursor wrap --- src/gui/cursor.cpp | 24 ++++++++++++++++++------ src/gui/pattern.cpp | 10 +++++++++- src/gui/settings.cpp | 24 +++++++++++++++++------- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/gui/cursor.cpp b/src/gui/cursor.cpp index 09da1b257..15f9e53ff 100644 --- a/src/gui/cursor.cpp +++ b/src/gui/cursor.cpp @@ -271,9 +271,15 @@ void FurnaceGUI::moveCursor(int x, int y, bool select) { if (cursor.y>=e->curSubSong->patLen) { if (settings.wrapVertical!=0 && !select) { cursor.y=0; - if (settings.wrapVertical==2) { - if ((!e->isPlaying() || !followPattern) && curOrder<(e->curSubSong->ordersLen-1)) { - setOrder(curOrder+1); + if (settings.wrapVertical>1) { + if (!e->isPlaying() || !followPattern) { + if (curOrder<(e->curSubSong->ordersLen-1)) { + setOrder(curOrder+1); + } else if (settings.wrapVertical==3) { + setOrder(0); + } else { + cursor.y=e->curSubSong->patLen-1; + } } else { cursor.y=e->curSubSong->patLen-1; } @@ -289,9 +295,15 @@ void FurnaceGUI::moveCursor(int x, int y, bool select) { if (cursor.y<0) { if (settings.wrapVertical!=0 && !select) { cursor.y=e->curSubSong->patLen-1; - if (settings.wrapVertical==2) { - if ((!e->isPlaying() || !followPattern) && curOrder>0) { - setOrder(curOrder-1); + if (settings.wrapVertical>1) { + if (!e->isPlaying() || !followPattern) { + if (curOrder>0) { + setOrder(curOrder-1); + } else if (settings.wrapVertical==3) { + setOrder(e->curSubSong->ordersLen-1); + } else { + cursor.y=0; + } } else { cursor.y=0; } diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 1deec9dc6..fd19f86a5 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -953,7 +953,7 @@ void FurnaceGUI::drawPattern() { // overflow changes order // TODO: this is very unreliable and sometimes it can warp you out of the song - if (settings.scrollChangesOrder && !e->isPlaying() && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) { + if (settings.scrollChangesOrder && (!e->isPlaying() || !followPattern) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) { if (wheelY!=0) { if (wheelY>0) { if (ImGui::GetScrollY()<=0) { @@ -962,6 +962,10 @@ void FurnaceGUI::drawPattern() { setOrder(curOrder-1); ImGui::SetScrollY(ImGui::GetScrollMaxY()); updateScroll(e->curSubSong->patLen); + } else if (settings.scrollChangesOrder==2) { + setOrder(e->curSubSong->ordersLen-1); + ImGui::SetScrollY(ImGui::GetScrollMaxY()); + updateScroll(e->curSubSong->patLen); } haveHitBounds=false; } else { @@ -977,6 +981,10 @@ void FurnaceGUI::drawPattern() { setOrder(curOrder+1); ImGui::SetScrollY(0); updateScroll(0); + } else if (settings.scrollChangesOrder==2) { + setOrder(0); + ImGui::SetScrollY(0); + updateScroll(0); } haveHitBounds=false; } else { diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 508778acb..45b90aa02 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -572,11 +572,6 @@ void FurnaceGUI::drawSettings() { settings.effectDeletionAltersValue=effectDeletionAltersValueB; } - bool scrollChangesOrderB=settings.scrollChangesOrder; - if (ImGui::Checkbox("Change order when scrolling outside of pattern bounds",&scrollChangesOrderB)) { - settings.scrollChangesOrder=scrollChangesOrderB; - } - bool stepOnInsertB=settings.stepOnInsert; if (ImGui::Checkbox("Move cursor by edit step on insert (push)",&stepOnInsertB)) { settings.stepOnInsert=stepOnInsertB; @@ -758,6 +753,21 @@ void FurnaceGUI::drawSettings() { if (ImGui::RadioButton("Yes, and move to next/prev pattern##wrapV2",settings.wrapVertical==2)) { settings.wrapVertical=2; } + if (ImGui::RadioButton("Yes, and move to next/prev pattern (wrap around)##wrapV2",settings.wrapVertical==3)) { + settings.wrapVertical=3; + } + + ImGui::Text("Change order when scrolling outside of pattern bounds:"); + if (ImGui::RadioButton("No##pscroll0",settings.scrollChangesOrder==0)) { + settings.scrollChangesOrder=0; + } + if (ImGui::RadioButton("Yes##pscroll1",settings.scrollChangesOrder==1)) { + settings.scrollChangesOrder=1; + } + if (ImGui::RadioButton("Yes, and wrap around song##pscroll2",settings.scrollChangesOrder==2)) { + settings.scrollChangesOrder=2; + } + ImGui::Text("Cursor movement keys behavior:"); if (ImGui::RadioButton("Move by one##cmk0",settings.scrollStep==0)) { @@ -2819,7 +2829,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.soloAction,0,2); clampSetting(settings.pullDeleteBehavior,0,1); clampSetting(settings.wrapHorizontal,0,2); - clampSetting(settings.wrapVertical,0,2); + clampSetting(settings.wrapVertical,0,3); clampSetting(settings.macroView,0,1); clampSetting(settings.fmNames,0,2); clampSetting(settings.allowEditDocking,0,1); @@ -2863,7 +2873,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.insEditColorize,0,1); clampSetting(settings.metroVol,0,200); clampSetting(settings.pushNibble,0,1); - clampSetting(settings.scrollChangesOrder,0,1); + clampSetting(settings.scrollChangesOrder,0,2); clampSetting(settings.oplStandardWaveNames,0,1); clampSetting(settings.cursorMoveNoScroll,0,1); clampSetting(settings.lowLatency,0,1);