=> 1449337bde58999838b34edcaf998d72b2eb1f32
[1mdiff --git a/res/about/version.gmi b/res/about/version.gmi[m [1mindex 2df2f9b4..bad1fbbf 100644[m [1m--- a/res/about/version.gmi[m [1m+++ b/res/about/version.gmi[m [36m@@ -7,16 +7,19 @@[m # Release notes[m [m ## 0.3[m [31m-* Added preferences for font and page layout.[m [31m-* Added preference for color saturation.[m [32m+[m[32m* Added several page appearance customization settings.[m * Added tabs in Preferences for better grouping.[m [31m-* Page outline appears when mouse is hovering over the scrollbar.[m [31m-* Site icon appears on the left when the window is wide enough.[m [31m-* Added "Open Link in Background Tab" to link context menu.[m [31m-* Slightly smaller first paragraph font size.[m [31m-* Improved text selection behavior when starting on empty space.[m [31m-* Fixed: Centered popups do not remain centered when window is resized.[m [31m-* Fixed: Sizing and alignment of Unicode symbols in preformatted text.[m [32m+[m[32m* Added new font option: Fira Sans.[m [32m+[m[32m* Added a setting for maximum line width.[m [32m+[m[32m* Added a setting for adjusting color saturation.[m [32m+[m[32m* Added an option for "Outline on scrollbar": page outline appears when mouse is hovering over the scrollbar.[m [32m+[m[32m* Added an option for site icon and current top heading to appear on the left when the window is wide enough.[m [32m+[m[32m* Added "Open Link in Background Tab" in link context menus.[m [32m+[m[32m* More flexible text selection behavior when starting on empty space.[m [32m+[m[32m* Smaller first paragraph font size.[m [32m+[m[32m* Fixed centering of popups so they remain centered when window is resized.[m [32m+[m[32m* Fixed sizing and alignment of Unicode symbols in preformatted text.[m [32m+[m[32m* Fixed sizing of Japanese glyphs in UI text (e.g., tab titles).[m [m ## 0.2.1[m * Fixed window size/state restoration issues, e.g., after window is maximized.[m [1mdiff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c[m [1mindex ec6288d5..3fbedb9a 100644[m [1m--- a/src/ui/documentwidget.c[m [1m+++ b/src/ui/documentwidget.c[m [36m@@ -173,6 +173,7 @@[m [mstruct Impl_DocumentWidget {[m const iGmRun * contextLink;[m iBool noHoverWhileScrolling;[m iBool showLinkNumbers;[m [32m+[m[32m const iGmRun * firstVisibleRun;[m const iGmRun * lastVisibleRun;[m iClick click;[m float initNormScrollY;[m [36m@@ -222,6 +223,7 @@[m [mvoid init_DocumentWidget(iDocumentWidget *d) {[m d->contextLink = NULL;[m d->noHoverWhileScrolling = iFalse;[m d->showLinkNumbers = iFalse;[m [32m+[m[32m d->firstVisibleRun = NULL;[m d->lastVisibleRun = NULL;[m d->visBuf = new_VisBuf();[m d->invalidRuns = new_PtrSet();[m [36m@@ -332,7 +334,12 @@[m [mstatic iRangei visibleRange_DocumentWidget_(const iDocumentWidget *d) {[m [m static void addVisibleLink_DocumentWidget_(void *context, const iGmRun *run) {[m iDocumentWidget *d = context;[m [31m- d->lastVisibleRun = run;[m [32m+[m[32m if (~run->flags & decoration_GmRunFlag && !run->imageId) {[m [32m+[m[32m if (!d->firstVisibleRun) {[m [32m+[m[32m d->firstVisibleRun = run;[m [32m+[m[32m }[m [32m+[m[32m d->lastVisibleRun = run;[m [32m+[m[32m }[m if (run->linkId && linkFlags_GmDocument(d->doc, run->linkId) & supportedProtocol_GmLinkFlag) {[m pushBack_PtrArray(&d->visibleLinks, run);[m }[m [36m@@ -422,7 +429,7 @@[m [mstatic void updateOutlineOpacity_DocumentWidget_(iDocumentWidget *d) {[m if (contains_Widget(constAs_Widget(d->scroll), mouseCoord_Window(get_Window()))) {[m opacity = 1.0f;[m }[m [31m- setValue_Anim(&d->outlineOpacity, opacity, opacity > 0.5f? 166 : 333);[m [32m+[m[32m setValue_Anim(&d->outlineOpacity, opacity, opacity > 0.5f? 100 : 166);[m animate_DocumentWidget_(d);[m }[m [m [36m@@ -435,6 +442,7 @@[m [mstatic void updateVisible_DocumentWidget_(iDocumentWidget *d) {[m d->scrollY,[m docSize > 0 ? height_Rect(bounds) * size_Range(&visRange) / docSize : 0);[m clear_PtrArray(&d->visibleLinks);[m [32m+[m[32m d->firstVisibleRun = NULL;[m render_GmDocument(d->doc, visRange, addVisibleLink_DocumentWidget_, d);[m updateHover_DocumentWidget_(d, mouseCoord_Window(get_Window()));[m updateSideOpacity_DocumentWidget_(d);[m [36m@@ -1496,6 +1504,11 @@[m [mstatic iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)[m return iFalse;[m }[m [m [32m+[m[32mstatic int outlineHeight_DocumentWidget_(const iDocumentWidget *d) {[m [32m+[m[32m if (isEmpty_Array(&d->outline)) return 0;[m [32m+[m[32m return bottom_Rect(((const iOutlineItem *) constBack_Array(&d->outline))->rect);[m [32m+[m[32m}[m [32m+[m static size_t visibleLinkOrdinal_DocumentWidget_(const iDocumentWidget *d, iGmLinkId linkId) {[m size_t ord = 0;[m const iRangei visRange = visibleRange_DocumentWidget_(d);[m [36m@@ -1632,9 +1645,17 @@[m [mstatic iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e[m }[m }[m else if (ev->type == SDL_MOUSEWHEEL && isHover_Widget(w)) {[m [32m+[m[32m float acceleration = 1.0f;[m [32m+[m[32m if (prefs_App()->hoverOutline &&[m [32m+[m[32m contains_Widget(constAs_Widget(d->scroll), mouseCoord_Window(get_Window()))) {[m [32m+[m[32m const int outHeight = outlineHeight_DocumentWidget_(d);[m [32m+[m[32m if (outHeight > height_Rect(bounds_Widget(w))) {[m [32m+[m[32m acceleration = (float) size_GmDocument(d->doc).y / (float) outHeight;[m [32m+[m[32m }[m [32m+[m[32m }[m #if defined (iPlatformApple)[m /* Momentum scrolling. */[m [31m- scroll_DocumentWidget_(d, -ev->wheel.y * get_Window()->pixelRatio);[m [32m+[m[32m scroll_DocumentWidget_(d, -ev->wheel.y * get_Window()->pixelRatio * acceleration);[m #else[m if (keyMods_Sym(SDL_GetModState()) == KMOD_PRIMARY) {[m postCommandf_App("zoom.delta arg:%d", ev->wheel.y > 0 ? 10 : -10);[m [36m@@ -1642,7 +1663,7 @@[m [mstatic iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e[m }[m smoothScroll_DocumentWidget_([m d,[m [31m- -3 * ev->wheel.y * lineHeight_Text(paragraph_FontId),[m [32m+[m[32m -3 * ev->wheel.y * lineHeight_Text(paragraph_FontId) * acceleration,[m gap_Text * smoothSpeed_DocumentWidget_ +[m (isSmoothScrolling_DocumentWidget_(d) ? d->smoothSpeed : 0));[m #endif[m [36m@@ -2069,6 +2090,24 @@[m [mstatic int drawSideRect_(iPaint *p, iRect rect) { //}, int thickness) {[m return fg;[m }[m [m [32m+[m[32mstatic iRangecc currentHeading_DocumentWidget_(const iDocumentWidget *d) {[m [32m+[m[32m iRangecc heading = iNullRange;[m [32m+[m[32m if (d->firstVisibleRun) {[m [32m+[m[32m iConstForEach(Array, i, headings_GmDocument(d->doc)) {[m [32m+[m[32m const iGmHeading *head = i.value;[m [32m+[m[32m if (head->level == 0) {[m [32m+[m[32m if (head->text.start <= d->firstVisibleRun->text.start) {[m [32m+[m[32m heading = head->text;[m [32m+[m[32m }[m [32m+[m[32m if (d->lastVisibleRun && head->text.start > d->lastVisibleRun->text.start) {[m [32m+[m[32m break;[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m return heading;[m [32m+[m[32m}[m [32m+[m static void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {[m const iWidget *w = constAs_Widget(d);[m const iRect bounds = bounds_Widget(w);[m [36m@@ -2090,22 +2129,18 @@[m [mstatic void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {[m p.alpha = opacity * 255;[m //int offset = iMax(0, bottom_Rect(banner->visBounds) - d->scrollY);[m rect.pos.y += height_Rect(bounds) / 2 - rect.size.y / 2 - (banner ? banner->visBounds.size.y / 2 : 0); // offset;[m [32m+[m[32m //rect.pos.y -= lineHeight_Text(heading3_FontId) / 2; /* the heading text underneath */[m int fg = drawSideRect_(&p, rect); //, gap_UI / 2);[m [31m-// if (equal_Color(get_Color(tmBannerBackground_ColorId), get_Color(tmBackground_ColorId))) {[m [31m-// drawRectThickness_Paint(&p, rect, gap_UI / 2, tmBannerIcon_ColorId);[m [31m-// }[m [31m-// else {[m [31m-// fillRect_Paint(&p, rect, tmBannerBackground_ColorId);[m [31m-// }[m iString str;[m initUnicodeN_String(&str, &icon, 1);[m drawCentered_Text(banner_FontId, rect, iTrue, fg, "%s", cstr_String(&str));[m [31m-#if 0[m [31m- if (avail >= minBannerSize * 2) {[m [31m- const char *endp;[m [31m- iRangecc text = bannerText_DocumentWidget_(d);[m [32m+[m[32m#if 1[m [32m+[m[32m if (avail >= minBannerSize * 2.25f) {[m [32m+[m[32m iRangecc text = currentHeading_DocumentWidget_(d);// bannerText_DocumentWidget_(d);[m iInt2 pos = addY_I2(bottomLeft_Rect(rect), gap_Text);[m const int font = heading3_FontId;[m [32m+[m[32m drawWrapRange_Text(font, pos, avail - margin, tmBannerSideTitle_ColorId, text);[m [32m+[m[32m#if 0[m while (!isEmpty_Range(&text)) {[m tryAdvance_Text(font, text, avail - 2 * margin, &endp);[m drawRange_Text([m [36m@@ -2117,6 +2152,7 @@[m [mstatic void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {[m text.start = endp;[m pos.y += lineHeight_Text(font);[m }[m [32m+[m[32m#endif[m }[m #endif[m setOpacity_Text(1.0f);[m [36m@@ -2142,31 +2178,21 @@[m [mstatic void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {[m /* Outline on the right side. */[m const float outlineOpacity = value_Anim(&d->outlineOpacity);[m if (prefs_App()->hoverOutline && !isEmpty_Array(&d->outline) && outlineOpacity > 0.0f) {[m [31m-// const int font = uiLabel_FontId;[m [31m- //iRect outlineRect = initCorners_Rect(topRight_Rect(docBounds), bottomRight_Rect(bounds));[m [31m- //const int excess = width_Rect(outlineRect) - 75 * gap_UI;[m [31m-// if (excess > 0) {[m [31m-// adjustEdges_Rect(&outlineRect, 0, 0, 0, excess);[m [31m-// }[m [31m-// const int margin = gap_UI * d->pageMargin;[m [31m- const int innerWidth = outlineWidth_DocumentWidget_(d);[m [31m- const int outWidth = innerWidth + 2 * outlinePadding_DocumentWidget_ * gap_UI;[m [31m- const int topMargin = 0;//d->pageMargin * gap_UI; // + (banner ? banner->visBounds.size.y : 0);[m [31m- const int bottomMargin = 3 * gap_UI; //d->pageMargin * gap_UI;[m [31m- iInt2 pos = add_I2(topRight_Rect(bounds), init_I2(-outWidth - width_Widget(d->scroll), topMargin));[m [31m-// const int lineWidth = avail - margin;[m [31m-// pos.y = drawRangeWrap_Text(uiContent_FontId, pos, lineWidth, tmBannerIcon_ColorId,[m [31m-// bannerText_DocumentWidget_(d));[m [31m-// pos.y += gap_UI;[m [31m- const int scrollMax = scrollMax_DocumentWidget_(d);[m [31m- const int outHeight = bottom_Rect(((const iOutlineItem *) constBack_Array(&d->outline))->rect);[m [31m- const int oversize = outHeight - height_Rect(bounds) + topMargin + bottomMargin;[m [32m+[m[32m const int innerWidth = outlineWidth_DocumentWidget_(d);[m [32m+[m[32m const int outWidth = innerWidth + 2 * outlinePadding_DocumentWidget_ * gap_UI;[m [32m+[m[32m const int topMargin = 0;[m [32m+[m[32m const int bottomMargin = 3 * gap_UI;[m [32m+[m[32m const int scrollMax = scrollMax_DocumentWidget_(d);[m [32m+[m[32m const int outHeight = outlineHeight_DocumentWidget_(d);[m [32m+[m[32m const int oversize = outHeight - height_Rect(bounds) + topMargin + bottomMargin;[m const int scroll =[m (oversize > 0 && scrollMax > 0 ? oversize * d->scrollY / scrollMax_DocumentWidget_(d)[m : 0);[m [32m+[m[32m iInt2 pos =[m [32m+[m[32m add_I2(topRight_Rect(bounds), init_I2(-outWidth - width_Widget(d->scroll), topMargin));[m /* Center short outlines vertically. */[m if (oversize < 0) {[m [31m- pos.y -= oversize / 2;// + (banner ? banner->visBounds.size.y / 2 : 0);[m [32m+[m[32m pos.y -= oversize / 2;[m }[m pos.y -= scroll;[m setOpacity_Text(outlineOpacity);[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).