GUI: options to wrap around song

both for order change on scroll and vertical cursor wrap
This commit is contained in:
tildearrow 2023-07-21 16:15:20 -05:00
parent 9f9b946522
commit 2f0f30f2f4
3 changed files with 44 additions and 14 deletions

View file

@ -271,9 +271,15 @@ void FurnaceGUI::moveCursor(int x, int y, bool select) {
if (cursor.y>=e->curSubSong->patLen) { if (cursor.y>=e->curSubSong->patLen) {
if (settings.wrapVertical!=0 && !select) { if (settings.wrapVertical!=0 && !select) {
cursor.y=0; cursor.y=0;
if (settings.wrapVertical==2) { if (settings.wrapVertical>1) {
if ((!e->isPlaying() || !followPattern) && curOrder<(e->curSubSong->ordersLen-1)) { if (!e->isPlaying() || !followPattern) {
if (curOrder<(e->curSubSong->ordersLen-1)) {
setOrder(curOrder+1); setOrder(curOrder+1);
} else if (settings.wrapVertical==3) {
setOrder(0);
} else {
cursor.y=e->curSubSong->patLen-1;
}
} else { } else {
cursor.y=e->curSubSong->patLen-1; cursor.y=e->curSubSong->patLen-1;
} }
@ -289,9 +295,15 @@ void FurnaceGUI::moveCursor(int x, int y, bool select) {
if (cursor.y<0) { if (cursor.y<0) {
if (settings.wrapVertical!=0 && !select) { if (settings.wrapVertical!=0 && !select) {
cursor.y=e->curSubSong->patLen-1; cursor.y=e->curSubSong->patLen-1;
if (settings.wrapVertical==2) { if (settings.wrapVertical>1) {
if ((!e->isPlaying() || !followPattern) && curOrder>0) { if (!e->isPlaying() || !followPattern) {
if (curOrder>0) {
setOrder(curOrder-1); setOrder(curOrder-1);
} else if (settings.wrapVertical==3) {
setOrder(e->curSubSong->ordersLen-1);
} else {
cursor.y=0;
}
} else { } else {
cursor.y=0; cursor.y=0;
} }

View file

@ -953,7 +953,7 @@ void FurnaceGUI::drawPattern() {
// overflow changes order // overflow changes order
// TODO: this is very unreliable and sometimes it can warp you out of the song // 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 (wheelY>0) { if (wheelY>0) {
if (ImGui::GetScrollY()<=0) { if (ImGui::GetScrollY()<=0) {
@ -962,6 +962,10 @@ void FurnaceGUI::drawPattern() {
setOrder(curOrder-1); setOrder(curOrder-1);
ImGui::SetScrollY(ImGui::GetScrollMaxY()); ImGui::SetScrollY(ImGui::GetScrollMaxY());
updateScroll(e->curSubSong->patLen); updateScroll(e->curSubSong->patLen);
} else if (settings.scrollChangesOrder==2) {
setOrder(e->curSubSong->ordersLen-1);
ImGui::SetScrollY(ImGui::GetScrollMaxY());
updateScroll(e->curSubSong->patLen);
} }
haveHitBounds=false; haveHitBounds=false;
} else { } else {
@ -977,6 +981,10 @@ void FurnaceGUI::drawPattern() {
setOrder(curOrder+1); setOrder(curOrder+1);
ImGui::SetScrollY(0); ImGui::SetScrollY(0);
updateScroll(0); updateScroll(0);
} else if (settings.scrollChangesOrder==2) {
setOrder(0);
ImGui::SetScrollY(0);
updateScroll(0);
} }
haveHitBounds=false; haveHitBounds=false;
} else { } else {

View file

@ -572,11 +572,6 @@ void FurnaceGUI::drawSettings() {
settings.effectDeletionAltersValue=effectDeletionAltersValueB; 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; bool stepOnInsertB=settings.stepOnInsert;
if (ImGui::Checkbox("Move cursor by edit step on insert (push)",&stepOnInsertB)) { if (ImGui::Checkbox("Move cursor by edit step on insert (push)",&stepOnInsertB)) {
settings.stepOnInsert=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)) { if (ImGui::RadioButton("Yes, and move to next/prev pattern##wrapV2",settings.wrapVertical==2)) {
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:"); ImGui::Text("Cursor movement keys behavior:");
if (ImGui::RadioButton("Move by one##cmk0",settings.scrollStep==0)) { if (ImGui::RadioButton("Move by one##cmk0",settings.scrollStep==0)) {
@ -2819,7 +2829,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.soloAction,0,2); clampSetting(settings.soloAction,0,2);
clampSetting(settings.pullDeleteBehavior,0,1); clampSetting(settings.pullDeleteBehavior,0,1);
clampSetting(settings.wrapHorizontal,0,2); clampSetting(settings.wrapHorizontal,0,2);
clampSetting(settings.wrapVertical,0,2); clampSetting(settings.wrapVertical,0,3);
clampSetting(settings.macroView,0,1); clampSetting(settings.macroView,0,1);
clampSetting(settings.fmNames,0,2); clampSetting(settings.fmNames,0,2);
clampSetting(settings.allowEditDocking,0,1); clampSetting(settings.allowEditDocking,0,1);
@ -2863,7 +2873,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.insEditColorize,0,1); clampSetting(settings.insEditColorize,0,1);
clampSetting(settings.metroVol,0,200); clampSetting(settings.metroVol,0,200);
clampSetting(settings.pushNibble,0,1); clampSetting(settings.pushNibble,0,1);
clampSetting(settings.scrollChangesOrder,0,1); clampSetting(settings.scrollChangesOrder,0,2);
clampSetting(settings.oplStandardWaveNames,0,1); clampSetting(settings.oplStandardWaveNames,0,1);
clampSetting(settings.cursorMoveNoScroll,0,1); clampSetting(settings.cursorMoveNoScroll,0,1);
clampSetting(settings.lowLatency,0,1); clampSetting(settings.lowLatency,0,1);