diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-13 21:15:51 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-13 21:16:15 +0200 |
commit | d2f3c851a7273f35f128d4ea58b752251c5d5001 (patch) | |
tree | e0333a1e41e5e53f6b9de0e52ec38e0d69ea8e02 /src/app.c | |
parent | b8673100bd8d02dcfc997260fd6dc297287b8c71 (diff) |
Windows: Custom frame preference; further minor tweaks
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -158,6 +158,9 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
158 | iString *str = new_String(); | 158 | iString *str = new_String(); |
159 | const iSidebarWidget *sidebar = findWidget_App("sidebar"); | 159 | const iSidebarWidget *sidebar = findWidget_App("sidebar"); |
160 | const iSidebarWidget *sidebar2 = findWidget_App("sidebar2"); | 160 | const iSidebarWidget *sidebar2 = findWidget_App("sidebar2"); |
161 | #if defined (LAGRANGE_CUSTOM_FRAME) | ||
162 | appendFormat_String(str, "customframe arg:%d\n", d->prefs.customFrame); | ||
163 | #endif | ||
161 | appendFormat_String(str, "window.retain arg:%d\n", d->prefs.retainWindowSize); | 164 | appendFormat_String(str, "window.retain arg:%d\n", d->prefs.retainWindowSize); |
162 | if (d->prefs.retainWindowSize) { | 165 | if (d->prefs.retainWindowSize) { |
163 | int w, h, x, y; | 166 | int w, h, x, y; |
@@ -283,6 +286,9 @@ static void loadPrefs_App_(iApp *d) { | |||
283 | if (equal_Command(cmd, "uiscale")) { | 286 | if (equal_Command(cmd, "uiscale")) { |
284 | setUiScale_Window(get_Window(), argf_Command(cmd)); | 287 | setUiScale_Window(get_Window(), argf_Command(cmd)); |
285 | } | 288 | } |
289 | else if (equal_Command(cmd, "customframe")) { | ||
290 | d->prefs.customFrame = arg_Command(cmd); | ||
291 | } | ||
286 | else if (equal_Command(cmd, "window.setrect") && !argLabel_Command(cmd, "snap")) { | 292 | else if (equal_Command(cmd, "window.setrect") && !argLabel_Command(cmd, "snap")) { |
287 | const iInt2 pos = coord_Command(cmd); | 293 | const iInt2 pos = coord_Command(cmd); |
288 | d->initialWindowRect = init_Rect( | 294 | d->initialWindowRect = init_Rect( |
@@ -298,6 +304,9 @@ static void loadPrefs_App_(iApp *d) { | |||
298 | else { | 304 | else { |
299 | /* default preference values */ | 305 | /* default preference values */ |
300 | } | 306 | } |
307 | #if !defined (LAGRANGE_CUSTOM_FRAME) | ||
308 | d->prefs.customFrame = iFalse; | ||
309 | #endif | ||
301 | iRelease(f); | 310 | iRelease(f); |
302 | } | 311 | } |
303 | 312 | ||
@@ -603,6 +612,11 @@ void processEvents_App(enum iAppEventMode eventMode) { | |||
603 | switch (ev.type) { | 612 | switch (ev.type) { |
604 | case SDL_QUIT: | 613 | case SDL_QUIT: |
605 | d->isRunning = iFalse; | 614 | d->isRunning = iFalse; |
615 | if (findWidget_App("prefs")) { | ||
616 | /* Make sure changed preferences get saved. */ | ||
617 | postCommand_App("prefs.dismiss"); | ||
618 | processEvents_App(postedEventsOnly_AppEventMode); | ||
619 | } | ||
606 | goto backToMainLoop; | 620 | goto backToMainLoop; |
607 | case SDL_DROPFILE: { | 621 | case SDL_DROPFILE: { |
608 | iBool wasUsed = processEvent_Window(d->window, &ev); | 622 | iBool wasUsed = processEvent_Window(d->window, &ev); |
@@ -909,6 +923,8 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) { | |||
909 | postCommandf_App("downloads path:%s", | 923 | postCommandf_App("downloads path:%s", |
910 | cstr_String(text_InputWidget(findChild_Widget(d, "prefs.downloads")))); | 924 | cstr_String(text_InputWidget(findChild_Widget(d, "prefs.downloads")))); |
911 | #endif | 925 | #endif |
926 | postCommandf_App("customframe arg:%d", | ||
927 | isSelected_Widget(findChild_Widget(d, "prefs.customframe"))); | ||
912 | postCommandf_App("window.retain arg:%d", | 928 | postCommandf_App("window.retain arg:%d", |
913 | isSelected_Widget(findChild_Widget(d, "prefs.retainwindow"))); | 929 | isSelected_Widget(findChild_Widget(d, "prefs.retainwindow"))); |
914 | postCommandf_App("smoothscroll arg:%d", | 930 | postCommandf_App("smoothscroll arg:%d", |
@@ -1120,6 +1136,10 @@ iBool handleCommand_App(const char *cmd) { | |||
1120 | d->prefs.retainWindowSize = arg_Command(cmd); | 1136 | d->prefs.retainWindowSize = arg_Command(cmd); |
1121 | return iTrue; | 1137 | return iTrue; |
1122 | } | 1138 | } |
1139 | else if (equal_Command(cmd, "customframe")) { | ||
1140 | d->prefs.customFrame = arg_Command(cmd); | ||
1141 | return iTrue; | ||
1142 | } | ||
1123 | else if (equal_Command(cmd, "window.maximize")) { | 1143 | else if (equal_Command(cmd, "window.maximize")) { |
1124 | if (!argLabel_Command(cmd, "toggle")) { | 1144 | if (!argLabel_Command(cmd, "toggle")) { |
1125 | setSnap_Window(d->window, maximized_WindowSnap); | 1145 | setSnap_Window(d->window, maximized_WindowSnap); |
@@ -1409,6 +1429,7 @@ iBool handleCommand_App(const char *cmd) { | |||
1409 | setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling); | 1429 | setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling); |
1410 | setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling); | 1430 | setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling); |
1411 | setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); | 1431 | setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); |
1432 | setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame); | ||
1412 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); | 1433 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); |
1413 | setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), | 1434 | setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), |
1414 | collectNewFormat_String("%g", uiScale_Window(d->window))); | 1435 | collectNewFormat_String("%g", uiScale_Window(d->window))); |