summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-12-17 05:58:51 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-12-17 05:58:51 +0200
commit16d6b6199d580d581f5bdb3c51ab92d1a973d31c (patch)
treee94785d84a0fd435013f695e920eca5d5fa1770e
parentff428e0fe60d8017dc340018faa62c75fcd24c20 (diff)
Prefs: Reorganizing booleans
-rw-r--r--src/prefs.h126
1 files changed, 96 insertions, 30 deletions
diff --git a/src/prefs.h b/src/prefs.h
index f22953c5..6c79a3e1 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -37,76 +37,142 @@ enum iPrefsString {
37 uiLanguage_PrefsString, 37 uiLanguage_PrefsString,
38 downloadDir_PrefsString, 38 downloadDir_PrefsString,
39 searchUrl_PrefsString, 39 searchUrl_PrefsString,
40
40 /* Network */ 41 /* Network */
41 caFile_PrefsString, 42 caFile_PrefsString,
42 caPath_PrefsString, 43 caPath_PrefsString,
43 geminiProxy_PrefsString, 44 geminiProxy_PrefsString,
44 gopherProxy_PrefsString, 45 gopherProxy_PrefsString,
45 httpProxy_PrefsString, 46 httpProxy_PrefsString,
47
46 /* Style */ 48 /* Style */
47 uiFont_PrefsString, 49 uiFont_PrefsString,
48 headingFont_PrefsString, 50 headingFont_PrefsString,
49 bodyFont_PrefsString, 51 bodyFont_PrefsString,
50 monospaceFont_PrefsString, 52 monospaceFont_PrefsString,
51 monospaceDocumentFont_PrefsString, 53 monospaceDocumentFont_PrefsString,
54
55 /* Meta */
52 max_PrefsString 56 max_PrefsString
53}; 57};
54 58
55/* TODO: Refactor at least the boolean values into an array for easier manipulation. 59/* Note: These match match the array/struct in Prefs. */
56 Then they can be (de)serialized as a group. Need to use a systematic command naming 60enum iPrefsBool {
57 convention for notifications. */ 61 /* Window and User Interface */
62 useSystemTheme_PrefsBool,
63 customFrame_PrefsBool,
64 retainWindowSize_PrefsBool,
65 uiAnimations_PrefsBool,
66 hideToolbarOnScroll_PrefsBool,
67
68 blinkingCursor_PrefsBool,
69
70 /* Document presentation */
71 sideIcon_PrefsBool,
72 time24h_PrefsBool,
73
74 /* Behavior */
75 hoverLink_PrefsBool,
76 smoothScrolling_PrefsBool,
77 loadImageInsteadOfScrolling_PrefsBool,
78 collapsePreOnLoad_PrefsBool,
79 openArchiveIndexPages_PrefsBool,
80
81 addBookmarksToBottom_PrefsBool,
82 warnAboutMissingGlyphs_PrefsBool,
83
84 /* Network */
85 decodeUserVisibleURLs_PrefsBool,
86
87 /* Style */
88 monospaceGemini_PrefsBool,
89 monospaceGopher_PrefsBool,
90 boldLinkVisited_PrefsBool,
91 boldLinkDark_PrefsBool,
92 boldLinkLight_PrefsBool,
93
94 fontSmoothing_PrefsBool,
95 bigFirstParagraph_PrefsBool,
96 quoteIcon_PrefsBool,
97 centerShortDocs_PrefsBool,
98 plainTextWrap_PrefsBool,
99
100 /* Meta */
101 max_PrefsBool
102};
103
104/* TODO: Use a systematic command naming convention for notifications. */
105
58struct Impl_Prefs { 106struct Impl_Prefs {
59 iString strings[max_PrefsString]; 107 iString strings[max_PrefsString];
108 union {
109 iBool bools[max_PrefsBool];
110 /* For convenience, contents of the array are accessible also via these members. */
111 struct {
112 /* Window and User Interface */
113 iBool useSystemTheme;
114 iBool customFrame; /* when LAGRANGE_ENABLE_CUSTOM_FRAME is defined */
115 iBool retainWindowSize;
116 iBool uiAnimations;
117 iBool hideToolbarOnScroll;
118
119 iBool blinkingCursor;
120
121 /* Document presentation */
122 iBool sideIcon;
123 iBool time24h;
124
125 /* Behavior */
126 iBool hoverLink;
127 iBool smoothScrolling;
128 iBool loadImageInsteadOfScrolling;
129 iBool collapsePreOnLoad;
130 iBool openArchiveIndexPages;
131
132 iBool addBookmarksToBottom;
133 iBool warnAboutMissingGlyphs;
134
135 /* Network */
136 iBool decodeUserVisibleURLs;
137
138 /* Style */
139 iBool monospaceGemini;
140 iBool monospaceGopher;
141 iBool boldLinkVisited;
142 iBool boldLinkDark;
143 iBool boldLinkLight;
144
145 iBool fontSmoothing;
146 iBool bigFirstParagraph;
147 iBool quoteIcon;
148 iBool centerShortDocs;
149 iBool plainTextWrap;
150 };
151 };
60 /* UI state (belongs to state.lgr...) */ 152 /* UI state (belongs to state.lgr...) */
61 int dialogTab; 153 int dialogTab;
62 int langFrom; 154 int langFrom;
63 int langTo; 155 int langTo;
64 /* Colors */ 156 /* Colors */
65 iBool useSystemTheme;
66 enum iColorTheme systemPreferredColorTheme[2]; /* dark, light */ 157 enum iColorTheme systemPreferredColorTheme[2]; /* dark, light */
67 enum iColorTheme theme; 158 enum iColorTheme theme;
68 enum iColorAccent accent; 159 enum iColorAccent accent;
69 /* Window and User Interface */ 160 /* Window and User Interface */
70 iBool customFrame; /* when LAGRANGE_ENABLE_CUSTOM_FRAME is defined */
71 iBool retainWindowSize;
72 iBool uiAnimations;
73 float uiScale; 161 float uiScale;
74 iBool hideToolbarOnScroll;
75 iBool blinkingCursor;
76 /* Document presentation */ 162 /* Document presentation */
77 int zoomPercent; 163 int zoomPercent;
78 iBool sideIcon;
79 iBool time24h;
80 /* Behavior */ 164 /* Behavior */
81 int pinSplit; /* 0: no pinning, 1: left doc, 2: right doc */ 165 int pinSplit; /* 0: no pinning, 1: left doc, 2: right doc */
82 int returnKey; 166 int returnKey;
83 iBool hoverLink;
84 iBool smoothScrolling;
85 int smoothScrollSpeed[max_ScrollType]; 167 int smoothScrollSpeed[max_ScrollType];
86 iBool loadImageInsteadOfScrolling;
87 iBool collapsePreOnLoad;
88 iBool openArchiveIndexPages;
89 iBool addBookmarksToBottom;
90 iBool warnAboutMissingGlyphs;
91 /* Network */ 168 /* Network */
92 iBool decodeUserVisibleURLs;
93 int maxCacheSize; /* MB */ 169 int maxCacheSize; /* MB */
94 int maxMemorySize; /* MB */ 170 int maxMemorySize; /* MB */
95 /* Style */ 171 /* Style */
96 iStringSet * disabledFontPacks; 172 iStringSet * disabledFontPacks;
97 iBool fontSmoothing;
98 int gemtextAnsiEscapes; 173 int gemtextAnsiEscapes;
99 iBool monospaceGemini;
100 iBool monospaceGopher;
101 iBool boldLinkVisited;
102 iBool boldLinkDark;
103 iBool boldLinkLight;
104 int lineWidth; 174 int lineWidth;
105 float lineSpacing; 175 float lineSpacing;
106 iBool bigFirstParagraph;
107 iBool quoteIcon;
108 iBool centerShortDocs;
109 iBool plainTextWrap;
110 enum iImageStyle imageStyle; 176 enum iImageStyle imageStyle;
111 /* Colors */ 177 /* Colors */
112 enum iGmDocumentTheme docThemeDark; 178 enum iGmDocumentTheme docThemeDark;