diff --git a/src/app.c b/src/app.c

index 81fe67af..d1732bf9 100644

--- a/src/app.c

+++ b/src/app.c

@@ -169,6 +169,8 @@ static iString *serializePrefs_App_(const iApp *d) {

 appendFormat_String(str, "zoom.set arg:%d\n", d->prefs.zoomPercent);

 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth);

 appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph);

+ appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon);

+ appendFormat_String(str, "prefs.hoveroutline.changed arg:%d\n", d->prefs.hoverOutline);

 appendFormat_String(str, "theme.set arg:%d auto:1\n", d->prefs.theme);

 appendFormat_String(str, "ostheme arg:%d\n", d->prefs.useSystemTheme);

 appendFormat_String(str, "saturation.set arg:%d\n", (int) ((d->prefs.saturation * 100) + 0.5f));

@@ -868,6 +870,16 @@ iBool handleCommand_App(const char *cmd) {

     postCommand_App("document.layout.changed");

     return iTrue;

 }

+ else if (equal_Command(cmd, "prefs.sideicon.changed")) {

+ d->prefs.sideIcon = arg_Command(cmd) != 0;

+ refresh_App();

+ return iTrue;

+ }

+ else if (equal_Command(cmd, "prefs.hoveroutline.changed")) {

+ d->prefs.hoverOutline = arg_Command(cmd) != 0;

+ refresh_App();

+ return iTrue;

+ }

 else if (equal_Command(cmd, "saturation.set")) {

     d->prefs.saturation = (float) arg_Command(cmd) / 100.0f;

     postCommandf_App("theme.changed auto:1");

@@ -982,6 +994,7 @@ iBool handleCommand_App(const char *cmd) {

     iWidget *dlg = makePreferences_Widget();

     updatePrefsThemeButtons_(dlg);

     setText_InputWidget(findChild_Widget(dlg, "prefs.downloads"), &d->prefs.downloadDir);

+ setToggle_Widget(findChild_Widget(dlg, "prefs.hoveroutline"), d->prefs.hoverOutline);

     setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme);

     setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize);

     setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"),

@@ -994,6 +1007,7 @@ iBool handleCommand_App(const char *cmd) {

         selected_WidgetFlag,

         iTrue);

     setToggle_Widget(findChild_Widget(dlg, "prefs.biglede"), d->prefs.bigFirstParagraph);

+ setToggle_Widget(findChild_Widget(dlg, "prefs.sideicon"), d->prefs.sideIcon);

     setFlags_Widget(

         findChild_Widget(

             dlg, format_CStr("prefs.saturation.%d", (int) (d->prefs.saturation * 3.99f))),

diff --git a/src/prefs.c b/src/prefs.c

index 9b77b4f2..af481233 100644

--- a/src/prefs.c

+++ b/src/prefs.c

@@ -9,6 +9,8 @@ void init_Prefs(iPrefs *d) {

 d->font              = nunito_TextFont;

 d->lineWidth         = 40;

 d->bigFirstParagraph = iTrue;

+ d->sideIcon = iTrue;

+ d->hoverOutline = iFalse;

 d->docThemeDark      = colorfulDark_GmDocumentTheme;

 d->docThemeLight     = white_GmDocumentTheme;

 d->saturation        = 1.0f;

diff --git a/src/prefs.h b/src/prefs.h

index 42ccff85..324fb6fd 100644

--- a/src/prefs.h

+++ b/src/prefs.h

@@ -23,6 +23,8 @@ struct Impl_Prefs {

 int lineWidth;

 iBool bigFirstParagraph;

 iBool forceLineWrap;

+ iBool sideIcon;

+ iBool hoverOutline;

 enum iGmDocumentTheme docThemeDark;

 enum iGmDocumentTheme docThemeLight;

 float saturation;

diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c

index 0079465f..ec6288d5 100644

--- a/src/ui/documentwidget.c

+++ b/src/ui/documentwidget.c

@@ -133,7 +133,7 @@ struct Impl_OutlineItem {

 iRangecc text;

 int      font;

 iRect    rect;

- int seenColor;

+ int seenColor; /* TODO: not used */

 int      sepColor;

};



@@ -2058,13 +2058,15 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {

// drawRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, red_ColorId);

}



-static void drawSideRect_(iPaint *p, iRect rect, int thickness) {

- if (equal_Color(get_Color(tmBannerBackground_ColorId), get_Color(tmBackground_ColorId))) {

- drawRectThickness_Paint(p, rect, thickness, tmBannerIcon_ColorId);

- }

- else {

- fillRect_Paint(p, rect, tmBannerBackground_ColorId);

+static int drawSideRect_(iPaint *p, iRect rect) { //}, int thickness) {

+ int bg = tmBannerBackground_ColorId;

+ int fg = tmBannerIcon_ColorId;

+ if (equal_Color(get_Color(bg), get_Color(tmBackground_ColorId))) {

+ bg = tmBannerIcon_ColorId;

+ fg = tmBannerBackground_ColorId;

 }

+ fillRect_Paint(p, rect, bg);

+ return fg;

}



static void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {

@@ -2079,7 +2081,7 @@ static void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {

 iPaint      p;

 init_Paint(&p);

 setClip_Paint(&p, bounds);

- if (avail > minBannerSize) {

+ if (prefs_App()->sideIcon && avail > minBannerSize) {

     if (banner && opacity > 0) {

         setOpacity_Text(opacity);

         SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND);

@@ -2088,16 +2090,16 @@ static void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {

         p.alpha = opacity * 255;

         //int offset = iMax(0, bottom_Rect(banner->visBounds) - d->scrollY);

         rect.pos.y += height_Rect(bounds) / 2 - rect.size.y / 2 - (banner ? banner->visBounds.size.y / 2 : 0); // offset;

- drawSideRect_(&p, rect, gap_UI / 2);

- if (equal_Color(get_Color(tmBannerBackground_ColorId), get_Color(tmBackground_ColorId))) {

- drawRectThickness_Paint(&p, rect, gap_UI / 2, tmBannerIcon_ColorId);

- }

- else {

- fillRect_Paint(&p, rect, tmBannerBackground_ColorId);

- }

+ int fg = drawSideRect_(&p, rect); //, gap_UI / 2);

+// if (equal_Color(get_Color(tmBannerBackground_ColorId), get_Color(tmBackground_ColorId))) {

+// drawRectThickness_Paint(&p, rect, gap_UI / 2, tmBannerIcon_ColorId);

+// }

+// else {

+// fillRect_Paint(&p, rect, tmBannerBackground_ColorId);

+// }

         iString str;

         initUnicodeN_String(&str, &icon, 1);

- drawCentered_Text(banner_FontId, rect, iTrue, tmBannerIcon_ColorId, "%s", cstr_String(&str));

+ drawCentered_Text(banner_FontId, rect, iTrue, fg, "%s", cstr_String(&str));

#if 0

         if (avail >= minBannerSize * 2) {

             const char *endp;

@@ -2139,7 +2141,7 @@ static void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {

 }

 /* Outline on the right side. */

 const float outlineOpacity = value_Anim(&d->outlineOpacity);

- if (!isEmpty_Array(&d->outline) && outlineOpacity > 0.0f) {

+ if (prefs_App()->hoverOutline && !isEmpty_Array(&d->outline) && outlineOpacity > 0.0f) {

// const int font = uiLabel_FontId;

     //iRect outlineRect = initCorners_Rect(topRight_Rect(docBounds), bottomRight_Rect(bounds));

     //const int excess = width_Rect(outlineRect) - 75 * gap_UI;

@@ -2170,26 +2172,23 @@ static void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {

     setOpacity_Text(outlineOpacity);

     SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND);

     p.alpha = outlineOpacity * 255;

- drawSideRect_(

- &p,

- (iRect){ addY_I2(pos, -outlinePadding_DocumentWidget_ * gap_UI / 2),

- init_I2(outWidth, outHeight + outlinePadding_DocumentWidget_ * gap_UI * 1.5f) },

- 1);

+ iRect outlineFrame = {

+ addY_I2(pos, -outlinePadding_DocumentWidget_ * gap_UI / 2),

+ init_I2(outWidth, outHeight + outlinePadding_DocumentWidget_ * gap_UI * 1.5f)

+ };

+ fillRect_Paint(&p, outlineFrame, tmBannerBackground_ColorId);

+ const int textFg = drawSideRect_(&p, outlineFrame); //, 1);

     iConstForEach(Array, i, &d->outline) {

         const iOutlineItem *item = i.value;

         iInt2 visPos = addX_I2(add_I2(pos, item->rect.pos), outlinePadding_DocumentWidget_ * gap_UI);

-// visPos.y -= scroll;

-// if (item->sepColor != none_ColorId) {

-// drawHLine_Paint(&p, addY_I2(visPos, -gap_UI), outWidth, item->sepColor);

-// }

-// drawRect_Paint(&p, (iRect){ visPos, item->rect.size }, red_ColorId);

         const iBool isVisible = d->lastVisibleRun && d->lastVisibleRun->text.start >= item->text.start;

- drawWrapRange_Text(item->font,

- visPos,

- innerWidth - left_Rect(item->rect),

- index_ArrayConstIterator(&i) == 0 || isVisible ? item->seenColor

- : tmQuoteIcon_ColorId,

- item->text);

+ const int fg = index_ArrayConstIterator(&i) == 0 || isVisible ? textFg

+ : tmQuoteIcon_ColorId;

+ drawWrapRange_Text(

+ item->font, visPos, innerWidth - left_Rect(item->rect), fg, item->text);

+ if (left_Rect(item->rect) > 0) {

+ drawRange_Text(item->font, addX_I2(visPos, -3 * gap_UI), fg, range_CStr("\u2013"));

+ }

     }

     setOpacity_Text(1.0f);

     SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_NONE);

diff --git a/src/ui/util.c b/src/ui/util.c

index 27bac834..e106bfff 100644

--- a/src/ui/util.c

+++ b/src/ui/util.c

@@ -898,6 +898,8 @@ iWidget *makePreferences_Widget(void) {

     appendTwoColumnPage_(tabs, "General", '1', &headings, &values);

     addChild_Widget(headings, iClob(makeHeading_Widget("Downloads folder:")));

     setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads");

+ addChild_Widget(headings, iClob(makeHeading_Widget("Outline on scrollbar:")));

+ addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoveroutline")));

     makeTwoColumnHeading_("WINDOW", headings, values);

#if defined (iPlatformApple) || defined (iPlatformMSys)

     addChild_Widget(headings, iClob(makeHeading_Widget("Use system theme:")));

@@ -939,6 +941,9 @@ iWidget *makePreferences_Widget(void) {

     addChildFlags_Widget(values, iClob(widths), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);

     addChild_Widget(headings, iClob(makeHeading_Widget("Big 1st paragaph:")));

     addChild_Widget(values, iClob(makeToggle_Widget("prefs.biglede")));

+ makeTwoColumnHeading_("WIDE LAYOUT", headings, values);

+ addChild_Widget(headings, iClob(makeHeading_Widget("Site icon:")));

+ addChild_Widget(values, iClob(makeToggle_Widget("prefs.sideicon")));

 }

 /* Colors. */ {

     appendTwoColumnPage_(tabs, "Colors", '3', &headings, &values);

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.8/pcdiff/790a2c49a0290ce872ec8929b063337eacde9880
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
70.133621 milliseconds
Gemini-to-HTML Time
3.490111 milliseconds

This content has been proxied by September (ba2dc).