diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-15 08:11:55 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-15 08:11:55 +0300 |
commit | f5938745dcbe567d6e52f79b63151584d2c917d8 (patch) | |
tree | 3fef4e28b6546141bc0d1a92a482b792669cc8ec /src/app.c | |
parent | 2ab107766248e35c895d89834f221caee48a96bd (diff) |
Preferences: Option to bold visited links, too
Cleaned up serialization of the bool preferences a little.
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 67 |
1 files changed, 49 insertions, 18 deletions
@@ -231,22 +231,46 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
231 | appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); | 231 | appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); |
232 | appendFormat_String(str, "linespacing.set arg:%f\n", d->prefs.lineSpacing); | 232 | appendFormat_String(str, "linespacing.set arg:%f\n", d->prefs.lineSpacing); |
233 | appendFormat_String(str, "returnkey.set arg:%d\n", d->prefs.returnKey); | 233 | appendFormat_String(str, "returnkey.set arg:%d\n", d->prefs.returnKey); |
234 | /* TODO: Set up an array of booleans in Prefs and do these in a loop. */ | 234 | /* TODO: This array belongs in Prefs. It can then be used for command handling as well. */ |
235 | appendFormat_String(str, "prefs.animate.changed arg:%d\n", d->prefs.uiAnimations); | 235 | const struct { |
236 | appendFormat_String(str, "prefs.font.smooth.changed arg:%d\n", d->prefs.fontSmoothing); | 236 | const char * id; |
237 | appendFormat_String(str, "prefs.gemtext.ansi.changed arg:%d\n", d->prefs.gemtextAnsiEscapes); | 237 | const iBool *value; |
238 | appendFormat_String(str, "prefs.mono.gemini.changed arg:%d\n", d->prefs.monospaceGemini); | 238 | } boolPrefs[] = { |
239 | appendFormat_String(str, "prefs.mono.gopher.changed arg:%d\n", d->prefs.monospaceGopher); | 239 | { "prefs.animate", &d->prefs.uiAnimations }, |
240 | appendFormat_String(str, "prefs.boldlink.dark.changed arg:%d\n", d->prefs.boldLinkDark); | 240 | { "prefs.font.smooth", &d->prefs.fontSmoothing }, |
241 | appendFormat_String(str, "prefs.boldlink.light.changed arg:%d\n", d->prefs.boldLinkLight); | 241 | { "prefs.gemtext.ansi", &d->prefs.gemtextAnsiEscapes }, |
242 | appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph); | 242 | { "prefs.mono.gemini", &d->prefs.monospaceGemini }, |
243 | appendFormat_String(str, "prefs.plaintext.wrap.changed arg:%d\n", d->prefs.plainTextWrap); | 243 | { "prefs.mono.gopher", &d->prefs.monospaceGopher }, |
244 | appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon); | 244 | { "prefs.boldlink.visited", &d->prefs.boldLinkVisited }, |
245 | appendFormat_String(str, "prefs.centershort.changed arg:%d\n", d->prefs.centerShortDocs); | 245 | { "prefs.boldlink.dark", &d->prefs.boldLinkDark }, |
246 | appendFormat_String(str, "prefs.collapsepreonload.changed arg:%d\n", d->prefs.collapsePreOnLoad); | 246 | { "prefs.boldlink.light", &d->prefs.boldLinkLight }, |
247 | appendFormat_String(str, "prefs.hoverlink.changed arg:%d\n", d->prefs.hoverLink); | 247 | { "prefs.biglede", &d->prefs.bigFirstParagraph }, |
248 | appendFormat_String(str, "prefs.bookmarks.addbottom arg:%d\n", d->prefs.addBookmarksToBottom); | 248 | { "prefs.plaintext.wrap", &d->prefs.plainTextWrap }, |
249 | appendFormat_String(str, "prefs.archive.openindex.changed arg:%d\n", d->prefs.openArchiveIndexPages); | 249 | { "prefs.sideicon", &d->prefs.sideIcon }, |
250 | { "prefs.centershort", &d->prefs.centerShortDocs }, | ||
251 | { "prefs.collapsepreonload", &d->prefs.collapsePreOnLoad }, | ||
252 | { "prefs.hoverlink", &d->prefs.hoverLink }, | ||
253 | { "prefs.bookmarks.addbottom", &d->prefs.addBookmarksToBottom }, | ||
254 | { "prefs.archive.openindex", &d->prefs.openArchiveIndexPages }, | ||
255 | }; | ||
256 | iForIndices(i, boolPrefs) { | ||
257 | appendFormat_String(str, "%s.changed arg:%d\n", boolPrefs[i].id, *boolPrefs[i].value); | ||
258 | } | ||
259 | // appendFormat_String(str, "prefs.animate.changed arg:%d\n", d->prefs.uiAnimations); | ||
260 | // appendFormat_String(str, "prefs.font.smooth.changed arg:%d\n", d->prefs.fontSmoothing); | ||
261 | // appendFormat_String(str, "prefs.gemtext.ansi.changed arg:%d\n", d->prefs.gemtextAnsiEscapes); | ||
262 | // appendFormat_String(str, "prefs.mono.gemini.changed arg:%d\n", d->prefs.monospaceGemini); | ||
263 | // appendFormat_String(str, "prefs.mono.gopher.changed arg:%d\n", d->prefs.monospaceGopher); | ||
264 | // appendFormat_String(str, "prefs.boldlink.dark.changed arg:%d\n", d->prefs.boldLinkDark); | ||
265 | // appendFormat_String(str, "prefs.boldlink.light.changed arg:%d\n", d->prefs.boldLinkLight); | ||
266 | // appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph); | ||
267 | // appendFormat_String(str, "prefs.plaintext.wrap.changed arg:%d\n", d->prefs.plainTextWrap); | ||
268 | // appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon); | ||
269 | // appendFormat_String(str, "prefs.centershort.changed arg:%d\n", d->prefs.centerShortDocs); | ||
270 | // appendFormat_String(str, "prefs.collapsepreonload.changed arg:%d\n", d->prefs.collapsePreOnLoad); | ||
271 | // appendFormat_String(str, "prefs.hoverlink.changed arg:%d\n", d->prefs.hoverLink); | ||
272 | // appendFormat_String(str, "prefs.bookmarks.addbottom arg:%d\n", d->prefs.addBookmarksToBottom); | ||
273 | // appendFormat_String(str, "prefs.archive.openindex.changed arg:%d\n", d->prefs.openArchiveIndexPages); | ||
250 | appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0); | 274 | appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0); |
251 | appendFormat_String(str, "theme.set arg:%d auto:1\n", d->prefs.theme); | 275 | appendFormat_String(str, "theme.set arg:%d auto:1\n", d->prefs.theme); |
252 | appendFormat_String(str, "accent.set arg:%d\n", d->prefs.accent); | 276 | appendFormat_String(str, "accent.set arg:%d\n", d->prefs.accent); |
@@ -2376,9 +2400,13 @@ iBool handleCommand_App(const char *cmd) { | |||
2376 | return iTrue; | 2400 | return iTrue; |
2377 | } | 2401 | } |
2378 | else if (equal_Command(cmd, "prefs.boldlink.dark.changed") || | 2402 | else if (equal_Command(cmd, "prefs.boldlink.dark.changed") || |
2379 | equal_Command(cmd, "prefs.boldlink.light.changed")) { | 2403 | equal_Command(cmd, "prefs.boldlink.light.changed") || |
2404 | equal_Command(cmd, "prefs.boldlink.visited.changed")) { | ||
2380 | const iBool isSet = (arg_Command(cmd) != 0); | 2405 | const iBool isSet = (arg_Command(cmd) != 0); |
2381 | if (startsWith_CStr(cmd, "prefs.boldlink.dark")) { | 2406 | if (startsWith_CStr(cmd, "prefs.boldlink.visited")) { |
2407 | d->prefs.boldLinkVisited = isSet; | ||
2408 | } | ||
2409 | else if (startsWith_CStr(cmd, "prefs.boldlink.dark")) { | ||
2382 | d->prefs.boldLinkDark = isSet; | 2410 | d->prefs.boldLinkDark = isSet; |
2383 | } | 2411 | } |
2384 | else { | 2412 | else { |
@@ -2763,6 +2791,9 @@ iBool handleCommand_App(const char *cmd) { | |||
2763 | setFlags_Widget(findChild_Widget(dlg, "prefs.mono.gopher"), | 2791 | setFlags_Widget(findChild_Widget(dlg, "prefs.mono.gopher"), |
2764 | selected_WidgetFlag, | 2792 | selected_WidgetFlag, |
2765 | d->prefs.monospaceGopher); | 2793 | d->prefs.monospaceGopher); |
2794 | setFlags_Widget(findChild_Widget(dlg, "prefs.boldlink.visited"), | ||
2795 | selected_WidgetFlag, | ||
2796 | d->prefs.boldLinkVisited); | ||
2766 | setFlags_Widget(findChild_Widget(dlg, "prefs.boldlink.dark"), | 2797 | setFlags_Widget(findChild_Widget(dlg, "prefs.boldlink.dark"), |
2767 | selected_WidgetFlag, | 2798 | selected_WidgetFlag, |
2768 | d->prefs.boldLinkDark); | 2799 | d->prefs.boldLinkDark); |