GUI: re-enable user presets option

This commit is contained in:
tildearrow 2024-04-09 14:34:13 -05:00
parent 8b43d5a488
commit 40f62aa13e
5 changed files with 27 additions and 5 deletions

View file

@ -1,6 +1,5 @@
# to-do for 0.6.3
- compress fonts further if possible
- 9xxx for more chips
- user presets

View file

@ -595,6 +595,10 @@ void FurnaceGUI::drawMobileControls() {
if (ImGui::Button("CV")) {
cvOpen=!cvOpen;
}
ImGui::SameLine();
if (ImGui::Button("Presets")) {
userPresetsOpen=!userPresetsOpen;
}
ImGui::Separator();

View file

@ -4391,11 +4391,9 @@ bool FurnaceGUI::loop() {
toggleMobileUI(!mobileUI);
}
#endif
/*
if (ImGui::MenuItem("manage presets...",BIND_FOR(GUI_ACTION_WINDOW_USER_PRESETS))) {
userPresetsOpen=true;
}
*/
if (ImGui::MenuItem("settings...",BIND_FOR(GUI_ACTION_WINDOW_SETTINGS))) {
syncSettings();
settingsOpen=true;

View file

@ -2527,6 +2527,8 @@ class FurnaceGUI {
// user presets window
int selectedUserPreset;
std::vector<int> selectedUserPresetSub;
std::vector<String> randomDemoSong;
void drawExportAudio(bool onWindow=false);
@ -2610,6 +2612,7 @@ class FurnaceGUI {
void sampleListItem(int index, int dir, int asset);
void drawSysDefs(std::vector<FurnaceGUISysDef>& category, bool& accepted, std::vector<int>& sysDefStack);
void printPresets(std::vector<FurnaceGUISysDef>& items, int depth);
void toggleMobileUI(bool enable, bool force=false);

View file

@ -2430,10 +2430,8 @@ void FurnaceGUI::initSystemPresets() {
);
CATEGORY_END;
/*
CATEGORY_BEGIN("User","system presets that you have saved.");
CATEGORY_END;
*/
CATEGORY_BEGIN("FM","chips which use frequency modulation (FM) to generate sound.\nsome of these also pack more (like square and sample channels).");
ENTRY(
@ -3398,6 +3396,19 @@ bool FurnaceGUI::saveUserPresets(bool redundancy) {
}
// user presets management
void FurnaceGUI::printPresets(std::vector<FurnaceGUISysDef>& items, int depth) {
if (depth>0) ImGui::Indent();
for (FurnaceGUISysDef& i: items) {
if (ImGui::Selectable(i.name.c_str())) {
// TODO
}
if (!i.subDefs.empty()) {
printPresets(i.subDefs,depth+1);
}
}
if (depth>0) ImGui::Unindent();
}
void FurnaceGUI::drawUserPresets() {
if (nextWindow==GUI_WINDOW_USER_PRESETS) {
userPresetsOpen=true;
@ -3414,16 +3425,23 @@ void FurnaceGUI::drawUserPresets() {
}
}
//std::vector<int> depthStack;
if (userCategory==NULL) {
ImGui::Text("Error! User category does not exist!");
} else if (ImGui::BeginTable("UserPresets",2,ImGuiTableFlags_BordersInnerV)) {
// preset list
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("Presets...");
printPresets(userCategory->systems,0);
// editor
ImGui::TableNextColumn();
if (selectedUserPreset<0 || selectedUserPreset>=(int)userCategory->systems.size()) {
ImGui::Text("select a preset");
} else {
ImGui::Text("Edit...");
}