From 40a4c9dfdd464d1ac27aca687ce112c25251cc8d Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Tue, 8 Oct 2024 18:36:20 +0400 Subject: [PATCH 01/61] le new settings code --- src/gui/gui.cpp | 2 + src/gui/gui.h | 56 ++++++++++++++++++++ src/gui/settings.cpp | 118 +++++++++++++++++++++++++++++++++++++++++++ src/gui/settings.h | 21 ++++++++ 4 files changed, 197 insertions(+) create mode 100644 src/gui/settings.h diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index c3b35f387e..95c047a7f7 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -8978,4 +8978,6 @@ FurnaceGUI::FurnaceGUI(): strncpy(macroRelLabel,"REL",32); strncpy(emptyLabel,"...",32); strncpy(emptyLabel2,"..",32); + + setupSettingsCategories(); } diff --git a/src/gui/gui.h b/src/gui/gui.h index 21fa0d3421..9d0dcc8ae2 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1600,6 +1600,53 @@ struct PendingDrawOsc { struct FurnaceCV; +enum SettingsTypes { + SETTING_CHECKBOX +}; + +struct SettingDef { + void* data; + const char* name; + const char* tooltip; + SettingsTypes type; + + SettingDef(): + data(NULL), + name(NULL), + tooltip(NULL), + type((SettingsTypes)0) {} + + SettingDef(void* d, const char* n, const char* t, SettingsTypes p) { + data=d; + name=n; + tooltip=t; + type=p; + } +}; + +struct SettingsCategory { + int id; + const char* name; + std::vector children; + std::vector settings; + bool expandChild; + + SettingsCategory(): + id(0), + name(NULL), + children({}), + settings({}), + expandChild(false) {} + + SettingsCategory(int i, const char* n, std::initializer_list c, std::initializer_list s): + expandChild(false) { + id=i; + name=n; + children=c; + settings=s; + } +}; + class FurnaceGUI { DivEngine* e; @@ -1760,7 +1807,11 @@ class FurnaceGUI { int totalFiles; struct Settings { + SettingsCategory categories[10]; + SettingsCategory activeCategory; // yes a boring copy + ImGuiTextFilter filter; bool settingsChanged; + int mainFontSize, patFontSize, headFontSize, iconSize; int audioEngine; int audioQuality; @@ -2923,6 +2974,11 @@ class FurnaceGUI { void readConfig(DivConfig& conf, FurnaceGUISettingGroups groups=GUI_SETTINGS_ALL); void writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups=GUI_SETTINGS_ALL); + void setupSettingsCategories(); + void drawSettingsCategory(SettingsCategory* cat); + void drawSettingsCategories(); + void drawSettingsItems(); + void syncSettings(); void commitSettings(); void syncTutorial(); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index b9006af5f3..d95ae276b2 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -33,6 +33,7 @@ #include "misc/freetype/imgui_freetype.h" #include "scaling.h" #include +#include #ifdef _WIN32 #include @@ -347,6 +348,107 @@ const char* specificControls[18]={ ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \ if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; +#define SETTINGS_CHANGED settings.settingsChanged=true; + +void FurnaceGUI::setupSettingsCategories() { + settings.categories[0]=SettingsCategory(1,"General", + { + SettingsCategory(2,"child", + {}, + { + SettingDef(&settingsChanged, "setting", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 2", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 3", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 4", "its a setting", SETTING_CHECKBOX) + } + ),SettingsCategory(3,"child 2", + {}, + { + SettingDef(&settingsChanged, "setting", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 2", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 3", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 4", "its a setting", SETTING_CHECKBOX) + } + ) + }, + { + SettingDef(&settingsChanged, "general setting", "its a setting", SETTING_CHECKBOX) + } + ); + + settings.categories[1]=SettingsCategory(4,"General 2", + { + SettingsCategory(5,"child", + {}, + { + SettingDef(&settingsChanged, "setting", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 2", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 3", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 4", "its a setting", SETTING_CHECKBOX) + } + ),SettingsCategory(6,"child 2", + {}, + { + SettingDef(&settingsChanged, "setting", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 2", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 3", "its a setting", SETTING_CHECKBOX), + SettingDef(&settingsChanged, "setting 4", "its a setting", SETTING_CHECKBOX) + } + ) + }, + { + SettingDef(&settingsChanged, "general setting", "its a setting", SETTING_CHECKBOX) + } + ); +} + +void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { + if (cat->children.size()>0) { + ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_OpenOnDoubleClick; + if (settings.activeCategory.id==cat->id) f|=ImGuiTreeNodeFlags_Selected; + cat->expandChild=ImGui::TreeNodeEx(cat->name,f); + if (ImGui::IsItemClicked()) { + settings.activeCategory=*cat; + } + } else { // a lonely child... + if (ImGui::Selectable(cat->name,settings.activeCategory.id==cat->id)) { + settings.activeCategory=*cat; + } + } + if (cat->children.size()>0 && cat->expandChild) { + ImGui::Indent(); + for (SettingsCategory child:cat->children) drawSettingsCategory(&child); + ImGui::Unindent(); + ImGui::TreePop(); + } +} + +void FurnaceGUI::drawSettingsCategories() { + for (int i=0;i<2;i++) { + drawSettingsCategory(&settings.categories[i]); + } +} + +void FurnaceGUI::drawSettingsItems() { + if (settings.activeCategory.name==NULL) return; + for (SettingDef s:settings.activeCategory.settings) { + switch (s.type) { + case SETTING_CHECKBOX: { + if (ImGui::Checkbox(s.name, (bool*)s.data)) SETTINGS_CHANGED; + if (s.tooltip) { + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { + ImGui::SetTooltip("%s",s.tooltip); + } + } + break; + } + default: break; + } + } +} + String stripName(String what) { String ret; for (char& i: what) { @@ -570,6 +672,22 @@ void FurnaceGUI::drawSettings() { } if (ImGui::BeginTabBar("settingsTab")) { // NEW SETTINGS HERE + CONFIG_SECTION("test") { + CONFIG_SUBSECTION("here"); + if (ImGui::BeginTable("set3", 2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if (ImGui::BeginChild("SettingCategories",ImGui::GetContentRegionAvail(),false)) { + settings.filter.Draw(_("Search")); + drawSettingsCategories(); + ImGui::EndChild(); + } + ImGui::TableNextColumn(); + drawSettingsItems(); + ImGui::EndTable(); + } + END_SECTION; + } CONFIG_SECTION(_("General")) { // SUBSECTION PROGRAM CONFIG_SUBSECTION(_("Program")); diff --git a/src/gui/settings.h b/src/gui/settings.h new file mode 100644 index 0000000000..908df72e5c --- /dev/null +++ b/src/gui/settings.h @@ -0,0 +1,21 @@ +/** + * Furnace Tracker - multi-system chiptune tracker + * Copyright (C) 2021-2024 tildearrow and contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +// handy macros and stuff go here + From 64fbdc22e1662ef9fd20b60f02e7cefae348ccc4 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 9 Oct 2024 14:52:35 +0400 Subject: [PATCH 02/61] redo with abstract classes --- src/gui/gui.h | 76 +++++++++++++++------------------- src/gui/settings.cpp | 63 +++++++++-------------------- src/gui/settings.h | 21 ---------- src/gui/settingsDef.h | 94 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+), 108 deletions(-) delete mode 100644 src/gui/settings.h create mode 100644 src/gui/settingsDef.h diff --git a/src/gui/gui.h b/src/gui/gui.h index 9d0dcc8ae2..976ba29555 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1600,51 +1600,41 @@ struct PendingDrawOsc { struct FurnaceCV; -enum SettingsTypes { - SETTING_CHECKBOX -}; - -struct SettingDef { - void* data; - const char* name; - const char* tooltip; - SettingsTypes type; - - SettingDef(): - data(NULL), - name(NULL), - tooltip(NULL), - type((SettingsTypes)0) {} - - SettingDef(void* d, const char* n, const char* t, SettingsTypes p) { - data=d; - name=n; - tooltip=t; - type=p; - } +class SettingDef { + void* data; + String name; + const char* friendlyName; + const char* tooltip; + public: + virtual void drawSetting(bool& changed); + virtual void saveSetting(DivConfig* conf); + virtual void loadSetting(DivConfig* conf); }; -struct SettingsCategory { - int id; - const char* name; - std::vector children; - std::vector settings; - bool expandChild; - - SettingsCategory(): - id(0), - name(NULL), - children({}), - settings({}), - expandChild(false) {} - - SettingsCategory(int i, const char* n, std::initializer_list c, std::initializer_list s): - expandChild(false) { - id=i; - name=n; - children=c; - settings=s; - } +class SettingsCategory { + public: + int id; + const char* name; + std::vector children; + std::vector settings; + bool expandChild; + void saveCaterofySettings(); + void loadCategorySettings(); + + SettingsCategory(): + id(0), + name(NULL), + children({}), + settings({}), + expandChild(false) {} + + SettingsCategory(int i, const char* n, std::initializer_list c, std::initializer_list s): + expandChild(false) { + id=i; + name=n; + children=c; + settings=s; + } }; class FurnaceGUI { diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index d95ae276b2..2fb3e483ee 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -46,6 +46,8 @@ #include #endif +#include "settingsDef.h" + #define DEFAULT_NOTE_KEYS "5:7;6:4;7:3;8:16;10:6;11:8;12:24;13:10;16:11;17:9;18:26;19:28;20:12;21:17;22:1;23:19;24:23;25:5;26:14;27:2;28:21;29:0;30:100;31:13;32:15;34:18;35:20;36:22;38:25;39:27;43:100;46:101;47:29;48:31;53:102;" #if defined(_WIN32) || defined(__APPLE__) || defined(IS_MOBILE) @@ -348,31 +350,27 @@ const char* specificControls[18]={ ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \ if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; -#define SETTINGS_CHANGED settings.settingsChanged=true; - void FurnaceGUI::setupSettingsCategories() { settings.categories[0]=SettingsCategory(1,"General", { SettingsCategory(2,"child", {}, { - SettingDef(&settingsChanged, "setting", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 2", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 3", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 4", "its a setting", SETTING_CHECKBOX) + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), } ),SettingsCategory(3,"child 2", {}, { - SettingDef(&settingsChanged, "setting", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 2", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 3", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 4", "its a setting", SETTING_CHECKBOX) + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), } ) }, { - SettingDef(&settingsChanged, "general setting", "its a setting", SETTING_CHECKBOX) + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), } ); @@ -381,23 +379,23 @@ void FurnaceGUI::setupSettingsCategories() { SettingsCategory(5,"child", {}, { - SettingDef(&settingsChanged, "setting", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 2", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 3", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 4", "its a setting", SETTING_CHECKBOX) + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), } ),SettingsCategory(6,"child 2", {}, { - SettingDef(&settingsChanged, "setting", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 2", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 3", "its a setting", SETTING_CHECKBOX), - SettingDef(&settingsChanged, "setting 4", "its a setting", SETTING_CHECKBOX) + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), } ) }, { - SettingDef(&settingsChanged, "general setting", "its a setting", SETTING_CHECKBOX) + new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), } ); } @@ -431,22 +429,7 @@ void FurnaceGUI::drawSettingsCategories() { void FurnaceGUI::drawSettingsItems() { if (settings.activeCategory.name==NULL) return; - for (SettingDef s:settings.activeCategory.settings) { - switch (s.type) { - case SETTING_CHECKBOX: { - if (ImGui::Checkbox(s.name, (bool*)s.data)) SETTINGS_CHANGED; - if (s.tooltip) { - ImGui::SameLine(); - ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { - ImGui::SetTooltip("%s",s.tooltip); - } - } - break; - } - default: break; - } - } + for (SettingDef* s:settings.activeCategory.settings) s->drawSetting(settingsChanged); } String stripName(String what) { @@ -4848,14 +4831,6 @@ void FurnaceGUI::drawKeybindSettingsTableRow(FurnaceGUIActions actionIdx) { ImGui::PopID(); // action } -#define clampSetting(x,minV,maxV) \ - if (xmaxV) { \ - x=maxV; \ - } - void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { if (groups&GUI_SETTINGS_GENERAL) { settings.renderDriver=conf.getString("renderDriver",""); diff --git a/src/gui/settings.h b/src/gui/settings.h deleted file mode 100644 index 908df72e5c..0000000000 --- a/src/gui/settings.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Furnace Tracker - multi-system chiptune tracker - * Copyright (C) 2021-2024 tildearrow and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -// handy macros and stuff go here - diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h new file mode 100644 index 0000000000..b36ea08dc1 --- /dev/null +++ b/src/gui/settingsDef.h @@ -0,0 +1,94 @@ +/** + * Furnace Tracker - multi-system chiptune tracker + * Copyright (C) 2021-2024 tildearrow and contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef SETTINGSDEF_H +#define SETTINGSDEF_H + +#define SETTINGS_CHANGED settingsChanged=true; + +#define clampSetting(x,minV,maxV) \ + if (xmaxV) { \ + x=maxV; \ + } + +#include "gui.h" +#include + +// abstract functions + +void SettingDef::drawSetting(bool& changed) { + ImGui::Text("%s",friendlyName); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) ImGui::SetTooltip("%s",tooltip); +} + +void SettingDef::saveSetting(DivConfig* conf) { + conf->set(name,*(int*)data); +} + +void SettingDef::loadSetting(DivConfig* conf) { + *(int*)data=conf->getInt(name, 0); +} + +// children + +class SettingDefCheckbox : public SettingDef { + void* data; + String name; + const char* friendlyName; + const char* tooltip; + + bool fallback; + public: + void drawSetting(bool& changed) { + if (ImGui::Checkbox(friendlyName, (bool*)data)) { + changed=true; + } + if (tooltip) { + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { + ImGui::SetTooltip("%s",tooltip); + } + } + } + void saveSetting(DivConfig* conf) { + conf->set(name,(*(bool*)data)?1:0); + } + void loadSetting(DivConfig* conf){ + *(bool*)data=conf->getInt(name, fallback?1:0); + clampSetting(*(bool*)data,0,1); + } + SettingDefCheckbox(): + data(NULL), + name(""), + friendlyName(""), + tooltip("") {} + SettingDefCheckbox(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + } +}; + +#endif From 4d77ecc92fe98de54b0d2937611752cb501b8fcf Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 9 Oct 2024 16:27:25 +0400 Subject: [PATCH 03/61] settings: more types, cleanup --- src/gui/settings.cpp | 3 +- src/gui/settingsDef.h | 231 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 229 insertions(+), 5 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 2fb3e483ee..52a3758c77 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -357,7 +357,8 @@ void FurnaceGUI::setupSettingsCategories() { {}, { new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefSliderInt(&settings.metroVol,"metroVol","Metronome volume","the volume of the metronome",100,0,200,"%d%%"), + new SettingDefSliderFloat(&settings.doubleClickTime,"doubleClickTime","Mouse double click time",NULL,0.3f,0.02f,1.0f,"%g s"), } ),SettingsCategory(3,"child 2", {}, diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index b36ea08dc1..42e881c719 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -20,8 +20,6 @@ #ifndef SETTINGSDEF_H #define SETTINGSDEF_H -#define SETTINGS_CHANGED settingsChanged=true; - #define clampSetting(x,minV,maxV) \ if (xset(name,(*(bool*)data)?1:0); } void loadSetting(DivConfig* conf){ - *(bool*)data=conf->getInt(name, fallback?1:0); - clampSetting(*(bool*)data,0,1); + *(int*)data=conf->getInt(name, fallback?1:0); + clampSetting(*(int*)data,0,1); } SettingDefCheckbox(): data(NULL), @@ -91,4 +89,229 @@ class SettingDefCheckbox : public SettingDef { } }; +class SettingDefSliderInt : public SettingDef { + void* data; + String name; + const char* friendlyName; + const char* tooltip; + + bool fallback; + int minV, maxV; + const char* sliderFmt; + ImGuiSliderFlags f; + public: + void drawSetting(bool& changed) { + if (ImGui::SliderInt(friendlyName, (int*)data, minV, maxV, sliderFmt, f)) { + clampSetting(*(int*)data, minV, maxV); + changed=true; + } + if (tooltip) { + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { + ImGui::SetTooltip("%s",tooltip); + } + } + } + void saveSetting(DivConfig* conf) { + conf->set(name,*(int*)data); + } + void loadSetting(DivConfig* conf){ + *(int*)data=conf->getInt(name, fallback); + clampSetting(*(int*)data,minV,maxV); + } + SettingDefSliderInt(): + data(NULL), + name(""), + friendlyName(""), + tooltip(""), + minV(0), + maxV(0), + sliderFmt(""), + f(0) {} + SettingDefSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max): + sliderFmt("%d"), + f(0) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + minV=min; + maxV=max; + } + SettingDefSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt): + f(0) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + minV=min; + maxV=max; + sliderFmt=fmt; + } + SettingDefSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt, ImGuiSliderFlags flags) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + minV=min; + maxV=max; + sliderFmt=fmt; + f=flags; + } +}; + +class SettingDefSliderFloat : public SettingDef { + void* data; + String name; + const char* friendlyName; + const char* tooltip; + + bool fallback; + float minV, maxV; + const char* sliderFmt; + ImGuiSliderFlags f; + public: + void drawSetting(bool& changed) { + if (ImGui::SliderFloat(friendlyName, (float*)data, minV, maxV, sliderFmt, f)) { + clampSetting(*(float*)data, minV, maxV); + changed=true; + } + if (tooltip) { + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { + ImGui::SetTooltip("%s",tooltip); + } + } + } + void saveSetting(DivConfig* conf) { + conf->set(name,*(float*)data); + } + void loadSetting(DivConfig* conf){ + *(float*)data=conf->getFloat(name, fallback); + clampSetting(*(float*)data,minV,maxV); + } + SettingDefSliderFloat(): + data(NULL), + name(""), + friendlyName(""), + tooltip(""), + minV(0), + maxV(0), + sliderFmt(""), + f(0) {} + SettingDefSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max): + sliderFmt("%g"), + f(0) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + minV=min; + maxV=max; + } + SettingDefSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max, const char* fmt): + f(0) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + minV=min; + maxV=max; + sliderFmt=fmt; + } + SettingDefSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max, const char* fmt, ImGuiSliderFlags flags) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + minV=min; + maxV=max; + sliderFmt=fmt; + f=flags; + } +}; + +class SettingDefInputInt : public SettingDef { + void* data; + String name; + const char* friendlyName; + const char* tooltip; + + bool fallback; + int minV, maxV; + const char* sliderFmt; + ImGuiInputTextFlags f; + public: + void drawSetting(bool& changed) { + if (ImGui::InputScalar(friendlyName, ImGuiDataType_S32, (int*)data, NULL, NULL, sliderFmt, f)) { + clampSetting(*(int*)data, minV, maxV); + changed=true; + } + if (tooltip) { + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { + ImGui::SetTooltip("%s",tooltip); + } + } + } + void saveSetting(DivConfig* conf) { + conf->set(name,*(int*)data); + } + void loadSetting(DivConfig* conf){ + *(int*)data=conf->getInt(name, fallback); + clampSetting(*(int*)data,minV,maxV); + } + SettingDefInputInt(): + data(NULL), + name(""), + friendlyName(""), + tooltip(""), + minV(0), + maxV(0), + sliderFmt(""), + f(0) {} + SettingDefInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max): + sliderFmt("%d"), + f(0) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + minV=min; + maxV=max; + } + SettingDefInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt): + f(0) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + minV=min; + maxV=max; + sliderFmt=fmt; + } + SettingDefInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt, ImGuiInputTextFlags flags) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + minV=min; + maxV=max; + sliderFmt=fmt; + f=flags; + } +}; + #endif From 0054a875690baa0207dfa09c4cf6b9cabfa46167 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 9 Oct 2024 16:43:31 +0400 Subject: [PATCH 04/61] prepare combo --- src/gui/settingsDef.h | 49 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index 42e881c719..d86d42c346 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -95,7 +95,7 @@ class SettingDefSliderInt : public SettingDef { const char* friendlyName; const char* tooltip; - bool fallback; + int fallback; int minV, maxV; const char* sliderFmt; ImGuiSliderFlags f; @@ -170,7 +170,7 @@ class SettingDefSliderFloat : public SettingDef { const char* friendlyName; const char* tooltip; - bool fallback; + float fallback; float minV, maxV; const char* sliderFmt; ImGuiSliderFlags f; @@ -245,7 +245,7 @@ class SettingDefInputInt : public SettingDef { const char* friendlyName; const char* tooltip; - bool fallback; + int fallback; int minV, maxV; const char* sliderFmt; ImGuiInputTextFlags f; @@ -314,4 +314,47 @@ class SettingDefInputInt : public SettingDef { } }; +class SettingDefDropdown : public SettingDef { + void* data; + String name; + const char* friendlyName; + const char* tooltip; + + bool fallback; + const char** options; + int optionsCount; + public: + void drawSetting(bool& changed) { + if (ImGui::Combo(friendlyName,(options[*(int*)data]),options,optionsCount)) { + changed=true; + } + if (tooltip) { + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { + ImGui::SetTooltip("%s",tooltip); + } + } + } + void saveSetting(DivConfig* conf) { + conf->set(name,(*(bool*)data)?1:0); + } + void loadSetting(DivConfig* conf){ + *(int*)data=conf->getInt(name, fallback?1:0); + clampSetting(*(int*)data,0,1); + } + SettingDefCheckbox(): + data(NULL), + name(""), + friendlyName(""), + tooltip("") {} + SettingDefCheckbox(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + } +}; + #endif From d92ab32a212665cfef5abb0f5918d811fa0632d1 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 9 Oct 2024 20:02:01 +0400 Subject: [PATCH 05/61] dropdown(combo) and radio settings --- src/gui/settings.cpp | 8 ++++ src/gui/settingsDef.h | 93 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 94 insertions(+), 7 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 52a3758c77..9fbf2187e6 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -290,6 +290,12 @@ const char* specificControls[18]={ _N("Effect 8 value") }; +const char* someRadioSettings[3]={ + "Yes", + "No", + "idk" +}; + #define SAMPLE_RATE_SELECTABLE(x) \ if (ImGui::Selectable(#x,settings.audioRate==x)) { \ settings.audioRate=x; \ @@ -359,6 +365,8 @@ void FurnaceGUI::setupSettingsCategories() { new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), new SettingDefSliderInt(&settings.metroVol,"metroVol","Metronome volume","the volume of the metronome",100,0,200,"%d%%"), new SettingDefSliderFloat(&settings.doubleClickTime,"doubleClickTime","Mouse double click time",NULL,0.3f,0.02f,1.0f,"%g s"), + new SettingDefDropdown(&settings.arcadeCore,"arcadeCore","YM2151 core",NULL,0,arcadeCores,2), + new SettingDefRadio(&settings.alwaysPlayIntro,"alwaysPlayIntro","Are you okay?",NULL,0,someRadioSettings,3), } ),SettingsCategory(3,"child 2", {}, diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index d86d42c346..926c0deb44 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -79,7 +79,8 @@ class SettingDefCheckbox : public SettingDef { data(NULL), name(""), friendlyName(""), - tooltip("") {} + tooltip(""), + fallback(0) {} SettingDefCheckbox(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback) { data=_data; name=_name; @@ -320,13 +321,20 @@ class SettingDefDropdown : public SettingDef { const char* friendlyName; const char* tooltip; - bool fallback; + int fallback; const char** options; int optionsCount; + ImGuiComboFlags f; public: void drawSetting(bool& changed) { - if (ImGui::Combo(friendlyName,(options[*(int*)data]),options,optionsCount)) { - changed=true; + if (ImGui::BeginCombo(friendlyName,options[*(int*)data],f)) { + for (unsigned short i=0; igetInt(name, fallback?1:0); clampSetting(*(int*)data,0,1); } - SettingDefCheckbox(): + SettingDefDropdown(): data(NULL), name(""), friendlyName(""), - tooltip("") {} - SettingDefCheckbox(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback) { + tooltip(""), + fallback(0), + options(NULL), + optionsCount(0), + f(0) {} + SettingDefDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount): + f(0) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + options=_options; + optionsCount=_optionsCount; + } + SettingDefDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + options=_options; + optionsCount=_optionsCount; + f=flags; + } +}; + +class SettingDefRadio : public SettingDef { + void* data; + String name; + const char* friendlyName; + const char* tooltip; + + int fallback; + const char** options; + int optionsCount; + public: + void drawSetting(bool& changed) { + ImGui::Text("%s",friendlyName); + ImGui::Indent(); + for (unsigned short i=0; iset(name,(*(bool*)data)?1:0); + } + void loadSetting(DivConfig* conf){ + *(int*)data=conf->getInt(name, fallback?1:0); + clampSetting(*(int*)data,0,1); + } + SettingDefRadio(): + data(NULL), + name(""), + friendlyName(""), + tooltip(""), + fallback(0), + options(NULL), + optionsCount(0) {} + SettingDefRadio(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount) { data=_data; name=_name; friendlyName=_friendlyName; tooltip=_tooltip; fallback=_fallback; + options=_options; + optionsCount=_optionsCount; } }; From 35dfdc12676b42a49701665d38a9466b5e133248 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Thu, 10 Oct 2024 17:35:38 +0400 Subject: [PATCH 06/61] settings searching --- src/gui/gui.h | 2 ++ src/gui/settings.cpp | 46 ++++++++++++++++++++++--------------------- src/gui/settingsDef.h | 31 ++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 23 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index bfc4e25f25..7c27bc0504 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1606,6 +1606,7 @@ class SettingDef { const char* friendlyName; const char* tooltip; public: + virtual bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat); virtual void drawSetting(bool& changed); virtual void saveSetting(DivConfig* conf); virtual void loadSetting(DivConfig* conf); @@ -2975,6 +2976,7 @@ class FurnaceGUI { void setupSettingsCategories(); void drawSettingsCategory(SettingsCategory* cat); void drawSettingsCategories(); + void searchDrawSettingItems(SettingsCategory* cat); void drawSettingsItems(); void syncSettings(); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 410d49fcc3..f48a54142e 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -363,23 +363,16 @@ void FurnaceGUI::setupSettingsCategories() { {}, { new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefSliderInt(&settings.metroVol,"metroVol","Metronome volume","the volume of the metronome",100,0,200,"%d%%"), - new SettingDefSliderFloat(&settings.doubleClickTime,"doubleClickTime","Mouse double click time",NULL,0.3f,0.02f,1.0f,"%g s"), - new SettingDefDropdown(&settings.arcadeCore,"arcadeCore","YM2151 core",NULL,0,arcadeCores,2), - new SettingDefRadio(&settings.alwaysPlayIntro,"alwaysPlayIntro","Are you okay?",NULL,0,someRadioSettings,3), } ),SettingsCategory(3,"child 2", {}, { - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefSliderInt(&settings.metroVol,"metroVol","Metronome volume","the volume of the metronome",100,0,200,"%d%%"), } ) }, { - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefRadio(&settings.alwaysPlayIntro,"alwaysPlayIntro","Are you okay?",NULL,0,someRadioSettings,3), } ); @@ -388,24 +381,16 @@ void FurnaceGUI::setupSettingsCategories() { SettingsCategory(5,"child", {}, { - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefDropdown(&settings.arcadeCore,"arcadeCore","YM2151 core",NULL,0,arcadeCores,2), } ),SettingsCategory(6,"child 2", {}, { - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), + new SettingDefSliderFloat(&settings.doubleClickTime,"doubleClickTime","Mouse double click time",NULL,0.3f,0.02f,1.0f,"%g s"), } ) }, - { - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - } + {} ); } @@ -436,9 +421,26 @@ void FurnaceGUI::drawSettingsCategories() { } } +void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { + if (cat->children.size()>0) { + for (SettingsCategory child:cat->children) { + searchDrawSettingItems(&child); + } + } + for (SettingDef* s:cat->settings) { + if (s->passesFilter(&settings.filter, 0b11)) s->drawSetting(settingsChanged); + } +} + void FurnaceGUI::drawSettingsItems() { - if (settings.activeCategory.name==NULL) return; - for (SettingDef* s:settings.activeCategory.settings) s->drawSetting(settingsChanged); + if (settings.filter.IsActive()) { + for (unsigned char i=0; i<2; i++) { + searchDrawSettingItems(&settings.categories[i]); + } + } else { + if (settings.activeCategory.name==NULL) return; + for (SettingDef* s:settings.activeCategory.settings) s->drawSetting(settingsChanged); + } } String stripName(String what) { diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index 926c0deb44..e1b06184a7 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -33,9 +33,14 @@ // abstract functions +bool SettingDef::passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { + return (filter->PassFilter(friendlyName) && (toWhat&1)) || + (filter->PassFilter(tooltip) && (toWhat&2)); +} + void SettingDef::drawSetting(bool& changed) { ImGui::Text("%s",friendlyName); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) ImGui::SetTooltip("%s",tooltip); + if (tooltip && ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) ImGui::SetTooltip("%s",tooltip); } void SettingDef::saveSetting(DivConfig* conf) { @@ -56,6 +61,10 @@ class SettingDefCheckbox : public SettingDef { bool fallback; public: + bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { + return (filter->PassFilter(friendlyName) && toWhat&1) || + (filter->PassFilter(tooltip) && toWhat&2); + } void drawSetting(bool& changed) { if (ImGui::Checkbox(friendlyName, (bool*)data)) { changed=true; @@ -101,6 +110,10 @@ class SettingDefSliderInt : public SettingDef { const char* sliderFmt; ImGuiSliderFlags f; public: + bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { + return (filter->PassFilter(friendlyName) && toWhat&1) || + (filter->PassFilter(tooltip) && toWhat&2); + } void drawSetting(bool& changed) { if (ImGui::SliderInt(friendlyName, (int*)data, minV, maxV, sliderFmt, f)) { clampSetting(*(int*)data, minV, maxV); @@ -176,6 +189,10 @@ class SettingDefSliderFloat : public SettingDef { const char* sliderFmt; ImGuiSliderFlags f; public: + bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { + return (filter->PassFilter(friendlyName) && toWhat&1) || + (filter->PassFilter(tooltip) && toWhat&2); + } void drawSetting(bool& changed) { if (ImGui::SliderFloat(friendlyName, (float*)data, minV, maxV, sliderFmt, f)) { clampSetting(*(float*)data, minV, maxV); @@ -251,6 +268,10 @@ class SettingDefInputInt : public SettingDef { const char* sliderFmt; ImGuiInputTextFlags f; public: + bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { + return (filter->PassFilter(friendlyName) && toWhat&1) || + (filter->PassFilter(tooltip) && toWhat&2); + } void drawSetting(bool& changed) { if (ImGui::InputScalar(friendlyName, ImGuiDataType_S32, (int*)data, NULL, NULL, sliderFmt, f)) { clampSetting(*(int*)data, minV, maxV); @@ -326,6 +347,10 @@ class SettingDefDropdown : public SettingDef { int optionsCount; ImGuiComboFlags f; public: + bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { + return (filter->PassFilter(friendlyName) && toWhat&1) || + (filter->PassFilter(tooltip) && toWhat&2); + } void drawSetting(bool& changed) { if (ImGui::BeginCombo(friendlyName,options[*(int*)data],f)) { for (unsigned short i=0; iPassFilter(friendlyName) && toWhat&1) || + (filter->PassFilter(tooltip) && toWhat&2); + } void drawSetting(bool& changed) { ImGui::Text("%s",friendlyName); ImGui::Indent(); From 1ba0ffb18eb682d04ce19fbb9dd0a05a3e4ff6b4 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Thu, 10 Oct 2024 18:03:33 +0400 Subject: [PATCH 07/61] t h e r e i s n o t h i n g y o u c a n d o --- src/gui/gui.h | 2 ++ src/gui/settings.cpp | 33 ++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 7c27bc0504..1b1fcb2085 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1802,6 +1802,7 @@ class FurnaceGUI { SettingsCategory activeCategory; // yes a boring copy ImGuiTextFilter filter; bool settingsChanged; + int searchDepth; int mainFontSize, patFontSize, headFontSize, iconSize; int audioEngine; @@ -2064,6 +2065,7 @@ class FurnaceGUI { Settings(): settingsChanged(false), + searchDepth(3), mainFontSize(GUI_FONT_SIZE_DEFAULT), patFontSize(GUI_FONT_SIZE_DEFAULT), headFontSize(27), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index f48a54142e..a2e0f069c7 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -402,17 +402,17 @@ void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { if (ImGui::IsItemClicked()) { settings.activeCategory=*cat; } + if (cat->expandChild) { + ImGui::Indent(); + for (SettingsCategory child:cat->children) drawSettingsCategory(&child); + ImGui::Unindent(); + ImGui::TreePop(); + } } else { // a lonely child... if (ImGui::Selectable(cat->name,settings.activeCategory.id==cat->id)) { settings.activeCategory=*cat; } } - if (cat->children.size()>0 && cat->expandChild) { - ImGui::Indent(); - for (SettingsCategory child:cat->children) drawSettingsCategory(&child); - ImGui::Unindent(); - ImGui::TreePop(); - } } void FurnaceGUI::drawSettingsCategories() { @@ -428,7 +428,7 @@ void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { } } for (SettingDef* s:cat->settings) { - if (s->passesFilter(&settings.filter, 0b11)) s->drawSetting(settingsChanged); + if (s->passesFilter(&settings.filter, settings.searchDepth)) s->drawSetting(settingsChanged); } } @@ -673,7 +673,26 @@ void FurnaceGUI::drawSettings() { ImGui::TableNextColumn(); if (ImGui::BeginChild("SettingCategories",ImGui::GetContentRegionAvail(),false)) { settings.filter.Draw(_("Search")); + ImGui::SameLine(); + ImGui::Button(ICON_FA_BARS "##SettingsSearchDepth"); + if (ImGui::BeginPopupContextItem("SettingsSearchDepth",ImGuiPopupFlags_MouseButtonLeft)) { + ImGui::Text("Search where:"); + ImGui::Indent(); + if (ImGui::RadioButton("Setting names", settings.searchDepth==1)) { + settings.searchDepth=1; + } + if (ImGui::RadioButton("Setting descriptions", settings.searchDepth==2)) { + settings.searchDepth=2; + } + if (ImGui::RadioButton("Setting names and descriptions", settings.searchDepth==3)) { + settings.searchDepth=3; + } + ImGui::Unindent(); + ImGui::EndPopup(); + } + drawSettingsCategories(); + ImGui::EndChild(); } ImGui::TableNextColumn(); From 9a8b92cd14a45fab92185fe79f9bbf9a5ed437e4 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Thu, 10 Oct 2024 19:04:40 +0400 Subject: [PATCH 08/61] remove useless func, array->stdvector, cleanup --- src/gui/gui.h | 3 +- src/gui/settings.cpp | 70 ++++++++++++++++---------------------------- 2 files changed, 27 insertions(+), 46 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 1b1fcb2085..91d8be0f72 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1798,7 +1798,7 @@ class FurnaceGUI { int totalFiles; struct Settings { - SettingsCategory categories[10]; + std::vector categories; SettingsCategory activeCategory; // yes a boring copy ImGuiTextFilter filter; bool settingsChanged; @@ -2977,7 +2977,6 @@ class FurnaceGUI { void setupSettingsCategories(); void drawSettingsCategory(SettingsCategory* cat); - void drawSettingsCategories(); void searchDrawSettingItems(SettingsCategory* cat); void drawSettingsItems(); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index a2e0f069c7..ea21db2583 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -356,42 +356,28 @@ const char* someRadioSettings[3]={ ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \ if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; +// NEW NEW SETTINGS HERE void FurnaceGUI::setupSettingsCategories() { - settings.categories[0]=SettingsCategory(1,"General", - { - SettingsCategory(2,"child", - {}, - { + settings.categories={ + SettingsCategory(1,"General",{ + SettingsCategory(2,"child",{},{ new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - } - ),SettingsCategory(3,"child 2", - {}, - { + }),SettingsCategory(3,"child 2",{},{ new SettingDefSliderInt(&settings.metroVol,"metroVol","Metronome volume","the volume of the metronome",100,0,200,"%d%%"), - } - ) - }, - { - new SettingDefRadio(&settings.alwaysPlayIntro,"alwaysPlayIntro","Are you okay?",NULL,0,someRadioSettings,3), - } - ); - - settings.categories[1]=SettingsCategory(4,"General 2", - { - SettingsCategory(5,"child", - {}, - { + }) + },{ + new SettingDefRadio(&settings.alwaysPlayIntro,"alwaysPlayIntro","Are you okay?",NULL,0,someRadioSettings,3), + } + ), + SettingsCategory(4,"General 2",{ + SettingsCategory(5,"child",{},{ new SettingDefDropdown(&settings.arcadeCore,"arcadeCore","YM2151 core",NULL,0,arcadeCores,2), - } - ),SettingsCategory(6,"child 2", - {}, - { + }),SettingsCategory(6,"child 2",{},{ new SettingDefSliderFloat(&settings.doubleClickTime,"doubleClickTime","Mouse double click time",NULL,0.3f,0.02f,1.0f,"%g s"), - } - ) - }, - {} - ); + }) + },{} + ) + }; } void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { @@ -415,12 +401,6 @@ void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { } } -void FurnaceGUI::drawSettingsCategories() { - for (int i=0;i<2;i++) { - drawSettingsCategory(&settings.categories[i]); - } -} - void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { if (cat->children.size()>0) { for (SettingsCategory child:cat->children) { @@ -434,8 +414,8 @@ void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { void FurnaceGUI::drawSettingsItems() { if (settings.filter.IsActive()) { - for (unsigned char i=0; i<2; i++) { - searchDrawSettingItems(&settings.categories[i]); + for (SettingsCategory cat:settings.categories) { + searchDrawSettingItems(&cat); } } else { if (settings.activeCategory.name==NULL) return; @@ -679,20 +659,22 @@ void FurnaceGUI::drawSettings() { ImGui::Text("Search where:"); ImGui::Indent(); if (ImGui::RadioButton("Setting names", settings.searchDepth==1)) { - settings.searchDepth=1; + settings.searchDepth=1; } if (ImGui::RadioButton("Setting descriptions", settings.searchDepth==2)) { - settings.searchDepth=2; + settings.searchDepth=2; } if (ImGui::RadioButton("Setting names and descriptions", settings.searchDepth==3)) { - settings.searchDepth=3; + settings.searchDepth=3; } ImGui::Unindent(); ImGui::EndPopup(); } - drawSettingsCategories(); - + for (SettingsCategory cat:settings.categories) { + drawSettingsCategory(&cat); + } + ImGui::EndChild(); } ImGui::TableNextColumn(); From c7d33f48850010f94b97544ea8f41d134626512c Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 11 Oct 2024 00:24:56 +0400 Subject: [PATCH 09/61] remove id (use const char ptr instead), redo window cat --- src/gui/gui.h | 5 +-- src/gui/settings.cpp | 95 +++++++++++++++++++++++++------------------- 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 91d8be0f72..88410e7cdc 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1614,7 +1614,6 @@ class SettingDef { class SettingsCategory { public: - int id; const char* name; std::vector children; std::vector settings; @@ -1623,15 +1622,13 @@ class SettingsCategory { void loadCategorySettings(); SettingsCategory(): - id(0), name(NULL), children({}), settings({}), expandChild(false) {} - SettingsCategory(int i, const char* n, std::initializer_list c, std::initializer_list s): + SettingsCategory(const char* n, std::initializer_list c, std::initializer_list s): expandChild(false) { - id=i; name=n; children=c; settings=s; diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index ea21db2583..0edd2edbe5 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -359,31 +359,45 @@ const char* someRadioSettings[3]={ // NEW NEW SETTINGS HERE void FurnaceGUI::setupSettingsCategories() { settings.categories={ - SettingsCategory(1,"General",{ - SettingsCategory(2,"child",{},{ + SettingsCategory("General",{ + SettingsCategory("child",{},{ new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - }),SettingsCategory(3,"child 2",{},{ + }),SettingsCategory("child 2",{},{ new SettingDefSliderInt(&settings.metroVol,"metroVol","Metronome volume","the volume of the metronome",100,0,200,"%d%%"), }) },{ new SettingDefRadio(&settings.alwaysPlayIntro,"alwaysPlayIntro","Are you okay?",NULL,0,someRadioSettings,3), } ), - SettingsCategory(4,"General 2",{ - SettingsCategory(5,"child",{},{ + SettingsCategory("General 2",{ + SettingsCategory("child",{},{ new SettingDefDropdown(&settings.arcadeCore,"arcadeCore","YM2151 core",NULL,0,arcadeCores,2), - }),SettingsCategory(6,"child 2",{},{ + }),SettingsCategory("child 2",{},{ new SettingDefSliderFloat(&settings.doubleClickTime,"doubleClickTime","Mouse double click time",NULL,0.3f,0.02f,1.0f,"%g s"), }) },{} - ) + ), + SettingsCategory("Window",{},{ +#ifndef IS_MOBILE + new SettingDefCheckbox(&settings.saveWindowPos,"saveWindowPos",_("Remember window position"),_("remembers the window's last position on start-up."),true), +#endif + new SettingDefCheckbox(&settings.moveWindowTitle,"moveWindowTitle",_("Only allow window movement when clicking on title bar"),NULL,true), + new SettingDefCheckbox(&settings.centerPopup,"centerPopup",_("Center pop-up windows"),NULL,true), + + new SettingDefCheckbox(&settings.roundedWindows,"roundedWindows",_("Rounded window corners"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingDefCheckbox(&settings.roundedButtons,"roundedButtons",_("Rounded buttons"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingDefCheckbox(&settings.roundedMenus,"roundedMenus",_("Rounded menu corners"),NULL,false), + new SettingDefCheckbox(&settings.roundedTabs,"roundedTabs",_("Rounded tabs"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingDefCheckbox(&settings.roundedScrollbars,"roundedScrollbars",_("Rounded scrollbars"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingDefCheckbox(&settings.frameBorders,"frameBorders",_("Borders around widgets"),NULL,false), + }) }; } void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { if (cat->children.size()>0) { ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_OpenOnDoubleClick; - if (settings.activeCategory.id==cat->id) f|=ImGuiTreeNodeFlags_Selected; + if (settings.activeCategory.name==cat->name) f|=ImGuiTreeNodeFlags_Selected; cat->expandChild=ImGui::TreeNodeEx(cat->name,f); if (ImGui::IsItemClicked()) { settings.activeCategory=*cat; @@ -395,7 +409,7 @@ void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { ImGui::TreePop(); } } else { // a lonely child... - if (ImGui::Selectable(cat->name,settings.activeCategory.id==cat->id)) { + if (ImGui::Selectable(cat->name,settings.activeCategory.name==cat->name)) { settings.activeCategory=*cat; } } @@ -648,39 +662,40 @@ void FurnaceGUI::drawSettings() { // NEW SETTINGS HERE CONFIG_SECTION("test") { CONFIG_SUBSECTION("here"); - if (ImGui::BeginTable("set3", 2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - if (ImGui::BeginChild("SettingCategories",ImGui::GetContentRegionAvail(),false)) { - settings.filter.Draw(_("Search")); - ImGui::SameLine(); - ImGui::Button(ICON_FA_BARS "##SettingsSearchDepth"); - if (ImGui::BeginPopupContextItem("SettingsSearchDepth",ImGuiPopupFlags_MouseButtonLeft)) { - ImGui::Text("Search where:"); - ImGui::Indent(); - if (ImGui::RadioButton("Setting names", settings.searchDepth==1)) { - settings.searchDepth=1; - } - if (ImGui::RadioButton("Setting descriptions", settings.searchDepth==2)) { - settings.searchDepth=2; - } - if (ImGui::RadioButton("Setting names and descriptions", settings.searchDepth==3)) { - settings.searchDepth=3; - } - ImGui::Unindent(); - ImGui::EndPopup(); - } - - for (SettingsCategory cat:settings.categories) { - drawSettingsCategory(&cat); - } - ImGui::EndChild(); - } - ImGui::TableNextColumn(); - drawSettingsItems(); - ImGui::EndTable(); + if (ImGui::BeginTable("set3", 2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if (ImGui::BeginChild("SettingCategories",ImGui::GetContentRegionAvail(),false)) { + settings.filter.Draw(_("Search")); + ImGui::SameLine(); + ImGui::Button(ICON_FA_BARS "##SettingsSearchDepth"); + if (ImGui::BeginPopupContextItem("SettingsSearchDepth",ImGuiPopupFlags_MouseButtonLeft)) { + ImGui::Text("Search where:"); + ImGui::Indent(); + if (ImGui::RadioButton("Setting names", settings.searchDepth==1)) { + settings.searchDepth=1; + } + if (ImGui::RadioButton("Setting descriptions", settings.searchDepth==2)) { + settings.searchDepth=2; + } + if (ImGui::RadioButton("Setting names and descriptions", settings.searchDepth==3)) { + settings.searchDepth=3; } + ImGui::Unindent(); + ImGui::EndPopup(); + } + for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); + ImGui::EndChild(); + } + ImGui::TableNextColumn(); + drawSettingsItems(); + if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { + ImGui::Text("gotta unlock them first!"); + } + ImGui::EndTable(); + } + END_SECTION; } CONFIG_SECTION(_("General")) { From 31cda970ef91e4834c778de9fd01fb372bff9309 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 11 Oct 2024 12:41:10 +0400 Subject: [PATCH 10/61] more settings --- src/gui/settings.cpp | 38 +++++++++++++++----------------------- src/gui/settingsDef.h | 14 +++++++------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 0edd2edbe5..d0f91caac6 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -290,10 +290,9 @@ const char* specificControls[18]={ _N("Effect 8 value") }; -const char* someRadioSettings[3]={ - "Yes", - "No", - "idk" +const char* oscRenderEngines[2]={ + _("ImGui line plot"), + _("GLSL (if available)") }; #define SAMPLE_RATE_SELECTABLE(x) \ @@ -359,25 +358,18 @@ const char* someRadioSettings[3]={ // NEW NEW SETTINGS HERE void FurnaceGUI::setupSettingsCategories() { settings.categories={ - SettingsCategory("General",{ - SettingsCategory("child",{},{ - new SettingDefCheckbox(&settings.audioHiPass,"audioHiPass","DC offset correction", "apply a high pass filter to the output to remove DC offsets from the audio",true), - }),SettingsCategory("child 2",{},{ - new SettingDefSliderInt(&settings.metroVol,"metroVol","Metronome volume","the volume of the metronome",100,0,200,"%d%%"), - }) - },{ - new SettingDefRadio(&settings.alwaysPlayIntro,"alwaysPlayIntro","Are you okay?",NULL,0,someRadioSettings,3), - } - ), - SettingsCategory("General 2",{ - SettingsCategory("child",{},{ - new SettingDefDropdown(&settings.arcadeCore,"arcadeCore","YM2151 core",NULL,0,arcadeCores,2), - }),SettingsCategory("child 2",{},{ - new SettingDefSliderFloat(&settings.doubleClickTime,"doubleClickTime","Mouse double click time",NULL,0.3f,0.02f,1.0f,"%g s"), - }) - },{} - ), - SettingsCategory("Window",{},{ + SettingsCategory("Window",{ + SettingsCategory("Oscilloscope",{},{ + new SettingDefRadio(&settings.shaderOsc,"shaderOsc",_("Oscilloscope rendering engine:"),_("render using either Dear ImGui's built-in line drawing functions or GLSL."),0,oscRenderEngines,2), + new SettingDefCheckbox(&settings.oscRoundedCorners,"oscRoundedCorners",_("Rounded corners"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingDefCheckbox(&settings.oscBorder,"oscBorder",_("Border"),NULL,1), + new SettingDefCheckbox(&settings.oscMono,"oscMono",_("Mono"),NULL,1), + new SettingDefCheckbox(&settings.oscAntiAlias,"oscAntiAlias",_("Anti-aliased"),NULL,1), + new SettingDefCheckbox(&settings.oscTakesEntireWindow,"oscTakesEntireWindow",_("Fill entire window"),NULL,0), + new SettingDefCheckbox(&settings.oscEscapesBoundary,"oscEscapesBoundary",_("Waveform goes out of bounds"),NULL,0), + new SettingDefSliderFloat(&settings.oscLineSize,"oscLineSize",_("Line size"),NULL,1.0f,0.25f,16.0f,"%.1f"), + }), + },{ #ifndef IS_MOBILE new SettingDefCheckbox(&settings.saveWindowPos,"saveWindowPos",_("Remember window position"),_("remembers the window's last position on start-up."),true), #endif diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index e1b06184a7..1a089b0f11 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -423,6 +423,13 @@ class SettingDefRadio : public SettingDef { } void drawSetting(bool& changed) { ImGui::Text("%s",friendlyName); + if (tooltip) { + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { + ImGui::SetTooltip("%s",tooltip); + } + } ImGui::Indent(); for (unsigned short i=0; iset(name,(*(bool*)data)?1:0); From 9090d4329a513190eeccd0be3752253d5a439c6e Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 11 Oct 2024 13:31:41 +0400 Subject: [PATCH 11/61] better search results, items in child --- src/gui/settings.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 255cf8cd25..38aee90d6f 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -413,8 +413,21 @@ void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { searchDrawSettingItems(&child); } } + bool anyFound=false; for (SettingDef* s:cat->settings) { - if (s->passesFilter(&settings.filter, settings.searchDepth)) s->drawSetting(settingsChanged); + if (s->passesFilter(&settings.filter, settings.searchDepth)) { + anyFound=true; + break; + } + } + if (anyFound) { + ImGui::Text("%s:",cat->name); + ImGui::Indent(); + for (SettingDef* s:cat->settings) { + if (s->passesFilter(&settings.filter, settings.searchDepth)) s->drawSetting(settingsChanged); + } + ImGui::Unindent(); + ImGui::Separator(); } } @@ -681,9 +694,12 @@ void FurnaceGUI::drawSettings() { ImGui::EndChild(); } ImGui::TableNextColumn(); - drawSettingsItems(); - if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { - ImGui::Text("gotta unlock them first!"); + if (ImGui::BeginChild("SettingsItems",ImGui::GetContentRegionAvail(),false)) { + drawSettingsItems(); + if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { + ImGui::Text("gotta unlock them first!"); + } + ImGui::EndChild(); } ImGui::EndTable(); } From 9f1cfd865ff5bf897ec8cedf7ab928067423aa03 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 11 Oct 2024 19:36:43 +0400 Subject: [PATCH 12/61] init active category, bullet text for search --- src/gui/settings.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 38aee90d6f..18a1260489 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -384,6 +384,8 @@ void FurnaceGUI::setupSettingsCategories() { new SettingDefCheckbox(&settings.frameBorders,"frameBorders",_("Borders around widgets"),NULL,false), }) }; + + settings.activeCategory=settings.categories[0]; } void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { @@ -421,7 +423,7 @@ void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { } } if (anyFound) { - ImGui::Text("%s:",cat->name); + ImGui::BulletText("%s",cat->name); ImGui::Indent(); for (SettingDef* s:cat->settings) { if (s->passesFilter(&settings.filter, settings.searchDepth)) s->drawSetting(settingsChanged); From a13d7150b661b229867598eb25a28496570eb20c Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 11 Oct 2024 23:55:31 +0400 Subject: [PATCH 13/61] dummy text dummy fixme: va_list of references --- src/gui/settings.cpp | 1 + src/gui/settingsDef.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 18a1260489..e15a3b2c38 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -360,6 +360,7 @@ void FurnaceGUI::setupSettingsCategories() { settings.categories={ SettingsCategory("Window",{ SettingsCategory("Oscilloscope",{},{ + new SettingDefDummyText("%c",&settingsChanged), new SettingDefRadio(&settings.shaderOsc,"shaderOsc",_("Oscilloscope rendering engine:"),_("render using either Dear ImGui's built-in line drawing functions or GLSL."),0,oscRenderEngines,2), new SettingDefCheckbox(&settings.oscRoundedCorners,"oscRoundedCorners",_("Rounded corners"),NULL,GUI_DECORATIONS_DEFAULT), new SettingDefCheckbox(&settings.oscBorder,"oscBorder",_("Border"),NULL,1), diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index 1a089b0f11..bec95b3924 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -20,6 +20,7 @@ #ifndef SETTINGSDEF_H #define SETTINGSDEF_H +#include #define clampSetting(x,minV,maxV) \ if (x Date: Sat, 12 Oct 2024 11:25:52 +0400 Subject: [PATCH 14/61] a --- src/gui/settingsDef.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index bec95b3924..ba2ff12f56 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -489,7 +489,6 @@ class SettingDefDummyText : public SettingDef { fmt(NULL) {} SettingDefDummyText(const char* _fmt, ...) { fmt=_fmt; - va_list args; va_start(args,_fmt); va_end(args); } From d2650557577945f461a93f255ace687b47e5a1f6 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Mon, 21 Oct 2024 15:43:23 +0400 Subject: [PATCH 15/61] how did this happen --- src/gui/gui.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 7ed5a01d04..6198495d79 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1798,7 +1798,6 @@ class FurnaceGUI { std::vector categories; SettingsCategory activeCategory; // yes a boring copy ImGuiTextFilter filter; - bool settingsChanged; int searchDepth; int mainFontSize, patFontSize, headFontSize, iconSize; @@ -2059,7 +2058,6 @@ class FurnaceGUI { DivConfig initialSys; Settings(): - settingsChanged(false), searchDepth(3), mainFontSize(GUI_FONT_SIZE_DEFAULT), patFontSize(GUI_FONT_SIZE_DEFAULT), From 20cb4c587024a6900a55518b14642d2564922c46 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Tue, 22 Oct 2024 13:45:45 +0400 Subject: [PATCH 16/61] drop "def" from setting items --- src/gui/settings.cpp | 38 ++++++++++++++--------------- src/gui/settingsDef.h | 56 +++++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index e15a3b2c38..8bb30ea9d6 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -360,29 +360,29 @@ void FurnaceGUI::setupSettingsCategories() { settings.categories={ SettingsCategory("Window",{ SettingsCategory("Oscilloscope",{},{ - new SettingDefDummyText("%c",&settingsChanged), - new SettingDefRadio(&settings.shaderOsc,"shaderOsc",_("Oscilloscope rendering engine:"),_("render using either Dear ImGui's built-in line drawing functions or GLSL."),0,oscRenderEngines,2), - new SettingDefCheckbox(&settings.oscRoundedCorners,"oscRoundedCorners",_("Rounded corners"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingDefCheckbox(&settings.oscBorder,"oscBorder",_("Border"),NULL,1), - new SettingDefCheckbox(&settings.oscMono,"oscMono",_("Mono"),NULL,1), - new SettingDefCheckbox(&settings.oscAntiAlias,"oscAntiAlias",_("Anti-aliased"),NULL,1), - new SettingDefCheckbox(&settings.oscTakesEntireWindow,"oscTakesEntireWindow",_("Fill entire window"),NULL,0), - new SettingDefCheckbox(&settings.oscEscapesBoundary,"oscEscapesBoundary",_("Waveform goes out of bounds"),NULL,0), - new SettingDefSliderFloat(&settings.oscLineSize,"oscLineSize",_("Line size"),NULL,1.0f,0.25f,16.0f,"%.1f"), + new SettingDummyText("%c",&settingsChanged), + new SettingRadio(&settings.shaderOsc,"shaderOsc",_("Oscilloscope rendering engine:"),_("render using either Dear ImGui's built-in line drawing functions or GLSL."),0,oscRenderEngines,2), + new SettingCheckbox(&settings.oscRoundedCorners,"oscRoundedCorners",_("Rounded corners"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.oscBorder,"oscBorder",_("Border"),NULL,1), + new SettingCheckbox(&settings.oscMono,"oscMono",_("Mono"),NULL,1), + new SettingCheckbox(&settings.oscAntiAlias,"oscAntiAlias",_("Anti-aliased"),NULL,1), + new SettingCheckbox(&settings.oscTakesEntireWindow,"oscTakesEntireWindow",_("Fill entire window"),NULL,0), + new SettingCheckbox(&settings.oscEscapesBoundary,"oscEscapesBoundary",_("Waveform goes out of bounds"),NULL,0), + new SettingSliderFloat(&settings.oscLineSize,"oscLineSize",_("Line size"),NULL,1.0f,0.25f,16.0f,"%.1f"), }), },{ #ifndef IS_MOBILE - new SettingDefCheckbox(&settings.saveWindowPos,"saveWindowPos",_("Remember window position"),_("remembers the window's last position on start-up."),true), + new SettingCheckbox(&settings.saveWindowPos,"saveWindowPos",_("Remember window position"),_("remembers the window's last position on start-up."),true), #endif - new SettingDefCheckbox(&settings.moveWindowTitle,"moveWindowTitle",_("Only allow window movement when clicking on title bar"),NULL,true), - new SettingDefCheckbox(&settings.centerPopup,"centerPopup",_("Center pop-up windows"),NULL,true), - - new SettingDefCheckbox(&settings.roundedWindows,"roundedWindows",_("Rounded window corners"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingDefCheckbox(&settings.roundedButtons,"roundedButtons",_("Rounded buttons"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingDefCheckbox(&settings.roundedMenus,"roundedMenus",_("Rounded menu corners"),NULL,false), - new SettingDefCheckbox(&settings.roundedTabs,"roundedTabs",_("Rounded tabs"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingDefCheckbox(&settings.roundedScrollbars,"roundedScrollbars",_("Rounded scrollbars"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingDefCheckbox(&settings.frameBorders,"frameBorders",_("Borders around widgets"),NULL,false), + new SettingCheckbox(&settings.moveWindowTitle,"moveWindowTitle",_("Only allow window movement when clicking on title bar"),NULL,true), + new SettingCheckbox(&settings.centerPopup,"centerPopup",_("Center pop-up windows"),NULL,true), + + new SettingCheckbox(&settings.roundedWindows,"roundedWindows",_("Rounded window corners"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.roundedButtons,"roundedButtons",_("Rounded buttons"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.roundedMenus,"roundedMenus",_("Rounded menu corners"),NULL,false), + new SettingCheckbox(&settings.roundedTabs,"roundedTabs",_("Rounded tabs"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.roundedScrollbars,"roundedScrollbars",_("Rounded scrollbars"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.frameBorders,"frameBorders",_("Borders around widgets"),NULL,false), }) }; diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index ba2ff12f56..b9fd3f15b9 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -54,7 +54,7 @@ void SettingDef::loadSetting(DivConfig* conf) { // children -class SettingDefCheckbox : public SettingDef { +class SettingCheckbox : public SettingDef { void* data; String name; const char* friendlyName; @@ -85,13 +85,13 @@ class SettingDefCheckbox : public SettingDef { *(int*)data=conf->getInt(name, fallback?1:0); clampSetting(*(int*)data,0,1); } - SettingDefCheckbox(): + SettingCheckbox(): data(NULL), name(""), friendlyName(""), tooltip(""), fallback(0) {} - SettingDefCheckbox(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback) { + SettingCheckbox(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback) { data=_data; name=_name; friendlyName=_friendlyName; @@ -100,7 +100,7 @@ class SettingDefCheckbox : public SettingDef { } }; -class SettingDefSliderInt : public SettingDef { +class SettingSliderInt : public SettingDef { void* data; String name; const char* friendlyName; @@ -135,7 +135,7 @@ class SettingDefSliderInt : public SettingDef { *(int*)data=conf->getInt(name, fallback); clampSetting(*(int*)data,minV,maxV); } - SettingDefSliderInt(): + SettingSliderInt(): data(NULL), name(""), friendlyName(""), @@ -144,7 +144,7 @@ class SettingDefSliderInt : public SettingDef { maxV(0), sliderFmt(""), f(0) {} - SettingDefSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max): + SettingSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max): sliderFmt("%d"), f(0) { data=_data; @@ -155,7 +155,7 @@ class SettingDefSliderInt : public SettingDef { minV=min; maxV=max; } - SettingDefSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt): + SettingSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt): f(0) { data=_data; name=_name; @@ -166,7 +166,7 @@ class SettingDefSliderInt : public SettingDef { maxV=max; sliderFmt=fmt; } - SettingDefSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt, ImGuiSliderFlags flags) { + SettingSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt, ImGuiSliderFlags flags) { data=_data; name=_name; friendlyName=_friendlyName; @@ -179,7 +179,7 @@ class SettingDefSliderInt : public SettingDef { } }; -class SettingDefSliderFloat : public SettingDef { +class SettingSliderFloat : public SettingDef { void* data; String name; const char* friendlyName; @@ -214,7 +214,7 @@ class SettingDefSliderFloat : public SettingDef { *(float*)data=conf->getFloat(name, fallback); clampSetting(*(float*)data,minV,maxV); } - SettingDefSliderFloat(): + SettingSliderFloat(): data(NULL), name(""), friendlyName(""), @@ -223,7 +223,7 @@ class SettingDefSliderFloat : public SettingDef { maxV(0), sliderFmt(""), f(0) {} - SettingDefSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max): + SettingSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max): sliderFmt("%g"), f(0) { data=_data; @@ -234,7 +234,7 @@ class SettingDefSliderFloat : public SettingDef { minV=min; maxV=max; } - SettingDefSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max, const char* fmt): + SettingSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max, const char* fmt): f(0) { data=_data; name=_name; @@ -245,7 +245,7 @@ class SettingDefSliderFloat : public SettingDef { maxV=max; sliderFmt=fmt; } - SettingDefSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max, const char* fmt, ImGuiSliderFlags flags) { + SettingSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max, const char* fmt, ImGuiSliderFlags flags) { data=_data; name=_name; friendlyName=_friendlyName; @@ -258,7 +258,7 @@ class SettingDefSliderFloat : public SettingDef { } }; -class SettingDefInputInt : public SettingDef { +class SettingInputInt : public SettingDef { void* data; String name; const char* friendlyName; @@ -293,7 +293,7 @@ class SettingDefInputInt : public SettingDef { *(int*)data=conf->getInt(name, fallback); clampSetting(*(int*)data,minV,maxV); } - SettingDefInputInt(): + SettingInputInt(): data(NULL), name(""), friendlyName(""), @@ -302,7 +302,7 @@ class SettingDefInputInt : public SettingDef { maxV(0), sliderFmt(""), f(0) {} - SettingDefInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max): + SettingInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max): sliderFmt("%d"), f(0) { data=_data; @@ -313,7 +313,7 @@ class SettingDefInputInt : public SettingDef { minV=min; maxV=max; } - SettingDefInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt): + SettingInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt): f(0) { data=_data; name=_name; @@ -324,7 +324,7 @@ class SettingDefInputInt : public SettingDef { maxV=max; sliderFmt=fmt; } - SettingDefInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt, ImGuiInputTextFlags flags) { + SettingInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt, ImGuiInputTextFlags flags) { data=_data; name=_name; friendlyName=_friendlyName; @@ -337,7 +337,7 @@ class SettingDefInputInt : public SettingDef { } }; -class SettingDefDropdown : public SettingDef { +class SettingDropdown : public SettingDef { void* data; String name; const char* friendlyName; @@ -377,7 +377,7 @@ class SettingDefDropdown : public SettingDef { *(int*)data=conf->getInt(name, fallback?1:0); clampSetting(*(int*)data,0,1); } - SettingDefDropdown(): + SettingDropdown(): data(NULL), name(""), friendlyName(""), @@ -386,7 +386,7 @@ class SettingDefDropdown : public SettingDef { options(NULL), optionsCount(0), f(0) {} - SettingDefDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount): + SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount): f(0) { data=_data; name=_name; @@ -396,7 +396,7 @@ class SettingDefDropdown : public SettingDef { options=_options; optionsCount=_optionsCount; } - SettingDefDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags) { + SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags) { data=_data; name=_name; friendlyName=_friendlyName; @@ -408,7 +408,7 @@ class SettingDefDropdown : public SettingDef { } }; -class SettingDefRadio : public SettingDef { +class SettingRadio : public SettingDef { void* data; String name; const char* friendlyName; @@ -447,7 +447,7 @@ class SettingDefRadio : public SettingDef { *(int*)data=conf->getInt(name, fallback?1:0); clampSetting(*(int*)data,0,1); } - SettingDefRadio(): + SettingRadio(): data(NULL), name(""), friendlyName(""), @@ -455,7 +455,7 @@ class SettingDefRadio : public SettingDef { fallback(0), options(NULL), optionsCount(0) {} - SettingDefRadio(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount) { + SettingRadio(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount) { data=_data; name=_name; friendlyName=_friendlyName; @@ -466,7 +466,7 @@ class SettingDefRadio : public SettingDef { } }; -class SettingDefDummyText : public SettingDef { +class SettingDummyText : public SettingDef { const char* fmt; va_list args; public: @@ -485,9 +485,9 @@ class SettingDefDummyText : public SettingDef { void loadSetting(DivConfig* conf) { (void)conf; } - SettingDefDummyText(): + SettingDummyText(): fmt(NULL) {} - SettingDefDummyText(const char* _fmt, ...) { + SettingDummyText(const char* _fmt, ...) { fmt=_fmt; va_start(args,_fmt); va_end(args); From 57425035c01fba6054b72159fb7ecff379c718bf Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 3 Nov 2024 10:54:47 +0400 Subject: [PATCH 17/61] prototype dropdowns with lambdas --- src/gui/settings.cpp | 3 +++ src/gui/settingsDef.h | 34 +++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 8bb30ea9d6..303965b69e 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -356,6 +356,8 @@ const char* oscRenderEngines[2]={ if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; // NEW NEW SETTINGS HERE + int a=0; + const char* t[2]={"1","2"}; void FurnaceGUI::setupSettingsCategories() { settings.categories={ SettingsCategory("Window",{ @@ -369,6 +371,7 @@ void FurnaceGUI::setupSettingsCategories() { new SettingCheckbox(&settings.oscTakesEntireWindow,"oscTakesEntireWindow",_("Fill entire window"),NULL,0), new SettingCheckbox(&settings.oscEscapesBoundary,"oscEscapesBoundary",_("Waveform goes out of bounds"),NULL,0), new SettingSliderFloat(&settings.oscLineSize,"oscLineSize",_("Line size"),NULL,1.0f,0.25f,16.0f,"%.1f"), + new SettingDropdown(&a,"","test!",NULL,0,t,2,0,[]() {logW("hello!");}), }), },{ #ifndef IS_MOBILE diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index b9fd3f15b9..cd407b8446 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -72,7 +72,7 @@ class SettingCheckbox : public SettingDef { } if (tooltip) { ImGui::SameLine(); - ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + ImGui::TextDisabled("(?)"); if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { ImGui::SetTooltip("%s",tooltip); } @@ -122,7 +122,7 @@ class SettingSliderInt : public SettingDef { } if (tooltip) { ImGui::SameLine(); - ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + ImGui::TextDisabled("(?)"); if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { ImGui::SetTooltip("%s",tooltip); } @@ -201,7 +201,7 @@ class SettingSliderFloat : public SettingDef { } if (tooltip) { ImGui::SameLine(); - ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + ImGui::TextDisabled("(?)"); if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { ImGui::SetTooltip("%s",tooltip); } @@ -280,7 +280,7 @@ class SettingInputInt : public SettingDef { } if (tooltip) { ImGui::SameLine(); - ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + ImGui::TextDisabled("(?)"); if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { ImGui::SetTooltip("%s",tooltip); } @@ -347,6 +347,7 @@ class SettingDropdown : public SettingDef { const char** options; int optionsCount; ImGuiComboFlags f; + std::function interact; public: bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { return (filter->PassFilter(friendlyName) && toWhat&1) || @@ -358,13 +359,14 @@ class SettingDropdown : public SettingDef { if (ImGui::Selectable(options[i],i==*(int*)data)) { *(int*)data=i; changed=true; + interact(); } } ImGui::EndCombo(); } if (tooltip) { ImGui::SameLine(); - ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + ImGui::TextDisabled("(?)"); if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { ImGui::SetTooltip("%s",tooltip); } @@ -385,9 +387,11 @@ class SettingDropdown : public SettingDef { fallback(0), options(NULL), optionsCount(0), - f(0) {} + f(0), + interact([]{}) {} SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount): - f(0) { + f(0), + interact([]{}) { data=_data; name=_name; friendlyName=_friendlyName; @@ -396,7 +400,18 @@ class SettingDropdown : public SettingDef { options=_options; optionsCount=_optionsCount; } - SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags) { + SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags): + interact([]{}) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + options=_options; + optionsCount=_optionsCount; + f=flags; + } + SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interact) { data=_data; name=_name; friendlyName=_friendlyName; @@ -405,6 +420,7 @@ class SettingDropdown : public SettingDef { options=_options; optionsCount=_optionsCount; f=flags; + interact=_interact; } }; @@ -426,7 +442,7 @@ class SettingRadio : public SettingDef { ImGui::Text("%s",friendlyName); if (tooltip) { ImGui::SameLine(); - ImGui::TextColored(ImVec4(0.5f,0.5f,0.5f,0.9f),"(?)"); + ImGui::TextDisabled("(?)"); if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { ImGui::SetTooltip("%s",tooltip); } From 7ec4a0e305b6a82c37915a2583f1e2ef4a23e3bd Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 3 Nov 2024 19:40:48 +0400 Subject: [PATCH 18/61] proper destructior(s), moar setting --- src/gui/gui.cpp | 3 ++ src/gui/gui.h | 2 ++ src/gui/settings.cpp | 83 +++++++++++++++++++++++++++---------------- src/gui/settingsDef.h | 49 +++++++++++++++++++++---- 4 files changed, 99 insertions(+), 38 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 72f4ee4870..451a52d16c 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -8286,6 +8286,9 @@ bool FurnaceGUI::finish(bool saveConfig) { SDL_HapticClose(vibrator); } + for (SettingsCategory i:settings.categories) destroySettingsCategories(i); + settings.categories.clear(); + for (int i=0; i0) { + for (SettingsCategory i:cat.children) { + destroySettingsCategories(i); + } + } + for (SettingDef* i:cat.settings) { + delete i; + } + cat.settings.clear(); + cat.children.clear(); +} + void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { if (cat->children.size()>0) { ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_OpenOnDoubleClick; @@ -674,41 +695,41 @@ void FurnaceGUI::drawSettings() { CONFIG_SECTION("test") { CONFIG_SUBSECTION("here"); - if (ImGui::BeginTable("set3", 2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - if (ImGui::BeginChild("SettingCategories",ImGui::GetContentRegionAvail(),false)) { - settings.filter.Draw(_("Search")); - ImGui::SameLine(); - ImGui::Button(ICON_FA_BARS "##SettingsSearchDepth"); - if (ImGui::BeginPopupContextItem("SettingsSearchDepth",ImGuiPopupFlags_MouseButtonLeft)) { - ImGui::Text("Search where:"); - ImGui::Indent(); - if (ImGui::RadioButton("Setting names", settings.searchDepth==1)) { - settings.searchDepth=1; - } - if (ImGui::RadioButton("Setting descriptions", settings.searchDepth==2)) { - settings.searchDepth=2; - } - if (ImGui::RadioButton("Setting names and descriptions", settings.searchDepth==3)) { - settings.searchDepth=3; + if (ImGui::BeginTable("set3", 2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if (ImGui::BeginChild("SettingCategories",ImGui::GetContentRegionAvail(),false)) { + settings.filter.Draw(_("Search")); + ImGui::SameLine(); + ImGui::Button(ICON_FA_BARS "##SettingsSearchDepth"); + if (ImGui::BeginPopupContextItem("SettingsSearchDepth",ImGuiPopupFlags_MouseButtonLeft)) { + ImGui::Text("Search where:"); + ImGui::Indent(); + if (ImGui::RadioButton("Setting names", settings.searchDepth==1)) { + settings.searchDepth=1; + } + if (ImGui::RadioButton("Setting descriptions", settings.searchDepth==2)) { + settings.searchDepth=2; + } + if (ImGui::RadioButton("Setting names and descriptions", settings.searchDepth==3)) { + settings.searchDepth=3; + } + ImGui::Unindent(); + ImGui::EndPopup(); } - ImGui::Unindent(); - ImGui::EndPopup(); + for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); + ImGui::EndChild(); } - for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); - ImGui::EndChild(); - } - ImGui::TableNextColumn(); - if (ImGui::BeginChild("SettingsItems",ImGui::GetContentRegionAvail(),false)) { - drawSettingsItems(); - if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { - ImGui::Text("gotta unlock them first!"); + ImGui::TableNextColumn(); + if (ImGui::BeginChild("SettingsItems",ImGui::GetContentRegionAvail(),false)) { + drawSettingsItems(); + if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { + ImGui::Text("gotta unlock them first!"); + } + ImGui::EndChild(); } - ImGui::EndChild(); + ImGui::EndTable(); } - ImGui::EndTable(); - } END_SECTION; } diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index cd407b8446..a370940cf6 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -52,6 +52,9 @@ void SettingDef::loadSetting(DivConfig* conf) { *(int*)data=conf->getInt(name, 0); } +SettingDef::~SettingDef() { +} + // children class SettingCheckbox : public SettingDef { @@ -98,6 +101,8 @@ class SettingCheckbox : public SettingDef { tooltip=_tooltip; fallback=_fallback; } + ~SettingCheckbox() { + } }; class SettingSliderInt : public SettingDef { @@ -177,6 +182,8 @@ class SettingSliderInt : public SettingDef { sliderFmt=fmt; f=flags; } + ~SettingSliderInt() { + } }; class SettingSliderFloat : public SettingDef { @@ -256,6 +263,8 @@ class SettingSliderFloat : public SettingDef { sliderFmt=fmt; f=flags; } + ~SettingSliderFloat() { + } }; class SettingInputInt : public SettingDef { @@ -335,6 +344,8 @@ class SettingInputInt : public SettingDef { sliderFmt=fmt; f=flags; } + ~SettingInputInt() { + } }; class SettingDropdown : public SettingDef { @@ -347,19 +358,21 @@ class SettingDropdown : public SettingDef { const char** options; int optionsCount; ImGuiComboFlags f; - std::function interact; + std::function interactFunc; + std::function setupFunc; public: bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { return (filter->PassFilter(friendlyName) && toWhat&1) || (filter->PassFilter(tooltip) && toWhat&2); } void drawSetting(bool& changed) { + setupFunc(); if (ImGui::BeginCombo(friendlyName,options[*(int*)data],f)) { for (unsigned short i=0; i _interactFunc): + setupFunc([]{}) { data=_data; name=_name; friendlyName=_friendlyName; @@ -410,8 +437,9 @@ class SettingDropdown : public SettingDef { options=_options; optionsCount=_optionsCount; f=flags; + interactFunc=_interactFunc; } - SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interact) { + SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interactFunc, std::function _setupFunc) { data=_data; name=_name; friendlyName=_friendlyName; @@ -420,7 +448,10 @@ class SettingDropdown : public SettingDef { options=_options; optionsCount=_optionsCount; f=flags; - interact=_interact; + interactFunc=_interactFunc; + setupFunc=_setupFunc; + } + ~SettingDropdown() { } }; @@ -480,6 +511,8 @@ class SettingRadio : public SettingDef { options=_options; optionsCount=_optionsCount; } + ~SettingRadio() { + } }; class SettingDummyText : public SettingDef { @@ -508,6 +541,8 @@ class SettingDummyText : public SettingDef { va_start(args,_fmt); va_end(args); } + ~SettingDummyText() { + } }; #endif From f48b5018e0202a28c213b91d9ea72e1528948e80 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Mon, 4 Nov 2024 19:57:55 +0400 Subject: [PATCH 19/61] dropdown text setting, how did i --- src/gui/settings.cpp | 30 +++++++++++ src/gui/settingsDef.h | 112 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 139 insertions(+), 3 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index a69b1f5b8e..e8b2f7988e 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -300,6 +300,33 @@ const char* memUsageUnits[2]={ _("Kilobytes##MUU1") }; +const char* renderBackends[]={ +#ifdef HAVE_RENDER_SDL + "SDL", +#endif +#ifdef HAVE_RENDER_DX11 + "DirectX 11", +#endif +#ifdef HAVE_RENDER_DX9 + "DirectX 9", +#endif +#ifdef HAVE_RENDER_METAL + "Metal", +#endif +#ifdef HAVE_RENDER_GL +#ifdef USE_GLES + "OpenGL ES 2.0", +#else + "OpenGL 3.0", + "OpenGL 2.0", +#endif +#endif +#ifdef HAVE_RENDER_GL1 + "OpenGL 1.1", +#endif + "Software" +}; + #define SAMPLE_RATE_SELECTABLE(x) \ if (ImGui::Selectable(#x,settings.audioRate==x)) { \ settings.audioRate=x; \ @@ -365,6 +392,9 @@ const char* memUsageUnits[2]={ const char* t[2]={"1","2"}; void FurnaceGUI::setupSettingsCategories() { settings.categories={ + SettingsCategory("Program",{},{ + new SettingDropdownText(&settings.renderBackend,"renderBackend",_("Render backend"),NULL,GUI_BACKEND_DEFAULT_NAME,renderBackends,(int)(sizeof(renderBackends)/sizeof(const char*))), + }), SettingsCategory("Window",{ SettingsCategory("Memory Composition",{},{ new SettingRadio(&settings.memUsageUnit,"memUsageUnit",_("Chip memory usage unit:"),NULL,1,memUsageUnits,2), diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index a370940cf6..2834842f5b 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -386,11 +386,11 @@ class SettingDropdown : public SettingDef { } } void saveSetting(DivConfig* conf) { - conf->set(name,(*(bool*)data)?1:0); + conf->set(name,(*(int*)data)); } void loadSetting(DivConfig* conf){ - *(int*)data=conf->getInt(name, fallback?1:0); - clampSetting(*(int*)data,0,1); + *(int*)data=conf->getInt(name, fallback); + clampSetting(*(int*)data,0,optionsCount-1); } SettingDropdown(): data(NULL), @@ -455,6 +455,112 @@ class SettingDropdown : public SettingDef { } }; +class SettingDropdownText : public SettingDef { + void* data; + String name; + const char* friendlyName; + const char* tooltip; + + String fallback; + const char** options; + int optionsCount; + ImGuiComboFlags f; + std::function interactFunc; + std::function setupFunc; + public: + bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { + return (filter->PassFilter(friendlyName) && toWhat&1) || + (filter->PassFilter(tooltip) && toWhat&2); + } + void drawSetting(bool& changed) { + setupFunc(); + if (ImGui::BeginCombo(friendlyName,(*(String*)data).c_str(),f)) { + for (unsigned short i=0; iset(name,*(String*)data); + } + void loadSetting(DivConfig* conf){ + *(String*)data=conf->getString(name, fallback); + } + SettingDropdownText(): + data(NULL), + name(""), + friendlyName(""), + tooltip(""), + fallback(0), + options(NULL), + optionsCount(0), + f(0), + interactFunc([]{}), + setupFunc([]{}) {} + SettingDropdownText(String* _data, String _name, const char* _friendlyName, const char* _tooltip, String _fallback, const char** _options, int _optionsCount): + f(0), + interactFunc([]{}), + setupFunc([]{}) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + options=_options; + optionsCount=_optionsCount; + } + SettingDropdownText(String* _data, String _name, const char* _friendlyName, const char* _tooltip, String _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags): + interactFunc([]{}), + setupFunc([]{}) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + options=_options; + optionsCount=_optionsCount; + f=flags; + } + SettingDropdownText(String* _data, String _name, const char* _friendlyName, const char* _tooltip, String _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interactFunc): + setupFunc([]{}) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + options=_options; + optionsCount=_optionsCount; + f=flags; + interactFunc=_interactFunc; + } + SettingDropdownText(String* _data, String _name, const char* _friendlyName, const char* _tooltip, String _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interactFunc, std::function _setupFunc) { + data=_data; + name=_name; + friendlyName=_friendlyName; + tooltip=_tooltip; + fallback=_fallback; + options=_options; + optionsCount=_optionsCount; + f=flags; + interactFunc=_interactFunc; + setupFunc=_setupFunc; + } + ~SettingDropdownText() { + } +}; + class SettingRadio : public SettingDef { void* data; String name; From d12ab239b13e1d9476098f56ee01097762c9ecef Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 6 Nov 2024 19:22:05 +0400 Subject: [PATCH 20/61] turn dummytext to whteverdummy --- src/gui/settings.cpp | 2 +- src/gui/settingsDef.h | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index e8b2f7988e..f726b590ff 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -400,7 +400,7 @@ void FurnaceGUI::setupSettingsCategories() { new SettingRadio(&settings.memUsageUnit,"memUsageUnit",_("Chip memory usage unit:"),NULL,1,memUsageUnits,2), }), SettingsCategory("Oscilloscope",{},{ - new SettingDummyText("%c",&settingsChanged), + new SettingDummy([this]{ImGui::Text("changed: %s",settingsChanged?"yes":"no");}), new SettingRadio(&settings.shaderOsc,"shaderOsc",_("Oscilloscope rendering engine:"),_("render using either Dear ImGui's built-in line drawing functions or GLSL."),0,oscRenderEngines,2), new SettingCheckbox(&settings.oscRoundedCorners,"oscRoundedCorners",_("Rounded corners"),NULL,GUI_DECORATIONS_DEFAULT), new SettingCheckbox(&settings.oscBorder,"oscBorder",_("Border"),NULL,1), diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index 2834842f5b..9367ef3cdd 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -621,18 +621,18 @@ class SettingRadio : public SettingDef { } }; -class SettingDummyText : public SettingDef { - const char* fmt; - va_list args; +class SettingDummy : public SettingDef { + std::function action; + bool alwaysShow; public: bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { (void)filter; (void)toWhat; - return false; + return alwaysShow; } void drawSetting(bool& changed) { (void)changed; - ImGui::Text(fmt,args); + action(); } void saveSetting(DivConfig* conf) { (void)conf; @@ -640,14 +640,18 @@ class SettingDummyText : public SettingDef { void loadSetting(DivConfig* conf) { (void)conf; } - SettingDummyText(): - fmt(NULL) {} - SettingDummyText(const char* _fmt, ...) { - fmt=_fmt; - va_start(args,_fmt); - va_end(args); + SettingDummy(): + action([]{}), + alwaysShow(false) {} + SettingDummy(std::function _action): + alwaysShow(false) { + action=_action; } - ~SettingDummyText() { + SettingDummy(std::function _action, bool _alwaysShow) { + action=_action; + alwaysShow=_alwaysShow; + } + ~SettingDummy() { } }; From 26e5385a3d65d0cfcd889e83a744f48e77b4e7aa Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 6 Nov 2024 19:27:58 +0400 Subject: [PATCH 21/61] remove redundant stuff --- src/gui/settingsDef.h | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index 9367ef3cdd..7eaef1d22a 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -466,14 +466,12 @@ class SettingDropdownText : public SettingDef { int optionsCount; ImGuiComboFlags f; std::function interactFunc; - std::function setupFunc; public: bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { return (filter->PassFilter(friendlyName) && toWhat&1) || (filter->PassFilter(tooltip) && toWhat&2); } void drawSetting(bool& changed) { - setupFunc(); if (ImGui::BeginCombo(friendlyName,(*(String*)data).c_str(),f)) { for (unsigned short i=0; i _interactFunc): - setupFunc([]{}) { + interactFunc([]{}) { data=_data; name=_name; friendlyName=_friendlyName; @@ -543,9 +527,8 @@ class SettingDropdownText : public SettingDef { options=_options; optionsCount=_optionsCount; f=flags; - interactFunc=_interactFunc; } - SettingDropdownText(String* _data, String _name, const char* _friendlyName, const char* _tooltip, String _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interactFunc, std::function _setupFunc) { + SettingDropdownText(String* _data, String _name, const char* _friendlyName, const char* _tooltip, String _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interactFunc) { data=_data; name=_name; friendlyName=_friendlyName; @@ -555,7 +538,6 @@ class SettingDropdownText : public SettingDef { optionsCount=_optionsCount; f=flags; interactFunc=_interactFunc; - setupFunc=_setupFunc; } ~SettingDropdownText() { } @@ -623,12 +605,11 @@ class SettingRadio : public SettingDef { class SettingDummy : public SettingDef { std::function action; - bool alwaysShow; public: bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { (void)filter; (void)toWhat; - return alwaysShow; + return false; } void drawSetting(bool& changed) { (void)changed; @@ -641,15 +622,9 @@ class SettingDummy : public SettingDef { (void)conf; } SettingDummy(): - action([]{}), - alwaysShow(false) {} - SettingDummy(std::function _action): - alwaysShow(false) { - action=_action; - } - SettingDummy(std::function _action, bool _alwaysShow) { + action([]{}) {} + SettingDummy(std::function _action) { action=_action; - alwaysShow=_alwaysShow; } ~SettingDummy() { } From 95e153cc50d074b0628327746059d84052e098bc Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 6 Nov 2024 19:54:32 +0400 Subject: [PATCH 22/61] vertical settings window --- src/gui/settings.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index f726b590ff..5bb3888893 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -725,10 +725,11 @@ void FurnaceGUI::drawSettings() { CONFIG_SECTION("test") { CONFIG_SUBSECTION("here"); - if (ImGui::BeginTable("set3", 2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { + bool vertical=ImGui::GetWindowSize().y>ImGui::GetWindowSize().x; + if (ImGui::BeginTable("set3", vertical?1:2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { ImGui::TableNextRow(); ImGui::TableNextColumn(); - if (ImGui::BeginChild("SettingCategories",ImGui::GetContentRegionAvail(),false)) { + if (ImGui::BeginChild("SettingCategories",vertical?ImGui::GetContentRegionAvail()/ImVec2(1.0f,3.0f):ImGui::GetContentRegionAvail(),false)) { settings.filter.Draw(_("Search")); ImGui::SameLine(); ImGui::Button(ICON_FA_BARS "##SettingsSearchDepth"); @@ -748,16 +749,17 @@ void FurnaceGUI::drawSettings() { ImGui::EndPopup(); } for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); - ImGui::EndChild(); } + ImGui::EndChild(); + if (ImGui::GetWindowSize().y>ImGui::GetWindowSize().x) ImGui::TableNextRow(); ImGui::TableNextColumn(); - if (ImGui::BeginChild("SettingsItems",ImGui::GetContentRegionAvail(),false)) { + if (ImGui::BeginChild("SettingsItems",vertical?ImVec2(0.0f,0.0f):ImGui::GetContentRegionAvail(),false)) { drawSettingsItems(); if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { ImGui::Text("gotta unlock them first!"); } - ImGui::EndChild(); } + ImGui::EndChild(); ImGui::EndTable(); } From 45cad85a5d044670551cf6ae89d7529e94463f5b Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Thu, 7 Nov 2024 18:53:47 +0400 Subject: [PATCH 23/61] settingunion setting union --- src/gui/settings.cpp | 5 ++++- src/gui/settingsDef.h | 30 ++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 5bb3888893..434a89b2dc 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -409,7 +409,10 @@ void FurnaceGUI::setupSettingsCategories() { new SettingCheckbox(&settings.oscTakesEntireWindow,"oscTakesEntireWindow",_("Fill entire window"),NULL,0), new SettingCheckbox(&settings.oscEscapesBoundary,"oscEscapesBoundary",_("Waveform goes out of bounds"),NULL,0), new SettingSliderFloat(&settings.oscLineSize,"oscLineSize",_("Line size"),NULL,1.0f,0.25f,16.0f,"%.1f"), - new SettingDropdown(&a,"","test!",NULL,0,t,2,0,[]() {logW("hello!");}), + new SettingUnion({ + new SettingDropdown(&a,"","test!",NULL,0,t,2,0,[]() {logW("hello!");}), + new SettingDummy([this]{ImGui::Text("this text will appear if the setting above does!");}), + }), }), },{ #ifndef IS_MOBILE diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index 7eaef1d22a..0f404ddabf 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -20,7 +20,8 @@ #ifndef SETTINGSDEF_H #define SETTINGSDEF_H -#include +#include "gui.h" + #define clampSetting(x,minV,maxV) \ if (x - // abstract functions bool SettingDef::passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { @@ -630,4 +628,28 @@ class SettingDummy : public SettingDef { } }; +class SettingUnion : public SettingDef { + std::vector settings; + public: + bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { + bool ret=false; + for (SettingDef* i:settings) ret |= i->passesFilter(filter, toWhat); + return ret; + } + void drawSetting(bool& changed) { + for (SettingDef* i:settings) i->drawSetting(changed); + } + void saveSetting(DivConfig* conf) { + for (SettingDef* i:settings) i->saveSetting(conf); + } + void loadSetting(DivConfig* conf) { + for (SettingDef* i:settings) i->loadSetting(conf); + } + SettingUnion(): + settings({}) {} + SettingUnion(std::vector _settings) { + settings=_settings; + } +}; + #endif From 013498e0cb89146ce143730a334aa421d9839320 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Thu, 7 Nov 2024 19:28:32 +0400 Subject: [PATCH 24/61] deconstructor --- src/gui/settingsDef.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index 0f404ddabf..59c4aaca7f 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -650,6 +650,9 @@ class SettingUnion : public SettingDef { SettingUnion(std::vector _settings) { settings=_settings; } + ~SettingUnion() { + for (SettingDef* i:settings) delete i; + } }; #endif From fa046fa061215616909b2be603d7eb6326819430 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 8 Nov 2024 13:44:21 +0400 Subject: [PATCH 25/61] setting union conditional displayability --- src/gui/settings.cpp | 4 +++- src/gui/settingsDef.h | 51 +++++++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 434a89b2dc..c16203549f 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -387,6 +387,8 @@ const char* renderBackends[]={ ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \ if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; +#define SHOW_IF(b) [this]{return b;} + // NEW NEW SETTINGS HERE int a=0; const char* t[2]={"1","2"}; @@ -412,7 +414,7 @@ void FurnaceGUI::setupSettingsCategories() { new SettingUnion({ new SettingDropdown(&a,"","test!",NULL,0,t,2,0,[]() {logW("hello!");}), new SettingDummy([this]{ImGui::Text("this text will appear if the setting above does!");}), - }), + },SHOW_IF(!settings.oscMono)), }), },{ #ifndef IS_MOBILE diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index 59c4aaca7f..cf645923c7 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -21,6 +21,7 @@ #define SETTINGSDEF_H #include "gui.h" +#include #define clampSetting(x,minV,maxV) \ if (x interactFunc; - std::function setupFunc; public: bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { return (filter->PassFilter(friendlyName) && toWhat&1) || (filter->PassFilter(tooltip) && toWhat&2); } void drawSetting(bool& changed) { - setupFunc(); if (ImGui::BeginCombo(friendlyName,options[*(int*)data],f)) { for (unsigned short i=0; i _interactFunc): - setupFunc([]{}) { + SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interactFunc) { data=_data; name=_name; friendlyName=_friendlyName; @@ -447,7 +442,6 @@ class SettingDropdown : public SettingDef { optionsCount=_optionsCount; f=flags; interactFunc=_interactFunc; - setupFunc=_setupFunc; } ~SettingDropdown() { } @@ -629,14 +623,19 @@ class SettingDummy : public SettingDef { }; class SettingUnion : public SettingDef { + const char* label; std::vector settings; + std::function showUnion; + bool showLabel; public: bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - bool ret=false; + bool ret=filter->PassFilter(label); for (SettingDef* i:settings) ret |= i->passesFilter(filter, toWhat); return ret; } void drawSetting(bool& changed) { + if (!showUnion()) return; + if (showLabel) ImGui::Text("%s",label); for (SettingDef* i:settings) i->drawSetting(changed); } void saveSetting(DivConfig* conf) { @@ -646,9 +645,33 @@ class SettingUnion : public SettingDef { for (SettingDef* i:settings) i->loadSetting(conf); } SettingUnion(): - settings({}) {} - SettingUnion(std::vector _settings) { + label(NULL), + settings({}), + showUnion([]{return true;}), + showLabel(false) {} + SettingUnion(std::vector _settings): + label(NULL), + showUnion([]{return true;}), + showLabel(false) { + settings=_settings; + } + SettingUnion(const char* _label, std::vector _settings): + showUnion([]{return true;}), + showLabel(false) { + label=_label; + settings=_settings; + } + SettingUnion(std::vector _settings, std::function _showUnion): + label(NULL), + showLabel(false) { + settings=_settings; + showUnion=_showUnion; + } + SettingUnion(const char* _label, bool _showLabel, std::vector _settings, std::function _showUnion) { + label=_label; settings=_settings; + showLabel=_showLabel; + showUnion=_showUnion; } ~SettingUnion() { for (SettingDef* i:settings) delete i; From ce78cf492724c75241a509463f0e7a22a32fcc36 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 8 Nov 2024 14:02:50 +0400 Subject: [PATCH 26/61] better union filterpass? --- src/gui/settingsDef.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index cf645923c7..6cf8423d56 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -629,9 +629,13 @@ class SettingUnion : public SettingDef { bool showLabel; public: bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { + if (!showUnion()) return false; bool ret=filter->PassFilter(label); - for (SettingDef* i:settings) ret |= i->passesFilter(filter, toWhat); - return ret; + for (SettingDef* i:settings) { + if (ret) return true; + ret |= i->passesFilter(filter, toWhat); + } + return false; } void drawSetting(bool& changed) { if (!showUnion()) return; From 93b73d9810295c7610380e496d3a29f720c927cb Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 8 Nov 2024 14:05:03 +0400 Subject: [PATCH 27/61] dammit --- src/gui/settingsDef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h index 6cf8423d56..6ab8930c68 100644 --- a/src/gui/settingsDef.h +++ b/src/gui/settingsDef.h @@ -635,7 +635,7 @@ class SettingUnion : public SettingDef { if (ret) return true; ret |= i->passesFilter(filter, toWhat); } - return false; + return ret; } void drawSetting(bool& changed) { if (!showUnion()) return; From bb818bc4eb669bcd6b47030008ad2940987bf8bd Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 10 Nov 2024 15:44:47 +0400 Subject: [PATCH 28/61] i dont even know --- src/gui/settings.cpp | 76 +++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index c16203549f..dcb78b831e 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -388,48 +388,51 @@ const char* renderBackends[]={ if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; #define SHOW_IF(b) [this]{return b;} +#define SettingSeparator() SettingDummy([]{ImGui::Separator();}) // NEW NEW SETTINGS HERE int a=0; const char* t[2]={"1","2"}; void FurnaceGUI::setupSettingsCategories() { settings.categories={ - SettingsCategory("Program",{},{ - new SettingDropdownText(&settings.renderBackend,"renderBackend",_("Render backend"),NULL,GUI_BACKEND_DEFAULT_NAME,renderBackends,(int)(sizeof(renderBackends)/sizeof(const char*))), - }), - SettingsCategory("Window",{ - SettingsCategory("Memory Composition",{},{ - new SettingRadio(&settings.memUsageUnit,"memUsageUnit",_("Chip memory usage unit:"),NULL,1,memUsageUnits,2), - }), - SettingsCategory("Oscilloscope",{},{ - new SettingDummy([this]{ImGui::Text("changed: %s",settingsChanged?"yes":"no");}), - new SettingRadio(&settings.shaderOsc,"shaderOsc",_("Oscilloscope rendering engine:"),_("render using either Dear ImGui's built-in line drawing functions or GLSL."),0,oscRenderEngines,2), - new SettingCheckbox(&settings.oscRoundedCorners,"oscRoundedCorners",_("Rounded corners"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.oscBorder,"oscBorder",_("Border"),NULL,1), - new SettingCheckbox(&settings.oscMono,"oscMono",_("Mono"),NULL,1), - new SettingCheckbox(&settings.oscAntiAlias,"oscAntiAlias",_("Anti-aliased"),NULL,1), - new SettingCheckbox(&settings.oscTakesEntireWindow,"oscTakesEntireWindow",_("Fill entire window"),NULL,0), - new SettingCheckbox(&settings.oscEscapesBoundary,"oscEscapesBoundary",_("Waveform goes out of bounds"),NULL,0), - new SettingSliderFloat(&settings.oscLineSize,"oscLineSize",_("Line size"),NULL,1.0f,0.25f,16.0f,"%.1f"), - new SettingUnion({ - new SettingDropdown(&a,"","test!",NULL,0,t,2,0,[]() {logW("hello!");}), - new SettingDummy([this]{ImGui::Text("this text will appear if the setting above does!");}), - },SHOW_IF(!settings.oscMono)), - }), - },{ + SettingsCategory("Program",{ + SettingsCategory("Window",{ + SettingsCategory("Memory Composition",{},{ + new SettingRadio(&settings.memUsageUnit,"memUsageUnit",_("Chip memory usage unit:"),NULL,1,memUsageUnits,2), + }), + SettingsCategory("Oscilloscope",{},{ + new SettingRadio(&settings.shaderOsc,"shaderOsc",_("Oscilloscope rendering engine:"),_("render using either Dear ImGui's built-in line drawing functions or GLSL."),0,oscRenderEngines,2), + new SettingCheckbox(&settings.oscRoundedCorners,"oscRoundedCorners",_("Rounded corners"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.oscBorder,"oscBorder",_("Border"),NULL,1), + new SettingCheckbox(&settings.oscMono,"oscMono",_("Mono"),NULL,1), + new SettingCheckbox(&settings.oscAntiAlias,"oscAntiAlias",_("Anti-aliased"),NULL,1), + new SettingCheckbox(&settings.oscTakesEntireWindow,"oscTakesEntireWindow",_("Fill entire window"),NULL,0), + new SettingCheckbox(&settings.oscEscapesBoundary,"oscEscapesBoundary",_("Waveform goes out of bounds"),NULL,0), + new SettingSliderFloat(&settings.oscLineSize,"oscLineSize",_("Line size"),NULL,1.0f,0.25f,16.0f,"%.1f"), + new SettingSeparator(), + new SettingDummy([this]{ImGui::Text("settings changed: %s",settingsChanged?"yes":"no");}), + new SettingUnion({ + new SettingDropdown(&a,"","test!",NULL,0,t,2,0,[]() {logW("hello!");}), + new SettingDummy([this]{ImGui::Text("this text will appear if the setting above does!");}), + },SHOW_IF(!settings.oscMono)), + }), + },{ #ifndef IS_MOBILE - new SettingCheckbox(&settings.saveWindowPos,"saveWindowPos",_("Remember window position"),_("remembers the window's last position on start-up."),true), + new SettingCheckbox(&settings.saveWindowPos,"saveWindowPos",_("Remember window position"),_("remembers the window's last position on start-up."),true), #endif - new SettingCheckbox(&settings.moveWindowTitle,"moveWindowTitle",_("Only allow window movement when clicking on title bar"),NULL,true), - new SettingCheckbox(&settings.centerPopup,"centerPopup",_("Center pop-up windows"),NULL,true), - - new SettingCheckbox(&settings.roundedWindows,"roundedWindows",_("Rounded window corners"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.roundedButtons,"roundedButtons",_("Rounded buttons"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.roundedMenus,"roundedMenus",_("Rounded menu corners"),NULL,false), - new SettingCheckbox(&settings.roundedTabs,"roundedTabs",_("Rounded tabs"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.roundedScrollbars,"roundedScrollbars",_("Rounded scrollbars"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.frameBorders,"frameBorders",_("Borders around widgets"),NULL,false), - }) + new SettingCheckbox(&settings.moveWindowTitle,"moveWindowTitle",_("Only allow window movement when clicking on title bar"),NULL,true), + new SettingCheckbox(&settings.centerPopup,"centerPopup",_("Center pop-up windows"),NULL,true), + new SettingSeparator(), + + new SettingCheckbox(&settings.roundedWindows,"roundedWindows",_("Rounded window corners"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.roundedButtons,"roundedButtons",_("Rounded buttons"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.roundedMenus,"roundedMenus",_("Rounded menu corners"),NULL,false), + new SettingCheckbox(&settings.roundedTabs,"roundedTabs",_("Rounded tabs"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.roundedScrollbars,"roundedScrollbars",_("Rounded scrollbars"),NULL,GUI_DECORATIONS_DEFAULT), + new SettingCheckbox(&settings.frameBorders,"frameBorders",_("Borders around widgets"),NULL,false), + })},{ + new SettingDropdownText(&settings.renderBackend,"renderBackend",_("Render backend"),NULL,GUI_BACKEND_DEFAULT_NAME,renderBackends,(int)(sizeof(renderBackends)/sizeof(const char*))), + }), }; settings.activeCategory=settings.categories[0]; @@ -457,9 +460,10 @@ void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { settings.activeCategory=*cat; } if (cat->expandChild) { - ImGui::Indent(); + float indentSize=ImGui::CalcTextSize("-").x*dpiScale; + ImGui::Indent(indentSize); for (SettingsCategory child:cat->children) drawSettingsCategory(&child); - ImGui::Unindent(); + ImGui::Unindent(indentSize); ImGui::TreePop(); } } else { // a lonely child... From 9b02e5cc6e53483748b1bd2903a2cb95b9e73b11 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 10 Nov 2024 15:58:04 +0400 Subject: [PATCH 29/61] UGH FINE --- src/gui/gui.h | 28 +- src/gui/settings.cpp | 146 +++------ src/gui/settingsDef.h | 685 ------------------------------------------ 3 files changed, 61 insertions(+), 798 deletions(-) delete mode 100644 src/gui/settingsDef.h diff --git a/src/gui/gui.h b/src/gui/gui.h index 274d78e8b8..14e2b2eace 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1600,24 +1600,28 @@ struct PendingDrawOsc { struct FurnaceCV; -class SettingDef { - void* data; - String name; +struct Setting { const char* friendlyName; - const char* tooltip; + std::function draw; public: - virtual bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat); - virtual void drawSetting(bool& changed); - virtual void saveSetting(DivConfig* conf); - virtual void loadSetting(DivConfig* conf); - virtual ~SettingDef(); + bool passesFilter(ImGuiTextFilter* filter) { + return filter->PassFilter(friendlyName); + }; + void drawSetting() { + draw(); + } + Setting(const char* _friendlyName, std::function _draw) { + friendlyName=_friendlyName; + draw=_draw; + } + ~Setting() {}; }; class SettingsCategory { public: const char* name; std::vector children; - std::vector settings; + std::vector settings; bool expandChild; void saveCaterofySettings(); void loadCategorySettings(); @@ -1628,7 +1632,7 @@ class SettingsCategory { settings({}), expandChild(false) {} - SettingsCategory(const char* n, std::initializer_list c, std::initializer_list s): + SettingsCategory(const char* n, std::initializer_list c, std::initializer_list s): expandChild(false) { name=n; children=c; @@ -1799,7 +1803,6 @@ class FurnaceGUI { std::vector categories; SettingsCategory activeCategory; // yes a boring copy ImGuiTextFilter filter; - int searchDepth; int mainFontSize, patFontSize, headFontSize, iconSize; int audioEngine; @@ -2060,7 +2063,6 @@ class FurnaceGUI { DivConfig initialSys; Settings(): - searchDepth(3), mainFontSize(GUI_FONT_SIZE_DEFAULT), patFontSize(GUI_FONT_SIZE_DEFAULT), headFontSize(27), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index dcb78b831e..b8af87f2b7 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -46,7 +46,13 @@ #include #endif -#include "settingsDef.h" +#define clampSetting(x,minV,maxV) \ + if (xmaxV) { \ + x=maxV; \ + } #define DEFAULT_NOTE_KEYS "5:7;6:4;7:3;8:16;10:6;11:8;12:24;13:10;16:11;17:9;18:26;19:28;20:12;21:17;22:1;23:19;24:23;25:5;26:14;27:2;28:21;29:0;30:100;31:13;32:15;34:18;35:20;36:22;38:25;39:27;43:100;46:101;47:29;48:31;53:102;" @@ -290,43 +296,6 @@ const char* specificControls[18]={ _N("Effect 8 value") }; -const char* oscRenderEngines[2]={ - _("ImGui line plot"), - _("GLSL (if available)") -}; - -const char* memUsageUnits[2]={ - _("Bytes##MUU0"), - _("Kilobytes##MUU1") -}; - -const char* renderBackends[]={ -#ifdef HAVE_RENDER_SDL - "SDL", -#endif -#ifdef HAVE_RENDER_DX11 - "DirectX 11", -#endif -#ifdef HAVE_RENDER_DX9 - "DirectX 9", -#endif -#ifdef HAVE_RENDER_METAL - "Metal", -#endif -#ifdef HAVE_RENDER_GL -#ifdef USE_GLES - "OpenGL ES 2.0", -#else - "OpenGL 3.0", - "OpenGL 2.0", -#endif -#endif -#ifdef HAVE_RENDER_GL1 - "OpenGL 1.1", -#endif - "Software" -}; - #define SAMPLE_RATE_SELECTABLE(x) \ if (ImGui::Selectable(#x,settings.audioRate==x)) { \ settings.audioRate=x; \ @@ -387,51 +356,45 @@ const char* renderBackends[]={ ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \ if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; -#define SHOW_IF(b) [this]{return b;} -#define SettingSeparator() SettingDummy([]{ImGui::Separator();}) - // NEW NEW SETTINGS HERE int a=0; const char* t[2]={"1","2"}; void FurnaceGUI::setupSettingsCategories() { settings.categories={ - SettingsCategory("Program",{ - SettingsCategory("Window",{ - SettingsCategory("Memory Composition",{},{ - new SettingRadio(&settings.memUsageUnit,"memUsageUnit",_("Chip memory usage unit:"),NULL,1,memUsageUnits,2), - }), - SettingsCategory("Oscilloscope",{},{ - new SettingRadio(&settings.shaderOsc,"shaderOsc",_("Oscilloscope rendering engine:"),_("render using either Dear ImGui's built-in line drawing functions or GLSL."),0,oscRenderEngines,2), - new SettingCheckbox(&settings.oscRoundedCorners,"oscRoundedCorners",_("Rounded corners"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.oscBorder,"oscBorder",_("Border"),NULL,1), - new SettingCheckbox(&settings.oscMono,"oscMono",_("Mono"),NULL,1), - new SettingCheckbox(&settings.oscAntiAlias,"oscAntiAlias",_("Anti-aliased"),NULL,1), - new SettingCheckbox(&settings.oscTakesEntireWindow,"oscTakesEntireWindow",_("Fill entire window"),NULL,0), - new SettingCheckbox(&settings.oscEscapesBoundary,"oscEscapesBoundary",_("Waveform goes out of bounds"),NULL,0), - new SettingSliderFloat(&settings.oscLineSize,"oscLineSize",_("Line size"),NULL,1.0f,0.25f,16.0f,"%.1f"), - new SettingSeparator(), - new SettingDummy([this]{ImGui::Text("settings changed: %s",settingsChanged?"yes":"no");}), - new SettingUnion({ - new SettingDropdown(&a,"","test!",NULL,0,t,2,0,[]() {logW("hello!");}), - new SettingDummy([this]{ImGui::Text("this text will appear if the setting above does!");}), - },SHOW_IF(!settings.oscMono)), - }), - },{ -#ifndef IS_MOBILE - new SettingCheckbox(&settings.saveWindowPos,"saveWindowPos",_("Remember window position"),_("remembers the window's last position on start-up."),true), + SettingsCategory("Program",{},{ +#ifdef HAVE_LOCALE + new Setting(_("Language"),[this] { + String curLocale=settings.locale; + const char* localeRestart=locales[0][2]; + if (curLocale=="") { + curLocale=""; + } else { + for (int i=1; locales[i][0]; i++) { + if (strcmp(curLocale.c_str(),locales[i][1])==0) { + curLocale=locales[i][0]; + break; + } + } + } + if (ImGui::BeginCombo(_("Language"),curLocale.c_str())) { + for (int i=0; locales[i][0]; i++) { + if (ImGui::Selectable(locales[i][0],strcmp(settings.locale.c_str(),locales[i][1])==0)) { + settings.locale=locales[i][1]; + settingsChanged=true; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("%s",locales[i][2]); + } + } + ImGui::EndCombo(); + } else { + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("%s",localeRestart); + } + } + }), #endif - new SettingCheckbox(&settings.moveWindowTitle,"moveWindowTitle",_("Only allow window movement when clicking on title bar"),NULL,true), - new SettingCheckbox(&settings.centerPopup,"centerPopup",_("Center pop-up windows"),NULL,true), - new SettingSeparator(), - - new SettingCheckbox(&settings.roundedWindows,"roundedWindows",_("Rounded window corners"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.roundedButtons,"roundedButtons",_("Rounded buttons"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.roundedMenus,"roundedMenus",_("Rounded menu corners"),NULL,false), - new SettingCheckbox(&settings.roundedTabs,"roundedTabs",_("Rounded tabs"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.roundedScrollbars,"roundedScrollbars",_("Rounded scrollbars"),NULL,GUI_DECORATIONS_DEFAULT), - new SettingCheckbox(&settings.frameBorders,"frameBorders",_("Borders around widgets"),NULL,false), - })},{ - new SettingDropdownText(&settings.renderBackend,"renderBackend",_("Render backend"),NULL,GUI_BACKEND_DEFAULT_NAME,renderBackends,(int)(sizeof(renderBackends)/sizeof(const char*))), + }), }; @@ -444,7 +407,7 @@ void FurnaceGUI::destroySettingsCategories(SettingsCategory& cat) { destroySettingsCategories(i); } } - for (SettingDef* i:cat.settings) { + for (Setting* i:cat.settings) { delete i; } cat.settings.clear(); @@ -480,8 +443,8 @@ void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { } } bool anyFound=false; - for (SettingDef* s:cat->settings) { - if (s->passesFilter(&settings.filter, settings.searchDepth)) { + for (Setting* s:cat->settings) { + if (s->passesFilter(&settings.filter)) { anyFound=true; break; } @@ -489,8 +452,8 @@ void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { if (anyFound) { ImGui::BulletText("%s",cat->name); ImGui::Indent(); - for (SettingDef* s:cat->settings) { - if (s->passesFilter(&settings.filter, settings.searchDepth)) s->drawSetting(settingsChanged); + for (Setting* s:cat->settings) { + if (s->passesFilter(&settings.filter)) s->drawSetting(); } ImGui::Unindent(); ImGui::Separator(); @@ -504,7 +467,7 @@ void FurnaceGUI::drawSettingsItems() { } } else { if (settings.activeCategory.name==NULL) return; - for (SettingDef* s:settings.activeCategory.settings) s->drawSetting(settingsChanged); + for (Setting* s:settings.activeCategory.settings) s->drawSetting(); } } @@ -740,23 +703,6 @@ void FurnaceGUI::drawSettings() { ImGui::TableNextColumn(); if (ImGui::BeginChild("SettingCategories",vertical?ImGui::GetContentRegionAvail()/ImVec2(1.0f,3.0f):ImGui::GetContentRegionAvail(),false)) { settings.filter.Draw(_("Search")); - ImGui::SameLine(); - ImGui::Button(ICON_FA_BARS "##SettingsSearchDepth"); - if (ImGui::BeginPopupContextItem("SettingsSearchDepth",ImGuiPopupFlags_MouseButtonLeft)) { - ImGui::Text("Search where:"); - ImGui::Indent(); - if (ImGui::RadioButton("Setting names", settings.searchDepth==1)) { - settings.searchDepth=1; - } - if (ImGui::RadioButton("Setting descriptions", settings.searchDepth==2)) { - settings.searchDepth=2; - } - if (ImGui::RadioButton("Setting names and descriptions", settings.searchDepth==3)) { - settings.searchDepth=3; - } - ImGui::Unindent(); - ImGui::EndPopup(); - } for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); } ImGui::EndChild(); diff --git a/src/gui/settingsDef.h b/src/gui/settingsDef.h deleted file mode 100644 index 6ab8930c68..0000000000 --- a/src/gui/settingsDef.h +++ /dev/null @@ -1,685 +0,0 @@ -/** - * Furnace Tracker - multi-system chiptune tracker - * Copyright (C) 2021-2024 tildearrow and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef SETTINGSDEF_H -#define SETTINGSDEF_H - -#include "gui.h" -#include - -#define clampSetting(x,minV,maxV) \ - if (xmaxV) { \ - x=maxV; \ - } - -// abstract functions - -bool SettingDef::passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - return (filter->PassFilter(friendlyName) && (toWhat&1)) || - (filter->PassFilter(tooltip) && (toWhat&2)); -} - -void SettingDef::drawSetting(bool& changed) { - ImGui::Text("%s",friendlyName); - if (tooltip && ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) ImGui::SetTooltip("%s",tooltip); -} - -void SettingDef::saveSetting(DivConfig* conf) { - conf->set(name,*(int*)data); -} - -void SettingDef::loadSetting(DivConfig* conf) { - *(int*)data=conf->getInt(name, 0); -} - -SettingDef::~SettingDef() { -} - -// children - -class SettingCheckbox : public SettingDef { - void* data; - String name; - const char* friendlyName; - const char* tooltip; - - bool fallback; - public: - bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - return (filter->PassFilter(friendlyName) && toWhat&1) || - (filter->PassFilter(tooltip) && toWhat&2); - } - void drawSetting(bool& changed) { - if (ImGui::Checkbox(friendlyName, (bool*)data)) { - changed=true; - } - if (tooltip) { - ImGui::SameLine(); - ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { - ImGui::SetTooltip("%s",tooltip); - } - } - } - void saveSetting(DivConfig* conf) { - conf->set(name,(*(bool*)data)?1:0); - } - void loadSetting(DivConfig* conf){ - *(int*)data=conf->getInt(name, fallback?1:0); - clampSetting(*(int*)data,0,1); - } - SettingCheckbox(): - data(NULL), - name(""), - friendlyName(""), - tooltip(""), - fallback(0) {} - SettingCheckbox(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - } - ~SettingCheckbox() { - } -}; - -class SettingSliderInt : public SettingDef { - void* data; - String name; - const char* friendlyName; - const char* tooltip; - - int fallback; - int minV, maxV; - const char* sliderFmt; - ImGuiSliderFlags f; - public: - bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - return (filter->PassFilter(friendlyName) && toWhat&1) || - (filter->PassFilter(tooltip) && toWhat&2); - } - void drawSetting(bool& changed) { - if (ImGui::SliderInt(friendlyName, (int*)data, minV, maxV, sliderFmt, f)) { - clampSetting(*(int*)data, minV, maxV); - changed=true; - } - if (tooltip) { - ImGui::SameLine(); - ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { - ImGui::SetTooltip("%s",tooltip); - } - } - } - void saveSetting(DivConfig* conf) { - conf->set(name,*(int*)data); - } - void loadSetting(DivConfig* conf){ - *(int*)data=conf->getInt(name, fallback); - clampSetting(*(int*)data,minV,maxV); - } - SettingSliderInt(): - data(NULL), - name(""), - friendlyName(""), - tooltip(""), - minV(0), - maxV(0), - sliderFmt(""), - f(0) {} - SettingSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max): - sliderFmt("%d"), - f(0) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - minV=min; - maxV=max; - } - SettingSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt): - f(0) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - minV=min; - maxV=max; - sliderFmt=fmt; - } - SettingSliderInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt, ImGuiSliderFlags flags) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - minV=min; - maxV=max; - sliderFmt=fmt; - f=flags; - } - ~SettingSliderInt() { - } -}; - -class SettingSliderFloat : public SettingDef { - void* data; - String name; - const char* friendlyName; - const char* tooltip; - - float fallback; - float minV, maxV; - const char* sliderFmt; - ImGuiSliderFlags f; - public: - bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - return (filter->PassFilter(friendlyName) && toWhat&1) || - (filter->PassFilter(tooltip) && toWhat&2); - } - void drawSetting(bool& changed) { - if (ImGui::SliderFloat(friendlyName, (float*)data, minV, maxV, sliderFmt, f)) { - clampSetting(*(float*)data, minV, maxV); - changed=true; - } - if (tooltip) { - ImGui::SameLine(); - ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { - ImGui::SetTooltip("%s",tooltip); - } - } - } - void saveSetting(DivConfig* conf) { - conf->set(name,*(float*)data); - } - void loadSetting(DivConfig* conf){ - *(float*)data=conf->getFloat(name, fallback); - clampSetting(*(float*)data,minV,maxV); - } - SettingSliderFloat(): - data(NULL), - name(""), - friendlyName(""), - tooltip(""), - minV(0), - maxV(0), - sliderFmt(""), - f(0) {} - SettingSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max): - sliderFmt("%g"), - f(0) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - minV=min; - maxV=max; - } - SettingSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max, const char* fmt): - f(0) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - minV=min; - maxV=max; - sliderFmt=fmt; - } - SettingSliderFloat(float* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, float min, float max, const char* fmt, ImGuiSliderFlags flags) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - minV=min; - maxV=max; - sliderFmt=fmt; - f=flags; - } - ~SettingSliderFloat() { - } -}; - -class SettingInputInt : public SettingDef { - void* data; - String name; - const char* friendlyName; - const char* tooltip; - - int fallback; - int minV, maxV; - const char* sliderFmt; - ImGuiInputTextFlags f; - public: - bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - return (filter->PassFilter(friendlyName) && toWhat&1) || - (filter->PassFilter(tooltip) && toWhat&2); - } - void drawSetting(bool& changed) { - if (ImGui::InputScalar(friendlyName, ImGuiDataType_S32, (int*)data, NULL, NULL, sliderFmt, f)) { - clampSetting(*(int*)data, minV, maxV); - changed=true; - } - if (tooltip) { - ImGui::SameLine(); - ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { - ImGui::SetTooltip("%s",tooltip); - } - } - } - void saveSetting(DivConfig* conf) { - conf->set(name,*(int*)data); - } - void loadSetting(DivConfig* conf){ - *(int*)data=conf->getInt(name, fallback); - clampSetting(*(int*)data,minV,maxV); - } - SettingInputInt(): - data(NULL), - name(""), - friendlyName(""), - tooltip(""), - minV(0), - maxV(0), - sliderFmt(""), - f(0) {} - SettingInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max): - sliderFmt("%d"), - f(0) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - minV=min; - maxV=max; - } - SettingInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt): - f(0) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - minV=min; - maxV=max; - sliderFmt=fmt; - } - SettingInputInt(int* _data, String _name, const char* _friendlyName, const char* _tooltip, bool _fallback, int min, int max, const char* fmt, ImGuiInputTextFlags flags) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - minV=min; - maxV=max; - sliderFmt=fmt; - f=flags; - } - ~SettingInputInt() { - } -}; - -class SettingDropdown : public SettingDef { - void* data; - String name; - const char* friendlyName; - const char* tooltip; - - int fallback; - const char** options; - int optionsCount; - ImGuiComboFlags f; - std::function interactFunc; - public: - bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - return (filter->PassFilter(friendlyName) && toWhat&1) || - (filter->PassFilter(tooltip) && toWhat&2); - } - void drawSetting(bool& changed) { - if (ImGui::BeginCombo(friendlyName,options[*(int*)data],f)) { - for (unsigned short i=0; iset(name,(*(int*)data)); - } - void loadSetting(DivConfig* conf){ - *(int*)data=conf->getInt(name, fallback); - clampSetting(*(int*)data,0,optionsCount-1); - } - SettingDropdown(): - data(NULL), - name(""), - friendlyName(""), - tooltip(""), - fallback(0), - options(NULL), - optionsCount(0), - f(0), - interactFunc([]{}) {} - SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount): - f(0), - interactFunc([]{}) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - options=_options; - optionsCount=_optionsCount; - } - SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags): - interactFunc([]{}) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - options=_options; - optionsCount=_optionsCount; - f=flags; - } - SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interactFunc) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - options=_options; - optionsCount=_optionsCount; - f=flags; - interactFunc=_interactFunc; - } - SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interactFunc, std::function _setupFunc) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - options=_options; - optionsCount=_optionsCount; - f=flags; - interactFunc=_interactFunc; - } - ~SettingDropdown() { - } -}; - -class SettingDropdownText : public SettingDef { - void* data; - String name; - const char* friendlyName; - const char* tooltip; - - String fallback; - const char** options; - int optionsCount; - ImGuiComboFlags f; - std::function interactFunc; - public: - bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - return (filter->PassFilter(friendlyName) && toWhat&1) || - (filter->PassFilter(tooltip) && toWhat&2); - } - void drawSetting(bool& changed) { - if (ImGui::BeginCombo(friendlyName,(*(String*)data).c_str(),f)) { - for (unsigned short i=0; iset(name,*(String*)data); - } - void loadSetting(DivConfig* conf){ - *(String*)data=conf->getString(name, fallback); - } - SettingDropdownText(): - data(NULL), - name(""), - friendlyName(""), - tooltip(""), - fallback(0), - options(NULL), - optionsCount(0), - f(0), - interactFunc([]{}) {} - SettingDropdownText(String* _data, String _name, const char* _friendlyName, const char* _tooltip, String _fallback, const char** _options, int _optionsCount): - f(0), - interactFunc([]{}) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - options=_options; - optionsCount=_optionsCount; - } - SettingDropdownText(String* _data, String _name, const char* _friendlyName, const char* _tooltip, String _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags): - interactFunc([]{}) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - options=_options; - optionsCount=_optionsCount; - f=flags; - } - SettingDropdownText(String* _data, String _name, const char* _friendlyName, const char* _tooltip, String _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function _interactFunc) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - options=_options; - optionsCount=_optionsCount; - f=flags; - interactFunc=_interactFunc; - } - ~SettingDropdownText() { - } -}; - -class SettingRadio : public SettingDef { - void* data; - String name; - const char* friendlyName; - const char* tooltip; - - int fallback; - const char** options; - int optionsCount; - public: - bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - return (filter->PassFilter(friendlyName) && toWhat&1) || - (filter->PassFilter(tooltip) && toWhat&2); - } - void drawSetting(bool& changed) { - ImGui::Text("%s",friendlyName); - if (tooltip) { - ImGui::SameLine(); - ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) { - ImGui::SetTooltip("%s",tooltip); - } - } - ImGui::Indent(); - for (unsigned short i=0; iset(name,(*(bool*)data)?1:0); - } - void loadSetting(DivConfig* conf){ - *(int*)data=conf->getInt(name, fallback?1:0); - clampSetting(*(int*)data,0,1); - } - SettingRadio(): - data(NULL), - name(""), - friendlyName(""), - tooltip(""), - fallback(0), - options(NULL), - optionsCount(0) {} - SettingRadio(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount) { - data=_data; - name=_name; - friendlyName=_friendlyName; - tooltip=_tooltip; - fallback=_fallback; - options=_options; - optionsCount=_optionsCount; - } - ~SettingRadio() { - } -}; - -class SettingDummy : public SettingDef { - std::function action; - public: - bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - (void)filter; - (void)toWhat; - return false; - } - void drawSetting(bool& changed) { - (void)changed; - action(); - } - void saveSetting(DivConfig* conf) { - (void)conf; - } - void loadSetting(DivConfig* conf) { - (void)conf; - } - SettingDummy(): - action([]{}) {} - SettingDummy(std::function _action) { - action=_action; - } - ~SettingDummy() { - } -}; - -class SettingUnion : public SettingDef { - const char* label; - std::vector settings; - std::function showUnion; - bool showLabel; - public: - bool passesFilter(ImGuiTextFilter* filter, unsigned char toWhat) { - if (!showUnion()) return false; - bool ret=filter->PassFilter(label); - for (SettingDef* i:settings) { - if (ret) return true; - ret |= i->passesFilter(filter, toWhat); - } - return ret; - } - void drawSetting(bool& changed) { - if (!showUnion()) return; - if (showLabel) ImGui::Text("%s",label); - for (SettingDef* i:settings) i->drawSetting(changed); - } - void saveSetting(DivConfig* conf) { - for (SettingDef* i:settings) i->saveSetting(conf); - } - void loadSetting(DivConfig* conf) { - for (SettingDef* i:settings) i->loadSetting(conf); - } - SettingUnion(): - label(NULL), - settings({}), - showUnion([]{return true;}), - showLabel(false) {} - SettingUnion(std::vector _settings): - label(NULL), - showUnion([]{return true;}), - showLabel(false) { - settings=_settings; - } - SettingUnion(const char* _label, std::vector _settings): - showUnion([]{return true;}), - showLabel(false) { - label=_label; - settings=_settings; - } - SettingUnion(std::vector _settings, std::function _showUnion): - label(NULL), - showLabel(false) { - settings=_settings; - showUnion=_showUnion; - } - SettingUnion(const char* _label, bool _showLabel, std::vector _settings, std::function _showUnion) { - label=_label; - settings=_settings; - showLabel=_showLabel; - showUnion=_showUnion; - } - ~SettingUnion() { - for (SettingDef* i:settings) delete i; - } -}; - -#endif From 5a993335d04ef7b3059ffe159e1e9cfa1202b272 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 10 Nov 2024 20:25:00 +0400 Subject: [PATCH 30/61] more settings, draw condition --- src/gui/gui.h | 11 +- src/gui/settings.cpp | 1079 +++++++++++++++++++----------------------- 2 files changed, 503 insertions(+), 587 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 14e2b2eace..c4547914da 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1603,17 +1603,24 @@ struct FurnaceCV; struct Setting { const char* friendlyName; std::function draw; + std::function drawCondition; public: bool passesFilter(ImGuiTextFilter* filter) { return filter->PassFilter(friendlyName); }; void drawSetting() { - draw(); + if (drawCondition()) draw(); } - Setting(const char* _friendlyName, std::function _draw) { + Setting(const char* _friendlyName, std::function _draw): + drawCondition([]{return true;}) { friendlyName=_friendlyName; draw=_draw; } + Setting(const char* _friendlyName, std::function _draw, std::function _drawCondition) { + friendlyName=_friendlyName; + draw=_draw; + drawCondition=_drawCondition; + } ~Setting() {}; }; diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index b8af87f2b7..9982b44383 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -299,20 +299,20 @@ const char* specificControls[18]={ #define SAMPLE_RATE_SELECTABLE(x) \ if (ImGui::Selectable(#x,settings.audioRate==x)) { \ settings.audioRate=x; \ - settingsChanged=true; \ + SETTINGS_CHANGED; \ } #define BUFFER_SIZE_SELECTABLE(x) \ if (ImGui::Selectable(#x,settings.audioBufSize==x)) { \ settings.audioBufSize=x; \ - settingsChanged=true; \ + SETTINGS_CHANGED; \ } #define UI_COLOR_CONFIG(what,label) \ ImGui::PushID(what); \ if (ImGui::ColorEdit4(label,(float*)&uiColors[what])) { \ applyUISettings(false); \ - settingsChanged=true; \ + SETTINGS_CHANGED; \ } \ ImGui::PopID(); @@ -351,11 +351,14 @@ const char* specificControls[18]={ ImGui::Text(_name); \ ImGui::TableNextColumn(); \ ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \ - if (ImGui::Combo("##" _name "Q",&settings._play,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; \ + if (ImGui::Combo("##" _name "Q",&settings._play,LocalizedComboGetter,coreQualities,6)) SETTINGS_CHANGED; \ ImGui::TableNextColumn(); \ ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \ - if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; + if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) SETTINGS_CHANGED; +#define SETTING(n,f) new Setting(n,[this]f) +#define SETTING_COND(n,f,c) new Setting(n,[this]f,[this]{return c;}) +#define SETTINGS_CHANGED settingsChanged=true // NEW NEW SETTINGS HERE int a=0; const char* t[2]={"1","2"}; @@ -363,7 +366,7 @@ void FurnaceGUI::setupSettingsCategories() { settings.categories={ SettingsCategory("Program",{},{ #ifdef HAVE_LOCALE - new Setting(_("Language"),[this] { + SETTING(_("Language"),{ String curLocale=settings.locale; const char* localeRestart=locales[0][2]; if (curLocale=="") { @@ -380,7 +383,7 @@ void FurnaceGUI::setupSettingsCategories() { for (int i=0; locales[i][0]; i++) { if (ImGui::Selectable(locales[i][0],strcmp(settings.locale.c_str(),locales[i][1])==0)) { settings.locale=locales[i][1]; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip("%s",locales[i][2]); @@ -394,7 +397,138 @@ void FurnaceGUI::setupSettingsCategories() { } }), #endif - + SETTING(_("Render backend"),{ + String curRenderBackend=settings.renderBackend.empty()?GUI_BACKEND_DEFAULT_NAME:settings.renderBackend; + if (ImGui::BeginCombo(_("Render backend"),curRenderBackend.c_str())) { +#ifdef HAVE_RENDER_SDL + if (ImGui::Selectable("SDL Renderer",curRenderBackend=="SDL")) { + settings.renderBackend="SDL"; + SETTINGS_CHANGED; + } +#endif +#ifdef HAVE_RENDER_DX11 + if (ImGui::Selectable("DirectX 11",curRenderBackend=="DirectX 11")) { + settings.renderBackend="DirectX 11"; + SETTINGS_CHANGED; + } +#endif +#ifdef HAVE_RENDER_DX9 + if (ImGui::Selectable("DirectX 9",curRenderBackend=="DirectX 9")) { + settings.renderBackend="DirectX 9"; + SETTINGS_CHANGED; + } +#endif +#ifdef HAVE_RENDER_METAL + if (ImGui::Selectable("Metal",curRenderBackend=="Metal")) { + settings.renderBackend="Metal"; + SETTINGS_CHANGED; + } +#endif +#ifdef HAVE_RENDER_GL +#ifdef USE_GLES + if (ImGui::Selectable("OpenGL ES 2.0",curRenderBackend=="OpenGL ES 2.0")) { + settings.renderBackend="OpenGL ES 2.0"; + SETTINGS_CHANGED; + } +#else + if (ImGui::Selectable("OpenGL 3.0",curRenderBackend=="OpenGL 3.0")) { + settings.renderBackend="OpenGL 3.0"; + SETTINGS_CHANGED; + } + if (ImGui::Selectable("OpenGL 2.0",curRenderBackend=="OpenGL 2.0")) { + settings.renderBackend="OpenGL 2.0"; + SETTINGS_CHANGED; + } +#endif +#endif +#ifdef HAVE_RENDER_GL1 + if (ImGui::Selectable("OpenGL 1.1",curRenderBackend=="OpenGL 1.1")) { + settings.renderBackend="OpenGL 1.1"; + SETTINGS_CHANGED; + } +#endif + if (ImGui::Selectable("Software",curRenderBackend=="Software")) { + settings.renderBackend="Software"; + SETTINGS_CHANGED; + } + ImGui::EndCombo(); + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect.")); + } + ImGui::TextWrapped(_("current backend: %s\n%s\n%s\n%s"),rend->getBackendName(),rend->getVendorName(),rend->getDeviceName(),rend->getAPIVersion()); + }), + SETTING(_("VSync"),{ + bool vsyncB=settings.vsync; + if (ImGui::Checkbox(_("VSync"),&vsyncB)) { + settings.vsync=vsyncB; + SETTINGS_CHANGED; + if (rend!=NULL) { + rend->setSwapInterval(settings.vsync); + } + } + }), + SETTING(_("Frame rate limit"),{ + if (ImGui::SliderInt(_("Frame rate limit"),&settings.frameRateLimit,0,250,settings.frameRateLimit==0?_("Unlimited"):"%d")) { + SETTINGS_CHANGED; + } + if (settings.frameRateLimit<0) settings.frameRateLimit=0; + if (settings.frameRateLimit>1000) settings.frameRateLimit=1000; + + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("only applies when VSync is disabled.")); + } + }), + SETTING(_("Display render time"),{ + bool displayRenderTimeB=settings.displayRenderTime; + if (ImGui::Checkbox(_("Display render time"),&displayRenderTimeB)) { + settings.displayRenderTime=displayRenderTimeB; + SETTINGS_CHANGED; + } + }), + SETTING_COND(_("Late render clear"),{ + bool renderClearPosB=settings.renderClearPos; + if (ImGui::Checkbox(_("Late render clear"),&renderClearPosB)) { + settings.renderClearPos=renderClearPosB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("calls rend->clear() after rend->present(). might reduce UI latency by one frame in some drivers.")); + } + },settings.renderBackend!="Metal"), + SETTING(_("Power-saving mode"),{ + bool powerSaveB=settings.powerSave; + if (ImGui::Checkbox(_("Power-saving mode"),&powerSaveB)) { + settings.powerSave=powerSaveB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("saves power by lowering the frame rate to 2fps when idle.\nmay cause issues under Mesa drivers!")); + } + }), +#ifndef IS_MOBILE + SETTING(_("Disable threaded input (restart after changing!)"),{ + bool noThreadedInputB=settings.noThreadedInput; + if (ImGui::Checkbox(_("Disable threaded input (restart after changing!)"),&noThreadedInputB)) { + settings.noThreadedInput=noThreadedInputB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("threaded input processes key presses for note preview on a separate thread (on supported platforms), which reduces latency.\nhowever, crashes have been reported when threaded input is on. enable this option if that is the case.")); + } + }), +#endif + SETTING(_("Enable event delay"),{ + bool eventDelayB=settings.eventDelay; + if (ImGui::Checkbox(_("Enable event delay"),&eventDelayB)) { + settings.eventDelay=eventDelayB; + SETTINGS_CHANGED; + applyUISettings(false); + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("may cause issues with high-polling-rate mice when previewing notes.")); + } + }), }), }; @@ -724,237 +858,12 @@ void FurnaceGUI::drawSettings() { // SUBSECTION PROGRAM CONFIG_SUBSECTION(_("Program")); -#ifdef HAVE_LOCALE - String curLocale=settings.locale; - const char* localeRestart=locales[0][2]; - if (curLocale=="") { - curLocale=""; - } else { - for (int i=1; locales[i][0]; i++) { - if (strcmp(curLocale.c_str(),locales[i][1])==0) { - curLocale=locales[i][0]; - break; - } - } - } - if (ImGui::BeginCombo(_("Language"),curLocale.c_str())) { - for (int i=0; locales[i][0]; i++) { - if (ImGui::Selectable(locales[i][0],strcmp(settings.locale.c_str(),locales[i][1])==0)) { - settings.locale=locales[i][1]; - settingsChanged=true; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("%s",locales[i][2]); - } - } - ImGui::EndCombo(); - } else { - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("%s",localeRestart); - } - } -#endif - - String curRenderBackend=settings.renderBackend.empty()?GUI_BACKEND_DEFAULT_NAME:settings.renderBackend; - if (ImGui::BeginCombo(_("Render backend"),curRenderBackend.c_str())) { -#ifdef HAVE_RENDER_SDL - if (ImGui::Selectable("SDL Renderer",curRenderBackend=="SDL")) { - settings.renderBackend="SDL"; - settingsChanged=true; - } -#endif -#ifdef HAVE_RENDER_DX11 - if (ImGui::Selectable("DirectX 11",curRenderBackend=="DirectX 11")) { - settings.renderBackend="DirectX 11"; - settingsChanged=true; - } -#endif -#ifdef HAVE_RENDER_DX9 - if (ImGui::Selectable("DirectX 9",curRenderBackend=="DirectX 9")) { - settings.renderBackend="DirectX 9"; - settingsChanged=true; - } -#endif -#ifdef HAVE_RENDER_METAL - if (ImGui::Selectable("Metal",curRenderBackend=="Metal")) { - settings.renderBackend="Metal"; - settingsChanged=true; - } -#endif -#ifdef HAVE_RENDER_GL -#ifdef USE_GLES - if (ImGui::Selectable("OpenGL ES 2.0",curRenderBackend=="OpenGL ES 2.0")) { - settings.renderBackend="OpenGL ES 2.0"; - settingsChanged=true; - } -#else - if (ImGui::Selectable("OpenGL 3.0",curRenderBackend=="OpenGL 3.0")) { - settings.renderBackend="OpenGL 3.0"; - settingsChanged=true; - } - if (ImGui::Selectable("OpenGL 2.0",curRenderBackend=="OpenGL 2.0")) { - settings.renderBackend="OpenGL 2.0"; - settingsChanged=true; - } -#endif -#endif -#ifdef HAVE_RENDER_GL1 - if (ImGui::Selectable("OpenGL 1.1",curRenderBackend=="OpenGL 1.1")) { - settings.renderBackend="OpenGL 1.1"; - settingsChanged=true; - } -#endif - if (ImGui::Selectable("Software",curRenderBackend=="Software")) { - settings.renderBackend="Software"; - settingsChanged=true; - } - ImGui::EndCombo(); - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect.")); - } - - if (ImGui::TreeNode(_("Advanced render backend settings"))) { - if (curRenderBackend=="SDL") { - if (ImGui::BeginCombo(_("Render driver"),settings.renderDriver.empty()?_("Automatic"):settings.renderDriver.c_str())) { - if (ImGui::Selectable(_("Automatic"),settings.renderDriver.empty())) { - settings.renderDriver=""; - settingsChanged=true; - } - for (String& i: availRenderDrivers) { - if (ImGui::Selectable(i.c_str(),i==settings.renderDriver)) { - settings.renderDriver=i; - settingsChanged=true; - } - } - ImGui::EndCombo(); - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect.")); - } - } else if (curRenderBackend.find("OpenGL")==0) { - ImGui::TextWrapped(_("beware: changing these settings may render Furnace unusable! do so at your own risk.\nstart Furnace with -safemode if you mess something up.")); - if (ImGui::InputInt(_("Red bits"),&settings.glRedSize)) { - if (settings.glRedSize<0) settings.glRedSize=0; - if (settings.glRedSize>32) settings.glRedSize=32; - settingsChanged=true; - } - if (ImGui::InputInt(_("Green bits"),&settings.glGreenSize)) { - if (settings.glGreenSize<0) settings.glGreenSize=0; - if (settings.glGreenSize>32) settings.glGreenSize=32; - settingsChanged=true; - } - if (ImGui::InputInt(_("Blue bits"),&settings.glBlueSize)) { - if (settings.glBlueSize<0) settings.glBlueSize=0; - if (settings.glBlueSize>32) settings.glBlueSize=32; - settingsChanged=true; - } - if (ImGui::InputInt(_("Alpha bits"),&settings.glAlphaSize)) { - if (settings.glAlphaSize<0) settings.glAlphaSize=0; - if (settings.glAlphaSize>32) settings.glAlphaSize=32; - settingsChanged=true; - } - if (ImGui::InputInt(_("Color depth"),&settings.glDepthSize)) { - if (settings.glDepthSize<0) settings.glDepthSize=0; - if (settings.glDepthSize>128) settings.glDepthSize=128; - settingsChanged=true; - } - if (ImGui::InputInt(_("Stencil buffer size"),&settings.glStencilSize)) { - if (settings.glStencilSize<0) settings.glStencilSize=0; - if (settings.glStencilSize>32) settings.glStencilSize=32; - settingsChanged=true; - } - if (ImGui::InputInt(_("Buffer size"),&settings.glBufferSize)) { - if (settings.glBufferSize<0) settings.glBufferSize=0; - if (settings.glBufferSize>128) settings.glBufferSize=128; - settingsChanged=true; - } - bool glDoubleBufferB=settings.glDoubleBuffer; - if (ImGui::Checkbox(_("Double buffer"),&glDoubleBufferB)) { - settings.glDoubleBuffer=glDoubleBufferB; - settingsChanged=true; - } - - ImGui::TextWrapped(_("the following values are common (in red, green, blue, alpha order):\n- 24 bits: 8, 8, 8, 0\n- 16 bits: 5, 6, 5, 0\n- 32 bits (with alpha): 8, 8, 8, 8\n- 30 bits (deep): 10, 10, 10, 0")); - } else { - ImGui::Text(_("nothing to configure")); - } - ImGui::TreePop(); - } - - ImGui::TextWrapped(_("current backend: %s\n%s\n%s\n%s"),rend->getBackendName(),rend->getVendorName(),rend->getDeviceName(),rend->getAPIVersion()); - - bool vsyncB=settings.vsync; - if (ImGui::Checkbox(_("VSync"),&vsyncB)) { - settings.vsync=vsyncB; - settingsChanged=true; - if (rend!=NULL) { - rend->setSwapInterval(settings.vsync); - } - } - - if (ImGui::SliderInt(_("Frame rate limit"),&settings.frameRateLimit,0,250,settings.frameRateLimit==0?_("Unlimited"):"%d")) { - settingsChanged=true; - } - if (settings.frameRateLimit<0) settings.frameRateLimit=0; - if (settings.frameRateLimit>1000) settings.frameRateLimit=1000; - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("only applies when VSync is disabled.")); - } - - bool displayRenderTimeB=settings.displayRenderTime; - if (ImGui::Checkbox(_("Display render time"),&displayRenderTimeB)) { - settings.displayRenderTime=displayRenderTimeB; - settingsChanged=true; - } - - if (settings.renderBackend!="Metal") { - bool renderClearPosB=settings.renderClearPos; - if (ImGui::Checkbox(_("Late render clear"),&renderClearPosB)) { - settings.renderClearPos=renderClearPosB; - settingsChanged=true; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("calls rend->clear() after rend->present(). might reduce UI latency by one frame in some drivers.")); - } - } - - bool powerSaveB=settings.powerSave; - if (ImGui::Checkbox(_("Power-saving mode"),&powerSaveB)) { - settings.powerSave=powerSaveB; - settingsChanged=true; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("saves power by lowering the frame rate to 2fps when idle.\nmay cause issues under Mesa drivers!")); - } - -#ifndef IS_MOBILE - bool noThreadedInputB=settings.noThreadedInput; - if (ImGui::Checkbox(_("Disable threaded input (restart after changing!)"),&noThreadedInputB)) { - settings.noThreadedInput=noThreadedInputB; - settingsChanged=true; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("threaded input processes key presses for note preview on a separate thread (on supported platforms), which reduces latency.\nhowever, crashes have been reported when threaded input is on. enable this option if that is the case.")); - } -#endif - - bool eventDelayB=settings.eventDelay; - if (ImGui::Checkbox(_("Enable event delay"),&eventDelayB)) { - settings.eventDelay=eventDelayB; - settingsChanged=true; - applyUISettings(false); - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("may cause issues with high-polling-rate mice when previewing notes.")); - } - pushWarningColor(settings.chanOscThreads>cpuCores,settings.chanOscThreads>(cpuCores*2)); if (ImGui::InputInt(_("Per-channel oscilloscope threads"),&settings.chanOscThreads)) { if (settings.chanOscThreads<0) settings.chanOscThreads=0; if (settings.chanOscThreads>(cpuCores*3)) settings.chanOscThreads=cpuCores*3; if (settings.chanOscThreads>256) settings.chanOscThreads=256; - settingsChanged=true; + SETTINGS_CHANGED; } if (settings.chanOscThreads>=(cpuCores*3)) { if (ImGui::IsItemHovered()) { @@ -975,14 +884,14 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("ImGui line plot"),settings.shaderOsc==0)) { settings.shaderOsc=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("render using Dear ImGui's built-in line drawing functions.")); } if (ImGui::RadioButton(_("GLSL (if available)"),settings.shaderOsc==1)) { settings.shaderOsc=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { #ifdef USE_GLES @@ -1000,13 +909,13 @@ void FurnaceGUI::drawSettings() { if (ImGui::SliderFloat(_("Strength"),&settings.vibrationStrength,0.0f,1.0f)) { if (settings.vibrationStrength<0.0f) settings.vibrationStrength=0.0f; if (settings.vibrationStrength>1.0f) settings.vibrationStrength=1.0f; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::SliderInt(_("Length"),&settings.vibrationLength,10,500)) { if (settings.vibrationLength<10) settings.vibrationLength=10; if (settings.vibrationLength>500) settings.vibrationLength=500; - settingsChanged=true; + SETTINGS_CHANGED; } #endif @@ -1016,19 +925,19 @@ void FurnaceGUI::drawSettings() { bool sysFileDialogB=settings.sysFileDialog; if (ImGui::Checkbox(_("Use system file picker"),&sysFileDialogB)) { settings.sysFileDialog=sysFileDialogB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::InputInt(_("Number of recent files"),&settings.maxRecentFile,1,5)) { if (settings.maxRecentFile<0) settings.maxRecentFile=0; if (settings.maxRecentFile>30) settings.maxRecentFile=30; - settingsChanged=true; + SETTINGS_CHANGED; } bool compressB=settings.compress; if (ImGui::Checkbox(_("Compress when saving"),&compressB)) { settings.compress=compressB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("use zlib to compress saved songs.")); @@ -1037,13 +946,13 @@ void FurnaceGUI::drawSettings() { bool saveUnusedPatternsB=settings.saveUnusedPatterns; if (ImGui::Checkbox(_("Save unused patterns"),&saveUnusedPatternsB)) { settings.saveUnusedPatterns=saveUnusedPatternsB; - settingsChanged=true; + SETTINGS_CHANGED; } bool newPatternFormatB=settings.newPatternFormat; if (ImGui::Checkbox(_("Use new pattern format when saving"),&newPatternFormatB)) { settings.newPatternFormat=newPatternFormatB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("use a packed format which saves space when saving songs.\ndisable if you need compatibility with older Furnace and/or tools\nwhich do not support this format.")); @@ -1052,7 +961,7 @@ void FurnaceGUI::drawSettings() { bool noDMFCompatB=settings.noDMFCompat; if (ImGui::Checkbox(_("Don't apply compatibility flags when loading .dmf"),&noDMFCompatB)) { settings.noDMFCompat=noDMFCompatB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("do not report any issues arising from the use of this option!")); @@ -1062,15 +971,15 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("No##pol0"),settings.playOnLoad==0)) { settings.playOnLoad=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Only if already playing##pol1"),settings.playOnLoad==1)) { settings.playOnLoad=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes##pol0"),settings.playOnLoad==2)) { settings.playOnLoad=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -1078,32 +987,32 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Set to these values on start-up:##fot0"),settings.persistFadeOut==0)) { settings.persistFadeOut=0; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::BeginDisabled(settings.persistFadeOut); ImGui::Indent(); if (ImGui::InputInt(_("Loops"),&settings.exportLoops,1,2)) { if (settings.exportLoops<0) settings.exportLoops=0; audioExportOptions.loops=settings.exportLoops; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::InputDouble(_("Fade out (seconds)"),&settings.exportFadeOut,1.0,2.0,"%.1f")) { if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; audioExportOptions.fadeOut=settings.exportFadeOut; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); ImGui::EndDisabled(); if (ImGui::RadioButton(_("Remember last values##fot1"),settings.persistFadeOut==1)) { settings.persistFadeOut=1; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool writeInsNamesB=settings.writeInsNames; if (ImGui::Checkbox(_("Store instrument name in .fui"),&writeInsNamesB)) { settings.writeInsNames=writeInsNamesB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("when enabled, saving an instrument will store its name.\nthis may increase file size.")); @@ -1112,7 +1021,7 @@ void FurnaceGUI::drawSettings() { bool readInsNamesB=settings.readInsNames; if (ImGui::Checkbox(_("Load instrument name from .fui"),&readInsNamesB)) { settings.readInsNames=readInsNamesB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("when enabled, loading an instrument will use the stored name (if present).\notherwise, it will use the file name.")); @@ -1121,7 +1030,7 @@ void FurnaceGUI::drawSettings() { bool autoFillSaveB=settings.autoFillSave; if (ImGui::Checkbox(_("Auto-fill file name when saving"),&autoFillSaveB)) { settings.autoFillSave=autoFillSaveB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("fill the file name field with an appropriate file name when saving or exporting.")); @@ -1142,7 +1051,7 @@ void FurnaceGUI::drawSettings() { settings.initialSys.set(fmt::sprintf("flags%d",i),e->song.systemFlags[i].toBase64()); } settings.initialSysName=e->song.systemName; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::SameLine(); if (ImGui::Button(_("Randomize"))) { @@ -1196,7 +1105,7 @@ void FurnaceGUI::drawSettings() { settings.initialSysName+=wordPool[i][rand()%wordPool[i].size()]; settings.initialSysName+=" "; } - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::SameLine(); if (ImGui::Button(_("Reset to defaults"))) { @@ -1212,14 +1121,14 @@ void FurnaceGUI::drawSettings() { settings.initialSys.set("fr1",0.0f); settings.initialSys.set("flags1",""); settings.initialSysName="Sega Genesis/Mega Drive"; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::AlignTextToFramePadding(); ImGui::Text(_("Name")); ImGui::SameLine(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::InputText("##InitSysName",&settings.initialSysName)) settingsChanged=true; + if (ImGui::InputText("##InitSysName",&settings.initialSysName)) SETTINGS_CHANGED; int sysCount=0; int doRemove=-1; @@ -1245,7 +1154,7 @@ void FurnaceGUI::drawSettings() { { settings.initialSys.set(fmt::sprintf("id%d",i),(int)e->systemToFileFur(sysID)); settings.initialSys.set(fmt::sprintf("flags%d",i),""); - settingsChanged=true; + SETTINGS_CHANGED; ImGui::CloseCurrentPopup(); } @@ -1257,14 +1166,14 @@ void FurnaceGUI::drawSettings() { if (ImGui::Checkbox(_("Invert"),&doInvert)) { sysVol=-sysVol; settings.initialSys.set(fmt::sprintf("vol%d",i),sysVol); - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::SameLine(); //ImGui::BeginDisabled(settings.initialSys.size()<=4); pushDestColor(); if (ImGui::Button(ICON_FA_MINUS "##InitSysRemove")) { doRemove=i; - settingsChanged=true; + SETTINGS_CHANGED; } popDestColor(); //ImGui::EndDisabled(); @@ -1277,21 +1186,21 @@ void FurnaceGUI::drawSettings() { if (vol>10) vol=10; sysVol=doInvert?-vol:vol; settings.initialSys.set(fmt::sprintf("vol%d",i),(float)sysVol); - settingsChanged=true; + SETTINGS_CHANGED; } rightClickable ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); if (CWSliderFloat(_("Panning"),&sysPan,-1.0f,1.0f)) { if (sysPan<-1.0f) sysPan=-1.0f; if (sysPan>1.0f) sysPan=1.0f; settings.initialSys.set(fmt::sprintf("pan%d",i),(float)sysPan); - settingsChanged=true; + SETTINGS_CHANGED; } rightClickable ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); if (CWSliderFloat(_("Front/Rear"),&sysPanFR,-1.0f,1.0f)) { if (sysPanFR<-1.0f) sysPanFR=-1.0f; if (sysPanFR>1.0f) sysPanFR=1.0f; settings.initialSys.set(fmt::sprintf("fr%d",i),(float)sysPanFR); - settingsChanged=true; + SETTINGS_CHANGED; } rightClickable // oh please MSVC don't cry @@ -1303,7 +1212,7 @@ void FurnaceGUI::drawSettings() { settings.initialSys.set(fmt::sprintf("flags%d",i),sysFlags.toBase64()); } ImGui::TreePop(); - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::PopID(); @@ -1342,13 +1251,13 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Display system preset selector##NSB0"),settings.newSongBehavior==0)) { settings.newSongBehavior=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Start with initial system##NSB1"),settings.newSongBehavior==1)) { settings.newSongBehavior=1; - settingsChanged=true; + SETTINGS_CHANGED; } - if (ImGui::InputText(_("Default author name"), &settings.defaultAuthorName)) settingsChanged=true; + if (ImGui::InputText(_("Default author name"), &settings.defaultAuthorName)) SETTINGS_CHANGED; ImGui::Unindent(); // SUBSECTION START-UP @@ -1357,26 +1266,26 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("No##pis0"),settings.alwaysPlayIntro==0)) { settings.alwaysPlayIntro=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Short##pis1"),settings.alwaysPlayIntro==1)) { settings.alwaysPlayIntro=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Full (short when loading song)##pis2"),settings.alwaysPlayIntro==2)) { settings.alwaysPlayIntro=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Full (always)##pis3"),settings.alwaysPlayIntro==3)) { settings.alwaysPlayIntro=3; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool disableFadeInB=settings.disableFadeIn; if (ImGui::Checkbox(_("Disable fade-in during start-up"),&disableFadeInB)) { settings.disableFadeIn=disableFadeInB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION BEHAVIOR @@ -1384,7 +1293,7 @@ void FurnaceGUI::drawSettings() { bool blankInsB=settings.blankIns; if (ImGui::Checkbox(_("New instruments are blank"),&blankInsB)) { settings.blankIns=blankInsB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION CONFIGURATION @@ -1407,7 +1316,7 @@ void FurnaceGUI::drawSettings() { bool s3mOPL3B=settings.s3mOPL3; if (ImGui::Checkbox(_("Use OPL3 instead of OPL2 for S3M import"),&s3mOPL3B)) { settings.s3mOPL3=s3mOPL3B; - settingsChanged=true; + SETTINGS_CHANGED; } #ifdef ANDROID @@ -1416,7 +1325,7 @@ void FurnaceGUI::drawSettings() { bool backgroundPlayB=settings.backgroundPlay; if (ImGui::Checkbox(_("Enable background playback (restart!)"),&backgroundPlayB)) { settings.backgroundPlay=backgroundPlayB; - settingsChanged=true; + SETTINGS_CHANGED; } #endif @@ -1439,17 +1348,17 @@ void FurnaceGUI::drawSettings() { #ifdef HAVE_JACK if (ImGui::Selectable("JACK",settings.audioEngine==DIV_AUDIO_JACK)) { settings.audioEngine=DIV_AUDIO_JACK; - settingsChanged=true; + SETTINGS_CHANGED; } #endif if (ImGui::Selectable("SDL",settings.audioEngine==DIV_AUDIO_SDL)) { settings.audioEngine=DIV_AUDIO_SDL; - settingsChanged=true; + SETTINGS_CHANGED; } #ifdef HAVE_PA if (ImGui::Selectable("PortAudio",settings.audioEngine==DIV_AUDIO_PORTAUDIO)) { settings.audioEngine=DIV_AUDIO_PORTAUDIO; - settingsChanged=true; + SETTINGS_CHANGED; } #endif if (settings.audioEngine!=prevAudioEngine) { @@ -1470,12 +1379,12 @@ void FurnaceGUI::drawSettings() { if (ImGui::BeginCombo("##SDLADriver",settings.sdlAudioDriver.empty()?_("Automatic"):settings.sdlAudioDriver.c_str())) { if (ImGui::Selectable(_("Automatic"),settings.sdlAudioDriver.empty())) { settings.sdlAudioDriver=""; - settingsChanged=true; + SETTINGS_CHANGED; } for (String& i: availAudioDrivers) { if (ImGui::Selectable(i.c_str(),i==settings.sdlAudioDriver)) { settings.sdlAudioDriver=i; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndCombo(); @@ -1506,12 +1415,12 @@ void FurnaceGUI::drawSettings() { if (ImGui::BeginCombo("##AudioDevice",audioDevName.c_str())) { if (ImGui::Selectable(_(""),settings.audioDevice.empty())) { settings.audioDevice=""; - settingsChanged=true; + SETTINGS_CHANGED; } for (String& i: e->getAudioDevices()) { if (ImGui::Selectable(i.c_str(),i==settings.audioDevice)) { settings.audioDevice=i; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndCombo(); @@ -1545,7 +1454,7 @@ void FurnaceGUI::drawSettings() { if (ImGui::InputInt("##AudioChansI",&settings.audioChans,1,2)) { if (settings.audioChans<1) settings.audioChans=1; if (settings.audioChans>16) settings.audioChans=16; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("common values:\n- 1 for mono\n- 2 for stereo")); @@ -1576,7 +1485,7 @@ void FurnaceGUI::drawSettings() { } else { settings.renderPoolThreads=0; } - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("runs chip emulation on separate threads.\nmay increase performance when using heavy emulation cores.\n\nwarnings:\n- experimental!\n- only useful on multi-chip songs.")); @@ -1587,7 +1496,7 @@ void FurnaceGUI::drawSettings() { if (ImGui::InputInt(_("Number of threads"),&settings.renderPoolThreads)) { if (settings.renderPoolThreads<2) settings.renderPoolThreads=2; if (settings.renderPoolThreads>32) settings.renderPoolThreads=32; - settingsChanged=true; + SETTINGS_CHANGED; } if (settings.renderPoolThreads>=DIV_MAX_CHIPS) { if (ImGui::IsItemHovered()) { @@ -1604,7 +1513,7 @@ void FurnaceGUI::drawSettings() { bool lowLatencyB=settings.lowLatency; if (ImGui::Checkbox(_("Low-latency mode"),&lowLatencyB)) { settings.lowLatency=lowLatencyB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("reduces latency by running the engine faster than the tick rate.\nuseful for live playback/jam mode.\n\nwarning: only enable if your buffer size is small (10ms or less).")); @@ -1613,7 +1522,7 @@ void FurnaceGUI::drawSettings() { bool forceMonoB=settings.forceMono; if (ImGui::Checkbox(_("Force mono audio"),&forceMonoB)) { settings.forceMono=forceMonoB; - settingsChanged=true; + SETTINGS_CHANGED; } if (settings.audioEngine==DIV_AUDIO_PORTAUDIO) { @@ -1621,7 +1530,7 @@ void FurnaceGUI::drawSettings() { bool wasapiExB=settings.wasapiEx; if (ImGui::Checkbox(_("Exclusive mode"),&wasapiExB)) { settings.wasapiEx=wasapiExB; - settingsChanged=true; + SETTINGS_CHANGED; } } } @@ -1642,18 +1551,18 @@ void FurnaceGUI::drawSettings() { ImGui::AlignTextToFramePadding(); ImGui::Text(_("Quality")); ImGui::SameLine(); - if (ImGui::Combo("##Quality",&settings.audioQuality,LocalizedComboGetter,audioQualities,2)) settingsChanged=true; + if (ImGui::Combo("##Quality",&settings.audioQuality,LocalizedComboGetter,audioQualities,2)) SETTINGS_CHANGED; bool clampSamplesB=settings.clampSamples; if (ImGui::Checkbox(_("Software clipping"),&clampSamplesB)) { settings.clampSamples=clampSamplesB; - settingsChanged=true; + SETTINGS_CHANGED; } bool audioHiPassB=settings.audioHiPass; if (ImGui::Checkbox(_("DC offset correction"),&audioHiPassB)) { settings.audioHiPass=audioHiPassB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION METRONOME @@ -1665,7 +1574,7 @@ void FurnaceGUI::drawSettings() { if (settings.metroVol<0) settings.metroVol=0; if (settings.metroVol>200) settings.metroVol=200; e->setMetronomeVol(((float)settings.metroVol)/100.0f); - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION SAMPLE PREVIEW @@ -1677,7 +1586,7 @@ void FurnaceGUI::drawSettings() { if (settings.sampleVol<0) settings.sampleVol=0; if (settings.sampleVol>100) settings.sampleVol=100; e->setSamplePreviewVol(((float)settings.sampleVol)/100.0f); - settingsChanged=true; + SETTINGS_CHANGED; } END_SECTION; @@ -1694,13 +1603,13 @@ void FurnaceGUI::drawSettings() { if (ImGui::Selectable(_(""),settings.midiInDevice.empty())) { settings.midiInDevice=""; hasToReloadMidi=true; - settingsChanged=true; + SETTINGS_CHANGED; } for (String& i: e->getMidiIns()) { if (ImGui::Selectable(i.c_str(),i==settings.midiInDevice)) { settings.midiInDevice=i; hasToReloadMidi=true; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndCombo(); @@ -1718,71 +1627,71 @@ void FurnaceGUI::drawSettings() { midiMap.compile(); } - if (ImGui::Checkbox(_("Note input"),&midiMap.noteInput)) settingsChanged=true; - if (ImGui::Checkbox(_("Velocity input"),&midiMap.volInput)) settingsChanged=true; + if (ImGui::Checkbox(_("Note input"),&midiMap.noteInput)) SETTINGS_CHANGED; + if (ImGui::Checkbox(_("Velocity input"),&midiMap.volInput)) SETTINGS_CHANGED; // TODO //ImGui::Checkbox(_("Use raw velocity value (don't map from linear to log)"),&midiMap.rawVolume); //ImGui::Checkbox(_("Polyphonic/chord input"),&midiMap.polyInput); if (ImGui::Checkbox(_("Map MIDI channels to direct channels"),&midiMap.directChannel)) { e->setMidiDirect(midiMap.directChannel); e->setMidiDirectProgram(midiMap.directChannel && midiMap.directProgram); - settingsChanged=true; + SETTINGS_CHANGED; } if (midiMap.directChannel) { if (ImGui::Checkbox(_("Program change pass-through"),&midiMap.directProgram)) { e->setMidiDirectProgram(midiMap.directChannel && midiMap.directProgram); - settingsChanged=true; + SETTINGS_CHANGED; } } - if (ImGui::Checkbox(_("Map Yamaha FM voice data to instruments"),&midiMap.yamahaFMResponse)) settingsChanged=true; + if (ImGui::Checkbox(_("Map Yamaha FM voice data to instruments"),&midiMap.yamahaFMResponse)) SETTINGS_CHANGED; if (!(midiMap.directChannel && midiMap.directProgram)) { - if (ImGui::Checkbox(_("Program change is instrument selection"),&midiMap.programChange)) settingsChanged=true; + if (ImGui::Checkbox(_("Program change is instrument selection"),&midiMap.programChange)) SETTINGS_CHANGED; } //ImGui::Checkbox(_("Listen to MIDI clock"),&midiMap.midiClock); //ImGui::Checkbox(_("Listen to MIDI time code"),&midiMap.midiTimeCode); - if (ImGui::Combo(_("Value input style"),&midiMap.valueInputStyle,LocalizedComboGetter,valueInputStyles,7)) settingsChanged=true; + if (ImGui::Combo(_("Value input style"),&midiMap.valueInputStyle,LocalizedComboGetter,valueInputStyles,7)) SETTINGS_CHANGED; if (midiMap.valueInputStyle>3) { if (midiMap.valueInputStyle==6) { if (ImGui::InputInt(_("Control##valueCCS"),&midiMap.valueInputControlSingle,1,16)) { if (midiMap.valueInputControlSingle<0) midiMap.valueInputControlSingle=0; if (midiMap.valueInputControlSingle>127) midiMap.valueInputControlSingle=127; - settingsChanged=true; + SETTINGS_CHANGED; } } else { if (ImGui::InputInt((midiMap.valueInputStyle==4)?_("CC of upper nibble##valueCC1"):_("MSB CC##valueCC1"),&midiMap.valueInputControlMSB,1,16)) { if (midiMap.valueInputControlMSB<0) midiMap.valueInputControlMSB=0; if (midiMap.valueInputControlMSB>127) midiMap.valueInputControlMSB=127; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::InputInt((midiMap.valueInputStyle==4)?_("CC of lower nibble##valueCC2"):_("LSB CC##valueCC2"),&midiMap.valueInputControlLSB,1,16)) { if (midiMap.valueInputControlLSB<0) midiMap.valueInputControlLSB=0; if (midiMap.valueInputControlLSB>127) midiMap.valueInputControlLSB=127; - settingsChanged=true; + SETTINGS_CHANGED; } } } if (ImGui::TreeNode(_("Per-column control change"))) { for (int i=0; i<18; i++) { ImGui::PushID(i); - if (ImGui::Combo(specificControls[i],&midiMap.valueInputSpecificStyle[i],LocalizedComboGetter,valueSInputStyles,4)) settingsChanged=true; + if (ImGui::Combo(specificControls[i],&midiMap.valueInputSpecificStyle[i],LocalizedComboGetter,valueSInputStyles,4)) SETTINGS_CHANGED; if (midiMap.valueInputSpecificStyle[i]>0) { ImGui::Indent(); if (midiMap.valueInputSpecificStyle[i]==3) { if (ImGui::InputInt(_("Control##valueCCS"),&midiMap.valueInputSpecificSingle[i],1,16)) { if (midiMap.valueInputSpecificSingle[i]<0) midiMap.valueInputSpecificSingle[i]=0; if (midiMap.valueInputSpecificSingle[i]>127) midiMap.valueInputSpecificSingle[i]=127; - settingsChanged=true; + SETTINGS_CHANGED; } } else { if (ImGui::InputInt((midiMap.valueInputSpecificStyle[i]==4)?_("CC of upper nibble##valueCC1"):_("MSB CC##valueCC1"),&midiMap.valueInputSpecificMSB[i],1,16)) { if (midiMap.valueInputSpecificMSB[i]<0) midiMap.valueInputSpecificMSB[i]=0; if (midiMap.valueInputSpecificMSB[i]>127) midiMap.valueInputSpecificMSB[i]=127; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::InputInt((midiMap.valueInputSpecificStyle[i]==4)?_("CC of lower nibble##valueCC2"):_("LSB CC##valueCC2"),&midiMap.valueInputSpecificLSB[i],1,16)) { if (midiMap.valueInputSpecificLSB[i]<0) midiMap.valueInputSpecificLSB[i]=0; if (midiMap.valueInputSpecificLSB[i]>127) midiMap.valueInputSpecificLSB[i]=127; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::Unindent(); @@ -1795,7 +1704,7 @@ void FurnaceGUI::drawSettings() { if (midiMap.volExp<0.01) midiMap.volExp=0.01; if (midiMap.volExp>8.0) midiMap.volExp=8.0; e->setMidiVolExp(midiMap.volExp); - settingsChanged=true; + SETTINGS_CHANGED; } rightClickable float curve[128]; for (int i=0; i<128; i++) { @@ -1808,13 +1717,13 @@ void FurnaceGUI::drawSettings() { ImGui::SameLine(); if (ImGui::Button(ICON_FA_PLUS "##AddAction")) { midiMap.binds.push_back(MIDIBind()); - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::SameLine(); if (ImGui::Button(ICON_FA_EXTERNAL_LINK "##AddLearnAction")) { midiMap.binds.push_back(MIDIBind()); learning=midiMap.binds.size()-1; - settingsChanged=true; + SETTINGS_CHANGED; } if (learning!=-1) { ImGui::SameLine(); @@ -1856,7 +1765,7 @@ void FurnaceGUI::drawSettings() { for (int j=8; j<15; j++) { if (ImGui::Selectable(messageTypes[j],bind.type==j)) { bind.type=j; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndCombo(); @@ -1867,12 +1776,12 @@ void FurnaceGUI::drawSettings() { if (ImGui::BeginCombo("##BChannel",messageChannels[bind.channel])) { if (ImGui::Selectable(messageChannels[16],bind.channel==16)) { bind.channel=16; - settingsChanged=true; + SETTINGS_CHANGED; } for (int j=0; j<16; j++) { if (ImGui::Selectable(messageChannels[j],bind.channel==j)) { bind.channel=j; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndCombo(); @@ -1892,7 +1801,7 @@ void FurnaceGUI::drawSettings() { if (ImGui::BeginCombo("##BValue1",bindID)) { if (ImGui::Selectable(_("Any"),bind.data1==128)) { bind.data1=128; - settingsChanged=true; + SETTINGS_CHANGED; } for (int j=0; j<128; j++) { const char* nName="???"; @@ -1902,7 +1811,7 @@ void FurnaceGUI::drawSettings() { snprintf(bindID,1024,"%d (0x%.2X, %s)##BV1_%d",j,j,nName,j); if (ImGui::Selectable(bindID,bind.data1==j)) { bind.data1=j; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndCombo(); @@ -1918,13 +1827,13 @@ void FurnaceGUI::drawSettings() { if (ImGui::BeginCombo("##BValue2",bindID)) { if (ImGui::Selectable(_("Any"),bind.data2==128)) { bind.data2=128; - settingsChanged=true; + SETTINGS_CHANGED; } for (int j=0; j<128; j++) { snprintf(bindID,1024,"%d (0x%.2X)##BV2_%d",j,j,j); if (ImGui::Selectable(bindID,bind.data2==j)) { bind.data2=j; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndCombo(); @@ -1935,7 +1844,7 @@ void FurnaceGUI::drawSettings() { if (ImGui::BeginCombo("##BAction",(bind.action==0)?_("--none--"):guiActions[bind.action].friendlyName)) { if (ImGui::Selectable(_("--none--"),bind.action==0)) { bind.action=0; - settingsChanged=true; + SETTINGS_CHANGED; } for (int j=0; j"),settings.midiOutDevice.empty())) { settings.midiOutDevice=""; - settingsChanged=true; + SETTINGS_CHANGED; } for (String& i: e->getMidiIns()) { if (ImGui::Selectable(i.c_str(),i==settings.midiOutDevice)) { settings.midiOutDevice=i; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndCombo(); @@ -2001,11 +1910,11 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Off (use for TX81Z)"),settings.midiOutMode==0)) { settings.midiOutMode=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Melodic"),settings.midiOutMode==1)) { settings.midiOutMode=1; - settingsChanged=true; + SETTINGS_CHANGED; } /* if (ImGui::RadioButton(_("Light Show (use for Launchpad)"),settings.midiOutMode==2)) { @@ -2016,19 +1925,19 @@ void FurnaceGUI::drawSettings() { bool midiOutProgramChangeB=settings.midiOutProgramChange; if (ImGui::Checkbox(_("Send Program Change"),&midiOutProgramChangeB)) { settings.midiOutProgramChange=midiOutProgramChangeB; - settingsChanged=true; + SETTINGS_CHANGED; } bool midiOutClockB=settings.midiOutClock; if (ImGui::Checkbox(_("Send MIDI clock"),&midiOutClockB)) { settings.midiOutClock=midiOutClockB; - settingsChanged=true; + SETTINGS_CHANGED; } bool midiOutTimeB=settings.midiOutTime; if (ImGui::Checkbox(_("Send MIDI timecode"),&midiOutTimeB)) { settings.midiOutTime=midiOutTimeB; - settingsChanged=true; + SETTINGS_CHANGED; } if (settings.midiOutTime) { @@ -2036,23 +1945,23 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Closest to Tick Rate"),settings.midiOutTimeRate==0)) { settings.midiOutTimeRate=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Film (24fps)"),settings.midiOutTimeRate==1)) { settings.midiOutTimeRate=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("PAL (25fps)"),settings.midiOutTimeRate==2)) { settings.midiOutTimeRate=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("NTSC drop (29.97fps)"),settings.midiOutTimeRate==3)) { settings.midiOutTimeRate=3; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("NTSC non-drop (30fps)"),settings.midiOutTimeRate==4)) { settings.midiOutTimeRate=4; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); } @@ -2086,10 +1995,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("YM2151"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##ArcadeCore",&settings.arcadeCore,arcadeCores,2)) settingsChanged=true; + if (ImGui::Combo("##ArcadeCore",&settings.arcadeCore,arcadeCores,2)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##ArcadeCoreRender",&settings.arcadeCoreRender,arcadeCores,2)) settingsChanged=true; + if (ImGui::Combo("##ArcadeCoreRender",&settings.arcadeCoreRender,arcadeCores,2)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2097,10 +2006,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("YM2612"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##YM2612Core",&settings.ym2612Core,ym2612Cores,3)) settingsChanged=true; + if (ImGui::Combo("##YM2612Core",&settings.ym2612Core,ym2612Cores,3)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##YM2612CoreRender",&settings.ym2612CoreRender,ym2612Cores,3)) settingsChanged=true; + if (ImGui::Combo("##YM2612CoreRender",&settings.ym2612CoreRender,ym2612Cores,3)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2108,10 +2017,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("SN76489"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##SNCore",&settings.snCore,snCores,2)) settingsChanged=true; + if (ImGui::Combo("##SNCore",&settings.snCore,snCores,2)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##SNCoreRender",&settings.snCoreRender,snCores,2)) settingsChanged=true; + if (ImGui::Combo("##SNCoreRender",&settings.snCoreRender,snCores,2)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2119,10 +2028,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("NES"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##NESCore",&settings.nesCore,nesCores,2)) settingsChanged=true; + if (ImGui::Combo("##NESCore",&settings.nesCore,nesCores,2)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##NESCoreRender",&settings.nesCoreRender,nesCores,2)) settingsChanged=true; + if (ImGui::Combo("##NESCoreRender",&settings.nesCoreRender,nesCores,2)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2130,10 +2039,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("FDS"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##FDSCore",&settings.fdsCore,nesCores,2)) settingsChanged=true; + if (ImGui::Combo("##FDSCore",&settings.fdsCore,nesCores,2)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##FDSCoreRender",&settings.fdsCoreRender,nesCores,2)) settingsChanged=true; + if (ImGui::Combo("##FDSCoreRender",&settings.fdsCoreRender,nesCores,2)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2141,10 +2050,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("SID"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##C64Core",&settings.c64Core,c64Cores,3)) settingsChanged=true; + if (ImGui::Combo("##C64Core",&settings.c64Core,c64Cores,3)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##C64CoreRender",&settings.c64CoreRender,c64Cores,3)) settingsChanged=true; + if (ImGui::Combo("##C64CoreRender",&settings.c64CoreRender,c64Cores,3)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2152,10 +2061,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("POKEY"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##POKEYCore",&settings.pokeyCore,pokeyCores,2)) settingsChanged=true; + if (ImGui::Combo("##POKEYCore",&settings.pokeyCore,pokeyCores,2)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##POKEYCoreRender",&settings.pokeyCoreRender,pokeyCores,2)) settingsChanged=true; + if (ImGui::Combo("##POKEYCoreRender",&settings.pokeyCoreRender,pokeyCores,2)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2163,10 +2072,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("OPN"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNCore",&settings.opn1Core,opnCores,3)) settingsChanged=true; + if (ImGui::Combo("##OPNCore",&settings.opn1Core,opnCores,3)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNCoreRender",&settings.opn1CoreRender,opnCores,3)) settingsChanged=true; + if (ImGui::Combo("##OPNCoreRender",&settings.opn1CoreRender,opnCores,3)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2174,10 +2083,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("OPNA"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNACore",&settings.opnaCore,opnCores,3)) settingsChanged=true; + if (ImGui::Combo("##OPNACore",&settings.opnaCore,opnCores,3)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNACoreRender",&settings.opnaCoreRender,opnCores,3)) settingsChanged=true; + if (ImGui::Combo("##OPNACoreRender",&settings.opnaCoreRender,opnCores,3)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2185,10 +2094,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("OPNB"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNBCore",&settings.opnbCore,opnCores,3)) settingsChanged=true; + if (ImGui::Combo("##OPNBCore",&settings.opnbCore,opnCores,3)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNBCoreRender",&settings.opnbCoreRender,opnCores,3)) settingsChanged=true; + if (ImGui::Combo("##OPNBCoreRender",&settings.opnbCoreRender,opnCores,3)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2196,10 +2105,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("OPL/OPL2/Y8950"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL2Core",&settings.opl2Core,opl2Cores,3)) settingsChanged=true; + if (ImGui::Combo("##OPL2Core",&settings.opl2Core,opl2Cores,3)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL2CoreRender",&settings.opl2CoreRender,opl2Cores,3)) settingsChanged=true; + if (ImGui::Combo("##OPL2CoreRender",&settings.opl2CoreRender,opl2Cores,3)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2207,10 +2116,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("OPL3"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL3Core",&settings.opl3Core,opl3Cores,3)) settingsChanged=true; + if (ImGui::Combo("##OPL3Core",&settings.opl3Core,opl3Cores,3)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL3CoreRender",&settings.opl3CoreRender,opl3Cores,3)) settingsChanged=true; + if (ImGui::Combo("##OPL3CoreRender",&settings.opl3CoreRender,opl3Cores,3)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2218,10 +2127,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("OPL4"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL4Core",&settings.opl4Core,opl4Cores,2)) settingsChanged=true; + if (ImGui::Combo("##OPL4Core",&settings.opl4Core,opl4Cores,2)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL4CoreRender",&settings.opl4CoreRender,opl4Cores,2)) settingsChanged=true; + if (ImGui::Combo("##OPL4CoreRender",&settings.opl4CoreRender,opl4Cores,2)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2229,10 +2138,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("ESFM"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##ESFMCore",&settings.esfmCore,LocalizedComboGetter,esfmCores,2)) settingsChanged=true; + if (ImGui::Combo("##ESFMCore",&settings.esfmCore,LocalizedComboGetter,esfmCores,2)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##ESFMCoreRender",&settings.esfmCoreRender,LocalizedComboGetter,esfmCores,2)) settingsChanged=true; + if (ImGui::Combo("##ESFMCoreRender",&settings.esfmCoreRender,LocalizedComboGetter,esfmCores,2)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2240,10 +2149,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("OPLL"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPLLCore",&settings.opllCore,opllCores,2)) settingsChanged=true; + if (ImGui::Combo("##OPLLCore",&settings.opllCore,opllCores,2)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPLLCoreRender",&settings.opllCoreRender,opllCores,2)) settingsChanged=true; + if (ImGui::Combo("##OPLLCoreRender",&settings.opllCoreRender,opllCores,2)) SETTINGS_CHANGED; ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -2251,10 +2160,10 @@ void FurnaceGUI::drawSettings() { ImGui::Text("AY-3-8910/SSG"); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##AYCore",&settings.ayCore,ayCores,2)) settingsChanged=true; + if (ImGui::Combo("##AYCore",&settings.ayCore,ayCores,2)) SETTINGS_CHANGED; ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##AYCoreRender",&settings.ayCoreRender,ayCores,2)) settingsChanged=true; + if (ImGui::Combo("##AYCoreRender",&settings.ayCoreRender,ayCores,2)) SETTINGS_CHANGED; ImGui::EndTable(); } @@ -2300,7 +2209,7 @@ void FurnaceGUI::drawSettings() { ImGui::AlignTextToFramePadding(); ImGui::Text(_("PC Speaker strategy")); ImGui::SameLine(); - if (ImGui::Combo("##PCSOutMethod",&settings.pcSpeakerOutMethod,LocalizedComboGetter,pcspkrOutMethods,5)) settingsChanged=true; + if (ImGui::Combo("##PCSOutMethod",&settings.pcSpeakerOutMethod,LocalizedComboGetter,pcspkrOutMethods,5)) SETTINGS_CHANGED; ImGui::Separator(); ImGui::Text(_("Sample ROMs:")); @@ -2495,14 +2404,14 @@ void FurnaceGUI::drawSettings() { if (i.val<0) i.val=0; if (i.val>96) i.val=96; noteKeys[i.scan]=i.val; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::TableNextColumn(); snprintf(id,4095,ICON_FA_TIMES "##SNRemove_%d",i.scan); if (ImGui::Button(id)) { noteKeys.erase(i.scan); - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndTable(); @@ -2515,7 +2424,7 @@ void FurnaceGUI::drawSettings() { snprintf(id,4095,"%s##SNNewKey_%d",sName,i); if (ImGui::Selectable(id)) { noteKeys[(SDL_Scancode)i]=0; - settingsChanged=true; + SETTINGS_CHANGED; } } ImGui::EndCombo(); @@ -2752,14 +2661,14 @@ void FurnaceGUI::drawSettings() { bool allowEditDockingB=settings.allowEditDocking; if (ImGui::Checkbox(_("Allow docking editors"),&allowEditDockingB)) { settings.allowEditDocking=allowEditDockingB; - settingsChanged=true; + SETTINGS_CHANGED; } #ifndef IS_MOBILE bool saveWindowPosB=settings.saveWindowPos; if (ImGui::Checkbox(_("Remember window position"),&saveWindowPosB)) { settings.saveWindowPos=saveWindowPosB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("remembers the window's last position on start-up.")); @@ -2770,32 +2679,32 @@ void FurnaceGUI::drawSettings() { if (ImGui::Checkbox(_("Only allow window movement when clicking on title bar"),&moveWindowTitleB)) { settings.moveWindowTitle=moveWindowTitleB; applyUISettings(false); - settingsChanged=true; + SETTINGS_CHANGED; } bool centerPopupB=settings.centerPopup; if (ImGui::Checkbox(_("Center pop-up windows"),¢erPopupB)) { settings.centerPopup=centerPopupB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Play/edit controls layout:")); ImGui::Indent(); if (ImGui::RadioButton(_("Classic##ecl0"),settings.controlLayout==0)) { settings.controlLayout=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Compact##ecl1"),settings.controlLayout==1)) { settings.controlLayout=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Compact (vertical)##ecl2"),settings.controlLayout==2)) { settings.controlLayout=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Split##ecl3"),settings.controlLayout==3)) { settings.controlLayout=3; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -2803,15 +2712,15 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Top##obp0"),settings.orderButtonPos==0)) { settings.orderButtonPos=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Left##obp1"),settings.orderButtonPos==1)) { settings.orderButtonPos=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Right##obp2"),settings.orderButtonPos==2)) { settings.orderButtonPos=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -2823,38 +2732,38 @@ void FurnaceGUI::drawSettings() { if (settings.doubleClickTime>1.0) settings.doubleClickTime=1.0; applyUISettings(false); - settingsChanged=true; + SETTINGS_CHANGED; } bool avoidRaisingPatternB=settings.avoidRaisingPattern; if (ImGui::Checkbox(_("Don't raise pattern editor on click"),&avoidRaisingPatternB)) { settings.avoidRaisingPattern=avoidRaisingPatternB; - settingsChanged=true; + SETTINGS_CHANGED; } bool insFocusesPatternB=settings.insFocusesPattern; if (ImGui::Checkbox(_("Focus pattern editor when selecting instrument"),&insFocusesPatternB)) { settings.insFocusesPattern=insFocusesPatternB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Note preview behavior:")); ImGui::Indent(); if (ImGui::RadioButton(_("Never##npb0"),settings.notePreviewBehavior==0)) { settings.notePreviewBehavior=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("When cursor is in Note column##npb1"),settings.notePreviewBehavior==1)) { settings.notePreviewBehavior=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("When cursor is in Note column or not in edit mode##npb2"),settings.notePreviewBehavior==2)) { settings.notePreviewBehavior=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Always##npb3"),settings.notePreviewBehavior==3)) { settings.notePreviewBehavior=3; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -2862,15 +2771,15 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("No##dms0"),settings.dragMovesSelection==0)) { settings.dragMovesSelection=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes##dms1"),settings.dragMovesSelection==1)) { settings.dragMovesSelection=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes (while holding Ctrl only)##dms2"),settings.dragMovesSelection==2)) { settings.dragMovesSelection=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -2878,15 +2787,15 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Right-click or double-click##soloA"),settings.soloAction==0)) { settings.soloAction=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Right-click##soloR"),settings.soloAction==1)) { settings.soloAction=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Double-click##soloD"),settings.soloAction==2)) { settings.soloAction=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -2894,27 +2803,27 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Ctrl or Meta/Cmd##cwm1"),settings.ctrlWheelModifier==0)) { settings.ctrlWheelModifier=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Ctrl##cwm2"),settings.ctrlWheelModifier==1)) { settings.ctrlWheelModifier=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Meta/Cmd##cwm3"),settings.ctrlWheelModifier==2)) { settings.ctrlWheelModifier=2; - settingsChanged=true; + SETTINGS_CHANGED; } // technically this key is called Option on mac, but we call it Alt in getKeyName(s) if (ImGui::RadioButton(_("Alt##cwm4"),settings.ctrlWheelModifier==3)) { settings.ctrlWheelModifier=3; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool doubleClickColumnB=settings.doubleClickColumn; if (ImGui::Checkbox(_("Double click selects entire column"),&doubleClickColumnB)) { settings.doubleClickColumn=doubleClickColumnB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION CURSOR BEHAVIOR @@ -2922,65 +2831,65 @@ void FurnaceGUI::drawSettings() { bool insertBehaviorB=settings.insertBehavior; if (ImGui::Checkbox(_("Insert pushes entire channel row"),&insertBehaviorB)) { settings.insertBehavior=insertBehaviorB; - settingsChanged=true; + SETTINGS_CHANGED; } bool pullDeleteRowB=settings.pullDeleteRow; if (ImGui::Checkbox(_("Pull delete affects entire channel row"),&pullDeleteRowB)) { settings.pullDeleteRow=pullDeleteRowB; - settingsChanged=true; + SETTINGS_CHANGED; } bool pushNibbleB=settings.pushNibble; if (ImGui::Checkbox(_("Push value when overwriting instead of clearing it"),&pushNibbleB)) { settings.pushNibble=pushNibbleB; - settingsChanged=true; + SETTINGS_CHANGED; } bool inputRepeatB=settings.inputRepeat; if (ImGui::Checkbox(_("Keyboard note/value input repeat (hold key to input continuously)"),&inputRepeatB)) { settings.inputRepeat=inputRepeatB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Effect input behavior:")); ImGui::Indent(); if (ImGui::RadioButton(_("Move down##eicb0"),settings.effectCursorDir==0)) { settings.effectCursorDir=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Move to effect value (otherwise move down)##eicb1"),settings.effectCursorDir==1)) { settings.effectCursorDir=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Move to effect value/next effect and wrap around##eicb2"),settings.effectCursorDir==2)) { settings.effectCursorDir=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool effectDeletionAltersValueB=settings.effectDeletionAltersValue; if (ImGui::Checkbox(_("Delete effect value when deleting effect"),&effectDeletionAltersValueB)) { settings.effectDeletionAltersValue=effectDeletionAltersValueB; - settingsChanged=true; + SETTINGS_CHANGED; } bool absorbInsInputB=settings.absorbInsInput; if (ImGui::Checkbox(_("Change current instrument when changing instrument column (absorb)"),&absorbInsInputB)) { settings.absorbInsInput=absorbInsInputB; - settingsChanged=true; + SETTINGS_CHANGED; } bool removeInsOffB=settings.removeInsOff; if (ImGui::Checkbox(_("Remove instrument value when inserting note off/release"),&removeInsOffB)) { settings.removeInsOff=removeInsOffB; - settingsChanged=true; + SETTINGS_CHANGED; } bool removeVolOffB=settings.removeVolOff; if (ImGui::Checkbox(_("Remove volume value when inserting note off/release"),&removeVolOffB)) { settings.removeVolOff=removeVolOffB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION CURSOR MOVEMENT @@ -2990,15 +2899,15 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("No##wrapH0"),settings.wrapHorizontal==0)) { settings.wrapHorizontal=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes##wrapH1"),settings.wrapHorizontal==1)) { settings.wrapHorizontal=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes, and move to next/prev row##wrapH2"),settings.wrapHorizontal==2)) { settings.wrapHorizontal=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3006,19 +2915,19 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("No##wrapV0"),settings.wrapVertical==0)) { settings.wrapVertical=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes##wrapV1"),settings.wrapVertical==1)) { settings.wrapVertical=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes, and move to next/prev pattern##wrapV2"),settings.wrapVertical==2)) { settings.wrapVertical=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes, and move to next/prev pattern (wrap around)##wrapV2"),settings.wrapVertical==3)) { settings.wrapVertical=3; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3026,36 +2935,36 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Move by one##cmk0"),settings.scrollStep==0)) { settings.scrollStep=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Move by Edit Step##cmk1"),settings.scrollStep==1)) { settings.scrollStep=1; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool stepOnDeleteB=settings.stepOnDelete; if (ImGui::Checkbox(_("Move cursor by edit step on delete"),&stepOnDeleteB)) { settings.stepOnDelete=stepOnDeleteB; - settingsChanged=true; + SETTINGS_CHANGED; } bool stepOnInsertB=settings.stepOnInsert; if (ImGui::Checkbox(_("Move cursor by edit step on insert (push)"),&stepOnInsertB)) { settings.stepOnInsert=stepOnInsertB; - settingsChanged=true; + SETTINGS_CHANGED; } bool pullDeleteBehaviorB=settings.pullDeleteBehavior; if (ImGui::Checkbox(_("Move cursor up on backspace-delete"),&pullDeleteBehaviorB)) { settings.pullDeleteBehavior=pullDeleteBehaviorB; - settingsChanged=true; + SETTINGS_CHANGED; } bool cursorPastePosB=settings.cursorPastePos; if (ImGui::Checkbox(_("Move cursor to end of clipboard content when pasting"),&cursorPastePosB)) { settings.cursorPastePos=cursorPastePosB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION SCROLLING @@ -3065,22 +2974,22 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("No##pscroll0"),settings.scrollChangesOrder==0)) { settings.scrollChangesOrder=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes##pscroll1"),settings.scrollChangesOrder==1)) { settings.scrollChangesOrder=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes, and wrap around song##pscroll2"),settings.scrollChangesOrder==2)) { settings.scrollChangesOrder=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool cursorFollowsOrderB=settings.cursorFollowsOrder; if (ImGui::Checkbox(_("Cursor follows current order when moving it"),&cursorFollowsOrderB)) { settings.cursorFollowsOrder=cursorFollowsOrderB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("applies when playback is stopped.")); @@ -3089,22 +2998,22 @@ void FurnaceGUI::drawSettings() { bool cursorMoveNoScrollB=settings.cursorMoveNoScroll; if (ImGui::Checkbox(_("Don't scroll when moving cursor"),&cursorMoveNoScrollB)) { settings.cursorMoveNoScroll=cursorMoveNoScrollB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Move cursor with scroll wheel:")); ImGui::Indent(); if (ImGui::RadioButton(_("No##csw0"),settings.cursorFollowsWheel==0)) { settings.cursorFollowsWheel=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Yes##csw1"),settings.cursorFollowsWheel==1)) { settings.cursorFollowsWheel=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Inverted##csw2"),settings.cursorFollowsWheel==2)) { settings.cursorFollowsWheel=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3112,11 +3021,11 @@ void FurnaceGUI::drawSettings() { ImGui::Text(_("How many steps to move with each scroll wheel step?")); if (ImGui::RadioButton(_("One##cws0"),settings.cursorWheelStep==0)) { settings.cursorWheelStep=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Edit Step##cws1"),settings.cursorWheelStep==1)) { settings.cursorWheelStep=1; - settingsChanged=true; + SETTINGS_CHANGED; } } @@ -3126,13 +3035,13 @@ void FurnaceGUI::drawSettings() { bool insTypeMenuB=settings.insTypeMenu; if (ImGui::Checkbox(_("Display instrument type menu when adding instrument"),&insTypeMenuB)) { settings.insTypeMenu=insTypeMenuB; - settingsChanged=true; + SETTINGS_CHANGED; } bool selectAssetOnLoadB=settings.selectAssetOnLoad; if (ImGui::Checkbox(_("Select asset after opening one"),&selectAssetOnLoadB)) { settings.selectAssetOnLoad=selectAssetOnLoadB; - settingsChanged=true; + SETTINGS_CHANGED; } END_SECTION; @@ -3147,20 +3056,20 @@ void FurnaceGUI::drawSettings() { } else { settings.dpiScale=1.0f; } - settingsChanged=true; + SETTINGS_CHANGED; } if (!dpiScaleAuto) { if (ImGui::SliderFloat(_("UI scaling factor"),&settings.dpiScale,1.0f,3.0f,"%.2fx")) { if (settings.dpiScale<0.5f) settings.dpiScale=0.5f; if (settings.dpiScale>3.0f) settings.dpiScale=3.0f; - settingsChanged=true; + SETTINGS_CHANGED; } rightClickable } if (ImGui::InputInt(_("Icon size"),&settings.iconSize,1,3)) { if (settings.iconSize<3) settings.iconSize=3; if (settings.iconSize>48) settings.iconSize=48; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION TEXT @@ -3174,7 +3083,7 @@ void FurnaceGUI::drawSettings() { ImGui::AlignTextToFramePadding(); ImGui::Text(_("Font renderer")); ImGui::TableNextColumn(); - if (ImGui::Combo("##FontBack",&settings.fontBackend,fontBackends,2)) settingsChanged=true; + if (ImGui::Combo("##FontBack",&settings.fontBackend,fontBackends,2)) SETTINGS_CHANGED; #else settings.fontBackend=0; #endif @@ -3184,57 +3093,57 @@ void FurnaceGUI::drawSettings() { ImGui::AlignTextToFramePadding(); ImGui::Text(_("Main font")); ImGui::TableNextColumn(); - if (ImGui::Combo("##MainFont",&settings.mainFont,LocalizedComboGetter,mainFonts,7)) settingsChanged=true; + if (ImGui::Combo("##MainFont",&settings.mainFont,LocalizedComboGetter,mainFonts,7)) SETTINGS_CHANGED; if (settings.mainFont==6) { ImGui::InputText("##MainFontPath",&settings.mainFontPath); ImGui::SameLine(); if (ImGui::Button(ICON_FA_FOLDER "##MainFontLoad")) { openFileDialog(GUI_FILE_LOAD_MAIN_FONT); - settingsChanged=true; + SETTINGS_CHANGED; } } if (ImGui::InputInt(_("Size##MainFontSize"),&settings.mainFontSize,1,3)) { if (settings.mainFontSize<3) settings.mainFontSize=3; if (settings.mainFontSize>96) settings.mainFontSize=96; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::AlignTextToFramePadding(); ImGui::Text(_("Header font")); ImGui::TableNextColumn(); - if (ImGui::Combo("##HeadFont",&settings.headFont,LocalizedComboGetter,headFonts,7)) settingsChanged=true; + if (ImGui::Combo("##HeadFont",&settings.headFont,LocalizedComboGetter,headFonts,7)) SETTINGS_CHANGED; if (settings.headFont==6) { ImGui::InputText("##HeadFontPath",&settings.headFontPath); ImGui::SameLine(); if (ImGui::Button(ICON_FA_FOLDER "##HeadFontLoad")) { openFileDialog(GUI_FILE_LOAD_HEAD_FONT); - settingsChanged=true; + SETTINGS_CHANGED; } } if (ImGui::InputInt(_("Size##HeadFontSize"),&settings.headFontSize,1,3)) { if (settings.headFontSize<3) settings.headFontSize=3; if (settings.headFontSize>96) settings.headFontSize=96; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::AlignTextToFramePadding(); ImGui::Text(_("Pattern font")); ImGui::TableNextColumn(); - if (ImGui::Combo("##PatFont",&settings.patFont,LocalizedComboGetter,patFonts,7)) settingsChanged=true; + if (ImGui::Combo("##PatFont",&settings.patFont,LocalizedComboGetter,patFonts,7)) SETTINGS_CHANGED; if (settings.patFont==6) { ImGui::InputText("##PatFontPath",&settings.patFontPath); ImGui::SameLine(); if (ImGui::Button(ICON_FA_FOLDER "##PatFontLoad")) { openFileDialog(GUI_FILE_LOAD_PAT_FONT); - settingsChanged=true; + SETTINGS_CHANGED; } } if (ImGui::InputInt(_("Size##PatFontSize"),&settings.patFontSize,1,3)) { if (settings.patFontSize<3) settings.patFontSize=3; if (settings.patFontSize>96) settings.patFontSize=96; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::EndTable(); } @@ -3243,32 +3152,32 @@ void FurnaceGUI::drawSettings() { bool fontAntiAliasB=settings.fontAntiAlias; if (ImGui::Checkbox(_("Anti-aliased fonts"),&fontAntiAliasB)) { settings.fontAntiAlias=fontAntiAliasB; - settingsChanged=true; + SETTINGS_CHANGED; } bool fontBitmapB=settings.fontBitmap; if (ImGui::Checkbox(_("Support bitmap fonts"),&fontBitmapB)) { settings.fontBitmap=fontBitmapB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Hinting:")); ImGui::Indent(); if (ImGui::RadioButton(_("Off (soft)##fh0"),settings.fontHinting==0)) { settings.fontHinting=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Slight##fh1"),settings.fontHinting==1)) { settings.fontHinting=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Normal##fh2"),settings.fontHinting==2)) { settings.fontHinting=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Full (hard)##fh3"),settings.fontHinting==3)) { settings.fontHinting=3; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3276,15 +3185,15 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Disable##fah0"),settings.fontAutoHint==0)) { settings.fontAutoHint=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Enable##fah1"),settings.fontAutoHint==1)) { settings.fontAutoHint=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Force##fah2"),settings.fontAutoHint==2)) { settings.fontAutoHint=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); } @@ -3294,7 +3203,7 @@ void FurnaceGUI::drawSettings() { ImGui::SameLine(); if (ImGui::RadioButton(_("1×##fos1"),settings.fontOversample==1)) { settings.fontOversample=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("saves video memory. reduces font rendering quality.\nuse for pixel/bitmap fonts.")); @@ -3302,7 +3211,7 @@ void FurnaceGUI::drawSettings() { ImGui::SameLine(); if (ImGui::RadioButton(_("2×##fos2"),settings.fontOversample==2)) { settings.fontOversample=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("default.")); @@ -3310,7 +3219,7 @@ void FurnaceGUI::drawSettings() { ImGui::SameLine(); if (ImGui::RadioButton(_("3×##fos3"),settings.fontOversample==3)) { settings.fontOversample=3; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("slightly better font rendering quality.\nuses more video memory.")); @@ -3319,7 +3228,7 @@ void FurnaceGUI::drawSettings() { bool loadFallbackB=settings.loadFallback; if (ImGui::Checkbox(_("Load fallback font"),&loadFallbackB)) { settings.loadFallback=loadFallbackB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_("disable to save video memory.")); @@ -3328,7 +3237,7 @@ void FurnaceGUI::drawSettings() { bool loadJapaneseB=settings.loadJapanese; if (ImGui::Checkbox(_("Display Japanese characters"),&loadJapaneseB)) { settings.loadJapanese=loadJapaneseB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_( @@ -3342,7 +3251,7 @@ void FurnaceGUI::drawSettings() { bool loadChineseB=settings.loadChinese; if (ImGui::Checkbox(_("Display Chinese (Simplified) characters"),&loadChineseB)) { settings.loadChinese=loadChineseB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_( @@ -3356,7 +3265,7 @@ void FurnaceGUI::drawSettings() { bool loadChineseTraditionalB=settings.loadChineseTraditional; if (ImGui::Checkbox(_("Display Chinese (Traditional) characters"),&loadChineseTraditionalB)) { settings.loadChineseTraditional=loadChineseTraditionalB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_( @@ -3370,7 +3279,7 @@ void FurnaceGUI::drawSettings() { bool loadKoreanB=settings.loadKorean; if (ImGui::Checkbox(_("Display Korean characters"),&loadKoreanB)) { settings.loadKorean=loadKoreanB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::IsItemHovered()) { ImGui::SetTooltip(_( @@ -3388,22 +3297,22 @@ void FurnaceGUI::drawSettings() { if (ImGui::RadioButton(_("Furnace##tbar0"),settings.titleBarInfo==0)) { settings.titleBarInfo=0; updateWindowTitle(); - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Song Name - Furnace##tbar1"),settings.titleBarInfo==1)) { settings.titleBarInfo=1; updateWindowTitle(); - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("file_name.fur - Furnace##tbar2"),settings.titleBarInfo==2)) { settings.titleBarInfo=2; updateWindowTitle(); - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("/path/to/file.fur - Furnace##tbar3"),settings.titleBarInfo==3)) { settings.titleBarInfo=3; updateWindowTitle(); - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3411,68 +3320,68 @@ void FurnaceGUI::drawSettings() { if (ImGui::Checkbox(_("Display system name on title bar"),&titleBarSysB)) { settings.titleBarSys=titleBarSysB; updateWindowTitle(); - settingsChanged=true; + SETTINGS_CHANGED; } bool noMultiSystemB=settings.noMultiSystem; if (ImGui::Checkbox(_("Display chip names instead of \"multi-system\" in title bar"),&noMultiSystemB)) { settings.noMultiSystem=noMultiSystemB; updateWindowTitle(); - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Status bar:")); ImGui::Indent(); if (ImGui::RadioButton(_("Cursor details##sbar0"),settings.statusDisplay==0)) { settings.statusDisplay=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("File path##sbar1"),settings.statusDisplay==1)) { settings.statusDisplay=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Cursor details or file path##sbar2"),settings.statusDisplay==2)) { settings.statusDisplay=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Nothing##sbar3"),settings.statusDisplay==3)) { settings.statusDisplay=3; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool playbackTimeB=settings.playbackTime; if (ImGui::Checkbox(_("Display playback status when playing"),&playbackTimeB)) { settings.playbackTime=playbackTimeB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Export options layout:")); ImGui::Indent(); if (ImGui::RadioButton(_("Sub-menus in File menu##eol0"),settings.exportOptionsLayout==0)) { settings.exportOptionsLayout=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Modal window with tabs##eol1"),settings.exportOptionsLayout==1)) { settings.exportOptionsLayout=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Modal windows with options in File menu##eol2"),settings.exportOptionsLayout==2)) { settings.exportOptionsLayout=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool capitalMenuBarB=settings.capitalMenuBar; if (ImGui::Checkbox(_("Capitalize menu bar"),&capitalMenuBarB)) { settings.capitalMenuBar=capitalMenuBarB; - settingsChanged=true; + SETTINGS_CHANGED; } bool classicChipOptionsB=settings.classicChipOptions; if (ImGui::Checkbox(_("Display add/configure/change/remove chip menus in File menu"),&classicChipOptionsB)) { settings.classicChipOptions=classicChipOptionsB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION ORDERS @@ -3486,18 +3395,18 @@ void FurnaceGUI::drawSettings() { bool ordersCursorB=settings.ordersCursor; if (ImGui::Checkbox(_("Highlight channel at cursor in Orders"),&ordersCursorB)) { settings.ordersCursor=ordersCursorB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Orders row number format:")); ImGui::Indent(); if (ImGui::RadioButton(_("Decimal##orbD"),settings.orderRowsBase==0)) { settings.orderRowsBase=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Hexadecimal##orbH"),settings.orderRowsBase==1)) { settings.orderRowsBase=1; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3506,56 +3415,56 @@ void FurnaceGUI::drawSettings() { bool centerPatternB=settings.centerPattern; if (ImGui::Checkbox(_("Center pattern view"),¢erPatternB)) { settings.centerPattern=centerPatternB; - settingsChanged=true; + SETTINGS_CHANGED; } bool overflowHighlightB=settings.overflowHighlight; if (ImGui::Checkbox(_("Overflow pattern highlights"),&overflowHighlightB)) { settings.overflowHighlight=overflowHighlightB; - settingsChanged=true; + SETTINGS_CHANGED; } bool viewPrevPatternB=settings.viewPrevPattern; if (ImGui::Checkbox(_("Display previous/next pattern"),&viewPrevPatternB)) { settings.viewPrevPattern=viewPrevPatternB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Pattern row number format:")); ImGui::Indent(); if (ImGui::RadioButton(_("Decimal##prbD"),settings.patRowsBase==0)) { settings.patRowsBase=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Hexadecimal##prbH"),settings.patRowsBase==1)) { settings.patRowsBase=1; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); ImGui::Text(_("Pattern view labels:")); ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLOff","OFF",&settings.noteOffLabel)) settingsChanged=true; + if (ImGui::InputTextWithHint("##PVLOff","OFF",&settings.noteOffLabel)) SETTINGS_CHANGED; ImGui::PopFont(); ImGui::SameLine(); ImGui::Text(_("Note off (3-char)")); ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLRel","===",&settings.noteRelLabel)) settingsChanged=true; + if (ImGui::InputTextWithHint("##PVLRel","===",&settings.noteRelLabel)) SETTINGS_CHANGED; ImGui::PopFont(); ImGui::SameLine(); ImGui::Text(_("Note release (3-char)")); ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLMacroRel","REL",&settings.macroRelLabel)) settingsChanged=true; + if (ImGui::InputTextWithHint("##PVLMacroRel","REL",&settings.macroRelLabel)) SETTINGS_CHANGED; ImGui::PopFont(); ImGui::SameLine(); ImGui::Text(_("Macro release (3-char)")); ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLE3","...",&settings.emptyLabel)) settingsChanged=true; + if (ImGui::InputTextWithHint("##PVLE3","...",&settings.emptyLabel)) SETTINGS_CHANGED; ImGui::PopFont(); ImGui::SameLine(); ImGui::Text(_("Empty field (3-char)")); ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLE2","..",&settings.emptyLabel2)) settingsChanged=true; + if (ImGui::InputTextWithHint("##PVLE2","..",&settings.emptyLabel2)) SETTINGS_CHANGED; ImGui::PopFont(); ImGui::SameLine(); ImGui::Text(_("Empty field (2-char)")); @@ -3565,49 +3474,49 @@ void FurnaceGUI::drawSettings() { if (CWSliderInt(_("Note"),&settings.noteCellSpacing,0,32)) { if (settings.noteCellSpacing<0) settings.noteCellSpacing=0; if (settings.noteCellSpacing>32) settings.noteCellSpacing=32; - settingsChanged=true; + SETTINGS_CHANGED; } if (CWSliderInt(_("Instrument"),&settings.insCellSpacing,0,32)) { if (settings.insCellSpacing<0) settings.insCellSpacing=0; if (settings.insCellSpacing>32) settings.insCellSpacing=32; - settingsChanged=true; + SETTINGS_CHANGED; } if (CWSliderInt(_("Volume"),&settings.volCellSpacing,0,32)) { if (settings.volCellSpacing<0) settings.volCellSpacing=0; if (settings.volCellSpacing>32) settings.volCellSpacing=32; - settingsChanged=true; + SETTINGS_CHANGED; } if (CWSliderInt(_("Effect"),&settings.effectCellSpacing,0,32)) { if (settings.effectCellSpacing<0) settings.effectCellSpacing=0; if (settings.effectCellSpacing>32) settings.effectCellSpacing=32; - settingsChanged=true; + SETTINGS_CHANGED; } if (CWSliderInt(_("Effect value"),&settings.effectValCellSpacing,0,32)) { if (settings.effectValCellSpacing<0) settings.effectValCellSpacing=0; if (settings.effectValCellSpacing>32) settings.effectValCellSpacing=32; - settingsChanged=true; + SETTINGS_CHANGED; } bool oneDigitEffectsB=settings.oneDigitEffects; if (ImGui::Checkbox(_("Single-digit effects for 00-0F"),&oneDigitEffectsB)) { settings.oneDigitEffects=oneDigitEffectsB; - settingsChanged=true; + SETTINGS_CHANGED; } bool flatNotesB=settings.flatNotes; if (ImGui::Checkbox(_("Use flats instead of sharps"),&flatNotesB)) { settings.flatNotes=flatNotesB; - settingsChanged=true; + SETTINGS_CHANGED; } bool germanNotationB=settings.germanNotation; if (ImGui::Checkbox(_("Use German notation"),&germanNotationB)) { settings.germanNotation=germanNotationB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION CHANNEL @@ -3617,27 +3526,27 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Classic##CHS0"),settings.channelStyle==0)) { settings.channelStyle=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Line##CHS1"),settings.channelStyle==1)) { settings.channelStyle=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Round##CHS2"),settings.channelStyle==2)) { settings.channelStyle=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Split button##CHS3"),settings.channelStyle==3)) { settings.channelStyle=3; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Square border##CH42"),settings.channelStyle==4)) { settings.channelStyle=4; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Round border##CHS5"),settings.channelStyle==5)) { settings.channelStyle=5; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3645,23 +3554,23 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("None##CHV0"),settings.channelVolStyle==0)) { settings.channelVolStyle=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Simple##CHV1"),settings.channelVolStyle==1)) { settings.channelVolStyle=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Stereo##CHV2"),settings.channelVolStyle==2)) { settings.channelVolStyle=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Real##CHV3"),settings.channelVolStyle==3)) { settings.channelVolStyle=3; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Real (stereo)##CHV4"),settings.channelVolStyle==4)) { settings.channelVolStyle=4; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3669,19 +3578,19 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Off##CHF0"),settings.channelFeedbackStyle==0)) { settings.channelFeedbackStyle=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Note##CHF1"),settings.channelFeedbackStyle==1)) { settings.channelFeedbackStyle=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Volume##CHF2"),settings.channelFeedbackStyle==2)) { settings.channelFeedbackStyle=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Active##CHF3"),settings.channelFeedbackStyle==3)) { settings.channelFeedbackStyle=3; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3689,33 +3598,33 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Regular##CHFont0"),settings.channelFont==0)) { settings.channelFont=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Monospace##CHFont1"),settings.channelFont==1)) { settings.channelFont=1; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool channelTextCenterB=settings.channelTextCenter; if (ImGui::Checkbox(_("Center channel name"),&channelTextCenterB)) { settings.channelTextCenter=channelTextCenterB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Channel colors:")); ImGui::Indent(); if (ImGui::RadioButton(_("Single##CHC0"),settings.channelColors==0)) { settings.channelColors=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Channel type##CHC1"),settings.channelColors==1)) { settings.channelColors=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Instrument type##CHC2"),settings.channelColors==2)) { settings.channelColors=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3723,15 +3632,15 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Single##CTC0"),settings.channelTextColors==0)) { settings.channelTextColors=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Channel type##CTC1"),settings.channelTextColors==1)) { settings.channelTextColors=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Instrument type##CTC2"),settings.channelTextColors==2)) { settings.channelTextColors=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3740,7 +3649,7 @@ void FurnaceGUI::drawSettings() { bool unifiedDataViewB=settings.unifiedDataView; if (ImGui::Checkbox(_("Unified instrument/wavetable/sample list"),&unifiedDataViewB)) { settings.unifiedDataView=unifiedDataViewB; - settingsChanged=true; + SETTINGS_CHANGED; } if (settings.unifiedDataView) { settings.horizontalDataView=0; @@ -3750,7 +3659,7 @@ void FurnaceGUI::drawSettings() { bool horizontalDataViewB=settings.horizontalDataView; if (ImGui::Checkbox(_("Horizontal instrument/wavetable list"),&horizontalDataViewB)) { settings.horizontalDataView=horizontalDataViewB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::EndDisabled(); @@ -3758,22 +3667,22 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("None##iis0"),settings.insIconsStyle==0)) { settings.insIconsStyle=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Graphical icons##iis1"),settings.insIconsStyle==1)) { settings.insIconsStyle=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Letter icons##iis2"),settings.insIconsStyle==2)) { settings.insIconsStyle=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool insEditColorizeB=settings.insEditColorize; if (ImGui::Checkbox(_("Colorize instrument editor using instrument type"),&insEditColorizeB)) { settings.insEditColorize=insEditColorizeB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION MACRO EDITOR @@ -3782,26 +3691,26 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Unified##mel0"),settings.macroLayout==0)) { settings.macroLayout=0; - settingsChanged=true; + SETTINGS_CHANGED; } /* if (ImGui::RadioButton(_("Tabs##mel1"),settings.macroLayout==1)) { settings.macroLayout=1; - settingsChanged=true; + SETTINGS_CHANGED; } */ if (ImGui::RadioButton(_("Grid##mel2"),settings.macroLayout==2)) { settings.macroLayout=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Single (with list)##mel3"),settings.macroLayout==3)) { settings.macroLayout=3; - settingsChanged=true; + SETTINGS_CHANGED; } /* if (ImGui::RadioButton(_("Single (combo box)##mel4"),settings.macroLayout==4)) { settings.macroLayout=4; - settingsChanged=true; + SETTINGS_CHANGED; } */ ImGui::Unindent(); @@ -3809,7 +3718,7 @@ void FurnaceGUI::drawSettings() { bool oldMacroVSliderB=settings.oldMacroVSlider; if (ImGui::Checkbox(_("Use classic macro editor vertical slider"),&oldMacroVSliderB)) { settings.oldMacroVSlider=oldMacroVSliderB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::BeginDisabled(settings.macroLayout==2); @@ -3817,15 +3726,15 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Manual"),settings.autoMacroStepSize==0)) { settings.autoMacroStepSize=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Automatic per macro"),settings.autoMacroStepSize==1)) { settings.autoMacroStepSize=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Automatic (use longest macro)"),settings.autoMacroStepSize==2)) { settings.autoMacroStepSize=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); ImGui::EndDisabled(); @@ -3835,7 +3744,7 @@ void FurnaceGUI::drawSettings() { bool waveLayoutB=settings.waveLayout; if (ImGui::Checkbox(_("Use compact wave editor"),&waveLayoutB)) { settings.waveLayout=waveLayoutB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION FM EDITOR @@ -3844,57 +3753,57 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Friendly##fmn0"),settings.fmNames==0)) { settings.fmNames=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Technical##fmn1"),settings.fmNames==1)) { settings.fmNames=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Technical (alternate)##fmn2"),settings.fmNames==2)) { settings.fmNames=2; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); bool oplStandardWaveNamesB=settings.oplStandardWaveNames; if (ImGui::Checkbox(_("Use standard OPL waveform names"),&oplStandardWaveNamesB)) { settings.oplStandardWaveNames=oplStandardWaveNamesB; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("FM parameter editor layout:")); ImGui::Indent(); if (ImGui::RadioButton(_("Modern##fml0"),settings.fmLayout==0)) { settings.fmLayout=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Modern with more labels##fml7"),settings.fmLayout==7)) { settings.fmLayout=7; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Compact (2x2, classic)##fml1"),settings.fmLayout==1)) { settings.fmLayout=1; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Compact (1x4)##fml2"),settings.fmLayout==2)) { settings.fmLayout=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Compact (4x1)##fml3"),settings.fmLayout==3)) { settings.fmLayout=3; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Alternate (2x2)##fml4"),settings.fmLayout==4)) { settings.fmLayout=4; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Alternate (1x4)##fml5"),settings.fmLayout==5)) { settings.fmLayout=5; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Alternate (4x1)##fml5"),settings.fmLayout==6)) { settings.fmLayout=6; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3902,20 +3811,20 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Between Decay and Sustain Rate##susp0"),settings.susPosition==0)) { settings.susPosition=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("After Release Rate##susp1"),settings.susPosition==1)) { settings.susPosition=1; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::BeginDisabled(settings.fmLayout!=0); if (ImGui::RadioButton(_("After Release Rate, after spacing##susp2"),settings.susPosition==2)) { settings.susPosition=2; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("After TL##susp3"),settings.susPosition==3)) { settings.susPosition=3; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::EndDisabled(); ImGui::Unindent(); @@ -3923,13 +3832,13 @@ void FurnaceGUI::drawSettings() { bool separateFMColorsB=settings.separateFMColors; if (ImGui::Checkbox(_("Use separate colors for carriers/modulators in FM editor"),&separateFMColorsB)) { settings.separateFMColors=separateFMColorsB; - settingsChanged=true; + SETTINGS_CHANGED; } bool unsignedDetuneB=settings.unsignedDetune; if (ImGui::Checkbox(_("Unsigned FM detune values"),&unsignedDetuneB)) { settings.unsignedDetune=unsignedDetuneB; - settingsChanged=true; + SETTINGS_CHANGED; } // SUBSECTION MEMORY COMPOSITION @@ -3938,11 +3847,11 @@ void FurnaceGUI::drawSettings() { ImGui::Indent(); if (ImGui::RadioButton(_("Bytes##MUU0"),settings.memUsageUnit==0)) { settings.memUsageUnit=0; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Kilobytes##MUU1"),settings.memUsageUnit==1)) { settings.memUsageUnit=1; - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -3951,43 +3860,43 @@ void FurnaceGUI::drawSettings() { bool oscRoundedCornersB=settings.oscRoundedCorners; if (ImGui::Checkbox(_("Rounded corners"),&oscRoundedCornersB)) { settings.oscRoundedCorners=oscRoundedCornersB; - settingsChanged=true; + SETTINGS_CHANGED; } bool oscBorderB=settings.oscBorder; if (ImGui::Checkbox(_("Border"),&oscBorderB)) { settings.oscBorder=oscBorderB; - settingsChanged=true; + SETTINGS_CHANGED; } bool oscMonoB=settings.oscMono; if (ImGui::Checkbox(_("Mono"),&oscMonoB)) { settings.oscMono=oscMonoB; - settingsChanged=true; + SETTINGS_CHANGED; } bool oscAntiAliasB=settings.oscAntiAlias; if (ImGui::Checkbox(_("Anti-aliased"),&oscAntiAliasB)) { settings.oscAntiAlias=oscAntiAliasB; - settingsChanged=true; + SETTINGS_CHANGED; } bool oscTakesEntireWindowB=settings.oscTakesEntireWindow; if (ImGui::Checkbox(_("Fill entire window"),&oscTakesEntireWindowB)) { settings.oscTakesEntireWindow=oscTakesEntireWindowB; - settingsChanged=true; + SETTINGS_CHANGED; } bool oscEscapesBoundaryB=settings.oscEscapesBoundary; if (ImGui::Checkbox(_("Waveform goes out of bounds"),&oscEscapesBoundaryB)) { settings.oscEscapesBoundary=oscEscapesBoundaryB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::SliderFloat(_("Line size"),&settings.oscLineSize,0.25f,16.0f,"%.1f")) { if (settings.oscLineSize<0.25f) settings.oscLineSize=0.25f; if (settings.oscLineSize>16.0f) settings.oscLineSize=16.0f; - settingsChanged=true; + SETTINGS_CHANGED; } rightClickable // SUBSECTION WINDOWS @@ -3995,37 +3904,37 @@ void FurnaceGUI::drawSettings() { bool roundedWindowsB=settings.roundedWindows; if (ImGui::Checkbox(_("Rounded window corners"),&roundedWindowsB)) { settings.roundedWindows=roundedWindowsB; - settingsChanged=true; + SETTINGS_CHANGED; } bool roundedButtonsB=settings.roundedButtons; if (ImGui::Checkbox(_("Rounded buttons"),&roundedButtonsB)) { settings.roundedButtons=roundedButtonsB; - settingsChanged=true; + SETTINGS_CHANGED; } bool roundedMenusB=settings.roundedMenus; if (ImGui::Checkbox(_("Rounded menu corners"),&roundedMenusB)) { settings.roundedMenus=roundedMenusB; - settingsChanged=true; + SETTINGS_CHANGED; } bool roundedTabsB=settings.roundedTabs; if (ImGui::Checkbox(_("Rounded tabs"),&roundedTabsB)) { settings.roundedTabs=roundedTabsB; - settingsChanged=true; + SETTINGS_CHANGED; } bool roundedScrollbarsB=settings.roundedScrollbars; if (ImGui::Checkbox(_("Rounded scrollbars"),&roundedScrollbarsB)) { settings.roundedScrollbars=roundedScrollbarsB; - settingsChanged=true; + SETTINGS_CHANGED; } bool frameBordersB=settings.frameBorders; if (ImGui::Checkbox(_("Borders around widgets"),&frameBordersB)) { settings.frameBorders=frameBordersB; - settingsChanged=true; + SETTINGS_CHANGED; } END_SECTION; @@ -4048,7 +3957,7 @@ void FurnaceGUI::drawSettings() { if (ImGui::Checkbox(_("Guru mode"),&basicColorsB)) { settings.basicColors=!basicColorsB; applyUISettings(false); - settingsChanged=true; + SETTINGS_CHANGED; } if (settings.basicColors) { if (ImGui::TreeNode(_("Interface"))) { @@ -4056,19 +3965,19 @@ void FurnaceGUI::drawSettings() { if (settings.guiColorsShading<0) settings.guiColorsShading=0; if (settings.guiColorsShading>100) settings.guiColorsShading=100; applyUISettings(false); - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Text(_("Color scheme type:")); ImGui::Indent(); if (ImGui::RadioButton(_("Dark##gcb0"),settings.guiColorsBase==0)) { settings.guiColorsBase=0; applyUISettings(false); - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::RadioButton(_("Light##gcb1"),settings.guiColorsBase==1)) { settings.guiColorsBase=1; applyUISettings(false); - settingsChanged=true; + SETTINGS_CHANGED; } ImGui::Unindent(); @@ -4086,7 +3995,7 @@ void FurnaceGUI::drawSettings() { if (settings.guiColorsShading<0) settings.guiColorsShading=0; if (settings.guiColorsShading>100) settings.guiColorsShading=100; applyUISettings(false); - settingsChanged=true; + SETTINGS_CHANGED; } UI_COLOR_CONFIG(GUI_COLOR_BUTTON,_("Button")); @@ -4505,7 +4414,7 @@ void FurnaceGUI::drawSettings() { bool backupEnableB=settings.backupEnable; if (ImGui::Checkbox(_("Enable backup system"),&backupEnableB)) { settings.backupEnable=backupEnableB; - settingsChanged=true; + SETTINGS_CHANGED; } if (ImGui::InputInt(_("Interval (in seconds)"),&settings.backupInterval)) { @@ -4865,7 +4774,7 @@ void FurnaceGUI::drawKeybindSettingsTableRow(FurnaceGUIActions actionIdx) { if (i Date: Mon, 11 Nov 2024 18:08:05 +0400 Subject: [PATCH 31/61] add more --- src/gui/settings.cpp | 376 +++++++++++++++++++++++-------------------- 1 file changed, 197 insertions(+), 179 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 9982b44383..da7036189f 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -364,7 +364,8 @@ const char* specificControls[18]={ const char* t[2]={"1","2"}; void FurnaceGUI::setupSettingsCategories() { settings.categories={ - SettingsCategory("Program",{},{ + SettingsCategory(_("General"),{ + SettingsCategory(_("Program"),{},{ #ifdef HAVE_LOCALE SETTING(_("Language"),{ String curLocale=settings.locale; @@ -529,7 +530,202 @@ void FurnaceGUI::setupSettingsCategories() { ImGui::SetTooltip(_("may cause issues with high-polling-rate mice when previewing notes.")); } }), + SETTING(_("Per-channel oscilloscope threads"),{ + pushWarningColor(settings.chanOscThreads>cpuCores,settings.chanOscThreads>(cpuCores*2)); + if (ImGui::InputInt(_("Per-channel oscilloscope threads"),&settings.chanOscThreads)) { + if (settings.chanOscThreads<0) settings.chanOscThreads=0; + if (settings.chanOscThreads>(cpuCores*3)) settings.chanOscThreads=cpuCores*3; + if (settings.chanOscThreads>256) settings.chanOscThreads=256; + SETTINGS_CHANGED; + } + if (settings.chanOscThreads>=(cpuCores*3)) { + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("you're being silly, aren't you? that's enough.")); + } + } else if (settings.chanOscThreads>(cpuCores*2)) { + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("what are you doing? stop!")); + } + } else if (settings.chanOscThreads>cpuCores) { + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("it is a bad idea to set this number higher than your CPU core count (%d)!"),cpuCores); + } + } + popWarningColor(); + }), + SETTING(_("Oscilloscope rendering engine:"),{ + ImGui::Text(_("Oscilloscope rendering engine:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("ImGui line plot"),settings.shaderOsc==0)) { + settings.shaderOsc=0; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("render using Dear ImGui's built-in line drawing functions.")); + } + if (ImGui::RadioButton(_("GLSL (if available)"),settings.shaderOsc==1)) { + settings.shaderOsc=1; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { +#ifdef USE_GLES + ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL ES 2.0 render backend.")); +#else + ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL 3.0 render backend.")); +#endif + } + ImGui::Unindent(); + }), + }), +#ifdef IS_MOBILE + SettingsCategory(_("Vibration"),{},{ + SETTING(_("Strength"),{ + if (ImGui::SliderFloat(_("Strength"),&settings.vibrationStrength,0.0f,1.0f)) { + if (settings.vibrationStrength<0.0f) settings.vibrationStrength=0.0f; + if (settings.vibrationStrength>1.0f) settings.vibrationStrength=1.0f; + SETTINGS_CHANGED; + } + }), + SETTING(_("Length"),{ + if (ImGui::SliderInt(_("Length"),&settings.vibrationLength,10,500)) { + if (settings.vibrationLength<10) settings.vibrationLength=10; + if (settings.vibrationLength>500) settings.vibrationLength=500; + SETTINGS_CHANGED; + } + }), + }), +#endif + SettingsCategory(_("File"),{},{ + SETTING(_("Use system file picker"),{ + bool sysFileDialogB=settings.sysFileDialog; + if (ImGui::Checkbox(_("Use system file picker"),&sysFileDialogB)) { + settings.sysFileDialog=sysFileDialogB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Number of recent files"),{ + if (ImGui::InputInt(_("Number of recent files"),&settings.maxRecentFile,1,5)) { + if (settings.maxRecentFile<0) settings.maxRecentFile=0; + if (settings.maxRecentFile>30) settings.maxRecentFile=30; + SETTINGS_CHANGED; + } + }), + SETTING(_("Compress when saving"),{ + bool compressB=settings.compress; + if (ImGui::Checkbox(_("Compress when saving"),&compressB)) { + settings.compress=compressB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("use zlib to compress saved songs.")); + } + }), + SETTING(_("Save unused patterns"),{ + bool saveUnusedPatternsB=settings.saveUnusedPatterns; + if (ImGui::Checkbox(_("Save unused patterns"),&saveUnusedPatternsB)) { + settings.saveUnusedPatterns=saveUnusedPatternsB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Use new pattern format when saving"),{ + bool newPatternFormatB=settings.newPatternFormat; + if (ImGui::Checkbox(_("Use new pattern format when saving"),&newPatternFormatB)) { + settings.newPatternFormat=newPatternFormatB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("use a packed format which saves space when saving songs.\ndisable if you need compatibility with older Furnace and/or tools\nwhich do not support this format.")); + } + }), + SETTING(_("Don't apply compatibility flags when loading .dmf"),{ + bool noDMFCompatB=settings.noDMFCompat; + if (ImGui::Checkbox(_("Don't apply compatibility flags when loading .dmf"),&noDMFCompatB)) { + settings.noDMFCompat=noDMFCompatB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("do not report any issues arising from the use of this option!")); + } + }), + SETTING(_("Play after opening song:"),{ + ImGui::Text(_("Play after opening song:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No##pol0"),settings.playOnLoad==0)) { + settings.playOnLoad=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Only if already playing##pol1"),settings.playOnLoad==1)) { + settings.playOnLoad=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes##pol0"),settings.playOnLoad==2)) { + settings.playOnLoad=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Audio export loop/fade out time:"),{ + ImGui::Text(_("Audio export loop/fade out time:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Set to these values on start-up:##fot0"),settings.persistFadeOut==0)) { + settings.persistFadeOut=0; + SETTINGS_CHANGED; + } + ImGui::BeginDisabled(settings.persistFadeOut); + ImGui::Indent(); + if (ImGui::InputInt(_("Loops"),&settings.exportLoops,1,2)) { + if (settings.exportLoops<0) settings.exportLoops=0; + audioExportOptions.loops=settings.exportLoops; + SETTINGS_CHANGED; + } + if (ImGui::InputDouble(_("Fade out (seconds)"),&settings.exportFadeOut,1.0,2.0,"%.1f")) { + if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; + audioExportOptions.fadeOut=settings.exportFadeOut; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + ImGui::EndDisabled(); + if (ImGui::RadioButton(_("Remember last values##fot1"),settings.persistFadeOut==1)) { + settings.persistFadeOut=1; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Store instrument name in .fui"),{ + bool writeInsNamesB=settings.writeInsNames; + if (ImGui::Checkbox(_("Store instrument name in .fui"),&writeInsNamesB)) { + settings.writeInsNames=writeInsNamesB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("when enabled, saving an instrument will store its name.\nthis may increase file size.")); + } + }), + SETTING(_("Load instrument name from .fui"),{ + bool readInsNamesB=settings.readInsNames; + if (ImGui::Checkbox(_("Load instrument name from .fui"),&readInsNamesB)) { + settings.readInsNames=readInsNamesB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("when enabled, loading an instrument will use the stored name (if present).\notherwise, it will use the file name.")); + } + }), + SETTING(_("Auto-fill file name when saving"),{ + bool autoFillSaveB=settings.autoFillSave; + if (ImGui::Checkbox(_("Auto-fill file name when saving"),&autoFillSaveB)) { + settings.autoFillSave=autoFillSaveB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("fill the file name field with an appropriate file name when saving or exporting.")); + } + }) }), + SettingsCategory(_("New Song"),{},{ + + }) + },{}) }; settings.activeCategory=settings.categories[0]; @@ -855,186 +1051,8 @@ void FurnaceGUI::drawSettings() { END_SECTION; } CONFIG_SECTION(_("General")) { - // SUBSECTION PROGRAM - CONFIG_SUBSECTION(_("Program")); - - pushWarningColor(settings.chanOscThreads>cpuCores,settings.chanOscThreads>(cpuCores*2)); - if (ImGui::InputInt(_("Per-channel oscilloscope threads"),&settings.chanOscThreads)) { - if (settings.chanOscThreads<0) settings.chanOscThreads=0; - if (settings.chanOscThreads>(cpuCores*3)) settings.chanOscThreads=cpuCores*3; - if (settings.chanOscThreads>256) settings.chanOscThreads=256; - SETTINGS_CHANGED; - } - if (settings.chanOscThreads>=(cpuCores*3)) { - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("you're being silly, aren't you? that's enough.")); - } - } else if (settings.chanOscThreads>(cpuCores*2)) { - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("what are you doing? stop!")); - } - } else if (settings.chanOscThreads>cpuCores) { - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("it is a bad idea to set this number higher than your CPU core count (%d)!"),cpuCores); - } - } - popWarningColor(); - ImGui::Text(_("Oscilloscope rendering engine:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("ImGui line plot"),settings.shaderOsc==0)) { - settings.shaderOsc=0; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("render using Dear ImGui's built-in line drawing functions.")); - } - if (ImGui::RadioButton(_("GLSL (if available)"),settings.shaderOsc==1)) { - settings.shaderOsc=1; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { -#ifdef USE_GLES - ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL ES 2.0 render backend.")); -#else - ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL 3.0 render backend.")); -#endif - } - ImGui::Unindent(); - -#ifdef IS_MOBILE - // SUBSECTION VIBRATION - CONFIG_SUBSECTION(_("Vibration")); - - if (ImGui::SliderFloat(_("Strength"),&settings.vibrationStrength,0.0f,1.0f)) { - if (settings.vibrationStrength<0.0f) settings.vibrationStrength=0.0f; - if (settings.vibrationStrength>1.0f) settings.vibrationStrength=1.0f; - SETTINGS_CHANGED; - } - - if (ImGui::SliderInt(_("Length"),&settings.vibrationLength,10,500)) { - if (settings.vibrationLength<10) settings.vibrationLength=10; - if (settings.vibrationLength>500) settings.vibrationLength=500; - SETTINGS_CHANGED; - } -#endif - - // SUBSECTION FILE - CONFIG_SUBSECTION(_("File")); - - bool sysFileDialogB=settings.sysFileDialog; - if (ImGui::Checkbox(_("Use system file picker"),&sysFileDialogB)) { - settings.sysFileDialog=sysFileDialogB; - SETTINGS_CHANGED; - } - - if (ImGui::InputInt(_("Number of recent files"),&settings.maxRecentFile,1,5)) { - if (settings.maxRecentFile<0) settings.maxRecentFile=0; - if (settings.maxRecentFile>30) settings.maxRecentFile=30; - SETTINGS_CHANGED; - } - - bool compressB=settings.compress; - if (ImGui::Checkbox(_("Compress when saving"),&compressB)) { - settings.compress=compressB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("use zlib to compress saved songs.")); - } - - bool saveUnusedPatternsB=settings.saveUnusedPatterns; - if (ImGui::Checkbox(_("Save unused patterns"),&saveUnusedPatternsB)) { - settings.saveUnusedPatterns=saveUnusedPatternsB; - SETTINGS_CHANGED; - } - bool newPatternFormatB=settings.newPatternFormat; - if (ImGui::Checkbox(_("Use new pattern format when saving"),&newPatternFormatB)) { - settings.newPatternFormat=newPatternFormatB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("use a packed format which saves space when saving songs.\ndisable if you need compatibility with older Furnace and/or tools\nwhich do not support this format.")); - } - - bool noDMFCompatB=settings.noDMFCompat; - if (ImGui::Checkbox(_("Don't apply compatibility flags when loading .dmf"),&noDMFCompatB)) { - settings.noDMFCompat=noDMFCompatB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("do not report any issues arising from the use of this option!")); - } - - ImGui::Text(_("Play after opening song:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("No##pol0"),settings.playOnLoad==0)) { - settings.playOnLoad=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Only if already playing##pol1"),settings.playOnLoad==1)) { - settings.playOnLoad=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes##pol0"),settings.playOnLoad==2)) { - settings.playOnLoad=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - ImGui::Text(_("Audio export loop/fade out time:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Set to these values on start-up:##fot0"),settings.persistFadeOut==0)) { - settings.persistFadeOut=0; - SETTINGS_CHANGED; - } - ImGui::BeginDisabled(settings.persistFadeOut); - ImGui::Indent(); - if (ImGui::InputInt(_("Loops"),&settings.exportLoops,1,2)) { - if (settings.exportLoops<0) settings.exportLoops=0; - audioExportOptions.loops=settings.exportLoops; - SETTINGS_CHANGED; - } - if (ImGui::InputDouble(_("Fade out (seconds)"),&settings.exportFadeOut,1.0,2.0,"%.1f")) { - if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; - audioExportOptions.fadeOut=settings.exportFadeOut; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - ImGui::EndDisabled(); - if (ImGui::RadioButton(_("Remember last values##fot1"),settings.persistFadeOut==1)) { - settings.persistFadeOut=1; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - bool writeInsNamesB=settings.writeInsNames; - if (ImGui::Checkbox(_("Store instrument name in .fui"),&writeInsNamesB)) { - settings.writeInsNames=writeInsNamesB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("when enabled, saving an instrument will store its name.\nthis may increase file size.")); - } - - bool readInsNamesB=settings.readInsNames; - if (ImGui::Checkbox(_("Load instrument name from .fui"),&readInsNamesB)) { - settings.readInsNames=readInsNamesB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("when enabled, loading an instrument will use the stored name (if present).\notherwise, it will use the file name.")); - } - - bool autoFillSaveB=settings.autoFillSave; - if (ImGui::Checkbox(_("Auto-fill file name when saving"),&autoFillSaveB)) { - settings.autoFillSave=autoFillSaveB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("fill the file name field with an appropriate file name when saving or exporting.")); - } // SUBSECTION NEW SONG CONFIG_SUBSECTION(_("New Song")); From d1ad38396528844019700d8d40815a41f3304a32 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Mon, 11 Nov 2024 23:23:38 +0400 Subject: [PATCH 32/61] settings: general section --- src/gui/gui.h | 6 + src/gui/settings.cpp | 1151 +++++++++++++++++++++--------------------- 2 files changed, 586 insertions(+), 571 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index c4547914da..7ddd11d10f 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1639,6 +1639,12 @@ class SettingsCategory { settings({}), expandChild(false) {} + /** + * settings category constructor. + * @param n category name. + * @param c subcategories. + * @param s category settings. + */ SettingsCategory(const char* n, std::initializer_list c, std::initializer_list s): expandChild(false) { name=n; diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index da7036189f..a60ece3049 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -33,7 +33,6 @@ #include "misc/freetype/imgui_freetype.h" #include "scaling.h" #include -#include #ifdef _WIN32 #include @@ -46,14 +45,6 @@ #include #endif -#define clampSetting(x,minV,maxV) \ - if (xmaxV) { \ - x=maxV; \ - } - #define DEFAULT_NOTE_KEYS "5:7;6:4;7:3;8:16;10:6;11:8;12:24;13:10;16:11;17:9;18:26;19:28;20:12;21:17;22:1;23:19;24:23;25:5;26:14;27:2;28:21;29:0;30:100;31:13;32:15;34:18;35:20;36:22;38:25;39:27;43:100;46:101;47:29;48:31;53:102;" #if defined(_WIN32) || defined(__APPLE__) || defined(IS_MOBILE) @@ -577,24 +568,6 @@ void FurnaceGUI::setupSettingsCategories() { ImGui::Unindent(); }), }), -#ifdef IS_MOBILE - SettingsCategory(_("Vibration"),{},{ - SETTING(_("Strength"),{ - if (ImGui::SliderFloat(_("Strength"),&settings.vibrationStrength,0.0f,1.0f)) { - if (settings.vibrationStrength<0.0f) settings.vibrationStrength=0.0f; - if (settings.vibrationStrength>1.0f) settings.vibrationStrength=1.0f; - SETTINGS_CHANGED; - } - }), - SETTING(_("Length"),{ - if (ImGui::SliderInt(_("Length"),&settings.vibrationLength,10,500)) { - if (settings.vibrationLength<10) settings.vibrationLength=10; - if (settings.vibrationLength>500) settings.vibrationLength=500; - SETTINGS_CHANGED; - } - }), - }), -#endif SettingsCategory(_("File"),{},{ SETTING(_("Use system file picker"),{ bool sysFileDialogB=settings.sysFileDialog; @@ -723,102 +696,427 @@ void FurnaceGUI::setupSettingsCategories() { }) }), SettingsCategory(_("New Song"),{},{ - - }) - },{}) - }; - - settings.activeCategory=settings.categories[0]; -} + SETTING(_("Initial system:"),{ + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("Initial system:")); + ImGui::SameLine(); + if (ImGui::Button(_("Current system"))) { + settings.initialSys.clear(); + for (int i=0; isong.systemLen; i++) { + settings.initialSys.set(fmt::sprintf("id%d",i),e->systemToFileFur(e->song.system[i])); + settings.initialSys.set(fmt::sprintf("vol%d",i),(float)e->song.systemVol[i]); + settings.initialSys.set(fmt::sprintf("pan%d",i),(float)e->song.systemPan[i]); + settings.initialSys.set(fmt::sprintf("fr%d",i),(float)e->song.systemPanFR[i]); + settings.initialSys.set(fmt::sprintf("flags%d",i),e->song.systemFlags[i].toBase64()); + } + settings.initialSysName=e->song.systemName; + SETTINGS_CHANGED; + } + ImGui::SameLine(); + if (ImGui::Button(_("Randomize"))) { + settings.initialSys.clear(); + int howMany=1+rand()%3; + int totalAvailSys=0; + for (totalAvailSys=0; availableSystems[totalAvailSys]; totalAvailSys++); + if (totalAvailSys>0) { + for (int i=0; isystemToFileFur(theSystem)); + settings.initialSys.set(fmt::sprintf("vol%d",i),1.0f); + settings.initialSys.set(fmt::sprintf("pan%d",i),0.0f); + settings.initialSys.set(fmt::sprintf("fr%d",i),0.0f); + settings.initialSys.set(fmt::sprintf("flags%d",i),""); + } + } else { + settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_DUMMY)); + settings.initialSys.set("vol0",1.0f); + settings.initialSys.set("pan0",0.0f); + settings.initialSys.set("fr0",0.0f); + settings.initialSys.set("flags0",""); + howMany=1; + } + // randomize system name + std::vector wordPool[6]; + for (int i=0; isystemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0)); + String sName=e->getSystemName(sysID); + String nameWord; + sName+=" "; + for (char& i: sName) { + if (i==' ') { + if (nameWord!="") { + wordPool[wpPos++].push_back(nameWord); + if (wpPos>=6) break; + nameWord=""; + } + } else { + nameWord+=i; + } + } + } + settings.initialSysName=""; + for (int i=0; i<6; i++) { + if (wordPool[i].empty()) continue; + settings.initialSysName+=wordPool[i][rand()%wordPool[i].size()]; + settings.initialSysName+=" "; + } + SETTINGS_CHANGED; + } + ImGui::SameLine(); + if (ImGui::Button(_("Reset to defaults"))) { + settings.initialSys.clear(); + settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_YM2612)); + settings.initialSys.set("vol0",1.0f); + settings.initialSys.set("pan0",0.0f); + settings.initialSys.set("fr0",0.0f); + settings.initialSys.set("flags0",""); + settings.initialSys.set("id1",e->systemToFileFur(DIV_SYSTEM_SMS)); + settings.initialSys.set("vol1",0.5f); + settings.initialSys.set("pan1",0.0f); + settings.initialSys.set("fr1",0.0f); + settings.initialSys.set("flags1",""); + settings.initialSysName="Sega Genesis/Mega Drive"; + SETTINGS_CHANGED; + } + }), + SETTING(_("Name"),{ + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("Name")); + ImGui::SameLine(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::InputText("##InitSysName",&settings.initialSysName)) SETTINGS_CHANGED; + }), + SETTING(_("Initial system:"),{ // not the real setting name but gotta find it somehow + int sysCount=0; + int doRemove=-1; + for (size_t i=0; settings.initialSys.getInt(fmt::sprintf("id%d",i),0); i++) { + DivSystem sysID=e->systemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0)); + float sysVol=settings.initialSys.getFloat(fmt::sprintf("vol%d",i),0); + float sysPan=settings.initialSys.getFloat(fmt::sprintf("pan%d",i),0); + float sysPanFR=settings.initialSys.getFloat(fmt::sprintf("fr%d",i),0); -void FurnaceGUI::destroySettingsCategories(SettingsCategory& cat) { - if (cat.children.size()>0) { - for (SettingsCategory i:cat.children) { - destroySettingsCategories(i); - } - } - for (Setting* i:cat.settings) { - delete i; - } - cat.settings.clear(); - cat.children.clear(); -} + sysCount=i+1; -void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { - if (cat->children.size()>0) { - ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_OpenOnDoubleClick; - if (settings.activeCategory.name==cat->name) f|=ImGuiTreeNodeFlags_Selected; - cat->expandChild=ImGui::TreeNodeEx(cat->name,f); - if (ImGui::IsItemClicked()) { - settings.activeCategory=*cat; - } - if (cat->expandChild) { - float indentSize=ImGui::CalcTextSize("-").x*dpiScale; - ImGui::Indent(indentSize); - for (SettingsCategory child:cat->children) drawSettingsCategory(&child); - ImGui::Unindent(indentSize); - ImGui::TreePop(); - } - } else { // a lonely child... - if (ImGui::Selectable(cat->name,settings.activeCategory.name==cat->name)) { - settings.activeCategory=*cat; - } - } -} + //bool doRemove=false; + bool doInvert=(sysVol<0); + float vol=fabs(sysVol); + ImGui::PushID(i); -void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { - if (cat->children.size()>0) { - for (SettingsCategory child:cat->children) { - searchDrawSettingItems(&child); - } - } - bool anyFound=false; - for (Setting* s:cat->settings) { - if (s->passesFilter(&settings.filter)) { - anyFound=true; - break; - } - } - if (anyFound) { - ImGui::BulletText("%s",cat->name); - ImGui::Indent(); - for (Setting* s:cat->settings) { - if (s->passesFilter(&settings.filter)) s->drawSetting(); - } - ImGui::Unindent(); - ImGui::Separator(); - } -} + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize(_("Invert")).x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (ImGui::BeginCombo("##System",getSystemName(sysID),ImGuiComboFlags_HeightLargest)) { + sysID=systemPicker(true); -void FurnaceGUI::drawSettingsItems() { - if (settings.filter.IsActive()) { - for (SettingsCategory cat:settings.categories) { - searchDrawSettingItems(&cat); - } - } else { - if (settings.activeCategory.name==NULL) return; - for (Setting* s:settings.activeCategory.settings) s->drawSetting(); - } -} + if (sysID!=DIV_SYSTEM_NULL) { + settings.initialSys.set(fmt::sprintf("id%d",i),(int)e->systemToFileFur(sysID)); + settings.initialSys.set(fmt::sprintf("flags%d",i),""); + SETTINGS_CHANGED; + ImGui::CloseCurrentPopup(); + } -String stripName(String what) { - String ret; - for (char& i: what) { - if ((i>='A' && i<='Z') || (i>='a' && i<='z') || (i>='0' && i<='9')) { - ret+=i; - } else { - ret+='-'; - } - } - return ret; -} + ImGui::EndCombo(); + } -bool FurnaceGUI::splitBackupName(const char* input, String& backupName, struct tm& backupTime) { - size_t len=strlen(input); - if (len<4) return false; + ImGui::SameLine(); + if (ImGui::Checkbox(_("Invert"),&doInvert)) { + sysVol=-sysVol; + settings.initialSys.set(fmt::sprintf("vol%d",i),sysVol); + SETTINGS_CHANGED; + } + ImGui::SameLine(); + //ImGui::BeginDisabled(settings.initialSys.size()<=4); + pushDestColor(); + if (ImGui::Button(ICON_FA_MINUS "##InitSysRemove")) { + doRemove=i; + SETTINGS_CHANGED; + } + popDestColor(); + //ImGui::EndDisabled(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (CWSliderFloat(_("Volume"),&vol,0.0f,3.0f)) { + if (doInvert) { + if (vol<0.0001) vol=0.0001; + } + if (vol<0) vol=0; + if (vol>10) vol=10; + sysVol=doInvert?-vol:vol; + settings.initialSys.set(fmt::sprintf("vol%d",i),(float)sysVol); + SETTINGS_CHANGED; + } rightClickable + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (CWSliderFloat(_("Panning"),&sysPan,-1.0f,1.0f)) { + if (sysPan<-1.0f) sysPan=-1.0f; + if (sysPan>1.0f) sysPan=1.0f; + settings.initialSys.set(fmt::sprintf("pan%d",i),(float)sysPan); + SETTINGS_CHANGED; + } rightClickable + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (CWSliderFloat(_("Front/Rear"),&sysPanFR,-1.0f,1.0f)) { + if (sysPanFR<-1.0f) sysPanFR=-1.0f; + if (sysPanFR>1.0f) sysPanFR=1.0f; + settings.initialSys.set(fmt::sprintf("fr%d",i),(float)sysPanFR); + SETTINGS_CHANGED; + } rightClickable - const char* firstHyphen=NULL; - const char* secondHyphen=NULL; + // oh please MSVC don't cry + if (ImGui::TreeNode(_("Configure"))) { + String sysFlagsS=settings.initialSys.getString(fmt::sprintf("flags%d",i),""); + DivConfig sysFlags; + sysFlags.loadFromBase64(sysFlagsS.c_str()); + if (drawSysConf(-1,i,sysID,sysFlags,false)) { + settings.initialSys.set(fmt::sprintf("flags%d",i),sysFlags.toBase64()); + } + ImGui::TreePop(); + SETTINGS_CHANGED; + } + + ImGui::PopID(); + } + + if (doRemove>=0 && sysCount>1) { + for (int i=doRemove; isystemToFileFur(DIV_SYSTEM_YM2612)); + settings.initialSys.set(fmt::sprintf("vol%d",sysCount),1.0f); + settings.initialSys.set(fmt::sprintf("pan%d",sysCount),0.0f); + settings.initialSys.set(fmt::sprintf("fr%d",sysCount),0.0f); + settings.initialSys.set(fmt::sprintf("flags%d",sysCount),""); + } + }), + SETTING(_("When creating new song:"),{ + ImGui::Text(_("When creating new song:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Display system preset selector##NSB0"),settings.newSongBehavior==0)) { + settings.newSongBehavior=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Start with initial system##NSB1"),settings.newSongBehavior==1)) { + settings.newSongBehavior=1; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Default author name"),{ + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("Default author name")); + ImGui::SameLine(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::InputText("##DefAuthName", &settings.defaultAuthorName)) SETTINGS_CHANGED; + }) + }), + SettingsCategory(_("Start-up"),{},{ + SETTING(_("Play intro on start-up:"),{ + ImGui::Text(_("Play intro on start-up:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No##pis0"),settings.alwaysPlayIntro==0)) { + settings.alwaysPlayIntro=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Short##pis1"),settings.alwaysPlayIntro==1)) { + settings.alwaysPlayIntro=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Full (short when loading song)##pis2"),settings.alwaysPlayIntro==2)) { + settings.alwaysPlayIntro=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Full (always)##pis3"),settings.alwaysPlayIntro==3)) { + settings.alwaysPlayIntro=3; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Disable fade-in during start-up"),{ + bool disableFadeInB=settings.disableFadeIn; + if (ImGui::Checkbox(_("Disable fade-in during start-up"),&disableFadeInB)) { + settings.disableFadeIn=disableFadeInB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Behavior"),{},{ + SETTING(_("New instruments are blank"),{ + bool blankInsB=settings.blankIns; + if (ImGui::Checkbox(_("New instruments are blank"),&blankInsB)) { + settings.blankIns=blankInsB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Configuration"),{},{ // these donn belond here... + SETTING(NULL,{ + if (ImGui::Button(_("Import"))) { + openFileDialog(GUI_FILE_IMPORT_CONFIG); + } + ImGui::SameLine(); + if (ImGui::Button(_("Export"))) { + openFileDialog(GUI_FILE_EXPORT_CONFIG); + } + pushDestColor(); + if (ImGui::Button(_("Factory Reset"))) { + showWarning(_("Are you sure you want to reset all Furnace settings?\nYou must restart Furnace after doing so."),GUI_WARN_RESET_CONFIG); + } + popDestColor(); + }) + }), + SettingsCategory(_("Import"),{},{ + SETTING(_("Use OPL3 instead of OPL2 for S3M import"),{ + bool s3mOPL3B=settings.s3mOPL3; + if (ImGui::Checkbox(_("Use OPL3 instead of OPL2 for S3M import"),&s3mOPL3B)) { + settings.s3mOPL3=s3mOPL3B; + SETTINGS_CHANGED; + } + }) + }), +#ifndef IS_MOBILE + SettingsCategory(_("Android"),{ + SettingsCategory(_("Vibrator"),{},{ + SETTING(_("Strength"),{ + if (ImGui::SliderFloat(_("Strength"),&settings.vibrationStrength,0.0f,1.0f)) { + if (settings.vibrationStrength<0.0f) settings.vibrationStrength=0.0f; + if (settings.vibrationStrength>1.0f) settings.vibrationStrength=1.0f; + SETTINGS_CHANGED; + } + }), + SETTING(_("Length"),{ + if (ImGui::SliderInt(_("Length"),&settings.vibrationLength,10,500,"%d ms")) { + if (settings.vibrationLength<10) settings.vibrationLength=10; + if (settings.vibrationLength>500) settings.vibrationLength=500; + SETTINGS_CHANGED; + } + }), + }) + },{ + SETTING(_("Enable background playback (restart!)"),{ + bool backgroundPlayB=settings.backgroundPlay; + if (ImGui::Checkbox(_("Enable background playback (restart!)"),&backgroundPlayB)) { + settings.backgroundPlay=backgroundPlayB; + SETTINGS_CHANGED; + } + }) + }), +#endif + },{}), + SettingsCategory(_("Audio"),{ + SettingsCategory(_("Output"),{},{ + + }) + },{}) + }; + + settings.activeCategory=settings.categories[0]; +} + +void FurnaceGUI::destroySettingsCategories(SettingsCategory& cat) { + if (cat.children.size()>0) { + for (SettingsCategory i:cat.children) { + destroySettingsCategories(i); + } + } + for (Setting* i:cat.settings) { + delete i; + } + cat.settings.clear(); + cat.children.clear(); +} + +void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { + if (cat->children.size()>0) { + ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_OpenOnDoubleClick; + if (settings.activeCategory.name==cat->name) f|=ImGuiTreeNodeFlags_Selected; + cat->expandChild=ImGui::TreeNodeEx(cat->name,f); + if (ImGui::IsItemClicked()) { + settings.activeCategory=*cat; + } + if (cat->expandChild) { + float indentSize=ImGui::CalcTextSize("-").x*dpiScale; + ImGui::Indent(indentSize); + for (SettingsCategory child:cat->children) drawSettingsCategory(&child); + ImGui::Unindent(indentSize); + ImGui::TreePop(); + } + } else { // a lonely child... + if (ImGui::Selectable(cat->name,settings.activeCategory.name==cat->name)) { + settings.activeCategory=*cat; + } + } +} + +void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { + if (cat->children.size()>0) { + for (SettingsCategory child:cat->children) { + searchDrawSettingItems(&child); + } + } + bool anyFound=false; + for (Setting* s:cat->settings) { + if (s->passesFilter(&settings.filter)) { + anyFound=true; + break; + } + } + if (anyFound) { + ImGui::BulletText("%s",cat->name); + ImGui::Indent(); + for (Setting* s:cat->settings) { + if (s->passesFilter(&settings.filter)) s->drawSetting(); + } + ImGui::Unindent(); + ImGui::Separator(); + } +} + +void FurnaceGUI::drawSettingsItems() { + if (settings.filter.IsActive()) { + for (SettingsCategory cat:settings.categories) { + searchDrawSettingItems(&cat); + } + } else { + if (settings.activeCategory.name==NULL) return; + for (Setting* s:settings.activeCategory.settings) s->drawSetting(); + } +} + +String stripName(String what) { + String ret; + for (char& i: what) { + if ((i>='A' && i<='Z') || (i>='a' && i<='z') || (i>='0' && i<='9')) { + ret+=i; + } else { + ret+='-'; + } + } + return ret; +} + +bool FurnaceGUI::splitBackupName(const char* input, String& backupName, struct tm& backupTime) { + size_t len=strlen(input); + if (len<4) return false; + + const char* firstHyphen=NULL; + const char* secondHyphen=NULL; bool whichHyphen=false; bool isDateValid=true; // -YYYYMMDD-hhmmss.fur @@ -879,473 +1177,176 @@ bool FurnaceGUI::splitBackupName(const char* input, String& backupName, struct t for (const char* i=firstHyphen+1; *i; i++) { if ((*i)=='-') break; if ((*i)<'0' || (*i)>'9') { - isDateValid=false; - break; - } - theDate+=*i; - } - if (!isDateValid) return false; - if (theDate.size()<5) return false; - if (theDate.size()>14) return false; - String mmdd=theDate.substr(theDate.size()-4); - if (mmdd.size()!=4) return false; - backupTime.tm_mon=(mmdd[0]-'0')*10+(mmdd[1]-'0')-1; - backupTime.tm_mday=(mmdd[2]-'0')*10+(mmdd[3]-'0'); - if (backupTime.tm_mon>12) return false; - if (backupTime.tm_mday>31) return false; - String yyyy=theDate.substr(0,theDate.size()-4); - try { - backupTime.tm_year=std::stoi(yyyy)-1900; - } catch (std::exception& e) { - return false; - } - - backupName=""; - for (const char* i=input; i!=firstHyphen && (*i); i++) { - backupName+=*i; - } - - return true; -} - -void FurnaceGUI::purgeBackups(int year, int month, int day) { -#ifdef _WIN32 - String findPath=backupPath+String(DIR_SEPARATOR_STR)+String("*.fur"); - WString findPathW=utf8To16(findPath.c_str()); - WIN32_FIND_DATAW next; - HANDLE backDir=FindFirstFileW(findPathW.c_str(),&next); - if (backDir!=INVALID_HANDLE_VALUE) { - do { - String backupName; - struct tm backupTime; - String cFileNameU=utf16To8(next.cFileName); - bool deleteBackup=false; - if (!splitBackupName(cFileNameU.c_str(),backupName,backupTime)) continue; - - if (year==0) { - deleteBackup=true; - } else if (backupTime.tm_year<(year-1900)) { - deleteBackup=true; - } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) { - deleteBackup=true; - } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mdayd_name,".")==0) continue; - if (strcmp(next->d_name,"..")==0) continue; - if (!splitBackupName(next->d_name,backupName,backupTime)) continue; - - if (year==0) { - deleteBackup=true; - } else if (backupTime.tm_year<(year-1900)) { - deleteBackup=true; - } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) { - deleteBackup=true; - } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mdayd_name; - deleteFile(nextPath.c_str()); - } - } - closedir(backDir); -#endif - refreshBackups=true; -} - -void FurnaceGUI::promptKey(int which, int bindIdx) { - bindSetTarget=which; - bindSetTargetIdx=bindIdx; - bindSetActive=true; - bindSetPending=true; - if (bindIdx>=(int)actionKeys[which].size()) { - bindSetPrevValue=0; - actionKeys[which].push_back(0); - } else { - bindSetPrevValue=actionKeys[which][bindIdx]; - actionKeys[which][bindIdx]=0; - } -} - -struct MappedInput { - int scan; - int val; - MappedInput(): - scan(SDL_SCANCODE_UNKNOWN), val(0) {} - MappedInput(int s, int v): - scan(s), val(v) {} -}; - -void FurnaceGUI::drawSettings() { - if (nextWindow==GUI_WINDOW_SETTINGS) { - settingsOpen=true; - ImGui::SetNextWindowFocus(); - nextWindow=GUI_WINDOW_NOTHING; - } - if (!settingsOpen) return; - if (mobileUI) { - ImVec2 setWindowPos=ImVec2(0,0); - ImVec2 setWindowSize=ImVec2(canvasW,canvasH); - ImGui::SetNextWindowPos(setWindowPos); - ImGui::SetNextWindowSize(setWindowSize); - } else { - ImGui::SetNextWindowSizeConstraints(ImVec2(200.0f*dpiScale,100.0f*dpiScale),ImVec2(canvasW,canvasH)); - } - if (ImGui::Begin("Settings",&settingsOpen,ImGuiWindowFlags_NoDocking|globalWinFlags,_("Settings"))) { - if (!settingsOpen) { - if (settingsChanged) { - settingsOpen=true; - showWarning(_("Do you want to save your settings?"),GUI_WARN_CLOSE_SETTINGS); - } else { - settingsOpen=false; - } - } - if (ImGui::BeginTabBar("settingsTab")) { - // NEW SETTINGS HERE - CONFIG_SECTION("test") { - CONFIG_SUBSECTION("here"); - - bool vertical=ImGui::GetWindowSize().y>ImGui::GetWindowSize().x; - if (ImGui::BeginTable("set3", vertical?1:2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - if (ImGui::BeginChild("SettingCategories",vertical?ImGui::GetContentRegionAvail()/ImVec2(1.0f,3.0f):ImGui::GetContentRegionAvail(),false)) { - settings.filter.Draw(_("Search")); - for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); - } - ImGui::EndChild(); - if (ImGui::GetWindowSize().y>ImGui::GetWindowSize().x) ImGui::TableNextRow(); - ImGui::TableNextColumn(); - if (ImGui::BeginChild("SettingsItems",vertical?ImVec2(0.0f,0.0f):ImGui::GetContentRegionAvail(),false)) { - drawSettingsItems(); - if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { - ImGui::Text("gotta unlock them first!"); - } - } - ImGui::EndChild(); - ImGui::EndTable(); - } - - END_SECTION; - } - CONFIG_SECTION(_("General")) { - - - - // SUBSECTION NEW SONG - CONFIG_SUBSECTION(_("New Song")); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Initial system:")); - ImGui::SameLine(); - if (ImGui::Button(_("Current system"))) { - settings.initialSys.clear(); - for (int i=0; isong.systemLen; i++) { - settings.initialSys.set(fmt::sprintf("id%d",i),e->systemToFileFur(e->song.system[i])); - settings.initialSys.set(fmt::sprintf("vol%d",i),(float)e->song.systemVol[i]); - settings.initialSys.set(fmt::sprintf("pan%d",i),(float)e->song.systemPan[i]); - settings.initialSys.set(fmt::sprintf("fr%d",i),(float)e->song.systemPanFR[i]); - settings.initialSys.set(fmt::sprintf("flags%d",i),e->song.systemFlags[i].toBase64()); - } - settings.initialSysName=e->song.systemName; - SETTINGS_CHANGED; - } - ImGui::SameLine(); - if (ImGui::Button(_("Randomize"))) { - settings.initialSys.clear(); - int howMany=1+rand()%3; - int totalAvailSys=0; - for (totalAvailSys=0; availableSystems[totalAvailSys]; totalAvailSys++); - if (totalAvailSys>0) { - for (int i=0; isystemToFileFur(theSystem)); - settings.initialSys.set(fmt::sprintf("vol%d",i),1.0f); - settings.initialSys.set(fmt::sprintf("pan%d",i),0.0f); - settings.initialSys.set(fmt::sprintf("fr%d",i),0.0f); - settings.initialSys.set(fmt::sprintf("flags%d",i),""); - } - } else { - settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_DUMMY)); - settings.initialSys.set("vol0",1.0f); - settings.initialSys.set("pan0",0.0f); - settings.initialSys.set("fr0",0.0f); - settings.initialSys.set("flags0",""); - howMany=1; - } - // randomize system name - std::vector wordPool[6]; - for (int i=0; isystemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0)); - String sName=e->getSystemName(sysID); - String nameWord; - sName+=" "; - for (char& i: sName) { - if (i==' ') { - if (nameWord!="") { - wordPool[wpPos++].push_back(nameWord); - if (wpPos>=6) break; - nameWord=""; - } - } else { - nameWord+=i; - } - } - } - settings.initialSysName=""; - for (int i=0; i<6; i++) { - if (wordPool[i].empty()) continue; - settings.initialSysName+=wordPool[i][rand()%wordPool[i].size()]; - settings.initialSysName+=" "; - } - SETTINGS_CHANGED; - } - ImGui::SameLine(); - if (ImGui::Button(_("Reset to defaults"))) { - settings.initialSys.clear(); - settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_YM2612)); - settings.initialSys.set("vol0",1.0f); - settings.initialSys.set("pan0",0.0f); - settings.initialSys.set("fr0",0.0f); - settings.initialSys.set("flags0",""); - settings.initialSys.set("id1",e->systemToFileFur(DIV_SYSTEM_SMS)); - settings.initialSys.set("vol1",0.5f); - settings.initialSys.set("pan1",0.0f); - settings.initialSys.set("fr1",0.0f); - settings.initialSys.set("flags1",""); - settings.initialSysName="Sega Genesis/Mega Drive"; - SETTINGS_CHANGED; - } - - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Name")); - ImGui::SameLine(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::InputText("##InitSysName",&settings.initialSysName)) SETTINGS_CHANGED; - - int sysCount=0; - int doRemove=-1; - for (size_t i=0; settings.initialSys.getInt(fmt::sprintf("id%d",i),0); i++) { - DivSystem sysID=e->systemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0)); - float sysVol=settings.initialSys.getFloat(fmt::sprintf("vol%d",i),0); - float sysPan=settings.initialSys.getFloat(fmt::sprintf("pan%d",i),0); - float sysPanFR=settings.initialSys.getFloat(fmt::sprintf("fr%d",i),0); - - sysCount=i+1; - - //bool doRemove=false; - bool doInvert=(sysVol<0); - float vol=fabs(sysVol); - ImGui::PushID(i); - - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize(_("Invert")).x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); - if (ImGui::BeginCombo("##System",getSystemName(sysID),ImGuiComboFlags_HeightLargest)) { - - sysID=systemPicker(true); - - if (sysID!=DIV_SYSTEM_NULL) - { - settings.initialSys.set(fmt::sprintf("id%d",i),(int)e->systemToFileFur(sysID)); - settings.initialSys.set(fmt::sprintf("flags%d",i),""); - SETTINGS_CHANGED; - - ImGui::CloseCurrentPopup(); - } - - ImGui::EndCombo(); - } - - ImGui::SameLine(); - if (ImGui::Checkbox(_("Invert"),&doInvert)) { - sysVol=-sysVol; - settings.initialSys.set(fmt::sprintf("vol%d",i),sysVol); - SETTINGS_CHANGED; - } - ImGui::SameLine(); - //ImGui::BeginDisabled(settings.initialSys.size()<=4); - pushDestColor(); - if (ImGui::Button(ICON_FA_MINUS "##InitSysRemove")) { - doRemove=i; - SETTINGS_CHANGED; - } - popDestColor(); - //ImGui::EndDisabled(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); - if (CWSliderFloat(_("Volume"),&vol,0.0f,3.0f)) { - if (doInvert) { - if (vol<0.0001) vol=0.0001; - } - if (vol<0) vol=0; - if (vol>10) vol=10; - sysVol=doInvert?-vol:vol; - settings.initialSys.set(fmt::sprintf("vol%d",i),(float)sysVol); - SETTINGS_CHANGED; - } rightClickable - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); - if (CWSliderFloat(_("Panning"),&sysPan,-1.0f,1.0f)) { - if (sysPan<-1.0f) sysPan=-1.0f; - if (sysPan>1.0f) sysPan=1.0f; - settings.initialSys.set(fmt::sprintf("pan%d",i),(float)sysPan); - SETTINGS_CHANGED; - } rightClickable - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); - if (CWSliderFloat(_("Front/Rear"),&sysPanFR,-1.0f,1.0f)) { - if (sysPanFR<-1.0f) sysPanFR=-1.0f; - if (sysPanFR>1.0f) sysPanFR=1.0f; - settings.initialSys.set(fmt::sprintf("fr%d",i),(float)sysPanFR); - SETTINGS_CHANGED; - } rightClickable - - // oh please MSVC don't cry - if (ImGui::TreeNode(_("Configure"))) { - String sysFlagsS=settings.initialSys.getString(fmt::sprintf("flags%d",i),""); - DivConfig sysFlags; - sysFlags.loadFromBase64(sysFlagsS.c_str()); - if (drawSysConf(-1,i,sysID,sysFlags,false)) { - settings.initialSys.set(fmt::sprintf("flags%d",i),sysFlags.toBase64()); - } - ImGui::TreePop(); - SETTINGS_CHANGED; - } + isDateValid=false; + break; + } + theDate+=*i; + } + if (!isDateValid) return false; + if (theDate.size()<5) return false; + if (theDate.size()>14) return false; + String mmdd=theDate.substr(theDate.size()-4); + if (mmdd.size()!=4) return false; + backupTime.tm_mon=(mmdd[0]-'0')*10+(mmdd[1]-'0')-1; + backupTime.tm_mday=(mmdd[2]-'0')*10+(mmdd[3]-'0'); + if (backupTime.tm_mon>12) return false; + if (backupTime.tm_mday>31) return false; + String yyyy=theDate.substr(0,theDate.size()-4); + try { + backupTime.tm_year=std::stoi(yyyy)-1900; + } catch (std::exception& e) { + return false; + } - ImGui::PopID(); - } + backupName=""; + for (const char* i=input; i!=firstHyphen && (*i); i++) { + backupName+=*i; + } - if (doRemove>=0 && sysCount>1) { - for (int i=doRemove; isystemToFileFur(DIV_SYSTEM_YM2612)); - settings.initialSys.set(fmt::sprintf("vol%d",sysCount),1.0f); - settings.initialSys.set(fmt::sprintf("pan%d",sysCount),0.0f); - settings.initialSys.set(fmt::sprintf("fr%d",sysCount),0.0f); - settings.initialSys.set(fmt::sprintf("flags%d",sysCount),""); - } + if (year==0) { + deleteBackup=true; + } else if (backupTime.tm_year<(year-1900)) { + deleteBackup=true; + } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) { + deleteBackup=true; + } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mdayd_name,".")==0) continue; + if (strcmp(next->d_name,"..")==0) continue; + if (!splitBackupName(next->d_name,backupName,backupTime)) continue; - // SUBSECTION START-UP - CONFIG_SUBSECTION(_("Start-up")); - ImGui::Text(_("Play intro on start-up:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("No##pis0"),settings.alwaysPlayIntro==0)) { - settings.alwaysPlayIntro=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Short##pis1"),settings.alwaysPlayIntro==1)) { - settings.alwaysPlayIntro=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Full (short when loading song)##pis2"),settings.alwaysPlayIntro==2)) { - settings.alwaysPlayIntro=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Full (always)##pis3"),settings.alwaysPlayIntro==3)) { - settings.alwaysPlayIntro=3; - SETTINGS_CHANGED; - } - ImGui::Unindent(); + if (year==0) { + deleteBackup=true; + } else if (backupTime.tm_year<(year-1900)) { + deleteBackup=true; + } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) { + deleteBackup=true; + } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mdayd_name; + deleteFile(nextPath.c_str()); + } + } + closedir(backDir); +#endif + refreshBackups=true; +} - // SUBSECTION BEHAVIOR - CONFIG_SUBSECTION(_("Behavior")); - bool blankInsB=settings.blankIns; - if (ImGui::Checkbox(_("New instruments are blank"),&blankInsB)) { - settings.blankIns=blankInsB; - SETTINGS_CHANGED; - } +void FurnaceGUI::promptKey(int which, int bindIdx) { + bindSetTarget=which; + bindSetTargetIdx=bindIdx; + bindSetActive=true; + bindSetPending=true; + if (bindIdx>=(int)actionKeys[which].size()) { + bindSetPrevValue=0; + actionKeys[which].push_back(0); + } else { + bindSetPrevValue=actionKeys[which][bindIdx]; + actionKeys[which][bindIdx]=0; + } +} - // SUBSECTION CONFIGURATION - CONFIG_SUBSECTION(_("Configuration")); - if (ImGui::Button(_("Import"))) { - openFileDialog(GUI_FILE_IMPORT_CONFIG); - } - ImGui::SameLine(); - if (ImGui::Button(_("Export"))) { - openFileDialog(GUI_FILE_EXPORT_CONFIG); - } - pushDestColor(); - if (ImGui::Button(_("Factory Reset"))) { - showWarning(_("Are you sure you want to reset all Furnace settings?\nYou must restart Furnace after doing so."),GUI_WARN_RESET_CONFIG); - } - popDestColor(); +struct MappedInput { + int scan; + int val; + MappedInput(): + scan(SDL_SCANCODE_UNKNOWN), val(0) {} + MappedInput(int s, int v): + scan(s), val(v) {} +}; - // SUBSECTION IMPORT - CONFIG_SUBSECTION(_("Import")); - bool s3mOPL3B=settings.s3mOPL3; - if (ImGui::Checkbox(_("Use OPL3 instead of OPL2 for S3M import"),&s3mOPL3B)) { - settings.s3mOPL3=s3mOPL3B; - SETTINGS_CHANGED; - } +void FurnaceGUI::drawSettings() { + if (nextWindow==GUI_WINDOW_SETTINGS) { + settingsOpen=true; + ImGui::SetNextWindowFocus(); + nextWindow=GUI_WINDOW_NOTHING; + } + if (!settingsOpen) return; + if (mobileUI) { + ImVec2 setWindowPos=ImVec2(0,0); + ImVec2 setWindowSize=ImVec2(canvasW,canvasH); + ImGui::SetNextWindowPos(setWindowPos); + ImGui::SetNextWindowSize(setWindowSize); + } else { + ImGui::SetNextWindowSizeConstraints(ImVec2(200.0f*dpiScale,100.0f*dpiScale),ImVec2(canvasW,canvasH)); + } + if (ImGui::Begin("Settings",&settingsOpen,ImGuiWindowFlags_NoDocking|globalWinFlags,_("Settings"))) { + if (!settingsOpen) { + if (settingsChanged) { + settingsOpen=true; + showWarning(_("Do you want to save your settings?"),GUI_WARN_CLOSE_SETTINGS); + } else { + settingsOpen=false; + } + } + if (ImGui::BeginTabBar("settingsTab")) { + // NEW SETTINGS HERE + CONFIG_SECTION("test") { + CONFIG_SUBSECTION("here"); -#ifdef ANDROID - // SUBSECTION ANDROID - CONFIG_SUBSECTION(_("Android")); - bool backgroundPlayB=settings.backgroundPlay; - if (ImGui::Checkbox(_("Enable background playback (restart!)"),&backgroundPlayB)) { - settings.backgroundPlay=backgroundPlayB; - SETTINGS_CHANGED; + bool vertical=ImGui::GetWindowSize().y>ImGui::GetWindowSize().x; + if (ImGui::BeginTable("set3", vertical?1:2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if (ImGui::BeginChild("SettingCategories",vertical?ImGui::GetContentRegionAvail()/ImVec2(1.0f,3.0f):ImGui::GetContentRegionAvail(),false)) { + settings.filter.Draw(_("Search")); + ImGui::BeginDisabled(settings.filter.IsActive()); + for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); + ImGui::EndDisabled(); + } + ImGui::EndChild(); + if (ImGui::GetWindowSize().y>ImGui::GetWindowSize().x) ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if (ImGui::BeginChild("SettingsItems",vertical?ImVec2(0.0f,0.0f):ImGui::GetContentRegionAvail(),false)) { + drawSettingsItems(); + if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { + ImGui::Text("gotta unlock them first!"); } -#endif + } + ImGui::EndChild(); + ImGui::EndTable(); + } END_SECTION; } @@ -4817,6 +4818,14 @@ void FurnaceGUI::drawKeybindSettingsTableRow(FurnaceGUIActions actionIdx) { ImGui::PopID(); // action } +#define clampSetting(x,minV,maxV) \ + if (xmaxV) { \ + x=maxV; \ + } + void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { if (groups&GUI_SETTINGS_GENERAL) { settings.renderDriver=conf.getString("renderDriver",""); From afa1105cf98bb8a4e293a5ba78be18d53acabe57 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Tue, 12 Nov 2024 00:12:12 +0400 Subject: [PATCH 33/61] adjust cat treenodes --- src/gui/settings.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index a60ece3049..4b15d75412 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -33,6 +33,7 @@ #include "misc/freetype/imgui_freetype.h" #include "scaling.h" #include +#include #ifdef _WIN32 #include @@ -1044,7 +1045,7 @@ void FurnaceGUI::destroySettingsCategories(SettingsCategory& cat) { void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { if (cat->children.size()>0) { - ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_OpenOnDoubleClick; + ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_SpanFullWidth|ImGuiTreeNodeFlags_OpenOnArrow|ImGuiTreeNodeFlags_OpenOnDoubleClick; if (settings.activeCategory.name==cat->name) f|=ImGuiTreeNodeFlags_Selected; cat->expandChild=ImGui::TreeNodeEx(cat->name,f); if (ImGui::IsItemClicked()) { From 9cb981b1894688169f6649f47a5627e8af03daef Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Tue, 12 Nov 2024 13:41:05 +0400 Subject: [PATCH 34/61] settigns: audio category --- src/gui/gui.h | 2 +- src/gui/settings.cpp | 483 ++++++++++++++++++++----------------------- 2 files changed, 222 insertions(+), 263 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 7ddd11d10f..971b53a808 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1606,7 +1606,7 @@ struct Setting { std::function drawCondition; public: bool passesFilter(ImGuiTextFilter* filter) { - return filter->PassFilter(friendlyName); + return drawCondition() && filter->PassFilter(friendlyName); }; void drawSetting() { if (drawCondition()) draw(); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 4b15d75412..6c1bdfcd8d 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -966,7 +966,7 @@ void FurnaceGUI::setupSettingsCategories() { } }) }), - SettingsCategory(_("Configuration"),{},{ // these donn belond here... + SettingsCategory(_("Configuration"),{},{ SETTING(NULL,{ if (ImGui::Button(_("Import"))) { openFileDialog(GUI_FILE_IMPORT_CONFIG); @@ -991,7 +991,7 @@ void FurnaceGUI::setupSettingsCategories() { } }) }), -#ifndef IS_MOBILE +#ifdef IS_MOBILE SettingsCategory(_("Android"),{ SettingsCategory(_("Vibrator"),{},{ SETTING(_("Strength"),{ @@ -1022,7 +1022,225 @@ void FurnaceGUI::setupSettingsCategories() { },{}), SettingsCategory(_("Audio"),{ SettingsCategory(_("Output"),{},{ - +#if defined(HAVE_JACK) || defined(HAVE_PA) + SETTING(_("Backend"),{ + int prevAudioEngine=settings.audioEngine; + if (ImGui::BeginCombo(_("Backend"),audioBackends[settings.audioEngine])) { +#ifdef HAVE_JACK + if (ImGui::Selectable("JACK",settings.audioEngine==DIV_AUDIO_JACK)) { + settings.audioEngine=DIV_AUDIO_JACK; + SETTINGS_CHANGED; + } +#endif + if (ImGui::Selectable("SDL",settings.audioEngine==DIV_AUDIO_SDL)) { + settings.audioEngine=DIV_AUDIO_SDL; + SETTINGS_CHANGED; + } +#ifdef HAVE_PA + if (ImGui::Selectable("PortAudio",settings.audioEngine==DIV_AUDIO_PORTAUDIO)) { + settings.audioEngine=DIV_AUDIO_PORTAUDIO; + SETTINGS_CHANGED; + } +#endif + if (settings.audioEngine!=prevAudioEngine) { + audioEngineChanged=true; + settings.audioDevice=""; + settings.audioChans=2; + } + ImGui::EndCombo(); + } + }), +#endif + SETTING_COND(_("Driver"),{ + if (ImGui::BeginCombo(_("Driver"),settings.sdlAudioDriver.empty()?_("Automatic"):settings.sdlAudioDriver.c_str())) { + if (ImGui::Selectable(_("Automatic"),settings.sdlAudioDriver.empty())) { + settings.sdlAudioDriver=""; + SETTINGS_CHANGED; + } + for (String& i: availAudioDrivers) { + if (ImGui::Selectable(i.c_str(),i==settings.sdlAudioDriver)) { + settings.sdlAudioDriver=i; + SETTINGS_CHANGED; + } + } + ImGui::EndCombo(); + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect.")); + } + },settings.audioEngine==DIV_AUDIO_SDL), + SETTING(_("Device"),{ + if (audioEngineChanged) { + // ImGui::BeginDisabled(); + if (ImGui::BeginCombo(_("Device"),_(""))) { + ImGui::Text(_("ALERT - TRESPASSER DETECTED")); + if (ImGui::IsItemHovered()) { + showError(_("you have been arrested for trying to engage with a disabled combo box.")); + ImGui::CloseCurrentPopup(); + } + ImGui::EndCombo(); + } + // ImGui::EndDisabled(); + } else { + String audioDevName=settings.audioDevice.empty()?_(""):settings.audioDevice; + if (ImGui::BeginCombo(_("Device"),audioDevName.c_str())) { + if (ImGui::Selectable(_(""),settings.audioDevice.empty())) { + settings.audioDevice=""; + SETTINGS_CHANGED; + } + for (String& i: e->getAudioDevices()) { + if (ImGui::Selectable(i.c_str(),i==settings.audioDevice)) { + settings.audioDevice=i; + SETTINGS_CHANGED; + } + } + ImGui::EndCombo(); + } + } + }), + SETTING(_("Sample rate"),{ + String sr=fmt::sprintf("%d",settings.audioRate); + if (ImGui::BeginCombo(_("Sample rate"),sr.c_str())) { + SAMPLE_RATE_SELECTABLE(8000); + SAMPLE_RATE_SELECTABLE(16000); + SAMPLE_RATE_SELECTABLE(22050); + SAMPLE_RATE_SELECTABLE(32000); + SAMPLE_RATE_SELECTABLE(44100); + SAMPLE_RATE_SELECTABLE(48000); + SAMPLE_RATE_SELECTABLE(88200); + SAMPLE_RATE_SELECTABLE(96000); + SAMPLE_RATE_SELECTABLE(192000); + ImGui::EndCombo(); + } + }), + SETTING(_("Outputs"),{ + if (ImGui::InputInt(_("Outputs"),&settings.audioChans,1,2)) { + if (settings.audioChans<1) settings.audioChans=1; + if (settings.audioChans>16) settings.audioChans=16; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("common values:\n- 1 for mono\n- 2 for stereo")); + } + }), + SETTING(_("Buffer size"),{ + String bs=fmt::sprintf(_("%d (latency: ~%.1fms)"),settings.audioBufSize,2000.0*(double)settings.audioBufSize/(double)MAX(1,settings.audioRate)); + if (ImGui::BeginCombo(_("Buffer size"),bs.c_str())) { + BUFFER_SIZE_SELECTABLE(64); + BUFFER_SIZE_SELECTABLE(128); + BUFFER_SIZE_SELECTABLE(256); + BUFFER_SIZE_SELECTABLE(512); + BUFFER_SIZE_SELECTABLE(1024); + BUFFER_SIZE_SELECTABLE(2048); + ImGui::EndCombo(); + } + }), + SETTING(_("Multi-threaded (EXPERIMENTAL)"),{ + bool renderPoolThreadsB=(settings.renderPoolThreads>0); + if (ImGui::Checkbox(_("Multi-threaded (EXPERIMENTAL)"),&renderPoolThreadsB)) { + if (renderPoolThreadsB) { + settings.renderPoolThreads=2; + } else { + settings.renderPoolThreads=0; + } + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("runs chip emulation on separate threads.\nmay increase performance when using heavy emulation cores.\n\nwarnings:\n- experimental!\n- only useful on multi-chip songs.")); + } + }), + SETTING_COND(_("Number of threads"),{ + pushWarningColor(settings.renderPoolThreads>cpuCores,settings.renderPoolThreads>cpuCores); + if (ImGui::InputInt(_("Number of threads"),&settings.renderPoolThreads)) { + if (settings.renderPoolThreads<2) settings.renderPoolThreads=2; + if (settings.renderPoolThreads>32) settings.renderPoolThreads=32; + SETTINGS_CHANGED; + } + if (settings.renderPoolThreads>=DIV_MAX_CHIPS) { + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("that's the limit!")); + } + } else if (settings.renderPoolThreads>cpuCores) { + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("it is a VERY bad idea to set this number higher than your CPU core count (%d)!"),cpuCores); + } + } + popWarningColor(); + },settings.renderPoolThreads>0), + SETTING(_("Low-latency mode"),{ + bool lowLatencyB=settings.lowLatency; + if (ImGui::Checkbox(_("Low-latency mode"),&lowLatencyB)) { + settings.lowLatency=lowLatencyB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("reduces latency by running the engine faster than the tick rate.\nuseful for live playback/jam mode.\n\nwarning: only enable if your buffer size is small (10ms or less).")); + } + }), + SETTING(_("Force mono audio"),{ + bool forceMonoB=settings.forceMono; + if (ImGui::Checkbox(_("Force mono audio"),&forceMonoB)) { + settings.forceMono=forceMonoB; + SETTINGS_CHANGED; + } + }), + SETTING_COND(_("Exclusive mode"),{ + bool wasapiExB=settings.wasapiEx; + if (ImGui::Checkbox(_("Exclusive mode"),&wasapiExB)) { + settings.wasapiEx=wasapiExB; + SETTINGS_CHANGED; + } + },settings.audioEngine==DIV_AUDIO_PORTAUDIO && settings.audioDevice.find("[Windows WASAPI] ")==0), + SETTING(NULL,{ + TAAudioDesc& audioWant=e->getAudioDescWant(); + TAAudioDesc& audioGot=e->getAudioDescGot(); +#ifdef HAVE_LOCALE + ImGui::Text(ngettext("want: %d samples @ %.0fHz (%d channel)","want: %d samples @ %.0fHz (%d channels)",audioWant.outChans),audioWant.bufsize,audioWant.rate,audioWant.outChans); + ImGui::Text(ngettext("got: %d samples @ %.0fHz (%d channel)","got: %d samples @ %.0fHz (%d channels)",audioGot.outChans),audioGot.bufsize,audioGot.rate,audioGot.outChans); +#else + ImGui::Text(_GN("want: %d samples @ %.0fHz (%d channel)","want: %d samples @ %.0fHz (%d channels)",audioWant.outChans),audioWant.bufsize,audioWant.rate,audioWant.outChans); + ImGui::Text(_GN("got: %d samples @ %.0fHz (%d channel)","got: %d samples @ %.0fHz (%d channels)",audioGot.outChans),audioGot.bufsize,audioGot.rate,audioGot.outChans); +#endif + }), + }), + SettingsCategory(_("Mixing"),{},{ + SETTING(_("Quality"),{ + if (ImGui::Combo(_("Quality"),&settings.audioQuality,LocalizedComboGetter,audioQualities,2)) SETTINGS_CHANGED; + }), + SETTING(_("Software clipping"),{ + bool clampSamplesB=settings.clampSamples; + if (ImGui::Checkbox(_("Software clipping"),&clampSamplesB)) { + settings.clampSamples=clampSamplesB; + SETTINGS_CHANGED; + } + }), + SETTING(_("DC offset correction"),{ + bool audioHiPassB=settings.audioHiPass; + if (ImGui::Checkbox(_("DC offset correction"),&audioHiPassB)) { + settings.audioHiPass=audioHiPassB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Metronome"),{},{ + SETTING(_("Volume"),{ + if (ImGui::SliderInt(_("Volume##metr"),&settings.metroVol,0,200,"%d%%")) { + if (settings.metroVol<0) settings.metroVol=0; + if (settings.metroVol>200) settings.metroVol=200; + e->setMetronomeVol(((float)settings.metroVol)/100.0f); + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Sample preview"),{},{ + SETTING(_("Volume"),{ + if (ImGui::SliderInt(_("Volume##smpr"),&settings.sampleVol,0,100,"%d%%")) { + if (settings.sampleVol<0) settings.sampleVol=0; + if (settings.sampleVol>100) settings.sampleVol=100; + e->setSamplePreviewVol(((float)settings.sampleVol)/100.0f); + SETTINGS_CHANGED; + } + }) }) },{}) }; @@ -1351,266 +1569,7 @@ void FurnaceGUI::drawSettings() { END_SECTION; } - CONFIG_SECTION(_("Audio")) { - // SUBSECTION OUTPUT - CONFIG_SUBSECTION(_("Output")); - if (ImGui::BeginTable("##Output",2)) { - ImGui::TableSetupColumn("##Label",ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("##Combo",ImGuiTableColumnFlags_WidthStretch); -#if defined(HAVE_JACK) || defined(HAVE_PA) - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Backend")); - ImGui::TableNextColumn(); - int prevAudioEngine=settings.audioEngine; - if (ImGui::BeginCombo("##Backend",audioBackends[settings.audioEngine])) { -#ifdef HAVE_JACK - if (ImGui::Selectable("JACK",settings.audioEngine==DIV_AUDIO_JACK)) { - settings.audioEngine=DIV_AUDIO_JACK; - SETTINGS_CHANGED; - } -#endif - if (ImGui::Selectable("SDL",settings.audioEngine==DIV_AUDIO_SDL)) { - settings.audioEngine=DIV_AUDIO_SDL; - SETTINGS_CHANGED; - } -#ifdef HAVE_PA - if (ImGui::Selectable("PortAudio",settings.audioEngine==DIV_AUDIO_PORTAUDIO)) { - settings.audioEngine=DIV_AUDIO_PORTAUDIO; - SETTINGS_CHANGED; - } -#endif - if (settings.audioEngine!=prevAudioEngine) { - audioEngineChanged=true; - settings.audioDevice=""; - settings.audioChans=2; - } - ImGui::EndCombo(); - } -#endif - - if (settings.audioEngine==DIV_AUDIO_SDL) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Driver")); - ImGui::TableNextColumn(); - if (ImGui::BeginCombo("##SDLADriver",settings.sdlAudioDriver.empty()?_("Automatic"):settings.sdlAudioDriver.c_str())) { - if (ImGui::Selectable(_("Automatic"),settings.sdlAudioDriver.empty())) { - settings.sdlAudioDriver=""; - SETTINGS_CHANGED; - } - for (String& i: availAudioDrivers) { - if (ImGui::Selectable(i.c_str(),i==settings.sdlAudioDriver)) { - settings.sdlAudioDriver=i; - SETTINGS_CHANGED; - } - } - ImGui::EndCombo(); - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect.")); - } - } - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Device")); - ImGui::TableNextColumn(); - if (audioEngineChanged) { - ImGui::BeginDisabled(); - if (ImGui::BeginCombo("##AudioDevice",_(""))) { - ImGui::Text(_("ALERT - TRESPASSER DETECTED")); - if (ImGui::IsItemHovered()) { - showError(_("you have been arrested for trying to engage with a disabled combo box.")); - ImGui::CloseCurrentPopup(); - } - ImGui::EndCombo(); - } - ImGui::EndDisabled(); - } else { - String audioDevName=settings.audioDevice.empty()?_(""):settings.audioDevice; - if (ImGui::BeginCombo("##AudioDevice",audioDevName.c_str())) { - if (ImGui::Selectable(_(""),settings.audioDevice.empty())) { - settings.audioDevice=""; - SETTINGS_CHANGED; - } - for (String& i: e->getAudioDevices()) { - if (ImGui::Selectable(i.c_str(),i==settings.audioDevice)) { - settings.audioDevice=i; - SETTINGS_CHANGED; - } - } - ImGui::EndCombo(); - } - } - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Sample rate")); - ImGui::TableNextColumn(); - String sr=fmt::sprintf("%d",settings.audioRate); - if (ImGui::BeginCombo("##SampleRate",sr.c_str())) { - SAMPLE_RATE_SELECTABLE(8000); - SAMPLE_RATE_SELECTABLE(16000); - SAMPLE_RATE_SELECTABLE(22050); - SAMPLE_RATE_SELECTABLE(32000); - SAMPLE_RATE_SELECTABLE(44100); - SAMPLE_RATE_SELECTABLE(48000); - SAMPLE_RATE_SELECTABLE(88200); - SAMPLE_RATE_SELECTABLE(96000); - SAMPLE_RATE_SELECTABLE(192000); - ImGui::EndCombo(); - } - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Outputs")); - ImGui::TableNextColumn(); - if (ImGui::InputInt("##AudioChansI",&settings.audioChans,1,2)) { - if (settings.audioChans<1) settings.audioChans=1; - if (settings.audioChans>16) settings.audioChans=16; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("common values:\n- 1 for mono\n- 2 for stereo")); - } - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Buffer size")); - ImGui::TableNextColumn(); - String bs=fmt::sprintf(_("%d (latency: ~%.1fms)"),settings.audioBufSize,2000.0*(double)settings.audioBufSize/(double)MAX(1,settings.audioRate)); - if (ImGui::BeginCombo("##BufferSize",bs.c_str())) { - BUFFER_SIZE_SELECTABLE(64); - BUFFER_SIZE_SELECTABLE(128); - BUFFER_SIZE_SELECTABLE(256); - BUFFER_SIZE_SELECTABLE(512); - BUFFER_SIZE_SELECTABLE(1024); - BUFFER_SIZE_SELECTABLE(2048); - ImGui::EndCombo(); - } - ImGui::EndTable(); - } - - bool renderPoolThreadsB=(settings.renderPoolThreads>0); - if (ImGui::Checkbox(_("Multi-threaded (EXPERIMENTAL)"),&renderPoolThreadsB)) { - if (renderPoolThreadsB) { - settings.renderPoolThreads=2; - } else { - settings.renderPoolThreads=0; - } - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("runs chip emulation on separate threads.\nmay increase performance when using heavy emulation cores.\n\nwarnings:\n- experimental!\n- only useful on multi-chip songs.")); - } - - if (renderPoolThreadsB) { - pushWarningColor(settings.renderPoolThreads>cpuCores,settings.renderPoolThreads>cpuCores); - if (ImGui::InputInt(_("Number of threads"),&settings.renderPoolThreads)) { - if (settings.renderPoolThreads<2) settings.renderPoolThreads=2; - if (settings.renderPoolThreads>32) settings.renderPoolThreads=32; - SETTINGS_CHANGED; - } - if (settings.renderPoolThreads>=DIV_MAX_CHIPS) { - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("that's the limit!")); - } - } else if (settings.renderPoolThreads>cpuCores) { - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("it is a VERY bad idea to set this number higher than your CPU core count (%d)!"),cpuCores); - } - } - popWarningColor(); - } - - bool lowLatencyB=settings.lowLatency; - if (ImGui::Checkbox(_("Low-latency mode"),&lowLatencyB)) { - settings.lowLatency=lowLatencyB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("reduces latency by running the engine faster than the tick rate.\nuseful for live playback/jam mode.\n\nwarning: only enable if your buffer size is small (10ms or less).")); - } - - bool forceMonoB=settings.forceMono; - if (ImGui::Checkbox(_("Force mono audio"),&forceMonoB)) { - settings.forceMono=forceMonoB; - SETTINGS_CHANGED; - } - - if (settings.audioEngine==DIV_AUDIO_PORTAUDIO) { - if (settings.audioDevice.find("[Windows WASAPI] ")==0) { - bool wasapiExB=settings.wasapiEx; - if (ImGui::Checkbox(_("Exclusive mode"),&wasapiExB)) { - settings.wasapiEx=wasapiExB; - SETTINGS_CHANGED; - } - } - } - - TAAudioDesc& audioWant=e->getAudioDescWant(); - TAAudioDesc& audioGot=e->getAudioDescGot(); - -#ifdef HAVE_LOCALE - ImGui::Text(ngettext("want: %d samples @ %.0fHz (%d channel)","want: %d samples @ %.0fHz (%d channels)",audioWant.outChans),audioWant.bufsize,audioWant.rate,audioWant.outChans); - ImGui::Text(ngettext("got: %d samples @ %.0fHz (%d channel)","got: %d samples @ %.0fHz (%d channels)",audioGot.outChans),audioGot.bufsize,audioGot.rate,audioGot.outChans); -#else - ImGui::Text(_GN("want: %d samples @ %.0fHz (%d channel)","want: %d samples @ %.0fHz (%d channels)",audioWant.outChans),audioWant.bufsize,audioWant.rate,audioWant.outChans); - ImGui::Text(_GN("got: %d samples @ %.0fHz (%d channel)","got: %d samples @ %.0fHz (%d channels)",audioGot.outChans),audioGot.bufsize,audioGot.rate,audioGot.outChans); -#endif - - // SUBSECTION MIXING - CONFIG_SUBSECTION(_("Mixing")); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Quality")); - ImGui::SameLine(); - if (ImGui::Combo("##Quality",&settings.audioQuality,LocalizedComboGetter,audioQualities,2)) SETTINGS_CHANGED; - - bool clampSamplesB=settings.clampSamples; - if (ImGui::Checkbox(_("Software clipping"),&clampSamplesB)) { - settings.clampSamples=clampSamplesB; - SETTINGS_CHANGED; - } - - bool audioHiPassB=settings.audioHiPass; - if (ImGui::Checkbox(_("DC offset correction"),&audioHiPassB)) { - settings.audioHiPass=audioHiPassB; - SETTINGS_CHANGED; - } - - // SUBSECTION METRONOME - CONFIG_SUBSECTION(_("Metronome")); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Volume")); - ImGui::SameLine(); - if (ImGui::SliderInt("##MetroVol",&settings.metroVol,0,200,"%d%%")) { - if (settings.metroVol<0) settings.metroVol=0; - if (settings.metroVol>200) settings.metroVol=200; - e->setMetronomeVol(((float)settings.metroVol)/100.0f); - SETTINGS_CHANGED; - } - - // SUBSECTION SAMPLE PREVIEW - CONFIG_SUBSECTION(_("Sample preview")); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Volume")); - ImGui::SameLine(); - if (ImGui::SliderInt("##SampleVol",&settings.sampleVol,0,100,"%d%%")) { - if (settings.sampleVol<0) settings.sampleVol=0; - if (settings.sampleVol>100) settings.sampleVol=100; - e->setSamplePreviewVol(((float)settings.sampleVol)/100.0f); - SETTINGS_CHANGED; - } - - END_SECTION; - } CONFIG_SECTION(_("MIDI")) { // SUBSECTION MIDI INPUT CONFIG_SUBSECTION(_("MIDI input")); From 44305530d4c2d573ef6e2c8793b98216a18364da Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Tue, 12 Nov 2024 22:02:44 +0400 Subject: [PATCH 35/61] half of midi input --- src/gui/gui.h | 2 + src/gui/settings.cpp | 185 +++++++++++++++++++++++++------------------ 2 files changed, 109 insertions(+), 78 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 971b53a808..c647e19316 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2990,6 +2990,8 @@ class FurnaceGUI { void drawSettingsCategory(SettingsCategory* cat); void searchDrawSettingItems(SettingsCategory* cat); void drawSettingsItems(); + // settings helper functions (made part of FurnaceGUI to be able to pass to lambdas) + String stripName(String what); void syncSettings(); void commitSettings(); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 6c1bdfcd8d..2d03b53d44 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -1242,7 +1242,111 @@ void FurnaceGUI::setupSettingsCategories() { } }) }) - },{}) + },{}), + SettingsCategory(_("MIDI"),{ + SettingsCategory(_("MIDI input"),{},{ + SETTING(_("MIDI input"),{ + String midiInName=settings.midiInDevice.empty()?_(""):settings.midiInDevice; + bool hasToReloadMidi=false; + if (ImGui::BeginCombo("##MidiInDevice",midiInName.c_str())) { + if (ImGui::Selectable(_(""),settings.midiInDevice.empty())) { + settings.midiInDevice=""; + hasToReloadMidi=true; + SETTINGS_CHANGED; + } + for (String& i: e->getMidiIns()) { + if (ImGui::Selectable(i.c_str(),i==settings.midiInDevice)) { + settings.midiInDevice=i; + hasToReloadMidi=true; + SETTINGS_CHANGED; + } + } + ImGui::EndCombo(); + } + + ImGui::SameLine(); + if (ImGui::Button(_("Re-scan MIDI devices"))) { + e->rescanMidiDevices(); + audioEngineChanged=true; + settingsChanged=false; + } + + if (hasToReloadMidi) { + midiMap.read(e->getConfigPath()+DIR_SEPARATOR_STR+"midiIn_"+stripName(settings.midiInDevice)+".cfg"); + midiMap.compile(); + } + }), + SETTING(_("Note input"),{ + if (ImGui::Checkbox(_("Note input"),&midiMap.noteInput)) SETTINGS_CHANGED; + }), + SETTING(_("Velocity input"),{ + if (ImGui::Checkbox(_("Velocity input"),&midiMap.volInput)) SETTINGS_CHANGED; + }), + // TODO + //ImGui::Checkbox(_("Use raw velocity value (don't map from linear to log)"),&midiMap.rawVolume); + //ImGui::Checkbox(_("Polyphonic/chord input"),&midiMap.polyInput); + // then convert to new new settings + SETTING(_("Map MIDI channels to direct channels"),{ + if (ImGui::Checkbox(_("Map MIDI channels to direct channels"),&midiMap.directChannel)) { + e->setMidiDirect(midiMap.directChannel); + e->setMidiDirectProgram(midiMap.directChannel && midiMap.directProgram); + SETTINGS_CHANGED; + } + }), + SETTING_COND(_("Program change pass-through"),{ + if (ImGui::Checkbox(_("Program change pass-through"),&midiMap.directProgram)) { + e->setMidiDirectProgram(midiMap.directChannel && midiMap.directProgram); + SETTINGS_CHANGED; + } + },midiMap.directChannel), + SETTING(_("Map Yamaha FM voice data to instruments"),{ + if (ImGui::Checkbox(_("Map Yamaha FM voice data to instruments"),&midiMap.yamahaFMResponse)) SETTINGS_CHANGED; + }), + SETTING_COND(_("Program change is instrument selection"),{ + if (ImGui::Checkbox(_("Program change is instrument selection"),&midiMap.programChange)) SETTINGS_CHANGED; + },!(midiMap.directChannel && midiMap.directProgram)), + //ImGui::Checkbox(_("Listen to MIDI clock"),&midiMap.midiClock); + //ImGui::Checkbox(_("Listen to MIDI time code"),&midiMap.midiTimeCode); + SETTING(_("Value input style"),{ + if (ImGui::Combo(_("Value input style"),&midiMap.valueInputStyle,LocalizedComboGetter,valueInputStyles,7)) SETTINGS_CHANGED; + }), + SETTING_COND(_("Control##valueCCS"),{ + if (ImGui::InputInt(_("Control##valueCCS"),&midiMap.valueInputControlSingle,1,16)) { + if (midiMap.valueInputControlSingle<0) midiMap.valueInputControlSingle=0; + if (midiMap.valueInputControlSingle>127) midiMap.valueInputControlSingle=127; + SETTINGS_CHANGED; + } + },midiMap.valueInputStyle==6), + SETTING_COND(_("CC of upper nibble##valueCC1"),{ + if (ImGui::InputInt(_("CC of upper nibble##valueCC1"),&midiMap.valueInputControlMSB,1,16)) { + if (midiMap.valueInputControlMSB<0) midiMap.valueInputControlMSB=0; + if (midiMap.valueInputControlMSB>127) midiMap.valueInputControlMSB=127; + SETTINGS_CHANGED; + } + },midiMap.valueInputStyle==4), + SETTING_COND(_("MSB CC##valueCC1"),{ + if (ImGui::InputInt(_("MSB CC##valueCC1"),&midiMap.valueInputControlMSB,1,16)) { + if (midiMap.valueInputControlMSB<0) midiMap.valueInputControlMSB=0; + if (midiMap.valueInputControlMSB>127) midiMap.valueInputControlMSB=127; + SETTINGS_CHANGED; + } + },midiMap.valueInputStyle==5), + SETTING_COND(_("CC of lower nibble##valueCC2"),{ + if (ImGui::InputInt(_("CC of lower nibble##valueCC2"),&midiMap.valueInputControlLSB,1,16)) { + if (midiMap.valueInputControlLSB<0) midiMap.valueInputControlLSB=0; + if (midiMap.valueInputControlLSB>127) midiMap.valueInputControlLSB=127; + SETTINGS_CHANGED; + } + },midiMap.valueInputStyle==4), + SETTING_COND(_("LSB CC##valueCC2"),{ + if (ImGui::InputInt(_("LSB CC##valueCC2"),&midiMap.valueInputControlLSB,1,16)) { + if (midiMap.valueInputControlLSB<0) midiMap.valueInputControlLSB=0; + if (midiMap.valueInputControlLSB>127) midiMap.valueInputControlLSB=127; + SETTINGS_CHANGED; + } + },midiMap.valueInputStyle==5), + }) + },{}), }; settings.activeCategory=settings.categories[0]; @@ -1318,7 +1422,7 @@ void FurnaceGUI::drawSettingsItems() { } } -String stripName(String what) { +String FurnaceGUI::stripName(String what) { String ret; for (char& i: what) { if ((i>='A' && i<='Z') || (i>='a' && i<='z') || (i>='0' && i<='9')) { @@ -1572,83 +1676,8 @@ void FurnaceGUI::drawSettings() { CONFIG_SECTION(_("MIDI")) { // SUBSECTION MIDI INPUT - CONFIG_SUBSECTION(_("MIDI input")); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("MIDI input")); - ImGui::SameLine(); - String midiInName=settings.midiInDevice.empty()?_(""):settings.midiInDevice; - bool hasToReloadMidi=false; - if (ImGui::BeginCombo("##MidiInDevice",midiInName.c_str())) { - if (ImGui::Selectable(_(""),settings.midiInDevice.empty())) { - settings.midiInDevice=""; - hasToReloadMidi=true; - SETTINGS_CHANGED; - } - for (String& i: e->getMidiIns()) { - if (ImGui::Selectable(i.c_str(),i==settings.midiInDevice)) { - settings.midiInDevice=i; - hasToReloadMidi=true; - SETTINGS_CHANGED; - } - } - ImGui::EndCombo(); - } - - ImGui::SameLine(); - if (ImGui::Button(_("Re-scan MIDI devices"))) { - e->rescanMidiDevices(); - audioEngineChanged=true; - settingsChanged=false; - } - - if (hasToReloadMidi) { - midiMap.read(e->getConfigPath()+DIR_SEPARATOR_STR+"midiIn_"+stripName(settings.midiInDevice)+".cfg"); - midiMap.compile(); - } + - if (ImGui::Checkbox(_("Note input"),&midiMap.noteInput)) SETTINGS_CHANGED; - if (ImGui::Checkbox(_("Velocity input"),&midiMap.volInput)) SETTINGS_CHANGED; - // TODO - //ImGui::Checkbox(_("Use raw velocity value (don't map from linear to log)"),&midiMap.rawVolume); - //ImGui::Checkbox(_("Polyphonic/chord input"),&midiMap.polyInput); - if (ImGui::Checkbox(_("Map MIDI channels to direct channels"),&midiMap.directChannel)) { - e->setMidiDirect(midiMap.directChannel); - e->setMidiDirectProgram(midiMap.directChannel && midiMap.directProgram); - SETTINGS_CHANGED; - } - if (midiMap.directChannel) { - if (ImGui::Checkbox(_("Program change pass-through"),&midiMap.directProgram)) { - e->setMidiDirectProgram(midiMap.directChannel && midiMap.directProgram); - SETTINGS_CHANGED; - } - } - if (ImGui::Checkbox(_("Map Yamaha FM voice data to instruments"),&midiMap.yamahaFMResponse)) SETTINGS_CHANGED; - if (!(midiMap.directChannel && midiMap.directProgram)) { - if (ImGui::Checkbox(_("Program change is instrument selection"),&midiMap.programChange)) SETTINGS_CHANGED; - } - //ImGui::Checkbox(_("Listen to MIDI clock"),&midiMap.midiClock); - //ImGui::Checkbox(_("Listen to MIDI time code"),&midiMap.midiTimeCode); - if (ImGui::Combo(_("Value input style"),&midiMap.valueInputStyle,LocalizedComboGetter,valueInputStyles,7)) SETTINGS_CHANGED; - if (midiMap.valueInputStyle>3) { - if (midiMap.valueInputStyle==6) { - if (ImGui::InputInt(_("Control##valueCCS"),&midiMap.valueInputControlSingle,1,16)) { - if (midiMap.valueInputControlSingle<0) midiMap.valueInputControlSingle=0; - if (midiMap.valueInputControlSingle>127) midiMap.valueInputControlSingle=127; - SETTINGS_CHANGED; - } - } else { - if (ImGui::InputInt((midiMap.valueInputStyle==4)?_("CC of upper nibble##valueCC1"):_("MSB CC##valueCC1"),&midiMap.valueInputControlMSB,1,16)) { - if (midiMap.valueInputControlMSB<0) midiMap.valueInputControlMSB=0; - if (midiMap.valueInputControlMSB>127) midiMap.valueInputControlMSB=127; - SETTINGS_CHANGED; - } - if (ImGui::InputInt((midiMap.valueInputStyle==4)?_("CC of lower nibble##valueCC2"):_("LSB CC##valueCC2"),&midiMap.valueInputControlLSB,1,16)) { - if (midiMap.valueInputControlLSB<0) midiMap.valueInputControlLSB=0; - if (midiMap.valueInputControlLSB>127) midiMap.valueInputControlLSB=127; - SETTINGS_CHANGED; - } - } - } if (ImGui::TreeNode(_("Per-column control change"))) { for (int i=0; i<18; i++) { ImGui::PushID(i); From 73316320368b18fabcdbae6a3c4841ee9537e28e Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 13 Nov 2024 18:46:59 +0400 Subject: [PATCH 36/61] settings: midi specific ctrls --- src/gui/settings.cpp | 121 +++++++++++++++++++++++++++---------------- 1 file changed, 77 insertions(+), 44 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index f24e355dd1..1d5ab60c28 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -349,11 +349,48 @@ const char* specificControls[18]={ if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) SETTINGS_CHANGED; #define SETTING(n,f) new Setting(n,[this]f) + #define SETTING_COND(n,f,c) new Setting(n,[this]f,[this]{return c;}) + +#define SETTING_SEPARATOR() new Setting(NULL,[]{ImGui::Separator();}) + #define SETTINGS_CHANGED settingsChanged=true + +#define MIDI_SPECIFIC_CONTROL(i) \ + SETTING(specificControls[i],{ \ + ImGui::PushID(i); \ + if (ImGui::Combo(specificControls[i],&midiMap.valueInputSpecificStyle[i],LocalizedComboGetter,valueSInputStyles,4)) SETTINGS_CHANGED; \ + ImGui::PopID(); \ + }), \ + SETTING_COND(_("Control##valueCCS"),{ \ + ImGui::PushID(i); \ + ImGui::Indent(); \ + if (ImGui::InputInt(_("Control##valueCCS"),&midiMap.valueInputSpecificSingle[i],1,16)) { \ + if (midiMap.valueInputSpecificSingle[i]<0) midiMap.valueInputSpecificSingle[i]=0; \ + if (midiMap.valueInputSpecificSingle[i]>127) midiMap.valueInputSpecificSingle[i]=127; \ + SETTINGS_CHANGED; \ + } \ + ImGui::Unindent(); \ + ImGui::PopID(); \ + },midiMap.valueInputSpecificStyle[i]==3), \ + SETTING_COND(_("Control##valueCCS"),{ \ + ImGui::PushID(i); \ + ImGui::Indent(); \ + if (ImGui::InputInt(_("MSB CC##valueCC1"),&midiMap.valueInputSpecificMSB[i],1,16)) { \ + if (midiMap.valueInputSpecificMSB[i]<0) midiMap.valueInputSpecificMSB[i]=0; \ + if (midiMap.valueInputSpecificMSB[i]>127) midiMap.valueInputSpecificMSB[i]=127; \ + SETTINGS_CHANGED; \ + } \ + if (ImGui::InputInt(_("LSB CC##valueCC2"),&midiMap.valueInputSpecificLSB[i],1,16)) { \ + if (midiMap.valueInputSpecificLSB[i]<0) midiMap.valueInputSpecificLSB[i]=0; \ + if (midiMap.valueInputSpecificLSB[i]>127) midiMap.valueInputSpecificLSB[i]=127; \ + SETTINGS_CHANGED; \ + } \ + ImGui::Unindent(); \ + ImGui::PopID(); \ + },(midiMap.valueInputSpecificStyle[i]>0) && (midiMap.valueInputSpecificStyle[i]!=3)) \ + // NEW NEW SETTINGS HERE - int a=0; - const char* t[2]={"1","2"}; void FurnaceGUI::setupSettingsCategories() { settings.categories={ SettingsCategory(_("General"),{ @@ -1244,7 +1281,28 @@ void FurnaceGUI::setupSettingsCategories() { }) },{}), SettingsCategory(_("MIDI"),{ - SettingsCategory(_("MIDI input"),{},{ + SettingsCategory(_("MIDI input"),{ + SettingsCategory(_("Per-column control change"),{},{ + MIDI_SPECIFIC_CONTROL(0), + MIDI_SPECIFIC_CONTROL(1), + MIDI_SPECIFIC_CONTROL(2), + MIDI_SPECIFIC_CONTROL(3), + MIDI_SPECIFIC_CONTROL(4), + MIDI_SPECIFIC_CONTROL(5), + MIDI_SPECIFIC_CONTROL(6), + MIDI_SPECIFIC_CONTROL(7), + MIDI_SPECIFIC_CONTROL(8), + MIDI_SPECIFIC_CONTROL(9), + MIDI_SPECIFIC_CONTROL(10), + MIDI_SPECIFIC_CONTROL(11), + MIDI_SPECIFIC_CONTROL(12), + MIDI_SPECIFIC_CONTROL(13), + MIDI_SPECIFIC_CONTROL(14), + MIDI_SPECIFIC_CONTROL(15), + MIDI_SPECIFIC_CONTROL(16), + MIDI_SPECIFIC_CONTROL(17), + }) + },{ SETTING(_("MIDI input"),{ String midiInName=settings.midiInDevice.empty()?_(""):settings.midiInDevice; bool hasToReloadMidi=false; @@ -1345,6 +1403,20 @@ void FurnaceGUI::setupSettingsCategories() { SETTINGS_CHANGED; } },midiMap.valueInputStyle==5), + SETTING_SEPARATOR(), + SETTING(_("Volume curve"),{ + if (ImGui::SliderFloat(_("Volume curve"),&midiMap.volExp,0.01,8.0,"%.2f")) { + if (midiMap.volExp<0.01) midiMap.volExp=0.01; + if (midiMap.volExp>8.0) midiMap.volExp=8.0; + e->setMidiVolExp(midiMap.volExp); + SETTINGS_CHANGED; + } rightClickable + float curve[128]; + for (int i=0; i<128; i++) { + curve[i]=(int)(pow((double)i/127.0,midiMap.volExp)*127.0); + } + ImGui::PlotLines("##VolCurveDisplay",curve,128,0,_("Volume curve"),0.0,127.0,ImVec2(200.0f*dpiScale,200.0f*dpiScale)); + }), }) },{}), }; @@ -1678,47 +1750,8 @@ void FurnaceGUI::drawSettings() { // SUBSECTION MIDI INPUT - if (ImGui::TreeNode(_("Per-column control change"))) { - for (int i=0; i<18; i++) { - ImGui::PushID(i); - if (ImGui::Combo(specificControls[i],&midiMap.valueInputSpecificStyle[i],LocalizedComboGetter,valueSInputStyles,4)) SETTINGS_CHANGED; - if (midiMap.valueInputSpecificStyle[i]>0) { - ImGui::Indent(); - if (midiMap.valueInputSpecificStyle[i]==3) { - if (ImGui::InputInt(_("Control##valueCCS"),&midiMap.valueInputSpecificSingle[i],1,16)) { - if (midiMap.valueInputSpecificSingle[i]<0) midiMap.valueInputSpecificSingle[i]=0; - if (midiMap.valueInputSpecificSingle[i]>127) midiMap.valueInputSpecificSingle[i]=127; - SETTINGS_CHANGED; - } - } else { - if (ImGui::InputInt((midiMap.valueInputSpecificStyle[i]==4)?_("CC of upper nibble##valueCC1"):_("MSB CC##valueCC1"),&midiMap.valueInputSpecificMSB[i],1,16)) { - if (midiMap.valueInputSpecificMSB[i]<0) midiMap.valueInputSpecificMSB[i]=0; - if (midiMap.valueInputSpecificMSB[i]>127) midiMap.valueInputSpecificMSB[i]=127; - SETTINGS_CHANGED; - } - if (ImGui::InputInt((midiMap.valueInputSpecificStyle[i]==4)?_("CC of lower nibble##valueCC2"):_("LSB CC##valueCC2"),&midiMap.valueInputSpecificLSB[i],1,16)) { - if (midiMap.valueInputSpecificLSB[i]<0) midiMap.valueInputSpecificLSB[i]=0; - if (midiMap.valueInputSpecificLSB[i]>127) midiMap.valueInputSpecificLSB[i]=127; - SETTINGS_CHANGED; - } - } - ImGui::Unindent(); - } - ImGui::PopID(); - } - ImGui::TreePop(); - } - if (ImGui::SliderFloat(_("Volume curve"),&midiMap.volExp,0.01,8.0,"%.2f")) { - if (midiMap.volExp<0.01) midiMap.volExp=0.01; - if (midiMap.volExp>8.0) midiMap.volExp=8.0; - e->setMidiVolExp(midiMap.volExp); - SETTINGS_CHANGED; - } rightClickable - float curve[128]; - for (int i=0; i<128; i++) { - curve[i]=(int)(pow((double)i/127.0,midiMap.volExp)*127.0); - } - ImGui::PlotLines("##VolCurveDisplay",curve,128,0,_("Volume curve"),0.0,127.0,ImVec2(200.0f*dpiScale,200.0f*dpiScale)); + + ImGui::AlignTextToFramePadding(); ImGui::Text(_("Actions:")); From a2301c44041547d2e2d2c4ecaab64f79f7d4982b Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 13 Nov 2024 20:21:30 +0400 Subject: [PATCH 37/61] settings: midi input actions, midi output, emulation, search box outside of child --- src/gui/settings.cpp | 924 +++++++++++++++++-------------------------- 1 file changed, 371 insertions(+), 553 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 1d5ab60c28..c9475dfb36 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -336,18 +336,6 @@ const char* specificControls[18]={ ImGui::EndChild(); \ ImGui::EndTabItem(); -#define CORE_QUALITY(_name,_play,_render) \ - ImGui::TableNextRow(); \ - ImGui::TableNextColumn(); \ - ImGui::AlignTextToFramePadding(); \ - ImGui::Text(_name); \ - ImGui::TableNextColumn(); \ - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \ - if (ImGui::Combo("##" _name "Q",&settings._play,LocalizedComboGetter,coreQualities,6)) SETTINGS_CHANGED; \ - ImGui::TableNextColumn(); \ - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \ - if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) SETTINGS_CHANGED; - #define SETTING(n,f) new Setting(n,[this]f) #define SETTING_COND(n,f,c) new Setting(n,[this]f,[this]{return c;}) @@ -390,6 +378,48 @@ const char* specificControls[18]={ ImGui::PopID(); \ },(midiMap.valueInputSpecificStyle[i]>0) && (midiMap.valueInputSpecificStyle[i]!=3)) \ +#define EMU_CORES(sysL,setC,setCR,arr) \ + SETTING(sysL,{ \ + const float comboSize=ImGui::GetContentRegionAvail().x/2.0-ImGui::CalcTextSize("AVGPNL").x; /* average part number length*/ \ + if (ImGui::BeginTable("##" sysL "Cores", 3)) { \ + ImGui::TableSetupColumn("##sys",ImGuiTableColumnFlags_WidthStretch); \ + ImGui::TableSetupColumn("##core",ImGuiTableColumnFlags_WidthFixed); \ + ImGui::TableSetupColumn("##coreRend",ImGuiTableColumnFlags_WidthFixed); \ + ImGui::TableNextRow(); \ + ImGui::TableNextColumn(); \ + ImGui::AlignTextToFramePadding(); \ + ImGui::ScrollText(ImGui::GetID(sysL),sysL,ImGui::GetCursorScreenPos()); \ + ImGui::TableNextColumn(); \ + ImGui::SetNextItemWidth(comboSize); \ + if (ImGui::Combo("##" sysL "C",&setC,arr,sizeof(arr)/sizeof(const char*))) SETTINGS_CHANGED; \ + ImGui::TableNextColumn(); \ + ImGui::SetNextItemWidth(comboSize); \ + if (ImGui::Combo("##" sysL "CR",&setCR,arr,sizeof(arr)/sizeof(const char*))) SETTINGS_CHANGED; \ + ImGui::EndTable(); \ + } \ + }) + +#define CORE_QUALITY(_name,_play,_render) \ + SETTING(_name,{ \ + const float comboSize=ImGui::GetContentRegionAvail().x/2.0-ImGui::CalcTextSize("averagsysname").x; /* average system name*/ \ + if (ImGui::BeginTable("##" _name "Cores", 3)) { \ + ImGui::TableSetupColumn("##sys",ImGuiTableColumnFlags_WidthStretch); \ + ImGui::TableSetupColumn("##core",ImGuiTableColumnFlags_WidthFixed); \ + ImGui::TableSetupColumn("##coreRend",ImGuiTableColumnFlags_WidthFixed); \ + ImGui::TableNextRow(); \ + ImGui::TableNextColumn(); \ + ImGui::AlignTextToFramePadding(); \ + ImGui::ScrollText(ImGui::GetID(_name),_name,ImGui::GetCursorScreenPos()); \ + ImGui::TableNextColumn(); \ + ImGui::SetNextItemWidth(comboSize); \ + if (ImGui::Combo("##" _name "Q",&settings._play,LocalizedComboGetter,coreQualities,6)) SETTINGS_CHANGED; \ + ImGui::TableNextColumn(); \ + ImGui::SetNextItemWidth(comboSize); \ + if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) SETTINGS_CHANGED; \ + ImGui::EndTable(); \ + } \ + }) + // NEW NEW SETTINGS HERE void FurnaceGUI::setupSettingsCategories() { settings.categories={ @@ -1417,8 +1447,336 @@ void FurnaceGUI::setupSettingsCategories() { } ImGui::PlotLines("##VolCurveDisplay",curve,128,0,_("Volume curve"),0.0,127.0,ImVec2(200.0f*dpiScale,200.0f*dpiScale)); }), + SETTING(_("Actions:"),{ + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("Actions:")); + ImGui::SameLine(); + if (ImGui::Button(ICON_FA_PLUS "##AddAction")) { + midiMap.binds.push_back(MIDIBind()); + SETTINGS_CHANGED; + } + ImGui::SameLine(); + if (ImGui::Button(ICON_FA_EXTERNAL_LINK "##AddLearnAction")) { + midiMap.binds.push_back(MIDIBind()); + learning=midiMap.binds.size()-1; + SETTINGS_CHANGED; + } + if (learning!=-1) { + ImGui::SameLine(); + ImGui::Text(_("(learning! press a button or move a slider/knob/something on your device.)")); + } + + if (ImGui::BeginTable("MIDIActions",7)) { + ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,0.2); + ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.1); + ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.3); + ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch,0.2); + ImGui::TableSetupColumn("c4",ImGuiTableColumnFlags_WidthStretch,0.5); + ImGui::TableSetupColumn("c5",ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("c6",ImGuiTableColumnFlags_WidthFixed); + + ImGui::TableNextRow(ImGuiTableRowFlags_Headers); + ImGui::TableNextColumn(); + ImGui::Text(_("Type")); + ImGui::TableNextColumn(); + ImGui::Text(_("Channel")); + ImGui::TableNextColumn(); + ImGui::Text(_("Note/Control")); + ImGui::TableNextColumn(); + ImGui::Text(_("Velocity/Value")); + ImGui::TableNextColumn(); + ImGui::Text(_("Action")); + ImGui::TableNextColumn(); + ImGui::TableNextColumn(); + + for (size_t i=0; i0 && (bind.data1+60)<180) { + nName=noteNames[bind.data1+60]; + } + snprintf(bindID,1024,"%d (0x%.2X, %s)",bind.data1,bind.data1,nName); + } + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("##BValue1",bindID)) { + if (ImGui::Selectable(_("Any"),bind.data1==128)) { + bind.data1=128; + SETTINGS_CHANGED; + } + for (int j=0; j<128; j++) { + const char* nName="???"; + if ((j+60)>0 && (j+60)<180) { + nName=noteNames[j+60]; + } + snprintf(bindID,1024,"%d (0x%.2X, %s)##BV1_%d",j,j,nName,j); + if (ImGui::Selectable(bindID,bind.data1==j)) { + bind.data1=j; + SETTINGS_CHANGED; + } + } + ImGui::EndCombo(); + } + + ImGui::TableNextColumn(); + if (bind.data2==128) { + snprintf(bindID,1024,_("Any")); + } else { + snprintf(bindID,1024,"%d (0x%.2X)",bind.data2,bind.data2); + } + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("##BValue2",bindID)) { + if (ImGui::Selectable(_("Any"),bind.data2==128)) { + bind.data2=128; + SETTINGS_CHANGED; + } + for (int j=0; j<128; j++) { + snprintf(bindID,1024,"%d (0x%.2X)##BV2_%d",j,j,j); + if (ImGui::Selectable(bindID,bind.data2==j)) { + bind.data2=j; + SETTINGS_CHANGED; + } + } + ImGui::EndCombo(); + } + + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::BeginCombo("##BAction",(bind.action==0)?_("--none--"):guiActions[bind.action].friendlyName)) { + if (ImGui::Selectable(_("--none--"),bind.action==0)) { + bind.action=0; + SETTINGS_CHANGED; + } + for (int j=0; j"):settings.midiOutDevice; + if (ImGui::BeginCombo(_("MIDI output"),midiOutName.c_str())) { + if (ImGui::Selectable(_(""),settings.midiOutDevice.empty())) { + settings.midiOutDevice=""; + SETTINGS_CHANGED; + } + for (String& i: e->getMidiIns()) { + if (ImGui::Selectable(i.c_str(),i==settings.midiOutDevice)) { + settings.midiOutDevice=i; + SETTINGS_CHANGED; + } + } + ImGui::EndCombo(); + } + }), + SETTING(_("Output mode:"),{ + ImGui::Text(_("Output mode:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Off (use for TX81Z)"),settings.midiOutMode==0)) { + settings.midiOutMode=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Melodic"),settings.midiOutMode==1)) { + settings.midiOutMode=1; + SETTINGS_CHANGED; + } + /* + if (ImGui::RadioButton(_("Light Show (use for Launchpad)"),settings.midiOutMode==2)) { + settings.midiOutMode=2; + SETTINGS_CHANGED; + }*/ + ImGui::Unindent(); + }), + SETTING(_("Send Program Change"),{ + bool midiOutProgramChangeB=settings.midiOutProgramChange; + if (ImGui::Checkbox(_("Send Program Change"),&midiOutProgramChangeB)) { + settings.midiOutProgramChange=midiOutProgramChangeB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Send MIDI clock"),{ + bool midiOutClockB=settings.midiOutClock; + if (ImGui::Checkbox(_("Send MIDI clock"),&midiOutClockB)) { + settings.midiOutClock=midiOutClockB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Send MIDI timecode"),{ + bool midiOutTimeB=settings.midiOutTime; + if (ImGui::Checkbox(_("Send MIDI timecode"),&midiOutTimeB)) { + settings.midiOutTime=midiOutTimeB; + SETTINGS_CHANGED; + } + }), + SETTING_COND(_("Timecode frame rate:"),{ + ImGui::Text(_("Timecode frame rate:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Closest to Tick Rate"),settings.midiOutTimeRate==0)) { + settings.midiOutTimeRate=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Film (24fps)"),settings.midiOutTimeRate==1)) { + settings.midiOutTimeRate=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("PAL (25fps)"),settings.midiOutTimeRate==2)) { + settings.midiOutTimeRate=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("NTSC drop (29.97fps)"),settings.midiOutTimeRate==3)) { + settings.midiOutTimeRate=3; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("NTSC non-drop (30fps)"),settings.midiOutTimeRate==4)) { + settings.midiOutTimeRate=4; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + },settings.midiOutTime) }) },{}), + SettingsCategory(_("Emulation"),{ + SettingsCategory(_("Cores"),{},{ + EMU_CORES("YM2151", settings.arcadeCore, settings.arcadeCoreRender, arcadeCores), + EMU_CORES("YM2612", settings.ym2612Core, settings.ym2612CoreRender, ym2612Cores), + EMU_CORES("SN76489", settings.snCore, settings.snCoreRender, snCores), + EMU_CORES("NES", settings.nesCore, settings.nesCoreRender, nesCores), + EMU_CORES("FDS", settings.fdsCore, settings.fdsCoreRender, nesCores), + EMU_CORES("SID", settings.c64Core, settings.c64CoreRender, c64Cores), + EMU_CORES("POKEY", settings.pokeyCore, settings.pokeyCoreRender, pokeyCores), + EMU_CORES("OPN", settings.opn1Core, settings.opn1CoreRender, opnCores), + EMU_CORES("OPNA", settings.opnaCore, settings.opnaCoreRender, opnCores), + EMU_CORES("OPNB", settings.opnbCore, settings.opnbCoreRender, opnCores), + EMU_CORES("OPL/OPL2/Y8950", settings.opl2Core, settings.opl2Core, opl2Cores), + EMU_CORES("OPL3", settings.opl3Core, settings.opl3CoreRender, opl3Cores), + EMU_CORES("OPL4", settings.opl4Core, settings.opl4CoreRender, opl4Cores), + EMU_CORES("ESFM", settings.esfmCore, settings.esfmCoreRender, esfmCores), + EMU_CORES("OPLL", settings.opllCore, settings.opllCoreRender, opllCores), + EMU_CORES("AY-3-8910/SSG", settings.ayCore, settings.ayCoreRender, ayCores), + }), + SettingsCategory(_("Quality"),{},{ + CORE_QUALITY("Bubble System WSG",bubsysQuality,bubsysQualityRender), + CORE_QUALITY("Game Boy",gbQuality,gbQualityRender), + CORE_QUALITY("Nintendo DS",ndsQuality,ndsQualityRender), + CORE_QUALITY("PC Engine",pceQuality,pceQualityRender), + CORE_QUALITY("PowerNoise",pnQuality,pnQualityRender), + CORE_QUALITY("SAA1099",saaQuality,saaQualityRender), + CORE_QUALITY("SCC",sccQuality,sccQualityRender), + CORE_QUALITY("SID (dSID)",dsidQuality,dsidQualityRender), + CORE_QUALITY("SM8521",smQuality,smQualityRender), + CORE_QUALITY("Virtual Boy",vbQuality,vbQualityRender), + CORE_QUALITY("WonderSwan",swanQuality,swanQualityRender), + }), + SettingsCategory(_("Other"),{},{ + SETTING(_("PC Speaker strategy"),{ + if (ImGui::Combo(_("PC Speaker strategy"),&settings.pcSpeakerOutMethod,LocalizedComboGetter,pcspkrOutMethods,5)) SETTINGS_CHANGED; + }), + SETTING(NULL,{ // subsection? + ImGui::Separator(); + ImGui::Text(_("Sample ROMs:")); + }), + SETTING(_("OPL4 YRW801 path"),{ + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("OPL4 YRW801 path")); + ImGui::SameLine(); + ImGui::InputText("##YRW801Path",&settings.yrw801Path); + ImGui::SameLine(); + if (ImGui::Button(ICON_FA_FOLDER "##YRW801Load")) { + openFileDialog(GUI_FILE_YRW801_ROM_OPEN); + } + }) + /* + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("MultiPCM TG100 path")); + ImGui::SameLine(); + ImGui::InputText("##TG100Path",&settings.tg100Path); + ImGui::SameLine(); + if (ImGui::Button(ICON_FA_FOLDER "##TG100Load")) { + openFileDialog(GUI_FILE_TG100_ROM_OPEN); + } + + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("MultiPCM MU5 path")); + ImGui::SameLine(); + ImGui::InputText("##MU5Path",&settings.mu5Path); + ImGui::SameLine(); + if (ImGui::Button(ICON_FA_FOLDER "##MU5Load")) { + openFileDialog(GUI_FILE_MU5_ROM_OPEN); + } + */ + }) + },{}) }; settings.activeCategory=settings.categories[0]; @@ -1724,8 +2082,8 @@ void FurnaceGUI::drawSettings() { if (ImGui::BeginTable("set3", vertical?1:2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { ImGui::TableNextRow(); ImGui::TableNextColumn(); + settings.filter.Draw(_("Search")); if (ImGui::BeginChild("SettingCategories",vertical?ImGui::GetContentRegionAvail()/ImVec2(1.0f,3.0f):ImGui::GetContentRegionAvail(),false)) { - settings.filter.Draw(_("Search")); ImGui::BeginDisabled(settings.filter.IsActive()); for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); ImGui::EndDisabled(); @@ -1746,546 +2104,6 @@ void FurnaceGUI::drawSettings() { END_SECTION; } - CONFIG_SECTION(_("MIDI")) { - // SUBSECTION MIDI INPUT - - - - - - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Actions:")); - ImGui::SameLine(); - if (ImGui::Button(ICON_FA_PLUS "##AddAction")) { - midiMap.binds.push_back(MIDIBind()); - SETTINGS_CHANGED; - } - ImGui::SameLine(); - if (ImGui::Button(ICON_FA_EXTERNAL_LINK "##AddLearnAction")) { - midiMap.binds.push_back(MIDIBind()); - learning=midiMap.binds.size()-1; - SETTINGS_CHANGED; - } - if (learning!=-1) { - ImGui::SameLine(); - ImGui::Text(_("(learning! press a button or move a slider/knob/something on your device.)")); - } - - if (ImGui::BeginTable("MIDIActions",7)) { - ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,0.2); - ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.1); - ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.3); - ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch,0.2); - ImGui::TableSetupColumn("c4",ImGuiTableColumnFlags_WidthStretch,0.5); - ImGui::TableSetupColumn("c5",ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("c6",ImGuiTableColumnFlags_WidthFixed); - - ImGui::TableNextRow(ImGuiTableRowFlags_Headers); - ImGui::TableNextColumn(); - ImGui::Text(_("Type")); - ImGui::TableNextColumn(); - ImGui::Text(_("Channel")); - ImGui::TableNextColumn(); - ImGui::Text(_("Note/Control")); - ImGui::TableNextColumn(); - ImGui::Text(_("Velocity/Value")); - ImGui::TableNextColumn(); - ImGui::Text(_("Action")); - ImGui::TableNextColumn(); - ImGui::TableNextColumn(); - - for (size_t i=0; i0 && (bind.data1+60)<180) { - nName=noteNames[bind.data1+60]; - } - snprintf(bindID,1024,"%d (0x%.2X, %s)",bind.data1,bind.data1,nName); - } - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::BeginCombo("##BValue1",bindID)) { - if (ImGui::Selectable(_("Any"),bind.data1==128)) { - bind.data1=128; - SETTINGS_CHANGED; - } - for (int j=0; j<128; j++) { - const char* nName="???"; - if ((j+60)>0 && (j+60)<180) { - nName=noteNames[j+60]; - } - snprintf(bindID,1024,"%d (0x%.2X, %s)##BV1_%d",j,j,nName,j); - if (ImGui::Selectable(bindID,bind.data1==j)) { - bind.data1=j; - SETTINGS_CHANGED; - } - } - ImGui::EndCombo(); - } - - ImGui::TableNextColumn(); - if (bind.data2==128) { - snprintf(bindID,1024,_("Any")); - } else { - snprintf(bindID,1024,"%d (0x%.2X)",bind.data2,bind.data2); - } - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::BeginCombo("##BValue2",bindID)) { - if (ImGui::Selectable(_("Any"),bind.data2==128)) { - bind.data2=128; - SETTINGS_CHANGED; - } - for (int j=0; j<128; j++) { - snprintf(bindID,1024,"%d (0x%.2X)##BV2_%d",j,j,j); - if (ImGui::Selectable(bindID,bind.data2==j)) { - bind.data2=j; - SETTINGS_CHANGED; - } - } - ImGui::EndCombo(); - } - - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::BeginCombo("##BAction",(bind.action==0)?_("--none--"):guiActions[bind.action].friendlyName)) { - if (ImGui::Selectable(_("--none--"),bind.action==0)) { - bind.action=0; - SETTINGS_CHANGED; - } - for (int j=0; j"):settings.midiOutDevice; - if (ImGui::BeginCombo("##MidiOutDevice",midiOutName.c_str())) { - if (ImGui::Selectable(_(""),settings.midiOutDevice.empty())) { - settings.midiOutDevice=""; - SETTINGS_CHANGED; - } - for (String& i: e->getMidiIns()) { - if (ImGui::Selectable(i.c_str(),i==settings.midiOutDevice)) { - settings.midiOutDevice=i; - SETTINGS_CHANGED; - } - } - ImGui::EndCombo(); - } - - ImGui::Text(_("Output mode:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Off (use for TX81Z)"),settings.midiOutMode==0)) { - settings.midiOutMode=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Melodic"),settings.midiOutMode==1)) { - settings.midiOutMode=1; - SETTINGS_CHANGED; - } - /* - if (ImGui::RadioButton(_("Light Show (use for Launchpad)"),settings.midiOutMode==2)) { - settings.midiOutMode=2; - }*/ - ImGui::Unindent(); - - bool midiOutProgramChangeB=settings.midiOutProgramChange; - if (ImGui::Checkbox(_("Send Program Change"),&midiOutProgramChangeB)) { - settings.midiOutProgramChange=midiOutProgramChangeB; - SETTINGS_CHANGED; - } - - bool midiOutClockB=settings.midiOutClock; - if (ImGui::Checkbox(_("Send MIDI clock"),&midiOutClockB)) { - settings.midiOutClock=midiOutClockB; - SETTINGS_CHANGED; - } - - bool midiOutTimeB=settings.midiOutTime; - if (ImGui::Checkbox(_("Send MIDI timecode"),&midiOutTimeB)) { - settings.midiOutTime=midiOutTimeB; - SETTINGS_CHANGED; - } - - if (settings.midiOutTime) { - ImGui::Text(_("Timecode frame rate:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Closest to Tick Rate"),settings.midiOutTimeRate==0)) { - settings.midiOutTimeRate=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Film (24fps)"),settings.midiOutTimeRate==1)) { - settings.midiOutTimeRate=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("PAL (25fps)"),settings.midiOutTimeRate==2)) { - settings.midiOutTimeRate=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("NTSC drop (29.97fps)"),settings.midiOutTimeRate==3)) { - settings.midiOutTimeRate=3; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("NTSC non-drop (30fps)"),settings.midiOutTimeRate==4)) { - settings.midiOutTimeRate=4; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - } - - END_SECTION; - } - CONFIG_SECTION(_("Emulation")) { - // SUBSECTION CORES - CONFIG_SUBSECTION(_("Cores")); - if (ImGui::BeginTable("##Cores",3)) { - ImGui::TableSetupColumn("##System",ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("##PlaybackCores",ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("##RenderCores",ImGuiTableColumnFlags_WidthStretch); - ImGui::TableNextRow(ImGuiTableRowFlags_Headers); - ImGui::TableNextColumn(); - ImGui::Text(_("System")); - ImGui::TableNextColumn(); - ImGui::Text(_("Playback Core(s)")); - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("used for playback")); - } - ImGui::TableNextColumn(); - ImGui::Text(_("Render Core(s)")); - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("used in audio export")); - } - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("YM2151"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##ArcadeCore",&settings.arcadeCore,arcadeCores,2)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##ArcadeCoreRender",&settings.arcadeCoreRender,arcadeCores,2)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("YM2612"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##YM2612Core",&settings.ym2612Core,ym2612Cores,3)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##YM2612CoreRender",&settings.ym2612CoreRender,ym2612Cores,3)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("SN76489"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##SNCore",&settings.snCore,snCores,2)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##SNCoreRender",&settings.snCoreRender,snCores,2)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("NES"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##NESCore",&settings.nesCore,nesCores,2)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##NESCoreRender",&settings.nesCoreRender,nesCores,2)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("FDS"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##FDSCore",&settings.fdsCore,nesCores,2)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##FDSCoreRender",&settings.fdsCoreRender,nesCores,2)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("SID"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##C64Core",&settings.c64Core,c64Cores,3)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##C64CoreRender",&settings.c64CoreRender,c64Cores,3)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("POKEY"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##POKEYCore",&settings.pokeyCore,pokeyCores,2)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##POKEYCoreRender",&settings.pokeyCoreRender,pokeyCores,2)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("OPN"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNCore",&settings.opn1Core,opnCores,3)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNCoreRender",&settings.opn1CoreRender,opnCores,3)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("OPNA"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNACore",&settings.opnaCore,opnCores,3)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNACoreRender",&settings.opnaCoreRender,opnCores,3)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("OPNB"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNBCore",&settings.opnbCore,opnCores,3)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPNBCoreRender",&settings.opnbCoreRender,opnCores,3)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("OPL/OPL2/Y8950"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL2Core",&settings.opl2Core,opl2Cores,3)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL2CoreRender",&settings.opl2CoreRender,opl2Cores,3)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("OPL3"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL3Core",&settings.opl3Core,opl3Cores,3)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL3CoreRender",&settings.opl3CoreRender,opl3Cores,3)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("OPL4"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL4Core",&settings.opl4Core,opl4Cores,2)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPL4CoreRender",&settings.opl4CoreRender,opl4Cores,2)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("ESFM"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##ESFMCore",&settings.esfmCore,LocalizedComboGetter,esfmCores,2)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##ESFMCoreRender",&settings.esfmCoreRender,LocalizedComboGetter,esfmCores,2)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("OPLL"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPLLCore",&settings.opllCore,opllCores,2)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##OPLLCoreRender",&settings.opllCoreRender,opllCores,2)) SETTINGS_CHANGED; - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("AY-3-8910/SSG"); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##AYCore",&settings.ayCore,ayCores,2)) SETTINGS_CHANGED; - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::Combo("##AYCoreRender",&settings.ayCoreRender,ayCores,2)) SETTINGS_CHANGED; - - ImGui::EndTable(); - } - - // SUBSECTION OTHER - CONFIG_SUBSECTION(_("Quality")); - if (ImGui::BeginTable("##CoreQual",3)) { - ImGui::TableSetupColumn("##System",ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("##PlaybackCores",ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("##RenderCores",ImGuiTableColumnFlags_WidthStretch); - ImGui::TableNextRow(ImGuiTableRowFlags_Headers); - ImGui::TableNextColumn(); - ImGui::Text(_("System")); - ImGui::TableNextColumn(); - ImGui::Text(_("Playback")); - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("used for playback")); - } - ImGui::TableNextColumn(); - ImGui::Text(_("Render")); - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("used in audio export")); - } - - CORE_QUALITY("Bubble System WSG",bubsysQuality,bubsysQualityRender); - CORE_QUALITY("Game Boy",gbQuality,gbQualityRender); - CORE_QUALITY("Nintendo DS",ndsQuality,ndsQualityRender); - CORE_QUALITY("PC Engine",pceQuality,pceQualityRender); - CORE_QUALITY("PowerNoise",pnQuality,pnQualityRender); - CORE_QUALITY("SAA1099",saaQuality,saaQualityRender); - CORE_QUALITY("SCC",sccQuality,sccQualityRender); - CORE_QUALITY("SID (dSID)",dsidQuality,dsidQualityRender); - CORE_QUALITY("SM8521",smQuality,smQualityRender); - CORE_QUALITY("Virtual Boy",vbQuality,vbQualityRender); - CORE_QUALITY("WonderSwan",swanQuality,swanQualityRender); - - ImGui::EndTable(); - } - - // SUBSECTION OTHER - CONFIG_SUBSECTION(_("Other")); - - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("PC Speaker strategy")); - ImGui::SameLine(); - if (ImGui::Combo("##PCSOutMethod",&settings.pcSpeakerOutMethod,LocalizedComboGetter,pcspkrOutMethods,5)) SETTINGS_CHANGED; - - ImGui::Separator(); - ImGui::Text(_("Sample ROMs:")); - - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("OPL4 YRW801 path")); - ImGui::SameLine(); - ImGui::InputText("##YRW801Path",&settings.yrw801Path); - ImGui::SameLine(); - if (ImGui::Button(ICON_FA_FOLDER "##YRW801Load")) { - openFileDialog(GUI_FILE_YRW801_ROM_OPEN); - } - - /* - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("MultiPCM TG100 path")); - ImGui::SameLine(); - ImGui::InputText("##TG100Path",&settings.tg100Path); - ImGui::SameLine(); - if (ImGui::Button(ICON_FA_FOLDER "##TG100Load")) { - openFileDialog(GUI_FILE_TG100_ROM_OPEN); - } - - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("MultiPCM MU5 path")); - ImGui::SameLine(); - ImGui::InputText("##MU5Path",&settings.mu5Path); - ImGui::SameLine(); - if (ImGui::Button(ICON_FA_FOLDER "##MU5Load")) { - openFileDialog(GUI_FILE_MU5_ROM_OPEN); - } - */ - - END_SECTION; - } CONFIG_SECTION(_("Keyboard")) { // SUBSECTION LAYOUT CONFIG_SUBSECTION(_("Keyboard")); From 7dd1b1e84f612278cd3a50885f13b4ddc5e57a00 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 13 Nov 2024 23:44:29 +0400 Subject: [PATCH 38/61] revert settings cat indent --- src/gui/settings.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index c9475dfb36..bd3b115453 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -1804,10 +1804,9 @@ void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { settings.activeCategory=*cat; } if (cat->expandChild) { - float indentSize=ImGui::CalcTextSize("-").x*dpiScale; - ImGui::Indent(indentSize); + ImGui::Indent(); for (SettingsCategory child:cat->children) drawSettingsCategory(&child); - ImGui::Unindent(indentSize); + ImGui::Unindent(); ImGui::TreePop(); } } else { // a lonely child... From 2bfee97b789edd291bcb2e41b80508165f360eb4 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Thu, 14 Nov 2024 16:30:09 +0400 Subject: [PATCH 39/61] more settings sections.... --- src/gui/settings.cpp | 5155 +++++++++++++++++++++--------------------- 1 file changed, 2628 insertions(+), 2527 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index bd3b115453..f575d4417d 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -340,7 +340,9 @@ const char* specificControls[18]={ #define SETTING_COND(n,f,c) new Setting(n,[this]f,[this]{return c;}) -#define SETTING_SEPARATOR() new Setting(NULL,[]{ImGui::Separator();}) +#define SETTING_SEPARATOR new Setting(NULL,[]{ImGui::Separator();}) + +#define SETTING_NEWLINE new Setting(NULL,[]{ImGui::NewLine();}) #define SETTINGS_CHANGED settingsChanged=true @@ -423,668 +425,668 @@ const char* specificControls[18]={ // NEW NEW SETTINGS HERE void FurnaceGUI::setupSettingsCategories() { settings.categories={ - SettingsCategory(_("General"),{ - SettingsCategory(_("Program"),{},{ + SettingsCategory(_("General"),{ + SettingsCategory(_("Program"),{},{ #ifdef HAVE_LOCALE - SETTING(_("Language"),{ - String curLocale=settings.locale; - const char* localeRestart=locales[0][2]; - if (curLocale=="") { - curLocale=""; - } else { - for (int i=1; locales[i][0]; i++) { - if (strcmp(curLocale.c_str(),locales[i][1])==0) { - curLocale=locales[i][0]; - break; + SETTING(_("Language"),{ + String curLocale=settings.locale; + const char* localeRestart=locales[0][2]; + if (curLocale=="") { + curLocale=""; + } else { + for (int i=1; locales[i][0]; i++) { + if (strcmp(curLocale.c_str(),locales[i][1])==0) { + curLocale=locales[i][0]; + break; + } } } - } - if (ImGui::BeginCombo(_("Language"),curLocale.c_str())) { - for (int i=0; locales[i][0]; i++) { - if (ImGui::Selectable(locales[i][0],strcmp(settings.locale.c_str(),locales[i][1])==0)) { - settings.locale=locales[i][1]; - SETTINGS_CHANGED; + if (ImGui::BeginCombo(_("Language"),curLocale.c_str())) { + for (int i=0; locales[i][0]; i++) { + if (ImGui::Selectable(locales[i][0],strcmp(settings.locale.c_str(),locales[i][1])==0)) { + settings.locale=locales[i][1]; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("%s",locales[i][2]); + } } + ImGui::EndCombo(); + } else { if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("%s",locales[i][2]); + ImGui::SetTooltip("%s",localeRestart); } } - ImGui::EndCombo(); - } else { - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("%s",localeRestart); - } - } - }), + }), #endif - SETTING(_("Render backend"),{ - String curRenderBackend=settings.renderBackend.empty()?GUI_BACKEND_DEFAULT_NAME:settings.renderBackend; - if (ImGui::BeginCombo(_("Render backend"),curRenderBackend.c_str())) { + SETTING(_("Render backend"),{ + String curRenderBackend=settings.renderBackend.empty()?GUI_BACKEND_DEFAULT_NAME:settings.renderBackend; + if (ImGui::BeginCombo(_("Render backend"),curRenderBackend.c_str())) { #ifdef HAVE_RENDER_SDL - if (ImGui::Selectable("SDL Renderer",curRenderBackend=="SDL")) { - settings.renderBackend="SDL"; - SETTINGS_CHANGED; - } + if (ImGui::Selectable("SDL Renderer",curRenderBackend=="SDL")) { + settings.renderBackend="SDL"; + SETTINGS_CHANGED; + } #endif #ifdef HAVE_RENDER_DX11 - if (ImGui::Selectable("DirectX 11",curRenderBackend=="DirectX 11")) { - settings.renderBackend="DirectX 11"; - SETTINGS_CHANGED; - } + if (ImGui::Selectable("DirectX 11",curRenderBackend=="DirectX 11")) { + settings.renderBackend="DirectX 11"; + SETTINGS_CHANGED; + } #endif #ifdef HAVE_RENDER_DX9 - if (ImGui::Selectable("DirectX 9",curRenderBackend=="DirectX 9")) { - settings.renderBackend="DirectX 9"; - SETTINGS_CHANGED; - } + if (ImGui::Selectable("DirectX 9",curRenderBackend=="DirectX 9")) { + settings.renderBackend="DirectX 9"; + SETTINGS_CHANGED; + } #endif #ifdef HAVE_RENDER_METAL - if (ImGui::Selectable("Metal",curRenderBackend=="Metal")) { - settings.renderBackend="Metal"; - SETTINGS_CHANGED; - } + if (ImGui::Selectable("Metal",curRenderBackend=="Metal")) { + settings.renderBackend="Metal"; + SETTINGS_CHANGED; + } #endif #ifdef HAVE_RENDER_GL #ifdef USE_GLES - if (ImGui::Selectable("OpenGL ES 2.0",curRenderBackend=="OpenGL ES 2.0")) { - settings.renderBackend="OpenGL ES 2.0"; + if (ImGui::Selectable("OpenGL ES 2.0",curRenderBackend=="OpenGL ES 2.0")) { + settings.renderBackend="OpenGL ES 2.0"; + SETTINGS_CHANGED; + } +#else + if (ImGui::Selectable("OpenGL 3.0",curRenderBackend=="OpenGL 3.0")) { + settings.renderBackend="OpenGL 3.0"; + SETTINGS_CHANGED; + } + if (ImGui::Selectable("OpenGL 2.0",curRenderBackend=="OpenGL 2.0")) { + settings.renderBackend="OpenGL 2.0"; + SETTINGS_CHANGED; + } +#endif +#endif +#ifdef HAVE_RENDER_GL1 + if (ImGui::Selectable("OpenGL 1.1",curRenderBackend=="OpenGL 1.1")) { + settings.renderBackend="OpenGL 1.1"; + SETTINGS_CHANGED; + } +#endif + if (ImGui::Selectable("Software",curRenderBackend=="Software")) { + settings.renderBackend="Software"; + SETTINGS_CHANGED; + } + ImGui::EndCombo(); + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect.")); + } + ImGui::TextWrapped(_("current backend: %s\n%s\n%s\n%s"),rend->getBackendName(),rend->getVendorName(),rend->getDeviceName(),rend->getAPIVersion()); + }), + SETTING(_("VSync"),{ + bool vsyncB=settings.vsync; + if (ImGui::Checkbox(_("VSync"),&vsyncB)) { + settings.vsync=vsyncB; SETTINGS_CHANGED; + if (rend!=NULL) { + rend->setSwapInterval(settings.vsync); + } } -#else - if (ImGui::Selectable("OpenGL 3.0",curRenderBackend=="OpenGL 3.0")) { - settings.renderBackend="OpenGL 3.0"; + }), + SETTING(_("Frame rate limit"),{ + if (ImGui::SliderInt(_("Frame rate limit"),&settings.frameRateLimit,0,250,settings.frameRateLimit==0?_("Unlimited"):"%d")) { SETTINGS_CHANGED; } - if (ImGui::Selectable("OpenGL 2.0",curRenderBackend=="OpenGL 2.0")) { - settings.renderBackend="OpenGL 2.0"; + if (settings.frameRateLimit<0) settings.frameRateLimit=0; + if (settings.frameRateLimit>1000) settings.frameRateLimit=1000; + + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("only applies when VSync is disabled.")); + } + }), + SETTING(_("Display render time"),{ + bool displayRenderTimeB=settings.displayRenderTime; + if (ImGui::Checkbox(_("Display render time"),&displayRenderTimeB)) { + settings.displayRenderTime=displayRenderTimeB; SETTINGS_CHANGED; } -#endif -#endif -#ifdef HAVE_RENDER_GL1 - if (ImGui::Selectable("OpenGL 1.1",curRenderBackend=="OpenGL 1.1")) { - settings.renderBackend="OpenGL 1.1"; + }), + SETTING_COND(_("Late render clear"),{ + bool renderClearPosB=settings.renderClearPos; + if (ImGui::Checkbox(_("Late render clear"),&renderClearPosB)) { + settings.renderClearPos=renderClearPosB; SETTINGS_CHANGED; } -#endif - if (ImGui::Selectable("Software",curRenderBackend=="Software")) { - settings.renderBackend="Software"; + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("calls rend->clear() after rend->present(). might reduce UI latency by one frame in some drivers.")); + } + },settings.renderBackend!="Metal"), + SETTING(_("Power-saving mode"),{ + bool powerSaveB=settings.powerSave; + if (ImGui::Checkbox(_("Power-saving mode"),&powerSaveB)) { + settings.powerSave=powerSaveB; SETTINGS_CHANGED; } - ImGui::EndCombo(); - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect.")); - } - ImGui::TextWrapped(_("current backend: %s\n%s\n%s\n%s"),rend->getBackendName(),rend->getVendorName(),rend->getDeviceName(),rend->getAPIVersion()); - }), - SETTING(_("VSync"),{ - bool vsyncB=settings.vsync; - if (ImGui::Checkbox(_("VSync"),&vsyncB)) { - settings.vsync=vsyncB; - SETTINGS_CHANGED; - if (rend!=NULL) { - rend->setSwapInterval(settings.vsync); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("saves power by lowering the frame rate to 2fps when idle.\nmay cause issues under Mesa drivers!")); } - } - }), - SETTING(_("Frame rate limit"),{ - if (ImGui::SliderInt(_("Frame rate limit"),&settings.frameRateLimit,0,250,settings.frameRateLimit==0?_("Unlimited"):"%d")) { - SETTINGS_CHANGED; - } - if (settings.frameRateLimit<0) settings.frameRateLimit=0; - if (settings.frameRateLimit>1000) settings.frameRateLimit=1000; - - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("only applies when VSync is disabled.")); - } - }), - SETTING(_("Display render time"),{ - bool displayRenderTimeB=settings.displayRenderTime; - if (ImGui::Checkbox(_("Display render time"),&displayRenderTimeB)) { - settings.displayRenderTime=displayRenderTimeB; - SETTINGS_CHANGED; - } - }), - SETTING_COND(_("Late render clear"),{ - bool renderClearPosB=settings.renderClearPos; - if (ImGui::Checkbox(_("Late render clear"),&renderClearPosB)) { - settings.renderClearPos=renderClearPosB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("calls rend->clear() after rend->present(). might reduce UI latency by one frame in some drivers.")); - } - },settings.renderBackend!="Metal"), - SETTING(_("Power-saving mode"),{ - bool powerSaveB=settings.powerSave; - if (ImGui::Checkbox(_("Power-saving mode"),&powerSaveB)) { - settings.powerSave=powerSaveB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("saves power by lowering the frame rate to 2fps when idle.\nmay cause issues under Mesa drivers!")); - } - }), + }), #ifndef IS_MOBILE - SETTING(_("Disable threaded input (restart after changing!)"),{ - bool noThreadedInputB=settings.noThreadedInput; - if (ImGui::Checkbox(_("Disable threaded input (restart after changing!)"),&noThreadedInputB)) { - settings.noThreadedInput=noThreadedInputB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("threaded input processes key presses for note preview on a separate thread (on supported platforms), which reduces latency.\nhowever, crashes have been reported when threaded input is on. enable this option if that is the case.")); - } - }), -#endif - SETTING(_("Enable event delay"),{ - bool eventDelayB=settings.eventDelay; - if (ImGui::Checkbox(_("Enable event delay"),&eventDelayB)) { - settings.eventDelay=eventDelayB; - SETTINGS_CHANGED; - applyUISettings(false); - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("may cause issues with high-polling-rate mice when previewing notes.")); - } - }), - SETTING(_("Per-channel oscilloscope threads"),{ - pushWarningColor(settings.chanOscThreads>cpuCores,settings.chanOscThreads>(cpuCores*2)); - if (ImGui::InputInt(_("Per-channel oscilloscope threads"),&settings.chanOscThreads)) { - if (settings.chanOscThreads<0) settings.chanOscThreads=0; - if (settings.chanOscThreads>(cpuCores*3)) settings.chanOscThreads=cpuCores*3; - if (settings.chanOscThreads>256) settings.chanOscThreads=256; - SETTINGS_CHANGED; - } - if (settings.chanOscThreads>=(cpuCores*3)) { + SETTING(_("Disable threaded input (restart after changing!)"),{ + bool noThreadedInputB=settings.noThreadedInput; + if (ImGui::Checkbox(_("Disable threaded input (restart after changing!)"),&noThreadedInputB)) { + settings.noThreadedInput=noThreadedInputB; + SETTINGS_CHANGED; + } if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("you're being silly, aren't you? that's enough.")); + ImGui::SetTooltip(_("threaded input processes key presses for note preview on a separate thread (on supported platforms), which reduces latency.\nhowever, crashes have been reported when threaded input is on. enable this option if that is the case.")); + } + }), +#endif + SETTING(_("Enable event delay"),{ + bool eventDelayB=settings.eventDelay; + if (ImGui::Checkbox(_("Enable event delay"),&eventDelayB)) { + settings.eventDelay=eventDelayB; + SETTINGS_CHANGED; + applyUISettings(false); } - } else if (settings.chanOscThreads>(cpuCores*2)) { if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("what are you doing? stop!")); + ImGui::SetTooltip(_("may cause issues with high-polling-rate mice when previewing notes.")); + } + }), + SETTING(_("Per-channel oscilloscope threads"),{ + pushWarningColor(settings.chanOscThreads>cpuCores,settings.chanOscThreads>(cpuCores*2)); + if (ImGui::InputInt(_("Per-channel oscilloscope threads"),&settings.chanOscThreads)) { + if (settings.chanOscThreads<0) settings.chanOscThreads=0; + if (settings.chanOscThreads>(cpuCores*3)) settings.chanOscThreads=cpuCores*3; + if (settings.chanOscThreads>256) settings.chanOscThreads=256; + SETTINGS_CHANGED; + } + if (settings.chanOscThreads>=(cpuCores*3)) { + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("you're being silly, aren't you? that's enough.")); + } + } else if (settings.chanOscThreads>(cpuCores*2)) { + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("what are you doing? stop!")); + } + } else if (settings.chanOscThreads>cpuCores) { + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("it is a bad idea to set this number higher than your CPU core count (%d)!"),cpuCores); + } + } + popWarningColor(); + }), + SETTING(_("Oscilloscope rendering engine:"),{ + ImGui::Text(_("Oscilloscope rendering engine:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("ImGui line plot"),settings.shaderOsc==0)) { + settings.shaderOsc=0; + SETTINGS_CHANGED; } - } else if (settings.chanOscThreads>cpuCores) { if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("it is a bad idea to set this number higher than your CPU core count (%d)!"),cpuCores); + ImGui::SetTooltip(_("render using Dear ImGui's built-in line drawing functions.")); } - } - popWarningColor(); - }), - SETTING(_("Oscilloscope rendering engine:"),{ - ImGui::Text(_("Oscilloscope rendering engine:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("ImGui line plot"),settings.shaderOsc==0)) { - settings.shaderOsc=0; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("render using Dear ImGui's built-in line drawing functions.")); - } - if (ImGui::RadioButton(_("GLSL (if available)"),settings.shaderOsc==1)) { - settings.shaderOsc=1; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { + if (ImGui::RadioButton(_("GLSL (if available)"),settings.shaderOsc==1)) { + settings.shaderOsc=1; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { #ifdef USE_GLES - ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL ES 2.0 render backend.")); + ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL ES 2.0 render backend.")); #else - ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL 3.0 render backend.")); + ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL 3.0 render backend.")); #endif - } - ImGui::Unindent(); - }), - }), - SettingsCategory(_("File"),{},{ - SETTING(_("Use system file picker"),{ - bool sysFileDialogB=settings.sysFileDialog; - if (ImGui::Checkbox(_("Use system file picker"),&sysFileDialogB)) { - settings.sysFileDialog=sysFileDialogB; - SETTINGS_CHANGED; - } - }), - SETTING(_("Number of recent files"),{ - if (ImGui::InputInt(_("Number of recent files"),&settings.maxRecentFile,1,5)) { - if (settings.maxRecentFile<0) settings.maxRecentFile=0; - if (settings.maxRecentFile>30) settings.maxRecentFile=30; - SETTINGS_CHANGED; - } - }), - SETTING(_("Compress when saving"),{ - bool compressB=settings.compress; - if (ImGui::Checkbox(_("Compress when saving"),&compressB)) { - settings.compress=compressB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("use zlib to compress saved songs.")); - } - }), - SETTING(_("Save unused patterns"),{ - bool saveUnusedPatternsB=settings.saveUnusedPatterns; - if (ImGui::Checkbox(_("Save unused patterns"),&saveUnusedPatternsB)) { - settings.saveUnusedPatterns=saveUnusedPatternsB; - SETTINGS_CHANGED; - } - }), - SETTING(_("Use new pattern format when saving"),{ - bool newPatternFormatB=settings.newPatternFormat; - if (ImGui::Checkbox(_("Use new pattern format when saving"),&newPatternFormatB)) { - settings.newPatternFormat=newPatternFormatB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("use a packed format which saves space when saving songs.\ndisable if you need compatibility with older Furnace and/or tools\nwhich do not support this format.")); - } - }), - SETTING(_("Don't apply compatibility flags when loading .dmf"),{ - bool noDMFCompatB=settings.noDMFCompat; - if (ImGui::Checkbox(_("Don't apply compatibility flags when loading .dmf"),&noDMFCompatB)) { - settings.noDMFCompat=noDMFCompatB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("do not report any issues arising from the use of this option!")); - } - }), - SETTING(_("Play after opening song:"),{ - ImGui::Text(_("Play after opening song:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("No##pol0"),settings.playOnLoad==0)) { - settings.playOnLoad=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Only if already playing##pol1"),settings.playOnLoad==1)) { - settings.playOnLoad=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes##pol0"),settings.playOnLoad==2)) { - settings.playOnLoad=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - }), - SETTING(_("Audio export loop/fade out time:"),{ - ImGui::Text(_("Audio export loop/fade out time:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Set to these values on start-up:##fot0"),settings.persistFadeOut==0)) { - settings.persistFadeOut=0; - SETTINGS_CHANGED; - } - ImGui::BeginDisabled(settings.persistFadeOut); - ImGui::Indent(); - if (ImGui::InputInt(_("Loops"),&settings.exportLoops,1,2)) { - if (settings.exportLoops<0) settings.exportLoops=0; - audioExportOptions.loops=settings.exportLoops; - SETTINGS_CHANGED; - } - if (ImGui::InputDouble(_("Fade out (seconds)"),&settings.exportFadeOut,1.0,2.0,"%.1f")) { - if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; - audioExportOptions.fadeOut=settings.exportFadeOut; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - ImGui::EndDisabled(); - if (ImGui::RadioButton(_("Remember last values##fot1"),settings.persistFadeOut==1)) { - settings.persistFadeOut=1; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - }), - SETTING(_("Store instrument name in .fui"),{ - bool writeInsNamesB=settings.writeInsNames; - if (ImGui::Checkbox(_("Store instrument name in .fui"),&writeInsNamesB)) { - settings.writeInsNames=writeInsNamesB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("when enabled, saving an instrument will store its name.\nthis may increase file size.")); - } - }), - SETTING(_("Load instrument name from .fui"),{ - bool readInsNamesB=settings.readInsNames; - if (ImGui::Checkbox(_("Load instrument name from .fui"),&readInsNamesB)) { - settings.readInsNames=readInsNamesB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("when enabled, loading an instrument will use the stored name (if present).\notherwise, it will use the file name.")); - } + } + ImGui::Unindent(); + }), }), - SETTING(_("Auto-fill file name when saving"),{ - bool autoFillSaveB=settings.autoFillSave; - if (ImGui::Checkbox(_("Auto-fill file name when saving"),&autoFillSaveB)) { - settings.autoFillSave=autoFillSaveB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("fill the file name field with an appropriate file name when saving or exporting.")); - } - }) - }), - SettingsCategory(_("New Song"),{},{ - SETTING(_("Initial system:"),{ - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Initial system:")); - ImGui::SameLine(); - if (ImGui::Button(_("Current system"))) { - settings.initialSys.clear(); - for (int i=0; isong.systemLen; i++) { - settings.initialSys.set(fmt::sprintf("id%d",i),e->systemToFileFur(e->song.system[i])); - settings.initialSys.set(fmt::sprintf("vol%d",i),(float)e->song.systemVol[i]); - settings.initialSys.set(fmt::sprintf("pan%d",i),(float)e->song.systemPan[i]); - settings.initialSys.set(fmt::sprintf("fr%d",i),(float)e->song.systemPanFR[i]); - settings.initialSys.set(fmt::sprintf("flags%d",i),e->song.systemFlags[i].toBase64()); - } - settings.initialSysName=e->song.systemName; - SETTINGS_CHANGED; - } - ImGui::SameLine(); - if (ImGui::Button(_("Randomize"))) { - settings.initialSys.clear(); - int howMany=1+rand()%3; - int totalAvailSys=0; - for (totalAvailSys=0; availableSystems[totalAvailSys]; totalAvailSys++); - if (totalAvailSys>0) { - for (int i=0; isystemToFileFur(theSystem)); - settings.initialSys.set(fmt::sprintf("vol%d",i),1.0f); - settings.initialSys.set(fmt::sprintf("pan%d",i),0.0f); - settings.initialSys.set(fmt::sprintf("fr%d",i),0.0f); - settings.initialSys.set(fmt::sprintf("flags%d",i),""); - } - } else { - settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_DUMMY)); - settings.initialSys.set("vol0",1.0f); - settings.initialSys.set("pan0",0.0f); - settings.initialSys.set("fr0",0.0f); - settings.initialSys.set("flags0",""); - howMany=1; + SettingsCategory(_("File"),{},{ + SETTING(_("Use system file picker"),{ + bool sysFileDialogB=settings.sysFileDialog; + if (ImGui::Checkbox(_("Use system file picker"),&sysFileDialogB)) { + settings.sysFileDialog=sysFileDialogB; + SETTINGS_CHANGED; } - // randomize system name - std::vector wordPool[6]; - for (int i=0; isystemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0)); - String sName=e->getSystemName(sysID); - String nameWord; - sName+=" "; - for (char& i: sName) { - if (i==' ') { - if (nameWord!="") { - wordPool[wpPos++].push_back(nameWord); - if (wpPos>=6) break; - nameWord=""; - } - } else { - nameWord+=i; - } - } + }), + SETTING(_("Number of recent files"),{ + if (ImGui::InputInt(_("Number of recent files"),&settings.maxRecentFile,1,5)) { + if (settings.maxRecentFile<0) settings.maxRecentFile=0; + if (settings.maxRecentFile>30) settings.maxRecentFile=30; + SETTINGS_CHANGED; } - settings.initialSysName=""; - for (int i=0; i<6; i++) { - if (wordPool[i].empty()) continue; - settings.initialSysName+=wordPool[i][rand()%wordPool[i].size()]; - settings.initialSysName+=" "; + }), + SETTING(_("Compress when saving"),{ + bool compressB=settings.compress; + if (ImGui::Checkbox(_("Compress when saving"),&compressB)) { + settings.compress=compressB; + SETTINGS_CHANGED; } - SETTINGS_CHANGED; - } - ImGui::SameLine(); - if (ImGui::Button(_("Reset to defaults"))) { - settings.initialSys.clear(); - settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_YM2612)); - settings.initialSys.set("vol0",1.0f); - settings.initialSys.set("pan0",0.0f); - settings.initialSys.set("fr0",0.0f); - settings.initialSys.set("flags0",""); - settings.initialSys.set("id1",e->systemToFileFur(DIV_SYSTEM_SMS)); - settings.initialSys.set("vol1",0.5f); - settings.initialSys.set("pan1",0.0f); - settings.initialSys.set("fr1",0.0f); - settings.initialSys.set("flags1",""); - settings.initialSysName="Sega Genesis/Mega Drive"; - SETTINGS_CHANGED; - } - }), - SETTING(_("Name"),{ - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Name")); - ImGui::SameLine(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::InputText("##InitSysName",&settings.initialSysName)) SETTINGS_CHANGED; - }), - SETTING(_("Initial system:"),{ // not the real setting name but gotta find it somehow - int sysCount=0; - int doRemove=-1; - for (size_t i=0; settings.initialSys.getInt(fmt::sprintf("id%d",i),0); i++) { - DivSystem sysID=e->systemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0)); - float sysVol=settings.initialSys.getFloat(fmt::sprintf("vol%d",i),0); - float sysPan=settings.initialSys.getFloat(fmt::sprintf("pan%d",i),0); - float sysPanFR=settings.initialSys.getFloat(fmt::sprintf("fr%d",i),0); - - sysCount=i+1; - - //bool doRemove=false; - bool doInvert=(sysVol<0); - float vol=fabs(sysVol); - ImGui::PushID(i); - - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize(_("Invert")).x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); - if (ImGui::BeginCombo("##System",getSystemName(sysID),ImGuiComboFlags_HeightLargest)) { - sysID=systemPicker(true); - - if (sysID!=DIV_SYSTEM_NULL) { - settings.initialSys.set(fmt::sprintf("id%d",i),(int)e->systemToFileFur(sysID)); - settings.initialSys.set(fmt::sprintf("flags%d",i),""); - SETTINGS_CHANGED; - ImGui::CloseCurrentPopup(); - } - - ImGui::EndCombo(); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("use zlib to compress saved songs.")); } - - ImGui::SameLine(); - if (ImGui::Checkbox(_("Invert"),&doInvert)) { - sysVol=-sysVol; - settings.initialSys.set(fmt::sprintf("vol%d",i),sysVol); + }), + SETTING(_("Save unused patterns"),{ + bool saveUnusedPatternsB=settings.saveUnusedPatterns; + if (ImGui::Checkbox(_("Save unused patterns"),&saveUnusedPatternsB)) { + settings.saveUnusedPatterns=saveUnusedPatternsB; SETTINGS_CHANGED; } - ImGui::SameLine(); - //ImGui::BeginDisabled(settings.initialSys.size()<=4); - pushDestColor(); - if (ImGui::Button(ICON_FA_MINUS "##InitSysRemove")) { - doRemove=i; + }), + SETTING(_("Use new pattern format when saving"),{ + bool newPatternFormatB=settings.newPatternFormat; + if (ImGui::Checkbox(_("Use new pattern format when saving"),&newPatternFormatB)) { + settings.newPatternFormat=newPatternFormatB; SETTINGS_CHANGED; } - popDestColor(); - //ImGui::EndDisabled(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); - if (CWSliderFloat(_("Volume"),&vol,0.0f,3.0f)) { - if (doInvert) { - if (vol<0.0001) vol=0.0001; - } - if (vol<0) vol=0; - if (vol>10) vol=10; - sysVol=doInvert?-vol:vol; - settings.initialSys.set(fmt::sprintf("vol%d",i),(float)sysVol); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("use a packed format which saves space when saving songs.\ndisable if you need compatibility with older Furnace and/or tools\nwhich do not support this format.")); + } + }), + SETTING(_("Don't apply compatibility flags when loading .dmf"),{ + bool noDMFCompatB=settings.noDMFCompat; + if (ImGui::Checkbox(_("Don't apply compatibility flags when loading .dmf"),&noDMFCompatB)) { + settings.noDMFCompat=noDMFCompatB; SETTINGS_CHANGED; - } rightClickable - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); - if (CWSliderFloat(_("Panning"),&sysPan,-1.0f,1.0f)) { - if (sysPan<-1.0f) sysPan=-1.0f; - if (sysPan>1.0f) sysPan=1.0f; - settings.initialSys.set(fmt::sprintf("pan%d",i),(float)sysPan); + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("do not report any issues arising from the use of this option!")); + } + }), + SETTING(_("Play after opening song:"),{ + ImGui::Text(_("Play after opening song:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No##pol0"),settings.playOnLoad==0)) { + settings.playOnLoad=0; SETTINGS_CHANGED; - } rightClickable - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); - if (CWSliderFloat(_("Front/Rear"),&sysPanFR,-1.0f,1.0f)) { - if (sysPanFR<-1.0f) sysPanFR=-1.0f; - if (sysPanFR>1.0f) sysPanFR=1.0f; - settings.initialSys.set(fmt::sprintf("fr%d",i),(float)sysPanFR); + } + if (ImGui::RadioButton(_("Only if already playing##pol1"),settings.playOnLoad==1)) { + settings.playOnLoad=1; SETTINGS_CHANGED; - } rightClickable - - // oh please MSVC don't cry - if (ImGui::TreeNode(_("Configure"))) { - String sysFlagsS=settings.initialSys.getString(fmt::sprintf("flags%d",i),""); - DivConfig sysFlags; - sysFlags.loadFromBase64(sysFlagsS.c_str()); - if (drawSysConf(-1,i,sysID,sysFlags,false)) { - settings.initialSys.set(fmt::sprintf("flags%d",i),sysFlags.toBase64()); - } - ImGui::TreePop(); + } + if (ImGui::RadioButton(_("Yes##pol0"),settings.playOnLoad==2)) { + settings.playOnLoad=2; SETTINGS_CHANGED; } - - ImGui::PopID(); - } - - if (doRemove>=0 && sysCount>1) { - for (int i=doRemove; isystemToFileFur(DIV_SYSTEM_YM2612)); - settings.initialSys.set(fmt::sprintf("vol%d",sysCount),1.0f); - settings.initialSys.set(fmt::sprintf("pan%d",sysCount),0.0f); - settings.initialSys.set(fmt::sprintf("fr%d",sysCount),0.0f); - settings.initialSys.set(fmt::sprintf("flags%d",sysCount),""); - } - }), - SETTING(_("When creating new song:"),{ - ImGui::Text(_("When creating new song:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Display system preset selector##NSB0"),settings.newSongBehavior==0)) { - settings.newSongBehavior=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Start with initial system##NSB1"),settings.newSongBehavior==1)) { - settings.newSongBehavior=1; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - }), - SETTING(_("Default author name"),{ - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Default author name")); - ImGui::SameLine(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (ImGui::InputText("##DefAuthName", &settings.defaultAuthorName)) SETTINGS_CHANGED; - }) - }), - SettingsCategory(_("Start-up"),{},{ - SETTING(_("Play intro on start-up:"),{ - ImGui::Text(_("Play intro on start-up:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("No##pis0"),settings.alwaysPlayIntro==0)) { - settings.alwaysPlayIntro=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Short##pis1"),settings.alwaysPlayIntro==1)) { - settings.alwaysPlayIntro=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Full (short when loading song)##pis2"),settings.alwaysPlayIntro==2)) { - settings.alwaysPlayIntro=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Full (always)##pis3"),settings.alwaysPlayIntro==3)) { - settings.alwaysPlayIntro=3; - SETTINGS_CHANGED; - } - ImGui::Unindent(); + ImGui::Unindent(); + }), + SETTING(_("Audio export loop/fade out time:"),{ + ImGui::Text(_("Audio export loop/fade out time:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Set to these values on start-up:##fot0"),settings.persistFadeOut==0)) { + settings.persistFadeOut=0; + SETTINGS_CHANGED; + } + ImGui::BeginDisabled(settings.persistFadeOut); + ImGui::Indent(); + if (ImGui::InputInt(_("Loops"),&settings.exportLoops,1,2)) { + if (settings.exportLoops<0) settings.exportLoops=0; + audioExportOptions.loops=settings.exportLoops; + SETTINGS_CHANGED; + } + if (ImGui::InputDouble(_("Fade out (seconds)"),&settings.exportFadeOut,1.0,2.0,"%.1f")) { + if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; + audioExportOptions.fadeOut=settings.exportFadeOut; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + ImGui::EndDisabled(); + if (ImGui::RadioButton(_("Remember last values##fot1"),settings.persistFadeOut==1)) { + settings.persistFadeOut=1; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Store instrument name in .fui"),{ + bool writeInsNamesB=settings.writeInsNames; + if (ImGui::Checkbox(_("Store instrument name in .fui"),&writeInsNamesB)) { + settings.writeInsNames=writeInsNamesB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("when enabled, saving an instrument will store its name.\nthis may increase file size.")); + } + }), + SETTING(_("Load instrument name from .fui"),{ + bool readInsNamesB=settings.readInsNames; + if (ImGui::Checkbox(_("Load instrument name from .fui"),&readInsNamesB)) { + settings.readInsNames=readInsNamesB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("when enabled, loading an instrument will use the stored name (if present).\notherwise, it will use the file name.")); + } + }), + SETTING(_("Auto-fill file name when saving"),{ + bool autoFillSaveB=settings.autoFillSave; + if (ImGui::Checkbox(_("Auto-fill file name when saving"),&autoFillSaveB)) { + settings.autoFillSave=autoFillSaveB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("fill the file name field with an appropriate file name when saving or exporting.")); + } + }) }), - SETTING(_("Disable fade-in during start-up"),{ - bool disableFadeInB=settings.disableFadeIn; - if (ImGui::Checkbox(_("Disable fade-in during start-up"),&disableFadeInB)) { - settings.disableFadeIn=disableFadeInB; - SETTINGS_CHANGED; - } - }) - }), - SettingsCategory(_("Behavior"),{},{ - SETTING(_("New instruments are blank"),{ - bool blankInsB=settings.blankIns; - if (ImGui::Checkbox(_("New instruments are blank"),&blankInsB)) { - settings.blankIns=blankInsB; - SETTINGS_CHANGED; - } - }) - }), - SettingsCategory(_("Configuration"),{},{ - SETTING(NULL,{ - if (ImGui::Button(_("Import"))) { - openFileDialog(GUI_FILE_IMPORT_CONFIG); - } - ImGui::SameLine(); - if (ImGui::Button(_("Export"))) { - openFileDialog(GUI_FILE_EXPORT_CONFIG); - } - pushDestColor(); - if (ImGui::Button(_("Factory Reset"))) { - showWarning(_("Are you sure you want to reset all Furnace settings?\nYou must restart Furnace after doing so."),GUI_WARN_RESET_CONFIG); - } - popDestColor(); - }) - }), - SettingsCategory(_("Import"),{},{ - SETTING(_("Use OPL3 instead of OPL2 for S3M import"),{ - bool s3mOPL3B=settings.s3mOPL3; - if (ImGui::Checkbox(_("Use OPL3 instead of OPL2 for S3M import"),&s3mOPL3B)) { - settings.s3mOPL3=s3mOPL3B; - SETTINGS_CHANGED; - } - }) - }), -#ifdef IS_MOBILE - SettingsCategory(_("Android"),{ - SettingsCategory(_("Vibrator"),{},{ - SETTING(_("Strength"),{ - if (ImGui::SliderFloat(_("Strength"),&settings.vibrationStrength,0.0f,1.0f)) { - if (settings.vibrationStrength<0.0f) settings.vibrationStrength=0.0f; - if (settings.vibrationStrength>1.0f) settings.vibrationStrength=1.0f; + SettingsCategory(_("New Song"),{},{ + SETTING(_("Initial system:"),{ + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("Initial system:")); + ImGui::SameLine(); + if (ImGui::Button(_("Current system"))) { + settings.initialSys.clear(); + for (int i=0; isong.systemLen; i++) { + settings.initialSys.set(fmt::sprintf("id%d",i),e->systemToFileFur(e->song.system[i])); + settings.initialSys.set(fmt::sprintf("vol%d",i),(float)e->song.systemVol[i]); + settings.initialSys.set(fmt::sprintf("pan%d",i),(float)e->song.systemPan[i]); + settings.initialSys.set(fmt::sprintf("fr%d",i),(float)e->song.systemPanFR[i]); + settings.initialSys.set(fmt::sprintf("flags%d",i),e->song.systemFlags[i].toBase64()); + } + settings.initialSysName=e->song.systemName; + SETTINGS_CHANGED; + } + ImGui::SameLine(); + if (ImGui::Button(_("Randomize"))) { + settings.initialSys.clear(); + int howMany=1+rand()%3; + int totalAvailSys=0; + for (totalAvailSys=0; availableSystems[totalAvailSys]; totalAvailSys++); + if (totalAvailSys>0) { + for (int i=0; isystemToFileFur(theSystem)); + settings.initialSys.set(fmt::sprintf("vol%d",i),1.0f); + settings.initialSys.set(fmt::sprintf("pan%d",i),0.0f); + settings.initialSys.set(fmt::sprintf("fr%d",i),0.0f); + settings.initialSys.set(fmt::sprintf("flags%d",i),""); + } + } else { + settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_DUMMY)); + settings.initialSys.set("vol0",1.0f); + settings.initialSys.set("pan0",0.0f); + settings.initialSys.set("fr0",0.0f); + settings.initialSys.set("flags0",""); + howMany=1; + } + // randomize system name + std::vector wordPool[6]; + for (int i=0; isystemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0)); + String sName=e->getSystemName(sysID); + String nameWord; + sName+=" "; + for (char& i: sName) { + if (i==' ') { + if (nameWord!="") { + wordPool[wpPos++].push_back(nameWord); + if (wpPos>=6) break; + nameWord=""; + } + } else { + nameWord+=i; + } + } + } + settings.initialSysName=""; + for (int i=0; i<6; i++) { + if (wordPool[i].empty()) continue; + settings.initialSysName+=wordPool[i][rand()%wordPool[i].size()]; + settings.initialSysName+=" "; + } + SETTINGS_CHANGED; + } + ImGui::SameLine(); + if (ImGui::Button(_("Reset to defaults"))) { + settings.initialSys.clear(); + settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_YM2612)); + settings.initialSys.set("vol0",1.0f); + settings.initialSys.set("pan0",0.0f); + settings.initialSys.set("fr0",0.0f); + settings.initialSys.set("flags0",""); + settings.initialSys.set("id1",e->systemToFileFur(DIV_SYSTEM_SMS)); + settings.initialSys.set("vol1",0.5f); + settings.initialSys.set("pan1",0.0f); + settings.initialSys.set("fr1",0.0f); + settings.initialSys.set("flags1",""); + settings.initialSysName="Sega Genesis/Mega Drive"; + SETTINGS_CHANGED; + } + }), + SETTING(_("Name"),{ + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("Name")); + ImGui::SameLine(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::InputText("##InitSysName",&settings.initialSysName)) SETTINGS_CHANGED; + }), + SETTING(_("Initial system:"),{ // not the real setting name but gotta find it somehow + int sysCount=0; + int doRemove=-1; + for (size_t i=0; settings.initialSys.getInt(fmt::sprintf("id%d",i),0); i++) { + DivSystem sysID=e->systemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0)); + float sysVol=settings.initialSys.getFloat(fmt::sprintf("vol%d",i),0); + float sysPan=settings.initialSys.getFloat(fmt::sprintf("pan%d",i),0); + float sysPanFR=settings.initialSys.getFloat(fmt::sprintf("fr%d",i),0); + + sysCount=i+1; + + //bool doRemove=false; + bool doInvert=(sysVol<0); + float vol=fabs(sysVol); + ImGui::PushID(i); + + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize(_("Invert")).x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (ImGui::BeginCombo("##System",getSystemName(sysID),ImGuiComboFlags_HeightLargest)) { + sysID=systemPicker(true); + + if (sysID!=DIV_SYSTEM_NULL) { + settings.initialSys.set(fmt::sprintf("id%d",i),(int)e->systemToFileFur(sysID)); + settings.initialSys.set(fmt::sprintf("flags%d",i),""); + SETTINGS_CHANGED; + ImGui::CloseCurrentPopup(); + } + + ImGui::EndCombo(); + } + + ImGui::SameLine(); + if (ImGui::Checkbox(_("Invert"),&doInvert)) { + sysVol=-sysVol; + settings.initialSys.set(fmt::sprintf("vol%d",i),sysVol); + SETTINGS_CHANGED; + } + ImGui::SameLine(); + //ImGui::BeginDisabled(settings.initialSys.size()<=4); + pushDestColor(); + if (ImGui::Button(ICON_FA_MINUS "##InitSysRemove")) { + doRemove=i; + SETTINGS_CHANGED; + } + popDestColor(); + //ImGui::EndDisabled(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (CWSliderFloat(_("Volume"),&vol,0.0f,3.0f)) { + if (doInvert) { + if (vol<0.0001) vol=0.0001; + } + if (vol<0) vol=0; + if (vol>10) vol=10; + sysVol=doInvert?-vol:vol; + settings.initialSys.set(fmt::sprintf("vol%d",i),(float)sysVol); + SETTINGS_CHANGED; + } rightClickable + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (CWSliderFloat(_("Panning"),&sysPan,-1.0f,1.0f)) { + if (sysPan<-1.0f) sysPan=-1.0f; + if (sysPan>1.0f) sysPan=1.0f; + settings.initialSys.set(fmt::sprintf("pan%d",i),(float)sysPan); + SETTINGS_CHANGED; + } rightClickable + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0); + if (CWSliderFloat(_("Front/Rear"),&sysPanFR,-1.0f,1.0f)) { + if (sysPanFR<-1.0f) sysPanFR=-1.0f; + if (sysPanFR>1.0f) sysPanFR=1.0f; + settings.initialSys.set(fmt::sprintf("fr%d",i),(float)sysPanFR); + SETTINGS_CHANGED; + } rightClickable + + // oh please MSVC don't cry + if (ImGui::TreeNode(_("Configure"))) { + String sysFlagsS=settings.initialSys.getString(fmt::sprintf("flags%d",i),""); + DivConfig sysFlags; + sysFlags.loadFromBase64(sysFlagsS.c_str()); + if (drawSysConf(-1,i,sysID,sysFlags,false)) { + settings.initialSys.set(fmt::sprintf("flags%d",i),sysFlags.toBase64()); + } + ImGui::TreePop(); + SETTINGS_CHANGED; + } + + ImGui::PopID(); + } + + if (doRemove>=0 && sysCount>1) { + for (int i=doRemove; isystemToFileFur(DIV_SYSTEM_YM2612)); + settings.initialSys.set(fmt::sprintf("vol%d",sysCount),1.0f); + settings.initialSys.set(fmt::sprintf("pan%d",sysCount),0.0f); + settings.initialSys.set(fmt::sprintf("fr%d",sysCount),0.0f); + settings.initialSys.set(fmt::sprintf("flags%d",sysCount),""); + } + }), + SETTING(_("When creating new song:"),{ + ImGui::Text(_("When creating new song:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Display system preset selector##NSB0"),settings.newSongBehavior==0)) { + settings.newSongBehavior=0; SETTINGS_CHANGED; } + if (ImGui::RadioButton(_("Start with initial system##NSB1"),settings.newSongBehavior==1)) { + settings.newSongBehavior=1; + SETTINGS_CHANGED; + } + ImGui::Unindent(); }), - SETTING(_("Length"),{ - if (ImGui::SliderInt(_("Length"),&settings.vibrationLength,10,500,"%d ms")) { - if (settings.vibrationLength<10) settings.vibrationLength=10; - if (settings.vibrationLength>500) settings.vibrationLength=500; + SETTING(_("Default author name"),{ + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("Default author name")); + ImGui::SameLine(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::InputText("##DefAuthName", &settings.defaultAuthorName)) SETTINGS_CHANGED; + }) + }), + SettingsCategory(_("Start-up"),{},{ + SETTING(_("Play intro on start-up:"),{ + ImGui::Text(_("Play intro on start-up:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No##pis0"),settings.alwaysPlayIntro==0)) { + settings.alwaysPlayIntro=0; SETTINGS_CHANGED; } + if (ImGui::RadioButton(_("Short##pis1"),settings.alwaysPlayIntro==1)) { + settings.alwaysPlayIntro=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Full (short when loading song)##pis2"),settings.alwaysPlayIntro==2)) { + settings.alwaysPlayIntro=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Full (always)##pis3"),settings.alwaysPlayIntro==3)) { + settings.alwaysPlayIntro=3; + SETTINGS_CHANGED; + } + ImGui::Unindent(); }), - }) - },{ - SETTING(_("Enable background playback (restart!)"),{ - bool backgroundPlayB=settings.backgroundPlay; - if (ImGui::Checkbox(_("Enable background playback (restart!)"),&backgroundPlayB)) { - settings.backgroundPlay=backgroundPlayB; - SETTINGS_CHANGED; - } - }) - }), + SETTING(_("Disable fade-in during start-up"),{ + bool disableFadeInB=settings.disableFadeIn; + if (ImGui::Checkbox(_("Disable fade-in during start-up"),&disableFadeInB)) { + settings.disableFadeIn=disableFadeInB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Behavior"),{},{ + SETTING(_("New instruments are blank"),{ + bool blankInsB=settings.blankIns; + if (ImGui::Checkbox(_("New instruments are blank"),&blankInsB)) { + settings.blankIns=blankInsB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Configuration"),{},{ + SETTING(NULL,{ + if (ImGui::Button(_("Import"))) { + openFileDialog(GUI_FILE_IMPORT_CONFIG); + } + ImGui::SameLine(); + if (ImGui::Button(_("Export"))) { + openFileDialog(GUI_FILE_EXPORT_CONFIG); + } + pushDestColor(); + if (ImGui::Button(_("Factory Reset"))) { + showWarning(_("Are you sure you want to reset all Furnace settings?\nYou must restart Furnace after doing so."),GUI_WARN_RESET_CONFIG); + } + popDestColor(); + }) + }), + SettingsCategory(_("Import"),{},{ + SETTING(_("Use OPL3 instead of OPL2 for S3M import"),{ + bool s3mOPL3B=settings.s3mOPL3; + if (ImGui::Checkbox(_("Use OPL3 instead of OPL2 for S3M import"),&s3mOPL3B)) { + settings.s3mOPL3=s3mOPL3B; + SETTINGS_CHANGED; + } + }) + }), +#ifdef IS_MOBILE + SettingsCategory(_("Android"),{ + SettingsCategory(_("Vibrator"),{},{ + SETTING(_("Strength"),{ + if (ImGui::SliderFloat(_("Strength"),&settings.vibrationStrength,0.0f,1.0f)) { + if (settings.vibrationStrength<0.0f) settings.vibrationStrength=0.0f; + if (settings.vibrationStrength>1.0f) settings.vibrationStrength=1.0f; + SETTINGS_CHANGED; + } + }), + SETTING(_("Length"),{ + if (ImGui::SliderInt(_("Length"),&settings.vibrationLength,10,500,"%d ms")) { + if (settings.vibrationLength<10) settings.vibrationLength=10; + if (settings.vibrationLength>500) settings.vibrationLength=500; + SETTINGS_CHANGED; + } + }), + }) + },{ + SETTING(_("Enable background playback (restart!)"),{ + bool backgroundPlayB=settings.backgroundPlay; + if (ImGui::Checkbox(_("Enable background playback (restart!)"),&backgroundPlayB)) { + settings.backgroundPlay=backgroundPlayB; + SETTINGS_CHANGED; + } + }) + }), #endif },{}), SettingsCategory(_("Audio"),{ @@ -1433,7 +1435,7 @@ void FurnaceGUI::setupSettingsCategories() { SETTINGS_CHANGED; } },midiMap.valueInputStyle==5), - SETTING_SEPARATOR(), + SETTING_SEPARATOR, SETTING(_("Volume curve"),{ if (ImGui::SliderFloat(_("Volume curve"),&midiMap.volExp,0.01,8.0,"%.2f")) { if (midiMap.volExp<0.01) midiMap.volExp=0.01; @@ -1776,2027 +1778,2126 @@ void FurnaceGUI::setupSettingsCategories() { } */ }) - },{}) - }; - - settings.activeCategory=settings.categories[0]; -} - -void FurnaceGUI::destroySettingsCategories(SettingsCategory& cat) { - if (cat.children.size()>0) { - for (SettingsCategory i:cat.children) { - destroySettingsCategories(i); - } - } - for (Setting* i:cat.settings) { - delete i; - } - cat.settings.clear(); - cat.children.clear(); -} + },{}), + SettingsCategory(_("Interface"),{ + SettingsCategory(_("Layout"),{},{ + SETTING(_("Workspace layout:"),{ + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("Workspace layout:")); + ImGui::SameLine(); + if (ImGui::Button(_("Import"))) { + openFileDialog(GUI_FILE_IMPORT_LAYOUT); + } + ImGui::SameLine(); + if (ImGui::Button(_("Export"))) { + openFileDialog(GUI_FILE_EXPORT_LAYOUT); + } + ImGui::SameLine(); + if (ImGui::Button(_("Reset"))) { + showWarning(_("Are you sure you want to reset the workspace layout?"),GUI_WARN_RESET_LAYOUT); + } + }), + SETTING(_("Allow docking editors"),{ + bool allowEditDockingB=settings.allowEditDocking; + if (ImGui::Checkbox(_("Allow docking editors"),&allowEditDockingB)) { + settings.allowEditDocking=allowEditDockingB; + SETTINGS_CHANGED; + } + }), +#ifndef IS_MOBILE + SETTING(_("Remember window position"),{ + bool saveWindowPosB=settings.saveWindowPos; + if (ImGui::Checkbox(_("Remember window position"),&saveWindowPosB)) { + settings.saveWindowPos=saveWindowPosB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("remembers the window's last position on start-up.")); + } + }), +#endif + SETTING(_("Only allow window movement when clicking on title bar"),{ + bool moveWindowTitleB=settings.moveWindowTitle; + if (ImGui::Checkbox(_("Only allow window movement when clicking on title bar"),&moveWindowTitleB)) { + settings.moveWindowTitle=moveWindowTitleB; + applyUISettings(false); + SETTINGS_CHANGED; + } + }), + SETTING(_("Center pop-up windows"),{ + bool centerPopupB=settings.centerPopup; + if (ImGui::Checkbox(_("Center pop-up windows"),¢erPopupB)) { + settings.centerPopup=centerPopupB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Play/edit controls layout:"),{ + ImGui::Text(_("Play/edit controls layout:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Classic##ecl0"),settings.controlLayout==0)) { + settings.controlLayout=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Compact##ecl1"),settings.controlLayout==1)) { + settings.controlLayout=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Compact (vertical)##ecl2"),settings.controlLayout==2)) { + settings.controlLayout=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Split##ecl3"),settings.controlLayout==3)) { + settings.controlLayout=3; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Position of buttons in Orders:"),{ + ImGui::Text(_("Position of buttons in Orders:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Top##obp0"),settings.orderButtonPos==0)) { + settings.orderButtonPos=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Left##obp1"),settings.orderButtonPos==1)) { + settings.orderButtonPos=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Right##obp2"),settings.orderButtonPos==2)) { + settings.orderButtonPos=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }) + }), + SettingsCategory(_("Mouse"),{},{ + SETTING(_("Double-click time (seconds)"),{ + if (CWSliderFloat(_("Double-click time (seconds)"),&settings.doubleClickTime,0.02,1.0,"%.2f")) { + if (settings.doubleClickTime<0.02) settings.doubleClickTime=0.02; + if (settings.doubleClickTime>1.0) settings.doubleClickTime=1.0; -void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { - if (cat->children.size()>0) { - ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_SpanFullWidth|ImGuiTreeNodeFlags_OpenOnArrow|ImGuiTreeNodeFlags_OpenOnDoubleClick; - if (settings.activeCategory.name==cat->name) f|=ImGuiTreeNodeFlags_Selected; - cat->expandChild=ImGui::TreeNodeEx(cat->name,f); - if (ImGui::IsItemClicked()) { - settings.activeCategory=*cat; - } - if (cat->expandChild) { - ImGui::Indent(); - for (SettingsCategory child:cat->children) drawSettingsCategory(&child); - ImGui::Unindent(); - ImGui::TreePop(); - } - } else { // a lonely child... - if (ImGui::Selectable(cat->name,settings.activeCategory.name==cat->name)) { - settings.activeCategory=*cat; - } - } -} - -void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { - if (cat->children.size()>0) { - for (SettingsCategory child:cat->children) { - searchDrawSettingItems(&child); - } - } - bool anyFound=false; - for (Setting* s:cat->settings) { - if (s->passesFilter(&settings.filter)) { - anyFound=true; - break; - } - } - if (anyFound) { - ImGui::BulletText("%s",cat->name); - ImGui::Indent(); - for (Setting* s:cat->settings) { - if (s->passesFilter(&settings.filter)) s->drawSetting(); - } - ImGui::Unindent(); - ImGui::Separator(); - } -} - -void FurnaceGUI::drawSettingsItems() { - if (settings.filter.IsActive()) { - for (SettingsCategory cat:settings.categories) { - searchDrawSettingItems(&cat); - } - } else { - if (settings.activeCategory.name==NULL) return; - for (Setting* s:settings.activeCategory.settings) s->drawSetting(); - } -} - -String FurnaceGUI::stripName(String what) { - String ret; - for (char& i: what) { - if ((i>='A' && i<='Z') || (i>='a' && i<='z') || (i>='0' && i<='9')) { - ret+=i; - } else { - ret+='-'; - } - } - return ret; -} - -bool FurnaceGUI::splitBackupName(const char* input, String& backupName, struct tm& backupTime) { - size_t len=strlen(input); - if (len<4) return false; - - const char* firstHyphen=NULL; - const char* secondHyphen=NULL; - bool whichHyphen=false; - bool isDateValid=true; - // -YYYYMMDD-hhmmss.fur - if (strcmp(&input[len-4],".fur")!=0) return false; - // find two hyphens - for (const char* i=input+len; i!=input; i--) { - if ((*i)=='-') { - if (whichHyphen) { - firstHyphen=i; - break; - } else { - secondHyphen=i; - whichHyphen=true; - } - } - } - if (firstHyphen==NULL) return false; - if (secondHyphen==NULL) return false; - - // get the time - int whichChar=0; - for (const char* i=secondHyphen+1; *i; i++) { - if ((*i)<'0' || (*i)>'9') { - isDateValid=false; - break; - } - switch (whichChar++) { - case 0: - backupTime.tm_hour=((*i)-'0')*10; - break; - case 1: - backupTime.tm_hour+=(*i)-'0'; - break; - case 2: - backupTime.tm_min=((*i)-'0')*10; - break; - case 3: - backupTime.tm_min+=(*i)-'0'; - break; - case 4: - backupTime.tm_sec=((*i)-'0')*10; - break; - case 5: - backupTime.tm_sec+=(*i)-'0'; - break; - } - if (whichChar>=6) break; - } - if (whichChar!=6) return false; - if (!isDateValid) return false; - if (backupTime.tm_hour>23) return false; - if (backupTime.tm_min>59) return false; - // intentional - if (backupTime.tm_sec>60) return false; - - // get the date - String theDate=""; - for (const char* i=firstHyphen+1; *i; i++) { - if ((*i)=='-') break; - if ((*i)<'0' || (*i)>'9') { - isDateValid=false; - break; - } - theDate+=*i; - } - if (!isDateValid) return false; - if (theDate.size()<5) return false; - if (theDate.size()>14) return false; - String mmdd=theDate.substr(theDate.size()-4); - if (mmdd.size()!=4) return false; - backupTime.tm_mon=(mmdd[0]-'0')*10+(mmdd[1]-'0')-1; - backupTime.tm_mday=(mmdd[2]-'0')*10+(mmdd[3]-'0'); - if (backupTime.tm_mon>12) return false; - if (backupTime.tm_mday>31) return false; - String yyyy=theDate.substr(0,theDate.size()-4); - try { - backupTime.tm_year=std::stoi(yyyy)-1900; - } catch (std::exception& e) { - return false; - } - - backupName=""; - for (const char* i=input; i!=firstHyphen && (*i); i++) { - backupName+=*i; - } - - return true; -} - -void FurnaceGUI::purgeBackups(int year, int month, int day) { -#ifdef _WIN32 - String findPath=backupPath+String(DIR_SEPARATOR_STR)+String("*.fur"); - WString findPathW=utf8To16(findPath.c_str()); - WIN32_FIND_DATAW next; - HANDLE backDir=FindFirstFileW(findPathW.c_str(),&next); - if (backDir!=INVALID_HANDLE_VALUE) { - do { - String backupName; - struct tm backupTime; - String cFileNameU=utf16To8(next.cFileName); - bool deleteBackup=false; - if (!splitBackupName(cFileNameU.c_str(),backupName,backupTime)) continue; - - if (year==0) { - deleteBackup=true; - } else if (backupTime.tm_year<(year-1900)) { - deleteBackup=true; - } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) { - deleteBackup=true; - } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mdayd_name,".")==0) continue; - if (strcmp(next->d_name,"..")==0) continue; - if (!splitBackupName(next->d_name,backupName,backupTime)) continue; - - if (year==0) { - deleteBackup=true; - } else if (backupTime.tm_year<(year-1900)) { - deleteBackup=true; - } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) { - deleteBackup=true; - } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mdayd_name; - deleteFile(nextPath.c_str()); - } - } - closedir(backDir); -#endif - refreshBackups=true; -} - -void FurnaceGUI::promptKey(int which, int bindIdx) { - bindSetTarget=which; - bindSetTargetIdx=bindIdx; - bindSetActive=true; - bindSetPending=true; - if (bindIdx>=(int)actionKeys[which].size()) { - bindSetPrevValue=0; - actionKeys[which].push_back(0); - } else { - bindSetPrevValue=actionKeys[which][bindIdx]; - actionKeys[which][bindIdx]=0; - } -} - -struct MappedInput { - int scan; - int val; - MappedInput(): - scan(SDL_SCANCODE_UNKNOWN), val(0) {} - MappedInput(int s, int v): - scan(s), val(v) {} -}; - -void FurnaceGUI::drawSettings() { - if (nextWindow==GUI_WINDOW_SETTINGS) { - settingsOpen=true; - ImGui::SetNextWindowFocus(); - nextWindow=GUI_WINDOW_NOTHING; - } - if (!settingsOpen) return; - if (mobileUI) { - ImVec2 setWindowPos=ImVec2(0,0); - ImVec2 setWindowSize=ImVec2(canvasW,canvasH); - ImGui::SetNextWindowPos(setWindowPos); - ImGui::SetNextWindowSize(setWindowSize); - } else { - ImGui::SetNextWindowSizeConstraints(ImVec2(200.0f*dpiScale,100.0f*dpiScale),ImVec2(canvasW,canvasH)); - } - if (ImGui::Begin("Settings",&settingsOpen,ImGuiWindowFlags_NoDocking|globalWinFlags,_("Settings"))) { - if (!settingsOpen) { - if (settingsChanged) { - settingsOpen=true; - showWarning(_("Do you want to save your settings?"),GUI_WARN_CLOSE_SETTINGS); - } else { - settingsOpen=false; - } - } - if (ImGui::BeginTabBar("settingsTab")) { - // NEW SETTINGS HERE - CONFIG_SECTION("test") { - CONFIG_SUBSECTION("here"); - - bool vertical=ImGui::GetWindowSize().y>ImGui::GetWindowSize().x; - if (ImGui::BeginTable("set3", vertical?1:2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - settings.filter.Draw(_("Search")); - if (ImGui::BeginChild("SettingCategories",vertical?ImGui::GetContentRegionAvail()/ImVec2(1.0f,3.0f):ImGui::GetContentRegionAvail(),false)) { - ImGui::BeginDisabled(settings.filter.IsActive()); - for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); - ImGui::EndDisabled(); - } - ImGui::EndChild(); - if (ImGui::GetWindowSize().y>ImGui::GetWindowSize().x) ImGui::TableNextRow(); - ImGui::TableNextColumn(); - if (ImGui::BeginChild("SettingsItems",vertical?ImVec2(0.0f,0.0f):ImGui::GetContentRegionAvail(),false)) { - drawSettingsItems(); - if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { - ImGui::Text("gotta unlock them first!"); - } - } - ImGui::EndChild(); - ImGui::EndTable(); - } - - END_SECTION; - } - - CONFIG_SECTION(_("Keyboard")) { - // SUBSECTION LAYOUT - CONFIG_SUBSECTION(_("Keyboard")); - if (ImGui::Button(_("Import"))) { - openFileDialog(GUI_FILE_IMPORT_KEYBINDS); - } - ImGui::SameLine(); - if (ImGui::Button(_("Export"))) { - openFileDialog(GUI_FILE_EXPORT_KEYBINDS); - } - ImGui::SameLine(); - if (ImGui::Button(_("Reset defaults"))) { - showWarning(_("Are you sure you want to reset the keyboard settings?"),GUI_WARN_RESET_KEYBINDS); - } - if (ImGui::BeginChild("##HotkeysList",ImVec2(0,0),false,ImGuiWindowFlags_HorizontalScrollbar)) { - if (ImGui::TreeNode(_("Global hotkeys"))) { - KEYBIND_CONFIG_BEGIN("keysGlobal"); - - drawKeybindSettingsTableRow(GUI_ACTION_NEW); - drawKeybindSettingsTableRow(GUI_ACTION_CLEAR); - drawKeybindSettingsTableRow(GUI_ACTION_OPEN); - drawKeybindSettingsTableRow(GUI_ACTION_OPEN_BACKUP); - drawKeybindSettingsTableRow(GUI_ACTION_SAVE); - drawKeybindSettingsTableRow(GUI_ACTION_SAVE_AS); - drawKeybindSettingsTableRow(GUI_ACTION_EXPORT); - drawKeybindSettingsTableRow(GUI_ACTION_UNDO); - drawKeybindSettingsTableRow(GUI_ACTION_REDO); - drawKeybindSettingsTableRow(GUI_ACTION_PLAY_TOGGLE); - drawKeybindSettingsTableRow(GUI_ACTION_PLAY); - drawKeybindSettingsTableRow(GUI_ACTION_STOP); - drawKeybindSettingsTableRow(GUI_ACTION_PLAY_START); - drawKeybindSettingsTableRow(GUI_ACTION_PLAY_REPEAT); - drawKeybindSettingsTableRow(GUI_ACTION_PLAY_CURSOR); - drawKeybindSettingsTableRow(GUI_ACTION_STEP_ONE); - drawKeybindSettingsTableRow(GUI_ACTION_OCTAVE_UP); - drawKeybindSettingsTableRow(GUI_ACTION_OCTAVE_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_INS_UP); - drawKeybindSettingsTableRow(GUI_ACTION_INS_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_STEP_UP); - drawKeybindSettingsTableRow(GUI_ACTION_STEP_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_TOGGLE_EDIT); - drawKeybindSettingsTableRow(GUI_ACTION_METRONOME); - drawKeybindSettingsTableRow(GUI_ACTION_REPEAT_PATTERN); - drawKeybindSettingsTableRow(GUI_ACTION_FOLLOW_ORDERS); - drawKeybindSettingsTableRow(GUI_ACTION_FOLLOW_PATTERN); - drawKeybindSettingsTableRow(GUI_ACTION_FULLSCREEN); - drawKeybindSettingsTableRow(GUI_ACTION_TX81Z_REQUEST); - drawKeybindSettingsTableRow(GUI_ACTION_PANIC); + applyUISettings(false); + SETTINGS_CHANGED; + } + }), + SETTING(_("Don't raise pattern editor on click"),{ + bool avoidRaisingPatternB=settings.avoidRaisingPattern; + if (ImGui::Checkbox(_("Don't raise pattern editor on click"),&avoidRaisingPatternB)) { + settings.avoidRaisingPattern=avoidRaisingPatternB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Focus pattern editor when selecting instrument"),{ + bool insFocusesPatternB=settings.insFocusesPattern; + if (ImGui::Checkbox(_("Focus pattern editor when selecting instrument"),&insFocusesPatternB)) { + settings.insFocusesPattern=insFocusesPatternB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Note preview behavior:"),{ + ImGui::Text(_("Note preview behavior:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Never##npb0"),settings.notePreviewBehavior==0)) { + settings.notePreviewBehavior=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("When cursor is in Note column##npb1"),settings.notePreviewBehavior==1)) { + settings.notePreviewBehavior=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("When cursor is in Note column or not in edit mode##npb2"),settings.notePreviewBehavior==2)) { + settings.notePreviewBehavior=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Always##npb3"),settings.notePreviewBehavior==3)) { + settings.notePreviewBehavior=3; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Allow dragging selection:"),{ + ImGui::Text(_("Allow dragging selection:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No##dms0"),settings.dragMovesSelection==0)) { + settings.dragMovesSelection=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes##dms1"),settings.dragMovesSelection==1)) { + settings.dragMovesSelection=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes (while holding Ctrl only)##dms2"),settings.dragMovesSelection==2)) { + settings.dragMovesSelection=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Toggle channel solo on:"),{ + ImGui::Text(_("Toggle channel solo on:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Right-click or double-click##soloA"),settings.soloAction==0)) { + settings.soloAction=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Right-click##soloR"),settings.soloAction==1)) { + settings.soloAction=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Double-click##soloD"),settings.soloAction==2)) { + settings.soloAction=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Modifier for alternate wheel-scrolling (vertical/zoom/slider-input):"),{ + ImGui::Text(_("Modifier for alternate wheel-scrolling (vertical/zoom/slider-input):")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Ctrl or Meta/Cmd##cwm1"),settings.ctrlWheelModifier==0)) { + settings.ctrlWheelModifier=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Ctrl##cwm2"),settings.ctrlWheelModifier==1)) { + settings.ctrlWheelModifier=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Meta/Cmd##cwm3"),settings.ctrlWheelModifier==2)) { + settings.ctrlWheelModifier=2; + SETTINGS_CHANGED; + } + // technically this key is called Option on mac, but we call it Alt in getKeyName(s) + if (ImGui::RadioButton(_("Alt##cwm4"),settings.ctrlWheelModifier==3)) { + settings.ctrlWheelModifier=3; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Double click selects entire column"),{ + bool doubleClickColumnB=settings.doubleClickColumn; + if (ImGui::Checkbox(_("Double click selects entire column"),&doubleClickColumnB)) { + settings.doubleClickColumn=doubleClickColumnB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Cursor behavior"),{},{ + SETTING(_("Insert pushes entire channel row"),{ + bool insertBehaviorB=settings.insertBehavior; + if (ImGui::Checkbox(_("Insert pushes entire channel row"),&insertBehaviorB)) { + settings.insertBehavior=insertBehaviorB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Pull delete affects entire channel row"),{ + bool pullDeleteRowB=settings.pullDeleteRow; + if (ImGui::Checkbox(_("Pull delete affects entire channel row"),&pullDeleteRowB)) { + settings.pullDeleteRow=pullDeleteRowB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Push value when overwriting instead of clearing it"),{ + bool pushNibbleB=settings.pushNibble; + if (ImGui::Checkbox(_("Push value when overwriting instead of clearing it"),&pushNibbleB)) { + settings.pushNibble=pushNibbleB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Keyboard note/value input repeat (hold key to input continuously)"),{ + bool inputRepeatB=settings.inputRepeat; + if (ImGui::Checkbox(_("Keyboard note/value input repeat (hold key to input continuously)"),&inputRepeatB)) { + settings.inputRepeat=inputRepeatB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Effect input behavior:"),{ + ImGui::Text(_("Effect input behavior:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Move down##eicb0"),settings.effectCursorDir==0)) { + settings.effectCursorDir=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Move to effect value (otherwise move down)##eicb1"),settings.effectCursorDir==1)) { + settings.effectCursorDir=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Move to effect value/next effect and wrap around##eicb2"),settings.effectCursorDir==2)) { + settings.effectCursorDir=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Delete effect value when deleting effect"),{ + bool effectDeletionAltersValueB=settings.effectDeletionAltersValue; + if (ImGui::Checkbox(_("Delete effect value when deleting effect"),&effectDeletionAltersValueB)) { + settings.effectDeletionAltersValue=effectDeletionAltersValueB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Change current instrument when changing instrument column (absorb)"),{ + bool absorbInsInputB=settings.absorbInsInput; + if (ImGui::Checkbox(_("Change current instrument when changing instrument column (absorb)"),&absorbInsInputB)) { + settings.absorbInsInput=absorbInsInputB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Remove instrument value when inserting note off/release"),{ + bool removeInsOffB=settings.removeInsOff; + if (ImGui::Checkbox(_("Remove instrument value when inserting note off/release"),&removeInsOffB)) { + settings.removeInsOff=removeInsOffB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Remove volume value when inserting note off/release"),{ + bool removeVolOffB=settings.removeVolOff; + if (ImGui::Checkbox(_("Remove volume value when inserting note off/release"),&removeVolOffB)) { + settings.removeVolOff=removeVolOffB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Cursor movement"),{},{ + SETTING(_("Wrap horizontally:"),{ + ImGui::Text(_("Wrap horizontally:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No##wrapH0"),settings.wrapHorizontal==0)) { + settings.wrapHorizontal=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes##wrapH1"),settings.wrapHorizontal==1)) { + settings.wrapHorizontal=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes, and move to next/prev row##wrapH2"),settings.wrapHorizontal==2)) { + settings.wrapHorizontal=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Wrap vertically:"),{ + ImGui::Text(_("Wrap vertically:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No##wrapV0"),settings.wrapVertical==0)) { + settings.wrapVertical=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes##wrapV1"),settings.wrapVertical==1)) { + settings.wrapVertical=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes, and move to next/prev pattern##wrapV2"),settings.wrapVertical==2)) { + settings.wrapVertical=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes, and move to next/prev pattern (wrap around)##wrapV2"),settings.wrapVertical==3)) { + settings.wrapVertical=3; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Cursor movement keys behavior:"),{ + ImGui::Text(_("Cursor movement keys behavior:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Move by one##cmk0"),settings.scrollStep==0)) { + settings.scrollStep=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Move by Edit Step##cmk1"),settings.scrollStep==1)) { + settings.scrollStep=1; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Move cursor by edit step on delete"),{ + bool stepOnDeleteB=settings.stepOnDelete; + if (ImGui::Checkbox(_("Move cursor by edit step on delete"),&stepOnDeleteB)) { + settings.stepOnDelete=stepOnDeleteB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Move cursor by edit step on insert (push)"),{ + bool stepOnInsertB=settings.stepOnInsert; + if (ImGui::Checkbox(_("Move cursor by edit step on insert (push)"),&stepOnInsertB)) { + settings.stepOnInsert=stepOnInsertB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Move cursor up on backspace-delete"),{ + bool pullDeleteBehaviorB=settings.pullDeleteBehavior; + if (ImGui::Checkbox(_("Move cursor up on backspace-delete"),&pullDeleteBehaviorB)) { + settings.pullDeleteBehavior=pullDeleteBehaviorB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Move cursor to end of clipboard content when pasting"),{ + bool cursorPastePosB=settings.cursorPastePos; + if (ImGui::Checkbox(_("Move cursor to end of clipboard content when pasting"),&cursorPastePosB)) { + settings.cursorPastePos=cursorPastePosB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Scrolling"),{},{ + SETTING(_("Change order when scrolling outside of pattern bounds:"),{ + ImGui::Text(_("Change order when scrolling outside of pattern bounds:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No##pscroll0"),settings.scrollChangesOrder==0)) { + settings.scrollChangesOrder=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes##pscroll1"),settings.scrollChangesOrder==1)) { + settings.scrollChangesOrder=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes, and wrap around song##pscroll2"),settings.scrollChangesOrder==2)) { + settings.scrollChangesOrder=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Cursor follows current order when moving it"),{ + bool cursorFollowsOrderB=settings.cursorFollowsOrder; + if (ImGui::Checkbox(_("Cursor follows current order when moving it"),&cursorFollowsOrderB)) { + settings.cursorFollowsOrder=cursorFollowsOrderB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("applies when playback is stopped.")); + } + }), + SETTING(_("Don't scroll when moving cursor"),{ + bool cursorMoveNoScrollB=settings.cursorMoveNoScroll; + if (ImGui::Checkbox(_("Don't scroll when moving cursor"),&cursorMoveNoScrollB)) { + settings.cursorMoveNoScroll=cursorMoveNoScrollB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Move cursor with scroll wheel:"),{ + ImGui::Text(_("Move cursor with scroll wheel:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No##csw0"),settings.cursorFollowsWheel==0)) { + settings.cursorFollowsWheel=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Yes##csw1"),settings.cursorFollowsWheel==1)) { + settings.cursorFollowsWheel=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Inverted##csw2"),settings.cursorFollowsWheel==2)) { + settings.cursorFollowsWheel=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING_COND(_("How many steps to move with each scroll wheel step?"),{ + ImGui::Text(_("How many steps to move with each scroll wheel step?")); + if (ImGui::RadioButton(_("One##cws0"),settings.cursorWheelStep==0)) { + settings.cursorWheelStep=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Edit Step##cws1"),settings.cursorWheelStep==1)) { + settings.cursorWheelStep=1; + SETTINGS_CHANGED; + } + },settings.cursorFollowsWheel) + }), + SettingsCategory(_("Assets"),{},{ + SETTING(_("Display instrument type menu when adding instrument"),{ + bool insTypeMenuB=settings.insTypeMenu; + if (ImGui::Checkbox(_("Display instrument type menu when adding instrument"),&insTypeMenuB)) { + settings.insTypeMenu=insTypeMenuB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Select asset after opening one"),{ + bool selectAssetOnLoadB=settings.selectAssetOnLoad; + if (ImGui::Checkbox(_("Select asset after opening one"),&selectAssetOnLoadB)) { + settings.selectAssetOnLoad=selectAssetOnLoadB; + SETTINGS_CHANGED; + } + }) + }) + },{}), + SettingsCategory(_("Appearance"),{ + SettingsCategory(_("Scaling"),{},{ + SETTING(_("Automatic UI scaling factor"),{ + bool dpiScaleAuto=(settings.dpiScale<0.5f); + if (ImGui::Checkbox(_("Automatic UI scaling factor"),&dpiScaleAuto)) { + if (dpiScaleAuto) { + settings.dpiScale=0.0f; + } else { + settings.dpiScale=1.0f; + } + SETTINGS_CHANGED; + } + }), + SETTING_COND(_("UI scaling factor"),{ + if (ImGui::SliderFloat(_("UI scaling factor"),&settings.dpiScale,1.0f,3.0f,"%.2fx")) { + if (settings.dpiScale<0.5f) settings.dpiScale=0.5f; + if (settings.dpiScale>3.0f) settings.dpiScale=3.0f; + SETTINGS_CHANGED; + } rightClickable + },!(settings.dpiScale<0.5f)), + SETTING(_("Icon size"),{ + if (ImGui::InputInt(_("Icon size"),&settings.iconSize,1,3)) { + if (settings.iconSize<3) settings.iconSize=3; + if (settings.iconSize>48) settings.iconSize=48; + SETTINGS_CHANGED; + } + }), + }), + SettingsCategory(_("Text"),{},{ +#ifdef HAVE_FREETYPE + SETTING(_("Font renderer"),{ + if (ImGui::Combo(_("Font renderer"),&settings.fontBackend,fontBackends,2)) SETTINGS_CHANGED; + }), +#else + SETTING(NULL,{settings.fontBackend=0;}), +#endif + SETTING_SEPARATOR, + SETTING(_("Main font"),{ + if (ImGui::Combo(_("Main font"),&settings.mainFont,LocalizedComboGetter,mainFonts,7)) SETTINGS_CHANGED; + }), + SETTING_COND(_("Main font"),{ + ImGui::InputText("##MainFontPath",&settings.mainFontPath); + ImGui::SameLine(); + if (ImGui::Button(ICON_FA_FOLDER "##MainFontLoad")) { + openFileDialog(GUI_FILE_LOAD_MAIN_FONT); + SETTINGS_CHANGED; + } + },settings.mainFont==6), + SETTING(_("Main font size"),{ + if (ImGui::InputInt(_("Main font size"),&settings.mainFontSize,1,3)) { + if (settings.mainFontSize<3) settings.mainFontSize=3; + if (settings.mainFontSize>96) settings.mainFontSize=96; + SETTINGS_CHANGED; + } + }), + SETTING_NEWLINE, + SETTING(_("Header font"),{ + if (ImGui::Combo(_("Header font"),&settings.headFont,LocalizedComboGetter,mainFonts,7)) SETTINGS_CHANGED; + }), + SETTING_COND(_("Header font"),{ + ImGui::InputText("##HeadFontPath",&settings.headFontPath); + ImGui::SameLine(); + if (ImGui::Button(ICON_FA_FOLDER "##HeadFontLoad")) { + openFileDialog(GUI_FILE_LOAD_HEAD_FONT); + SETTINGS_CHANGED; + } + },settings.headFont==6), + SETTING(_("Header font size"),{ + if (ImGui::InputInt(_("Header font size"),&settings.headFontSize,1,3)) { + if (settings.headFontSize<3) settings.headFontSize=3; + if (settings.headFontSize>96) settings.headFontSize=96; + SETTINGS_CHANGED; + } + }), + SETTING_NEWLINE, + SETTING(_("Pattern font"),{ + if (ImGui::Combo(_("Pattern font"),&settings.patFont,LocalizedComboGetter,mainFonts,7)) SETTINGS_CHANGED; + }), + SETTING_COND(_("Pattern font"),{ + ImGui::InputText("##PatFontPath",&settings.patFontPath); + ImGui::SameLine(); + if (ImGui::Button(ICON_FA_FOLDER "##PatFontLoad")) { + openFileDialog(GUI_FILE_LOAD_PAT_FONT); + SETTINGS_CHANGED; + } + },settings.patFont==6), + SETTING(_("Pattern font size"),{ + if (ImGui::InputInt(_("Pattern font size"),&settings.patFontSize,1,3)) { + if (settings.patFontSize<3) settings.patFontSize=3; + if (settings.patFontSize>96) settings.patFontSize=96; + SETTINGS_CHANGED; + } + }), + SETTING_COND(_("Anti-aliased fonts"),{ + bool fontAntiAliasB=settings.fontAntiAlias; + if (ImGui::Checkbox(_("Anti-aliased fonts"),&fontAntiAliasB)) { + settings.fontAntiAlias=fontAntiAliasB; + SETTINGS_CHANGED; + } + },settings.fontBackend==1), + SETTING_COND(_("Support bitmap fonts"),{ + bool fontBitmapB=settings.fontBitmap; + if (ImGui::Checkbox(_("Support bitmap fonts"),&fontBitmapB)) { + settings.fontBitmap=fontBitmapB; + SETTINGS_CHANGED; + } + },settings.fontBackend==1), + SETTING_COND(_("Hinting:"),{ + ImGui::Text(_("Hinting:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Off (soft)##fh0"),settings.fontHinting==0)) { + settings.fontHinting=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Slight##fh1"),settings.fontHinting==1)) { + settings.fontHinting=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Normal##fh2"),settings.fontHinting==2)) { + settings.fontHinting=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Full (hard)##fh3"),settings.fontHinting==3)) { + settings.fontHinting=3; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + },settings.fontBackend==1), + SETTING_COND(_("Auto-hinter:"),{ + ImGui::Text(_("Auto-hinter:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Disable##fah0"),settings.fontAutoHint==0)) { + settings.fontAutoHint=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Enable##fah1"),settings.fontAutoHint==1)) { + settings.fontAutoHint=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Force##fah2"),settings.fontAutoHint==2)) { + settings.fontAutoHint=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + },settings.fontBackend==1), + SETTING(_("Oversample"),{ + ImGui::Text(_("Oversample")); - KEYBIND_CONFIG_END; - ImGui::TreePop(); + ImGui::SameLine(); + if (ImGui::RadioButton(_("1×##fos1"),settings.fontOversample==1)) { + settings.fontOversample=1; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("saves video memory. reduces font rendering quality.\nuse for pixel/bitmap fonts.")); + } + ImGui::SameLine(); + if (ImGui::RadioButton(_("2×##fos2"),settings.fontOversample==2)) { + settings.fontOversample=2; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("default.")); + } + ImGui::SameLine(); + if (ImGui::RadioButton(_("3×##fos3"),settings.fontOversample==3)) { + settings.fontOversample=3; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("slightly better font rendering quality.\nuses more video memory.")); + } + }), + SETTING(_("Load fallback font"),{ + bool loadFallbackB=settings.loadFallback; + if (ImGui::Checkbox(_("Load fallback font"),&loadFallbackB)) { + settings.loadFallback=loadFallbackB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_("disable to save video memory.")); + } + }), + SETTING(_("Display Japanese characters"),{ + bool loadJapaneseB=settings.loadJapanese; + if (ImGui::Checkbox(_("Display Japanese characters"),&loadJapaneseB)) { + settings.loadJapanese=loadJapaneseB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_( + "Only toggle this option if you have enough graphics memory.\n" + "This is a temporary solution until dynamic font atlas is implemented in Dear ImGui.\n\n" + "このオプションは、十分なグラフィックメモリがある場合にのみ切り替えてください。\n" + "これは、Dear ImGuiにダイナミックフォントアトラスが実装されるまでの一時的な解決策です。" + )); + } + }), + SETTING(_("Display Chinese (Simplified) characters"),{ + bool loadChineseB=settings.loadChinese; + if (ImGui::Checkbox(_("Display Chinese (Simplified) characters"),&loadChineseB)) { + settings.loadChinese=loadChineseB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_( + "Only toggle this option if you have enough graphics memory.\n" + "This is a temporary solution until dynamic font atlas is implemented in Dear ImGui.\n\n" + "请在确保你有足够的显存后再启动此设定\n" + "这是一个在ImGui实现动态字体加载之前的临时解决方案" + )); + } + }), + SETTING(_("Display Chinese (Traditional) characters"),{ + bool loadChineseTraditionalB=settings.loadChineseTraditional; + if (ImGui::Checkbox(_("Display Chinese (Traditional) characters"),&loadChineseTraditionalB)) { + settings.loadChineseTraditional=loadChineseTraditionalB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_( + "Only toggle this option if you have enough graphics memory.\n" + "This is a temporary solution until dynamic font atlas is implemented in Dear ImGui.\n\n" + "請在確保你有足夠的顯存后再啟動此設定\n" + "這是一個在ImGui實現動態字體加載之前的臨時解決方案" + )); + } + }), + SETTING(_("Display Korean characters"),{ + bool loadKoreanB=settings.loadKorean; + if (ImGui::Checkbox(_("Display Korean characters"),&loadKoreanB)) { + settings.loadKorean=loadKoreanB; + SETTINGS_CHANGED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip(_( + "Only toggle this option if you have enough graphics memory.\n" + "This is a temporary solution until dynamic font atlas is implemented in Dear ImGui.\n\n" + "그래픽 메모리가 충분한 경우에만 이 옵션을 선택하십시오.\n" + "이 옵션은 Dear ImGui에 동적 글꼴 아틀라스가 구현될 때까지 임시 솔루션입니다." + )); + } + }) + }), + SettingsCategory(_("Program"),{},{ + SETTING(_("Title bar:"),{ + ImGui::Text(_("Title bar:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Furnace##tbar0"),settings.titleBarInfo==0)) { + settings.titleBarInfo=0; + updateWindowTitle(); + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Song Name - Furnace##tbar1"),settings.titleBarInfo==1)) { + settings.titleBarInfo=1; + updateWindowTitle(); + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("file_name.fur - Furnace##tbar2"),settings.titleBarInfo==2)) { + settings.titleBarInfo=2; + updateWindowTitle(); + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("/path/to/file.fur - Furnace##tbar3"),settings.titleBarInfo==3)) { + settings.titleBarInfo=3; + updateWindowTitle(); + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Display system name on title bar"),{ + bool titleBarSysB=settings.titleBarSys; + if (ImGui::Checkbox(_("Display system name on title bar"),&titleBarSysB)) { + settings.titleBarSys=titleBarSysB; + updateWindowTitle(); + SETTINGS_CHANGED; + } + }), + SETTING(_("Display chip names instead of \"multi-system\" in title bar"),{ + bool noMultiSystemB=settings.noMultiSystem; + if (ImGui::Checkbox(_("Display chip names instead of \"multi-system\" in title bar"),&noMultiSystemB)) { + settings.noMultiSystem=noMultiSystemB; + updateWindowTitle(); + SETTINGS_CHANGED; + } + }), + SETTING(_("Status bar:"),{ + ImGui::Text(_("Status bar:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Cursor details##sbar0"),settings.statusDisplay==0)) { + settings.statusDisplay=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("File path##sbar1"),settings.statusDisplay==1)) { + settings.statusDisplay=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Cursor details or file path##sbar2"),settings.statusDisplay==2)) { + settings.statusDisplay=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Nothing##sbar3"),settings.statusDisplay==3)) { + settings.statusDisplay=3; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Display playback status when playing"),{ + bool playbackTimeB=settings.playbackTime; + if (ImGui::Checkbox(_("Display playback status when playing"),&playbackTimeB)) { + settings.playbackTime=playbackTimeB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Export options layout:"),{ + ImGui::Text(_("Export options layout:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Sub-menus in File menu##eol0"),settings.exportOptionsLayout==0)) { + settings.exportOptionsLayout=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Modal window with tabs##eol1"),settings.exportOptionsLayout==1)) { + settings.exportOptionsLayout=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Modal windows with options in File menu##eol2"),settings.exportOptionsLayout==2)) { + settings.exportOptionsLayout=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Capitalize menu bar"),{ + bool capitalMenuBarB=settings.capitalMenuBar; + if (ImGui::Checkbox(_("Capitalize menu bar"),&capitalMenuBarB)) { + settings.capitalMenuBar=capitalMenuBarB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Display add/configure/change/remove chip menus in File menu"),{ + bool classicChipOptionsB=settings.classicChipOptions; + if (ImGui::Checkbox(_("Display add/configure/change/remove chip menus in File menu"),&classicChipOptionsB)) { + settings.classicChipOptions=classicChipOptionsB; + SETTINGS_CHANGED; } - if (ImGui::TreeNode(_("Window activation"))) { - KEYBIND_CONFIG_BEGIN("keysWindow"); - - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_FIND); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SETTINGS); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SONG_INFO); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SUBSONGS); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SPEED); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_INS_LIST); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_WAVE_LIST); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SAMPLE_LIST); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_ORDERS); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_PATTERN); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_MIXER); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_GROOVES); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CHANNELS); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_PAT_MANAGER); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SYS_MANAGER); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_COMPAT_FLAGS); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_NOTES); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_INS_EDIT); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_WAVE_EDIT); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SAMPLE_EDIT); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_EDIT_CONTROLS); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_PIANO); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_OSCILLOSCOPE); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CHAN_OSC); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_XY_OSC); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_VOL_METER); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CLOCK); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_REGISTER_VIEW); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_LOG); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_STATS); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_MEMORY); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_EFFECT_LIST); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_DEBUG); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CS_PLAYER); - drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_ABOUT); - drawKeybindSettingsTableRow(GUI_ACTION_COLLAPSE_WINDOW); - drawKeybindSettingsTableRow(GUI_ACTION_CLOSE_WINDOW); - - drawKeybindSettingsTableRow(GUI_ACTION_COMMAND_PALETTE); - drawKeybindSettingsTableRow(GUI_ACTION_CMDPAL_RECENT); - drawKeybindSettingsTableRow(GUI_ACTION_CMDPAL_INSTRUMENTS); - drawKeybindSettingsTableRow(GUI_ACTION_CMDPAL_SAMPLES); - - KEYBIND_CONFIG_END; - ImGui::TreePop(); + }) + }), + SettingsCategory(_("Orders"),{},{ + // sorry. temporarily disabled until ImGui has a way to add separators in tables arbitrarily. + /*bool sysSeparatorsB=settings.sysSeparators; + if (ImGui::Checkbox(_("Add separators between systems in Orders"),&sysSeparatorsB)) { + settings.sysSeparators=sysSeparatorsB; + }*/ + SETTING(_("Highlight channel at cursor in Orders"),{ + bool ordersCursorB=settings.ordersCursor; + if (ImGui::Checkbox(_("Highlight channel at cursor in Orders"),&ordersCursorB)) { + settings.ordersCursor=ordersCursorB; + SETTINGS_CHANGED; } - if (ImGui::TreeNode(_("Note input"))) { - std::vector sorted; - if (ImGui::BeginTable("keysNoteInput",4)) { - for (std::map::value_type& i: noteKeys) { - std::vector::iterator j; - for (j=sorted.begin(); j!=sorted.end(); j++) { - if (j->val>i.second) { - break; - } - } - sorted.insert(j,MappedInput(i.first,i.second)); - } - - static char id[4096]; - - ImGui::TableNextRow(ImGuiTableRowFlags_Headers); - ImGui::TableNextColumn(); - ImGui::Text(_("Key")); - ImGui::TableNextColumn(); - ImGui::Text(_("Type")); - ImGui::TableNextColumn(); - ImGui::Text(_("Value")); - ImGui::TableNextColumn(); - ImGui::Text(_("Remove")); - - for (MappedInput& i: sorted) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("%s",SDL_GetScancodeName((SDL_Scancode)i.scan)); - ImGui::TableNextColumn(); - if (i.val==102) { - snprintf(id,4095,_("Macro release##SNType_%d"),i.scan); - if (ImGui::Button(id)) { - noteKeys[i.scan]=0; - } - } else if (i.val==101) { - snprintf(id,4095,_("Note release##SNType_%d"),i.scan); - if (ImGui::Button(id)) { - noteKeys[i.scan]=102; - } - } else if (i.val==100) { - snprintf(id,4095,_("Note off##SNType_%d"),i.scan); - if (ImGui::Button(id)) { - noteKeys[i.scan]=101; - } - } else { - snprintf(id,4095,_("Note##SNType_%d"),i.scan); - if (ImGui::Button(id)) { - noteKeys[i.scan]=100; - } - } - ImGui::TableNextColumn(); - if (i.val<100) { - snprintf(id,4095,"##SNValue_%d",i.scan); - if (ImGui::InputInt(id,&i.val,1,12)) { - if (i.val<0) i.val=0; - if (i.val>96) i.val=96; - noteKeys[i.scan]=i.val; - SETTINGS_CHANGED; - } - } - ImGui::TableNextColumn(); - snprintf(id,4095,ICON_FA_TIMES "##SNRemove_%d",i.scan); - if (ImGui::Button(id)) { - noteKeys.erase(i.scan); - SETTINGS_CHANGED; - } - } - ImGui::EndTable(); - - if (ImGui::BeginCombo("##SNAddNew",_("Add..."))) { - for (int i=0; i32) settings.noteCellSpacing=32; + SETTINGS_CHANGED; + } + }), + SETTING(_("Instrument"),{ + if (CWSliderInt(_("Instrument"),&settings.insCellSpacing,0,32)) { + if (settings.insCellSpacing<0) settings.insCellSpacing=0; + if (settings.insCellSpacing>32) settings.insCellSpacing=32; + SETTINGS_CHANGED; + } + }), + SETTING(_("Volume"),{ + if (CWSliderInt(_("Volume"),&settings.volCellSpacing,0,32)) { + if (settings.volCellSpacing<0) settings.volCellSpacing=0; + if (settings.volCellSpacing>32) settings.volCellSpacing=32; + SETTINGS_CHANGED; + } + }), + SETTING(_("Effect"),{ + if (CWSliderInt(_("Effect"),&settings.effectCellSpacing,0,32)) { + if (settings.effectCellSpacing<0) settings.effectCellSpacing=0; + if (settings.effectCellSpacing>32) settings.effectCellSpacing=32; + SETTINGS_CHANGED; + } + }), + SETTING(_("Effect value"),{ + if (CWSliderInt(_("Effect value"),&settings.effectValCellSpacing,0,32)) { + if (settings.effectValCellSpacing<0) settings.effectValCellSpacing=0; + if (settings.effectValCellSpacing>32) settings.effectValCellSpacing=32; + SETTINGS_CHANGED; + } + }), + SETTING_SEPARATOR, + SETTING(_("Single-digit effects for 00-0F"),{ + bool oneDigitEffectsB=settings.oneDigitEffects; + if (ImGui::Checkbox(_("Single-digit effects for 00-0F"),&oneDigitEffectsB)) { + settings.oneDigitEffects=oneDigitEffectsB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Use flats instead of sharps"),{ + bool flatNotesB=settings.flatNotes; + if (ImGui::Checkbox(_("Use flats instead of sharps"),&flatNotesB)) { + settings.flatNotes=flatNotesB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Use German notation"),{ + bool germanNotationB=settings.germanNotation; + if (ImGui::Checkbox(_("Use German notation"),&germanNotationB)) { + settings.germanNotation=germanNotationB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Channel"),{},{ + SETTING(_("Channel style:"),{ + ImGui::Text(_("Channel style:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Classic##CHS0"),settings.channelStyle==0)) { + settings.channelStyle=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Line##CHS1"),settings.channelStyle==1)) { + settings.channelStyle=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Round##CHS2"),settings.channelStyle==2)) { + settings.channelStyle=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Split button##CHS3"),settings.channelStyle==3)) { + settings.channelStyle=3; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Square border##CH42"),settings.channelStyle==4)) { + settings.channelStyle=4; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Round border##CHS5"),settings.channelStyle==5)) { + settings.channelStyle=5; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Channel volume bar:"),{ + ImGui::Text(_("Channel volume bar:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("None##CHV0"),settings.channelVolStyle==0)) { + settings.channelVolStyle=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Simple##CHV1"),settings.channelVolStyle==1)) { + settings.channelVolStyle=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Stereo##CHV2"),settings.channelVolStyle==2)) { + settings.channelVolStyle=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Real##CHV3"),settings.channelVolStyle==3)) { + settings.channelVolStyle=3; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Real (stereo)##CHV4"),settings.channelVolStyle==4)) { + settings.channelVolStyle=4; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Channel feedback style:"),{ + ImGui::Text(_("Channel feedback style:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Off##CHF0"),settings.channelFeedbackStyle==0)) { + settings.channelFeedbackStyle=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Note##CHF1"),settings.channelFeedbackStyle==1)) { + settings.channelFeedbackStyle=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Volume##CHF2"),settings.channelFeedbackStyle==2)) { + settings.channelFeedbackStyle=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Active##CHF3"),settings.channelFeedbackStyle==3)) { + settings.channelFeedbackStyle=3; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Channel font:"),{ + ImGui::Text(_("Channel font:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Regular##CHFont0"),settings.channelFont==0)) { + settings.channelFont=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Monospace##CHFont1"),settings.channelFont==1)) { + settings.channelFont=1; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Center channel name"),{ + bool channelTextCenterB=settings.channelTextCenter; + if (ImGui::Checkbox(_("Center channel name"),&channelTextCenterB)) { + settings.channelTextCenter=channelTextCenterB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Channel colors:"),{ + ImGui::Text(_("Channel colors:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Single##CHC0"),settings.channelColors==0)) { + settings.channelColors=0; + SETTINGS_CHANGED; } - if (ImGui::TreeNode(_("Pattern"))) { - KEYBIND_CONFIG_BEGIN("keysPattern"); - - drawKeybindSettingsTableRow(GUI_ACTION_PAT_NOTE_UP); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_NOTE_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_OCTAVE_UP); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_OCTAVE_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_VALUE_UP); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_VALUE_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_VALUE_UP_COARSE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_VALUE_DOWN_COARSE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECT_ALL); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CUT); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_COPY); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE_MIX); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE_MIX_BG); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE_FLOOD); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE_OVERFLOW); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_UP); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_LEFT); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_RIGHT); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_UP_ONE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_DOWN_ONE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_LEFT_CHANNEL); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_RIGHT_CHANNEL); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_PREVIOUS_CHANNEL); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_NEXT_CHANNEL); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_BEGIN); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_END); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_UP_COARSE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_DOWN_COARSE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_UP); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_LEFT); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_RIGHT); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_UP_ONE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_DOWN_ONE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_BEGIN); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_END); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_UP_COARSE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_DOWN_COARSE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_MOVE_UP); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_MOVE_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_MOVE_LEFT_CHANNEL); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_MOVE_RIGHT_CHANNEL); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_DELETE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_PULL_DELETE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_INSERT); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_MUTE_CURSOR); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_SOLO_CURSOR); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_UNMUTE_ALL); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_NEXT_ORDER); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_PREV_ORDER); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_COLLAPSE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_INCREASE_COLUMNS); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_DECREASE_COLUMNS); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_INTERPOLATE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_FADE); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_INVERT_VALUES); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_FLIP_SELECTION); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_COLLAPSE_ROWS); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_EXPAND_ROWS); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_COLLAPSE_PAT); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_EXPAND_PAT); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_COLLAPSE_SONG); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_EXPAND_SONG); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_LATCH); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CLEAR_LATCH); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_ABSORB_INSTRUMENT); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_UNDO); - drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_REDO); - - KEYBIND_CONFIG_END; - ImGui::TreePop(); + if (ImGui::RadioButton(_("Channel type##CHC1"),settings.channelColors==1)) { + settings.channelColors=1; + SETTINGS_CHANGED; } - if (ImGui::TreeNode(_("Instrument list"))) { - KEYBIND_CONFIG_BEGIN("keysInsList"); - - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_ADD); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_DUPLICATE); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_OPEN); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_OPEN_REPLACE); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_SAVE); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_SAVE_DMP); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_MOVE_UP); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_MOVE_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_DELETE); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_EDIT); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_UP); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_DIR_VIEW); - - KEYBIND_CONFIG_END; - ImGui::TreePop(); + if (ImGui::RadioButton(_("Instrument type##CHC2"),settings.channelColors==2)) { + settings.channelColors=2; + SETTINGS_CHANGED; } - if (ImGui::TreeNode(_("Wavetable list"))) { - KEYBIND_CONFIG_BEGIN("keysWaveList"); - - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_ADD); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_DUPLICATE); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_OPEN); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_OPEN_REPLACE); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_SAVE); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_SAVE_DMW); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_SAVE_RAW); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_MOVE_UP); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_MOVE_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_DELETE); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_EDIT); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_UP); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_DIR_VIEW); - - KEYBIND_CONFIG_END; - ImGui::TreePop(); + ImGui::Unindent(); + }), + SETTING(_("Channel name colors:"),{ + ImGui::Text(_("Channel name colors:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Single##CTC0"),settings.channelTextColors==0)) { + settings.channelTextColors=0; + SETTINGS_CHANGED; } - if (ImGui::TreeNode(_("Sample list"))) { - KEYBIND_CONFIG_BEGIN("keysSampleList"); - - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_ADD); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DUPLICATE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_CREATE_WAVE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN_REPLACE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN_RAW); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN_REPLACE_RAW); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_SAVE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_SAVE_RAW); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_MOVE_UP); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_MOVE_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DELETE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_EDIT); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_UP); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_PREVIEW); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_STOP_PREVIEW); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DIR_VIEW); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_MAKE_MAP); - - KEYBIND_CONFIG_END; - ImGui::TreePop(); + if (ImGui::RadioButton(_("Channel type##CTC1"),settings.channelTextColors==1)) { + settings.channelTextColors=1; + SETTINGS_CHANGED; } - if (ImGui::TreeNode(_("Orders"))) { - KEYBIND_CONFIG_BEGIN("keysOrders"); - - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_UP); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_LEFT); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_RIGHT); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_INCREASE); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DECREASE); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_EDIT_MODE); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_LINK); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_ADD); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DUPLICATE); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DEEP_CLONE); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DUPLICATE_END); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DEEP_CLONE_END); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_REMOVE); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_MOVE_UP); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_MOVE_DOWN); - drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_REPLAY); - - KEYBIND_CONFIG_END; - ImGui::TreePop(); + if (ImGui::RadioButton(_("Instrument type##CTC2"),settings.channelTextColors==2)) { + settings.channelTextColors=2; + SETTINGS_CHANGED; } - if (ImGui::TreeNode(_("Sample editor"))) { - KEYBIND_CONFIG_BEGIN("keysSampleEdit"); - - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SELECT); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_DRAW); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_CUT); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_COPY); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PASTE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PASTE_REPLACE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PASTE_MIX); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SELECT_ALL); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_RESIZE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_RESAMPLE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_AMPLIFY); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_NORMALIZE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_FADE_IN); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_FADE_OUT); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_INSERT); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SILENCE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_DELETE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_TRIM); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_REVERSE); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_INVERT); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SIGN); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_FILTER); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PREVIEW); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_STOP_PREVIEW); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_ZOOM_IN); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_ZOOM_OUT); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_ZOOM_AUTO); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_MAKE_INS); - drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SET_LOOP); - - KEYBIND_CONFIG_END; - ImGui::TreePop(); + ImGui::Unindent(); + }) + }), + SettingsCategory(_("Assets"),{},{ + SETTING(_("Unified instrument/wavetable/sample list"),{ + bool unifiedDataViewB=settings.unifiedDataView; + if (ImGui::Checkbox(_("Unified instrument/wavetable/sample list"),&unifiedDataViewB)) { + settings.unifiedDataView=unifiedDataViewB; + SETTINGS_CHANGED; + } + if (settings.unifiedDataView) { + settings.horizontalDataView=0; + } + }), + SETTING(_("Horizontal instrument/wavetable list"),{ + ImGui::BeginDisabled(settings.unifiedDataView); + bool horizontalDataViewB=settings.horizontalDataView; + if (ImGui::Checkbox(_("Horizontal instrument/wavetable list"),&horizontalDataViewB)) { + settings.horizontalDataView=horizontalDataViewB; + SETTINGS_CHANGED; + } + ImGui::EndDisabled(); + }), + SETTING(_("Instrument list icon style:"),{ + ImGui::Text(_("Instrument list icon style:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("None##iis0"),settings.insIconsStyle==0)) { + settings.insIconsStyle=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Graphical icons##iis1"),settings.insIconsStyle==1)) { + settings.insIconsStyle=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Letter icons##iis2"),settings.insIconsStyle==2)) { + settings.insIconsStyle=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Colorize instrument editor using instrument type"),{ + bool insEditColorizeB=settings.insEditColorize; + if (ImGui::Checkbox(_("Colorize instrument editor using instrument type"),&insEditColorizeB)) { + settings.insEditColorize=insEditColorizeB; + SETTINGS_CHANGED; + } + }) + }), + SettingsCategory(_("Macro Editor"),{},{ + SETTING(_("Macro editor layout:"),{ + ImGui::Text(_("Macro editor layout:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Unified##mel0"),settings.macroLayout==0)) { + settings.macroLayout=0; + SETTINGS_CHANGED; + } + /* + if (ImGui::RadioButton(_("Tabs##mel1"),settings.macroLayout==1)) { + settings.macroLayout=1; + SETTINGS_CHANGED; + } + */ + if (ImGui::RadioButton(_("Grid##mel2"),settings.macroLayout==2)) { + settings.macroLayout=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Single (with list)##mel3"),settings.macroLayout==3)) { + settings.macroLayout=3; + SETTINGS_CHANGED; + } + /* + if (ImGui::RadioButton(_("Single (combo box)##mel4"),settings.macroLayout==4)) { + settings.macroLayout=4; + SETTINGS_CHANGED; + } + */ + ImGui::Unindent(); + }), + SETTING(_("Use classic macro editor vertical slider"),{ + bool oldMacroVSliderB=settings.oldMacroVSlider; + if (ImGui::Checkbox(_("Use classic macro editor vertical slider"),&oldMacroVSliderB)) { + settings.oldMacroVSlider=oldMacroVSliderB; + SETTINGS_CHANGED; + } + }), + SETTING(_("Macro step size/horizontal zoom:"),{ + ImGui::BeginDisabled(settings.macroLayout==2); + ImGui::Text(_("Macro step size/horizontal zoom:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Manual"),settings.autoMacroStepSize==0)) { + settings.autoMacroStepSize=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Automatic per macro"),settings.autoMacroStepSize==1)) { + settings.autoMacroStepSize=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Automatic (use longest macro)"),settings.autoMacroStepSize==2)) { + settings.autoMacroStepSize=2; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + ImGui::EndDisabled(); + }) + }), + SettingsCategory(_("Wave Editor"),{},{ + SETTING(_("Use compact wave editor"),{ + bool waveLayoutB=settings.waveLayout; + if (ImGui::Checkbox(_("Use compact wave editor"),&waveLayoutB)) { + settings.waveLayout=waveLayoutB; + SETTINGS_CHANGED; } - } - ImGui::EndChild(); - END_SECTION; - } - CONFIG_SECTION(_("Interface")) { - // SUBSECTION LAYOUT - CONFIG_SUBSECTION(_("Layout")); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Workspace layout:")); - ImGui::SameLine(); - if (ImGui::Button(_("Import"))) { - openFileDialog(GUI_FILE_IMPORT_LAYOUT); - } - ImGui::SameLine(); - if (ImGui::Button(_("Export"))) { - openFileDialog(GUI_FILE_EXPORT_LAYOUT); - } - ImGui::SameLine(); - if (ImGui::Button(_("Reset"))) { - showWarning(_("Are you sure you want to reset the workspace layout?"),GUI_WARN_RESET_LAYOUT); - } - - bool allowEditDockingB=settings.allowEditDocking; - if (ImGui::Checkbox(_("Allow docking editors"),&allowEditDockingB)) { - settings.allowEditDocking=allowEditDockingB; - SETTINGS_CHANGED; - } - -#ifndef IS_MOBILE - bool saveWindowPosB=settings.saveWindowPos; - if (ImGui::Checkbox(_("Remember window position"),&saveWindowPosB)) { - settings.saveWindowPos=saveWindowPosB; + }) + }), + SettingsCategory(_("FM Editor"),{},{ + SETTING(_("FM parameter names:"),{ + ImGui::Text(_("FM parameter names:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Friendly##fmn0"),settings.fmNames==0)) { + settings.fmNames=0; SETTINGS_CHANGED; } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("remembers the window's last position on start-up.")); + if (ImGui::RadioButton(_("Technical##fmn1"),settings.fmNames==1)) { + settings.fmNames=1; + SETTINGS_CHANGED; } -#endif - - bool moveWindowTitleB=settings.moveWindowTitle; - if (ImGui::Checkbox(_("Only allow window movement when clicking on title bar"),&moveWindowTitleB)) { - settings.moveWindowTitle=moveWindowTitleB; - applyUISettings(false); - SETTINGS_CHANGED; - } - - bool centerPopupB=settings.centerPopup; - if (ImGui::Checkbox(_("Center pop-up windows"),¢erPopupB)) { - settings.centerPopup=centerPopupB; - SETTINGS_CHANGED; - } - - ImGui::Text(_("Play/edit controls layout:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Classic##ecl0"),settings.controlLayout==0)) { - settings.controlLayout=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Compact##ecl1"),settings.controlLayout==1)) { - settings.controlLayout=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Compact (vertical)##ecl2"),settings.controlLayout==2)) { - settings.controlLayout=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Split##ecl3"),settings.controlLayout==3)) { - settings.controlLayout=3; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - ImGui::Text(_("Position of buttons in Orders:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Top##obp0"),settings.orderButtonPos==0)) { - settings.orderButtonPos=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Left##obp1"),settings.orderButtonPos==1)) { - settings.orderButtonPos=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Right##obp2"),settings.orderButtonPos==2)) { - settings.orderButtonPos=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - // SUBSECTION MOUSE - CONFIG_SUBSECTION(_("Mouse")); - - if (CWSliderFloat(_("Double-click time (seconds)"),&settings.doubleClickTime,0.02,1.0,"%.2f")) { - if (settings.doubleClickTime<0.02) settings.doubleClickTime=0.02; - if (settings.doubleClickTime>1.0) settings.doubleClickTime=1.0; - - applyUISettings(false); - SETTINGS_CHANGED; - } - - bool avoidRaisingPatternB=settings.avoidRaisingPattern; - if (ImGui::Checkbox(_("Don't raise pattern editor on click"),&avoidRaisingPatternB)) { - settings.avoidRaisingPattern=avoidRaisingPatternB; - SETTINGS_CHANGED; - } - - bool insFocusesPatternB=settings.insFocusesPattern; - if (ImGui::Checkbox(_("Focus pattern editor when selecting instrument"),&insFocusesPatternB)) { - settings.insFocusesPattern=insFocusesPatternB; - SETTINGS_CHANGED; - } - - ImGui::Text(_("Note preview behavior:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Never##npb0"),settings.notePreviewBehavior==0)) { - settings.notePreviewBehavior=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("When cursor is in Note column##npb1"),settings.notePreviewBehavior==1)) { - settings.notePreviewBehavior=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("When cursor is in Note column or not in edit mode##npb2"),settings.notePreviewBehavior==2)) { - settings.notePreviewBehavior=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Always##npb3"),settings.notePreviewBehavior==3)) { - settings.notePreviewBehavior=3; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - ImGui::Text(_("Allow dragging selection:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("No##dms0"),settings.dragMovesSelection==0)) { - settings.dragMovesSelection=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes##dms1"),settings.dragMovesSelection==1)) { - settings.dragMovesSelection=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes (while holding Ctrl only)##dms2"),settings.dragMovesSelection==2)) { - settings.dragMovesSelection=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - ImGui::Text(_("Toggle channel solo on:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Right-click or double-click##soloA"),settings.soloAction==0)) { - settings.soloAction=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Right-click##soloR"),settings.soloAction==1)) { - settings.soloAction=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Double-click##soloD"),settings.soloAction==2)) { - settings.soloAction=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - ImGui::Text(_("Modifier for alternate wheel-scrolling (vertical/zoom/slider-input):")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Ctrl or Meta/Cmd##cwm1"),settings.ctrlWheelModifier==0)) { - settings.ctrlWheelModifier=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Ctrl##cwm2"),settings.ctrlWheelModifier==1)) { - settings.ctrlWheelModifier=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Meta/Cmd##cwm3"),settings.ctrlWheelModifier==2)) { - settings.ctrlWheelModifier=2; - SETTINGS_CHANGED; - } - // technically this key is called Option on mac, but we call it Alt in getKeyName(s) - if (ImGui::RadioButton(_("Alt##cwm4"),settings.ctrlWheelModifier==3)) { - settings.ctrlWheelModifier=3; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - bool doubleClickColumnB=settings.doubleClickColumn; - if (ImGui::Checkbox(_("Double click selects entire column"),&doubleClickColumnB)) { - settings.doubleClickColumn=doubleClickColumnB; - SETTINGS_CHANGED; - } - - // SUBSECTION CURSOR BEHAVIOR - CONFIG_SUBSECTION(_("Cursor behavior")); - bool insertBehaviorB=settings.insertBehavior; - if (ImGui::Checkbox(_("Insert pushes entire channel row"),&insertBehaviorB)) { - settings.insertBehavior=insertBehaviorB; - SETTINGS_CHANGED; - } - - bool pullDeleteRowB=settings.pullDeleteRow; - if (ImGui::Checkbox(_("Pull delete affects entire channel row"),&pullDeleteRowB)) { - settings.pullDeleteRow=pullDeleteRowB; - SETTINGS_CHANGED; - } - - bool pushNibbleB=settings.pushNibble; - if (ImGui::Checkbox(_("Push value when overwriting instead of clearing it"),&pushNibbleB)) { - settings.pushNibble=pushNibbleB; - SETTINGS_CHANGED; - } - - bool inputRepeatB=settings.inputRepeat; - if (ImGui::Checkbox(_("Keyboard note/value input repeat (hold key to input continuously)"),&inputRepeatB)) { - settings.inputRepeat=inputRepeatB; - SETTINGS_CHANGED; - } - - ImGui::Text(_("Effect input behavior:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Move down##eicb0"),settings.effectCursorDir==0)) { - settings.effectCursorDir=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Move to effect value (otherwise move down)##eicb1"),settings.effectCursorDir==1)) { - settings.effectCursorDir=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Move to effect value/next effect and wrap around##eicb2"),settings.effectCursorDir==2)) { - settings.effectCursorDir=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - bool effectDeletionAltersValueB=settings.effectDeletionAltersValue; - if (ImGui::Checkbox(_("Delete effect value when deleting effect"),&effectDeletionAltersValueB)) { - settings.effectDeletionAltersValue=effectDeletionAltersValueB; - SETTINGS_CHANGED; - } - - bool absorbInsInputB=settings.absorbInsInput; - if (ImGui::Checkbox(_("Change current instrument when changing instrument column (absorb)"),&absorbInsInputB)) { - settings.absorbInsInput=absorbInsInputB; - SETTINGS_CHANGED; - } - - bool removeInsOffB=settings.removeInsOff; - if (ImGui::Checkbox(_("Remove instrument value when inserting note off/release"),&removeInsOffB)) { - settings.removeInsOff=removeInsOffB; - SETTINGS_CHANGED; - } - - bool removeVolOffB=settings.removeVolOff; - if (ImGui::Checkbox(_("Remove volume value when inserting note off/release"),&removeVolOffB)) { - settings.removeVolOff=removeVolOffB; - SETTINGS_CHANGED; - } - - // SUBSECTION CURSOR MOVEMENT - CONFIG_SUBSECTION(_("Cursor movement")); - - ImGui::Text(_("Wrap horizontally:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("No##wrapH0"),settings.wrapHorizontal==0)) { - settings.wrapHorizontal=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes##wrapH1"),settings.wrapHorizontal==1)) { - settings.wrapHorizontal=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes, and move to next/prev row##wrapH2"),settings.wrapHorizontal==2)) { - settings.wrapHorizontal=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - ImGui::Text(_("Wrap vertically:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("No##wrapV0"),settings.wrapVertical==0)) { - settings.wrapVertical=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes##wrapV1"),settings.wrapVertical==1)) { - settings.wrapVertical=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes, and move to next/prev pattern##wrapV2"),settings.wrapVertical==2)) { - settings.wrapVertical=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes, and move to next/prev pattern (wrap around)##wrapV2"),settings.wrapVertical==3)) { - settings.wrapVertical=3; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - ImGui::Text(_("Cursor movement keys behavior:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Move by one##cmk0"),settings.scrollStep==0)) { - settings.scrollStep=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Move by Edit Step##cmk1"),settings.scrollStep==1)) { - settings.scrollStep=1; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - bool stepOnDeleteB=settings.stepOnDelete; - if (ImGui::Checkbox(_("Move cursor by edit step on delete"),&stepOnDeleteB)) { - settings.stepOnDelete=stepOnDeleteB; - SETTINGS_CHANGED; - } - - bool stepOnInsertB=settings.stepOnInsert; - if (ImGui::Checkbox(_("Move cursor by edit step on insert (push)"),&stepOnInsertB)) { - settings.stepOnInsert=stepOnInsertB; - SETTINGS_CHANGED; - } - - bool pullDeleteBehaviorB=settings.pullDeleteBehavior; - if (ImGui::Checkbox(_("Move cursor up on backspace-delete"),&pullDeleteBehaviorB)) { - settings.pullDeleteBehavior=pullDeleteBehaviorB; - SETTINGS_CHANGED; - } - - bool cursorPastePosB=settings.cursorPastePos; - if (ImGui::Checkbox(_("Move cursor to end of clipboard content when pasting"),&cursorPastePosB)) { - settings.cursorPastePos=cursorPastePosB; - SETTINGS_CHANGED; - } - - // SUBSECTION SCROLLING - CONFIG_SUBSECTION(_("Scrolling")); - - ImGui::Text(_("Change order when scrolling outside of pattern bounds:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("No##pscroll0"),settings.scrollChangesOrder==0)) { - settings.scrollChangesOrder=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes##pscroll1"),settings.scrollChangesOrder==1)) { - settings.scrollChangesOrder=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes, and wrap around song##pscroll2"),settings.scrollChangesOrder==2)) { - settings.scrollChangesOrder=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - bool cursorFollowsOrderB=settings.cursorFollowsOrder; - if (ImGui::Checkbox(_("Cursor follows current order when moving it"),&cursorFollowsOrderB)) { - settings.cursorFollowsOrder=cursorFollowsOrderB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("applies when playback is stopped.")); - } - - bool cursorMoveNoScrollB=settings.cursorMoveNoScroll; - if (ImGui::Checkbox(_("Don't scroll when moving cursor"),&cursorMoveNoScrollB)) { - settings.cursorMoveNoScroll=cursorMoveNoScrollB; - SETTINGS_CHANGED; - } - - ImGui::Text(_("Move cursor with scroll wheel:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("No##csw0"),settings.cursorFollowsWheel==0)) { - settings.cursorFollowsWheel=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Yes##csw1"),settings.cursorFollowsWheel==1)) { - settings.cursorFollowsWheel=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Inverted##csw2"),settings.cursorFollowsWheel==2)) { - settings.cursorFollowsWheel=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - if (settings.cursorFollowsWheel) { - ImGui::Text(_("How many steps to move with each scroll wheel step?")); - if (ImGui::RadioButton(_("One##cws0"),settings.cursorWheelStep==0)) { - settings.cursorWheelStep=0; + if (ImGui::RadioButton(_("Technical (alternate)##fmn2"),settings.fmNames==2)) { + settings.fmNames=2; SETTINGS_CHANGED; } - if (ImGui::RadioButton(_("Edit Step##cws1"),settings.cursorWheelStep==1)) { - settings.cursorWheelStep=1; + ImGui::Unindent(); + }), + SETTING(_("Use standard OPL waveform names"),{ + bool oplStandardWaveNamesB=settings.oplStandardWaveNames; + if (ImGui::Checkbox(_("Use standard OPL waveform names"),&oplStandardWaveNamesB)) { + settings.oplStandardWaveNames=oplStandardWaveNamesB; SETTINGS_CHANGED; } - } - - // SUBSECTION ASSETS - CONFIG_SUBSECTION(_("Assets")); - - bool insTypeMenuB=settings.insTypeMenu; - if (ImGui::Checkbox(_("Display instrument type menu when adding instrument"),&insTypeMenuB)) { - settings.insTypeMenu=insTypeMenuB; - SETTINGS_CHANGED; - } - - bool selectAssetOnLoadB=settings.selectAssetOnLoad; - if (ImGui::Checkbox(_("Select asset after opening one"),&selectAssetOnLoadB)) { - settings.selectAssetOnLoad=selectAssetOnLoadB; - SETTINGS_CHANGED; - } - - END_SECTION; - } - CONFIG_SECTION(_("Appearance")) { - // SUBSECTION INTERFACE - CONFIG_SUBSECTION(_("Scaling")); - bool dpiScaleAuto=(settings.dpiScale<0.5f); - if (ImGui::Checkbox(_("Automatic UI scaling factor"),&dpiScaleAuto)) { - if (dpiScaleAuto) { - settings.dpiScale=0.0f; - } else { - settings.dpiScale=1.0f; + }), + SETTING(_("FM parameter editor layout:"),{ + ImGui::Text(_("FM parameter editor layout:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Modern##fml0"),settings.fmLayout==0)) { + settings.fmLayout=0; + SETTINGS_CHANGED; } - SETTINGS_CHANGED; - } - if (!dpiScaleAuto) { - if (ImGui::SliderFloat(_("UI scaling factor"),&settings.dpiScale,1.0f,3.0f,"%.2fx")) { - if (settings.dpiScale<0.5f) settings.dpiScale=0.5f; - if (settings.dpiScale>3.0f) settings.dpiScale=3.0f; + if (ImGui::RadioButton(_("Modern with more labels##fml7"),settings.fmLayout==7)) { + settings.fmLayout=7; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Compact (2x2, classic)##fml1"),settings.fmLayout==1)) { + settings.fmLayout=1; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Compact (1x4)##fml2"),settings.fmLayout==2)) { + settings.fmLayout=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Compact (4x1)##fml3"),settings.fmLayout==3)) { + settings.fmLayout=3; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Alternate (2x2)##fml4"),settings.fmLayout==4)) { + settings.fmLayout=4; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Alternate (1x4)##fml5"),settings.fmLayout==5)) { + settings.fmLayout=5; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Alternate (4x1)##fml5"),settings.fmLayout==6)) { + settings.fmLayout=6; + SETTINGS_CHANGED; + } + ImGui::Unindent(); + }), + SETTING(_("Position of Sustain in FM editor:"),{ + ImGui::Text(_("Position of Sustain in FM editor:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Between Decay and Sustain Rate##susp0"),settings.susPosition==0)) { + settings.susPosition=0; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("After Release Rate##susp1"),settings.susPosition==1)) { + settings.susPosition=1; + SETTINGS_CHANGED; + } + ImGui::BeginDisabled(settings.fmLayout!=0); + if (ImGui::RadioButton(_("After Release Rate, after spacing##susp2"),settings.susPosition==2)) { + settings.susPosition=2; + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("After TL##susp3"),settings.susPosition==3)) { + settings.susPosition=3; + SETTINGS_CHANGED; + } + ImGui::EndDisabled(); + ImGui::Unindent(); + }), + SETTING(_("Use separate colors for carriers/modulators in FM editor"),{ + bool separateFMColorsB=settings.separateFMColors; + if (ImGui::Checkbox(_("Use separate colors for carriers/modulators in FM editor"),&separateFMColorsB)) { + settings.separateFMColors=separateFMColorsB; SETTINGS_CHANGED; - } rightClickable - } - - if (ImGui::InputInt(_("Icon size"),&settings.iconSize,1,3)) { - if (settings.iconSize<3) settings.iconSize=3; - if (settings.iconSize>48) settings.iconSize=48; - SETTINGS_CHANGED; - } - - // SUBSECTION TEXT - CONFIG_SUBSECTION(_("Text")); - if (ImGui::BeginTable("##Text",2)) { - ImGui::TableSetupColumn("##Label",ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("##Combos",ImGuiTableColumnFlags_WidthStretch); -#ifdef HAVE_FREETYPE - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Font renderer")); - ImGui::TableNextColumn(); - if (ImGui::Combo("##FontBack",&settings.fontBackend,fontBackends,2)) SETTINGS_CHANGED; -#else - settings.fontBackend=0; -#endif - - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Main font")); - ImGui::TableNextColumn(); - if (ImGui::Combo("##MainFont",&settings.mainFont,LocalizedComboGetter,mainFonts,7)) SETTINGS_CHANGED; - if (settings.mainFont==6) { - ImGui::InputText("##MainFontPath",&settings.mainFontPath); - ImGui::SameLine(); - if (ImGui::Button(ICON_FA_FOLDER "##MainFontLoad")) { - openFileDialog(GUI_FILE_LOAD_MAIN_FONT); - SETTINGS_CHANGED; - } } - if (ImGui::InputInt(_("Size##MainFontSize"),&settings.mainFontSize,1,3)) { - if (settings.mainFontSize<3) settings.mainFontSize=3; - if (settings.mainFontSize>96) settings.mainFontSize=96; + }), + SETTING(_("Unsigned FM detune values"),{ + bool unsignedDetuneB=settings.unsignedDetune; + if (ImGui::Checkbox(_("Unsigned FM detune values"),&unsignedDetuneB)) { + settings.unsignedDetune=unsignedDetuneB; SETTINGS_CHANGED; } - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Header font")); - ImGui::TableNextColumn(); - if (ImGui::Combo("##HeadFont",&settings.headFont,LocalizedComboGetter,headFonts,7)) SETTINGS_CHANGED; - if (settings.headFont==6) { - ImGui::InputText("##HeadFontPath",&settings.headFontPath); - ImGui::SameLine(); - if (ImGui::Button(ICON_FA_FOLDER "##HeadFontLoad")) { - openFileDialog(GUI_FILE_LOAD_HEAD_FONT); - SETTINGS_CHANGED; - } + }) + }), + SettingsCategory(_("Memory Composition"),{},{ + SETTING(_("Chip memory usage unit:"),{ + ImGui::Text(_("Chip memory usage unit:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Bytes##MUU0"),settings.memUsageUnit==0)) { + settings.memUsageUnit=0; + SETTINGS_CHANGED; } - if (ImGui::InputInt(_("Size##HeadFontSize"),&settings.headFontSize,1,3)) { - if (settings.headFontSize<3) settings.headFontSize=3; - if (settings.headFontSize>96) settings.headFontSize=96; + if (ImGui::RadioButton(_("Kilobytes##MUU1"),settings.memUsageUnit==1)) { + settings.memUsageUnit=1; SETTINGS_CHANGED; } - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Pattern font")); - ImGui::TableNextColumn(); - if (ImGui::Combo("##PatFont",&settings.patFont,LocalizedComboGetter,patFonts,7)) SETTINGS_CHANGED; - if (settings.patFont==6) { - ImGui::InputText("##PatFontPath",&settings.patFontPath); - ImGui::SameLine(); - if (ImGui::Button(ICON_FA_FOLDER "##PatFontLoad")) { - openFileDialog(GUI_FILE_LOAD_PAT_FONT); - SETTINGS_CHANGED; - } + ImGui::Unindent(); + }) + }), + SettingsCategory(_("Oscilloscope"),{},{ + SETTING(_("Rounded corners"),{ + bool oscRoundedCornersB=settings.oscRoundedCorners; + if (ImGui::Checkbox(_("Rounded corners"),&oscRoundedCornersB)) { + settings.oscRoundedCorners=oscRoundedCornersB; + SETTINGS_CHANGED; } - if (ImGui::InputInt(_("Size##PatFontSize"),&settings.patFontSize,1,3)) { - if (settings.patFontSize<3) settings.patFontSize=3; - if (settings.patFontSize>96) settings.patFontSize=96; + }), + SETTING(_("Border"),{ + bool oscBorderB=settings.oscBorder; + if (ImGui::Checkbox(_("Border"),&oscBorderB)) { + settings.oscBorder=oscBorderB; SETTINGS_CHANGED; } - ImGui::EndTable(); - } - - if (settings.fontBackend==1) { - bool fontAntiAliasB=settings.fontAntiAlias; - if (ImGui::Checkbox(_("Anti-aliased fonts"),&fontAntiAliasB)) { - settings.fontAntiAlias=fontAntiAliasB; + }), + SETTING(_("Mono"),{ + bool oscMonoB=settings.oscMono; + if (ImGui::Checkbox(_("Mono"),&oscMonoB)) { + settings.oscMono=oscMonoB; SETTINGS_CHANGED; } - - bool fontBitmapB=settings.fontBitmap; - if (ImGui::Checkbox(_("Support bitmap fonts"),&fontBitmapB)) { - settings.fontBitmap=fontBitmapB; + }), + SETTING(_("Anti-aliased"),{ + bool oscAntiAliasB=settings.oscAntiAlias; + if (ImGui::Checkbox(_("Anti-aliased"),&oscAntiAliasB)) { + settings.oscAntiAlias=oscAntiAliasB; SETTINGS_CHANGED; } - - ImGui::Text(_("Hinting:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Off (soft)##fh0"),settings.fontHinting==0)) { - settings.fontHinting=0; + }), + SETTING(_("Fill entire window"),{ + bool oscTakesEntireWindowB=settings.oscTakesEntireWindow; + if (ImGui::Checkbox(_("Fill entire window"),&oscTakesEntireWindowB)) { + settings.oscTakesEntireWindow=oscTakesEntireWindowB; SETTINGS_CHANGED; } - if (ImGui::RadioButton(_("Slight##fh1"),settings.fontHinting==1)) { - settings.fontHinting=1; + }), + SETTING(_("Waveform goes out of bounds"),{ + bool oscEscapesBoundaryB=settings.oscEscapesBoundary; + if (ImGui::Checkbox(_("Waveform goes out of bounds"),&oscEscapesBoundaryB)) { + settings.oscEscapesBoundary=oscEscapesBoundaryB; SETTINGS_CHANGED; } - if (ImGui::RadioButton(_("Normal##fh2"),settings.fontHinting==2)) { - settings.fontHinting=2; + }), + SETTING(_("Line size"),{ + if (ImGui::SliderFloat(_("Line size"),&settings.oscLineSize,0.25f,16.0f,"%.1f")) { + if (settings.oscLineSize<0.25f) settings.oscLineSize=0.25f; + if (settings.oscLineSize>16.0f) settings.oscLineSize=16.0f; + SETTINGS_CHANGED; + } rightClickable + }) + }), + SettingsCategory(_("Windows"),{},{ + SETTING(_("Rounded window corners"),{ + bool roundedWindowsB=settings.roundedWindows; + if (ImGui::Checkbox(_("Rounded window corners"),&roundedWindowsB)) { + settings.roundedWindows=roundedWindowsB; SETTINGS_CHANGED; } - if (ImGui::RadioButton(_("Full (hard)##fh3"),settings.fontHinting==3)) { - settings.fontHinting=3; + }), + SETTING(_("Rounded buttons"),{ + bool roundedButtonsB=settings.roundedButtons; + if (ImGui::Checkbox(_("Rounded buttons"),&roundedButtonsB)) { + settings.roundedButtons=roundedButtonsB; SETTINGS_CHANGED; } - ImGui::Unindent(); - - ImGui::Text(_("Auto-hinter:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Disable##fah0"),settings.fontAutoHint==0)) { - settings.fontAutoHint=0; + }), + SETTING(_("Rounded menu corners"),{ + bool roundedMenusB=settings.roundedMenus; + if (ImGui::Checkbox(_("Rounded menu corners"),&roundedMenusB)) { + settings.roundedMenus=roundedMenusB; SETTINGS_CHANGED; } - if (ImGui::RadioButton(_("Enable##fah1"),settings.fontAutoHint==1)) { - settings.fontAutoHint=1; + }), + SETTING(_("Rounded tabs"),{ + bool roundedTabsB=settings.roundedTabs; + if (ImGui::Checkbox(_("Rounded tabs"),&roundedTabsB)) { + settings.roundedTabs=roundedTabsB; SETTINGS_CHANGED; } - if (ImGui::RadioButton(_("Force##fah2"),settings.fontAutoHint==2)) { - settings.fontAutoHint=2; + }), + SETTING(_("Rounded scrollbars"),{ + bool roundedScrollbarsB=settings.roundedScrollbars; + if (ImGui::Checkbox(_("Rounded scrollbars"),&roundedScrollbarsB)) { + settings.roundedScrollbars=roundedScrollbarsB; SETTINGS_CHANGED; } - ImGui::Unindent(); - } - - ImGui::Text(_("Oversample")); - - ImGui::SameLine(); - if (ImGui::RadioButton(_("1×##fos1"),settings.fontOversample==1)) { - settings.fontOversample=1; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("saves video memory. reduces font rendering quality.\nuse for pixel/bitmap fonts.")); - } - ImGui::SameLine(); - if (ImGui::RadioButton(_("2×##fos2"),settings.fontOversample==2)) { - settings.fontOversample=2; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("default.")); - } - ImGui::SameLine(); - if (ImGui::RadioButton(_("3×##fos3"),settings.fontOversample==3)) { - settings.fontOversample=3; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("slightly better font rendering quality.\nuses more video memory.")); - } - - bool loadFallbackB=settings.loadFallback; - if (ImGui::Checkbox(_("Load fallback font"),&loadFallbackB)) { - settings.loadFallback=loadFallbackB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_("disable to save video memory.")); - } - - bool loadJapaneseB=settings.loadJapanese; - if (ImGui::Checkbox(_("Display Japanese characters"),&loadJapaneseB)) { - settings.loadJapanese=loadJapaneseB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_( - "Only toggle this option if you have enough graphics memory.\n" - "This is a temporary solution until dynamic font atlas is implemented in Dear ImGui.\n\n" - "このオプションは、十分なグラフィックメモリがある場合にのみ切り替えてください。\n" - "これは、Dear ImGuiにダイナミックフォントアトラスが実装されるまでの一時的な解決策です。" - )); - } - - bool loadChineseB=settings.loadChinese; - if (ImGui::Checkbox(_("Display Chinese (Simplified) characters"),&loadChineseB)) { - settings.loadChinese=loadChineseB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_( - "Only toggle this option if you have enough graphics memory.\n" - "This is a temporary solution until dynamic font atlas is implemented in Dear ImGui.\n\n" - "请在确保你有足够的显存后再启动此设定\n" - "这是一个在ImGui实现动态字体加载之前的临时解决方案" - )); - } - - bool loadChineseTraditionalB=settings.loadChineseTraditional; - if (ImGui::Checkbox(_("Display Chinese (Traditional) characters"),&loadChineseTraditionalB)) { - settings.loadChineseTraditional=loadChineseTraditionalB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_( - "Only toggle this option if you have enough graphics memory.\n" - "This is a temporary solution until dynamic font atlas is implemented in Dear ImGui.\n\n" - "請在確保你有足夠的顯存后再啟動此設定\n" - "這是一個在ImGui實現動態字體加載之前的臨時解決方案" - )); - } - - bool loadKoreanB=settings.loadKorean; - if (ImGui::Checkbox(_("Display Korean characters"),&loadKoreanB)) { - settings.loadKorean=loadKoreanB; - SETTINGS_CHANGED; - } - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip(_( - "Only toggle this option if you have enough graphics memory.\n" - "This is a temporary solution until dynamic font atlas is implemented in Dear ImGui.\n\n" - "그래픽 메모리가 충분한 경우에만 이 옵션을 선택하십시오.\n" - "이 옵션은 Dear ImGui에 동적 글꼴 아틀라스가 구현될 때까지 임시 솔루션입니다." - )); - } - - // SUBSECTION PROGRAM - CONFIG_SUBSECTION(_("Program")); - ImGui::Text(_("Title bar:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Furnace##tbar0"),settings.titleBarInfo==0)) { - settings.titleBarInfo=0; - updateWindowTitle(); - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Song Name - Furnace##tbar1"),settings.titleBarInfo==1)) { - settings.titleBarInfo=1; - updateWindowTitle(); - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("file_name.fur - Furnace##tbar2"),settings.titleBarInfo==2)) { - settings.titleBarInfo=2; - updateWindowTitle(); - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("/path/to/file.fur - Furnace##tbar3"),settings.titleBarInfo==3)) { - settings.titleBarInfo=3; - updateWindowTitle(); - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - bool titleBarSysB=settings.titleBarSys; - if (ImGui::Checkbox(_("Display system name on title bar"),&titleBarSysB)) { - settings.titleBarSys=titleBarSysB; - updateWindowTitle(); - SETTINGS_CHANGED; - } - - bool noMultiSystemB=settings.noMultiSystem; - if (ImGui::Checkbox(_("Display chip names instead of \"multi-system\" in title bar"),&noMultiSystemB)) { - settings.noMultiSystem=noMultiSystemB; - updateWindowTitle(); - SETTINGS_CHANGED; - } - - ImGui::Text(_("Status bar:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Cursor details##sbar0"),settings.statusDisplay==0)) { - settings.statusDisplay=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("File path##sbar1"),settings.statusDisplay==1)) { - settings.statusDisplay=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Cursor details or file path##sbar2"),settings.statusDisplay==2)) { - settings.statusDisplay=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Nothing##sbar3"),settings.statusDisplay==3)) { - settings.statusDisplay=3; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - bool playbackTimeB=settings.playbackTime; - if (ImGui::Checkbox(_("Display playback status when playing"),&playbackTimeB)) { - settings.playbackTime=playbackTimeB; - SETTINGS_CHANGED; - } - - ImGui::Text(_("Export options layout:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Sub-menus in File menu##eol0"),settings.exportOptionsLayout==0)) { - settings.exportOptionsLayout=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Modal window with tabs##eol1"),settings.exportOptionsLayout==1)) { - settings.exportOptionsLayout=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Modal windows with options in File menu##eol2"),settings.exportOptionsLayout==2)) { - settings.exportOptionsLayout=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - bool capitalMenuBarB=settings.capitalMenuBar; - if (ImGui::Checkbox(_("Capitalize menu bar"),&capitalMenuBarB)) { - settings.capitalMenuBar=capitalMenuBarB; - SETTINGS_CHANGED; - } - - bool classicChipOptionsB=settings.classicChipOptions; - if (ImGui::Checkbox(_("Display add/configure/change/remove chip menus in File menu"),&classicChipOptionsB)) { - settings.classicChipOptions=classicChipOptionsB; - SETTINGS_CHANGED; - } - - // SUBSECTION ORDERS - CONFIG_SUBSECTION(_("Orders")); - // sorry. temporarily disabled until ImGui has a way to add separators in tables arbitrarily. - /*bool sysSeparatorsB=settings.sysSeparators; - if (ImGui::Checkbox(_("Add separators between systems in Orders"),&sysSeparatorsB)) { - settings.sysSeparators=sysSeparatorsB; - }*/ - - bool ordersCursorB=settings.ordersCursor; - if (ImGui::Checkbox(_("Highlight channel at cursor in Orders"),&ordersCursorB)) { - settings.ordersCursor=ordersCursorB; - SETTINGS_CHANGED; - } - - ImGui::Text(_("Orders row number format:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Decimal##orbD"),settings.orderRowsBase==0)) { - settings.orderRowsBase=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Hexadecimal##orbH"),settings.orderRowsBase==1)) { - settings.orderRowsBase=1; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - // SUBSECTION PATTERN - CONFIG_SUBSECTION(_("Pattern")); - bool centerPatternB=settings.centerPattern; - if (ImGui::Checkbox(_("Center pattern view"),¢erPatternB)) { - settings.centerPattern=centerPatternB; - SETTINGS_CHANGED; - } - - bool overflowHighlightB=settings.overflowHighlight; - if (ImGui::Checkbox(_("Overflow pattern highlights"),&overflowHighlightB)) { - settings.overflowHighlight=overflowHighlightB; - SETTINGS_CHANGED; - } - - bool viewPrevPatternB=settings.viewPrevPattern; - if (ImGui::Checkbox(_("Display previous/next pattern"),&viewPrevPatternB)) { - settings.viewPrevPattern=viewPrevPatternB; - SETTINGS_CHANGED; - } - - ImGui::Text(_("Pattern row number format:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Decimal##prbD"),settings.patRowsBase==0)) { - settings.patRowsBase=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Hexadecimal##prbH"),settings.patRowsBase==1)) { - settings.patRowsBase=1; - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - ImGui::Text(_("Pattern view labels:")); - ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLOff","OFF",&settings.noteOffLabel)) SETTINGS_CHANGED; - ImGui::PopFont(); - ImGui::SameLine(); - ImGui::Text(_("Note off (3-char)")); - ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLRel","===",&settings.noteRelLabel)) SETTINGS_CHANGED; - ImGui::PopFont(); - ImGui::SameLine(); - ImGui::Text(_("Note release (3-char)")); - ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLMacroRel","REL",&settings.macroRelLabel)) SETTINGS_CHANGED; - ImGui::PopFont(); - ImGui::SameLine(); - ImGui::Text(_("Macro release (3-char)")); - ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLE3","...",&settings.emptyLabel)) SETTINGS_CHANGED; - ImGui::PopFont(); - ImGui::SameLine(); - ImGui::Text(_("Empty field (3-char)")); - ImGui::PushFont(patFont); - if (ImGui::InputTextWithHint("##PVLE2","..",&settings.emptyLabel2)) SETTINGS_CHANGED; - ImGui::PopFont(); - ImGui::SameLine(); - ImGui::Text(_("Empty field (2-char)")); - - ImGui::Text(_("Pattern view spacing after:")); + }), + SETTING(_("Borders around widgets"),{ + bool frameBordersB=settings.frameBorders; + if (ImGui::Checkbox(_("Borders around widgets"),&frameBordersB)) { + settings.frameBorders=frameBordersB; + SETTINGS_CHANGED; + } + }) + }) + },{}) + }; - if (CWSliderInt(_("Note"),&settings.noteCellSpacing,0,32)) { - if (settings.noteCellSpacing<0) settings.noteCellSpacing=0; - if (settings.noteCellSpacing>32) settings.noteCellSpacing=32; - SETTINGS_CHANGED; - } + settings.activeCategory=settings.categories[0]; +} - if (CWSliderInt(_("Instrument"),&settings.insCellSpacing,0,32)) { - if (settings.insCellSpacing<0) settings.insCellSpacing=0; - if (settings.insCellSpacing>32) settings.insCellSpacing=32; - SETTINGS_CHANGED; - } +void FurnaceGUI::destroySettingsCategories(SettingsCategory& cat) { + if (cat.children.size()>0) { + for (SettingsCategory i:cat.children) { + destroySettingsCategories(i); + } + } + for (Setting* i:cat.settings) { + delete i; + } + cat.settings.clear(); + cat.children.clear(); +} - if (CWSliderInt(_("Volume"),&settings.volCellSpacing,0,32)) { - if (settings.volCellSpacing<0) settings.volCellSpacing=0; - if (settings.volCellSpacing>32) settings.volCellSpacing=32; - SETTINGS_CHANGED; - } +void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { + if (cat->children.size()>0) { + ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_SpanFullWidth|ImGuiTreeNodeFlags_OpenOnArrow|ImGuiTreeNodeFlags_OpenOnDoubleClick; + if (settings.activeCategory.name==cat->name) f|=ImGuiTreeNodeFlags_Selected; + cat->expandChild=ImGui::TreeNodeEx(cat->name,f); + if (ImGui::IsItemClicked()) { + settings.activeCategory=*cat; + } + if (cat->expandChild) { + ImGui::Indent(); + for (SettingsCategory child:cat->children) drawSettingsCategory(&child); + ImGui::Unindent(); + ImGui::TreePop(); + } + } else { // a lonely child... + if (ImGui::Selectable(cat->name,settings.activeCategory.name==cat->name)) { + settings.activeCategory=*cat; + } + } +} - if (CWSliderInt(_("Effect"),&settings.effectCellSpacing,0,32)) { - if (settings.effectCellSpacing<0) settings.effectCellSpacing=0; - if (settings.effectCellSpacing>32) settings.effectCellSpacing=32; - SETTINGS_CHANGED; - } +void FurnaceGUI::searchDrawSettingItems(SettingsCategory* cat) { + if (cat->children.size()>0) { + for (SettingsCategory child:cat->children) { + searchDrawSettingItems(&child); + } + } + bool anyFound=false; + for (Setting* s:cat->settings) { + if (s->passesFilter(&settings.filter)) { + anyFound=true; + break; + } + } + if (anyFound) { + ImGui::BulletText("%s",cat->name); + ImGui::Indent(); + for (Setting* s:cat->settings) { + if (s->passesFilter(&settings.filter)) s->drawSetting(); + } + ImGui::Unindent(); + ImGui::Separator(); + } +} - if (CWSliderInt(_("Effect value"),&settings.effectValCellSpacing,0,32)) { - if (settings.effectValCellSpacing<0) settings.effectValCellSpacing=0; - if (settings.effectValCellSpacing>32) settings.effectValCellSpacing=32; - SETTINGS_CHANGED; - } +void FurnaceGUI::drawSettingsItems() { + if (settings.filter.IsActive()) { + for (SettingsCategory cat:settings.categories) { + searchDrawSettingItems(&cat); + } + } else { + if (settings.activeCategory.name==NULL) return; + for (Setting* s:settings.activeCategory.settings) s->drawSetting(); + } +} - bool oneDigitEffectsB=settings.oneDigitEffects; - if (ImGui::Checkbox(_("Single-digit effects for 00-0F"),&oneDigitEffectsB)) { - settings.oneDigitEffects=oneDigitEffectsB; - SETTINGS_CHANGED; - } +String FurnaceGUI::stripName(String what) { + String ret; + for (char& i: what) { + if ((i>='A' && i<='Z') || (i>='a' && i<='z') || (i>='0' && i<='9')) { + ret+=i; + } else { + ret+='-'; + } + } + return ret; +} - bool flatNotesB=settings.flatNotes; - if (ImGui::Checkbox(_("Use flats instead of sharps"),&flatNotesB)) { - settings.flatNotes=flatNotesB; - SETTINGS_CHANGED; - } +bool FurnaceGUI::splitBackupName(const char* input, String& backupName, struct tm& backupTime) { + size_t len=strlen(input); + if (len<4) return false; - bool germanNotationB=settings.germanNotation; - if (ImGui::Checkbox(_("Use German notation"),&germanNotationB)) { - settings.germanNotation=germanNotationB; - SETTINGS_CHANGED; - } + const char* firstHyphen=NULL; + const char* secondHyphen=NULL; + bool whichHyphen=false; + bool isDateValid=true; + // -YYYYMMDD-hhmmss.fur + if (strcmp(&input[len-4],".fur")!=0) return false; + // find two hyphens + for (const char* i=input+len; i!=input; i--) { + if ((*i)=='-') { + if (whichHyphen) { + firstHyphen=i; + break; + } else { + secondHyphen=i; + whichHyphen=true; + } + } + } + if (firstHyphen==NULL) return false; + if (secondHyphen==NULL) return false; - // SUBSECTION CHANNEL - CONFIG_SUBSECTION(_("Channel")); + // get the time + int whichChar=0; + for (const char* i=secondHyphen+1; *i; i++) { + if ((*i)<'0' || (*i)>'9') { + isDateValid=false; + break; + } + switch (whichChar++) { + case 0: + backupTime.tm_hour=((*i)-'0')*10; + break; + case 1: + backupTime.tm_hour+=(*i)-'0'; + break; + case 2: + backupTime.tm_min=((*i)-'0')*10; + break; + case 3: + backupTime.tm_min+=(*i)-'0'; + break; + case 4: + backupTime.tm_sec=((*i)-'0')*10; + break; + case 5: + backupTime.tm_sec+=(*i)-'0'; + break; + } + if (whichChar>=6) break; + } + if (whichChar!=6) return false; + if (!isDateValid) return false; + if (backupTime.tm_hour>23) return false; + if (backupTime.tm_min>59) return false; + // intentional + if (backupTime.tm_sec>60) return false; - ImGui::Text(_("Channel style:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Classic##CHS0"),settings.channelStyle==0)) { - settings.channelStyle=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Line##CHS1"),settings.channelStyle==1)) { - settings.channelStyle=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Round##CHS2"),settings.channelStyle==2)) { - settings.channelStyle=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Split button##CHS3"),settings.channelStyle==3)) { - settings.channelStyle=3; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Square border##CH42"),settings.channelStyle==4)) { - settings.channelStyle=4; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Round border##CHS5"),settings.channelStyle==5)) { - settings.channelStyle=5; - SETTINGS_CHANGED; - } - ImGui::Unindent(); + // get the date + String theDate=""; + for (const char* i=firstHyphen+1; *i; i++) { + if ((*i)=='-') break; + if ((*i)<'0' || (*i)>'9') { + isDateValid=false; + break; + } + theDate+=*i; + } + if (!isDateValid) return false; + if (theDate.size()<5) return false; + if (theDate.size()>14) return false; + String mmdd=theDate.substr(theDate.size()-4); + if (mmdd.size()!=4) return false; + backupTime.tm_mon=(mmdd[0]-'0')*10+(mmdd[1]-'0')-1; + backupTime.tm_mday=(mmdd[2]-'0')*10+(mmdd[3]-'0'); + if (backupTime.tm_mon>12) return false; + if (backupTime.tm_mday>31) return false; + String yyyy=theDate.substr(0,theDate.size()-4); + try { + backupTime.tm_year=std::stoi(yyyy)-1900; + } catch (std::exception& e) { + return false; + } - ImGui::Text(_("Channel volume bar:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("None##CHV0"),settings.channelVolStyle==0)) { - settings.channelVolStyle=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Simple##CHV1"),settings.channelVolStyle==1)) { - settings.channelVolStyle=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Stereo##CHV2"),settings.channelVolStyle==2)) { - settings.channelVolStyle=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Real##CHV3"),settings.channelVolStyle==3)) { - settings.channelVolStyle=3; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Real (stereo)##CHV4"),settings.channelVolStyle==4)) { - settings.channelVolStyle=4; - SETTINGS_CHANGED; - } - ImGui::Unindent(); + backupName=""; + for (const char* i=input; i!=firstHyphen && (*i); i++) { + backupName+=*i; + } - ImGui::Text(_("Channel feedback style:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Off##CHF0"),settings.channelFeedbackStyle==0)) { - settings.channelFeedbackStyle=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Note##CHF1"),settings.channelFeedbackStyle==1)) { - settings.channelFeedbackStyle=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Volume##CHF2"),settings.channelFeedbackStyle==2)) { - settings.channelFeedbackStyle=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Active##CHF3"),settings.channelFeedbackStyle==3)) { - settings.channelFeedbackStyle=3; - SETTINGS_CHANGED; - } - ImGui::Unindent(); + return true; +} - ImGui::Text(_("Channel font:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Regular##CHFont0"),settings.channelFont==0)) { - settings.channelFont=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Monospace##CHFont1"),settings.channelFont==1)) { - settings.channelFont=1; - SETTINGS_CHANGED; - } - ImGui::Unindent(); +void FurnaceGUI::purgeBackups(int year, int month, int day) { +#ifdef _WIN32 + String findPath=backupPath+String(DIR_SEPARATOR_STR)+String("*.fur"); + WString findPathW=utf8To16(findPath.c_str()); + WIN32_FIND_DATAW next; + HANDLE backDir=FindFirstFileW(findPathW.c_str(),&next); + if (backDir!=INVALID_HANDLE_VALUE) { + do { + String backupName; + struct tm backupTime; + String cFileNameU=utf16To8(next.cFileName); + bool deleteBackup=false; + if (!splitBackupName(cFileNameU.c_str(),backupName,backupTime)) continue; - bool channelTextCenterB=settings.channelTextCenter; - if (ImGui::Checkbox(_("Center channel name"),&channelTextCenterB)) { - settings.channelTextCenter=channelTextCenterB; - SETTINGS_CHANGED; - } + if (year==0) { + deleteBackup=true; + } else if (backupTime.tm_year<(year-1900)) { + deleteBackup=true; + } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) { + deleteBackup=true; + } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mdayd_name,".")==0) continue; + if (strcmp(next->d_name,"..")==0) continue; + if (!splitBackupName(next->d_name,backupName,backupTime)) continue; - ImGui::Text(_("Channel name colors:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Single##CTC0"),settings.channelTextColors==0)) { - settings.channelTextColors=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Channel type##CTC1"),settings.channelTextColors==1)) { - settings.channelTextColors=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Instrument type##CTC2"),settings.channelTextColors==2)) { - settings.channelTextColors=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); + if (year==0) { + deleteBackup=true; + } else if (backupTime.tm_year<(year-1900)) { + deleteBackup=true; + } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) { + deleteBackup=true; + } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mdayd_name; + deleteFile(nextPath.c_str()); + } + } + closedir(backDir); +#endif + refreshBackups=true; +} - ImGui::BeginDisabled(settings.unifiedDataView); - bool horizontalDataViewB=settings.horizontalDataView; - if (ImGui::Checkbox(_("Horizontal instrument/wavetable list"),&horizontalDataViewB)) { - settings.horizontalDataView=horizontalDataViewB; - SETTINGS_CHANGED; - } - ImGui::EndDisabled(); +void FurnaceGUI::promptKey(int which, int bindIdx) { + bindSetTarget=which; + bindSetTargetIdx=bindIdx; + bindSetActive=true; + bindSetPending=true; + if (bindIdx>=(int)actionKeys[which].size()) { + bindSetPrevValue=0; + actionKeys[which].push_back(0); + } else { + bindSetPrevValue=actionKeys[which][bindIdx]; + actionKeys[which][bindIdx]=0; + } +} - ImGui::Text(_("Instrument list icon style:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("None##iis0"),settings.insIconsStyle==0)) { - settings.insIconsStyle=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Graphical icons##iis1"),settings.insIconsStyle==1)) { - settings.insIconsStyle=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Letter icons##iis2"),settings.insIconsStyle==2)) { - settings.insIconsStyle=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); +struct MappedInput { + int scan; + int val; + MappedInput(): + scan(SDL_SCANCODE_UNKNOWN), val(0) {} + MappedInput(int s, int v): + scan(s), val(v) {} +}; - bool insEditColorizeB=settings.insEditColorize; - if (ImGui::Checkbox(_("Colorize instrument editor using instrument type"),&insEditColorizeB)) { - settings.insEditColorize=insEditColorizeB; - SETTINGS_CHANGED; - } +void FurnaceGUI::drawSettings() { + if (nextWindow==GUI_WINDOW_SETTINGS) { + settingsOpen=true; + ImGui::SetNextWindowFocus(); + nextWindow=GUI_WINDOW_NOTHING; + } + if (!settingsOpen) return; + if (mobileUI) { + ImVec2 setWindowPos=ImVec2(0,0); + ImVec2 setWindowSize=ImVec2(canvasW,canvasH); + ImGui::SetNextWindowPos(setWindowPos); + ImGui::SetNextWindowSize(setWindowSize); + } else { + ImGui::SetNextWindowSizeConstraints(ImVec2(200.0f*dpiScale,100.0f*dpiScale),ImVec2(canvasW,canvasH)); + } + if (ImGui::Begin("Settings",&settingsOpen,ImGuiWindowFlags_NoDocking|globalWinFlags,_("Settings"))) { + if (!settingsOpen) { + if (settingsChanged) { + settingsOpen=true; + showWarning(_("Do you want to save your settings?"),GUI_WARN_CLOSE_SETTINGS); + } else { + settingsOpen=false; + } + } + if (ImGui::BeginTabBar("settingsTab")) { + // NEW SETTINGS HERE + CONFIG_SECTION("test") { + CONFIG_SUBSECTION("here"); - // SUBSECTION MACRO EDITOR - CONFIG_SUBSECTION(_("Macro Editor")); - ImGui::Text(_("Macro editor layout:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Unified##mel0"),settings.macroLayout==0)) { - settings.macroLayout=0; - SETTINGS_CHANGED; - } - /* - if (ImGui::RadioButton(_("Tabs##mel1"),settings.macroLayout==1)) { - settings.macroLayout=1; - SETTINGS_CHANGED; - } - */ - if (ImGui::RadioButton(_("Grid##mel2"),settings.macroLayout==2)) { - settings.macroLayout=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Single (with list)##mel3"),settings.macroLayout==3)) { - settings.macroLayout=3; - SETTINGS_CHANGED; - } - /* - if (ImGui::RadioButton(_("Single (combo box)##mel4"),settings.macroLayout==4)) { - settings.macroLayout=4; - SETTINGS_CHANGED; + bool vertical=ImGui::GetWindowSize().y>ImGui::GetWindowSize().x; + if (ImGui::BeginTable("set3", vertical?1:2,ImGuiTableFlags_Resizable|ImGuiTableFlags_BordersInner)) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + settings.filter.Draw(_("Search")); + if (ImGui::BeginChild("SettingCategories",vertical?ImGui::GetContentRegionAvail()/ImVec2(1.0f,3.0f):ImGui::GetContentRegionAvail(),false)) { + ImGui::BeginDisabled(settings.filter.IsActive()); + for (SettingsCategory cat:settings.categories) drawSettingsCategory(&cat); + ImGui::EndDisabled(); + } + ImGui::EndChild(); + if (ImGui::GetWindowSize().y>ImGui::GetWindowSize().x) ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if (ImGui::BeginChild("SettingsItems",vertical?ImVec2(0.0f,0.0f):ImGui::GetContentRegionAvail(),false)) { + drawSettingsItems(); + if ((strncmp(settings.filter.InputBuf,"Cheats",7)==0) && !nonLatchNibble) { + ImGui::Text("gotta unlock them first!"); } - */ - ImGui::Unindent(); + } + ImGui::EndChild(); + ImGui::EndTable(); + } - bool oldMacroVSliderB=settings.oldMacroVSlider; - if (ImGui::Checkbox(_("Use classic macro editor vertical slider"),&oldMacroVSliderB)) { - settings.oldMacroVSlider=oldMacroVSliderB; - SETTINGS_CHANGED; - } + END_SECTION; + } - ImGui::BeginDisabled(settings.macroLayout==2); - ImGui::Text(_("Macro step size/horizontal zoom:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Manual"),settings.autoMacroStepSize==0)) { - settings.autoMacroStepSize=0; - SETTINGS_CHANGED; + CONFIG_SECTION(_("Keyboard")) { + // SUBSECTION LAYOUT + CONFIG_SUBSECTION(_("Keyboard")); + if (ImGui::Button(_("Import"))) { + openFileDialog(GUI_FILE_IMPORT_KEYBINDS); } - if (ImGui::RadioButton(_("Automatic per macro"),settings.autoMacroStepSize==1)) { - settings.autoMacroStepSize=1; - SETTINGS_CHANGED; + ImGui::SameLine(); + if (ImGui::Button(_("Export"))) { + openFileDialog(GUI_FILE_EXPORT_KEYBINDS); } - if (ImGui::RadioButton(_("Automatic (use longest macro)"),settings.autoMacroStepSize==2)) { - settings.autoMacroStepSize=2; - SETTINGS_CHANGED; + ImGui::SameLine(); + if (ImGui::Button(_("Reset defaults"))) { + showWarning(_("Are you sure you want to reset the keyboard settings?"),GUI_WARN_RESET_KEYBINDS); } - ImGui::Unindent(); - ImGui::EndDisabled(); + if (ImGui::BeginChild("##HotkeysList",ImVec2(0,0),false,ImGuiWindowFlags_HorizontalScrollbar)) { + if (ImGui::TreeNode(_("Global hotkeys"))) { + KEYBIND_CONFIG_BEGIN("keysGlobal"); - // SUBSECTION WAVE EDITOR - CONFIG_SUBSECTION(_("Wave Editor")); - bool waveLayoutB=settings.waveLayout; - if (ImGui::Checkbox(_("Use compact wave editor"),&waveLayoutB)) { - settings.waveLayout=waveLayoutB; - SETTINGS_CHANGED; - } + drawKeybindSettingsTableRow(GUI_ACTION_NEW); + drawKeybindSettingsTableRow(GUI_ACTION_CLEAR); + drawKeybindSettingsTableRow(GUI_ACTION_OPEN); + drawKeybindSettingsTableRow(GUI_ACTION_OPEN_BACKUP); + drawKeybindSettingsTableRow(GUI_ACTION_SAVE); + drawKeybindSettingsTableRow(GUI_ACTION_SAVE_AS); + drawKeybindSettingsTableRow(GUI_ACTION_EXPORT); + drawKeybindSettingsTableRow(GUI_ACTION_UNDO); + drawKeybindSettingsTableRow(GUI_ACTION_REDO); + drawKeybindSettingsTableRow(GUI_ACTION_PLAY_TOGGLE); + drawKeybindSettingsTableRow(GUI_ACTION_PLAY); + drawKeybindSettingsTableRow(GUI_ACTION_STOP); + drawKeybindSettingsTableRow(GUI_ACTION_PLAY_START); + drawKeybindSettingsTableRow(GUI_ACTION_PLAY_REPEAT); + drawKeybindSettingsTableRow(GUI_ACTION_PLAY_CURSOR); + drawKeybindSettingsTableRow(GUI_ACTION_STEP_ONE); + drawKeybindSettingsTableRow(GUI_ACTION_OCTAVE_UP); + drawKeybindSettingsTableRow(GUI_ACTION_OCTAVE_DOWN); + drawKeybindSettingsTableRow(GUI_ACTION_INS_UP); + drawKeybindSettingsTableRow(GUI_ACTION_INS_DOWN); + drawKeybindSettingsTableRow(GUI_ACTION_STEP_UP); + drawKeybindSettingsTableRow(GUI_ACTION_STEP_DOWN); + drawKeybindSettingsTableRow(GUI_ACTION_TOGGLE_EDIT); + drawKeybindSettingsTableRow(GUI_ACTION_METRONOME); + drawKeybindSettingsTableRow(GUI_ACTION_REPEAT_PATTERN); + drawKeybindSettingsTableRow(GUI_ACTION_FOLLOW_ORDERS); + drawKeybindSettingsTableRow(GUI_ACTION_FOLLOW_PATTERN); + drawKeybindSettingsTableRow(GUI_ACTION_FULLSCREEN); + drawKeybindSettingsTableRow(GUI_ACTION_TX81Z_REQUEST); + drawKeybindSettingsTableRow(GUI_ACTION_PANIC); - // SUBSECTION FM EDITOR - CONFIG_SUBSECTION(_("FM Editor")); - ImGui::Text(_("FM parameter names:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Friendly##fmn0"),settings.fmNames==0)) { - settings.fmNames=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Technical##fmn1"),settings.fmNames==1)) { - settings.fmNames=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Technical (alternate)##fmn2"),settings.fmNames==2)) { - settings.fmNames=2; - SETTINGS_CHANGED; - } - ImGui::Unindent(); + KEYBIND_CONFIG_END; + ImGui::TreePop(); + } + if (ImGui::TreeNode(_("Window activation"))) { + KEYBIND_CONFIG_BEGIN("keysWindow"); - bool oplStandardWaveNamesB=settings.oplStandardWaveNames; - if (ImGui::Checkbox(_("Use standard OPL waveform names"),&oplStandardWaveNamesB)) { - settings.oplStandardWaveNames=oplStandardWaveNamesB; - SETTINGS_CHANGED; - } + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_FIND); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SETTINGS); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SONG_INFO); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SUBSONGS); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SPEED); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_INS_LIST); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_WAVE_LIST); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SAMPLE_LIST); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_ORDERS); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_PATTERN); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_MIXER); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_GROOVES); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CHANNELS); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_PAT_MANAGER); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SYS_MANAGER); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_COMPAT_FLAGS); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_NOTES); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_INS_EDIT); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_WAVE_EDIT); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SAMPLE_EDIT); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_EDIT_CONTROLS); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_PIANO); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_OSCILLOSCOPE); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CHAN_OSC); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_XY_OSC); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_VOL_METER); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CLOCK); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_REGISTER_VIEW); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_LOG); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_STATS); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_MEMORY); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_EFFECT_LIST); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_DEBUG); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CS_PLAYER); + drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_ABOUT); + drawKeybindSettingsTableRow(GUI_ACTION_COLLAPSE_WINDOW); + drawKeybindSettingsTableRow(GUI_ACTION_CLOSE_WINDOW); - ImGui::Text(_("FM parameter editor layout:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Modern##fml0"),settings.fmLayout==0)) { - settings.fmLayout=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Modern with more labels##fml7"),settings.fmLayout==7)) { - settings.fmLayout=7; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Compact (2x2, classic)##fml1"),settings.fmLayout==1)) { - settings.fmLayout=1; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Compact (1x4)##fml2"),settings.fmLayout==2)) { - settings.fmLayout=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Compact (4x1)##fml3"),settings.fmLayout==3)) { - settings.fmLayout=3; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Alternate (2x2)##fml4"),settings.fmLayout==4)) { - settings.fmLayout=4; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Alternate (1x4)##fml5"),settings.fmLayout==5)) { - settings.fmLayout=5; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Alternate (4x1)##fml5"),settings.fmLayout==6)) { - settings.fmLayout=6; - SETTINGS_CHANGED; - } - ImGui::Unindent(); + drawKeybindSettingsTableRow(GUI_ACTION_COMMAND_PALETTE); + drawKeybindSettingsTableRow(GUI_ACTION_CMDPAL_RECENT); + drawKeybindSettingsTableRow(GUI_ACTION_CMDPAL_INSTRUMENTS); + drawKeybindSettingsTableRow(GUI_ACTION_CMDPAL_SAMPLES); - ImGui::Text(_("Position of Sustain in FM editor:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Between Decay and Sustain Rate##susp0"),settings.susPosition==0)) { - settings.susPosition=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("After Release Rate##susp1"),settings.susPosition==1)) { - settings.susPosition=1; - SETTINGS_CHANGED; - } - ImGui::BeginDisabled(settings.fmLayout!=0); - if (ImGui::RadioButton(_("After Release Rate, after spacing##susp2"),settings.susPosition==2)) { - settings.susPosition=2; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("After TL##susp3"),settings.susPosition==3)) { - settings.susPosition=3; - SETTINGS_CHANGED; - } - ImGui::EndDisabled(); - ImGui::Unindent(); + KEYBIND_CONFIG_END; + ImGui::TreePop(); + } + if (ImGui::TreeNode(_("Note input"))) { + std::vector sorted; + if (ImGui::BeginTable("keysNoteInput",4)) { + for (std::map::value_type& i: noteKeys) { + std::vector::iterator j; + for (j=sorted.begin(); j!=sorted.end(); j++) { + if (j->val>i.second) { + break; + } + } + sorted.insert(j,MappedInput(i.first,i.second)); + } - bool separateFMColorsB=settings.separateFMColors; - if (ImGui::Checkbox(_("Use separate colors for carriers/modulators in FM editor"),&separateFMColorsB)) { - settings.separateFMColors=separateFMColorsB; - SETTINGS_CHANGED; - } + static char id[4096]; - bool unsignedDetuneB=settings.unsignedDetune; - if (ImGui::Checkbox(_("Unsigned FM detune values"),&unsignedDetuneB)) { - settings.unsignedDetune=unsignedDetuneB; - SETTINGS_CHANGED; - } + ImGui::TableNextRow(ImGuiTableRowFlags_Headers); + ImGui::TableNextColumn(); + ImGui::Text(_("Key")); + ImGui::TableNextColumn(); + ImGui::Text(_("Type")); + ImGui::TableNextColumn(); + ImGui::Text(_("Value")); + ImGui::TableNextColumn(); + ImGui::Text(_("Remove")); - // SUBSECTION MEMORY COMPOSITION - CONFIG_SUBSECTION(_("Memory Composition")); - ImGui::Text(_("Chip memory usage unit:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Bytes##MUU0"),settings.memUsageUnit==0)) { - settings.memUsageUnit=0; - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Kilobytes##MUU1"),settings.memUsageUnit==1)) { - settings.memUsageUnit=1; - SETTINGS_CHANGED; - } - ImGui::Unindent(); + for (MappedInput& i: sorted) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("%s",SDL_GetScancodeName((SDL_Scancode)i.scan)); + ImGui::TableNextColumn(); + if (i.val==102) { + snprintf(id,4095,_("Macro release##SNType_%d"),i.scan); + if (ImGui::Button(id)) { + noteKeys[i.scan]=0; + } + } else if (i.val==101) { + snprintf(id,4095,_("Note release##SNType_%d"),i.scan); + if (ImGui::Button(id)) { + noteKeys[i.scan]=102; + } + } else if (i.val==100) { + snprintf(id,4095,_("Note off##SNType_%d"),i.scan); + if (ImGui::Button(id)) { + noteKeys[i.scan]=101; + } + } else { + snprintf(id,4095,_("Note##SNType_%d"),i.scan); + if (ImGui::Button(id)) { + noteKeys[i.scan]=100; + } + } + ImGui::TableNextColumn(); + if (i.val<100) { + snprintf(id,4095,"##SNValue_%d",i.scan); + if (ImGui::InputInt(id,&i.val,1,12)) { + if (i.val<0) i.val=0; + if (i.val>96) i.val=96; + noteKeys[i.scan]=i.val; + SETTINGS_CHANGED; + } + } + ImGui::TableNextColumn(); + snprintf(id,4095,ICON_FA_TIMES "##SNRemove_%d",i.scan); + if (ImGui::Button(id)) { + noteKeys.erase(i.scan); + SETTINGS_CHANGED; + } + } + ImGui::EndTable(); - // SUBSECTION OSCILLOSCOPE - CONFIG_SUBSECTION(_("Oscilloscope")); - bool oscRoundedCornersB=settings.oscRoundedCorners; - if (ImGui::Checkbox(_("Rounded corners"),&oscRoundedCornersB)) { - settings.oscRoundedCorners=oscRoundedCornersB; - SETTINGS_CHANGED; - } + if (ImGui::BeginCombo("##SNAddNew",_("Add..."))) { + for (int i=0; i16.0f) settings.oscLineSize=16.0f; - SETTINGS_CHANGED; - } rightClickable + KEYBIND_CONFIG_END; + ImGui::TreePop(); + } + if (ImGui::TreeNode(_("Sample list"))) { + KEYBIND_CONFIG_BEGIN("keysSampleList"); - // SUBSECTION WINDOWS - CONFIG_SUBSECTION(_("Windows")); - bool roundedWindowsB=settings.roundedWindows; - if (ImGui::Checkbox(_("Rounded window corners"),&roundedWindowsB)) { - settings.roundedWindows=roundedWindowsB; - SETTINGS_CHANGED; - } + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_ADD); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DUPLICATE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_CREATE_WAVE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN_REPLACE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN_RAW); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN_REPLACE_RAW); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_SAVE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_SAVE_RAW); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_MOVE_UP); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_MOVE_DOWN); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DELETE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_EDIT); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_UP); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DOWN); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_PREVIEW); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_STOP_PREVIEW); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DIR_VIEW); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_MAKE_MAP); - bool roundedButtonsB=settings.roundedButtons; - if (ImGui::Checkbox(_("Rounded buttons"),&roundedButtonsB)) { - settings.roundedButtons=roundedButtonsB; - SETTINGS_CHANGED; - } + KEYBIND_CONFIG_END; + ImGui::TreePop(); + } + if (ImGui::TreeNode(_("Orders"))) { + KEYBIND_CONFIG_BEGIN("keysOrders"); - bool roundedMenusB=settings.roundedMenus; - if (ImGui::Checkbox(_("Rounded menu corners"),&roundedMenusB)) { - settings.roundedMenus=roundedMenusB; - SETTINGS_CHANGED; - } + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_UP); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DOWN); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_LEFT); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_RIGHT); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_INCREASE); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DECREASE); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_EDIT_MODE); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_LINK); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_ADD); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DUPLICATE); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DEEP_CLONE); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DUPLICATE_END); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DEEP_CLONE_END); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_REMOVE); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_MOVE_UP); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_MOVE_DOWN); + drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_REPLAY); - bool roundedTabsB=settings.roundedTabs; - if (ImGui::Checkbox(_("Rounded tabs"),&roundedTabsB)) { - settings.roundedTabs=roundedTabsB; - SETTINGS_CHANGED; - } + KEYBIND_CONFIG_END; + ImGui::TreePop(); + } + if (ImGui::TreeNode(_("Sample editor"))) { + KEYBIND_CONFIG_BEGIN("keysSampleEdit"); - bool roundedScrollbarsB=settings.roundedScrollbars; - if (ImGui::Checkbox(_("Rounded scrollbars"),&roundedScrollbarsB)) { - settings.roundedScrollbars=roundedScrollbarsB; - SETTINGS_CHANGED; - } + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SELECT); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_DRAW); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_CUT); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_COPY); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PASTE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PASTE_REPLACE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PASTE_MIX); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SELECT_ALL); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_RESIZE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_RESAMPLE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_AMPLIFY); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_NORMALIZE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_FADE_IN); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_FADE_OUT); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_INSERT); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SILENCE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_DELETE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_TRIM); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_REVERSE); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_INVERT); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SIGN); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_FILTER); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PREVIEW); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_STOP_PREVIEW); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_ZOOM_IN); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_ZOOM_OUT); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_ZOOM_AUTO); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_MAKE_INS); + drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SET_LOOP); - bool frameBordersB=settings.frameBorders; - if (ImGui::Checkbox(_("Borders around widgets"),&frameBordersB)) { - settings.frameBorders=frameBordersB; - SETTINGS_CHANGED; + KEYBIND_CONFIG_END; + ImGui::TreePop(); + } } - + ImGui::EndChild(); END_SECTION; } + CONFIG_SECTION(_("Color")) { // SUBSECTION COLOR SCHEME CONFIG_SUBSECTION(_("Color scheme")); From 004d5972d596e09d750da632fbda2e0af291fd85 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Thu, 14 Nov 2024 17:20:57 +0400 Subject: [PATCH 40/61] settings: color section --- src/gui/settings.cpp | 925 +++++++++++++++++++++---------------------- 1 file changed, 448 insertions(+), 477 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index f575d4417d..6cd7c1930a 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -300,14 +300,6 @@ const char* specificControls[18]={ SETTINGS_CHANGED; \ } -#define UI_COLOR_CONFIG(what,label) \ - ImGui::PushID(what); \ - if (ImGui::ColorEdit4(label,(float*)&uiColors[what])) { \ - applyUISettings(false); \ - SETTINGS_CHANGED; \ - } \ - ImGui::PopID(); - #define KEYBIND_CONFIG_BEGIN(id) \ if (ImGui::BeginTable(id,2,ImGuiTableFlags_SizingFixedFit|ImGuiTableFlags_NoHostExtendX|ImGuiTableFlags_NoClip)) { @@ -422,6 +414,26 @@ const char* specificControls[18]={ } \ }) +#define UI_COLOR_CONFIG(what,label) \ + SETTING(label,{ \ + ImGui::PushID(what); \ + if (ImGui::ColorEdit4(label,(float*)&uiColors[what])) { \ + applyUISettings(false); \ + SETTINGS_CHANGED; \ + } \ + ImGui::PopID(); \ + }) + +#define UI_COLOR_CONFIG_COND(what,label,cond) \ + SETTING_COND(label,{ \ + ImGui::PushID(what); \ + if (ImGui::ColorEdit4(label,(float*)&uiColors[what])) { \ + applyUISettings(false); \ + SETTINGS_CHANGED; \ + } \ + ImGui::PopID(); \ + },cond) + // NEW NEW SETTINGS HERE void FurnaceGUI::setupSettingsCategories() { settings.categories={ @@ -3174,8 +3186,435 @@ void FurnaceGUI::setupSettingsCategories() { SETTINGS_CHANGED; } }) + }), + },{}), + SettingsCategory(_("Color"),{ + SettingsCategory(_("Interface"),{},{ + SETTING(_("Frame shading"),{ + if (ImGui::SliderInt(_("Frame shading"),&settings.guiColorsShading,0,100,"%d%%")) { + if (settings.guiColorsShading<0) settings.guiColorsShading=0; + if (settings.guiColorsShading>100) settings.guiColorsShading=100; + applyUISettings(false); + SETTINGS_CHANGED; + } + }), + SETTING_COND(_("Color scheme type:"),{ + ImGui::Text(_("Color scheme type:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("Dark##gcb0"),settings.guiColorsBase==0)) { + settings.guiColorsBase=0; + applyUISettings(false); + SETTINGS_CHANGED; + } + if (ImGui::RadioButton(_("Light##gcb1"),settings.guiColorsBase==1)) { + settings.guiColorsBase=1; + applyUISettings(false); + SETTINGS_CHANGED; + } + ImGui::Unindent(); + },settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_ACCENT_PRIMARY,_("Primary"),settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_ACCENT_SECONDARY,_("Secondary"),settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_BUTTON,_("Button"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_BUTTON_HOVER,_("Button (hovered)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_BUTTON_ACTIVE,_("Button (active)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_TAB,_("Tab"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_TAB_HOVER,_("Tab (hovered)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_TAB_ACTIVE,_("Tab (active)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_TAB_UNFOCUSED,_("Tab (unfocused)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_TAB_UNFOCUSED_ACTIVE,_("Tab (unfocused and active)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_IMGUI_HEADER,_("ImGui header"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_IMGUI_HEADER_HOVER,_("ImGui header (hovered)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_IMGUI_HEADER_ACTIVE,_("ImGui header (active)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_RESIZE_GRIP,_("Resize grip"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_RESIZE_GRIP_HOVER,_("Resize grip (hovered)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_RESIZE_GRIP_ACTIVE,_("Resize grip (active)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_WIDGET_BACKGROUND,_("Widget background"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_WIDGET_BACKGROUND_HOVER,_("Widget background (hovered)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_WIDGET_BACKGROUND_ACTIVE,_("Widget background (active)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_SLIDER_GRAB,_("Slider grab"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_SLIDER_GRAB_ACTIVE,_("Slider grab (active)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_TITLE_BACKGROUND_ACTIVE,_("Title background (active)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_CHECK_MARK,_("Checkbox/radio button mark"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_TEXT_SELECTION,_("Text selection"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_PLOT_LINES,_("Line plot"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_PLOT_LINES_HOVER,_("Line plot (hovered)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_PLOT_HISTOGRAM,_("Histogram plot"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_PLOT_HISTOGRAM_HOVER,_("Histogram plot (hovered)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_TABLE_ROW_EVEN,_("Table row (even)"),!settings.basicColors), + UI_COLOR_CONFIG_COND(GUI_COLOR_TABLE_ROW_ODD,_("Table row (odd)"),!settings.basicColors), + }), + SettingsCategory(_("Interface (other)"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_BACKGROUND,_("Background")), + UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND,_("Window background")), + UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND_CHILD,_("Sub-window background")), + UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND_POPUP,_("Pop-up background")), + UI_COLOR_CONFIG(GUI_COLOR_MODAL_BACKDROP,_("Modal backdrop")), + UI_COLOR_CONFIG(GUI_COLOR_HEADER,_("Header")), + UI_COLOR_CONFIG(GUI_COLOR_TEXT,_("Text")), + UI_COLOR_CONFIG(GUI_COLOR_TEXT_DISABLED,_("Text (disabled)")), + UI_COLOR_CONFIG(GUI_COLOR_TITLE_INACTIVE,_("Title bar (inactive)")), + UI_COLOR_CONFIG(GUI_COLOR_TITLE_COLLAPSED,_("Title bar (collapsed)")), + UI_COLOR_CONFIG(GUI_COLOR_MENU_BAR,_("Menu bar")), + UI_COLOR_CONFIG(GUI_COLOR_BORDER,_("Border")), + UI_COLOR_CONFIG(GUI_COLOR_BORDER_SHADOW,_("Border shadow")), + UI_COLOR_CONFIG(GUI_COLOR_SCROLL,_("Scroll bar")), + UI_COLOR_CONFIG(GUI_COLOR_SCROLL_HOVER,_("Scroll bar (hovered)")), + UI_COLOR_CONFIG(GUI_COLOR_SCROLL_ACTIVE,_("Scroll bar (clicked)")), + UI_COLOR_CONFIG(GUI_COLOR_SCROLL_BACKGROUND,_("Scroll bar background")), + UI_COLOR_CONFIG(GUI_COLOR_SEPARATOR,_("Separator")), + UI_COLOR_CONFIG(GUI_COLOR_SEPARATOR_HOVER,_("Separator (hover)")), + UI_COLOR_CONFIG(GUI_COLOR_SEPARATOR_ACTIVE,_("Separator (active)")), + UI_COLOR_CONFIG(GUI_COLOR_DOCKING_PREVIEW,_("Docking preview")), + UI_COLOR_CONFIG(GUI_COLOR_DOCKING_EMPTY,_("Docking empty")), + UI_COLOR_CONFIG(GUI_COLOR_TABLE_HEADER,_("Table header")), + UI_COLOR_CONFIG(GUI_COLOR_TABLE_BORDER_HARD,_("Table border (hard)")), + UI_COLOR_CONFIG(GUI_COLOR_TABLE_BORDER_SOFT,_("Table border (soft)")), + UI_COLOR_CONFIG(GUI_COLOR_DRAG_DROP_TARGET,_("Drag and drop target")), + UI_COLOR_CONFIG(GUI_COLOR_NAV_WIN_HIGHLIGHT,_("Window switcher (highlight)")), + UI_COLOR_CONFIG(GUI_COLOR_NAV_WIN_BACKDROP,_("Window switcher backdrop")), + }), + SettingsCategory(_("Miscellaneous"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_ON,_("Toggle on")), + UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_OFF,_("Toggle off")), + UI_COLOR_CONFIG(GUI_COLOR_PLAYBACK_STAT,_("Playback status")), + UI_COLOR_CONFIG(GUI_COLOR_DESTRUCTIVE,_("Destructive hint")), + UI_COLOR_CONFIG(GUI_COLOR_WARNING,_("Warning hint")), + UI_COLOR_CONFIG(GUI_COLOR_ERROR,_("Error hint")), + }), + SettingsCategory(_("File Picker (built-in)"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_FILE_DIR,_("Directory")), + UI_COLOR_CONFIG(GUI_COLOR_FILE_SONG_NATIVE,_("Song (native)")), + UI_COLOR_CONFIG(GUI_COLOR_FILE_SONG_IMPORT,_("Song (import)")), + UI_COLOR_CONFIG(GUI_COLOR_FILE_INSTR,_("Instrument")), + UI_COLOR_CONFIG(GUI_COLOR_FILE_AUDIO,_("Audio")), + UI_COLOR_CONFIG(GUI_COLOR_FILE_WAVE,_("Wavetable")), + UI_COLOR_CONFIG(GUI_COLOR_FILE_VGM,_("VGM")), + UI_COLOR_CONFIG(GUI_COLOR_FILE_ZSM,_("ZSM")), + UI_COLOR_CONFIG(GUI_COLOR_FILE_FONT,_("Font")), + UI_COLOR_CONFIG(GUI_COLOR_FILE_OTHER,_("Other")), + }), + SettingsCategory(_("Oscilloscope"),{ + SettingsCategory(_("Wave (non-mono)"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH0,_("Waveform (1)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH1,_("Waveform (2)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH2,_("Waveform (3)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH3,_("Waveform (4)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH4,_("Waveform (5)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH5,_("Waveform (6)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH6,_("Waveform (7)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH7,_("Waveform (8)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH8,_("Waveform (9)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH9,_("Waveform (10)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH10,_("Waveform (11)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH11,_("Waveform (12)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH12,_("Waveform (13)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH13,_("Waveform (14)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH14,_("Waveform (15)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH15,_("Waveform (16)")), + }) + },{ + UI_COLOR_CONFIG(GUI_COLOR_OSC_BORDER,_("Border")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_BG1,_("Background (top-left)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_BG2,_("Background (top-right)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_BG3,_("Background (bottom-left)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_BG4,_("Background (bottom-right)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE,_("Waveform")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_PEAK,_("Waveform (clip)")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_REF,_("Reference")), + UI_COLOR_CONFIG(GUI_COLOR_OSC_GUIDE,_("Guide")), + }), + SettingsCategory(_("Volume Meter"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_LOW,_("Low")), + UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_HIGH,_("High")), + UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_PEAK,_("Clip")), + }), + SettingsCategory(_("Orders"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_ORDER_ROW_INDEX,_("Order number")), + UI_COLOR_CONFIG(GUI_COLOR_ORDER_ACTIVE,_("Playing order background")), + UI_COLOR_CONFIG(GUI_COLOR_SONG_LOOP,_("Song loop")), + UI_COLOR_CONFIG(GUI_COLOR_ORDER_SELECTED,_("Selected order")), + UI_COLOR_CONFIG(GUI_COLOR_ORDER_SIMILAR,_("Similar patterns")), + UI_COLOR_CONFIG(GUI_COLOR_ORDER_INACTIVE,_("Inactive patterns")), + }), + SettingsCategory(_("Envelope View"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE,_("Envelope")), + UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_SUS_GUIDE,_("Sustain guide")), + UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_RELEASE,_("Release")), + }), + SettingsCategory(_("FM Editor"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_FM_ALG_BG,_("Algorithm background")), + UI_COLOR_CONFIG(GUI_COLOR_FM_ALG_LINE,_("Algorithm lines")), + UI_COLOR_CONFIG(GUI_COLOR_FM_MOD,_("Modulator")), + UI_COLOR_CONFIG(GUI_COLOR_FM_CAR,_("Carrier")), + + UI_COLOR_CONFIG(GUI_COLOR_FM_SSG,_("SSG-EG")), + UI_COLOR_CONFIG(GUI_COLOR_FM_WAVE,_("Waveform")), + SETTING(NULL,{ImGui::TextWrapped(_("(the following colors only apply when \"Use separate colors for carriers/modulators in FM editor\" is on!)"));}), + UI_COLOR_CONFIG(GUI_COLOR_FM_PRIMARY_MOD,_("Mod. accent (primary)")), + UI_COLOR_CONFIG(GUI_COLOR_FM_SECONDARY_MOD,_("Mod. accent (secondary)")), + UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_MOD,_("Mod. border")), + UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_SHADOW_MOD,_("Mod. border shadow")), + + UI_COLOR_CONFIG(GUI_COLOR_FM_PRIMARY_CAR,_("Car. accent (primary)")), + UI_COLOR_CONFIG(GUI_COLOR_FM_SECONDARY_CAR,_("Car. accent (secondary)")), + UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_CAR,_("Car. border")), + UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_SHADOW_CAR,_("Car. border shadow")), + }), + SettingsCategory(_("Macro Editor"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_MACRO_VOLUME,_("Volume")), + UI_COLOR_CONFIG(GUI_COLOR_MACRO_PITCH,_("Pitch")), + UI_COLOR_CONFIG(GUI_COLOR_MACRO_WAVE,_("Wave")), + UI_COLOR_CONFIG(GUI_COLOR_MACRO_NOISE,_("Noise")), + UI_COLOR_CONFIG(GUI_COLOR_MACRO_FILTER,_("Filter")), + UI_COLOR_CONFIG(GUI_COLOR_MACRO_ENVELOPE,_("Envelope")), + UI_COLOR_CONFIG(GUI_COLOR_MACRO_GLOBAL,_("Global Parameter")), + UI_COLOR_CONFIG(GUI_COLOR_MACRO_OTHER,_("Other")), + UI_COLOR_CONFIG(GUI_COLOR_MACRO_HIGHLIGHT,_("Step Highlight")), + }), + SettingsCategory(_("Instrument Types"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_INSTR_FM,_("FM (OPN)")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_STD,_("SN76489/Sega PSG")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_T6W28,_("T6W28")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_GB,_("Game Boy")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_C64,_("C64")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_AMIGA,_("Amiga/Generic Sample")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_PCE,_("PC Engine")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_AY,_("AY-3-8910/SSG")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_AY8930,_("AY8930")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_TIA,_("TIA")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SAA1099,_("SAA1099")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_VIC,_("VIC")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_PET,_("PET")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_VRC6,_("VRC6")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_VRC6_SAW,_("VRC6 (saw)")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPLL,_("FM (OPLL)")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPL,_("FM (OPL)")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_FDS,_("FDS")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_VBOY,_("Virtual Boy")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_N163,_("Namco 163")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SCC,_("Konami SCC")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPZ,_("FM (OPZ)")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_POKEY,_("POKEY")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_BEEPER,_("PC Beeper")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SWAN,_("WonderSwan")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_MIKEY,_("Lynx")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_VERA,_("VERA")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_X1_010,_("X1-010")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_ES5506,_("ES5506")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_MULTIPCM,_("MultiPCM")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SNES,_("SNES")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SU,_("Sound Unit")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_NAMCO,_("Namco WSG")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPL_DRUMS,_("FM (OPL Drums)")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPM,_("FM (OPM)")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_NES,_("NES")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_MSM6258,_("MSM6258")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_MSM6295,_("MSM6295")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_ADPCMA,_("ADPCM-A")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_ADPCMB,_("ADPCM-B")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SEGAPCM,_("Sega PCM")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_QSOUND,_("QSound")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_YMZ280B,_("YMZ280B")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_RF5C68,_("RF5C68")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_MSM5232,_("MSM5232")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_K007232,_("K007232")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_GA20,_("GA20")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_POKEMINI,_("Pokémon Mini")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SM8521,_("SM8521")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_PV1000,_("PV-1000")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_K053260,_("K053260")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_TED,_("TED")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_C140,_("C140")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_C219,_("C219")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_ESFM,_("ESFM")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_POWERNOISE,_("PowerNoise (noise)")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_POWERNOISE_SLOPE,_("PowerNoise (slope)")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_DAVE,_("Dave")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_NDS,_("Nintendo DS")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_GBA_DMA,_("GBA DMA")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_GBA_MINMOD,_("GBA MinMod")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_BIFURCATOR,_("Bifurcator")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SID2,_("SID2")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SUPERVISION,_("Supervision")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_UPD1771C,_("μPD1771C")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_SID3,_("SID3")), + UI_COLOR_CONFIG(GUI_COLOR_INSTR_UNKNOWN,_("Other/Unknown")), + }), + SettingsCategory(_("Channel"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_BG,_("Single color (background)")), + UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_FG,_("Single color (text)")), + UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_FM,_("FM")), + UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_PULSE,_("Pulse")), + UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_NOISE,_("Noise")), + UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_PCM,_("PCM")), + UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_WAVE,_("Wave")), + UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_OP,_("FM operator")), + UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_MUTED,_("Muted")), + }), + SettingsCategory(_("Pattern"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_PLAY_HEAD,_("Playhead")), + UI_COLOR_CONFIG(GUI_COLOR_EDITING,_("Editing")), + UI_COLOR_CONFIG(GUI_COLOR_EDITING_CLONE,_("Editing (will clone)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR,_("Cursor")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR_HOVER,_("Cursor (hovered)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR_ACTIVE,_("Cursor (clicked)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_SELECTION,_("Selection")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_SELECTION_HOVER,_("Selection (hovered)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_SELECTION_ACTIVE,_("Selection (clicked)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_HI_1,_("Highlight 1")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_HI_2,_("Highlight 2")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX,_("Row number")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX_HI1,_("Row number (highlight 1)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX_HI2,_("Row number (highlight 2)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE,_("Note")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE_HI1,_("Note (highlight 1)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE_HI2,_("Note (highlight 2)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE,_("Blank")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE_HI1,_("Blank (highlight 1)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE_HI2,_("Blank (highlight 2)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS,_("Instrument")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS_WARN,_("Instrument (invalid type)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS_ERROR,_("Instrument (out of range)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_VOLUME_MIN,_("Volume (0%)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_VOLUME_HALF,_("Volume (50%)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_VOLUME_MAX,_("Volume (100%)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_INVALID,_("Invalid effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_PITCH,_("Pitch effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_VOLUME,_("Volume effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_PANNING,_("Panning effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SONG,_("Song effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_TIME,_("Time effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SPEED,_("Speed effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY,_("Primary specific effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,_("Secondary specific effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_MISC,_("Miscellaneous")), + UI_COLOR_CONFIG(GUI_COLOR_EE_VALUE,_("External command output")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_OFF,_("Status: off/disabled")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_REL,_("Status: off + macro rel")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_REL_ON,_("Status: on + macro rel")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_ON,_("Status: on")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_VOLUME,_("Status: volume")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_PITCH,_("Status: pitch")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_PANNING,_("Status: panning")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SYS1,_("Status: chip (primary)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SYS2,_("Status: chip (secondary)")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MIXING,_("Status: mixing")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DSP,_("Status: DSP effect")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_NOTE,_("Status: note altering")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC1,_("Status: misc color 1")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC2,_("Status: misc color 2")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC3,_("Status: misc color 3")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_ATTACK,_("Status: attack")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DECAY,_("Status: decay")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SUSTAIN,_("Status: sustain")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_RELEASE,_("Status: release")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DEC_LINEAR,_("Status: decrease linear")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DEC_EXP,_("Status: decrease exp")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_INC,_("Status: increase")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_BENT,_("Status: bent")), + UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DIRECT,_("Status: direct")), + }), + SettingsCategory(_("Sample Editor"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_BG,_("Background")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_FG,_("Waveform")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_TIME_BG,_("Time background")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_TIME_FG,_("Time text")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP,_("Loop region")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CENTER,_("Center guide")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_GRID,_("Grid")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_SEL,_("Selection")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_SEL_POINT,_("Selection points")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_NEEDLE,_("Preview needle")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_NEEDLE_PLAYING,_("Playing needles")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP_POINT,_("Loop markers")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_DISABLED,_("Chip select: disabled")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_ENABLED,_("Chip select: enabled")), + UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_WARNING,_("Chip select: enabled (failure)")), + }), + SettingsCategory(_("Pattern Manager"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_NULL,_("Unallocated")), + UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_UNUSED,_("Unused")), + UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_USED,_("Used")), + UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_OVERUSED,_("Overused")), + UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_EXTREMELY_OVERUSED,_("Really overused")), + UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_COMBO_BREAKER,_("Combo Breaker")), + }), + SettingsCategory(_("Piano"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_PIANO_BACKGROUND,_("Background")), + UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_TOP,_("Upper key")), + UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_TOP_HIT,_("Upper key (feedback)")), + UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_TOP_ACTIVE,_("Upper key (pressed)")), + UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_BOTTOM,_("Lower key")), + UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_BOTTOM_HIT,_("Lower key (feedback)")), + UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_BOTTOM_ACTIVE,_("Lower key (pressed)")), + }), + SettingsCategory(_("Clock"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_CLOCK_TEXT,_("Clock text")), + UI_COLOR_CONFIG(GUI_COLOR_CLOCK_BEAT_LOW,_("Beat (off)")), + UI_COLOR_CONFIG(GUI_COLOR_CLOCK_BEAT_HIGH,_("Beat (on)")), + }), + SettingsCategory(_("Patchbay"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_PORTSET,_("PortSet")), + UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_PORT,_("Port")), + UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_PORT_HIDDEN,_("Port (hidden/unavailable)")), + UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_CONNECTION,_("Connection (selected)")), + UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_CONNECTION_BG,_("Connection (other)")), + }), + SettingsCategory(_("Memory Composition"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BG,_("Background")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_DATA,_("Waveform data")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_FREE,_("Unknown")), + //UI_COLOR_CONFIG(GUI_COLOR_MEMORY_PADDING,_("")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_RESERVED,_("Reserved")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE,_("Sample")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT1,_("Sample (alternate 1)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT2,_("Sample (alternate 2)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT3,_("Sample (alternate 3)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_WAVE_RAM,_("Wave RAM")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_WAVE_STATIC,_("Wavetable (static)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_ECHO,_("Echo buffer")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_N163_LOAD,_("Namco 163 load pos")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_N163_PLAY,_("Namco 163 play pos")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK0,_("Sample (bank 0)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK1,_("Sample (bank 1)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK2,_("Sample (bank 2)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK3,_("Sample (bank 3)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK4,_("Sample (bank 4)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK5,_("Sample (bank 5)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK6,_("Sample (bank 6)")), + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK7,_("Sample (bank 7)")), + }), + SettingsCategory(_("Log Viewer"),{},{ + UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_ERROR,_("Log level: Error")), + UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_WARNING,_("Log level: Warning")), + UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_INFO,_("Log level: Info")), + UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_DEBUG,_("Log level: Debug")), + UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_TRACE,_("Log level: Trace/Verbose")), + }) + },{ + SETTING(_("Color scheme"),{ + if (ImGui::Button(_("Import"))) { + openFileDialog(GUI_FILE_IMPORT_COLORS); + } + ImGui::SameLine(); + if (ImGui::Button(_("Export"))) { + openFileDialog(GUI_FILE_EXPORT_COLORS); + } + ImGui::SameLine(); + if (ImGui::Button(_("Reset defaults"))) { + showWarning(_("Are you sure you want to reset the color scheme?"),GUI_WARN_RESET_COLORS); + } + }), + SETTING(_("Guru mode"),{ + bool basicColorsB=!settings.basicColors; + if (ImGui::Checkbox(_("Guru mode"),&basicColorsB)) { + settings.basicColors=!basicColorsB; + applyUISettings(false); + SETTINGS_CHANGED; + } }) - },{}) + }) }; settings.activeCategory=settings.categories[0]; @@ -3898,474 +4337,6 @@ void FurnaceGUI::drawSettings() { END_SECTION; } - CONFIG_SECTION(_("Color")) { - // SUBSECTION COLOR SCHEME - CONFIG_SUBSECTION(_("Color scheme")); - if (ImGui::Button(_("Import"))) { - openFileDialog(GUI_FILE_IMPORT_COLORS); - } - ImGui::SameLine(); - if (ImGui::Button(_("Export"))) { - openFileDialog(GUI_FILE_EXPORT_COLORS); - } - ImGui::SameLine(); - if (ImGui::Button(_("Reset defaults"))) { - showWarning(_("Are you sure you want to reset the color scheme?"),GUI_WARN_RESET_COLORS); - } - bool basicColorsB=!settings.basicColors; - if (ImGui::Checkbox(_("Guru mode"),&basicColorsB)) { - settings.basicColors=!basicColorsB; - applyUISettings(false); - SETTINGS_CHANGED; - } - if (settings.basicColors) { - if (ImGui::TreeNode(_("Interface"))) { - if (ImGui::SliderInt(_("Frame shading"),&settings.guiColorsShading,0,100,"%d%%")) { - if (settings.guiColorsShading<0) settings.guiColorsShading=0; - if (settings.guiColorsShading>100) settings.guiColorsShading=100; - applyUISettings(false); - SETTINGS_CHANGED; - } - ImGui::Text(_("Color scheme type:")); - ImGui::Indent(); - if (ImGui::RadioButton(_("Dark##gcb0"),settings.guiColorsBase==0)) { - settings.guiColorsBase=0; - applyUISettings(false); - SETTINGS_CHANGED; - } - if (ImGui::RadioButton(_("Light##gcb1"),settings.guiColorsBase==1)) { - settings.guiColorsBase=1; - applyUISettings(false); - SETTINGS_CHANGED; - } - ImGui::Unindent(); - - ImGui::Text(_("Accent colors:")); - ImGui::Indent(); - UI_COLOR_CONFIG(GUI_COLOR_ACCENT_PRIMARY,_("Primary")); - UI_COLOR_CONFIG(GUI_COLOR_ACCENT_SECONDARY,_("Secondary")); - ImGui::Unindent(); - - ImGui::TreePop(); - } - } else { - if (ImGui::TreeNode(_("Interface"))) { - if (ImGui::SliderInt(_("Frame shading"),&settings.guiColorsShading,0,100,"%d%%")) { - if (settings.guiColorsShading<0) settings.guiColorsShading=0; - if (settings.guiColorsShading>100) settings.guiColorsShading=100; - applyUISettings(false); - SETTINGS_CHANGED; - } - - UI_COLOR_CONFIG(GUI_COLOR_BUTTON,_("Button")); - UI_COLOR_CONFIG(GUI_COLOR_BUTTON_HOVER,_("Button (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_BUTTON_ACTIVE,_("Button (active)")); - UI_COLOR_CONFIG(GUI_COLOR_TAB,_("Tab")); - UI_COLOR_CONFIG(GUI_COLOR_TAB_HOVER,_("Tab (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_TAB_ACTIVE,_("Tab (active)")); - UI_COLOR_CONFIG(GUI_COLOR_TAB_UNFOCUSED,_("Tab (unfocused)")); - UI_COLOR_CONFIG(GUI_COLOR_TAB_UNFOCUSED_ACTIVE,_("Tab (unfocused and active)")); - UI_COLOR_CONFIG(GUI_COLOR_IMGUI_HEADER,_("ImGui header")); - UI_COLOR_CONFIG(GUI_COLOR_IMGUI_HEADER_HOVER,_("ImGui header (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_IMGUI_HEADER_ACTIVE,_("ImGui header (active)")); - UI_COLOR_CONFIG(GUI_COLOR_RESIZE_GRIP,_("Resize grip")); - UI_COLOR_CONFIG(GUI_COLOR_RESIZE_GRIP_HOVER,_("Resize grip (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_RESIZE_GRIP_ACTIVE,_("Resize grip (active)")); - UI_COLOR_CONFIG(GUI_COLOR_WIDGET_BACKGROUND,_("Widget background")); - UI_COLOR_CONFIG(GUI_COLOR_WIDGET_BACKGROUND_HOVER,_("Widget background (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_WIDGET_BACKGROUND_ACTIVE,_("Widget background (active)")); - UI_COLOR_CONFIG(GUI_COLOR_SLIDER_GRAB,_("Slider grab")); - UI_COLOR_CONFIG(GUI_COLOR_SLIDER_GRAB_ACTIVE,_("Slider grab (active)")); - UI_COLOR_CONFIG(GUI_COLOR_TITLE_BACKGROUND_ACTIVE,_("Title background (active)")); - UI_COLOR_CONFIG(GUI_COLOR_CHECK_MARK,_("Checkbox/radio button mark")); - UI_COLOR_CONFIG(GUI_COLOR_TEXT_SELECTION,_("Text selection")); - UI_COLOR_CONFIG(GUI_COLOR_PLOT_LINES,_("Line plot")); - UI_COLOR_CONFIG(GUI_COLOR_PLOT_LINES_HOVER,_("Line plot (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_PLOT_HISTOGRAM,_("Histogram plot")); - UI_COLOR_CONFIG(GUI_COLOR_PLOT_HISTOGRAM_HOVER,_("Histogram plot (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_TABLE_ROW_EVEN,_("Table row (even)")); - UI_COLOR_CONFIG(GUI_COLOR_TABLE_ROW_ODD,_("Table row (odd)")); - - ImGui::TreePop(); - } - } - if (ImGui::TreeNode(_("Interface (other)"))) { - UI_COLOR_CONFIG(GUI_COLOR_BACKGROUND,_("Background")); - UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND,_("Window background")); - UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND_CHILD,_("Sub-window background")); - UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND_POPUP,_("Pop-up background")); - UI_COLOR_CONFIG(GUI_COLOR_MODAL_BACKDROP,_("Modal backdrop")); - UI_COLOR_CONFIG(GUI_COLOR_HEADER,_("Header")); - UI_COLOR_CONFIG(GUI_COLOR_TEXT,_("Text")); - UI_COLOR_CONFIG(GUI_COLOR_TEXT_DISABLED,_("Text (disabled)")); - UI_COLOR_CONFIG(GUI_COLOR_TITLE_INACTIVE,_("Title bar (inactive)")); - UI_COLOR_CONFIG(GUI_COLOR_TITLE_COLLAPSED,_("Title bar (collapsed)")); - UI_COLOR_CONFIG(GUI_COLOR_MENU_BAR,_("Menu bar")); - UI_COLOR_CONFIG(GUI_COLOR_BORDER,_("Border")); - UI_COLOR_CONFIG(GUI_COLOR_BORDER_SHADOW,_("Border shadow")); - UI_COLOR_CONFIG(GUI_COLOR_SCROLL,_("Scroll bar")); - UI_COLOR_CONFIG(GUI_COLOR_SCROLL_HOVER,_("Scroll bar (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_SCROLL_ACTIVE,_("Scroll bar (clicked)")); - UI_COLOR_CONFIG(GUI_COLOR_SCROLL_BACKGROUND,_("Scroll bar background")); - UI_COLOR_CONFIG(GUI_COLOR_SEPARATOR,_("Separator")); - UI_COLOR_CONFIG(GUI_COLOR_SEPARATOR_HOVER,_("Separator (hover)")); - UI_COLOR_CONFIG(GUI_COLOR_SEPARATOR_ACTIVE,_("Separator (active)")); - UI_COLOR_CONFIG(GUI_COLOR_DOCKING_PREVIEW,_("Docking preview")); - UI_COLOR_CONFIG(GUI_COLOR_DOCKING_EMPTY,_("Docking empty")); - UI_COLOR_CONFIG(GUI_COLOR_TABLE_HEADER,_("Table header")); - UI_COLOR_CONFIG(GUI_COLOR_TABLE_BORDER_HARD,_("Table border (hard)")); - UI_COLOR_CONFIG(GUI_COLOR_TABLE_BORDER_SOFT,_("Table border (soft)")); - UI_COLOR_CONFIG(GUI_COLOR_DRAG_DROP_TARGET,_("Drag and drop target")); - UI_COLOR_CONFIG(GUI_COLOR_NAV_WIN_HIGHLIGHT,_("Window switcher (highlight)")); - UI_COLOR_CONFIG(GUI_COLOR_NAV_WIN_BACKDROP,_("Window switcher backdrop")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Miscellaneous"))) { - UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_ON,_("Toggle on")); - UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_OFF,_("Toggle off")); - UI_COLOR_CONFIG(GUI_COLOR_PLAYBACK_STAT,_("Playback status")); - UI_COLOR_CONFIG(GUI_COLOR_DESTRUCTIVE,_("Destructive hint")); - UI_COLOR_CONFIG(GUI_COLOR_WARNING,_("Warning hint")); - UI_COLOR_CONFIG(GUI_COLOR_ERROR,_("Error hint")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("File Picker (built-in)"))) { - UI_COLOR_CONFIG(GUI_COLOR_FILE_DIR,_("Directory")); - UI_COLOR_CONFIG(GUI_COLOR_FILE_SONG_NATIVE,_("Song (native)")); - UI_COLOR_CONFIG(GUI_COLOR_FILE_SONG_IMPORT,_("Song (import)")); - UI_COLOR_CONFIG(GUI_COLOR_FILE_INSTR,_("Instrument")); - UI_COLOR_CONFIG(GUI_COLOR_FILE_AUDIO,_("Audio")); - UI_COLOR_CONFIG(GUI_COLOR_FILE_WAVE,_("Wavetable")); - UI_COLOR_CONFIG(GUI_COLOR_FILE_VGM,_("VGM")); - UI_COLOR_CONFIG(GUI_COLOR_FILE_ZSM,_("ZSM")); - UI_COLOR_CONFIG(GUI_COLOR_FILE_FONT,_("Font")); - UI_COLOR_CONFIG(GUI_COLOR_FILE_OTHER,_("Other")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Oscilloscope"))) { - UI_COLOR_CONFIG(GUI_COLOR_OSC_BORDER,_("Border")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_BG1,_("Background (top-left)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_BG2,_("Background (top-right)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_BG3,_("Background (bottom-left)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_BG4,_("Background (bottom-right)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE,_("Waveform")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_PEAK,_("Waveform (clip)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_REF,_("Reference")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_GUIDE,_("Guide")); - - if (ImGui::TreeNode(_("Wave (non-mono)"))) { - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH0,_("Waveform (1)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH1,_("Waveform (2)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH2,_("Waveform (3)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH3,_("Waveform (4)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH4,_("Waveform (5)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH5,_("Waveform (6)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH6,_("Waveform (7)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH7,_("Waveform (8)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH8,_("Waveform (9)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH9,_("Waveform (10)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH10,_("Waveform (11)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH11,_("Waveform (12)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH12,_("Waveform (13)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH13,_("Waveform (14)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH14,_("Waveform (15)")); - UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH15,_("Waveform (16)")); - ImGui::TreePop(); - } - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Volume Meter"))) { - UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_LOW,_("Low")); - UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_HIGH,_("High")); - UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_PEAK,_("Clip")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Orders"))) { - UI_COLOR_CONFIG(GUI_COLOR_ORDER_ROW_INDEX,_("Order number")); - UI_COLOR_CONFIG(GUI_COLOR_ORDER_ACTIVE,_("Playing order background")); - UI_COLOR_CONFIG(GUI_COLOR_SONG_LOOP,_("Song loop")); - UI_COLOR_CONFIG(GUI_COLOR_ORDER_SELECTED,_("Selected order")); - UI_COLOR_CONFIG(GUI_COLOR_ORDER_SIMILAR,_("Similar patterns")); - UI_COLOR_CONFIG(GUI_COLOR_ORDER_INACTIVE,_("Inactive patterns")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Envelope View"))) { - UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE,_("Envelope")); - UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_SUS_GUIDE,_("Sustain guide")); - UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_RELEASE,_("Release")); - - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("FM Editor"))) { - UI_COLOR_CONFIG(GUI_COLOR_FM_ALG_BG,_("Algorithm background")); - UI_COLOR_CONFIG(GUI_COLOR_FM_ALG_LINE,_("Algorithm lines")); - UI_COLOR_CONFIG(GUI_COLOR_FM_MOD,_("Modulator")); - UI_COLOR_CONFIG(GUI_COLOR_FM_CAR,_("Carrier")); - - UI_COLOR_CONFIG(GUI_COLOR_FM_SSG,_("SSG-EG")); - UI_COLOR_CONFIG(GUI_COLOR_FM_WAVE,_("Waveform")); - - ImGui::TextWrapped(_("(the following colors only apply when \"Use separate colors for carriers/modulators in FM editor\" is on!)")); - - UI_COLOR_CONFIG(GUI_COLOR_FM_PRIMARY_MOD,_("Mod. accent (primary)")); - UI_COLOR_CONFIG(GUI_COLOR_FM_SECONDARY_MOD,_("Mod. accent (secondary)")); - UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_MOD,_("Mod. border")); - UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_SHADOW_MOD,_("Mod. border shadow")); - - UI_COLOR_CONFIG(GUI_COLOR_FM_PRIMARY_CAR,_("Car. accent (primary)")); - UI_COLOR_CONFIG(GUI_COLOR_FM_SECONDARY_CAR,_("Car. accent (secondary)")); - UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_CAR,_("Car. border")); - UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_SHADOW_CAR,_("Car. border shadow")); - - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Macro Editor"))) { - UI_COLOR_CONFIG(GUI_COLOR_MACRO_VOLUME,_("Volume")); - UI_COLOR_CONFIG(GUI_COLOR_MACRO_PITCH,_("Pitch")); - UI_COLOR_CONFIG(GUI_COLOR_MACRO_WAVE,_("Wave")); - UI_COLOR_CONFIG(GUI_COLOR_MACRO_NOISE,_("Noise")); - UI_COLOR_CONFIG(GUI_COLOR_MACRO_FILTER,_("Filter")); - UI_COLOR_CONFIG(GUI_COLOR_MACRO_ENVELOPE,_("Envelope")); - UI_COLOR_CONFIG(GUI_COLOR_MACRO_GLOBAL,_("Global Parameter")); - UI_COLOR_CONFIG(GUI_COLOR_MACRO_OTHER,_("Other")); - UI_COLOR_CONFIG(GUI_COLOR_MACRO_HIGHLIGHT,_("Step Highlight")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Instrument Types"))) { - UI_COLOR_CONFIG(GUI_COLOR_INSTR_FM,_("FM (OPN)")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_STD,_("SN76489/Sega PSG")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_T6W28,_("T6W28")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_GB,_("Game Boy")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_C64,_("C64")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_AMIGA,_("Amiga/Generic Sample")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_PCE,_("PC Engine")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_AY,_("AY-3-8910/SSG")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_AY8930,_("AY8930")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_TIA,_("TIA")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SAA1099,_("SAA1099")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_VIC,_("VIC")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_PET,_("PET")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_VRC6,_("VRC6")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_VRC6_SAW,_("VRC6 (saw)")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPLL,_("FM (OPLL)")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPL,_("FM (OPL)")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_FDS,_("FDS")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_VBOY,_("Virtual Boy")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_N163,_("Namco 163")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SCC,_("Konami SCC")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPZ,_("FM (OPZ)")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_POKEY,_("POKEY")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_BEEPER,_("PC Beeper")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SWAN,_("WonderSwan")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_MIKEY,_("Lynx")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_VERA,_("VERA")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_X1_010,_("X1-010")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_ES5506,_("ES5506")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_MULTIPCM,_("MultiPCM")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SNES,_("SNES")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SU,_("Sound Unit")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_NAMCO,_("Namco WSG")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPL_DRUMS,_("FM (OPL Drums)")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPM,_("FM (OPM)")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_NES,_("NES")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_MSM6258,_("MSM6258")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_MSM6295,_("MSM6295")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_ADPCMA,_("ADPCM-A")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_ADPCMB,_("ADPCM-B")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SEGAPCM,_("Sega PCM")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_QSOUND,_("QSound")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_YMZ280B,_("YMZ280B")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_RF5C68,_("RF5C68")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_MSM5232,_("MSM5232")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_K007232,_("K007232")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_GA20,_("GA20")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_POKEMINI,_("Pokémon Mini")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SM8521,_("SM8521")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_PV1000,_("PV-1000")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_K053260,_("K053260")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_TED,_("TED")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_C140,_("C140")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_C219,_("C219")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_ESFM,_("ESFM")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_POWERNOISE,_("PowerNoise (noise)")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_POWERNOISE_SLOPE,_("PowerNoise (slope)")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_DAVE,_("Dave")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_NDS,_("Nintendo DS")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_GBA_DMA,_("GBA DMA")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_GBA_MINMOD,_("GBA MinMod")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_BIFURCATOR,_("Bifurcator")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SID2,_("SID2")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SUPERVISION,_("Supervision")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_UPD1771C,_("μPD1771C")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_SID3,_("SID3")); - UI_COLOR_CONFIG(GUI_COLOR_INSTR_UNKNOWN,_("Other/Unknown")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Channel"))) { - UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_BG,_("Single color (background)")); - UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_FG,_("Single color (text)")); - UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_FM,_("FM")); - UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_PULSE,_("Pulse")); - UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_NOISE,_("Noise")); - UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_PCM,_("PCM")); - UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_WAVE,_("Wave")); - UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_OP,_("FM operator")); - UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_MUTED,_("Muted")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Pattern"))) { - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_PLAY_HEAD,_("Playhead")); - UI_COLOR_CONFIG(GUI_COLOR_EDITING,_("Editing")); - UI_COLOR_CONFIG(GUI_COLOR_EDITING_CLONE,_("Editing (will clone)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR,_("Cursor")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR_HOVER,_("Cursor (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR_ACTIVE,_("Cursor (clicked)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_SELECTION,_("Selection")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_SELECTION_HOVER,_("Selection (hovered)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_SELECTION_ACTIVE,_("Selection (clicked)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_HI_1,_("Highlight 1")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_HI_2,_("Highlight 2")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX,_("Row number")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX_HI1,_("Row number (highlight 1)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX_HI2,_("Row number (highlight 2)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE,_("Note")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE_HI1,_("Note (highlight 1)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE_HI2,_("Note (highlight 2)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE,_("Blank")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE_HI1,_("Blank (highlight 1)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE_HI2,_("Blank (highlight 2)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS,_("Instrument")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS_WARN,_("Instrument (invalid type)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS_ERROR,_("Instrument (out of range)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_VOLUME_MIN,_("Volume (0%)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_VOLUME_HALF,_("Volume (50%)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_VOLUME_MAX,_("Volume (100%)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_INVALID,_("Invalid effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_PITCH,_("Pitch effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_VOLUME,_("Volume effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_PANNING,_("Panning effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SONG,_("Song effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_TIME,_("Time effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SPEED,_("Speed effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY,_("Primary specific effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,_("Secondary specific effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_MISC,_("Miscellaneous")); - UI_COLOR_CONFIG(GUI_COLOR_EE_VALUE,_("External command output")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_OFF,_("Status: off/disabled")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_REL,_("Status: off + macro rel")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_REL_ON,_("Status: on + macro rel")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_ON,_("Status: on")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_VOLUME,_("Status: volume")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_PITCH,_("Status: pitch")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_PANNING,_("Status: panning")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SYS1,_("Status: chip (primary)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SYS2,_("Status: chip (secondary)")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MIXING,_("Status: mixing")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DSP,_("Status: DSP effect")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_NOTE,_("Status: note altering")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC1,_("Status: misc color 1")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC2,_("Status: misc color 2")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC3,_("Status: misc color 3")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_ATTACK,_("Status: attack")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DECAY,_("Status: decay")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SUSTAIN,_("Status: sustain")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_RELEASE,_("Status: release")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DEC_LINEAR,_("Status: decrease linear")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DEC_EXP,_("Status: decrease exp")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_INC,_("Status: increase")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_BENT,_("Status: bent")); - UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DIRECT,_("Status: direct")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Sample Editor"))) { - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_BG,_("Background")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_FG,_("Waveform")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_TIME_BG,_("Time background")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_TIME_FG,_("Time text")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP,_("Loop region")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CENTER,_("Center guide")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_GRID,_("Grid")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_SEL,_("Selection")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_SEL_POINT,_("Selection points")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_NEEDLE,_("Preview needle")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_NEEDLE_PLAYING,_("Playing needles")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP_POINT,_("Loop markers")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_DISABLED,_("Chip select: disabled")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_ENABLED,_("Chip select: enabled")); - UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_WARNING,_("Chip select: enabled (failure)")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Pattern Manager"))) { - UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_NULL,_("Unallocated")); - UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_UNUSED,_("Unused")); - UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_USED,_("Used")); - UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_OVERUSED,_("Overused")); - UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_EXTREMELY_OVERUSED,_("Really overused")); - UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_COMBO_BREAKER,_("Combo Breaker")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Piano"))) { - UI_COLOR_CONFIG(GUI_COLOR_PIANO_BACKGROUND,_("Background")); - UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_TOP,_("Upper key")); - UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_TOP_HIT,_("Upper key (feedback)")); - UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_TOP_ACTIVE,_("Upper key (pressed)")); - UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_BOTTOM,_("Lower key")); - UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_BOTTOM_HIT,_("Lower key (feedback)")); - UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_BOTTOM_ACTIVE,_("Lower key (pressed)")); - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Clock"))) { - UI_COLOR_CONFIG(GUI_COLOR_CLOCK_TEXT,_("Clock text")); - UI_COLOR_CONFIG(GUI_COLOR_CLOCK_BEAT_LOW,_("Beat (off)")); - UI_COLOR_CONFIG(GUI_COLOR_CLOCK_BEAT_HIGH,_("Beat (on)")); - - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Patchbay"))) { - UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_PORTSET,_("PortSet")); - UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_PORT,_("Port")); - UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_PORT_HIDDEN,_("Port (hidden/unavailable)")); - UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_CONNECTION,_("Connection (selected)")); - UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_CONNECTION_BG,_("Connection (other)")); - - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Memory Composition"))) { - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BG,_("Background")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_DATA,_("Waveform data")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_FREE,_("Unknown")); - //UI_COLOR_CONFIG(GUI_COLOR_MEMORY_PADDING,_("")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_RESERVED,_("Reserved")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE,_("Sample")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT1,_("Sample (alternate 1)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT2,_("Sample (alternate 2)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT3,_("Sample (alternate 3)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_WAVE_RAM,_("Wave RAM")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_WAVE_STATIC,_("Wavetable (static)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_ECHO,_("Echo buffer")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_N163_LOAD,_("Namco 163 load pos")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_N163_PLAY,_("Namco 163 play pos")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK0,_("Sample (bank 0)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK1,_("Sample (bank 1)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK2,_("Sample (bank 2)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK3,_("Sample (bank 3)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK4,_("Sample (bank 4)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK5,_("Sample (bank 5)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK6,_("Sample (bank 6)")); - UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK7,_("Sample (bank 7)")); - - ImGui::TreePop(); - } - if (ImGui::TreeNode(_("Log Viewer"))) { - UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_ERROR,_("Log level: Error")); - UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_WARNING,_("Log level: Warning")); - UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_INFO,_("Log level: Info")); - UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_DEBUG,_("Log level: Debug")); - UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_TRACE,_("Log level: Trace/Verbose")); - ImGui::TreePop(); - } - END_SECTION; - } CONFIG_SECTION(_("Backup")) { // SUBSECTION SETTINGS CONFIG_SUBSECTION(_("Configuration")); From 0738d6f849d003f83e5b7aa4d10ba4d52d6ff2c7 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Fri, 15 Nov 2024 15:26:22 +0400 Subject: [PATCH 41/61] settings: backup, cheats --- src/gui/gui.cpp | 1 + src/gui/gui.h | 2 +- src/gui/settings.cpp | 657 ++++++++++++++++++++++--------------------- 3 files changed, 333 insertions(+), 327 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index c9ed109e61..72a7fd0084 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -8382,6 +8382,7 @@ FurnaceGUI::FurnaceGUI(): makeDrumkitMode(false), audioEngineChanged(false), settingsChanged(false), + purgeDateChanged(false), debugFFT(false), vgmExportVersion(0x171), vgmExportTrailingTicks(-1), diff --git a/src/gui/gui.h b/src/gui/gui.h index c647e19316..c5bf97fd63 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1708,7 +1708,7 @@ class FurnaceGUI { bool safeMode; bool midiWakeUp; bool makeDrumkitMode; - bool audioEngineChanged, settingsChanged, debugFFT; + bool audioEngineChanged, settingsChanged, purgeDateChanged, debugFFT; bool willExport[DIV_MAX_CHIPS]; int vgmExportVersion; int vgmExportTrailingTicks; diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 6cd7c1930a..a21bf6e0cf 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -3614,6 +3614,330 @@ void FurnaceGUI::setupSettingsCategories() { SETTINGS_CHANGED; } }) + }), + SettingsCategory(_("Backup"),{ + SettingsCategory(_("Backup Management"),{},{ + SETTING(_("Backup Management"),{ + purgeDateChanged=false; + + ImGui::AlignTextToFramePadding(); + ImGui::Text(_("Purge before:")); + ImGui::SameLine(); + ImGui::SetNextItemWidth(60.0f*dpiScale); + if (ImGui::InputInt("##PYear",&purgeYear,0,0)) purgeDateChanged=true; + ImGui::SameLine(); + ImGui::SetNextItemWidth(40.0f*dpiScale); + if (ImGui::InputInt("##PMonth",&purgeMonth,0,0)) purgeDateChanged=true; + ImGui::SameLine(); + ImGui::SetNextItemWidth(40.0f*dpiScale); + if (ImGui::InputInt("##PDay",&purgeDay,0,0)) purgeDateChanged=true; + + if (purgeDateChanged) { + // check month/day validity + time_t thisMakesNoSense=time(NULL); + bool tmFailed=false; + struct tm curTime; +#ifdef _WIN32 + struct tm* tempTM=localtime(&thisMakesNoSense); + if (tempTM==NULL) { + memset(&curTime,0,sizeof(struct tm)); + tmFailed=true; + } else { + memcpy(&curTime,tempTM,sizeof(struct tm)); + } +#else + if (localtime_r(&thisMakesNoSense,&curTime)==NULL) { + memset(&curTime,0,sizeof(struct tm)); + tmFailed=true; + } +#endif + + // don't allow dates in the future + if (!tmFailed) { + int curYear=curTime.tm_year+1900; + int curMonth=curTime.tm_mon+1; + int curDay=curTime.tm_mday; + + if (purgeYear<1) purgeYear=1; + if (purgeYear>curYear) purgeYear=curYear; + + if (purgeYear==curYear) { + if (purgeMonth>curMonth) purgeMonth=curMonth; + + if (purgeMonth==curMonth) { + if (purgeDay>curDay) purgeDay=curDay; + } + } + } + + // general checks + if (purgeYear<1) purgeYear=1; + if (purgeMonth<1) purgeMonth=1; + if (purgeMonth>12) purgeMonth=12; + if (purgeDay<1) purgeDay=1; + + // 1752 calendar alignment + if (purgeYear==1752 && purgeMonth==9) { + if (purgeDay>2 && purgeDay<14) purgeDay=2; + } + if (purgeMonth==2) { + // leap year + if ((purgeYear&3)==0 && ((purgeYear%100)!=0 || (purgeYear%400)==0)) { + if (purgeDay>29) purgeDay=29; + } else { + if (purgeDay>28) purgeDay=28; + } + } else if (purgeMonth==1 || purgeMonth==3 || purgeMonth==5 || purgeMonth==7 || purgeMonth==8 || purgeMonth==10 || purgeMonth==12) { + if (purgeDay>31) purgeDay=31; + } else { + if (purgeDay>30) purgeDay=30; + } + } + ImGui::SameLine(); + if (ImGui::Button(_("Go##PDate"))) { + purgeBackups(purgeYear,purgeMonth,purgeDay); + } + backupEntryLock.lock(); + ImGui::AlignTextToFramePadding(); + if (totalBackupSize>=(1ULL<<50ULL)) { + ImGui::Text(_("%" PRIu64 "PB used"),totalBackupSize>>50); + } else if (totalBackupSize>=(1ULL<<40ULL)) { + ImGui::Text(_("%" PRIu64 "TB used"),totalBackupSize>>40); + } else if (totalBackupSize>=(1ULL<<30ULL)) { + ImGui::Text(_("%" PRIu64 "GB used"),totalBackupSize>>30); + } else if (totalBackupSize>=(1ULL<<20ULL)) { + ImGui::Text(_("%" PRIu64 "MB used"),totalBackupSize>>20); + } else if (totalBackupSize>=(1ULL<<10ULL)) { + ImGui::Text(_("%" PRIu64 "KB used"),totalBackupSize>>10); + } else { + ImGui::Text(_("%" PRIu64 " bytes used"),totalBackupSize); + } + + ImGui::SameLine(); + + if (ImGui::Button(_("Refresh"))) { + refreshBackups=true; + } + ImGui::SameLine(); + if (ImGui::Button(_("Delete all"))) { + purgeBackups(0,0,0); + } + + if (ImGui::BeginTable("BackupList",3,ImGuiTableFlags_ScrollY|ImGuiTableFlags_Borders)) { + ImGui::TableSetupColumn(_("Name"),ImGuiTableColumnFlags_WidthStretch,0.6f); + ImGui::TableSetupColumn(_("Size"),ImGuiTableColumnFlags_WidthStretch,0.15f); + ImGui::TableSetupColumn(_("Latest"),ImGuiTableColumnFlags_WidthStretch,0.25f); + + ImGui::TableHeadersRow(); + + for (FurnaceGUIBackupEntry& i: backupEntries) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(i.name.c_str()); + ImGui::TableNextColumn(); + if (i.size>=(1ULL<<50ULL)) { + ImGui::Text(_("%" PRIu64 "P"),i.size>>50); + } else if (i.size>=(1ULL<<40ULL)) { + ImGui::Text(_("%" PRIu64 "T"),i.size>>40); + } else if (i.size>=(1ULL<<30ULL)) { + ImGui::Text(_("%" PRIu64 "G"),i.size>>30); + } else if (i.size>=(1ULL<<20ULL)) { + ImGui::Text(_("%" PRIu64 "M"),i.size>>20); + } else if (i.size>=(1ULL<<10ULL)) { + ImGui::Text(_("%" PRIu64 "K"),i.size>>10); + } else { + ImGui::Text(_("%" PRIu64 ""),i.size); + } + ImGui::TableNextColumn(); + ImGui::Text("%d-%02d-%02d",i.lastEntryTime.tm_year+1900,i.lastEntryTime.tm_mon+1,i.lastEntryTime.tm_mday); + } + + ImGui::EndTable(); + } + backupEntryLock.unlock(); + if (refreshBackups) { + refreshBackups=false; + if (backupEntryTask.valid()) backupEntryTask.get(); + backupEntryTask=std::async(std::launch::async,[this]() -> bool { + backupEntryLock.lock(); + backupEntries.clear(); + totalBackupSize=0; + backupEntryLock.unlock(); + +#ifdef _WIN32 + String findPath=backupPath+String(DIR_SEPARATOR_STR)+String("*.fur"); + WString findPathW=utf8To16(findPath.c_str()); + WIN32_FIND_DATAW next; + HANDLE backDir=FindFirstFileW(findPathW.c_str(),&next); + if (backDir!=INVALID_HANDLE_VALUE) { + do { + FurnaceGUIBackupEntry nextEntry; + String cFileNameU=utf16To8(next.cFileName); + if (!splitBackupName(cFileNameU.c_str(),nextEntry.name,nextEntry.lastEntryTime)) continue; + + nextEntry.size=(((uint64_t)next.nFileSizeHigh)<<32)|next.nFileSizeLow; + + backupEntryLock.lock(); + backupEntries.push_back(nextEntry); + totalBackupSize+=nextEntry.size; + backupEntryLock.unlock(); + } while (FindNextFileW(backDir,&next)!=0); + FindClose(backDir); + } +#else + DIR* backDir=opendir(backupPath.c_str()); + if (backDir==NULL) { + logW("could not open backups dir!"); + return false; + } + while (true) { + FurnaceGUIBackupEntry nextEntry; + struct stat nextStat; + struct dirent* next=readdir(backDir); + if (next==NULL) break; + if (strcmp(next->d_name,".")==0) continue; + if (strcmp(next->d_name,"..")==0) continue; + if (!splitBackupName(next->d_name,nextEntry.name,nextEntry.lastEntryTime)) continue; + + String nextPath=backupPath+DIR_SEPARATOR_STR+next->d_name; + + if (stat(nextPath.c_str(),&nextStat)>=0) { + nextEntry.size=nextStat.st_size; + } + + backupEntryLock.lock(); + backupEntries.push_back(nextEntry); + totalBackupSize+=nextEntry.size; + backupEntryLock.unlock(); + } + closedir(backDir); +#endif + + // sort and merge + backupEntryLock.lock(); + std::sort(backupEntries.begin(),backupEntries.end(),[](const FurnaceGUIBackupEntry& a, const FurnaceGUIBackupEntry& b) -> bool { + int sc=strcmp(a.name.c_str(),b.name.c_str()); + if (sc==0) { + if (a.lastEntryTime.tm_year==b.lastEntryTime.tm_year) { + if (a.lastEntryTime.tm_mon==b.lastEntryTime.tm_mon) { + if (a.lastEntryTime.tm_mday==b.lastEntryTime.tm_mday) { + if (a.lastEntryTime.tm_hour==b.lastEntryTime.tm_hour) { + if (a.lastEntryTime.tm_min==b.lastEntryTime.tm_min) { + return (a.lastEntryTime.tm_sec86400) settings.backupInterval=86400; + } + }), + SETTING(_("Backups per file"),{ + if (ImGui::InputInt(_("Backups per file"),&settings.backupMaxCopies)) { + if (settings.backupMaxCopies<1) settings.backupMaxCopies=1; + if (settings.backupMaxCopies>100) settings.backupMaxCopies=100; + } + }) + }), + SettingsCategory(_("Cheat Codes"),{},{ + // ok, so you decided to read the code. + // these are the cheat codes: + // "Debug" - toggles mobile UI + // "Nice Amiga cover of the song!" - enables hidden systems (YMU759/Dummy) + // "42 63" - enables all instrument types + // "4-bit FDS" - enables partial pitch linearity option + // "Power of the Chip" - enables options for multi-threaded audio (isnt that already enabled by default? maybe remove?) + // "btcdbcb" - use modern UI padding + // + // "????" - enables stuff + SETTING(_("Cheat Codes"),{ + ImGui::PushFont(headFont); + ImGui::Text(_("Enter code:")); + ImGui::PopFont(); + ImGui::InputText("##CheatCode",&mmlString[31]); + if (ImGui::Button(_("Submit"))) { + unsigned int checker=0x11111111; + unsigned int checker1=0; + int index=0; + mmlString[30]=_("invalid code"); + + for (char& i: mmlString[31]) { + checker^=((unsigned int)i)<>1|(((checker)^(checker>>2)^(checker>>3)^(checker>>5))&1)<<31); + checker1<<=1; + index=(index+1)&31; + } + if (checker==0x90888b65 && checker1==0x1482) { + mmlString[30]=_("toggled alternate UI"); + toggleMobileUI(!mobileUI); + } + if (checker==0x5a42a113 && checker1==0xe4ef451e) { + mmlString[30]=_(":smile: :star_struck: :sunglasses: :ok_hand:"); + settings.hiddenSystems=!settings.hiddenSystems; + } + if (checker==0xe888896b && checker1==0xbde) { + mmlString[30]=_("enabled all instrument types"); + settings.displayAllInsTypes=!settings.displayAllInsTypes; + } + if (checker==0x3f88abcc && checker1==0xf4a6) { + mmlString[30]=_("OK, if I bring your Partial pitch linearity will you stop bothering me?"); + settings.displayPartial=1; + } + if (checker==0x94222d83 && checker1==0x6600) { + mmlString[30]=_("enabled \"comfortable\" mode"); + ImGuiStyle& sty=ImGui::GetStyle(); + sty.FramePadding=ImVec2(20.0f*dpiScale,20.0f*dpiScale); + sty.ItemSpacing=ImVec2(10.0f*dpiScale,10.0f*dpiScale); + sty.ItemInnerSpacing=ImVec2(10.0f*dpiScale,10.0f*dpiScale); + settingsOpen=false; + } + + mmlString[31]=""; + } + ImGui::Text("%s",mmlString[30].c_str()); + }) }) }; @@ -3627,13 +3951,19 @@ void FurnaceGUI::destroySettingsCategories(SettingsCategory& cat) { } } for (Setting* i:cat.settings) { - delete i; + if (i) { + delete i; + i=NULL; + } } cat.settings.clear(); cat.children.clear(); } void FurnaceGUI::drawSettingsCategory(SettingsCategory* cat) { + if (!nonLatchNibble) { + if (strncmp(cat->name, _("Cheat Codes"), 12)==0) return; + } if (cat->children.size()>0) { ImGuiTreeNodeFlags f=ImGuiTreeNodeFlags_SpanFullWidth|ImGuiTreeNodeFlags_OpenOnArrow|ImGuiTreeNodeFlags_OpenOnDoubleClick; if (settings.activeCategory.name==cat->name) f|=ImGuiTreeNodeFlags_Selected; @@ -4337,331 +4667,6 @@ void FurnaceGUI::drawSettings() { END_SECTION; } - CONFIG_SECTION(_("Backup")) { - // SUBSECTION SETTINGS - CONFIG_SUBSECTION(_("Configuration")); - - bool backupEnableB=settings.backupEnable; - if (ImGui::Checkbox(_("Enable backup system"),&backupEnableB)) { - settings.backupEnable=backupEnableB; - SETTINGS_CHANGED; - } - - if (ImGui::InputInt(_("Interval (in seconds)"),&settings.backupInterval)) { - if (settings.backupInterval<10) settings.backupInterval=10; - if (settings.backupInterval>86400) settings.backupInterval=86400; - } - - if (ImGui::InputInt(_("Backups per file"),&settings.backupMaxCopies)) { - if (settings.backupMaxCopies<1) settings.backupMaxCopies=1; - if (settings.backupMaxCopies>100) settings.backupMaxCopies=100; - } - - // SUBSECTION SETTINGS - CONFIG_SUBSECTION(_("Backup Management")); - bool purgeDateChanged=false; - - ImGui::AlignTextToFramePadding(); - ImGui::Text(_("Purge before:")); - ImGui::SameLine(); - ImGui::SetNextItemWidth(60.0f*dpiScale); - if (ImGui::InputInt("##PYear",&purgeYear,0,0)) purgeDateChanged=true; - ImGui::SameLine(); - ImGui::SetNextItemWidth(40.0f*dpiScale); - if (ImGui::InputInt("##PMonth",&purgeMonth,0,0)) purgeDateChanged=true; - ImGui::SameLine(); - ImGui::SetNextItemWidth(40.0f*dpiScale); - if (ImGui::InputInt("##PDay",&purgeDay,0,0)) purgeDateChanged=true; - - if (purgeDateChanged) { - // check month/day validity - time_t thisMakesNoSense=time(NULL); - bool tmFailed=false; - struct tm curTime; -#ifdef _WIN32 - struct tm* tempTM=localtime(&thisMakesNoSense); - if (tempTM==NULL) { - memset(&curTime,0,sizeof(struct tm)); - tmFailed=true; - } else { - memcpy(&curTime,tempTM,sizeof(struct tm)); - } -#else - if (localtime_r(&thisMakesNoSense,&curTime)==NULL) { - memset(&curTime,0,sizeof(struct tm)); - tmFailed=true; - } -#endif - - // don't allow dates in the future - if (!tmFailed) { - int curYear=curTime.tm_year+1900; - int curMonth=curTime.tm_mon+1; - int curDay=curTime.tm_mday; - - if (purgeYear<1) purgeYear=1; - if (purgeYear>curYear) purgeYear=curYear; - - if (purgeYear==curYear) { - if (purgeMonth>curMonth) purgeMonth=curMonth; - - if (purgeMonth==curMonth) { - if (purgeDay>curDay) purgeDay=curDay; - } - } - } - - // general checks - if (purgeYear<1) purgeYear=1; - if (purgeMonth<1) purgeMonth=1; - if (purgeMonth>12) purgeMonth=12; - if (purgeDay<1) purgeDay=1; - - // 1752 calendar alignment - if (purgeYear==1752 && purgeMonth==9) { - if (purgeDay>2 && purgeDay<14) purgeDay=2; - } - if (purgeMonth==2) { - // leap year - if ((purgeYear&3)==0 && ((purgeYear%100)!=0 || (purgeYear%400)==0)) { - if (purgeDay>29) purgeDay=29; - } else { - if (purgeDay>28) purgeDay=28; - } - } else if (purgeMonth==1 || purgeMonth==3 || purgeMonth==5 || purgeMonth==7 || purgeMonth==8 || purgeMonth==10 || purgeMonth==12) { - if (purgeDay>31) purgeDay=31; - } else { - if (purgeDay>30) purgeDay=30; - } - } - - ImGui::SameLine(); - if (ImGui::Button(_("Go##PDate"))) { - purgeBackups(purgeYear,purgeMonth,purgeDay); - } - - backupEntryLock.lock(); - ImGui::AlignTextToFramePadding(); - if (totalBackupSize>=(1ULL<<50ULL)) { - ImGui::Text(_("%" PRIu64 "PB used"),totalBackupSize>>50); - } else if (totalBackupSize>=(1ULL<<40ULL)) { - ImGui::Text(_("%" PRIu64 "TB used"),totalBackupSize>>40); - } else if (totalBackupSize>=(1ULL<<30ULL)) { - ImGui::Text(_("%" PRIu64 "GB used"),totalBackupSize>>30); - } else if (totalBackupSize>=(1ULL<<20ULL)) { - ImGui::Text(_("%" PRIu64 "MB used"),totalBackupSize>>20); - } else if (totalBackupSize>=(1ULL<<10ULL)) { - ImGui::Text(_("%" PRIu64 "KB used"),totalBackupSize>>10); - } else { - ImGui::Text(_("%" PRIu64 " bytes used"),totalBackupSize); - } - - ImGui::SameLine(); - - if (ImGui::Button(_("Refresh"))) { - refreshBackups=true; - } - ImGui::SameLine(); - if (ImGui::Button(_("Delete all"))) { - purgeBackups(0,0,0); - } - - if (ImGui::BeginTable("BackupList",3,ImGuiTableFlags_ScrollY|ImGuiTableFlags_Borders)) { - ImGui::TableSetupColumn(_("Name"),ImGuiTableColumnFlags_WidthStretch,0.6f); - ImGui::TableSetupColumn(_("Size"),ImGuiTableColumnFlags_WidthStretch,0.15f); - ImGui::TableSetupColumn(_("Latest"),ImGuiTableColumnFlags_WidthStretch,0.25f); - - ImGui::TableHeadersRow(); - - for (FurnaceGUIBackupEntry& i: backupEntries) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::TextUnformatted(i.name.c_str()); - ImGui::TableNextColumn(); - if (i.size>=(1ULL<<50ULL)) { - ImGui::Text(_("%" PRIu64 "P"),i.size>>50); - } else if (i.size>=(1ULL<<40ULL)) { - ImGui::Text(_("%" PRIu64 "T"),i.size>>40); - } else if (i.size>=(1ULL<<30ULL)) { - ImGui::Text(_("%" PRIu64 "G"),i.size>>30); - } else if (i.size>=(1ULL<<20ULL)) { - ImGui::Text(_("%" PRIu64 "M"),i.size>>20); - } else if (i.size>=(1ULL<<10ULL)) { - ImGui::Text(_("%" PRIu64 "K"),i.size>>10); - } else { - ImGui::Text(_("%" PRIu64 ""),i.size); - } - ImGui::TableNextColumn(); - ImGui::Text("%d-%02d-%02d",i.lastEntryTime.tm_year+1900,i.lastEntryTime.tm_mon+1,i.lastEntryTime.tm_mday); - } - - ImGui::EndTable(); - } - backupEntryLock.unlock(); - if (refreshBackups) { - refreshBackups=false; - if (backupEntryTask.valid()) backupEntryTask.get(); - backupEntryTask=std::async(std::launch::async,[this]() -> bool { - backupEntryLock.lock(); - backupEntries.clear(); - totalBackupSize=0; - backupEntryLock.unlock(); - -#ifdef _WIN32 - String findPath=backupPath+String(DIR_SEPARATOR_STR)+String("*.fur"); - WString findPathW=utf8To16(findPath.c_str()); - WIN32_FIND_DATAW next; - HANDLE backDir=FindFirstFileW(findPathW.c_str(),&next); - if (backDir!=INVALID_HANDLE_VALUE) { - do { - FurnaceGUIBackupEntry nextEntry; - String cFileNameU=utf16To8(next.cFileName); - if (!splitBackupName(cFileNameU.c_str(),nextEntry.name,nextEntry.lastEntryTime)) continue; - - nextEntry.size=(((uint64_t)next.nFileSizeHigh)<<32)|next.nFileSizeLow; - - backupEntryLock.lock(); - backupEntries.push_back(nextEntry); - totalBackupSize+=nextEntry.size; - backupEntryLock.unlock(); - } while (FindNextFileW(backDir,&next)!=0); - FindClose(backDir); - } -#else - DIR* backDir=opendir(backupPath.c_str()); - if (backDir==NULL) { - logW("could not open backups dir!"); - return false; - } - while (true) { - FurnaceGUIBackupEntry nextEntry; - struct stat nextStat; - struct dirent* next=readdir(backDir); - if (next==NULL) break; - if (strcmp(next->d_name,".")==0) continue; - if (strcmp(next->d_name,"..")==0) continue; - if (!splitBackupName(next->d_name,nextEntry.name,nextEntry.lastEntryTime)) continue; - - String nextPath=backupPath+DIR_SEPARATOR_STR+next->d_name; - - if (stat(nextPath.c_str(),&nextStat)>=0) { - nextEntry.size=nextStat.st_size; - } - - backupEntryLock.lock(); - backupEntries.push_back(nextEntry); - totalBackupSize+=nextEntry.size; - backupEntryLock.unlock(); - } - closedir(backDir); -#endif - - // sort and merge - backupEntryLock.lock(); - std::sort(backupEntries.begin(),backupEntries.end(),[](const FurnaceGUIBackupEntry& a, const FurnaceGUIBackupEntry& b) -> bool { - int sc=strcmp(a.name.c_str(),b.name.c_str()); - if (sc==0) { - if (a.lastEntryTime.tm_year==b.lastEntryTime.tm_year) { - if (a.lastEntryTime.tm_mon==b.lastEntryTime.tm_mon) { - if (a.lastEntryTime.tm_mday==b.lastEntryTime.tm_mday) { - if (a.lastEntryTime.tm_hour==b.lastEntryTime.tm_hour) { - if (a.lastEntryTime.tm_min==b.lastEntryTime.tm_min) { - return (a.lastEntryTime.tm_sec