diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-28 20:58:29 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-28 20:58:29 +0300 |
commit | 1a8a0170168568d1c3f075cc2996aceda08e790d (patch) | |
tree | 452541dd5b9f1846e7671612d8b4e12fccbd7f7a /src/ui/documentwidget.c | |
parent | 7f98874272432815000b6c1aeedfc0327693490b (diff) |
Detect known image/audio file extensions
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index b681c2c8..10af43f3 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -730,18 +730,21 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
730 | // desc = cstrFormat_String("\u2192 %s", cstr_String(collect_String(newRange_String(parts.protocol)))); | 730 | // desc = cstrFormat_String("\u2192 %s", cstr_String(collect_String(newRange_String(parts.protocol)))); |
731 | const iString *host = collect_String(newRange_String(parts.host)); | 731 | const iString *host = collect_String(newRange_String(parts.host)); |
732 | fg = linkColor_GmDocument(doc, linkId); | 732 | fg = linkColor_GmDocument(doc, linkId); |
733 | if (!isEmpty_String(host) && flags & userFriendly_GmLinkFlag) { | 733 | const iBool showHost = (!isEmpty_String(host) && flags & userFriendly_GmLinkFlag); |
734 | // int descWidth = measure_Text(default_FontId, cstr_String(host)).x + gap_UI; | 734 | const iBool showImage = (flags & imageFileExtension_GmLinkFlag) != 0; |
735 | const iBool showAudio = (flags & audioFileExtension_GmLinkFlag) != 0; | ||
736 | if (flags & (imageFileExtension_GmLinkFlag | audioFileExtension_GmLinkFlag) || showHost) { | ||
735 | iRect linkRect = moved_Rect(run->visBounds, origin); | 737 | iRect linkRect = moved_Rect(run->visBounds, origin); |
736 | // linkRect.size.x += descWidth; | ||
737 | // fillRect_Paint(&d->paint, linkRect, teal_ColorId); | ||
738 | drawAlign_Text(default_FontId, | 738 | drawAlign_Text(default_FontId, |
739 | // init_I2(right_Rect(d->bounds), top_Rect(linkRect)), | ||
740 | topRight_Rect(linkRect), | 739 | topRight_Rect(linkRect), |
741 | fg - 1, | 740 | fg - 1, |
742 | left_Alignment, | 741 | left_Alignment, |
743 | " \u2014 %s", | 742 | " \u2014%s%s\r%c%s", |
744 | cstr_String(host)); | 743 | showHost ? " " : "", |
744 | showHost ? cstr_String(host) : "", | ||
745 | showImage || showAudio ? '0' + fg : ('0' + fg - 1), | ||
746 | showImage ? " View Image \U0001f5bc" | ||
747 | : showAudio ? " Play Audio \U0001f3b5" : ""); | ||
745 | } | 748 | } |
746 | } | 749 | } |
747 | const iInt2 visPos = add_I2(run->visBounds.pos, origin); | 750 | const iInt2 visPos = add_I2(run->visBounds.pos, origin); |