diff options
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r-- | src/gmdocument.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 54b7ad56..660b05fd 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -469,10 +469,6 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
469 | if (!isPreformat || (prevType != preformatted_GmLineType)) { | 469 | if (!isPreformat || (prevType != preformatted_GmLineType)) { |
470 | int required = | 470 | int required = |
471 | iMax(topMargin[type], bottomMargin[prevType]) * lineHeight_Text(paragraph_FontId); | 471 | iMax(topMargin[type], bottomMargin[prevType]) * lineHeight_Text(paragraph_FontId); |
472 | if (type == link_GmLineType && prevType == link_GmLineType) { | ||
473 | /* Reduced margin between consecutive links. */ | ||
474 | required *= 0.75f; | ||
475 | } | ||
476 | if (type == quote_GmLineType && prevType == quote_GmLineType) { | 472 | if (type == quote_GmLineType && prevType == quote_GmLineType) { |
477 | /* No margin between consecutive quote lines. */ | 473 | /* No margin between consecutive quote lines. */ |
478 | required = 0; | 474 | required = 0; |
@@ -541,8 +537,19 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
541 | icon.text = link->labelIcon; | 537 | icon.text = link->labelIcon; |
542 | } | 538 | } |
543 | icon.font = regular_FontId; | 539 | icon.font = regular_FontId; |
544 | if (link->flags & remote_GmLinkFlag) { | 540 | /* Center the icon within the indentation. */ { |
545 | icon.visBounds.pos.x -= gap_Text / 2; | 541 | const iRect visBounds = visualBounds_Text(icon.font, icon.text); |
542 | const int visWidth = width_Rect(visBounds); | ||
543 | /* Keep the icon aligned to the left edge. */ | ||
544 | icon.visBounds.pos.x -= left_Rect(visBounds); | ||
545 | if (visWidth > width_Rect(icon.visBounds)) { | ||
546 | /* ...unless it's a wide icon, in which case move it to the left. */ | ||
547 | icon.visBounds.pos.x -= visWidth - width_Rect(icon.visBounds); | ||
548 | } | ||
549 | else if (visWidth < width_Rect(icon.visBounds) * 3 / 4) { | ||
550 | /* ...or a narrow icon, which needs to be centered but leave a gap. */ | ||
551 | icon.visBounds.pos.x += (width_Rect(icon.visBounds) * 3 / 4 - visWidth) / 2; | ||
552 | } | ||
546 | } | 553 | } |
547 | icon.color = linkColor_GmDocument(d, run.linkId, icon_GmLinkPart); | 554 | icon.color = linkColor_GmDocument(d, run.linkId, icon_GmLinkPart); |
548 | icon.flags |= decoration_GmRunFlag; | 555 | icon.flags |= decoration_GmRunFlag; |
@@ -750,6 +757,8 @@ static void setDerivedThemeColors_(enum iGmDocumentTheme theme) { | |||
750 | addSatLum_HSLColor(get_HSLColor(tmParagraph_ColorId), 0.3f, -0.025f)); | 757 | addSatLum_HSLColor(get_HSLColor(tmParagraph_ColorId), 0.3f, -0.025f)); |
751 | } | 758 | } |
752 | } | 759 | } |
760 | set_Color(tmLinkCustomIconVisited_ColorId, | ||
761 | mix_Color(get_Color(tmLinkIconVisited_ColorId), get_Color(tmLinkIcon_ColorId), 0.5f)); | ||
753 | #if 0 | 762 | #if 0 |
754 | set_Color(tmOutlineHeadingAbove_ColorId, get_Color(white_ColorId)); | 763 | set_Color(tmOutlineHeadingAbove_ColorId, get_Color(white_ColorId)); |
755 | set_Color(tmOutlineHeadingBelow_ColorId, get_Color(black_ColorId)); | 764 | set_Color(tmOutlineHeadingBelow_ColorId, get_Color(black_ColorId)); |
@@ -1471,8 +1480,8 @@ enum iColorId linkColor_GmDocument(const iGmDocument *d, iGmLinkId linkId, enum | |||
1471 | return tmBadLink_ColorId; | 1480 | return tmBadLink_ColorId; |
1472 | } | 1481 | } |
1473 | if (link->flags & iconFromLabel_GmLinkFlag) { | 1482 | if (link->flags & iconFromLabel_GmLinkFlag) { |
1474 | return link->flags & visited_GmLinkFlag ? tmLinkTextHover_ColorId | 1483 | return link->flags & visited_GmLinkFlag ? tmLinkCustomIconVisited_ColorId |
1475 | : tmLinkText_ColorId; | 1484 | : tmLinkIcon_ColorId; |
1476 | } | 1485 | } |
1477 | if (link->flags & visited_GmLinkFlag) { | 1486 | if (link->flags & visited_GmLinkFlag) { |
1478 | return link->flags & www_GmLinkFlag ? tmHypertextLinkIconVisited_ColorId | 1487 | return link->flags & www_GmLinkFlag ? tmHypertextLinkIconVisited_ColorId |