GUI: separate current order from engine order

fixes #105
This commit is contained in:
tildearrow 2022-04-14 02:58:29 -05:00
parent 9795bca2ca
commit 55e085b148
8 changed files with 70 additions and 79 deletions

View file

@ -158,8 +158,8 @@ void FurnaceGUI::moveCursor(int x, int y, bool select) {
if (settings.wrapVertical!=0 && !select) {
cursor.y=0;
if (settings.wrapVertical==2) {
if (!e->isPlaying() && e->getOrder()<(e->song.ordersLen-1)) {
e->setOrder(e->getOrder()+1);
if ((!e->isPlaying() || !followPattern) && curOrder<(e->song.ordersLen-1)) {
setOrder(curOrder+1);
} else {
cursor.y=e->song.patLen-1;
}
@ -176,8 +176,8 @@ void FurnaceGUI::moveCursor(int x, int y, bool select) {
if (settings.wrapVertical!=0 && !select) {
cursor.y=e->song.patLen-1;
if (settings.wrapVertical==2) {
if (!e->isPlaying() && e->getOrder()>0) {
e->setOrder(e->getOrder()-1);
if ((!e->isPlaying() || !followPattern) && curOrder>0) {
setOrder(curOrder-1);
} else {
cursor.y=0;
}

View file

@ -428,13 +428,13 @@ void FurnaceGUI::doAction(int what) {
e->unmuteAll();
break;
case GUI_ACTION_PAT_NEXT_ORDER:
if (e->getOrder()<e->song.ordersLen-1) {
e->setOrder(e->getOrder()+1);
if (curOrder<e->song.ordersLen-1) {
setOrder(curOrder+1);
}
break;
case GUI_ACTION_PAT_PREV_ORDER:
if (e->getOrder()>0) {
e->setOrder(e->getOrder()-1);
if (curOrder>0) {
setOrder(curOrder-1);
}
break;
case GUI_ACTION_PAT_COLLAPSE:
@ -1096,13 +1096,13 @@ void FurnaceGUI::doAction(int what) {
}
case GUI_ACTION_ORDERS_UP:
if (e->getOrder()>0) {
e->setOrder(e->getOrder()-1);
if (curOrder>0) {
setOrder(curOrder-1);
}
break;
case GUI_ACTION_ORDERS_DOWN:
if (e->getOrder()<e->song.ordersLen-1) {
e->setOrder(e->getOrder()+1);
if (curOrder<e->song.ordersLen-1) {
setOrder(curOrder+1);
}
break;
case GUI_ACTION_ORDERS_LEFT: {
@ -1131,7 +1131,6 @@ void FurnaceGUI::doAction(int what) {
}
case GUI_ACTION_ORDERS_INCREASE: {
if (orderCursor<0 || orderCursor>=e->getTotalChannelCount()) break;
int curOrder=e->getOrder();
if (e->song.orders.ord[orderCursor][curOrder]<0x7f) {
e->song.orders.ord[orderCursor][curOrder]++;
}
@ -1139,7 +1138,6 @@ void FurnaceGUI::doAction(int what) {
}
case GUI_ACTION_ORDERS_DECREASE: {
if (orderCursor<0 || orderCursor>=e->getTotalChannelCount()) break;
int curOrder=e->getOrder();
if (e->song.orders.ord[orderCursor][curOrder]>0) {
e->song.orders.ord[orderCursor][curOrder]--;
}
@ -1199,7 +1197,7 @@ void FurnaceGUI::doAction(int what) {
makeUndo(GUI_UNDO_CHANGE_ORDER);
break;
case GUI_ACTION_ORDERS_REPLAY:
e->setOrder(e->getOrder());
setOrder(curOrder);
break;
}
}

View file

@ -42,7 +42,6 @@ const char* noteNameNormal(short note, short octave) {
}
void FurnaceGUI::prepareUndo(ActionType action) {
int order=e->getOrder();
switch (action) {
case GUI_UNDO_CHANGE_ORDER:
oldOrders=e->song.orders;
@ -64,7 +63,7 @@ void FurnaceGUI::prepareUndo(ActionType action) {
case GUI_UNDO_PATTERN_COLLAPSE:
case GUI_UNDO_PATTERN_EXPAND:
for (int i=0; i<e->getTotalChannelCount(); i++) {
e->song.pat[i].getPattern(e->song.orders.ord[i][order],false)->copyOn(oldPat[i]);
e->song.pat[i].getPattern(e->song.orders.ord[i][curOrder],false)->copyOn(oldPat[i]);
}
break;
}
@ -77,8 +76,7 @@ void FurnaceGUI::makeUndo(ActionType action) {
s.cursor=cursor;
s.selStart=selStart;
s.selEnd=selEnd;
int order=e->getOrder();
s.order=order;
s.order=curOrder;
s.nibble=curNibble;
switch (action) {
case GUI_UNDO_CHANGE_ORDER:
@ -114,11 +112,11 @@ void FurnaceGUI::makeUndo(ActionType action) {
case GUI_UNDO_PATTERN_COLLAPSE:
case GUI_UNDO_PATTERN_EXPAND:
for (int i=0; i<e->getTotalChannelCount(); i++) {
DivPattern* p=e->song.pat[i].getPattern(e->song.orders.ord[i][order],false);
DivPattern* p=e->song.pat[i].getPattern(e->song.orders.ord[i][curOrder],false);
for (int j=0; j<e->song.patLen; j++) {
for (int k=0; k<32; k++) {
if (p->data[j][k]!=oldPat[i]->data[j][k]) {
s.pat.push_back(UndoPatternData(i,e->song.orders.ord[i][order],j,k,oldPat[i]->data[j][k],p->data[j][k]));
s.pat.push_back(UndoPatternData(i,e->song.orders.ord[i][curOrder],j,k,oldPat[i]->data[j][k],p->data[j][k]));
}
}
}
@ -199,10 +197,9 @@ void FurnaceGUI::doDelete() {
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
@ -237,10 +234,9 @@ void FurnaceGUI::doPullDelete() {
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
for (int j=selStart.y; j<e->song.patLen; j++) {
@ -270,10 +266,9 @@ void FurnaceGUI::doInsert() {
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
for (int j=e->song.patLen-1; j>=selStart.y; j--) {
@ -303,10 +298,9 @@ void FurnaceGUI::doTranspose(int amount) {
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
@ -371,11 +365,10 @@ void FurnaceGUI::doCopy(bool cut) {
if (iFine>3 && !(iFine&1)) {
iFine--;
}
int ord=e->getOrder();
clipboard+='\n';
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
if (iFine==0) {
clipboard+=noteNameNormal(pat->data[j][0],pat->data[j][1]);
@ -439,7 +432,6 @@ void FurnaceGUI::doPaste(PasteMode mode) {
int j=cursor.y;
char note[4];
int ord=e->getOrder();
for (size_t i=2; i<data.size() && j<e->song.patLen; i++) {
size_t charPos=0;
int iCoarse=cursor.xCoarse;
@ -448,7 +440,7 @@ void FurnaceGUI::doPaste(PasteMode mode) {
String& line=data[i];
while (charPos<line.size() && iCoarse<lastChannel) {
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
if (line[charPos]=='|') {
iCoarse++;
if (iCoarse<lastChannel) while (!e->song.chanShow[iCoarse]) {
@ -551,9 +543,9 @@ void FurnaceGUI::doPaste(PasteMode mode) {
break;
}
j++;
if (mode==GUI_PASTE_MODE_OVERFLOW && j>=e->song.patLen && ord<e->song.ordersLen-1) {
if (mode==GUI_PASTE_MODE_OVERFLOW && j>=e->song.patLen && curOrder<e->song.ordersLen-1) {
j=0;
ord++;
curOrder++;
}
if (mode==GUI_PASTE_MODE_FLOOD && i==data.size()-1) {
@ -573,10 +565,9 @@ void FurnaceGUI::doChangeIns(int ins) {
prepareUndo(GUI_UNDO_PATTERN_CHANGE_INS);
int iCoarse=selStart.xCoarse;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (int j=selStart.y; j<=selEnd.y; j++) {
if (pat->data[j][2]!=-1 || !(pat->data[j][0]==0 && pat->data[j][1]==0)) {
pat->data[j][2]=ins;
@ -594,10 +585,9 @@ void FurnaceGUI::doInterpolate() {
std::vector<std::pair<int,int>> points;
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
points.clear();
@ -654,10 +644,9 @@ void FurnaceGUI::doFade(int p0, int p1, bool mode) {
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
if (iFine!=0) {
@ -693,10 +682,9 @@ void FurnaceGUI::doInvertValues() {
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
if (iFine!=0) {
@ -725,10 +713,9 @@ void FurnaceGUI::doScale(float top) {
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
if (iFine!=0) {
@ -757,10 +744,9 @@ void FurnaceGUI::doRandomize(int bottom, int top, bool mode) {
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
if (iFine!=0) {
@ -804,10 +790,9 @@ void FurnaceGUI::doFlip() {
DivPattern patBuffer;
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
@ -836,10 +821,9 @@ void FurnaceGUI::doCollapse(int divider) {
DivPattern patBuffer;
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
@ -894,10 +878,9 @@ void FurnaceGUI::doExpand(int multiplier) {
DivPattern patBuffer;
int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine;
int ord=e->getOrder();
for (; iCoarse<=selEnd.xCoarse; iCoarse++) {
if (!e->song.chanShow[iCoarse]) continue;
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true);
DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][curOrder],true);
for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
@ -961,13 +944,13 @@ void FurnaceGUI::doUndo() {
DivPattern* p=e->song.pat[i.chan].getPattern(i.pat,true);
p->data[i.row][i.col]=i.oldVal;
}
if (!e->isPlaying()) {
if (!e->isPlaying() || !followPattern) {
cursor=us.cursor;
selStart=us.selStart;
selEnd=us.selEnd;
curNibble=us.nibble;
updateScroll(cursor.y);
e->setOrder(us.order);
setOrder(us.order);
}
break;
}
@ -1013,7 +996,7 @@ void FurnaceGUI::doRedo() {
selEnd=us.selEnd;
curNibble=us.nibble;
updateScroll(cursor.y);
e->setOrder(us.order);
setOrder(us.order);
}
break;

View file

@ -841,6 +841,7 @@ float FurnaceGUI::calcBPM(int s1, int s2, float hz) {
void FurnaceGUI::play(int row) {
e->walkSong(loopOrder,loopRow,loopEnd);
memset(lastIns,-1,sizeof(int)*DIV_MAX_CHANS);
if (!followPattern) e->setOrder(curOrder);
if (row>0) {
e->playToRow(row);
} else {
@ -851,6 +852,13 @@ void FurnaceGUI::play(int row) {
activeNotes.clear();
}
void FurnaceGUI::setOrder(unsigned char order, bool forced) {
curOrder=order;
if (followPattern || forced) {
e->setOrder(order);
}
}
void FurnaceGUI::stop() {
e->walkSong(loopOrder,loopRow,loopEnd);
e->stop();
@ -921,7 +929,7 @@ void FurnaceGUI::stopPreviewNote(SDL_Scancode scancode, bool autoNote) {
}
void FurnaceGUI::noteInput(int num, int key, int vol) {
DivPattern* pat=e->song.pat[cursor.xCoarse].getPattern(e->song.orders.ord[cursor.xCoarse][e->getOrder()],true);
DivPattern* pat=e->song.pat[cursor.xCoarse].getPattern(e->song.orders.ord[cursor.xCoarse][curOrder],true);
prepareUndo(GUI_UNDO_PATTERN_EDIT);
@ -962,7 +970,7 @@ void FurnaceGUI::noteInput(int num, int key, int vol) {
}
void FurnaceGUI::valueInput(int num, bool direct, int target) {
DivPattern* pat=e->song.pat[cursor.xCoarse].getPattern(e->song.orders.ord[cursor.xCoarse][e->getOrder()],true);
DivPattern* pat=e->song.pat[cursor.xCoarse].getPattern(e->song.orders.ord[cursor.xCoarse][curOrder],true);
prepareUndo(GUI_UNDO_PATTERN_EDIT);
if (target==-1) target=cursor.xFine+1;
if (direct) {
@ -1135,8 +1143,7 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
try {
int num=valueKeys.at(ev.key.keysym.sym);
if (orderCursor>=0 && orderCursor<e->getTotalChannelCount()) {
int curOrder=e->getOrder();
e->lockSave([this,curOrder,num]() {
e->lockSave([this,num]() {
e->song.orders.ord[orderCursor][curOrder]=((e->song.orders.ord[orderCursor][curOrder]<<4)|num);
});
if (orderEditMode==2 || orderEditMode==3) {
@ -1147,7 +1154,7 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
if (orderCursor>=e->getTotalChannelCount()) orderCursor=0;
} else if (orderEditMode==3) {
if (curOrder<e->song.ordersLen-1) {
e->setOrder(curOrder+1);
setOrder(curOrder+1);
}
}
}
@ -2559,7 +2566,7 @@ bool FurnaceGUI::loop() {
bool hasInfo=false;
String info;
if (cursor.xCoarse>=0 && cursor.xCoarse<e->getTotalChannelCount()) {
DivPattern* p=e->song.pat[cursor.xCoarse].getPattern(e->song.orders.ord[cursor.xCoarse][e->getOrder()],false);
DivPattern* p=e->song.pat[cursor.xCoarse].getPattern(e->song.orders.ord[cursor.xCoarse][curOrder],false);
if (cursor.xFine>=0) switch (cursor.xFine) {
case 0: // note
if (p->data[cursor.y][0]>0) {
@ -3475,6 +3482,7 @@ FurnaceGUI::FurnaceGUI():
curWave(0),
curSample(0),
curOctave(3),
curOrder(0),
oldRow(0),
oldOrder(0),
oldOrder1(0),

View file

@ -892,7 +892,7 @@ class FurnaceGUI {
char finalLayoutPath[4096];
int curIns, curWave, curSample, curOctave, oldRow, oldOrder, oldOrder1, editStep, exportLoops, soloChan, soloTimeout, orderEditMode, orderCursor;
int curIns, curWave, curSample, curOctave, curOrder, oldRow, oldOrder, oldOrder1, editStep, exportLoops, soloChan, soloTimeout, orderEditMode, orderCursor;
int loopOrder, loopRow, loopEnd, isClipping, extraChannelButtons, patNameTarget, newSongCategory;
int wheelX, wheelY;
@ -1167,6 +1167,7 @@ class FurnaceGUI {
void doRedoSample();
void play(int row=0);
void setOrder(unsigned char order, bool forced=false);
void stop();
void previewNote(int refChan, int note, bool autoNote=false);

View file

@ -47,10 +47,9 @@ void FurnaceGUI::drawOrders() {
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,prevSpacing);
ImGui::TableSetupScrollFreeze(1,1);
float lineHeight=(ImGui::GetTextLineHeight()+4*dpiScale);
int curOrder=e->getOrder();
if (e->isPlaying()) {
if (followOrders) {
ImGui::SetScrollY((curOrder+1)*lineHeight-(ImGui::GetContentRegionAvail().y/2));
ImGui::SetScrollY((e->getOrder()+1)*lineHeight-(ImGui::GetContentRegionAvail().y/2));
}
}
ImGui::TableNextRow(0,lineHeight);
@ -75,7 +74,7 @@ void FurnaceGUI::drawOrders() {
snprintf(selID,4096,"%d##O_S%.2x",i,i);
}
if (ImGui::Selectable(selID)) {
e->setOrder(i);
setOrder(i);
curNibble=false;
orderCursor=-1;
@ -115,7 +114,7 @@ void FurnaceGUI::drawOrders() {
curNibble=false;
}
} else {
e->setOrder(i);
setOrder(i);
e->walkSong(loopOrder,loopRow,loopEnd);
if (orderEditMode!=0) {
orderCursor=j;
@ -151,7 +150,7 @@ void FurnaceGUI::drawOrders() {
curNibble=false;
}
} else {
e->setOrder(i);
setOrder(i);
e->walkSong(loopOrder,loopRow,loopEnd);
if (orderEditMode!=0) {
orderCursor=j;

View file

@ -120,7 +120,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
if (settings.overflowHighlight) {
if (edit && cursor.y==i) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
} else if (isPlaying && oldRow==i) {
} else if (isPlaying && oldRow==i && ord==e->getOrder()) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
} else if (e->song.hilightB>0 && !(i%e->song.hilightB)) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2]));
@ -131,7 +131,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
isPushing=true;
if (edit && cursor.y==i) {
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
} else if (isPlaying && oldRow==i) {
} else if (isPlaying && oldRow==i && ord==e->getOrder()) {
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
} else if (e->song.hilightB>0 && !(i%e->song.hilightB)) {
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2]));
@ -409,9 +409,11 @@ void FurnaceGUI::drawPattern() {
patWindowSize=ImGui::GetWindowSize();
//char id[32];
ImGui::PushFont(patFont);
// TODO: separate GUI curOrder from engine curOrder
int ord=e->isPlaying()?oldOrder:e->getOrder();
oldOrder=e->getOrder();
int ord=oldOrder;
if (followPattern) {
curOrder=e->getOrder();
}
oldOrder=curOrder;
int chans=e->getTotalChannelCount();
int displayChans=0;
const DivPattern* patCache[DIV_MAX_CHANS];
@ -661,8 +663,8 @@ void FurnaceGUI::drawPattern() {
if (wheelY>0) {
if (ImGui::GetScrollY()<=0) {
if (haveHitBounds) {
if (e->getOrder()>0) {
e->setOrder(e->getOrder()-1);
if (curOrder>0) {
setOrder(curOrder-1);
ImGui::SetScrollY(ImGui::GetScrollMaxY());
updateScroll(e->song.patLen);
}
@ -676,8 +678,8 @@ void FurnaceGUI::drawPattern() {
} else {
if (ImGui::GetScrollY()>=ImGui::GetScrollMaxY()) {
if (haveHitBounds) {
if (e->getOrder()<(e->song.ordersLen-1)) {
e->setOrder(e->getOrder()+1);
if (curOrder<(e->song.ordersLen-1)) {
setOrder(curOrder+1);
ImGui::SetScrollY(0);
updateScroll(0);
}

View file

@ -124,8 +124,8 @@ void FurnaceGUI::drawSongInfo() {
if (ordLen<1) ordLen=1;
if (ordLen>256) ordLen=256;
e->song.ordersLen=ordLen;
if (e->getOrder()>=ordLen) {
e->setOrder(ordLen-1);
if (curOrder>=ordLen) {
setOrder(ordLen-1);
}
}