New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Links menu and handling tweaks #4867
Conversation
@@ -746,7 +746,9 @@ function ReaderGesture:gestureAction(action, ges) | |||
elseif action == "latest_bookmark" then | |||
self.ui:handleEvent(Event:new("GoToLatestBookmark")) | |||
elseif action == "follow_nearest_link" then | |||
self.ui:handleEvent(Event:new("GoToPageLink", ges, false, G_reader_settings:isTrue("footnote_link_in_popup"))) | |||
self.ui:handleEvent(Event:new("GoToPageLink", ges, | |||
G_reader_settings:nilOrTrue("swipe_ignore_external_links"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think defaulting to ignoring is an unintuitive default.
G_reader_settings:nilOrTrue("swipe_ignore_external_links"), | |
G_reader_settings:isTrue("swipe_ignore_external_links"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree for swipe, which is there for a few years and evoke the physical gesture of turning pages to jump to footnotes and back. Having it suddently throw a popup is not a good thing.
(People like you who would still want that can now activate it - but no one else but you complained it was missing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, from the multiswipe gesture, it could be another default or setting. But I don't feel like adding yet another setting for that. So let's have it the same as in readerlink.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It breaks the concept of links as well as the internal logic for ignoring external links.
For the gesture manager you could just make two actions: the current one that follows all links, and a new one called follow_nearest_internal_link
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, went with 2 actions, hardcoded false and hardcoded true, not using the single swipe ignore setting.
- Removed "Swipe to follow first link on page" menu item and handling code, as it feels not really as practical as "Swipe to follow nearest link". - Removed recently added "External link action", as we can just always present a popup with the url and the available actions. - Generic handling of these actions in onGoToExternalLink(), so they are proposed on the Wikipedia lookup popup too. - Allow external link on PDF documents (previously, only internal links were handled). - Have "Ignore external links on tap" available on all document types. - Added "Ignore external links on swipe" (default to true, the current behaviour). - Added multiswipe gesture "Follow nearest internal link" (the existing "Follow nearest link" now follows the nearest external or internal link) - ButtonDialogTitle: added an option to look a bit more alike ConfirmBoxes. - Footnote popups: fix link unhighlight when tap on external link.
I don't think it does. Better, that is. |
I like it for actual titles, not so much for multiline links, FWIW ;). |
It's okay for titles, yes. Not really better or worse. But the link is both more balanced and also much worse. ;-) |
Been toying with adding some kind of PTF (Poor Text Format) to TextBoxWidget, so we could specify alignment hints on individual lines in text fed to TextBoxWidget. @@ -36,6 +36,8 @@ local TextBoxWidget = InputContainer:new{
editable = false, -- Editable flag for whether drawing the cursor or not.
justified = false, -- Should text be justified (spaces widened to fill width)
alignment = "left", -- or "center", "right"
+ simple_formatting = false, -- Set to true to look for simple formatting hints via chars
+ -- (do not enable it when editable=true, not tested)
+-- Simple formatting chars (picked from Unicode Private Use area)
+
+-- Line alignment (that's all we have for now)
+TextBoxWidget.LINE_ALIGN_LEFT = "\xEE\x90\x80" -- U+E400
+TextBoxWidget.LINE_ALIGN_CENTER = "\xEE\x90\x81" -- U+E401
+TextBoxWidget.LINE_ALIGN_RIGHT = "\xEE\x90\x82" -- U+E402
+TextBoxWidget.LINE_ALIGN_JUSTIFY = "\xEE\x90\x83" -- U+E403
[+ some added code to deal with them] and: - text = T(_("Would you like to read this Wikipedia %1 article?\n\n%2\n"), wiki_lang:upper(), wiki_page:gsub("_", " "))
+ simple_formatting = true
+ local TextBoxWidget = require("ui/widget/textboxwidget")
+ text = T(_("Would you like to read this Wikipedia %1 article?\n\n%3%2\n"), wiki_lang:upper(), wiki_page:gsub("_", " "), TextBoxWidget.LINE_ALIGN_CENTER)
if epub_fullpath then
- text = T("%1\n%2", text, _("This article has previously been saved as EPUB. You may wish to read the saved EPUB instead."))
+ text = T("%1\n%3%2", text, _("This article has previously been saved as EPUB. You may wish to read the saved EPUB instead."), TextBoxWidget.LINE_ALIGN_JUSTIFY)
[...]
dialog = ButtonDialogTitle:new{
title = text,
+ simple_formatting = simple_formatting,
use_info_style = true,
buttons = buttons,
} We could get when needed results like this (just an example, we'd probably only use LINE_ALIGN_CENTER on the Wikipedia title in that specific example): But I wonder:
|
The way that looks is not great for localization purposes, to put it almost euphemistically. ;-) If you want to experiment with typography, why not just use the rich text widget we have at our disposal these days? No centering, just something like a simple Also see, e.g., #2555 (comment) although I think that "Are you sure you want to wipe" might be going a bit overboard. Mainly I'd just make the first line bold: |
From the Gnome HIG, which aligns with my comment above:
|
That's why I asked for alternative suggestions. text = T(_("Would you like to read this Wikipedia %1 article?\n\n=%2\n"),
wiki_lang:upper(), wiki_page:gsub("_", " ")) Or, if hardcoding the layout: text = T(_("Would you like to read this Wikipedia %1 article?"), wiki_lang:upper()) ..
"\n\n" .. TextBoxWidget.LINE_ALIGN_CENTER .. wiki_page:gsub("_", " "))
I don't :) Just wanted a quick solution to this not that nice display of the Wikipedia article title.
Not that keen on having to bring MuPDF to render simple text messages. And using HTML in the localisation strings is prone to errors, unbalanced tags, readability... |
I am because I'm not talking about simple, although even merely implementing support for You shouldn't use HTML, but Markdown. BlockquoteWould you like to read this Wikipedia %1 article?
> %2 StrongWould you like to read this Wikipedia %1 article?
**%2** ListWould you like to read this Wikipedia %1 article?
* %2 Some headerWould you like to read this Wikipedia %1 article?
## %2 PreWould you like to read this Wikipedia %1 article?
```
%2
``` Also note definition lists (here, might make it into CommonMark soonish?), although like some of the others mentioned probably not so much for this use caseWould you like to read this Wikipedia %1 article?
: %2 The specifics don't necessarily matter too much. Ideally the element base style suffices, but you can pass along some minor adjustments in the stylesheet. |
But you and markdown do not even answer my original wish: text centering :( :) |
I don't agree that it should be centered. I think it looks unbalanced in combination with a ragged-right edge. NB I don't think "balanced" is a particularly important metric, unless all else is roughly equal. Weight and size are the best way to improve clarity of the dialogs. However, the above is most definitely the answer to your question and not my vision on what it should look like. See below for that. Because no matter which element you go for, if you tell it to I think blockquote or emphasized does a better job. |
- Removed "Swipe to follow first link on page" menu item and handling code, as it feels not really as practical as "Swipe to follow nearest link". - Removed recently added "External link action", as we can just always present a popup with the url and the available actions. - Generic handling of these actions in onGoToExternalLink(), so they are proposed on the Wikipedia lookup popup too. - Allow external link on PDF documents (previously, only internal links were handled). - Have "Ignore external links on tap" available on all document types. - Added "Ignore external links on swipe" (default to true, the current behaviour). - Added multiswipe gesture "Follow nearest internal link" (the existing "Follow nearest link" now follows the nearest external or internal link) - ButtonDialogTitle: added an option to look a bit more alike ConfirmBoxes. - Footnote popups: fix link unhighlight when tap on external link.
Follow up to #4863, see discussion there (so, I removed the External link action menu, and as a compensation, I allowed external links on swipe :).
I'm not really fond of the switch for Wikipedia popup from the ConfirmBox & MultiConfirmBox to this ButtonDialogTitle, but I guess I'll get used to it (the removal of the Info icon make more room for the article title, so I guess it's good).
For all Wikipedia or external links, the popup will be the same, with just added buttons depending on what's possible/available: