summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 07761aa7..9bf40e5c 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -264,9 +264,7 @@ static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) {
264} 264}
265 265
266static void setSource_DocumentWidget_(iDocumentWidget *d, const iString *source) { 266static void setSource_DocumentWidget_(iDocumentWidget *d, const iString *source) {
267 iUrl parts; 267 setUrl_GmDocument(d->doc, d->url);
268 init_Url(&parts, d->url);
269 setHost_GmDocument(d->doc, collect_String(newRange_String(parts.host)));
270 setSource_GmDocument(d->doc, source, documentWidth_DocumentWidget_(d)); 268 setSource_GmDocument(d->doc, source, documentWidth_DocumentWidget_(d));
271 d->foundMark = iNullRange; 269 d->foundMark = iNullRange;
272 d->selectMark = iNullRange; 270 d->selectMark = iNullRange;
@@ -326,7 +324,7 @@ static void updateSource_DocumentWidget_(iDocumentWidget *d) {
326 iUrl parts; 324 iUrl parts;
327 init_Url(&parts, url_GmRequest(d->request)); 325 init_Url(&parts, url_GmRequest(d->request));
328 if (!isEmpty_Range(&parts.path)) { 326 if (!isEmpty_Range(&parts.path)) {
329 imageTitle = baseName_Path(collect_String(newRange_String(parts.path))); 327 imageTitle = baseName_Path(collect_String(newRange_String(parts.path))).start;
330 } 328 }
331 format_String( 329 format_String(
332 &str, "=> %s %s\n", cstr_String(url_GmRequest(d->request)), imageTitle); 330 &str, "=> %s %s\n", cstr_String(url_GmRequest(d->request)), imageTitle);
@@ -851,7 +849,8 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
851 fillRange_DrawContext_(d, run, teal_ColorId, d->widget->foundMark, &d->inFoundMark); 849 fillRange_DrawContext_(d, run, teal_ColorId, d->widget->foundMark, &d->inFoundMark);
852 fillRange_DrawContext_(d, run, brown_ColorId, d->widget->selectMark, &d->inSelectMark); 850 fillRange_DrawContext_(d, run, brown_ColorId, d->widget->selectMark, &d->inSelectMark);
853 if (run->linkId && !isEmpty_Rect(run->bounds)) { 851 if (run->linkId && !isEmpty_Rect(run->bounds)) {
854 fg = white_ColorId; 852 const int flags = linkFlags_GmDocument(doc, run->linkId);
853 fg = /*flags & visited_GmLinkFlag ? gray88_ColorId :*/ white_ColorId;
855 if (isHover || linkFlags_GmDocument(doc, run->linkId) & content_GmLinkFlag) { 854 if (isHover || linkFlags_GmDocument(doc, run->linkId) & content_GmLinkFlag) {
856 fg = linkColor_GmDocument(doc, run->linkId); 855 fg = linkColor_GmDocument(doc, run->linkId);
857 } 856 }
@@ -862,6 +861,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
862 if (run->linkId) { 861 if (run->linkId) {
863 /* TODO: Show status of an ongoing media request. */ 862 /* TODO: Show status of an ongoing media request. */
864 const int flags = linkFlags_GmDocument(doc, run->linkId); 863 const int flags = linkFlags_GmDocument(doc, run->linkId);
864 const iRect linkRect = moved_Rect(run->visBounds, origin);
865 if (flags & content_GmLinkFlag) { 865 if (flags & content_GmLinkFlag) {
866 fg = linkColor_GmDocument(doc, run->linkId); 866 fg = linkColor_GmDocument(doc, run->linkId);
867 if (!isEmpty_Rect(run->bounds)) { 867 if (!isEmpty_Rect(run->bounds)) {
@@ -894,7 +894,6 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
894 const iBool showHost = (!isEmpty_String(host) && flags & userFriendly_GmLinkFlag); 894 const iBool showHost = (!isEmpty_String(host) && flags & userFriendly_GmLinkFlag);
895 const iBool showImage = (flags & imageFileExtension_GmLinkFlag) != 0; 895 const iBool showImage = (flags & imageFileExtension_GmLinkFlag) != 0;
896 const iBool showAudio = (flags & audioFileExtension_GmLinkFlag) != 0; 896 const iBool showAudio = (flags & audioFileExtension_GmLinkFlag) != 0;
897 iRect linkRect = moved_Rect(run->visBounds, origin);
898 if (run->flags & endOfLine_GmRunFlag && 897 if (run->flags & endOfLine_GmRunFlag &&
899 (flags & (imageFileExtension_GmLinkFlag | audioFileExtension_GmLinkFlag) || 898 (flags & (imageFileExtension_GmLinkFlag | audioFileExtension_GmLinkFlag) ||
900 showHost)) { 899 showHost)) {
@@ -925,6 +924,17 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
925 deinit_String(&str); 924 deinit_String(&str);
926 } 925 }
927 } 926 }
927 else if (run->flags & endOfLine_GmRunFlag && flags & visited_GmLinkFlag) {
928 iDate date;
929 init_Date(&date, linkTime_GmDocument(doc, run->linkId));
930 draw_Text(default_FontId,
931 topRight_Rect(linkRect),
932 linkColor_GmDocument(doc, run->linkId) - 1,
933 " \u2014 Visited on %04d-%02d-%02d",
934 date.year,
935 date.month,
936 date.day);
937 }
928 } 938 }
929 939
930// drawRect_Paint(&d->paint, (iRect){ visPos, run->bounds.size }, green_ColorId); 940// drawRect_Paint(&d->paint, (iRect){ visPos, run->bounds.size }, green_ColorId);