Commit Graph

130 Commits (bf6c0cdd6c5b22bbb38497b5df8abe428eb80307)

Author SHA1 Message Date
NiLuJe bf6c0cdd6c
LuaSettings: Add a method to initialize a setting properly (#7371)
* LuaSettings/DocSettings: Updated readSetting API to allow proper initialization to default.
Use it to initialize tables, e.g., fixing corner-cases in readerFooter that could prevent settings from being saved.
(Fixes an issue reported on Gitter).
* LuaSettings/DocSettings: Add simpler API than the the flip* ones to toggle boolean settings.
* Update LuaSettings/DocSettigns usage throughout the codebase to use the dedicated boolean methods wher appropriate, and clean up some of the more mind-bending uses.
* FileChooser: Implement an extended default exclusion list (fix #2360)
* ScreenSaver: Refactor to avoid the pile of kludges this was threatening to become. Code should be easier to follow and use, and fallbacks now behave as expected (fix #4418).
3 years ago
NiLuJe d8fc28df97
Page Overlap: Fix rectangle computation and arrow mode (#7269)
* In ReaderPaging, the panning step pre-PanningUpdate can be wildly overshot near page edges, so, use the corrected value instead by recomputing it after the panning has been effectively computed by ReaderView.
This fixes slight inaccuracies, as well as glaring mistakes when going backwards, or when near page edges.
This is in line with how ReaderRolling computes the value, which I only realized later because I'm an idiot. 
* Minor cleanups around the handling of the dim_area Geom object in general.

* Fix the "Arrow" page overlap mode to be painted in the right coordinates when going backward. Issue might not have been terribly clear because of the previous issue ;).
* Center the arrow's point, while we're here.
* Don't use AlphaContainer to make it translucent, because AlphaContainer is horribly broken, and has weird quirks and behavior that make no sense to me unless some very specific and unlikely constraints are met, and they definitely aren't here.
This fixes the arrow copying an arrow-sized square of the original page the book was opened on on the top-left corner of *every* page with an arrow. (lol).
* Do real proper alpha-blending via Icon/ImageWidget from the original icon, instead of faking it via addBlitFrom, in order to avoid the dimming *around* the triangle's shape.
3 years ago
poire-z 3b89e32069 [UX] Add ToC/Bookmarks settings
- Menu widget: allow specifying the number of items per
  page and the item font size, so we can use other values
  than the default File browser ones
- Menu: fix setDirty when a border is used
- ToC: add item per page and font size settings, make
  Alternative ToC more visible (was previously
  available on long-press on Table of contents)
- Bookmarks: add item per page, font size, size reduction
- Progress bars (Skim widget and footer): allow selecting
  ToC depths from which ticks are made.
3 years ago
poire-z 316107a1cb ReaderRolling: fix possible crash in scroll mode
When opening a document in scroll mode with an invalid
last_xpointer.
This code path was never taken before 05126b94, and it has
never been updated to pass the page number in scroll mode
(so it's provided to the footer) like it has been in other
places.
3 years ago
poire-z 49e2d91afb Don't toggle the footer when toggling the top status bar 3 years ago
poire-z 05126b94b6 Dual pages: shown as 2 columns on a single page
Rework Dual pages code so that the view is considered
a single page number, so it looks more like 2-columns
on a single page.
This solves a few issues like:
- Page number and count are consistent between top
  and bottom status bars
- SkimTo -1/+1 doing nothing every other tap
- Statistics being wrong (like "Pages read" never
  going over half of the book page count)
3 years ago
poire-z 7779e2d8e7 CRe: use getDocumentRenderingHash() to detect rendering changes
Instead of just relying on document full height
and number of pages.
3 years ago
poire-z 8f79c662cf Notification: closed by any event, but not consuming it
Make Notification have toast=true, and UIManager deal
specifically with such widget:
a "toast" widget gets closed by any event, and let
the event be handled by a lower widget.
This should allow us to not wait or tap to get rid
of a notification, and just go on with what we're
doing.
Also make them have a default timeout of 2s,
used with all existing ones.
3 years ago
Frans de Jonge ded8ae6efb
[lang] Minor touch-up to non-linear info text (#6895)
As an aside, it should be "ToC," not "Toc." ;-)

Cf. <https://github.com/koreader/koreader/pull/6847>.

* Also fix newlines in to be translated string
4 years ago
Jellby 5e3c554dd7 Hide non-linear fragments
Add option to hide (skip) non-linear fragments, only working
in 1-page mode. Tweaks mostly to footer, toc and skim code
to make it clear(er) which pages belong to linear or non-linear
fragments.
4 years ago
Jellby f892d4559f Fix typos 4 years ago
NiLuJe a393137273
Another round of ReaderFooter fixes (#6830)
* When auto_refresh_time is enabled, don't actually refresh anything when the footer is hidden.
* Fix a bunch of state tracking related to height computations, meaning `getHeight()` is now actually accurate, always, and we don't need shitty workarounds anymore.
  * `footer_container.dimen.h` *includes* the progress bar, so, never reset it to 0 unless the progress bar is disabled (some `settings.progress_bar_position` codepaths were mistakenly doing just that).
  * More aggressively set/reset `footer_text.height` (not sure this one makes much of a difference, and/or if it's actually useful at all, but, the tracking was already there, but hella inconsistent, so, just fix it).
* Honor `settings.reclaim_height` in other bits of code that were only checking `footer_visible` to figure out the visible page area.
* Ask ReaderView to update the `visible_area` *now* when toggling the footer's visibility (for ReaderPaging).
4 years ago
NiLuJe 1ac5846eff
Revamp ToC ticks handling (#6716)
Replace the level `0` `getTocTicks` heuristic with a simple sorted, deduped flat listing of *every* ToC node (via `getTocTicksFlattened`).
4 years ago
poire-z 8d99523388
bump crengine: new HTML parser, libRu and FB2 tweaks (#6560)
Includes:
- Revert "FB2: don't draw cover in scroll mode"
- (Upstream) FB2: fix coverpage drawing in scroll mode
- FB2 footnotes: only merge run-in when next is erm_final
- fb2.css: use OTF tabular-nums for footnote numbers
- Text: ignore ascii and unicode control chars
- Fix HR positionning when floats involved
- writeNodeEx(): minor tweaks
- OnTagClose(): add self_closing_tag parameter
- HTML format detection: accept HTML5 doctype
- HTML parser: rework Lib.ru specific handling
- HTML parser: new more conforming implementation
- HTML parser: ensure foster parenting inside tables

Also includes:
- SDL: don't bypass X11 WM compositor
4 years ago
yparitcher 5a7ecabaed
ReaderRolling: fix gotoPercent (#6503)
Before it only worked in scroll mode not page mode & it used 10000 instead of 100%
4 years ago
yparitcher 93eadbaf88
recalculate footer progress bar correctly on `UpdatePos` (#6436)
Closes: #6434
4 years ago
yparitcher 70f89c4df1
ReaderGesture: cleanup (#6292)
convert all gesture actions to use events for better modularity
add network event handlers and device event handlers
4 years ago
yparitcher f7d538b108
Landscape FM / Refactor rotation (#6309)
* landscape FM / Refactor rotation

refactor and simplify the orientation handling code. the user generally cares about the rotation (what direction the device is facing) and not about if koreader is displaying in portrait or landscape mode

* bump base

update luasocket, libjpeg-turbo, curl
add logging to evernote-sdk-lua
update framebuffer for proper rotation
4 years ago
Frans de Jonge 86db43a052
[UX] Move double tap to gesture manager (#6322)
Also replaces the default with +10/-10 pages instead of prev/next chapter.

Closes <https://github.com/koreader/koreader/issues/2721>.
4 years ago
NiLuJe b23af97914
Fix partial HW dithered refreshes sometimes appearing to shift refreshed content (#6267)
* Fix HW dithered partial refreshes sometimes behaving as if the refreshed
content had moved a few pixels to the side...

Probably a kernel issue with the alignment fixup in the EPDC?

* Get rid of the legacy coordinates fixup

It shouldn't be necessary anymore.
And I'd rather fix the root cause, anyway.

* Bump base

(https://github.com/koreader/koreader-base/pull/1116)

* Missed a few DIVs in #6224
4 years ago
NiLuJe 1f994f8ede
Floor dimension computations (mul/div). (#6264)
* floor most every dimension computations involving MUL or DIV
Should avoid passing nonsensical floating point coordinates/dimensions
to the UI code.

* Update base

* https://github.com/koreader/koreader-base/pull/1113
* https://github.com/koreader/koreader-base/pull/1114
* https://github.com/koreader/koreader-base/pull/1115

* Bump android-luajit-launcher

https://github.com/koreader/android-luajit-launcher/pull/230
https://github.com/koreader/android-luajit-launcher/pull/231
4 years ago
NiLuJe 2b5b069863
Remove a dodgy scheduleIn (#6241)
It was causing a double-refresh on orientation change via ConfigDialog

I could only reproduce it on Kindle, for some strange reason (slower?).
4 years ago
poire-z 5536ce996a CRE: use same marks in top and bottom progress bars
Feed to crengine the same ticks (build from the TOC
entries) that we use in the bottom status bar.
(crengine otherwise builds a tick for each DocFragment,
which most often is really different than what's seen
in the bottom bar.)
4 years ago
poire-z 177551918f
bump_crengine: various fixes, tweaks and cleanups (#6188)
Includes:
- Don't reset invisible BR to display: inline
- ldomTextCollector: handle inline-block/table as inline
- Avoid re-rendering on font hinting mode change
- List markers: fix positionning when floats involved
- GIF decoding: avoid uneeded abort on LZW table overflow
- Adds getUnknownEntities(), can help with debugging
- Don't check stylesheet hashes when loading from cache
- Hardcoded elements and attributes list: cleanup
- Full rendering: 2 small optimisations
- Strut confinning: deal with images earlier
- lvtextfm: some cleanup and reordering
cre.cpp:
- fix getPageFromXPointer() and getPosFromXPointer()
  to not fail on invisible nodes and work on the next
  visible node (so links whose target is display:none
  can work).

Add support for 2 settings one can set manually
in reader.settings.reader.lua:
["cre_background_color"] = "0xccffcc",
["cre_background_image"] = "/path/to/bg_paper.jpg",
4 years ago
poire-z e5206922c6 [UX] Normalize SpinWidget and DoubleSpinWidget
- Use same names for options;
- Have them both movable
- Add option to keep widget shown on Apply (and use that
  when appropriate: when the value may have an immediate
  visual effect, so one can tweak it without having to
  go thru menus to re-open it again).
4 years ago
poire-z 026140f809 Adds ReaderPageMap, to optionally show source pages numbers
bump crengine: support for EPUB3 nav toc and page maps
Includes:
- Fix lvRect:isRectInside(rc) with 0-width or 0-height rect
- TOC: parse EPUB3 nav toc, fallback to spine when no toc
- Parse and cache various hardcopy page list maps
- epub.css: hide EPUB3 <span epub:type="pagebreak"> content
cre.cpp: add a few PageMap helper functions.

Adds ReaderPageMap which will add a new menu (under TOC and
Bookmarks) that will allow:
- to list source page numbers (like a TOC)
- to show visible page labels in the right margin
- to use these source page numbers in the footer, the TOC,
  the GoTo and SkimTo widgets, and to use the source page
  number in the standard bookmark and highlight initial text.
4 years ago
poire-z c1f19e943a
Make xpointers migration ConfirmBox non-dismissable (#5931)
Because dismissing it by tapping outside would have
"not for this book" selected, which is the least
welcome action.
4 years ago
poire-z 5a4f5b4d59 bump crengine, migrate books to normalized xpointers
Enable new rendering feature COMPLETE_INCOMPLETE_TABLES
on all enhanced rendering mode, but have it disabled for
earlier cre_dom_version.
Also increase default_cre_storage_size_factor from 20 to 40.
4 years ago
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
4 years ago
yparitcher 816b197ab9 [UX] Thicker loading bar (#5581)
The current thickness for the loading bar when opening a document is to thin to really see on my KT4,
5 years ago
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
5 years ago
yparitcher aa165cefe9 [UX] Set global settings independent of local setting (#5522) 5 years ago
poire-z 50f3aa252f cre progress meter: avoid some warning with unit tests (#5464)
Quick fix for some warnings shown in unit tests output, see https://github.com/koreader/koreader/pull/5406#issuecomment-540059452
5 years ago
poire-z 529d2d91d6
cre: properly unmark link position markers (#5451)
By restoring the previous content instead of just drawing
a white rectangle.
5 years ago
yparitcher 09d49e29ad [UX] Add inverse reading order to gesture manager (#5423)
Also fixes #5354.
5 years ago
Robert 0778ec09fc Fix: incorrect chapter markers (#5425) 5 years ago
poire-z 5bc6bf046c
bump crengine, show progress meter on load/re-rendering (#5406)
Includes:
- Adds tinyNodeCollection::getStatistics()
- epubfmt.cpp: cleanup indentation and small optimisation
- Add more progress callback events
- Optimisation: avoid re-init for EPUBs with embedded fonts
- Fix: don't draw border when border-color: transparent
- CSS: ignore 'inherit' inside font-family

Show a small progress meter at top left of screen when
crengine is loading, re-rendering, and saving cache file
(after a 2 second delay to not be bothered on small books).

Also add a wrapper for the last remaining bit of code that
was accessing _document directly (:getPageOffsetX()).
5 years ago
Frans de Jonge ed4396821f
[fix] ReadSettings Inverse reading order (#5350)
`self.inverse_reading_order == nil and G_reader_settings:has("inverse_reading_order")` could easily be false, which would then incorrectly turn the setting off.

Fixes <https://github.com/koreader/koreader/issues/5346>.
5 years ago
Frans de Jonge 4cdc3ab99b
[feat, plugin] Add AutoTurn (#5295)
Fixes <https://github.com/koreader/koreader/issues/3019>.
5 years ago
Frans de Jonge ac16c8d547
[UX] Treat inverse_reading_order as a proper setting (#5284)
This is supported by ReaderPaging and ReaderRolling, but the menu entry was only shown in ReaderPaging.

Hold now sets the global default.

Fixes <https://github.com/koreader/koreader/issues/4983>.
Fixes <https://github.com/koreader/koreader/issues/4089>.
5 years ago
Frans de Jonge be87fb27a0
[chore] Convert a couple more todos (#5267)
Cf. <https://github.com/koreader/koreader/pull/5244>.

Also update check.
5 years ago
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
5 years ago
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
5 years ago
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
5 years ago
Robert 803a143764 [sdl] Add support arrow key for next/prev page (#5149)
Close: #4997 
This PR add support arrow key and mouse scroll wheel for next/previous page.

- Document in page mode:

PageDown, Arrow down, Arrow right - go to next page
PageUp, Arrow up, arrow left - go to prev page
Mouse scroll wheel down - go to next page
Mouse scroll wheel up - go to prev page

- Document in scroll mode:

PageDown, Arrow right - go to next page
PageUp, Arrow, arrow left - go to prev page
Arrow down - scroll document down
Arrow up - scroll document up
Mouse scroll wheel down - scroll document down
Mouse scroll wheel up - scroll document up
5 years ago
poire-z 9f3c85ed83 cre: toggable enhanced rendering (floats, collapsed margins...)
Adds "Render mode" toggle with 4 modes, to enable some or all
of crengine's new enhanced block rendering features.
Use "legacy" rendering for previously opened books to not mess
with bookmarks, and "web" (all of the new features) for new books.

Also make available the added "HTML5" stylesheet to the Style menu.
5 years ago
poire-z eace8d25c1 cre: fix possible crash when switching books too fast
Noticable with "End of document action > Open next file",
and holding PgDn in a directory full of single page html
files.
5 years ago
NiLuJe 7210fb478d
Faster blitting @ BB8/BBRGB32 when no processing is needed (#4847)
* Pickup the eponymous blitting performance tweaks from koreader/koreader-base#878
* Cleanup BitOpts usage (require & cache)
* Unify oddness checks (MOD -> AND)
* Enforce the native Portrait orientation on Kobo (except @ 16bpp, i.e., KSM w/ 8bpp swap disabled), to allow for faster blitting when unrotted.
* Switch CRe BB to 32BPP on color screens
* Minor cleanups
5 years ago
poire-z a47f3a2765 ReaderRolling: proper refresh when toggling scroll/page mode
When toggling between scroll and page modes multiple
times, _gotoXPointer() could find the xpointer to be
already positionned and avoid calling setDirty() (so
not enqueuing a whole screen refresh). But the page
will be slightly moved to account for the top margin
disappearing. We need that whole screen refresh in
such cases, so ensure one is enqueued.
5 years ago
poire-z cfd562697f
Fix Color rendering toggle not toggable (#4836)
Also refresh screen when toggling.
5 years ago