From 0060ea507a1cba64a100741745aed4b01942b498 Mon Sep 17 00:00:00 2001 From: YohananDiamond Date: Tue, 15 Aug 2023 18:37:30 -0300 Subject: [PATCH] command palette: support for changing (selection's) instrument --- src/gui/commandPalette.cpp | 9 +++++++++ src/gui/commandPalette.h | 1 + src/gui/doAction.cpp | 4 ++++ src/gui/gui.h | 1 + src/gui/guiConst.cpp | 3 ++- 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gui/commandPalette.cpp b/src/gui/commandPalette.cpp index c313a963c..cca76ca03 100644 --- a/src/gui/commandPalette.cpp +++ b/src/gui/commandPalette.cpp @@ -59,6 +59,9 @@ void FurnaceGUI::drawPalette() { case CMDPAL_TYPE_SAMPLES: hint="Search samples..."; break; + case CMDPAL_TYPE_INSTRUMENT_CHANGE: + hint="Search instruments (to change to)..."; + break; } if (ImGui::InputTextWithHint("##CommandPaletteSearch",hint,&paletteQuery) || paletteFirstFrame) { @@ -83,6 +86,7 @@ void FurnaceGUI::drawPalette() { break; case CMDPAL_TYPE_INSTRUMENTS: + case CMDPAL_TYPE_INSTRUMENT_CHANGE: if (matchFuzzy("- None -",paletteQuery.c_str())) { paletteSearchResults.push_back(0); } @@ -136,6 +140,7 @@ void FurnaceGUI::drawPalette() { s=recentFile.at(id).c_str(); break; case CMDPAL_TYPE_INSTRUMENTS: + case CMDPAL_TYPE_INSTRUMENT_CHANGE: if (id==0) { s="- None -"; } else { @@ -194,6 +199,10 @@ void FurnaceGUI::drawPalette() { curSample=i; break; + case CMDPAL_TYPE_INSTRUMENT_CHANGE: + doChangeIns(i-1); + break; + default: logE("invalid command palette type"); break; diff --git a/src/gui/commandPalette.h b/src/gui/commandPalette.h index 308b2b8fc..a1753afe5 100644 --- a/src/gui/commandPalette.h +++ b/src/gui/commandPalette.h @@ -22,6 +22,7 @@ enum CommandPaletteType { CMDPAL_TYPE_RECENT, CMDPAL_TYPE_INSTRUMENTS, CMDPAL_TYPE_SAMPLES, + CMDPAL_TYPE_INSTRUMENT_CHANGE, // a menu to select wavetables is beyond scope (they can't be put as strings) // TODO: are there more? diff --git a/src/gui/doAction.cpp b/src/gui/doAction.cpp index 545eeeff6..d2efceaf3 100644 --- a/src/gui/doAction.cpp +++ b/src/gui/doAction.cpp @@ -202,6 +202,10 @@ void FurnaceGUI::doAction(int what) { displayPalette=true; curPaletteType=CMDPAL_TYPE_SAMPLES; break; + case GUI_ACTION_CMDPAL_INSTRUMENT_CHANGE: + displayPalette=true; + curPaletteType=CMDPAL_TYPE_INSTRUMENT_CHANGE; + break; case GUI_ACTION_WINDOW_EDIT_CONTROLS: nextWindow=GUI_WINDOW_EDIT_CONTROLS; break; diff --git a/src/gui/gui.h b/src/gui/gui.h index 7e60e3b43..2579587ff 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -519,6 +519,7 @@ enum FurnaceGUIActions { GUI_ACTION_CMDPAL_RECENT, GUI_ACTION_CMDPAL_INSTRUMENTS, GUI_ACTION_CMDPAL_SAMPLES, + GUI_ACTION_CMDPAL_INSTRUMENT_CHANGE, GUI_ACTION_CMDPAL_MAX, GUI_ACTION_WINDOW_EDIT_CONTROLS, diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index e2149f34c..bfa12c994 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -566,6 +566,7 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={ D("CMDPAL_RECENT", "Recent files (Palette)", 0), D("CMDPAL_INSTRUMENTS", "Instruments (Palette)", 0), D("CMDPAL_SAMPLES", "Samples (Palette)", 0), + D("CMDPAL_INSTRUMENT_CHANGE", "Change instrument (Palette)", 0), D("CMDPAL_MAX", "", NOT_AN_ACTION), D("WINDOW_EDIT_CONTROLS", "Edit Controls", 0), @@ -1270,4 +1271,4 @@ const char* chipCategoryNames[]={ const char* insIcons[]={ ICON_FA_AREA_CHART, -}; \ No newline at end of file +};