diff options
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 161 |
1 files changed, 98 insertions, 63 deletions
@@ -209,12 +209,16 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
209 | } | 209 | } |
210 | #endif | 210 | #endif |
211 | } | 211 | } |
212 | appendFormat_String(str, "uilang id:%s\n", cstr_String(&d->prefs.uiLanguage)); | 212 | appendFormat_String(str, "uilang id:%s\n", cstr_String(&d->prefs.strings[uiLanguage_PrefsString])); |
213 | appendFormat_String(str, "uiscale arg:%f\n", uiScale_Window(as_Window(d->window))); | 213 | appendFormat_String(str, "uiscale arg:%f\n", uiScale_Window(as_Window(d->window))); |
214 | appendFormat_String(str, "prefs.dialogtab arg:%d\n", d->prefs.dialogTab); | 214 | appendFormat_String(str, "prefs.dialogtab arg:%d\n", d->prefs.dialogTab); |
215 | appendFormat_String(str, "font.set arg:%d\n", d->prefs.font); | 215 | appendFormat_String(str, |
216 | appendFormat_String(str, "font.user path:%s\n", cstr_String(&d->prefs.symbolFontPath)); | 216 | "font.set ui:%s heading:%s body:%s mono:%s monodoc:%s\n", |
217 | appendFormat_String(str, "headingfont.set arg:%d\n", d->prefs.headingFont); | 217 | cstr_String(&d->prefs.strings[uiFont_PrefsString]), |
218 | cstr_String(&d->prefs.strings[headingFont_PrefsString]), | ||
219 | cstr_String(&d->prefs.strings[bodyFont_PrefsString]), | ||
220 | cstr_String(&d->prefs.strings[monospaceFont_PrefsString]), | ||
221 | cstr_String(&d->prefs.strings[monospaceDocumentFont_PrefsString])); | ||
218 | appendFormat_String(str, "zoom.set arg:%d\n", d->prefs.zoomPercent); | 222 | appendFormat_String(str, "zoom.set arg:%d\n", d->prefs.zoomPercent); |
219 | appendFormat_String(str, "smoothscroll arg:%d\n", d->prefs.smoothScrolling); | 223 | appendFormat_String(str, "smoothscroll arg:%d\n", d->prefs.smoothScrolling); |
220 | appendFormat_String(str, "scrollspeed arg:%d type:%d\n", d->prefs.smoothScrollSpeed[keyboard_ScrollType], keyboard_ScrollType); | 224 | appendFormat_String(str, "scrollspeed arg:%d type:%d\n", d->prefs.smoothScrollSpeed[keyboard_ScrollType], keyboard_ScrollType); |
@@ -247,15 +251,15 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
247 | appendFormat_String(str, "doctheme.light.set arg:%d\n", d->prefs.docThemeLight); | 251 | appendFormat_String(str, "doctheme.light.set arg:%d\n", d->prefs.docThemeLight); |
248 | appendFormat_String(str, "saturation.set arg:%d\n", (int) ((d->prefs.saturation * 100) + 0.5f)); | 252 | appendFormat_String(str, "saturation.set arg:%d\n", (int) ((d->prefs.saturation * 100) + 0.5f)); |
249 | appendFormat_String(str, "imagestyle.set arg:%d\n", d->prefs.imageStyle); | 253 | appendFormat_String(str, "imagestyle.set arg:%d\n", d->prefs.imageStyle); |
250 | appendFormat_String(str, "ca.file noset:1 path:%s\n", cstr_String(&d->prefs.caFile)); | 254 | appendFormat_String(str, "ca.file noset:1 path:%s\n", cstr_String(&d->prefs.strings[caFile_PrefsString])); |
251 | appendFormat_String(str, "ca.path path:%s\n", cstr_String(&d->prefs.caPath)); | 255 | appendFormat_String(str, "ca.path path:%s\n", cstr_String(&d->prefs.strings[caPath_PrefsString])); |
252 | appendFormat_String(str, "proxy.gemini address:%s\n", cstr_String(&d->prefs.geminiProxy)); | 256 | appendFormat_String(str, "proxy.gemini address:%s\n", cstr_String(&d->prefs.strings[geminiProxy_PrefsString])); |
253 | appendFormat_String(str, "proxy.gopher address:%s\n", cstr_String(&d->prefs.gopherProxy)); | 257 | appendFormat_String(str, "proxy.gopher address:%s\n", cstr_String(&d->prefs.strings[gopherProxy_PrefsString])); |
254 | appendFormat_String(str, "proxy.http address:%s\n", cstr_String(&d->prefs.httpProxy)); | 258 | appendFormat_String(str, "proxy.http address:%s\n", cstr_String(&d->prefs.strings[httpProxy_PrefsString])); |
255 | #if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT) | 259 | #if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT) |
256 | appendFormat_String(str, "downloads path:%s\n", cstr_String(&d->prefs.downloadDir)); | 260 | appendFormat_String(str, "downloads path:%s\n", cstr_String(&d->prefs.strings[downloadDir_PrefsString])); |
257 | #endif | 261 | #endif |
258 | appendFormat_String(str, "searchurl address:%s\n", cstr_String(&d->prefs.searchUrl)); | 262 | appendFormat_String(str, "searchurl address:%s\n", cstr_String(&d->prefs.strings[searchUrl_PrefsString])); |
259 | appendFormat_String(str, "translation.languages from:%d to:%d\n", d->prefs.langFrom, d->prefs.langTo); | 263 | appendFormat_String(str, "translation.languages from:%d to:%d\n", d->prefs.langFrom, d->prefs.langTo); |
260 | return str; | 264 | return str; |
261 | } | 265 | } |
@@ -329,7 +333,7 @@ static void loadPrefs_App_(iApp *d) { | |||
329 | } | 333 | } |
330 | else if (equal_Command(cmd, "uilang")) { | 334 | else if (equal_Command(cmd, "uilang")) { |
331 | const char *id = cstr_Rangecc(range_Command(cmd, "id")); | 335 | const char *id = cstr_Rangecc(range_Command(cmd, "id")); |
332 | setCStr_String(&d->prefs.uiLanguage, id); | 336 | setCStr_String(&d->prefs.strings[uiLanguage_PrefsString], id); |
333 | setCurrent_Lang(id); | 337 | setCurrent_Lang(id); |
334 | } | 338 | } |
335 | else if (equal_Command(cmd, "ca.file") || equal_Command(cmd, "ca.path")) { | 339 | else if (equal_Command(cmd, "ca.file") || equal_Command(cmd, "ca.path")) { |
@@ -360,7 +364,8 @@ static void loadPrefs_App_(iApp *d) { | |||
360 | } | 364 | } |
361 | if (!haveCA) { | 365 | if (!haveCA) { |
362 | /* Default CA setup. */ | 366 | /* Default CA setup. */ |
363 | setCACertificates_TlsRequest(&d->prefs.caFile, &d->prefs.caPath); | 367 | setCACertificates_TlsRequest(&d->prefs.strings[caFile_PrefsString], |
368 | &d->prefs.strings[caPath_PrefsString]); | ||
364 | } | 369 | } |
365 | #if !defined (LAGRANGE_ENABLE_CUSTOM_FRAME) | 370 | #if !defined (LAGRANGE_ENABLE_CUSTOM_FRAME) |
366 | d->prefs.customFrame = iFalse; | 371 | d->prefs.customFrame = iFalse; |
@@ -787,7 +792,7 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
787 | #endif | 792 | #endif |
788 | init_Prefs(&d->prefs); | 793 | init_Prefs(&d->prefs); |
789 | init_SiteSpec(dataDir_App_()); | 794 | init_SiteSpec(dataDir_App_()); |
790 | setCStr_String(&d->prefs.downloadDir, downloadDir_App_()); | 795 | setCStr_String(&d->prefs.strings[downloadDir_PrefsString], downloadDir_App_()); |
791 | set_Atomic(&d->pendingRefresh, iFalse); | 796 | set_Atomic(&d->pendingRefresh, iFalse); |
792 | d->isRunning = iFalse; | 797 | d->isRunning = iFalse; |
793 | d->window = NULL; | 798 | d->window = NULL; |
@@ -918,7 +923,7 @@ const iString *dataDir_App(void) { | |||
918 | } | 923 | } |
919 | 924 | ||
920 | const iString *downloadDir_App(void) { | 925 | const iString *downloadDir_App(void) { |
921 | return collect_String(cleaned_Path(&app_.prefs.downloadDir)); | 926 | return collect_String(cleaned_Path(&app_.prefs.strings[downloadDir_PrefsString])); |
922 | } | 927 | } |
923 | 928 | ||
924 | const iString *downloadPathForUrl_App(const iString *url, const iString *mime) { | 929 | const iString *downloadPathForUrl_App(const iString *url, const iString *mime) { |
@@ -1517,13 +1522,13 @@ const iString *schemeProxy_App(iRangecc scheme) { | |||
1517 | iApp *d = &app_; | 1522 | iApp *d = &app_; |
1518 | const iString *proxy = NULL; | 1523 | const iString *proxy = NULL; |
1519 | if (equalCase_Rangecc(scheme, "gemini")) { | 1524 | if (equalCase_Rangecc(scheme, "gemini")) { |
1520 | proxy = &d->prefs.geminiProxy; | 1525 | proxy = &d->prefs.strings[geminiProxy_PrefsString]; |
1521 | } | 1526 | } |
1522 | else if (equalCase_Rangecc(scheme, "gopher")) { | 1527 | else if (equalCase_Rangecc(scheme, "gopher")) { |
1523 | proxy = &d->prefs.gopherProxy; | 1528 | proxy = &d->prefs.strings[gopherProxy_PrefsString]; |
1524 | } | 1529 | } |
1525 | else if (equalCase_Rangecc(scheme, "http") || equalCase_Rangecc(scheme, "https")) { | 1530 | else if (equalCase_Rangecc(scheme, "http") || equalCase_Rangecc(scheme, "https")) { |
1526 | proxy = &d->prefs.httpProxy; | 1531 | proxy = &d->prefs.strings[httpProxy_PrefsString]; |
1527 | } | 1532 | } |
1528 | return isEmpty_String(proxy) ? NULL : proxy; | 1533 | return isEmpty_String(proxy) ? NULL : proxy; |
1529 | } | 1534 | } |
@@ -1727,9 +1732,9 @@ static void updateColorThemeButton_(iLabelWidget *button, int theme) { | |||
1727 | updateDropdownSelection_LabelWidget(button, format_CStr(".set arg:%d", theme)); | 1732 | updateDropdownSelection_LabelWidget(button, format_CStr(".set arg:%d", theme)); |
1728 | } | 1733 | } |
1729 | 1734 | ||
1730 | static void updateFontButton_(iLabelWidget *button, int font) { | 1735 | static void updateFontButton_(iLabelWidget *button, const iString *fontId) { |
1731 | if (!button) return; | 1736 | if (!button || isEmpty_String(fontId)) return; |
1732 | updateDropdownSelection_LabelWidget(button, format_CStr(".set arg:%d", font)); | 1737 | updateDropdownSelection_LabelWidget(button, format_CStr(":%s", cstr_String(fontId))); |
1733 | } | 1738 | } |
1734 | 1739 | ||
1735 | static void updateImageStyleButton_(iLabelWidget *button, int style) { | 1740 | static void updateImageStyleButton_(iLabelWidget *button, int style) { |
@@ -1823,11 +1828,11 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) { | |||
1823 | return iFalse; | 1828 | return iFalse; |
1824 | } | 1829 | } |
1825 | else if (equal_Command(cmd, "font.set")) { | 1830 | else if (equal_Command(cmd, "font.set")) { |
1826 | updateFontButton_(findChild_Widget(d, "prefs.font"), arg_Command(cmd)); | 1831 | updateFontButton_(findChild_Widget(d, "prefs.font.ui"), string_Command(cmd, "ui")); |
1827 | return iFalse; | 1832 | updateFontButton_(findChild_Widget(d, "prefs.font.heading"), string_Command(cmd, "heading")); |
1828 | } | 1833 | updateFontButton_(findChild_Widget(d, "prefs.font.body"), string_Command(cmd, "body")); |
1829 | else if (equal_Command(cmd, "headingfont.set")) { | 1834 | updateFontButton_(findChild_Widget(d, "prefs.font.mono"), string_Command(cmd, "mono")); |
1830 | updateFontButton_(findChild_Widget(d, "prefs.headingfont"), arg_Command(cmd)); | 1835 | updateFontButton_(findChild_Widget(d, "prefs.font.monodoc"), string_Command(cmd, "monodoc")); |
1831 | return iFalse; | 1836 | return iFalse; |
1832 | } | 1837 | } |
1833 | else if (startsWith_CStr(cmd, "input.ended id:prefs.linespacing")) { | 1838 | else if (startsWith_CStr(cmd, "input.ended id:prefs.linespacing")) { |
@@ -2040,11 +2045,12 @@ iBool willUseProxy_App(const iRangecc scheme) { | |||
2040 | 2045 | ||
2041 | const iString *searchQueryUrl_App(const iString *queryStringUnescaped) { | 2046 | const iString *searchQueryUrl_App(const iString *queryStringUnescaped) { |
2042 | iApp *d = &app_; | 2047 | iApp *d = &app_; |
2043 | if (isEmpty_String(&d->prefs.searchUrl)) { | 2048 | if (isEmpty_String(&d->prefs.strings[searchUrl_PrefsString])) { |
2044 | return collectNew_String(); | 2049 | return collectNew_String(); |
2045 | } | 2050 | } |
2046 | const iString *escaped = urlEncode_String(queryStringUnescaped); | 2051 | const iString *escaped = urlEncode_String(queryStringUnescaped); |
2047 | return collectNewFormat_String("%s?%s", cstr_String(&d->prefs.searchUrl), cstr_String(escaped)); | 2052 | return collectNewFormat_String( |
2053 | "%s?%s", cstr_String(&d->prefs.strings[searchUrl_PrefsString]), cstr_String(escaped)); | ||
2048 | } | 2054 | } |
2049 | 2055 | ||
2050 | static void resetFonts_App_(iApp *d) { | 2056 | static void resetFonts_App_(iApp *d) { |
@@ -2074,9 +2080,10 @@ iBool handleCommand_App(const char *cmd) { | |||
2074 | } | 2080 | } |
2075 | else if (equal_Command(cmd, "uilang")) { | 2081 | else if (equal_Command(cmd, "uilang")) { |
2076 | const iString *lang = string_Command(cmd, "id"); | 2082 | const iString *lang = string_Command(cmd, "id"); |
2077 | if (!equal_String(lang, &d->prefs.uiLanguage)) { | 2083 | iString *val = &d->prefs.strings[uiLanguage_PrefsString]; |
2078 | set_String(&d->prefs.uiLanguage, lang); | 2084 | if (!equal_String(lang, val)) { |
2079 | setCurrent_Lang(cstr_String(&d->prefs.uiLanguage)); | 2085 | set_String(val, lang); |
2086 | setCurrent_Lang(cstr_String(val)); | ||
2080 | postCommand_App("lang.changed"); | 2087 | postCommand_App("lang.changed"); |
2081 | } | 2088 | } |
2082 | return iTrue; | 2089 | return iTrue; |
@@ -2148,14 +2155,38 @@ iBool handleCommand_App(const char *cmd) { | |||
2148 | if (!isFrozen) { | 2155 | if (!isFrozen) { |
2149 | setFreezeDraw_MainWindow(get_MainWindow(), iTrue); | 2156 | setFreezeDraw_MainWindow(get_MainWindow(), iTrue); |
2150 | } | 2157 | } |
2151 | d->prefs.font = arg_Command(cmd); | 2158 | struct { |
2152 | setContentFont_Text(text_Window(d->window), d->prefs.font); | 2159 | const char *label; |
2160 | enum iPrefsString ps; | ||
2161 | int fontId; | ||
2162 | } params[] = { | ||
2163 | { "ui", uiFont_PrefsString, default_FontId }, | ||
2164 | { "mono", monospaceFont_PrefsString, monospace_FontId }, | ||
2165 | { "heading", headingFont_PrefsString, documentHeading_FontId }, | ||
2166 | { "body", bodyFont_PrefsString, documentBody_FontId }, | ||
2167 | { "monodoc", monospaceDocumentFont_PrefsString, documentMonospace_FontId }, | ||
2168 | }; | ||
2169 | iBool wasChanged = iFalse; | ||
2170 | iForIndices(i, params) { | ||
2171 | if (hasLabel_Command(cmd, params[i].label)) { | ||
2172 | iString *ps = &d->prefs.strings[params[i].ps]; | ||
2173 | const iString *newFont = string_Command(cmd, params[i].label); | ||
2174 | if (!equal_String(ps, newFont)) { | ||
2175 | set_String(ps, newFont); | ||
2176 | wasChanged = iTrue; | ||
2177 | } | ||
2178 | } | ||
2179 | } | ||
2180 | if (wasChanged) { | ||
2181 | resetFonts_Text(text_Window(get_MainWindow())); | ||
2182 | } | ||
2153 | if (!isFrozen) { | 2183 | if (!isFrozen) { |
2154 | postCommand_App("font.changed"); | 2184 | postCommand_App("font.changed"); |
2155 | postCommand_App("window.unfreeze"); | 2185 | postCommand_App("window.unfreeze"); |
2156 | } | 2186 | } |
2157 | return iTrue; | 2187 | return iTrue; |
2158 | } | 2188 | } |
2189 | #if 0 | ||
2159 | else if (equal_Command(cmd, "headingfont.set")) { | 2190 | else if (equal_Command(cmd, "headingfont.set")) { |
2160 | if (!isFrozen) { | 2191 | if (!isFrozen) { |
2161 | setFreezeDraw_MainWindow(get_MainWindow(), iTrue); | 2192 | setFreezeDraw_MainWindow(get_MainWindow(), iTrue); |
@@ -2168,12 +2199,13 @@ iBool handleCommand_App(const char *cmd) { | |||
2168 | } | 2199 | } |
2169 | return iTrue; | 2200 | return iTrue; |
2170 | } | 2201 | } |
2202 | #endif | ||
2171 | else if (equal_Command(cmd, "zoom.set")) { | 2203 | else if (equal_Command(cmd, "zoom.set")) { |
2172 | if (!isFrozen) { | 2204 | if (!isFrozen) { |
2173 | setFreezeDraw_MainWindow(get_MainWindow(), iTrue); /* no intermediate draws before docs updated */ | 2205 | setFreezeDraw_MainWindow(get_MainWindow(), iTrue); /* no intermediate draws before docs updated */ |
2174 | } | 2206 | } |
2175 | d->prefs.zoomPercent = arg_Command(cmd); | 2207 | d->prefs.zoomPercent = arg_Command(cmd); |
2176 | setContentFontSize_Text(text_Window(d->window), (float) d->prefs.zoomPercent / 100.0f); | 2208 | setDocumentFontSize_Text(text_Window(d->window), (float) d->prefs.zoomPercent / 100.0f); |
2177 | if (!isFrozen) { | 2209 | if (!isFrozen) { |
2178 | postCommand_App("font.changed"); | 2210 | postCommand_App("font.changed"); |
2179 | postCommand_App("window.unfreeze"); | 2211 | postCommand_App("window.unfreeze"); |
@@ -2189,7 +2221,7 @@ iBool handleCommand_App(const char *cmd) { | |||
2189 | delta /= 2; | 2221 | delta /= 2; |
2190 | } | 2222 | } |
2191 | d->prefs.zoomPercent = iClamp(d->prefs.zoomPercent + delta, 50, 200); | 2223 | d->prefs.zoomPercent = iClamp(d->prefs.zoomPercent + delta, 50, 200); |
2192 | setContentFontSize_Text(text_Window(d->window), (float) d->prefs.zoomPercent / 100.0f); | 2224 | setDocumentFontSize_Text(text_Window(d->window), (float) d->prefs.zoomPercent / 100.0f); |
2193 | if (!isFrozen) { | 2225 | if (!isFrozen) { |
2194 | postCommand_App("font.changed"); | 2226 | postCommand_App("font.changed"); |
2195 | postCommand_App("window.unfreeze"); | 2227 | postCommand_App("window.unfreeze"); |
@@ -2388,7 +2420,7 @@ iBool handleCommand_App(const char *cmd) { | |||
2388 | return iTrue; | 2420 | return iTrue; |
2389 | } | 2421 | } |
2390 | else if (equal_Command(cmd, "searchurl")) { | 2422 | else if (equal_Command(cmd, "searchurl")) { |
2391 | iString *url = &d->prefs.searchUrl; | 2423 | iString *url = &d->prefs.strings[searchUrl_PrefsString]; |
2392 | setCStr_String(url, suffixPtr_Command(cmd, "address")); | 2424 | setCStr_String(url, suffixPtr_Command(cmd, "address")); |
2393 | if (startsWith_String(url, "//")) { | 2425 | if (startsWith_String(url, "//")) { |
2394 | prependCStr_String(url, "gemini:"); | 2426 | prependCStr_String(url, "gemini:"); |
@@ -2399,20 +2431,20 @@ iBool handleCommand_App(const char *cmd) { | |||
2399 | return iTrue; | 2431 | return iTrue; |
2400 | } | 2432 | } |
2401 | else if (equal_Command(cmd, "proxy.gemini")) { | 2433 | else if (equal_Command(cmd, "proxy.gemini")) { |
2402 | setCStr_String(&d->prefs.geminiProxy, suffixPtr_Command(cmd, "address")); | 2434 | setCStr_String(&d->prefs.strings[geminiProxy_PrefsString], suffixPtr_Command(cmd, "address")); |
2403 | return iTrue; | 2435 | return iTrue; |
2404 | } | 2436 | } |
2405 | else if (equal_Command(cmd, "proxy.gopher")) { | 2437 | else if (equal_Command(cmd, "proxy.gopher")) { |
2406 | setCStr_String(&d->prefs.gopherProxy, suffixPtr_Command(cmd, "address")); | 2438 | setCStr_String(&d->prefs.strings[gopherProxy_PrefsString], suffixPtr_Command(cmd, "address")); |
2407 | return iTrue; | 2439 | return iTrue; |
2408 | } | 2440 | } |
2409 | else if (equal_Command(cmd, "proxy.http")) { | 2441 | else if (equal_Command(cmd, "proxy.http")) { |
2410 | setCStr_String(&d->prefs.httpProxy, suffixPtr_Command(cmd, "address")); | 2442 | setCStr_String(&d->prefs.strings[httpProxy_PrefsString], suffixPtr_Command(cmd, "address")); |
2411 | return iTrue; | 2443 | return iTrue; |
2412 | } | 2444 | } |
2413 | #if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT) | 2445 | #if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT) |
2414 | else if (equal_Command(cmd, "downloads")) { | 2446 | else if (equal_Command(cmd, "downloads")) { |
2415 | setCStr_String(&d->prefs.downloadDir, suffixPtr_Command(cmd, "path")); | 2447 | setCStr_String(&d->prefs.strings[downloadDir_PrefsString], suffixPtr_Command(cmd, "path")); |
2416 | return iTrue; | 2448 | return iTrue; |
2417 | } | 2449 | } |
2418 | #endif | 2450 | #endif |
@@ -2421,16 +2453,16 @@ iBool handleCommand_App(const char *cmd) { | |||
2421 | return iTrue; | 2453 | return iTrue; |
2422 | } | 2454 | } |
2423 | else if (equal_Command(cmd, "ca.file")) { | 2455 | else if (equal_Command(cmd, "ca.file")) { |
2424 | setCStr_String(&d->prefs.caFile, suffixPtr_Command(cmd, "path")); | 2456 | setCStr_String(&d->prefs.strings[caFile_PrefsString], suffixPtr_Command(cmd, "path")); |
2425 | if (!argLabel_Command(cmd, "noset")) { | 2457 | if (!argLabel_Command(cmd, "noset")) { |
2426 | setCACertificates_TlsRequest(&d->prefs.caFile, &d->prefs.caPath); | 2458 | setCACertificates_TlsRequest(&d->prefs.strings[caFile_PrefsString], &d->prefs.strings[caPath_PrefsString]); |
2427 | } | 2459 | } |
2428 | return iTrue; | 2460 | return iTrue; |
2429 | } | 2461 | } |
2430 | else if (equal_Command(cmd, "ca.path")) { | 2462 | else if (equal_Command(cmd, "ca.path")) { |
2431 | setCStr_String(&d->prefs.caPath, suffixPtr_Command(cmd, "path")); | 2463 | setCStr_String(&d->prefs.strings[caPath_PrefsString], suffixPtr_Command(cmd, "path")); |
2432 | if (!argLabel_Command(cmd, "noset")) { | 2464 | if (!argLabel_Command(cmd, "noset")) { |
2433 | setCACertificates_TlsRequest(&d->prefs.caFile, &d->prefs.caPath); | 2465 | setCACertificates_TlsRequest(&d->prefs.strings[caFile_PrefsString], &d->prefs.strings[caPath_PrefsString]); |
2434 | } | 2466 | } |
2435 | return iTrue; | 2467 | return iTrue; |
2436 | } | 2468 | } |
@@ -2465,7 +2497,7 @@ iBool handleCommand_App(const char *cmd) { | |||
2465 | return iTrue; | 2497 | return iTrue; |
2466 | } | 2498 | } |
2467 | if (argLabel_Command(cmd, "default") || equalCase_Rangecc(parts.scheme, "mailto") || | 2499 | if (argLabel_Command(cmd, "default") || equalCase_Rangecc(parts.scheme, "mailto") || |
2468 | ((noProxy || isEmpty_String(&d->prefs.httpProxy)) && | 2500 | ((noProxy || isEmpty_String(&d->prefs.strings[httpProxy_PrefsString])) && |
2469 | (equalCase_Rangecc(parts.scheme, "http") || | 2501 | (equalCase_Rangecc(parts.scheme, "http") || |
2470 | equalCase_Rangecc(parts.scheme, "https")))) { | 2502 | equalCase_Rangecc(parts.scheme, "https")))) { |
2471 | openInDefaultBrowser_App(url); | 2503 | openInDefaultBrowser_App(url); |
@@ -2653,7 +2685,7 @@ iBool handleCommand_App(const char *cmd) { | |||
2653 | else if (equal_Command(cmd, "preferences")) { | 2685 | else if (equal_Command(cmd, "preferences")) { |
2654 | iWidget *dlg = makePreferences_Widget(); | 2686 | iWidget *dlg = makePreferences_Widget(); |
2655 | updatePrefsThemeButtons_(dlg); | 2687 | updatePrefsThemeButtons_(dlg); |
2656 | setText_InputWidget(findChild_Widget(dlg, "prefs.downloads"), &d->prefs.downloadDir); | 2688 | setText_InputWidget(findChild_Widget(dlg, "prefs.downloads"), &d->prefs.strings[downloadDir_PrefsString]); |
2657 | setToggle_Widget(findChild_Widget(dlg, "prefs.hoverlink"), d->prefs.hoverLink); | 2689 | setToggle_Widget(findChild_Widget(dlg, "prefs.hoverlink"), d->prefs.hoverLink); |
2658 | setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling); | 2690 | setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling); |
2659 | setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling); | 2691 | setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling); |
@@ -2662,24 +2694,24 @@ iBool handleCommand_App(const char *cmd) { | |||
2662 | setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); | 2694 | setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); |
2663 | setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame); | 2695 | setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame); |
2664 | setToggle_Widget(findChild_Widget(dlg, "prefs.animate"), d->prefs.uiAnimations); | 2696 | setToggle_Widget(findChild_Widget(dlg, "prefs.animate"), d->prefs.uiAnimations); |
2665 | setText_InputWidget(findChild_Widget(dlg, "prefs.userfont"), &d->prefs.symbolFontPath); | 2697 | // setText_InputWidget(findChild_Widget(dlg, "prefs.userfont"), &d->prefs.symbolFontPath); |
2666 | updatePrefsPinSplitButtons_(dlg, d->prefs.pinSplit); | 2698 | updatePrefsPinSplitButtons_(dlg, d->prefs.pinSplit); |
2667 | updateScrollSpeedButtons_(dlg, mouse_ScrollType, d->prefs.smoothScrollSpeed[mouse_ScrollType]); | 2699 | updateScrollSpeedButtons_(dlg, mouse_ScrollType, d->prefs.smoothScrollSpeed[mouse_ScrollType]); |
2668 | updateScrollSpeedButtons_(dlg, keyboard_ScrollType, d->prefs.smoothScrollSpeed[keyboard_ScrollType]); | 2700 | updateScrollSpeedButtons_(dlg, keyboard_ScrollType, d->prefs.smoothScrollSpeed[keyboard_ScrollType]); |
2669 | updateDropdownSelection_LabelWidget(findChild_Widget(dlg, "prefs.uilang"), cstr_String(&d->prefs.uiLanguage)); | 2701 | updateDropdownSelection_LabelWidget(findChild_Widget(dlg, "prefs.uilang"), cstr_String(&d->prefs.strings[uiLanguage_PrefsString])); |
2670 | updateDropdownSelection_LabelWidget( | 2702 | updateDropdownSelection_LabelWidget( |
2671 | findChild_Widget(dlg, "prefs.returnkey"), | 2703 | findChild_Widget(dlg, "prefs.returnkey"), |
2672 | format_CStr("returnkey.set arg:%d", d->prefs.returnKey)); | 2704 | format_CStr("returnkey.set arg:%d", d->prefs.returnKey)); |
2673 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); | 2705 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); |
2674 | setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), | 2706 | setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), |
2675 | collectNewFormat_String("%g", uiScale_Window(as_Window(d->window)))); | 2707 | collectNewFormat_String("%g", uiScale_Window(as_Window(d->window)))); |
2676 | setFlags_Widget(findChild_Widget(dlg, format_CStr("prefs.font.%d", d->prefs.font)), | 2708 | // setFlags_Widget(findChild_Widget(dlg, format_CStr("prefs.font.%d", d->prefs.font)), |
2677 | selected_WidgetFlag, | 2709 | // selected_WidgetFlag, |
2678 | iTrue); | 2710 | // iTrue); |
2679 | setFlags_Widget( | 2711 | // setFlags_Widget( |
2680 | findChild_Widget(dlg, format_CStr("prefs.headingfont.%d", d->prefs.headingFont)), | 2712 | // findChild_Widget(dlg, format_CStr("prefs.headingfont.%d", d->prefs.headingFont)), |
2681 | selected_WidgetFlag, | 2713 | // selected_WidgetFlag, |
2682 | iTrue); | 2714 | // iTrue); |
2683 | setFlags_Widget(findChild_Widget(dlg, "prefs.mono.gemini"), | 2715 | setFlags_Widget(findChild_Widget(dlg, "prefs.mono.gemini"), |
2684 | selected_WidgetFlag, | 2716 | selected_WidgetFlag, |
2685 | d->prefs.monospaceGemini); | 2717 | d->prefs.monospaceGemini); |
@@ -2710,8 +2742,11 @@ iBool handleCommand_App(const char *cmd) { | |||
2710 | updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.dark"), d->prefs.docThemeDark); | 2742 | updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.dark"), d->prefs.docThemeDark); |
2711 | updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.light"), d->prefs.docThemeLight); | 2743 | updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.light"), d->prefs.docThemeLight); |
2712 | updateImageStyleButton_(findChild_Widget(dlg, "prefs.imagestyle"), d->prefs.imageStyle); | 2744 | updateImageStyleButton_(findChild_Widget(dlg, "prefs.imagestyle"), d->prefs.imageStyle); |
2713 | updateFontButton_(findChild_Widget(dlg, "prefs.font"), d->prefs.font); | 2745 | updateFontButton_(findChild_Widget(dlg, "prefs.font.ui"), &d->prefs.strings[uiFont_PrefsString]); |
2714 | updateFontButton_(findChild_Widget(dlg, "prefs.headingfont"), d->prefs.headingFont); | 2746 | updateFontButton_(findChild_Widget(dlg, "prefs.font.heading"), &d->prefs.strings[headingFont_PrefsString]); |
2747 | updateFontButton_(findChild_Widget(dlg, "prefs.font.body"), &d->prefs.strings[bodyFont_PrefsString]); | ||
2748 | updateFontButton_(findChild_Widget(dlg, "prefs.font.mono"), &d->prefs.strings[monospaceFont_PrefsString]); | ||
2749 | updateFontButton_(findChild_Widget(dlg, "prefs.font.monodoc"), &d->prefs.strings[monospaceDocumentFont_PrefsString]); | ||
2715 | setFlags_Widget( | 2750 | setFlags_Widget( |
2716 | findChild_Widget( | 2751 | findChild_Widget( |
2717 | dlg, format_CStr("prefs.saturation.%d", (int) (d->prefs.saturation * 3.99f))), | 2752 | dlg, format_CStr("prefs.saturation.%d", (int) (d->prefs.saturation * 3.99f))), |
@@ -2722,12 +2757,12 @@ iBool handleCommand_App(const char *cmd) { | |||
2722 | setText_InputWidget(findChild_Widget(dlg, "prefs.memorysize"), | 2757 | setText_InputWidget(findChild_Widget(dlg, "prefs.memorysize"), |
2723 | collectNewFormat_String("%d", d->prefs.maxMemorySize)); | 2758 | collectNewFormat_String("%d", d->prefs.maxMemorySize)); |
2724 | setToggle_Widget(findChild_Widget(dlg, "prefs.decodeurls"), d->prefs.decodeUserVisibleURLs); | 2759 | setToggle_Widget(findChild_Widget(dlg, "prefs.decodeurls"), d->prefs.decodeUserVisibleURLs); |
2725 | setText_InputWidget(findChild_Widget(dlg, "prefs.searchurl"), &d->prefs.searchUrl); | 2760 | setText_InputWidget(findChild_Widget(dlg, "prefs.searchurl"), &d->prefs.strings[searchUrl_PrefsString]); |
2726 | setText_InputWidget(findChild_Widget(dlg, "prefs.ca.file"), &d->prefs.caFile); | 2761 | setText_InputWidget(findChild_Widget(dlg, "prefs.ca.file"), &d->prefs.strings[caFile_PrefsString]); |
2727 | setText_InputWidget(findChild_Widget(dlg, "prefs.ca.path"), &d->prefs.caPath); | 2762 | setText_InputWidget(findChild_Widget(dlg, "prefs.ca.path"), &d->prefs.strings[caPath_PrefsString]); |
2728 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gemini"), &d->prefs.geminiProxy); | 2763 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gemini"), &d->prefs.strings[geminiProxy_PrefsString]); |
2729 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"), &d->prefs.gopherProxy); | 2764 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"), &d->prefs.strings[gopherProxy_PrefsString]); |
2730 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.http"), &d->prefs.httpProxy); | 2765 | setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.http"), &d->prefs.strings[httpProxy_PrefsString]); |
2731 | iWidget *tabs = findChild_Widget(dlg, "prefs.tabs"); | 2766 | iWidget *tabs = findChild_Widget(dlg, "prefs.tabs"); |
2732 | if (tabs) { | 2767 | if (tabs) { |
2733 | showTabPage_Widget(tabs, tabPage_Widget(tabs, d->prefs.dialogTab)); | 2768 | showTabPage_Widget(tabs, tabPage_Widget(tabs, d->prefs.dialogTab)); |