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;