command palette: instrument and sample menus
won't be doing for wavetables because they don't have text and that would be impossible to search through with a keyboard
This commit is contained in:
parent
00ee72269f
commit
51148a729c
5 changed files with 55 additions and 4 deletions
|
|
@ -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; i<e->song.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; i<e->song.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<GUI_ACTION_CMDPAL_MIN || GUI_ACTION_CMDPAL_MAX<i) {
|
||||
// TODO: maybe instead of this, just re-open the dialog from the doAction code. it'll be much simpler than this corny mess I made
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
break;
|
||||
|
||||
case CMDPAL_TYPE_RECENT:
|
||||
resetPalette(this);
|
||||
openRecentFile(recentFile.at(i));
|
||||
ImGui::CloseCurrentPopup();
|
||||
break;
|
||||
|
||||
case CMDPAL_TYPE_INSTRUMENTS:
|
||||
curIns=i-1;
|
||||
ImGui::CloseCurrentPopup();
|
||||
break;
|
||||
|
||||
case CMDPAL_TYPE_SAMPLES:
|
||||
curSample=i;
|
||||
ImGui::CloseCurrentPopup();
|
||||
break;
|
||||
|
||||
default:
|
||||
logE("invalid command palette type");
|
||||
ImGui::CloseCurrentPopup();
|
||||
break;
|
||||
};
|
||||
resetPalette(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue