Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new new settings (idk what to call it tbh) #2242

Open
wants to merge 82 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
40a4c9d
le new settings code
Eknous-P Oct 8, 2024
64fbdc2
redo with abstract classes
Eknous-P Oct 9, 2024
4d77ecc
settings: more types, cleanup
Eknous-P Oct 9, 2024
0054a87
prepare combo
Eknous-P Oct 9, 2024
d92ab32
dropdown(combo) and radio settings
Eknous-P Oct 9, 2024
9f97b46
Merge branch 'tildearrow:master' into settings3
Eknous-P Oct 10, 2024
35dfdc1
settings searching
Eknous-P Oct 10, 2024
1ba0ffb
t h e r e i s n o t h i n g y o u c a n d o
Eknous-P Oct 10, 2024
9a8b92c
remove useless func, array->stdvector, cleanup
Eknous-P Oct 10, 2024
c7d33f4
remove id (use const char ptr instead), redo window cat
Eknous-P Oct 10, 2024
31cda97
more settings
Eknous-P Oct 11, 2024
a7b37a2
Merge branch 'tildearrow:master' into settings3
Eknous-P Oct 11, 2024
9090d43
better search results, items in child
Eknous-P Oct 11, 2024
9f1cfd8
init active category, bullet text for search
Eknous-P Oct 11, 2024
a13d715
dummy text dummy
Eknous-P Oct 11, 2024
4aa3a21
a
Eknous-P Oct 12, 2024
d265055
how did this happen
Eknous-P Oct 21, 2024
9e0e6d0
Merge branch 'tildearrow:master' into settings3
Eknous-P Oct 22, 2024
20cb4c5
drop "def" from setting items
Eknous-P Oct 22, 2024
5742503
prototype dropdowns with lambdas
Eknous-P Nov 3, 2024
7ec4a0e
proper destructior(s), moar setting
Eknous-P Nov 3, 2024
6dcbf9a
Merge branch 'tildearrow:master' into settings3
Eknous-P Nov 4, 2024
f48b501
dropdown text setting, how did i
Eknous-P Nov 4, 2024
d12ab23
turn dummytext to whteverdummy
Eknous-P Nov 6, 2024
26e5385
remove redundant stuff
Eknous-P Nov 6, 2024
95e153c
vertical settings window
Eknous-P Nov 6, 2024
45cad85
settingunion
Eknous-P Nov 7, 2024
013498e
deconstructor
Eknous-P Nov 7, 2024
fa046fa
setting union conditional displayability
Eknous-P Nov 8, 2024
ce78cf4
better union filterpass?
Eknous-P Nov 8, 2024
93b73d9
dammit
Eknous-P Nov 8, 2024
57180ff
Merge branch 'tildearrow:master' into settings3
Eknous-P Nov 9, 2024
1bc3862
Merge branch 'settings3' of github.com:Eknous-P/furnace into settings3
Eknous-P Nov 9, 2024
bb818bc
i dont even know
Eknous-P Nov 10, 2024
9b02e5c
UGH FINE
Eknous-P Nov 10, 2024
5a99333
more settings, draw condition
Eknous-P Nov 10, 2024
901ebd3
add more
Eknous-P Nov 11, 2024
d1ad383
settings: general section
Eknous-P Nov 11, 2024
afa1105
adjust cat treenodes
Eknous-P Nov 11, 2024
9cb981b
settigns: audio category
Eknous-P Nov 12, 2024
4430553
half of midi input
Eknous-P Nov 12, 2024
21b5aab
Merge branch 'tildearrow:master' into settings3butnotreally
Eknous-P Nov 12, 2024
7331632
settings: midi specific ctrls
Eknous-P Nov 13, 2024
a2301c4
settings: midi input actions, midi output, emulation, search box outs…
Eknous-P Nov 13, 2024
7dd1b1e
revert settings cat indent
Eknous-P Nov 13, 2024
2bfee97
more settings sections....
Eknous-P Nov 14, 2024
004d597
settings: color section
Eknous-P Nov 14, 2024
0738d6f
settings: backup, cheats
Eknous-P Nov 15, 2024
bbcca96
settings: better cheats reveal
Eknous-P Nov 15, 2024
0696b85
settings: begin keyboard sect, ditch tabbar, ditch abstract nonesense
Eknous-P Nov 16, 2024
538f853
stfu macos
Eknous-P Nov 16, 2024
e23dd0a
oh come onnnnn
Eknous-P Nov 16, 2024
f207c36
ass
Eknous-P Nov 16, 2024
5d61f7a
winshit
Eknous-P Nov 16, 2024
aa48253
settings: move setup to gui init
Eknous-P Nov 18, 2024
fcd2f93
settings: keyboard section almost
Eknous-P Nov 18, 2024
a2a8079
settings: note input
Eknous-P Nov 18, 2024
8fc6c28
fix and improve search
Eknous-P Nov 18, 2024
99c2a9c
settings: move setup to separate file, brief search explanation
Eknous-P Nov 19, 2024
7e5387e
go self
Eknous-P Nov 19, 2024
ccbeb2e
settings: fix crash on search, separator in vertical mode
Eknous-P Nov 20, 2024
2e7a1cb
settings: fix search crash, again...
Eknous-P Nov 21, 2024
a466380
settings: double indent when treenode collapsed but search make it ex…
Eknous-P Nov 22, 2024
3ba94e4
how did i leave the
Eknous-P Nov 26, 2024
60cd95e
Merge branch 'tildearrow:master' into settings3butnotreally
Eknous-P Nov 26, 2024
4383d62
Merge branch 'settings3butnotreally' into settings3-resolve
Eknous-P Dec 7, 2024
42bf231
finish merge
Eknous-P Dec 7, 2024
d299608
Merge pull request #16 from Eknous-P/settings3-resolve
Eknous-P Dec 7, 2024
0faa66c
Merge branch 'settings3butnotreally' into settings-resolve
Eknous-P Dec 24, 2024
f042860
asset drag&drop option
Eknous-P Dec 24, 2024
06b1ef4
Merge pull request #17 from Eknous-P/settings-resolve
Eknous-P Dec 24, 2024
a973cc4
setting changed on font path change
Eknous-P Dec 24, 2024
5d1b22a
fix l10n stuff
Eknous-P Dec 26, 2024
2b803b3
Merge branch 'settings3butnotreally' into settings-resolve
Eknous-P Feb 4, 2025
15f40b3
finish merge
Eknous-P Feb 4, 2025
228d13c
Merge pull request #18 from Eknous-P/settings-resolve
Eknous-P Feb 4, 2025
edb4cca
fix backup table expading
Eknous-P Feb 4, 2025
e4b1075
Merge branch 'settings3butnotreally' into settings3-resolve
Eknous-P Mar 12, 2025
2d816e5
merge: remove duplicate struct and removed settings
Eknous-P Mar 12, 2025
4d468e5
merge: reapply note sort fix
Eknous-P Mar 12, 2025
cfeccf6
Merge pull request #19 from Eknous-P/settings3-resolve
Eknous-P Mar 12, 2025
1107341
do not expand categories when name not found by search in children
Eknous-P Mar 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
proper destructior(s), moar setting
Eknous-P committed Nov 3, 2024
commit 7ec4a0e305b6a82c37915a2583f1e2ef4a23e3bd
3 changes: 3 additions & 0 deletions src/gui/gui.cpp
Original file line number Diff line number Diff line change
@@ -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; i<DIV_MAX_OUTPUTS; i++) {
if (oscValues[i]) {
delete[] oscValues[i];
2 changes: 2 additions & 0 deletions src/gui/gui.h
Original file line number Diff line number Diff line change
@@ -1610,6 +1610,7 @@ class SettingDef {
virtual void drawSetting(bool& changed);
virtual void saveSetting(DivConfig* conf);
virtual void loadSetting(DivConfig* conf);
virtual ~SettingDef();
};

class SettingsCategory {
@@ -2968,6 +2969,7 @@ class FurnaceGUI {
void writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups=GUI_SETTINGS_ALL);

void setupSettingsCategories();
void destroySettingsCategories(SettingsCategory& cat);
void drawSettingsCategory(SettingsCategory* cat);
void searchDrawSettingItems(SettingsCategory* cat);
void drawSettingsItems();
83 changes: 52 additions & 31 deletions src/gui/settings.cpp
Original file line number Diff line number Diff line change
@@ -295,6 +295,11 @@ const char* oscRenderEngines[2]={
_("GLSL (if available)")
};

const char* memUsageUnits[2]={
_("Bytes##MUU0"),
_("Kilobytes##MUU1")
};

#define SAMPLE_RATE_SELECTABLE(x) \
if (ImGui::Selectable(#x,settings.audioRate==x)) { \
settings.audioRate=x; \
@@ -361,6 +366,9 @@ const char* oscRenderEngines[2]={
void FurnaceGUI::setupSettingsCategories() {
settings.categories={
SettingsCategory("Window",{
SettingsCategory("Memory Composition",{},{
new SettingRadio(&settings.memUsageUnit,"memUsageUnit",_("Chip memory usage unit:"),NULL,1,memUsageUnits,2),
}),
SettingsCategory("Oscilloscope",{},{
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),
@@ -392,6 +400,19 @@ 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 (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;
}
49 changes: 42 additions & 7 deletions src/gui/settingsDef.h
Original file line number Diff line number Diff line change
@@ -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<void()> interact;
std::function<void()> interactFunc;
std::function<void()> 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<optionsCount; i++) {
if (ImGui::Selectable(options[i],i==*(int*)data)) {
*(int*)data=i;
changed=true;
interact();
interactFunc();
}
}
ImGui::EndCombo();
@@ -388,10 +401,12 @@ class SettingDropdown : public SettingDef {
options(NULL),
optionsCount(0),
f(0),
interact([]{}) {}
interactFunc([]{}),
setupFunc([]{}) {}
SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount):
f(0),
interact([]{}) {
interactFunc([]{}),
setupFunc([]{}) {
data=_data;
name=_name;
friendlyName=_friendlyName;
@@ -401,7 +416,19 @@ class SettingDropdown : public SettingDef {
optionsCount=_optionsCount;
}
SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags):
interact([]{}) {
interactFunc([]{}),
setupFunc([]{}) {
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<void()> _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<void()> _interact) {
SettingDropdown(int* _data, String _name, const char* _friendlyName, const char* _tooltip, int _fallback, const char** _options, int _optionsCount, ImGuiComboFlags flags, std::function<void()> _interactFunc, std::function<void()> _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