summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/app.c b/src/app.c
index be96bf6c..9ff8ebc8 100644
--- a/src/app.c
+++ b/src/app.c
@@ -242,6 +242,7 @@ static iString *serializePrefs_App_(const iApp *d) {
242 appendFormat_String(str, "doctheme.dark.set arg:%d\n", d->prefs.docThemeDark); 242 appendFormat_String(str, "doctheme.dark.set arg:%d\n", d->prefs.docThemeDark);
243 appendFormat_String(str, "doctheme.light.set arg:%d\n", d->prefs.docThemeLight); 243 appendFormat_String(str, "doctheme.light.set arg:%d\n", d->prefs.docThemeLight);
244 appendFormat_String(str, "saturation.set arg:%d\n", (int) ((d->prefs.saturation * 100) + 0.5f)); 244 appendFormat_String(str, "saturation.set arg:%d\n", (int) ((d->prefs.saturation * 100) + 0.5f));
245 appendFormat_String(str, "imagestyle.set arg:%d\n", d->prefs.imageStyle);
245 appendFormat_String(str, "ca.file noset:1 path:%s\n", cstr_String(&d->prefs.caFile)); 246 appendFormat_String(str, "ca.file noset:1 path:%s\n", cstr_String(&d->prefs.caFile));
246 appendFormat_String(str, "ca.path path:%s\n", cstr_String(&d->prefs.caPath)); 247 appendFormat_String(str, "ca.path path:%s\n", cstr_String(&d->prefs.caPath));
247 appendFormat_String(str, "proxy.gemini address:%s\n", cstr_String(&d->prefs.geminiProxy)); 248 appendFormat_String(str, "proxy.gemini address:%s\n", cstr_String(&d->prefs.geminiProxy));
@@ -1655,6 +1656,7 @@ static void updateDropdownSelection_(iLabelWidget *dropButton, const char *selec
1655} 1656}
1656 1657
1657static void updateColorThemeButton_(iLabelWidget *button, int theme) { 1658static void updateColorThemeButton_(iLabelWidget *button, int theme) {
1659 /* TODO: These three functions are all the same? Cleanup? */
1658 if (!button) return; 1660 if (!button) return;
1659 updateDropdownSelection_(button, format_CStr(".set arg:%d", theme)); 1661 updateDropdownSelection_(button, format_CStr(".set arg:%d", theme));
1660} 1662}
@@ -1664,6 +1666,11 @@ static void updateFontButton_(iLabelWidget *button, int font) {
1664 updateDropdownSelection_(button, format_CStr(".set arg:%d", font)); 1666 updateDropdownSelection_(button, format_CStr(".set arg:%d", font));
1665} 1667}
1666 1668
1669static void updateImageStyleButton_(iLabelWidget *button, int style) {
1670 if (!button) return;
1671 updateDropdownSelection_(button, format_CStr(".set arg:%d", style));
1672}
1673
1667static iBool handlePrefsCommands_(iWidget *d, const char *cmd) { 1674static iBool handlePrefsCommands_(iWidget *d, const char *cmd) {
1668 if (equal_Command(cmd, "prefs.dismiss") || equal_Command(cmd, "preferences")) { 1675 if (equal_Command(cmd, "prefs.dismiss") || equal_Command(cmd, "preferences")) {
1669 setupSheetTransition_Mobile(d, iFalse); 1676 setupSheetTransition_Mobile(d, iFalse);
@@ -1745,6 +1752,10 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) {
1745 updateColorThemeButton_(findChild_Widget(d, "prefs.doctheme.light"), arg_Command(cmd)); 1752 updateColorThemeButton_(findChild_Widget(d, "prefs.doctheme.light"), arg_Command(cmd));
1746 return iFalse; 1753 return iFalse;
1747 } 1754 }
1755 else if (equal_Command(cmd, "imagestyle.set")) {
1756 updateImageStyleButton_(findChild_Widget(d, "prefs.imagestyle"), arg_Command(cmd));
1757 return iFalse;
1758 }
1748 else if (equal_Command(cmd, "font.set")) { 1759 else if (equal_Command(cmd, "font.set")) {
1749 updateFontButton_(findChild_Widget(d, "prefs.font"), arg_Command(cmd)); 1760 updateFontButton_(findChild_Widget(d, "prefs.font"), arg_Command(cmd));
1750 return iFalse; 1761 return iFalse;
@@ -2177,6 +2188,10 @@ iBool handleCommand_App(const char *cmd) {
2177 } 2188 }
2178 return iTrue; 2189 return iTrue;
2179 } 2190 }
2191 else if (equal_Command(cmd, "imagestyle.set")) {
2192 d->prefs.imageStyle = arg_Command(cmd);
2193 return iTrue;
2194 }
2180 else if (equal_Command(cmd, "linewidth.set")) { 2195 else if (equal_Command(cmd, "linewidth.set")) {
2181 d->prefs.lineWidth = iMax(20, arg_Command(cmd)); 2196 d->prefs.lineWidth = iMax(20, arg_Command(cmd));
2182 postCommand_App("document.layout.changed"); 2197 postCommand_App("document.layout.changed");
@@ -2611,6 +2626,7 @@ iBool handleCommand_App(const char *cmd) {
2611 setToggle_Widget(findChild_Widget(dlg, "prefs.collapsepreonload"), d->prefs.collapsePreOnLoad); 2626 setToggle_Widget(findChild_Widget(dlg, "prefs.collapsepreonload"), d->prefs.collapsePreOnLoad);
2612 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.dark"), d->prefs.docThemeDark); 2627 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.dark"), d->prefs.docThemeDark);
2613 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.light"), d->prefs.docThemeLight); 2628 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.light"), d->prefs.docThemeLight);
2629 updateImageStyleButton_(findChild_Widget(dlg, "prefs.imagestyle"), d->prefs.imageStyle);
2614 updateFontButton_(findChild_Widget(dlg, "prefs.font"), d->prefs.font); 2630 updateFontButton_(findChild_Widget(dlg, "prefs.font"), d->prefs.font);
2615 updateFontButton_(findChild_Widget(dlg, "prefs.headingfont"), d->prefs.headingFont); 2631 updateFontButton_(findChild_Widget(dlg, "prefs.headingfont"), d->prefs.headingFont);
2616 setFlags_Widget( 2632 setFlags_Widget(