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 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 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
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ src/gui/presets.cpp
src/gui/regView.cpp
src/gui/sampleEdit.cpp
src/gui/scaling.cpp
src/gui/settingsDef.cpp
src/gui/settings.cpp
src/gui/songInfo.cpp
src/gui/songNotes.cpp
Expand Down
7 changes: 7 additions & 0 deletions doc/2-interface/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ the Settings window allows you to change Furnace settings.

settings are saved when clicking the **OK** or **Apply** buttons at the bottom of the window, and when closing the program. several backups are kept in the Furnace settings directory.

## temp description on search bar

when starting a search, the selected category gets unselected.
settings with matching names (labels) get shown
categories with mathcing names get highlighted (non-matching get disabled)
selecting a mathcing category shows the settings of that category
to reset to show matching settings update the search bar

## General

Expand Down
72 changes: 70 additions & 2 deletions src/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ void FurnaceGUI::updateWindowTitle() {

if (sdlWin!=NULL) SDL_SetWindowTitle(sdlWin,title.c_str());

if (e->song.insLen==1) {
if (e->song.insLen==1 && !nonLatchNibble) {
unsigned int checker=0x11111111;
unsigned int checker1=0;
DivInstrument* ins=e->getIns(0);
Expand All @@ -656,7 +656,70 @@ void FurnaceGUI::updateWindowTitle() {
checker=(checker>>1|(((checker)^(checker>>2)^(checker>>3)^(checker>>5))&1)<<31);
checker1<<=1;
}
if (checker==0x5ec4497d && checker1==0x6347ee) nonLatchNibble=true;
if (checker==0x5ec4497d && checker1==0x6347ee) {
nonLatchNibble=true;
settings.categories.push_back(
SettingsCategory(_N("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(_N("Cheat Codes"),[this]{
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)<<index;
checker1+=i;
checker=(checker>>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());
})
})
);
}
}
}
}
Expand Down Expand Up @@ -7897,6 +7960,8 @@ bool FurnaceGUI::init() {
audioLoadFormats.push_back(_("all files"));
audioLoadFormats.push_back("*");

setupSettingsCategories();

logI("done!");
return true;
}
Expand Down Expand Up @@ -8232,6 +8297,8 @@ bool FurnaceGUI::finish(bool saveConfig) {
SDL_HapticClose(vibrator);
}

settings.categories.clear();

for (int i=0; i<DIV_MAX_OUTPUTS; i++) {
if (oscValues[i]) {
delete[] oscValues[i];
Expand Down Expand Up @@ -8323,6 +8390,7 @@ FurnaceGUI::FurnaceGUI():
makeDrumkitMode(false),
audioEngineChanged(false),
settingsChanged(false),
purgeDateChanged(false),
debugFFT(false),
vgmExportVersion(0x171),
vgmExportTrailingTicks(-1),
Expand Down
79 changes: 75 additions & 4 deletions src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,69 @@ struct PendingDrawOsc {

struct FurnaceCV;

struct MappedInput {
int scan;
int val;
MappedInput():
scan(SDL_SCANCODE_UNKNOWN), val(0) {}
MappedInput(int s, int v):
scan(s), val(v) {}
};

struct Setting {
const char* friendlyName;
std::function<void()> draw;
std::function<bool()> drawCondition;
public:
bool passesFilter(ImGuiTextFilter* filter) {
return drawCondition() && filter->PassFilter(_(friendlyName));
};
void drawSetting() {
if (drawCondition()) draw();
}
Setting(const char* _friendlyName, std::function<void()> _draw):
drawCondition([]{return true;}) {
friendlyName=_friendlyName;
draw=_draw;
}
Setting(const char* _friendlyName, std::function<void()> _draw, std::function<bool()> _drawCondition) {
friendlyName=_friendlyName;
draw=_draw;
drawCondition=_drawCondition;
}
~Setting() {};
};

class SettingsCategory {
public:
unsigned long long int id;
const char* name;
std::vector<SettingsCategory> children;
std::vector<Setting> settings;
bool expandChild;

SettingsCategory():
id(0),
name(NULL),
children({}),
settings({}),
expandChild(false) {}

/**
* settings category constructor.
* @param n category name.
* @param c subcategories.
* @param s category settings.
*/
SettingsCategory(const char* n, std::initializer_list<SettingsCategory> c, std::initializer_list<Setting> s):
expandChild(false) {
name=n;
children=c;
settings=s;
id=(unsigned long long int)name+(unsigned long long int)&children;
}
};

class FurnaceGUI {
DivEngine* e;

Expand Down Expand Up @@ -1656,7 +1719,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;
Expand Down Expand Up @@ -1761,7 +1824,10 @@ class FurnaceGUI {
int totalFiles;

struct Settings {
bool settingsChanged;
std::vector<SettingsCategory> categories;
SettingsCategory activeCategory; // yes a boring copy
ImGuiTextFilter filter;

int mainFontSize, patFontSize, headFontSize, iconSize;
int audioEngine;
int audioQuality;
Expand Down Expand Up @@ -2023,7 +2089,6 @@ class FurnaceGUI {
DivConfig initialSys;

Settings():
settingsChanged(false),
mainFontSize(GUI_FONT_SIZE_DEFAULT),
patFontSize(GUI_FONT_SIZE_DEFAULT),
headFontSize(27),
Expand Down Expand Up @@ -2911,7 +2976,6 @@ class FurnaceGUI {
void drawSystemChannelInfoText(const DivSysDef* whichDef);

void assignActionMap(std::map<int,int>& actionMap, int first, int last);
void drawKeybindSettingsTableRow(FurnaceGUIActions actionIdx);
void parseKeybinds();
void promptKey(int which, int bindIdx);
void doAction(int what);
Expand All @@ -2936,6 +3000,13 @@ 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 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();
void syncTutorial();
Expand Down
Loading