diff options
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 6a2173af..5bded6c6 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -942,7 +942,7 @@ static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) { | |||
942 | prependChar_String(text, siteIcon); | 942 | prependChar_String(text, siteIcon); |
943 | prependCStr_String(text, escape_Color(uiIcon_ColorId)); | 943 | prependCStr_String(text, escape_Color(uiIcon_ColorId)); |
944 | } | 944 | } |
945 | const int width = advanceRange_Text(default_FontId, range_String(text)).x; | 945 | const int width = measureRange_Text(default_FontId, range_String(text)).advance.x; |
946 | if (width <= avail || | 946 | if (width <= avail || |
947 | isEmpty_StringArray(title)) { | 947 | isEmpty_StringArray(title)) { |
948 | updateText_LabelWidget(tabButton, text); | 948 | updateText_LabelWidget(tabButton, text); |
@@ -953,7 +953,7 @@ static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) { | |||
953 | const char *endPos; | 953 | const char *endPos; |
954 | tryAdvanceNoWrap_Text(default_FontId, | 954 | tryAdvanceNoWrap_Text(default_FontId, |
955 | range_String(text), | 955 | range_String(text), |
956 | avail - advance_Text(default_FontId, "...").x, | 956 | avail - measure_Text(default_FontId, "...").advance.x, |
957 | &endPos); | 957 | &endPos); |
958 | updateText_LabelWidget( | 958 | updateText_LabelWidget( |
959 | tabButton, | 959 | tabButton, |
@@ -3898,17 +3898,17 @@ static void fillRange_DrawContext_(iDrawContext *d, const iGmRun *run, enum iCol | |||
3898 | contains_Range(&mark, run->text.start))) { | 3898 | contains_Range(&mark, run->text.start))) { |
3899 | int x = 0; | 3899 | int x = 0; |
3900 | if (!*isInside) { | 3900 | if (!*isInside) { |
3901 | x = advanceRange_Text(run->font, | 3901 | x = measureRange_Text(run->font, |
3902 | (iRangecc){ run->text.start, iMax(run->text.start, mark.start) }) | 3902 | (iRangecc){ run->text.start, iMax(run->text.start, mark.start) }) |
3903 | .x; | 3903 | .advance.x; |
3904 | } | 3904 | } |
3905 | int w = width_Rect(run->visBounds) - x; | 3905 | int w = width_Rect(run->visBounds) - x; |
3906 | if (contains_Range(&run->text, mark.end) || mark.end < run->text.start) { | 3906 | if (contains_Range(&run->text, mark.end) || mark.end < run->text.start) { |
3907 | w = advanceRange_Text( | 3907 | w = measureRange_Text( |
3908 | run->font, | 3908 | run->font, |
3909 | !*isInside ? mark | 3909 | !*isInside ? mark |
3910 | : (iRangecc){ run->text.start, iMax(run->text.start, mark.end) }) | 3910 | : (iRangecc){ run->text.start, iMax(run->text.start, mark.end) }) |
3911 | .x; | 3911 | .advance.x; |
3912 | *isInside = iFalse; | 3912 | *isInside = iFalse; |
3913 | } | 3913 | } |
3914 | else { | 3914 | else { |
@@ -4013,8 +4013,8 @@ static void drawBannerRun_DrawContext_(iDrawContext *d, const iGmRun *run, iInt2 | |||
4013 | appendCStr_String(&str, "\n"); | 4013 | appendCStr_String(&str, "\n"); |
4014 | appendCStr_String(&str, cstr_Lang("dlg.certwarn.domain.expired")); | 4014 | appendCStr_String(&str, cstr_Lang("dlg.certwarn.domain.expired")); |
4015 | } | 4015 | } |
4016 | const iInt2 dims = advanceWrapRange_Text( | 4016 | const iInt2 dims = measureWrapRange_Text( |
4017 | uiContent_FontId, width_Rect(rect) - 16 * gap_UI, range_String(&str)); | 4017 | uiContent_FontId, width_Rect(rect) - 16 * gap_UI, range_String(&str)).bounds.size; |
4018 | const int warnHeight = run->visBounds.size.y - domainHeight; | 4018 | const int warnHeight = run->visBounds.size.y - domainHeight; |
4019 | const int yOff = (lineHeight_Text(uiLabelLarge_FontId) - | 4019 | const int yOff = (lineHeight_Text(uiLabelLarge_FontId) - |
4020 | lineHeight_Text(uiContent_FontId)) / 2; | 4020 | lineHeight_Text(uiContent_FontId)) / 2; |
@@ -4224,7 +4224,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
4224 | appendFormat_String( | 4224 | appendFormat_String( |
4225 | &text, " %s" close_Icon, isHover ? escape_Color(tmLinkText_ColorId) : ""); | 4225 | &text, " %s" close_Icon, isHover ? escape_Color(tmLinkText_ColorId) : ""); |
4226 | } | 4226 | } |
4227 | const iInt2 size = measureRange_Text(metaFont, range_String(&text)); | 4227 | const iInt2 size = measureRange_Text(metaFont, range_String(&text)).bounds.size; |
4228 | fillRect_Paint( | 4228 | fillRect_Paint( |
4229 | &d->paint, | 4229 | &d->paint, |
4230 | (iRect){ add_I2(origin, addX_I2(topRight_Rect(run->bounds), -size.x - gap_UI)), | 4230 | (iRect){ add_I2(origin, addX_I2(topRight_Rect(run->bounds), -size.x - gap_UI)), |
@@ -4293,7 +4293,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
4293 | append_String(&str, collect_String(format_Date(&date, "%b %d"))); | 4293 | append_String(&str, collect_String(format_Date(&date, "%b %d"))); |
4294 | } | 4294 | } |
4295 | if (!isEmpty_String(&str)) { | 4295 | if (!isEmpty_String(&str)) { |
4296 | const iInt2 textSize = measure_Text(metaFont, cstr_String(&str)); | 4296 | const iInt2 textSize = measure_Text(metaFont, cstr_String(&str)).bounds.size; |
4297 | int tx = topRight_Rect(linkRect).x; | 4297 | int tx = topRight_Rect(linkRect).x; |
4298 | const char *msg = cstr_String(&str); | 4298 | const char *msg = cstr_String(&str); |
4299 | if (tx + textSize.x > right_Rect(d->widgetBounds)) { | 4299 | if (tx + textSize.x > right_Rect(d->widgetBounds)) { |
@@ -4301,7 +4301,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
4301 | fillRect_Paint(&d->paint, (iRect){ init_I2(tx, top_Rect(linkRect)), textSize }, | 4301 | fillRect_Paint(&d->paint, (iRect){ init_I2(tx, top_Rect(linkRect)), textSize }, |
4302 | uiBackground_ColorId); | 4302 | uiBackground_ColorId); |
4303 | msg += 4; /* skip the space and dash */ | 4303 | msg += 4; /* skip the space and dash */ |
4304 | tx += measure_Text(metaFont, " \u2014").x / 2; | 4304 | tx += measure_Text(metaFont, " \u2014").advance.x / 2; |
4305 | } | 4305 | } |
4306 | drawAlign_Text(metaFont, | 4306 | drawAlign_Text(metaFont, |
4307 | init_I2(tx, top_Rect(linkRect)), | 4307 | init_I2(tx, top_Rect(linkRect)), |
@@ -4359,8 +4359,8 @@ static void updateSideIconBuf_DocumentWidget_(const iDocumentWidget *d) { | |||
4359 | /* Determine the required size. */ | 4359 | /* Determine the required size. */ |
4360 | iInt2 bufSize = init1_I2(minBannerSize); | 4360 | iInt2 bufSize = init1_I2(minBannerSize); |
4361 | if (isHeadingVisible) { | 4361 | if (isHeadingVisible) { |
4362 | const iInt2 headingSize = advanceWrapRange_Text(heading3_FontId, avail, | 4362 | const iInt2 headingSize = measureWrapRange_Text(heading3_FontId, avail, |
4363 | currentHeading_DocumentWidget_(d)); | 4363 | currentHeading_DocumentWidget_(d)).bounds.size; |
4364 | if (headingSize.x > 0) { | 4364 | if (headingSize.x > 0) { |
4365 | bufSize.y += gap_Text + headingSize.y; | 4365 | bufSize.y += gap_Text + headingSize.y; |
4366 | bufSize.x = iMax(bufSize.x, headingSize.x); | 4366 | bufSize.x = iMax(bufSize.x, headingSize.x); |
@@ -4736,7 +4736,7 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) { | |||
4736 | if (prefs_App()->hoverLink && d->hoverLink) { | 4736 | if (prefs_App()->hoverLink && d->hoverLink) { |
4737 | const int font = uiLabel_FontId; | 4737 | const int font = uiLabel_FontId; |
4738 | const iRangecc linkUrl = range_String(linkUrl_GmDocument(d->doc, d->hoverLink->linkId)); | 4738 | const iRangecc linkUrl = range_String(linkUrl_GmDocument(d->doc, d->hoverLink->linkId)); |
4739 | const iInt2 size = measureRange_Text(font, linkUrl); | 4739 | const iInt2 size = measureRange_Text(font, linkUrl).bounds.size; |
4740 | const iRect linkRect = { addY_I2(bottomLeft_Rect(bounds), -size.y), | 4740 | const iRect linkRect = { addY_I2(bottomLeft_Rect(bounds), -size.y), |
4741 | addX_I2(size, 2 * gap_UI) }; | 4741 | addX_I2(size, 2 * gap_UI) }; |
4742 | fillRect_Paint(&ctx.paint, linkRect, tmBackground_ColorId); | 4742 | fillRect_Paint(&ctx.paint, linkRect, tmBackground_ColorId); |
@@ -4757,7 +4757,7 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) { | |||
4757 | const int wrap = docBounds.size.x - 2 * margin; | 4757 | const int wrap = docBounds.size.x - 2 * margin; |
4758 | iInt2 pos = addY_I2(add_I2(docBounds.pos, meta->pixelRect.pos), | 4758 | iInt2 pos = addY_I2(add_I2(docBounds.pos, meta->pixelRect.pos), |
4759 | -pos_SmoothScroll(&d->scrollY)); | 4759 | -pos_SmoothScroll(&d->scrollY)); |
4760 | const iInt2 textSize = advanceWrapRange_Text(altFont, wrap, meta->altText); | 4760 | const iInt2 textSize = measureWrapRange_Text(altFont, wrap, meta->altText).bounds.size; |
4761 | pos.y -= textSize.y + gap_UI; | 4761 | pos.y -= textSize.y + gap_UI; |
4762 | pos.y = iMax(pos.y, top_Rect(bounds)); | 4762 | pos.y = iMax(pos.y, top_Rect(bounds)); |
4763 | const iRect altRect = { pos, init_I2(docBounds.size.x, textSize.y) }; | 4763 | const iRect altRect = { pos, init_I2(docBounds.size.x, textSize.y) }; |