mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 13:05:11 +00:00
GUI: find and replace, part 1
it does not work yet
This commit is contained in:
parent
a300916753
commit
aa09ffeedd
3 changed files with 112 additions and 1 deletions
|
@ -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; j<i.effectCount; j++) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Effect");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
ImGui::Combo("##ECondition",&i.noteMode,queryModes,GUI_QUERY_MAX);
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Value");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
ImGui::Combo("##EVCondition",&i.noteMode,queryModes,GUI_QUERY_MAX);
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Replace")) {
|
||||
ImGui::Text("Replace controls here.");
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_FIND;
|
||||
ImGui::End();
|
||||
|
|
|
@ -4032,6 +4032,7 @@ bool FurnaceGUI::init() {
|
|||
logOpen=e->getConfBool("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);
|
||||
|
|
|
@ -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<DivRegWrite> pgProgram;
|
||||
int pgSys, pgAddr, pgVal;
|
||||
|
||||
std::vector<FurnaceGUIFindQuery> curQuery;
|
||||
|
||||
struct ActiveNote {
|
||||
int chan;
|
||||
int note;
|
||||
|
|
Loading…
Reference in a new issue