diff --git a/src/gui/findReplace.cpp b/src/gui/findReplace.cpp index 77c1a7e3a..3f877242f 100644 --- a/src/gui/findReplace.cpp +++ b/src/gui/findReplace.cpp @@ -126,8 +126,37 @@ void FurnaceGUI::doFind() { } } break; - case 1: // lax + case 1: { // lax + // locate first effect + int posOfFirst=-1; + for (int m=0; mcurPat[k].effectCols; m++) { + if (!checkCondition(l.effectMode[0],l.effect[0],l.effectMax[0],p->data[j][4+m*2])) continue; + if (!checkCondition(l.effectValMode[0],l.effectVal[0],l.effectValMax[0],p->data[j][5+m*2])) continue; + posOfFirst=m; + break; + } + if (posOfFirst<0) { + notMatched=true; + break; + } + // make sure we aren't too far to the right + if ((posOfFirst+l.effectCount)>e->curPat[k].effectCols) { + notMatched=true; + break; + } + // search from first effect location + for (int m=0; mdata[j][4+(m+posOfFirst)*2])) { + notMatched=true; + break; + } + if (!checkCondition(l.effectValMode[m],l.effectVal[m],l.effectValMax[m],p->data[j][5+(m+posOfFirst)*2])) { + notMatched=true; + break; + } + } break; + } case 2: // strict int effectMax=l.effectCount; if (effectMax>e->curPat[k].effectCols) { @@ -160,6 +189,9 @@ void FurnaceGUI::doFind() { queryViewingResults=true; } +void FurnaceGUI::doReplace() { +} + #define FIRST_VISIBLE(x) (x==GUI_QUERY_MATCH || x==GUI_QUERY_MATCH_NOT || x==GUI_QUERY_RANGE || x==GUI_QUERY_RANGE_NOT) #define SECOND_VISIBLE(x) (x==GUI_QUERY_RANGE || x==GUI_QUERY_RANGE_NOT) @@ -754,7 +786,7 @@ void FurnaceGUI::drawFindReplace() { queryReplaceEffectPos=3; } if (ImGui::Button("Replace##QueryReplace")) { - // TODO + doReplace(); } ImGui::EndTabItem(); } diff --git a/src/gui/gui.h b/src/gui/gui.h index 300fa8fca..55ea989c8 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1492,6 +1492,7 @@ class FurnaceGUI { void doUndo(); void doRedo(); void doFind(); + void doReplace(); void editOptions(bool topMenu); void noteInput(int num, int key, int vol=-1); void valueInput(int num, bool direct=false, int target=-1);