summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-01-10 19:20:09 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-01-10 19:21:05 +0200
commit209b1d96b0c5c63ee78601938a32eaa9fa52512e (patch)
tree9597d8ab54d3029096b88cff2a5379d29668499b
parent5472891b5711138d3c54bd90508720a935c36de7 (diff)
Option to show full URL when hovering on a link
The URL is shown in the bottom of the page. IssueID #64
-rw-r--r--res/about/version.gmi1
-rw-r--r--src/app.c8
-rw-r--r--src/prefs.c2
-rw-r--r--src/prefs.h2
-rw-r--r--src/ui/documentwidget.c9
-rw-r--r--src/ui/util.c4
6 files changed, 18 insertions, 8 deletions
diff --git a/res/about/version.gmi b/res/about/version.gmi
index 188b56bd..3f11642d 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -10,6 +10,7 @@
10* Added identity importing: existing client certificates in PEM format can be imported from the current page, from clipboard, or from drag-and-dropped files. 10* Added identity importing: existing client certificates in PEM format can be imported from the current page, from clipboard, or from drag-and-dropped files.
11* Added a bold UI font. It is used for unread feed entries and default dialog buttons. 11* Added a bold UI font. It is used for unread feed entries and default dialog buttons.
12* Added support for Finger links (courtesy of John Cowan). 12* Added support for Finger links (courtesy of John Cowan).
13* Added option to show full link URL when hovering on it.
13* Remote bookmarks are grouped under their source in the bookmark list. 14* Remote bookmarks are grouped under their source in the bookmark list.
14* A bookmark's icon is updated after loading the page so it matches the site. 15* A bookmark's icon is updated after loading the page so it matches the site.
15* Quote border line shows up on empty quote lines, too. 16* Quote border line shows up on empty quote lines, too.
diff --git a/src/app.c b/src/app.c
index 01f62bba..05739f0a 100644
--- a/src/app.c
+++ b/src/app.c
@@ -198,7 +198,7 @@ static iString *serializePrefs_App_(const iApp *d) {
198 appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph); 198 appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph);
199 appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon); 199 appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon);
200 appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0); 200 appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0);
201 appendFormat_String(str, "prefs.hoveroutline.changed arg:%d\n", d->prefs.hoverOutline); 201 appendFormat_String(str, "prefs.hoverlink.changed arg:%d\n", d->prefs.hoverLink);
202 appendFormat_String(str, "theme.set arg:%d auto:1\n", d->prefs.theme); 202 appendFormat_String(str, "theme.set arg:%d auto:1\n", d->prefs.theme);
203 appendFormat_String(str, "ostheme arg:%d\n", d->prefs.useSystemTheme); 203 appendFormat_String(str, "ostheme arg:%d\n", d->prefs.useSystemTheme);
204 appendFormat_String(str, "doctheme.dark.set arg:%d\n", d->prefs.docThemeDark); 204 appendFormat_String(str, "doctheme.dark.set arg:%d\n", d->prefs.docThemeDark);
@@ -1129,8 +1129,8 @@ iBool handleCommand_App(const char *cmd) {
1129 postRefresh_App(); 1129 postRefresh_App();
1130 return iTrue; 1130 return iTrue;
1131 } 1131 }
1132 else if (equal_Command(cmd, "prefs.hoveroutline.changed")) { 1132 else if (equal_Command(cmd, "prefs.hoverlink.changed")) {
1133 d->prefs.hoverOutline = arg_Command(cmd) != 0; 1133 d->prefs.hoverLink = arg_Command(cmd) != 0;
1134 postRefresh_App(); 1134 postRefresh_App();
1135 return iTrue; 1135 return iTrue;
1136 } 1136 }
@@ -1273,7 +1273,7 @@ iBool handleCommand_App(const char *cmd) {
1273 iWidget *dlg = makePreferences_Widget(); 1273 iWidget *dlg = makePreferences_Widget();
1274 updatePrefsThemeButtons_(dlg); 1274 updatePrefsThemeButtons_(dlg);
1275 setText_InputWidget(findChild_Widget(dlg, "prefs.downloads"), &d->prefs.downloadDir); 1275 setText_InputWidget(findChild_Widget(dlg, "prefs.downloads"), &d->prefs.downloadDir);
1276 setToggle_Widget(findChild_Widget(dlg, "prefs.hoveroutline"), d->prefs.hoverOutline); 1276 setToggle_Widget(findChild_Widget(dlg, "prefs.hoverlink"), d->prefs.hoverLink);
1277 setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling); 1277 setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling);
1278 setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling); 1278 setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling);
1279 setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); 1279 setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme);
diff --git a/src/prefs.c b/src/prefs.c
index 31ffe03b..188938a2 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -30,7 +30,7 @@ void init_Prefs(iPrefs *d) {
30 d->uiScale = 1.0f; /* default set elsewhere */ 30 d->uiScale = 1.0f; /* default set elsewhere */
31 d->zoomPercent = 100; 31 d->zoomPercent = 100;
32 d->sideIcon = iTrue; 32 d->sideIcon = iTrue;
33 d->hoverOutline = iFalse; 33 d->hoverLink = iTrue;
34 d->smoothScrolling = iTrue; 34 d->smoothScrolling = iTrue;
35 d->loadImageInsteadOfScrolling = iFalse; 35 d->loadImageInsteadOfScrolling = iFalse;
36 d->decodeUserVisibleURLs = iTrue; 36 d->decodeUserVisibleURLs = iTrue;
diff --git a/src/prefs.h b/src/prefs.h
index e95a32da..07298eac 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -44,7 +44,7 @@ struct Impl_Prefs {
44 iBool sideIcon; 44 iBool sideIcon;
45 /* Behavior */ 45 /* Behavior */
46 iString downloadDir; 46 iString downloadDir;
47 iBool hoverOutline; 47 iBool hoverLink;
48 iBool smoothScrolling; 48 iBool smoothScrolling;
49 iBool loadImageInsteadOfScrolling; 49 iBool loadImageInsteadOfScrolling;
50 /* Network */ 50 /* Network */
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 78624c7a..9d284840 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -3194,6 +3194,15 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) {
3194 tmBackground_ColorId); 3194 tmBackground_ColorId);
3195 } 3195 }
3196 drawSideElements_DocumentWidget_(d); 3196 drawSideElements_DocumentWidget_(d);
3197 if (prefs_App()->hoverLink && d->hoverLink) {
3198 const int font = uiLabel_FontId;
3199 const iRangecc linkUrl = range_String(linkUrl_GmDocument(d->doc, d->hoverLink->linkId));
3200 const iInt2 size = measureRange_Text(font, linkUrl);
3201 const iRect linkRect = { addY_I2(bottomLeft_Rect(bounds), -size.y),
3202 addX_I2(size, 2 * gap_UI) };
3203 fillRect_Paint(&ctx.paint, linkRect, tmBackground_ColorId);
3204 drawRange_Text(font, addX_I2(topLeft_Rect(linkRect), gap_UI), tmParagraph_ColorId, linkUrl);
3205 }
3197 draw_Widget(w); 3206 draw_Widget(w);
3198} 3207}
3199 3208
diff --git a/src/ui/util.c b/src/ui/util.c
index fd297ce2..6615a454 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1043,8 +1043,8 @@ iWidget *makePreferences_Widget(void) {
1043 appendTwoColumnPage_(tabs, "General", '1', &headings, &values); 1043 appendTwoColumnPage_(tabs, "General", '1', &headings, &values);
1044 addChild_Widget(headings, iClob(makeHeading_Widget("Downloads folder:"))); 1044 addChild_Widget(headings, iClob(makeHeading_Widget("Downloads folder:")));
1045 setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads"); 1045 setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads");
1046 /*addChild_Widget(headings, iClob(makeHeading_Widget("Outline on scrollbar:"))); 1046 addChild_Widget(headings, iClob(makeHeading_Widget("Full link on hover:")));
1047 addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoveroutline")));*/ 1047 addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoverlink")));
1048 addChild_Widget(headings, iClob(makeHeading_Widget("Smooth scrolling:"))); 1048 addChild_Widget(headings, iClob(makeHeading_Widget("Smooth scrolling:")));
1049 addChild_Widget(values, iClob(makeToggle_Widget("prefs.smoothscroll"))); 1049 addChild_Widget(values, iClob(makeToggle_Widget("prefs.smoothscroll")));
1050 addChild_Widget(headings, iClob(makeHeading_Widget("Load image on scroll:"))); 1050 addChild_Widget(headings, iClob(makeHeading_Widget("Load image on scroll:")));