GUI: find and replace, part 11

lax mode done

now replace time...
This commit is contained in:
tildearrow 2022-06-11 22:42:30 -05:00
parent 19251e84f6
commit f0e9bd5f57
2 changed files with 35 additions and 2 deletions

View File

@ -126,8 +126,37 @@ void FurnaceGUI::doFind() {
}
}
break;
case 1: // lax
case 1: { // lax
// locate first effect
int posOfFirst=-1;
for (int m=0; m<e->curPat[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; m<l.effectCount; m++) {
if (!checkCondition(l.effectMode[m],l.effect[m],l.effectMax[m],p->data[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();
}

View File

@ -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);