prepare for find and replace window

This commit is contained in:
tildearrow 2022-06-06 05:03:19 -05:00
parent 64fa5f804b
commit 9edc4818b5
6 changed files with 51 additions and 39 deletions

View file

@ -494,6 +494,7 @@ src/gui/doAction.cpp
src/gui/editing.cpp
src/gui/editControls.cpp
src/gui/effectList.cpp
src/gui/findReplace.cpp
src/gui/insEdit.cpp
src/gui/log.cpp
src/gui/mixer.cpp

View file

@ -250,6 +250,9 @@ void FurnaceGUI::doAction(int what) {
case GUI_ACTION_WINDOW_CHAN_OSC:
nextWindow=GUI_WINDOW_CHAN_OSC;
break;
case GUI_ACTION_WINDOW_FIND:
nextWindow=GUI_WINDOW_FIND;
break;
case GUI_ACTION_COLLAPSE_WINDOW:
collapseWindow=true;
@ -331,6 +334,9 @@ void FurnaceGUI::doAction(int what) {
case GUI_WINDOW_CHAN_OSC:
chanOscOpen=false;
break;
case GUI_WINDOW_FIND:
findOpen=false;
break;
default:
break;
}

19
src/gui/findReplace.cpp Normal file
View file

@ -0,0 +1,19 @@
#include "gui.h"
#include "imgui.h"
#include "IconsFontAwesome4.h"
#include "misc/cpp/imgui_stdlib.h"
void FurnaceGUI::drawFindReplace() {
if (nextWindow==GUI_WINDOW_FIND) {
findOpen=true;
ImGui::SetNextWindowFocus();
nextWindow=GUI_WINDOW_NOTHING;
}
if (!findOpen) return;
ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale));
if (ImGui::Begin("Find/Replace",&findOpen,globalWinFlags)) {
ImGui::Text("What am I gonna do with you?");
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_FIND;
ImGui::End();
}

View file

@ -1899,6 +1899,12 @@ void FurnaceGUI::processDrags(int dragX, int dragY) {
void FurnaceGUI::editOptions(bool topMenu) {
char id[4096];
editOptsVisible=true;
if (topMenu) {
ImGui::Text("...");
ImGui::Separator();
}
if (ImGui::MenuItem("cut",BIND_FOR(GUI_ACTION_PAT_CUT))) doCopy(true);
if (ImGui::MenuItem("copy",BIND_FOR(GUI_ACTION_PAT_COPY))) doCopy(false);
if (ImGui::MenuItem("paste",BIND_FOR(GUI_ACTION_PAT_PASTE))) doPaste();
@ -2200,6 +2206,17 @@ void FurnaceGUI::editOptions(bool topMenu) {
if (ImGui::MenuItem("collapse",BIND_FOR(GUI_ACTION_PAT_COLLAPSE_ROWS))) doCollapse(2);
if (ImGui::MenuItem("expand",BIND_FOR(GUI_ACTION_PAT_EXPAND_ROWS))) doExpand(2);
if (topMenu) {
ImGui::Separator();
if (ImGui::MenuItem("find/replace",BIND_FOR(GUI_ACTION_WINDOW_FIND),findOpen)) {
if (findOpen) {
findOpen=false;
} else {
nextWindow=GUI_WINDOW_FIND;
}
}
}
/*if (topMenu) {
ImGui::Separator();
ImGui::MenuItem("collapse pattern",BIND_FOR(GUI_ACTION_PAT_COLLAPSE_PAT));
@ -3084,6 +3101,7 @@ bool FurnaceGUI::loop() {
ImGui::DockSpaceOverViewport(NULL,lockLayout?(ImGuiDockNodeFlags_NoWindowMenuButton|ImGuiDockNodeFlags_NoMove|ImGuiDockNodeFlags_NoResize|ImGuiDockNodeFlags_NoCloseButton|ImGuiDockNodeFlags_NoDocking|ImGuiDockNodeFlags_NoDockingSplitMe|ImGuiDockNodeFlags_NoDockingSplitOther):0);
drawSubSongs();
drawFindReplace();
drawPattern();
drawEditControls();
drawSongInfo();
@ -4382,35 +4400,7 @@ FurnaceGUI::FurnaceGUI():
effectListOpen(false),
chanOscOpen(false),
subSongsOpen(true),
/*
editControlsDocked(false),
ordersDocked(false),
insListDocked(false),
songInfoDocked(false),
patternDocked(false),
insEditDocked(false),
waveListDocked(false),
waveEditDocked(false),
sampleListDocked(false),
sampleEditDocked(false),
aboutDocked(false),
settingsDocked(false),
mixerDocked(false),
debugDocked(false),
inspectorDocked(false),
oscDocked(false),
volMeterDocked(false),
statsDocked(false),
compatFlagsDocked(false),
pianoDocked(false),
notesDocked(false),
channelsDocked(false),
regViewDocked(false),
logDocked(false),
effectListDocked(false),
chanOscDocked(false),
subSongsDocked(false),
*/
findOpen(false),
selecting(false),
selectingFull(false),
curNibble(false),

View file

@ -245,7 +245,8 @@ enum FurnaceGUIWindows {
GUI_WINDOW_LOG,
GUI_WINDOW_EFFECT_LIST,
GUI_WINDOW_CHAN_OSC,
GUI_WINDOW_SUBSONGS
GUI_WINDOW_SUBSONGS,
GUI_WINDOW_FIND
};
enum FurnaceGUIFileDialogs {
@ -354,6 +355,7 @@ enum FurnaceGUIActions {
GUI_ACTION_WINDOW_EFFECT_LIST,
GUI_ACTION_WINDOW_CHAN_OSC,
GUI_ACTION_WINDOW_SUBSONGS,
GUI_ACTION_WINDOW_FIND,
GUI_ACTION_COLLAPSE_WINDOW,
GUI_ACTION_CLOSE_WINDOW,
@ -1078,15 +1080,7 @@ class FurnaceGUI {
bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen;
bool mixerOpen, debugOpen, inspectorOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen;
bool pianoOpen, notesOpen, channelsOpen, regViewOpen, logOpen, effectListOpen, chanOscOpen;
bool subSongsOpen;
/* there ought to be a better way...
bool editControlsDocked, ordersDocked, insListDocked, songInfoDocked, patternDocked, insEditDocked;
bool waveListDocked, waveEditDocked, sampleListDocked, sampleEditDocked, aboutDocked, settingsDocked;
bool mixerDocked, debugDocked, inspectorDocked, oscDocked, volMeterDocked, statsDocked, compatFlagsDocked;
bool pianoDocked, notesDocked, channelsDocked, regViewDocked, logDocked, effectListDocked, chanOscDocked;
bool subSongsDocked;
*/
bool subSongsOpen, findOpen;
SelectionPoint selStart, selEnd, cursor;
bool selecting, selectingFull, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
@ -1355,6 +1349,7 @@ class FurnaceGUI {
void drawLog();
void drawEffectList();
void drawSubSongs();
void drawFindReplace();
void parseKeybinds();
void promptKey(int which);

View file

@ -492,6 +492,7 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={
D("WINDOW_SUBSONGS", "Subsongs", 0),
D("EFFECT_LIST", "Effect List", 0),
D("WINDOW_CHAN_OSC", "Oscilloscope (per-channel)", 0),
D("WINDOW_FIND", "Find/Replace", FURKMOD_CMD|SDLK_f),
D("COLLAPSE_WINDOW", "Collapse/expand current window", 0),
D("CLOSE_WINDOW", "Close current window", FURKMOD_SHIFT|SDLK_ESCAPE),