2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
Commit Graph

114 Commits

Author SHA1 Message Date
poire-z
8e68dc11db
Highlights: turn page when start or end crosses pages (#5984)
More generally: switch to the page that contains the highlight
edge that we are currently moving.
2020-03-20 21:58:58 +01:00
Martín Fernández
5d103a41f8
Avoid writting highlights into read-only PDFs (#5889) 2020-02-25 21:26:19 +01:00
poire-z
f6a64de44a View HTML: adds another extended debug view
Split the extended debug view (rendering method + unicode
codepoints) into 2 distinct views, as it's more practical.
2020-01-31 15:33:13 +01:00
poire-z
23d848acf4 Reader: strict ordering of tap & hold gestures (#5789)
The lack of proper overrides could make their
order/precedence/priority non-deterministic.
2020-01-24 20:05:21 +01:00
poire-z
7eee758149
bump crengine: support inline-block, better text selection (#5763)
Includes:
- lvtinydom.cpp: fix Use-after-free
- lvtextfm: fix/cleanup lastnonspace code bits
- lvtextfm: fix vertical-align: top & bottom
- renderBlockElementEnhanced: minor fixes related to floats
- renderBlockElementEnhanced: compute baseline of block
- Add support for display: inline-block/inline-table
- Better selection highlighting by using getSegmentRects()
- getHtml(): add flag to get text soft-hyphenated

cre.cpp: toggable text selection highlighting method,
default to the new one using segments.

Update various cre flags to use the new features (and
to conform with some flags re-ordering):
- support display: inline-block in flat, book and web
  render modes.
- get HTML with soft-hyphens for footnote popups, so MuPDF
  can use them when rendering the footnote.
2020-01-14 01:14:15 +01:00
poire-z
acfc8c0440
CRE multipage text selection: mirror corners when inverse_reading_order (#5751) 2020-01-06 21:09:00 +01:00
Martín Fernández
ffabb26aae close menu before sharing text 2020-01-05 16:21:45 +01:00
Martín Fernández
5ef329c19c android: share text (#5745) 2020-01-05 12:56:01 +01:00
poire-z
0599c440cc [RTL UI] Bidi-wrap filenames, paths, urls, metadata
bidi.lua:
- Revert "Alias everything to Bidi.nowrap() when in LTR UI,
  as using LTR isolates seems uneeded when already LTR" (part
  of a628714f) which was a wrong assumption: we need proper
  wrappers for all things paths. Enhance some of these wrappers.
- Fix GetText RTL wrapping which was losing empty lines and
  trailing \n.

- Wrap all paths, directories, filenames in the code with
  these wrappers.
- Wrap all book metadata (title, authors...) with BD.auto(),
  as it helps fixing some edge cases (like open/close quotation
  marks which are not considered as bracket types by FriBiDi).
  (Needed some minor logic changes in CoverBrowser.)

- Tweak hyphenation menu text
- Update forgotten SortWidget for UI mirroring
- KoptConfig: update "justification" index for RTL re-ordering,
  following the recent addition of the page_gap_height option.
2020-01-04 01:34:46 +01:00
poire-z
7952fa2c09 [RTL UI] update widgets and apps for UI mirroring
Small tweaks all around to handle UI mirroring:
- swap existing symbols like arrows, or use alternative ones
- rotate some images, like chevrons and dogear icons
- flip some left and right swipe handling
- flip some geometry arithmetic like tap on left or right
  side of page or dict window
- use new ProgressWidget:getPercentageFromPosition() instead
  of geometry arithmetic
- BD.wrap() some concatenated string bits, like in reader
  and menu footers
- flip inverse_reading_order when UI is mirrored

More specific tweaks:
- ReaderGesture: reset some specific gestures when UI direction
  has changed (tap on top/bottom left/right corners, for
  bookmarks and FileManager "Plus menu").
- ReaderRolling: show markers on the correct side of page,
  in single or dual page mode.
- KoptOptions: swap left and right icons in Alignment toggle
- CheckMark: proper rendering in all 4 mirroring/rtl combinations.
- VirtualKeyboard: forbid any mirroring
- Move util.getMenuText into Menu.lua
2019-12-08 15:10:51 +01:00
poire-z
d6d49a64a7 [RTL UI] use auto or LTR text direction in some specific cases
Allow TextBoxWidget new text direction/lang parameters to be
set on upper widgets, and propagate them all the way to it
(ScrollTextWidget, InputText, InputDialog, TextViewer).

Use specific non-default ones in some specific cases:
- Force LTR text direction when showing HTML and CSS, and
  configuration files (in some plugins).
- Use Wikipedia server language and text direction when
  showing an article.
- Use auto with Dictionary results, as we don't know the
  dictionary language, and they may contain mixed content.
- Force LTR when showing some paths (still needs more of them)

TextEditor plugin: add 2 new options "Auto paragraph direction"
and "Force paragraph direction LTR".

Footnotes popup: grab HTML direction, and forward it
to MuPDF for proper display.
2019-12-08 15:10:51 +01:00
NiLuJe
d8e0b1759b
Other minor frontend.util cleanups (#5629)
* Resync fixUtf8 w/ upstream
* Fix lastIndexOf desc
* Drop unichar usage, it's a crappier unicodeCodepointToUtf8 ;).
2019-11-24 00:27:27 +01:00
yparitcher
83b7d8de2b [UX] Default setting option always enabled (#5580)
as per https://github.com/koreader/koreader/pull/5522#issuecomment-548006595 do not grey out the current default
2019-11-08 21:01:38 +01:00
yparitcher
aa165cefe9 [UX] Set global settings independent of local setting (#5522) 2019-10-25 17:25:26 +02:00
Frans de Jonge
0fa1b44782
[UX] Add … button to highlight edit (#5456)
Shows regular highlight dialog. Fixes #5455.
2019-10-06 23:47:53 +02:00
Frans de Jonge
37bab4fe89
[fix] Pass plain link to link:onGotoLink (#5286)
Internal links carry more baggage than external ones.

See <https://github.com/koreader/koreader/pull/5282#issuecomment-526813719>.
2019-08-31 12:43:19 +02:00
Frans de Jonge
45a0f285f1
[fix, i18n] Make two strings translatable (#5256)
Fixes <https://github.com/koreader/koreader/issues/5255>.
2019-08-24 13:45:07 +02:00
Frans de Jonge
a2dcfe9aec
[doc] Tag @todo, @fixme and @warning (#5244)
This commit standardizes the various todos around the code a bit in a manner recognized by LDoc.

Besides drawing more attention by being displayed in the developer docs, they're also extractable with LDoc on the command line:

```sh
ldoc --tags todo,fixme *.lua
```

However, whether that particular usage offers any advantage over other search tools is questionable at best.

* and some random beautification
2019-08-23 19:53:53 +02:00
Frans de Jonge
da988c15de
[CI] Switch to custom xgettext build to extract multiline strings (#5242)
Because let's face it, it just looks much better this way.

Docker image update in https://github.com/koreader/virdevenv/pull/43

Discussion in https://github.com/koreader/koreader/pull/5238#issuecomment-523675211 and https://github.com/koreader/koreader/pull/4524
2019-08-22 17:11:47 +02:00
Frans de Jonge
e2ceace302
[fix, CI] Push to Transifex from master, fix multiline strings for xgettext (#5238)
Related to https://github.com/koreader/koreader/pull/5237
2019-08-22 00:12:53 +02:00
poire-z
d25d449a26
bump crengine and others, adds HTML extended debug view (#5219)
Bump crengine: background image and other fixes:
- View HTML: option to show text unicode codepoints
- Fix attribute parsing: decode &-encoded chars
- Text: allow wrap after more unicode spaces and hyphen
- Fix: no left hanging when hanging punctuation disabled
- lvtextfm.cpp: more comments, some formatting cleanup
- Optimize background image drawing
- CSS: fix background-image file path resolution

Bump luasec to 0.8.1
Bump harfbuzz to 2.6.0

cre.cpp:
Adds setBackgroundImage() proxy function to crengine
facility to set background textures (this is unrelated
to the background-image CSS fixes).
No frontend code (yet) to select such an image.

View HTML: adds a 3rd view (extended debug view), showing the
unicode codepoint of each char and crengine rendereing methods.
2019-08-17 19:10:54 +02:00
poire-z
8b612142b7 Prettier CSS when viewing HTML
Avoid wraps on comma in properties values (eg. in font list,
in rgb() values).
Also prettify CSS included in the HTML in debug view.
2019-07-15 20:14:33 +02:00
Galunid
9759ffa381 [feat] GestureManager: Implement action to change highlight style using gesture manager (#4936) 2019-04-18 12:12:38 +02:00
poire-z
7396abebf2 [chore] reformat all gestures "overrides" to be diff friendly 2019-03-30 23:47:07 +01:00
Galunid
f637555d93 [UX] Gesture manager: add action - cycle default highlight action (#4791)
Cf. https://github.com/koreader/koreader/issues/4727
2019-03-14 15:33:04 +01:00
poire-z
766b199880 cre 2-pages view: allow extending selection across pages
Similar to what's been added for 1 page view, but just turn
one page instead of switching to scroll mode when reaching
top left or bottom right corners.
Also make the selection start xpointer more accurate by
getting them in onHold(), instead of possibly too late in
onHoldPan() where we have already moved.
2019-03-13 22:18:04 +01:00
poire-z
0948a4b656 cre: tweak current page highlights detection
No need to use current page and xpointers. We can use
'pos', in both scroll and page modes, as it is always
accurate to show the y of the current view.
2019-03-13 22:18:04 +01:00
Galunid
14c705f11b Enable addNote button, by letting it edit highlight (#4773) 2019-03-12 20:14:34 +01:00
poire-z
2c98c81a0d
cre: fix highlights in 2-pages mode (#4753)
Also check for boxes in the 2nd page when in 2 page modes
(and fix onTapXPointerSavedHighlight(), too quickly cut
and pasted from drawXPointerSavedHighlight() recently).
Bump crengine and cre.cpp to correctly returns rect for
the first line of the 2nd page.
2019-03-07 22:13:30 +01:00
poire-z
918f296bd3 cre scroll mode: fix highlights not shown when small pages
The idea of looking for highlights 1 page before and after
was not working when you have multiple small pages, and
some scroll mode view was actually showing 3 or 4 pages.
So, rework that by using absolute positions when looking
for highlights present in the scrolled view.
2019-02-26 09:43:35 +01:00
poire-z
62d548fc61 Highlight adjusting: avoid start and end crossing each other 2019-02-17 16:54:54 +01:00
Frans de Jonge
33840c17cb
[fix] Highlight moving button text shouldn't be translated (#4597) 2019-02-16 15:03:27 +01:00
Galunid
015fb4d34e Allows adjusting highlight start and end (#4582)
Adds arrow buttons under Delete|Edit.
Tap to move by word, hold to move by char.
2019-02-16 00:42:27 +01:00
poire-z
e802b96e45 cre: allow text selection/highlighting across pages
Panning to the bottom right corner (or top left corner) switches
to scroll mode and scroll the page forward (resp. backward) 1/3rd
of the screen.
One has to pan out of the corner to continue selection.
Panning again to that corner scrolls another 1/3rd of screen.
Page mode is restored when highlighting or dismissing the highlight
dialog, and a little marker is shown at where selection was started
so one does not get lost after all that scrolling and restoring.
2019-02-03 22:12:00 +01:00
poire-z
895589ddaa
Page overlap menu (cre): set nb of overlap lines (#4538)
Make this existing setting tunable with a menu item.
Also make the Page overlap and Highlight menus use a
checkbox, and their items grayed out when disabled.
2019-02-03 11:17:27 +01:00
poire-z
335a513826 [chore] cleanup multi-lines translatable strings
Revert 9971eb85 and make multi-lines strings more readable.
(Multiline translatable strings extraction has been fixed
in koreader-misc tralua_xgettext.py.)
2019-01-29 00:05:55 +01:00
Galunid
0678d75438 Adds choice of default action when highlighting (#4486)
New menu Document > Highlight action.
2019-01-17 22:12:38 +01:00
poire-z
80cb9d0db1 adds "Translation settings" menu
and the list of 104 languages supported by Google Translate
2018-12-17 15:19:25 +01:00
poire-z
22b7f17cd8 Fix translator, enable selected text translation
Update translator.lua to use a still working google translate API.
Add a method to show translations (main and alternates) in
a TextViewer.
Re-enable "Translate" button in text selection/highlight buttons
dialog.
Target language can be set with a manually added setting:
    translator_target_language = "fr"
and will fallback to the UI language.
2018-12-17 15:19:25 +01:00
poire-z
ea946d52d6 bump crengine: tables rendering improvements and others
bump crengine, which includes:
- Adds support for symbol fonts (local or embedded)
- Fix some issues when rendering text in constrained width
- Page splitting: fix possible missing blocks
- CSS: adds support for 'auto', ignore % for borders
- Fix right border drawing position
- Fix: adds missing properties in copystyle()
- Adds comments, erm_killed rendering method
- Adds getRenderedWidths(): get node min/max node content width
- Tables rendering: fixes and improvements
- getRenderedWidths: enable min_width to be a single CJK char
- Fix wrong text wrap avoid in some case
- epub.css: add style for 'blockquote'
- Fix rendering issue when line ends with an image

Adds a few style tweaks related to tables.

Enforce table width: 100% in Wikipedia EPUBs to keep
previous look, which feels better with the various kinds
of tables in Wikipedia pages.

Fix unit tests as juliet.epub (full of blockquotes), grew quite
a few pages with the epub.css update.
2018-12-07 14:11:46 +01:00
poire-z
2a8ab2b311 View HTML: adds Prettify button to CSS viewer
Quick and non-full-proof prettification, but quite good
and enough to make unreadable/minified CSS files readable
for Style tweaks cooking.
2018-10-23 13:12:40 +02:00
poire-z
f9086a2ba9
EPUB links: show footnotes in popup, larger tap area (#4261)
Adds new options to the Links> submenu, for now only
available and used with CRE documents.
- Allow larger tap area around links
- Ignore external links
- Show footnotes in popup
- Show more links as footnotes

(This last item is mostly for testing and loosening the
footnote detection algorithm, and see how it would behave
with glossary-like links and inter glossary terms links.)

Fix distance computation from gesture position to link by
using segments.
Code for detecting if a link is a footnote is in cre.cpp, and
tweakable a bit with flags in ReaderLink:showAsFoonotePopup().

Footnotes HTML content is displayed by a new FootnoteWidget,
which uses MuPDF for its rendering.
From it, swipe south or tap outside to close, swipe to the left
to follow the original link and jump to the footnote location
in the book.

Also fix tap on highlights after the recent change to use segments
for displaying: use segments also when checking taps.
2018-10-10 18:50:24 +02:00
poire-z
0e2a3b6263 Selection menu: allow viewing HTML 2018-10-08 22:04:50 +02:00
poire-z
6ab34c6d1d cre highlights: draw segments instead of word boxes
It gives a cleaner drawing of multi-lines selected text.
Bump base and crengine.
2018-10-08 22:04:50 +02:00
poire-z
850be52177
Keep some menus open when Tap or Hold (#4189)
TouchMenu: added options to menu items with the following defaults:
    keep_menu_open = false
    hold_keep_menu_open = true
So, default for Tap callback is to close menu, and for Hold callback
to keep menu open.
In both cases, provide the TouchMenu instance as the 1st argument to
the callback functions (instead of a refresh_menu_func I added in #3941)
so the callback can do more things, like closing, refreshing,
changing menu items text and re-ordering...

ReaderZooming: show symbol for default (like it was done for
ReaderFont, ReaderHyphenation...)
TextEditor plugin: update the previously opened files list in real
time, so the menu can be kept open and used as the TextEditor main
interface.
SSH plugin: keep menu open and update the Start/Stop state in real time
ReadTimer plugin: tried to do what feels right (but I don't use it)

Also remove forgotten cp in the move/paste file code
2018-09-04 23:55:58 +02:00
poire-z
9971eb8533 Fix untranslatable strings (#4132)
Some problem somewhere with [[...]] strings starting with a
leading newline. Should probably be allowed, but for now
fix the few such cases to allow them being translated.
2018-08-01 19:29:03 +02:00
poire-z
4bb3999cbc RenderImage: factorize all image rendering and scaling code
New module RenderImage (alongside existing RenderText) to provides
image rendering and scaling facilities.
Uses MuPDF, but tries first giflib on GIF.
Allows for getting all the frames from an animated GIF.
2018-04-22 17:00:29 +02:00
poire-z
b3b7e3d279 Remove some leading and trailing newlines (#3768)
in some InfoMessage and ConfirmBox, introduced willingly
or not, that cause top or bottom padding
2018-03-17 18:13:04 +01:00
Frans de Jonge
076bf406fd
[UX] Add InfoMessage about OCR (#3718) 2018-03-05 16:38:04 +01:00
poire-z
5bc18b3c78 [fix] Long Hold on DjVu/PDF documents crash (#3697)
Holding on a word for more than 3s should bring the highlight menu.
It crashed on readerpaging documents because self.hold_pos is no more
a Geom object with them.
Also inverted selected_word/selected_text logic, as with PDF, selected_word
stays set when selected_text is available.
2018-02-26 17:25:34 +01:00