diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-21 08:19:02 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-21 08:19:02 +0300 |
commit | 9721a5f46bd2e3b1cc564cf615ef716658ef9c1a (patch) | |
tree | ad5a5197991ef7e7d4a6a44c954f8f946a5e9463 /src/gmdocument.c | |
parent | fb01da68c401287376699409858d2b0ec507e52b (diff) |
Added Prefs; placeholders for new options
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r-- | src/gmdocument.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 39c45c80..0129db64 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -331,6 +331,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
331 | static const char *globe = "\U0001f310"; | 331 | static const char *globe = "\U0001f310"; |
332 | static const char *quote = "\u201c"; | 332 | static const char *quote = "\u201c"; |
333 | const float midRunSkip = 0; /*0.120f;*/ /* extra space between wrapped text/quote lines */ | 333 | const float midRunSkip = 0; /*0.120f;*/ /* extra space between wrapped text/quote lines */ |
334 | const iPrefs *prefs = prefs_App(); | ||
334 | clear_Array(&d->layout); | 335 | clear_Array(&d->layout); |
335 | clearLinks_GmDocument_(d); | 336 | clearLinks_GmDocument_(d); |
336 | clear_Array(&d->headings); | 337 | clear_Array(&d->headings); |
@@ -341,7 +342,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
341 | const iRangecc content = range_String(&d->source); | 342 | const iRangecc content = range_String(&d->source); |
342 | iRangecc contentLine = iNullRange; | 343 | iRangecc contentLine = iNullRange; |
343 | iInt2 pos = zero_I2(); | 344 | iInt2 pos = zero_I2(); |
344 | iBool isFirstText = isGemini; | 345 | iBool isFirstText = isGemini && prefs->bigFirstParagraph; |
345 | iBool addQuoteIcon = iTrue; | 346 | iBool addQuoteIcon = iTrue; |
346 | iBool isPreformat = iFalse; | 347 | iBool isPreformat = iFalse; |
347 | iRangecc preAltText = iNullRange; | 348 | iRangecc preAltText = iNullRange; |
@@ -650,9 +651,11 @@ void reset_GmDocument(iGmDocument *d) { | |||
650 | } | 651 | } |
651 | 652 | ||
652 | void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | 653 | void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { |
653 | const float saturationLevel = 1.0f; /* TODO: user setting */ | 654 | const iPrefs * prefs = prefs_App(); |
654 | const iBool isLightMode = isLight_ColorTheme(colorTheme_App()); | 655 | enum iGmDocumentTheme theme = |
655 | const iBool isDarkMode = !isLightMode; | 656 | (isDark_ColorTheme(colorTheme_App()) ? prefs->docThemeDark : prefs->docThemeLight); |
657 | // const iBool isLightMode = isLight_ColorTheme(colorTheme_App()); | ||
658 | // const iBool isDarkMode = !isLightMode; | ||
656 | static const iChar siteIcons[] = { | 659 | static const iChar siteIcons[] = { |
657 | 0x203b, 0x2042, 0x205c, 0x2182, 0x25ed, 0x2600, 0x2601, 0x2604, 0x2605, 0x2606, | 660 | 0x203b, 0x2042, 0x205c, 0x2182, 0x25ed, 0x2600, 0x2601, 0x2604, 0x2605, 0x2606, |
658 | 0x265c, 0x265e, 0x2690, 0x2691, 0x2693, 0x2698, 0x2699, 0x26f0, 0x270e, 0x2728, | 661 | 0x265c, 0x265e, 0x2690, 0x2691, 0x2693, 0x2698, 0x2699, 0x26f0, 0x270e, 0x2728, |
@@ -662,7 +665,7 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
662 | 0x1f533, 0x1f657, 0x1f659, 0x1f665, 0x1f668, 0x1f66b, 0x1f78b, 0x1f796, 0x1f79c, | 665 | 0x1f533, 0x1f657, 0x1f659, 0x1f665, 0x1f668, 0x1f66b, 0x1f78b, 0x1f796, 0x1f79c, |
663 | }; | 666 | }; |
664 | /* Default colors. */ { | 667 | /* Default colors. */ { |
665 | if (isDarkMode) { | 668 | if (theme == colorfulDark_GmDocumentTheme) { |
666 | const iHSLColor base = { 200, 0, 0.15f, 1.0f }; | 669 | const iHSLColor base = { 200, 0, 0.15f, 1.0f }; |
667 | setHsl_Color(tmBackground_ColorId, base); | 670 | setHsl_Color(tmBackground_ColorId, base); |
668 | set_Color(tmParagraph_ColorId, get_Color(gray75_ColorId)); | 671 | set_Color(tmParagraph_ColorId, get_Color(gray75_ColorId)); |
@@ -784,7 +787,7 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
784 | // printf("background: %d %f %f\n", (int) base.hue, base.sat, base.lum); | 787 | // printf("background: %d %f %f\n", (int) base.hue, base.sat, base.lum); |
785 | // printf("isDarkBgSat: %d\n", isDarkBgSat); | 788 | // printf("isDarkBgSat: %d\n", isDarkBgSat); |
786 | 789 | ||
787 | if (isDarkMode) { | 790 | if (theme == colorfulDark_GmDocumentTheme) { |
788 | iHSLColor base = { hues[primIndex], | 791 | iHSLColor base = { hues[primIndex], |
789 | 0.8f * (d->themeSeed >> 24) / 255.0f, | 792 | 0.8f * (d->themeSeed >> 24) / 255.0f, |
790 | 0.06f + 0.09f * ((d->themeSeed >> 5) & 0x7) / 7.0f, | 793 | 0.06f + 0.09f * ((d->themeSeed >> 5) & 0x7) / 7.0f, |
@@ -836,7 +839,7 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
836 | /* Adjust colors based on light/dark mode. */ | 839 | /* Adjust colors based on light/dark mode. */ |
837 | for (int i = tmFirst_ColorId; i < max_ColorId; i++) { | 840 | for (int i = tmFirst_ColorId; i < max_ColorId; i++) { |
838 | iHSLColor color = hsl_Color(get_Color(i)); | 841 | iHSLColor color = hsl_Color(get_Color(i)); |
839 | if (isLightMode) { | 842 | if (theme == white_GmDocumentTheme) { |
840 | #if 0 | 843 | #if 0 |
841 | if (isLink_ColorId(i)) continue; | 844 | if (isLink_ColorId(i)) continue; |
842 | color.lum = 1.0f - color.lum; /* All colors invert lightness. */ | 845 | color.lum = 1.0f - color.lum; /* All colors invert lightness. */ |
@@ -894,7 +897,7 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
894 | } | 897 | } |
895 | } | 898 | } |
896 | /* Modify overall saturation. */ | 899 | /* Modify overall saturation. */ |
897 | color.sat *= saturationLevel; | 900 | color.sat *= prefs->saturation; |
898 | setHsl_Color(i, color); | 901 | setHsl_Color(i, color); |
899 | } | 902 | } |
900 | } | 903 | } |