GUI: find and replace, part 6

This commit is contained in:
tildearrow 2022-06-09 18:52:38 -05:00
parent dd05429c0e
commit 936d9dfa49
5 changed files with 106 additions and 9 deletions

View file

@ -3,6 +3,7 @@
#include "IconsFontAwesome4.h"
#include "misc/cpp/imgui_stdlib.h"
#include "guiConst.h"
#include "intConst.h"
const char* queryModes[GUI_QUERY_MAX]={
"ignore",
@ -290,7 +291,11 @@ void FurnaceGUI::drawFindReplace() {
curQuery.push_back(FurnaceGUIFindQuery());
}
if (ImGui::BeginTable("QueryLimits",2)) {
if (ImGui::BeginTable("QueryLimits",3)) {
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.5f);
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.5f);
ImGui::TableNextRow();
ImGui::TableNextColumn();
@ -333,6 +338,7 @@ void FurnaceGUI::drawFindReplace() {
}
ImGui::EndDisabled();
ImGui::TableNextColumn();
ImGui::Text("Match effect position:");
if (ImGui::RadioButton("No",curQueryEffectPos==0)) {
@ -356,8 +362,6 @@ void FurnaceGUI::drawFindReplace() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Checkbox("From start",&curQueryFromStart);
ImGui::TableNextColumn();
ImGui::Checkbox("Backwards",&curQueryBackwards);
ImGui::EndTable();
@ -373,10 +377,49 @@ void FurnaceGUI::drawFindReplace() {
ImGui::TableNextColumn();
ImGui::Checkbox("Note",&queryReplaceNoteDo);
ImGui::TableNextColumn();
ImGui::BeginDisabled(!queryReplaceNoteDo);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::Combo("##NRMode",&queryReplaceNoteMode,queryReplaceModes,GUI_QUERY_REPLACE_MAX);
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (queryReplaceNoteMode==GUI_QUERY_REPLACE_SET) {
if (queryReplaceNote==130) {
snprintf(tempID,1024,"REL");
} else if (queryReplaceNote==129) {
snprintf(tempID,1024,"===");
} else if (queryReplaceNote==128) {
snprintf(tempID,1024,"OFF");
} else if (queryReplaceNote>=-60 && queryReplaceNote<120) {
snprintf(tempID,1024,"%s",noteNames[queryReplaceNote+60]);
} else {
snprintf(tempID,1024,"???");
queryReplaceNote=0;
}
if (ImGui::BeginCombo("##NRValueC",tempID)) {
for (int j=0; j<180; j++) {
snprintf(tempID,1024,"%s",noteNames[j]);
if (ImGui::Selectable(tempID,queryReplaceNote==(j-60))) {
queryReplaceNote=j-60;
}
}
if (ImGui::Selectable("OFF",queryReplaceNote==128)) {
queryReplaceNote=128;
}
if (ImGui::Selectable("===",queryReplaceNote==129)) {
queryReplaceNote=129;
}
if (ImGui::Selectable("REL",queryReplaceNote==130)) {
queryReplaceNote=130;
}
ImGui::EndCombo();
}
} else if (queryReplaceNoteMode==GUI_QUERY_REPLACE_ADD || queryReplaceNoteMode==GUI_QUERY_REPLACE_ADD_OVERFLOW) {
if (ImGui::InputInt("##NRValue",&queryReplaceNote,1,12)) {
if (queryReplaceNote<-180) queryReplaceNote=-180;
if (queryReplaceNote>180) queryReplaceNote=180;
}
}
ImGui::EndDisabled();
ImGui::TableNextRow();
ImGui::TableNextColumn();
@ -384,6 +427,19 @@ void FurnaceGUI::drawFindReplace() {
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::Combo("##IRMode",&queryReplaceInsMode,queryReplaceModes,GUI_QUERY_REPLACE_MAX);
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (queryReplaceInsMode==GUI_QUERY_REPLACE_SET) {
if (ImGui::InputScalar("##IRValueH",ImGuiDataType_S32,&queryReplaceIns,&_ONE,&_SIXTEEN,"%.2X",ImGuiInputTextFlags_CharsHexadecimal)) {
if (queryReplaceIns<0) queryReplaceIns=0;
if (queryReplaceIns>255) queryReplaceIns=255;
}
} else if (queryReplaceInsMode==GUI_QUERY_REPLACE_ADD || queryReplaceInsMode==GUI_QUERY_REPLACE_ADD_OVERFLOW) {
if (ImGui::InputInt("##IRValue",&queryReplaceIns,1,12)) {
if (queryReplaceIns<-255) queryReplaceIns=-255;
if (queryReplaceIns>255) queryReplaceIns=255;
}
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
@ -391,14 +447,27 @@ void FurnaceGUI::drawFindReplace() {
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::Combo("##VRMode",&queryReplaceVolMode,queryReplaceModes,GUI_QUERY_REPLACE_MAX);
/*ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("Effect");
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (queryReplaceVolMode==GUI_QUERY_REPLACE_SET) {
if (ImGui::InputScalar("##VRValueH",ImGuiDataType_S32,&queryReplaceVol,&_ONE,&_SIXTEEN,"%.2X",ImGuiInputTextFlags_CharsHexadecimal)) {
if (queryReplaceVol<0) queryReplaceVol=0;
if (queryReplaceVol>255) queryReplaceVol=255;
}
} else if (queryReplaceVolMode==GUI_QUERY_REPLACE_ADD || queryReplaceVolMode==GUI_QUERY_REPLACE_ADD_OVERFLOW) {
if (ImGui::InputInt("##VRValue",&queryReplaceVol,1,12)) {
if (queryReplaceVol<-255) queryReplaceVol=-255;
if (queryReplaceVol>255) queryReplaceVol=255;
}
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("Value");*/
ImGui::Text("Later");
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("Later");
ImGui::EndTable();
}

View file

@ -4431,6 +4431,25 @@ FurnaceGUI::FurnaceGUI():
wavePreviewLen(32),
wavePreviewHeight(255),
wavePreviewInit(true),
pgSys(0),
pgAddr(0),
pgVal(0),
curQueryRangeX(false),
curQueryBackwards(false),
curQueryRangeXMin(0), curQueryRangeXMax(0),
curQueryRangeY(0),
curQueryEffectPos(0),
queryReplaceEffectCount(0),
queryReplaceEffectPos(0),
queryReplaceNoteMode(0),
queryReplaceInsMode(0),
queryReplaceVolMode(0),
queryReplaceNote(0),
queryReplaceIns(0),
queryReplaceVol(0),
queryReplaceNoteDo(false),
queryReplaceInsDo(false),
queryReplaceVolDo(false),
wavePreviewOn(false),
wavePreviewKey((SDL_Scancode)0),
wavePreviewNote(0),
@ -4624,4 +4643,11 @@ FurnaceGUI::FurnaceGUI():
memset(pianoKeyHit,0,sizeof(float)*180);
memset(pianoKeyPressed,0,sizeof(bool)*180);
memset(queryReplaceEffectMode,0,sizeof(int)*8);
memset(queryReplaceEffectValMode,0,sizeof(int)*8);
memset(queryReplaceEffect,0,sizeof(int)*8);
memset(queryReplaceEffectVal,0,sizeof(int)*8);
memset(queryReplaceEffectDo,0,sizeof(bool)*8);
memset(queryReplaceEffectValDo,0,sizeof(bool)*8);
}

View file

@ -1171,7 +1171,7 @@ class FurnaceGUI {
int pgSys, pgAddr, pgVal;
std::vector<FurnaceGUIFindQuery> curQuery;
bool curQueryRangeX, curQueryFromStart, curQueryBackwards;
bool curQueryRangeX, curQueryBackwards;
int curQueryRangeXMin, curQueryRangeXMax;
int curQueryRangeY;
int curQueryEffectPos;

View file

@ -25,6 +25,7 @@ const int _THREE=3;
const int _SEVEN=7;
const int _TEN=10;
const int _FIFTEEN=15;
const int _SIXTEEN=16;
const int _THIRTY_ONE=31;
const int _SIXTY_FOUR=64;
const int _ONE_HUNDRED=100;

View file

@ -27,6 +27,7 @@ extern const int _THREE;
extern const int _SEVEN;
extern const int _TEN;
extern const int _FIFTEEN;
extern const int _SIXTEEN;
extern const int _THIRTY_ONE;
extern const int _SIXTY_FOUR;
extern const int _ONE_HUNDRED;