diff --git a/src/gui/commandPalette.cpp b/src/gui/commandPalette.cpp index d3744741b..af38fa1ac 100644 --- a/src/gui/commandPalette.cpp +++ b/src/gui/commandPalette.cpp @@ -76,6 +76,26 @@ void FurnaceGUI::drawPalette() { } break; + case CMDPAL_TYPE_INSTRUMENTS: + if (matchFuzzy("- None -",paletteQuery.c_str())) { + paletteSearchResults.push_back(0); + } + for (int i=0; isong.insLen; i++) { + if (matchFuzzy(e->song.ins[i]->name.c_str(),paletteQuery.c_str())) { + paletteSearchResults.push_back(i+1); // because over here ins=0 is 'None' + } + } + break; + + case CMDPAL_TYPE_SAMPLES: + for (int i=0; isong.sampleLen; i++) { + logD("ins #%x: %s", i, e->song.sample[i]->name.c_str()); + if (matchFuzzy(e->song.sample[i]->name.c_str(),paletteQuery.c_str())) { + paletteSearchResults.push_back(i); + } + } + break; + default: logE("invalid command palette type"); ImGui::CloseCurrentPopup(); @@ -109,13 +129,21 @@ void FurnaceGUI::drawPalette() { case CMDPAL_TYPE_RECENT: s=recentFile.at(id).c_str(); break; + case CMDPAL_TYPE_INSTRUMENTS: + if (id==0) { + s="- None -"; + } else { + s=e->song.ins[id-1]->name.c_str(); + } + break; + case CMDPAL_TYPE_SAMPLES: + s=e->song.sample[id]->name.c_str(); + break; default: logE("invalid command palette type"); break; }; - logD("~ %d, %d", curPaletteType, s == nullptr); - if (ImGui::Selectable(s,current)) { curPaletteChoice=i; accepted=true; @@ -147,24 +175,34 @@ void FurnaceGUI::drawPalette() { int i=paletteSearchResults[curPaletteChoice]; switch (curPaletteType) { case CMDPAL_TYPE_MAIN: - resetPalette(this); doAction(i); if (i