From aa09ffeedda51919d732a53d3d93274024415f21 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 7 Jun 2022 13:49:12 -0500 Subject: [PATCH 1/5] GUI: find and replace, part 1 it does not work yet --- src/gui/findReplace.cpp | 65 ++++++++++++++++++++++++++++++++++++++++- src/gui/gui.cpp | 2 ++ src/gui/gui.h | 46 +++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 1 deletion(-) diff --git a/src/gui/findReplace.cpp b/src/gui/findReplace.cpp index addc1a02f..1d83ab4e7 100644 --- a/src/gui/findReplace.cpp +++ b/src/gui/findReplace.cpp @@ -3,6 +3,16 @@ #include "IconsFontAwesome4.h" #include "misc/cpp/imgui_stdlib.h" +const char* queryModes[GUI_QUERY_MAX]={ + "ignore", + "equals", + "not equal", + "between", + "not between", + "any", + "none" +}; + void FurnaceGUI::drawFindReplace() { if (nextWindow==GUI_WINDOW_FIND) { findOpen=true; @@ -12,7 +22,60 @@ void FurnaceGUI::drawFindReplace() { if (!findOpen) return; ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); if (ImGui::Begin("Find/Replace",&findOpen,globalWinFlags)) { - + if (curQuery.empty()) { + curQuery.push_back(FurnaceGUIFindQuery()); + } + ImGui::Text("Find"); + for (FurnaceGUIFindQuery& i: curQuery) { + if (ImGui::BeginTable("FindRep",4,ImGuiTableFlags_BordersOuter)) { + ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.5); + ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.25); + ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch,0.25); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Note"); + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + ImGui::Combo("##NCondition",&i.noteMode,queryModes,GUI_QUERY_MAX); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Ins"); + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + ImGui::Combo("##ICondition",&i.noteMode,queryModes,GUI_QUERY_MAX); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Volume"); + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + ImGui::Combo("##VCondition",&i.noteMode,queryModes,GUI_QUERY_MAX); + + for (int j=0; jgetConfBool("logOpen",false); effectListOpen=e->getConfBool("effectListOpen",false); subSongsOpen=e->getConfBool("subSongsOpen",true); + findOpen=e->getConfBool("findOpen",false); tempoView=e->getConfBool("tempoView",true); waveHex=e->getConfBool("waveHex",false); @@ -4253,6 +4254,7 @@ bool FurnaceGUI::finish() { e->setConf("logOpen",logOpen); e->setConf("effectListOpen",effectListOpen); e->setConf("subSongsOpen",subSongsOpen); + e->setConf("findOpen",findOpen); // commit last window size e->setConf("lastWindowWidth",scrW); diff --git a/src/gui/gui.h b/src/gui/gui.h index ab34af1e4..23eb9e1fb 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -803,6 +803,50 @@ struct FurnaceGUIMacroDesc { } }; +enum FurnaceGUIFindQueryModes { + GUI_QUERY_IGNORE=0, + GUI_QUERY_MATCH, + GUI_QUERY_MATCH_NOT, + GUI_QUERY_RANGE, + GUI_QUERY_RANGE_NOT, + GUI_QUERY_ANY, + GUI_QUERY_NONE, + + GUI_QUERY_MAX +}; + +struct FurnaceGUIFindQuery { + int noteMode, insMode, volMode, effectCount; + int effectMode[8]; + int effectValMode[8]; + int note, noteMax; + unsigned char ins, insMax; + unsigned char vol, volMax; + unsigned char effect[8]; + unsigned char effectMax[8]; + unsigned char effectVal[8]; + unsigned char effectValMax[8]; + + FurnaceGUIFindQuery(): + noteMode(GUI_QUERY_IGNORE), + insMode(GUI_QUERY_IGNORE), + volMode(GUI_QUERY_IGNORE), + effectCount(0), + note(0), + noteMax(0), + ins(0), + insMax(0), + vol(0), + volMax(0) { + memset(effectMode,0,8*sizeof(int)); + memset(effectValMode,0,8*sizeof(int)); + memset(effect,0,8); + memset(effectMax,0,8); + memset(effectVal,0,8); + memset(effectValMax,0,8); + } +}; + class FurnaceGUI { DivEngine* e; @@ -1117,6 +1161,8 @@ class FurnaceGUI { std::vector pgProgram; int pgSys, pgAddr, pgVal; + std::vector curQuery; + struct ActiveNote { int chan; int note; From 95dd07742fcea3a17a6986566a6f428f7945a0e5 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 7 Jun 2022 13:55:10 -0500 Subject: [PATCH 2/5] CI: only upload artifacts for master branch --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d1302468..7e060924f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -278,6 +278,7 @@ jobs: popd - name: Upload artifact + if: ${{ github.repository == 'tildearrow/furnace' && github.ref_name == 'master' }} uses: actions/upload-artifact@v3 with: name: ${{ steps.package-identify.outputs.id }} From bfbbdbf1d6e7749ef494abc7a3e99788de2c4458 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 7 Jun 2022 18:51:18 -0500 Subject: [PATCH 3/5] GUI: find and replace, part 2 still does not work --- src/gui/findReplace.cpp | 291 +++++++++++++++++++++++++++++++++++++++- src/gui/gui.h | 11 ++ 2 files changed, 296 insertions(+), 6 deletions(-) diff --git a/src/gui/findReplace.cpp b/src/gui/findReplace.cpp index 1d83ab4e7..a4da0128a 100644 --- a/src/gui/findReplace.cpp +++ b/src/gui/findReplace.cpp @@ -2,6 +2,7 @@ #include "imgui.h" #include "IconsFontAwesome4.h" #include "misc/cpp/imgui_stdlib.h" +#include "guiConst.h" const char* queryModes[GUI_QUERY_MAX]={ "ignore", @@ -13,6 +14,15 @@ const char* queryModes[GUI_QUERY_MAX]={ "none" }; +const char* queryReplaceModes[GUI_QUERY_REPLACE_MAX]={ + "set", + "add", + "clear" +}; + +#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) + void FurnaceGUI::drawFindReplace() { if (nextWindow==GUI_WINDOW_FIND) { findOpen=true; @@ -25,55 +35,324 @@ void FurnaceGUI::drawFindReplace() { if (curQuery.empty()) { curQuery.push_back(FurnaceGUIFindQuery()); } - ImGui::Text("Find"); + int index=0; + int eraseIndex=-1; + char tempID[1024]; for (FurnaceGUIFindQuery& i: curQuery) { if (ImGui::BeginTable("FindRep",4,ImGuiTableFlags_BordersOuter)) { ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.5); ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.25); ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch,0.25); + ImGui::PushID(index); ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text("Note"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::Combo("##NCondition",&i.noteMode,queryModes,GUI_QUERY_MAX); + ImGui::TableNextColumn(); + if (FIRST_VISIBLE(i.noteMode)) { + if ((i.noteMode==GUI_QUERY_RANGE || i.noteMode==GUI_QUERY_RANGE_NOT) && i.note>=120) { + i.note=0; + } + if (i.note==130) { + snprintf(tempID,1024,"REL"); + } else if (i.note==129) { + snprintf(tempID,1024,"==="); + } else if (i.note==128) { + snprintf(tempID,1024,"OFF"); + } else if (i.note>=-60 && i.note<120) { + snprintf(tempID,1024,"%s",noteNames[i.note+60]); + } else { + snprintf(tempID,1024,"???"); + i.note=0; + } + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("##NN1",tempID)) { + for (int j=0; j<180; j++) { + snprintf(tempID,1024,"%s",noteNames[j]); + if (ImGui::Selectable(tempID,i.note==(j-60))) { + i.note=j-60; + } + } + if (i.noteMode!=GUI_QUERY_RANGE && i.noteMode!=GUI_QUERY_RANGE_NOT) { + if (ImGui::Selectable("OFF",i.note==128)) { + i.note=128; + } + if (ImGui::Selectable("===",i.note==129)) { + i.note=129; + } + if (ImGui::Selectable("REL",i.note==130)) { + i.note=130; + } + } + ImGui::EndCombo(); + } + } + ImGui::TableNextColumn(); + if (SECOND_VISIBLE(i.noteMode)) { + if (i.noteMax<-60 || i.noteMax>=120) { + i.noteMax=0; + } + if (i.noteMax>=-60 && i.noteMax<120) { + snprintf(tempID,1024,"%s",noteNames[i.noteMax+60]); + } else { + snprintf(tempID,1024,"???"); + } + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("##NN2",tempID)) { + for (int j=0; j<180; j++) { + snprintf(tempID,1024,"%s",noteNames[j]); + if (ImGui::Selectable(tempID,i.noteMax==(j-60))) { + i.noteMax=j-60; + } + } + ImGui::EndCombo(); + } + } ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text("Ins"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - ImGui::Combo("##ICondition",&i.noteMode,queryModes,GUI_QUERY_MAX); + ImGui::Combo("##ICondition",&i.insMode,queryModes,GUI_QUERY_MAX); + ImGui::TableNextColumn(); + if (FIRST_VISIBLE(i.insMode)) { + if (i.ins<0 || i.ins>255) i.ins=0; + snprintf(tempID,1024,"%.2X",i.ins); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("II1",tempID)) { + for (int j=0; j<256; j++) { + snprintf(tempID,1024,"%.2X",j); + if (ImGui::Selectable(tempID,i.ins==j)) { + i.ins=j; + } + } + ImGui::EndCombo(); + } + } + ImGui::TableNextColumn(); + if (SECOND_VISIBLE(i.insMode)) { + if (i.insMax<0 || i.insMax>255) i.insMax=0; + snprintf(tempID,1024,"%.2X",i.insMax); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("II2",tempID)) { + for (int j=0; j<256; j++) { + snprintf(tempID,1024,"%.2X",j); + if (ImGui::Selectable(tempID,i.insMax==j)) { + i.insMax=j; + } + } + ImGui::EndCombo(); + } + } ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text("Volume"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - ImGui::Combo("##VCondition",&i.noteMode,queryModes,GUI_QUERY_MAX); + ImGui::Combo("##VCondition",&i.volMode,queryModes,GUI_QUERY_MAX); + ImGui::TableNextColumn(); + if (FIRST_VISIBLE(i.volMode)) { + if (i.vol<0 || i.vol>255) i.vol=0; + snprintf(tempID,1024,"%.2X",i.vol); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("VV1",tempID)) { + for (int j=0; j<256; j++) { + snprintf(tempID,1024,"%.2X",j); + if (ImGui::Selectable(tempID,i.vol==j)) { + i.vol=j; + } + } + ImGui::EndCombo(); + } + } + ImGui::TableNextColumn(); + if (SECOND_VISIBLE(i.volMode)) { + if (i.volMax<0 || i.volMax>255) i.volMax=0; + snprintf(tempID,1024,"%.2X",i.volMax); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("VV2",tempID)) { + for (int j=0; j<256; j++) { + snprintf(tempID,1024,"%.2X",j); + if (ImGui::Selectable(tempID,i.volMax==j)) { + i.volMax=j; + } + } + ImGui::EndCombo(); + } + } for (int j=0; j255) i.effect[j]=0; + snprintf(tempID,1024,"%.2X",i.effect[j]); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("EE1",tempID)) { + for (int k=0; k<256; k++) { + snprintf(tempID,1024,"%.2X",k); + if (ImGui::Selectable(tempID,i.effect[j]==k)) { + i.effect[j]=k; + } + } + ImGui::EndCombo(); + } + } + ImGui::TableNextColumn(); + if (SECOND_VISIBLE(i.effectMode[j])) { + if (i.effectMax[j]<0 || i.effectMax[j]>255) i.effectMax[j]=0; + snprintf(tempID,1024,"%.2X",i.effectMax[j]); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("EE2",tempID)) { + for (int k=0; k<256; k++) { + snprintf(tempID,1024,"%.2X",k); + if (ImGui::Selectable(tempID,i.effectMax[j]==k)) { + i.effectMax[j]=k; + } + } + ImGui::EndCombo(); + } + } ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text("Value"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - ImGui::Combo("##EVCondition",&i.noteMode,queryModes,GUI_QUERY_MAX); + ImGui::Combo("##EVCondition",&i.effectValMode[j],queryModes,GUI_QUERY_MAX); + ImGui::TableNextColumn(); + if (FIRST_VISIBLE(i.effectValMode[j])) { + if (i.effectVal[j]<0 || i.effectVal[j]>255) i.effectVal[j]=0; + snprintf(tempID,1024,"%.2X",i.effectVal[j]); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("EV1",tempID)) { + for (int k=0; k<256; k++) { + snprintf(tempID,1024,"%.2X",k); + if (ImGui::Selectable(tempID,i.effectVal[j]==k)) { + i.effectVal[j]=k; + } + } + ImGui::EndCombo(); + } + } + ImGui::TableNextColumn(); + if (SECOND_VISIBLE(i.effectValMode[j])) { + if (i.effectValMax[j]<0 || i.effectValMax[j]>255) i.effectValMax[j]=0; + snprintf(tempID,1024,"%.2X",i.effectValMax[j]); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("EV2",tempID)) { + for (int k=0; k<256; k++) { + snprintf(tempID,1024,"%.2X",k); + if (ImGui::Selectable(tempID,i.effectValMax[j]==k)) { + i.effectValMax[j]=k; + } + } + ImGui::EndCombo(); + } + } + + ImGui::PopID(); } + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if (ImGui::Button(ICON_FA_MINUS "##DelQuery")) { + eraseIndex=index; + } + ImGui::TableNextColumn(); + if (i.effectCount<8) { + if (ImGui::Button("Add effect")) { + i.effectCount++; + } + } + ImGui::TableNextColumn(); + if (i.effectCount>0) { + if (ImGui::Button("Remove effect")) { + i.effectCount--; + } + } + ImGui::PopID(); ImGui::EndTable(); } + index++; + } + if (ImGui::Button("Find")) { + + } + ImGui::SameLine(); + if (eraseIndex>=0) { + curQuery.erase(curQuery.begin()+eraseIndex); + } + if (ImGui::Button(ICON_FA_PLUS "##AddQuery")) { + curQuery.push_back(FurnaceGUIFindQuery()); + } + + if (ImGui::BeginTable("QueryLimits",2)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + + ImGui::Text("Search range:"); + + if (ImGui::RadioButton("Song",curQueryRangeY==0)) { + curQueryRangeY=0; + } + if (ImGui::RadioButton("Selection",curQueryRangeY==1)) { + curQueryRangeY=1; + } + if (ImGui::RadioButton("Pattern",curQueryRangeY==2)) { + curQueryRangeY=2; + } + + ImGui::TableNextColumn(); + ImGui::Checkbox("Confine to channels",&curQueryRangeX); + + ImGui::BeginDisabled(!curQueryRangeX); + snprintf(tempID,1024,"%d: %s",curQueryRangeXMin+1,e->getChannelName(curQueryRangeXMin)); + if (ImGui::BeginCombo("From",tempID)) { + for (int i=0; igetTotalChannelCount(); i++) { + snprintf(tempID,1024,"%d: %s",i+1,e->getChannelName(i)); + if (ImGui::Selectable(tempID,curQueryRangeXMin==i)) { + curQueryRangeXMin=i; + } + } + ImGui::EndCombo(); + } + + snprintf(tempID,1024,"%d: %s",curQueryRangeXMax+1,e->getChannelName(curQueryRangeXMax)); + if (ImGui::BeginCombo("To",tempID)) { + for (int i=0; igetTotalChannelCount(); i++) { + snprintf(tempID,1024,"%d: %s",i+1,e->getChannelName(i)); + if (ImGui::Selectable(tempID,curQueryRangeXMax==i)) { + curQueryRangeXMax=i; + } + } + ImGui::EndCombo(); + } + ImGui::EndDisabled(); + + ImGui::EndTable(); } if (ImGui::TreeNode("Replace")) { - ImGui::Text("Replace controls here."); + if (ImGui::BeginTable("QueryReplace",3)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("..."); + ImGui::EndTable(); + } + if (ImGui::Button("Replace##QueryReplace")) { + // TODO + } ImGui::TreePop(); } } diff --git a/src/gui/gui.h b/src/gui/gui.h index 23eb9e1fb..c50b064dd 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -815,6 +815,14 @@ enum FurnaceGUIFindQueryModes { GUI_QUERY_MAX }; +enum FurnaceGUIFindQueryReplaceModes { + GUI_QUERY_REPLACE_SET=0, + GUI_QUERY_REPLACE_ADD, + GUI_QUERY_REPLACE_CLEAR, + + GUI_QUERY_REPLACE_MAX +}; + struct FurnaceGUIFindQuery { int noteMode, insMode, volMode, effectCount; int effectMode[8]; @@ -1162,6 +1170,9 @@ class FurnaceGUI { int pgSys, pgAddr, pgVal; std::vector curQuery; + bool curQueryRangeX; + int curQueryRangeXMin, curQueryRangeXMax; + int curQueryRangeY; struct ActiveNote { int chan; From d90cfc0f331912d2fafa4b6e8cb527b0c181c19e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 7 Jun 2022 19:26:19 -0500 Subject: [PATCH 4/5] fix build --- src/gui/findReplace.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/gui/findReplace.cpp b/src/gui/findReplace.cpp index a4da0128a..324f7f30a 100644 --- a/src/gui/findReplace.cpp +++ b/src/gui/findReplace.cpp @@ -120,7 +120,6 @@ void FurnaceGUI::drawFindReplace() { ImGui::Combo("##ICondition",&i.insMode,queryModes,GUI_QUERY_MAX); ImGui::TableNextColumn(); if (FIRST_VISIBLE(i.insMode)) { - if (i.ins<0 || i.ins>255) i.ins=0; snprintf(tempID,1024,"%.2X",i.ins); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (ImGui::BeginCombo("II1",tempID)) { @@ -135,7 +134,6 @@ void FurnaceGUI::drawFindReplace() { } ImGui::TableNextColumn(); if (SECOND_VISIBLE(i.insMode)) { - if (i.insMax<0 || i.insMax>255) i.insMax=0; snprintf(tempID,1024,"%.2X",i.insMax); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (ImGui::BeginCombo("II2",tempID)) { @@ -157,7 +155,6 @@ void FurnaceGUI::drawFindReplace() { ImGui::Combo("##VCondition",&i.volMode,queryModes,GUI_QUERY_MAX); ImGui::TableNextColumn(); if (FIRST_VISIBLE(i.volMode)) { - if (i.vol<0 || i.vol>255) i.vol=0; snprintf(tempID,1024,"%.2X",i.vol); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (ImGui::BeginCombo("VV1",tempID)) { @@ -172,7 +169,6 @@ void FurnaceGUI::drawFindReplace() { } ImGui::TableNextColumn(); if (SECOND_VISIBLE(i.volMode)) { - if (i.volMax<0 || i.volMax>255) i.volMax=0; snprintf(tempID,1024,"%.2X",i.volMax); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (ImGui::BeginCombo("VV2",tempID)) { @@ -196,7 +192,6 @@ void FurnaceGUI::drawFindReplace() { ImGui::Combo("##ECondition",&i.effectMode[j],queryModes,GUI_QUERY_MAX); ImGui::TableNextColumn(); if (FIRST_VISIBLE(i.effectMode[j])) { - if (i.effect[j]<0 || i.effect[j]>255) i.effect[j]=0; snprintf(tempID,1024,"%.2X",i.effect[j]); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (ImGui::BeginCombo("EE1",tempID)) { @@ -211,7 +206,6 @@ void FurnaceGUI::drawFindReplace() { } ImGui::TableNextColumn(); if (SECOND_VISIBLE(i.effectMode[j])) { - if (i.effectMax[j]<0 || i.effectMax[j]>255) i.effectMax[j]=0; snprintf(tempID,1024,"%.2X",i.effectMax[j]); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (ImGui::BeginCombo("EE2",tempID)) { @@ -233,7 +227,6 @@ void FurnaceGUI::drawFindReplace() { ImGui::Combo("##EVCondition",&i.effectValMode[j],queryModes,GUI_QUERY_MAX); ImGui::TableNextColumn(); if (FIRST_VISIBLE(i.effectValMode[j])) { - if (i.effectVal[j]<0 || i.effectVal[j]>255) i.effectVal[j]=0; snprintf(tempID,1024,"%.2X",i.effectVal[j]); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (ImGui::BeginCombo("EV1",tempID)) { @@ -248,7 +241,6 @@ void FurnaceGUI::drawFindReplace() { } ImGui::TableNextColumn(); if (SECOND_VISIBLE(i.effectValMode[j])) { - if (i.effectValMax[j]<0 || i.effectValMax[j]>255) i.effectValMax[j]=0; snprintf(tempID,1024,"%.2X",i.effectValMax[j]); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (ImGui::BeginCombo("EV2",tempID)) { From dc3b0e83229c84c4217c1569e70aa695778b42fb Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 7 Jun 2022 19:48:42 -0500 Subject: [PATCH 5/5] GUI: find and replace, part 3 --- src/gui/findReplace.cpp | 29 ++++++++++++++++++++++++++++- src/gui/gui.h | 3 ++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/gui/findReplace.cpp b/src/gui/findReplace.cpp index 324f7f30a..0daf34125 100644 --- a/src/gui/findReplace.cpp +++ b/src/gui/findReplace.cpp @@ -331,7 +331,34 @@ void FurnaceGUI::drawFindReplace() { ImGui::EndCombo(); } ImGui::EndDisabled(); - + + ImGui::Text("Match effect position:"); + + if (ImGui::RadioButton("No",curQueryEffectPos==0)) { + curQueryEffectPos=0; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("match effects regardless of position."); + } + if (ImGui::RadioButton("Lax",curQueryEffectPos==1)) { + curQueryEffectPos=1; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("match effects only if they appear in-order."); + } + if (ImGui::RadioButton("Strict",curQueryEffectPos==2)) { + curQueryEffectPos=2; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("match effects only if they appear exactly as specified."); + } + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Checkbox("From start",&curQueryFromStart); + ImGui::TableNextColumn(); + ImGui::Checkbox("Backwards",&curQueryBackwards); + ImGui::EndTable(); } diff --git a/src/gui/gui.h b/src/gui/gui.h index c50b064dd..2ee6170aa 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1170,9 +1170,10 @@ class FurnaceGUI { int pgSys, pgAddr, pgVal; std::vector curQuery; - bool curQueryRangeX; + bool curQueryRangeX, curQueryFromStart, curQueryBackwards; int curQueryRangeXMin, curQueryRangeXMax; int curQueryRangeY; + int curQueryEffectPos; struct ActiveNote { int chan;