GUI: fix scrolling when stepping rows

This commit is contained in:
tildearrow 2023-07-14 19:24:57 -05:00
parent 0461d220b8
commit d096d5eb3c
7 changed files with 21 additions and 11 deletions

View file

@ -2598,6 +2598,8 @@ void DivEngine::stepOne(int row) {
} }
stepPlay=2; stepPlay=2;
ticks=1; ticks=1;
prevOrder=curOrder;
prevRow=curRow;
BUSY_END; BUSY_END;
} }

View file

@ -1130,8 +1130,10 @@ void DivEngine::nextRow() {
} }
} }
prevOrder=curOrder; if (!stepPlay) {
prevRow=curRow; prevOrder=curOrder;
prevRow=curRow;
}
for (int i=0; i<chans; i++) { for (int i=0; i<chans; i++) {
if (song.delayBehavior!=2) { if (song.delayBehavior!=2) {
@ -1337,7 +1339,11 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
} }
} }
endOfSong=false; endOfSong=false;
if (stepPlay==2) stepPlay=1; if (stepPlay==2) {
stepPlay=1;
prevOrder=curOrder;
prevRow=curRow;
}
nextRow(); nextRow();
break; break;
} }

View file

@ -111,6 +111,7 @@ void FurnaceGUI::doAction(int what) {
break; break;
case GUI_ACTION_STEP_ONE: case GUI_ACTION_STEP_ONE:
e->stepOne(cursor.y); e->stepOne(cursor.y);
pendingStepUpdate=1;
break; break;
case GUI_ACTION_OCTAVE_UP: case GUI_ACTION_OCTAVE_UP:
if (++curOctave>7) { if (++curOctave>7) {

View file

@ -374,7 +374,7 @@ void FurnaceGUI::drawMobileControls() {
if (portrait) ImGui::SameLine(); if (portrait) ImGui::SameLine();
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) { if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) {
e->stepOne(cursor.y); e->stepOne(cursor.y);
pendingStepUpdate=true; pendingStepUpdate=1;
} }
bool repeatPattern=e->getRepeatPattern(); bool repeatPattern=e->getRepeatPattern();
@ -730,7 +730,7 @@ void FurnaceGUI::drawEditControls() {
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) { if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) {
e->stepOne(cursor.y); e->stepOne(cursor.y);
pendingStepUpdate=true; pendingStepUpdate=1;
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Step one row"); ImGui::SetTooltip("Step one row");
@ -770,7 +770,7 @@ void FurnaceGUI::drawEditControls() {
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) { if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) {
e->stepOne(cursor.y); e->stepOne(cursor.y);
pendingStepUpdate=true; pendingStepUpdate=1;
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Step one row"); ImGui::SetTooltip("Step one row");
@ -875,7 +875,7 @@ void FurnaceGUI::drawEditControls() {
} }
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) { if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) {
e->stepOne(cursor.y); e->stepOne(cursor.y);
pendingStepUpdate=true; pendingStepUpdate=1;
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Step one row"); ImGui::SetTooltip("Step one row");
@ -1009,7 +1009,7 @@ void FurnaceGUI::drawEditControls() {
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) { if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) {
e->stepOne(cursor.y); e->stepOne(cursor.y);
pendingStepUpdate=true; pendingStepUpdate=1;
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Step one row"); ImGui::SetTooltip("Step one row");

View file

@ -7015,7 +7015,7 @@ FurnaceGUI::FurnaceGUI():
fadeMode(false), fadeMode(false),
randomMode(false), randomMode(false),
haveHitBounds(false), haveHitBounds(false),
pendingStepUpdate(false), pendingStepUpdate(0),
oldOrdersLen(0), oldOrdersLen(0),
sampleZoom(1.0), sampleZoom(1.0),
prevSampleZoom(1.0), prevSampleZoom(1.0),

View file

@ -1913,7 +1913,8 @@ class FurnaceGUI {
int dummyRows, demandX; int dummyRows, demandX;
int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax, collapseAmount; int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax, collapseAmount;
float scaleMax; float scaleMax;
bool fadeMode, randomMode, haveHitBounds, pendingStepUpdate; bool fadeMode, randomMode, haveHitBounds;
signed char pendingStepUpdate;
int oldOrdersLen; int oldOrdersLen;
DivOrders oldOrders; DivOrders oldOrders;

View file

@ -446,7 +446,7 @@ void FurnaceGUI::drawPattern() {
float lineHeight=(ImGui::GetTextLineHeight()+2*dpiScale); float lineHeight=(ImGui::GetTextLineHeight()+2*dpiScale);
int curRow=e->getRow(); int curRow=e->getRow();
if (e->isPlaying() && followPattern && (!e->isStepping() || pendingStepUpdate)) updateScroll(curRow); if (e->isPlaying() && followPattern && (!e->isStepping() || pendingStepUpdate)) updateScroll(curRow);
pendingStepUpdate=false; if (--pendingStepUpdate<0) pendingStepUpdate=0;
if (nextScroll>-0.5f) { if (nextScroll>-0.5f) {
ImGui::SetScrollY(nextScroll); ImGui::SetScrollY(nextScroll);
nextScroll=-1.0f; nextScroll=-1.0f;