Commit Graph

2088 Commits (master)

Author SHA1 Message Date
NiLuJe c5d606a7f4
ProgressWidget: Add an optional marker on the initial position (#10114)
* Enable it on SkimToWidget
* Optional on ReaderFooter (toggle in the progress bar > style submenu)
1 year ago
poire-z 81f2aed086 ReaderRolling: quicker partial rerenderings with EPUBs
Only available with EPUBs containing 2 or more fragments,
and a file size large enough to ensure a cache file is used.
The idea is simply, on any rendering setting change, to
skip the rerendering of the full book and to defer any
rerendering to the moment we draw a DocFragment, and
render only it.
So, on a setting change, only the fragment containing the
current page will be rerendered, and the new fragments we
may cross while turning pages.
When having done so, KOReader is in a degraded state (the
full page count is incorrect, the ToC is invalid...).
So, a full rerendering is needed, and one will happen
in the background, and when the user is idle, we reload
seamlessly and quickly from the cache file it has made.
ReaderFlipping will show some icons in the top left
corner to let it know at which steps in this procress
we are.
1 year ago
poire-z 2f0954fa71 Book style tweak: revamp sample tweak 1 year ago
hius07 91ff6ce2d8
ReaderBookmark: fix comparing positions (#10109) 1 year ago
Melik 881d8ed406 Fix spelling of filemanagerutil.genStatusButtonsRow 1 year ago
Melik 7d6da81233 Compact covermenu addn. to for loop, fix collections bug, further gimp genStatusButton to use upvalues 1 year ago
Melik 0e470aaed9 Remove leftover function, arg 1 year ago
Melik d9b0785a96 Reset button gen to util, collections current file check
- filemanagerutil.resetDocumentSettings()'s doc_settings:close() -> doc_settings:flush()
- Remove current_status from filemanagerutil.getStatusButtonsRow() args, get it inside from file
- Move genStatusButton() inside filemanagerutil.getStatusButtonsRow()
- Move "Reset settings" button generation to filemanagerutil
- Rename "Reset settings" button to "Reset" and update popup box text
- Disable "Reset settings" for file if it's currently open in Collections (same as History)
1 year ago
Melik fb7ec830c6 Create getStatusButtonsRow() for status buttons, hide row if history item deleted 1 year ago
Melik 31cfffc289 Pull genStatusButton() to filemanagerutil 1 year ago
Melik 502bb0ccbf Create genStatusButton() for buttons, use item.dim for deleted in history 1 year ago
Melik 9e7e68beb6 Shorten status button names 1 year ago
Melik c0d0b36f98 Get rid of luacheck warning 1 year ago
Melik 1b2adfd201 Return to callback fudging, fix book info callback replacement 1 year ago
Melik 628cacf1e6 Disable status buttons for deleted files in history 1 year ago
Melik 77b110a987 Add 'Reset settings' button to collections 1 year ago
Melik 8642509f26 Move 'Put on hold' between reading & read 1 year ago
Melik a9313dda1a Add buttons to collections 1 year ago
Melik 57849b3f7c Add buttons to history, use id for button-getting 1 year ago
Melik 086d4622e6 Add buttons to file manager, lay groundwork 1 year ago
NiLuJe 45a4aac3d3
Notification: Fence the *display* update in an attempt to avoid upsetting some boards... (#10083)
Re: https://github.com/koreader/koreader/issues/9806#issuecomment-1416827447

Depends on https://github.com/koreader/koreader-base/pull/1576

Includes assorted cosmetics tweaks related to duplicate `setDirty` calls when instantiating widgets that already have an `onShow` handler doing it. (I left widgets doing it in `update` instead of `init` alone, on the assumption that callers *may* be relying on that behavior when updating widgets at runtime. This might actually never matter, and it certainly didn't for ScreenSaverWidget, which is why I removed it from there ;p).
1 year ago
Sargun Vohra 15fb73384f
EInk: Add a setting to toggle flashing on pages with images (#10049)
With minor code cleanups along the way ;).
1 year ago
NiLuJe 21210800c1
ReaderFooter/Header: Refine autorefresh repaint-or-not checks (#10045)
Use both a whitelist for targeted widget repaints, a blacklist for no repaint at all, and a fallback for a full in-order ReaderUI repaint when unsure.

Use a similar approach in ReaderHeader (i.e., prevent explicit refreshes while ReaderMenu is open).

Re #9979, re #9768
1 year ago
NiLuJe 7863a7ad70
Misc: Natural sorting refactor (#10023)
* Move natural sorting algo to a dedicated sort module to avoid code duplication
* Use a slightly more accurate algorithm, and speed it up by caching intermediary strings
* Calibre: Use natural sorting in metadata search (fix #10009)
1 year ago
NiLuJe 4732bc9aed ReaderView: Recompute page layout when toggling ReaderFooter in
non-reflowable documents.

The code only handled setups with "reclaim bar height" enabled (because
that's my usual workflow, har har), but would have broken in various
more or less obvious ways without it, depending on the exact layout/zoom
settings.
The previous attempts at handling the no-reclaim case were focused
on scroll mode, which is a bit of a nightmare. This approach should
deal as well/badly as the previous one in scroll mode, but actually
handle page mode properly ;).

Re #9979
1 year ago
hius07 d5a4ac14e1
ReaderUI: fix status and history (#9993) 1 year ago
NiLuJe 4ce0058e2d
ReaderLink: Minor logic simplification in onGoToPageLink (#9987)
Abort earlier if the nearest link is too far, instead of computing stuff and creating an object we'll never actually use.

Includes minor logging tweaks to vaguely related codepaths ;p.
1 year ago
zwim f0b007bb31
Footer: avoid footer auto refresh over bottom menu (#9983) 1 year ago
poire-z 7448ad23e7 ReaderDogear: fix no y-offset after load with top status bar 1 year ago
zwim ebaef61536
Make translateable: SystemStat, custom footer (#9945)
Fixes #9942.
1 year ago
NiLuJe 788ccac561
Input/Device: Refactor Gyro events handling (#9935)
* Get rid of the `canToggleGSensor` Device cap, it's now mandatory for `hasGSensor` devices. (This means Kindles can now toggle the gyro, fix #9136).
* This also means that `Device:toggleGSensor` is now implemented by `Generic`.
* Update the Screen & Gyro rotation constants to be clearer (c.f., https://github.com/koreader/koreader-base/pull/1568) (/!\ This might conceivably break some `rotation_map` user-patches).
* Input: Move the platform-specific gyro handling to Device implementations, and let Input only handle a single, custom protocol (`EV_MSC:MSC_GYRO`).
* Input: Refine the `rotation_map` disable method implemented in 43b021d37c. Instead of directly poking at the internal field, use a new method, `disableRotationMap` (/!\ Again, this might break some `rotation_map` user-patches).
* Input: Minor tweaks to event adjust hooks to make them more modular, allowing the Kobo implementation to build and use a single composite hook. API compatibility maintained with wrappers.
1 year ago
hius07 ee75abd4a0
Statistics: show correct number of notes in a book (#9928) 1 year ago
poire-z b1b7773237
TouchMenu: tweak menu search (#9926)
- Cleanup search and animation codes, fix inconsistencies
  between animation/no-animation opening, and refreshes
  glitches on eInk.
- Show menu item on tap, with buttons to either open
  directly, or to walk there (removed earlier "Animation"
  checkbox, so the choice can be decided later).
- Move event handlers into ReaderMenu/FileManagerMenu.
- Avoid duplicated and confusing results from gestures
  and font-family submenus.
1 year ago
melyux a53e9847fa
Footer: some menu items rewording (#9915)
Change footer status bar type setting label from 'Prefix' to 'Item style'.
1 year ago
melyux 6f39f6cb7b
Screensaver: exclude content when excluding cover, random image as fallback (#9912)
Exclude some screensaver option showing book content
(title, page image) when "Exclude this book cover" is checked. 
Random image as fallback, KOReader logo as 2nd-order fallback.
1 year ago
hius07 7719ad04f3
Reader: add open next file in folder to Dispatcher (#9916)
Closes https://www.mobileread.com/forums/showthread.php?t=350683.
1 year ago
NiLuJe b16b215cbb ReaderHighlight: Appease newer versions of LuaCheck
Good to know: it now defaults to assuming that function arguments
prefixed with an underscore would be unused, which is... nice in theory ;).
1 year ago
Roygbyte 3e49cf9a18
ReaderLink: allow buttons to be added to the External link dialog (#9746)
So plugins can register and advertize themselves
as handlers of external links (ie. Wallabag).
1 year ago
Frans de Jonge e1fe897c9b
[i18n] Add a couple of explanatory comments for translators (#9878) 1 year ago
hius07 c53dd55b16
ReaderHighlight: new Select mode icon (#9869) 1 year ago
weijiuqiao 49d8ec2f4f
Cloudsync: dropbox token re-generation (#9862) 1 year ago
hius07 05cd59ebe5
ReaderBookmark: indicate current page with dimmed page numbers after current (#9872) 1 year ago
Frans de Jonge e58a12ba04
TouchMenu: Search menu to search the menu (#9876)
Fixes #9800.
1 year ago
zwim 192a243b4d Add datetime.lua
Move date and time related functions from util.lua
(and the statistics plugin) to a new datetime.lua.
1 year ago
zwim d1cd2a1c8d
Restart KOReader: add a ConfirmBox instead of a plain InfoMessage (#9853) 1 year ago
Steady Quad fa9f0acf5e
cloudstorage: Fix directory listing for some WebDAV servers (#9847)
(sub)folders on some WebDAV servers are not listed in cloudstorage due to strict xml element matching of <d:collection> elements.
1 year ago
hius07 cd56dd2edf
ReaderHighlight: pdf multi-page highlights (#9850) 1 year ago
melyux cc53ceb039
History: remember status filter, show filtered count in title (#9822) 1 year ago
Frans de Jonge 84be6fc226
[i18n] Fix 'Choose new folder to set as home?' can't be translated (#9841)
Reported in <https://www.mobileread.com/forums/showthread.php?p=4276962#post4276962>.
1 year ago
hius07 c35140e8d2
ReaderHighlight: new icon in select mode ConfirmBox (#9830) 1 year ago
hius07 90f6dd178e
CloudStorage: add DropBox starting folder (#9821) 1 year ago
hius07 5b889a0145
Reader style tweaks: register in Dispatcher manually (#9816)
Style tweaks can be applied with a gesture or added to a profile.
1 year ago
zwim 486d7071c7
[StatusBar] Allow status bars to be repainted if they are not covered (#9768) 1 year ago
hius07 d95c692c78
ReaderHighlight: add abort select mode (#9786) 1 year ago
weijiuqiao e481e60aa1 Syncservice: fix not updating services after adding new ones 1 year ago
NiLuJe df890105e4 ReaderMenu: Use a dedicated handler for the Menu key
Piggybacking on the touch gesture handlers implied that the gesture
filter (tap and/or swipe) was still applied, which made no sense.

Also, stop the weird Event roundtrip for events we're actually the only
ones to handle, just call the handler ourselves directly.

Fix #9792
1 year ago
hius07 06cec98d09
Filemanagerutil: let abbreviate manage extra slash (#9785) 1 year ago
hius07 71c65d18f1
Page turns: add backward tap zone width setting (#9772) 2 years ago
poire-z 1fa706a2c5
Fix page stats messed up after rerendering (#9775)
Fix regression introduced by 48eb0231 #9651: on re-rerendering, the new pages count didn't reach the Statistics plugin.
So, if you change font size or margins, the stats for the page read since then were badly accounted, until a change of book or restart... I noticed that in Book map, strange nobody else did over the last 2.5 weeks.
2 years ago
weijiuqiao 8500fdd519
Cloud-based sync for 2 plugins: reading statistics and vocabulary builder (#9709)
This commit adds cross-device sync ability for two plugins: reading statistics and vocabulary builder. It relies on user setting up a Cloud server (DropBox and WebDAV but not FTP though) and designating a path. Behind the curtains sqlite databases are being passed around and updated.

UI-wise, for the statistics plugin, two new menu items Synchronize now and Cloud sync to set it up (might not be the best wording) are added. As for vocabulary builder, a similar Cloud sync button is added to the menu and a shortcut icon button to Synchronize now is pinned at the bottom corner.

CloudStorage new features: WebDAV creating folders and uploading files. And a new widget-like sync server chooser. In the end I decided not to add automatic sync, as the SQL commands part seem a bit much.
2 years ago
hius07 4f3000e882
ReaderHighlight: fix ending fragment check (#9769) 2 years ago
hius07 c3ed51aded
ReaderHighlight: set default long-press action with a gesture (#9723) 2 years ago
NiLuJe 925fd647dc InputContainer/FocusManager: Simplify key_events clearing on unplug
Thanks to @poire-z for the idea, it's indeed much nicer this way ;).
2 years ago
NiLuJe 09498d4bbb ReaderUI: Refresh key_events handlers on keyboard hotplug 2 years ago
NiLuJe e0bfebb0b5 FileManager: Refresh key_events handlers on keyboard hotplug 2 years ago
NiLuJe 8cba303b96 ReaderPanning: Don't crash in the key event handler.
I'm unclear on where this is supposed to do anything, though.
But at least it no longer crashes, so, yay?
2 years ago
NiLuJe 25dce4d1b5 WebDAV: Fix a warning with the latest LuaCheck version
(error-prone negation)
2 years ago
NiLuJe 1e24a1c7a3 ReaderUI: Properly neuter gesture handling from InputContainer modules
None[1] of them actually rely on their own onGesture handler, they
all register their own stuff to ReaderUI's.
Hotfix #9710 revealed that the way this was handled didn't exactly
work as expected ;).

The only thing that consumes ges_events is InputContainer's onGesture
method. All these modules *extend* InputContainer, but none of them
*implement* a custom onGesture, so self.onGesture = nil was just a NOP,
they always access InputContainer's method via inheritance.
If we actively want to neuter it, we *have* to implement it in that
module (with a NOP).

[1] The exception being ReaderZooming, but that only when in flip mode.
2 years ago
yparitcher 4d8e2f0ea1 ges_events must be a table
regression in #9691 b523c2e8b9
2 years ago
NiLuJe b523c2e8b9 InputContainer: Fall cleanup ;).
Get rid of the doc & seqtext fields, as they are not actually used (nor
are they particularly useful, the event handler's name should be pretty
self-explanatory).

Also, tweak the key_events documentation to highlight the quirks of the
API, especially as far as array nesting is involved...

Random drive-by cleanup of the declarations of key_events & ges_events
to re-use the existing instance object (now that we know they're sane
;p) for tables with a single member (less GC pressure).
2 years ago
hius07 a8ff3a6571 readerzoomin: add zoom mode translation, simplify zoom mode validation 2 years ago
hius07 0919c4ef17 readerkoptlistener: simplify zoom mode validation 2 years ago
weijiuqiao e8cd2ba498
WebDAV: fix bugs when start folder starts with "/" (#9688) 2 years ago
zwim d7c63edca6
Random optimizations (#9657) 2 years ago
poire-z 48eb02318d
Dispatcher: avoid multiple cre rerenderings when many settings changed (#9651)
When a gesture/profile was updating multiple cre settings,
each setting handler would emit UpdatePos which each would
force a re-rendering.
When this might be happening, postpone the rerendering
until all are set.
Needs some bit of refactoring to the events at play:
introduce "DocumentRerendered" event, and use it where
we used "UpdatePos" or "UpdateToc" to mean exactly that.
2 years ago
hius07 d1abbbfdd8
Document settings submenu: add Save as default (#9643) 2 years ago
weijiuqiao edf7cc9a61
Vocabulary builder: support extracting context from pdfs (#9622)
Move getSelectedWordContext(), now document specific,
from ReaderHighlight into each document module.
2 years ago
NiLuJe da65ac8b02
Cleanup various varargs shenanigans (#9624)
* Iterate over varargs directly via select if possible
* Use table.pack otherwise (https://github.com/koreader/koreader-base/pull/1535).
* This allows us to simplify a few Logger calls, as logger now handles nil values.
2 years ago
hius07 a728e3b5fa
ReaderStatus: save status summary (#9619) 2 years ago
zwim 4969811c08
Optimization: Use constant folding for divisions not a power of two (#9609) 2 years ago
NiLuJe a62f076e56 DictQuickLookup: The window_list array needs to be a static class member
Also, make sure references are actually dropped,
no matter how the widget is closed, by relying on onCloseWidget ;).

Enable the "long-press-on-close" trick on the actual Close button,
too, instead of only on the title bar's cross.

Fix: https://github.com/koreader/koreader/pull/9586#issuecomment-1272332275
2 years ago
NiLuJe c0dffe2012
Kobo: Add a debug option to turn the charging LED on PM entry failure (#9601)
This should be fairly unintrusive, but still noticeable enough without having to watch the battery gauge like a hawk, or resort to actual monitoring via kernel logs and/or usb meter and/or multimeter...
2 years ago
NiLuJe eef938996f MultiDialog: Fix an extremely nasty API misuse
Stuff was poking at the class object, not the instance's :s.

Fix #9599
2 years ago
NiLuJe fadee1f5dc
Clarify our OOP semantics across the codebase (#9586)
Basically:

* Use `extend` for class definitions
* Use `new` for object instantiations

That includes some minor code cleanups along the way:

* Updated `Widget`'s docs to make the semantics clearer.
* Removed `should_restrict_JIT` (it's been dead code since https://github.com/koreader/android-luajit-launcher/pull/283)
* Minor refactoring of LuaSettings/LuaData/LuaDefaults/DocSettings to behave (mostly, they are instantiated via `open` instead of `new`) like everything else and handle inheritance properly (i.e., DocSettings is now a proper LuaSettings subclass).
* Default to `WidgetContainer` instead of `InputContainer` for stuff that doesn't actually setup key/gesture events.
* Ditto for explicit `*Listener` only classes, make sure they're based on `EventListener` instead of something uselessly fancier.
* Unless absolutely necessary, do not store references in class objects, ever; only values. Instead, always store references in instances, to avoid both sneaky inheritance issues, and sneaky GC pinning of stale references.
  * ReaderUI: Fix one such issue with its `active_widgets` array, with critical implications, as it essentially pinned *all* of ReaderUI's modules, including their reference to the `Document` instance (i.e., that was a big-ass leak).
* Terminal: Make sure the shell is killed on plugin teardown.
* InputText: Fix Home/End/Del physical keys to behave sensibly.
* InputContainer/WidgetContainer: If necessary, compute self.dimen at paintTo time (previously, only InputContainers did, which might have had something to do with random widgets unconcerned about input using it as a baseclass instead of WidgetContainer...).
* OverlapGroup: Compute self.dimen at *init* time, because for some reason it needs to do that, but do it directly in OverlapGroup instead of going through a weird WidgetContainer method that it was the sole user of.
* ReaderCropping: Under no circumstances should a Document instance member (here, self.bbox) risk being `nil`ed!
* Kobo: Minor code cleanups.
2 years ago
hius07 1ea7e16f3e
Cloud storage: add Dropbox short-lived tokens (#9496) 2 years ago
hius07 c5505879c3
ConfigDialog: fix bug in DoubleSpinWidget default values (#9580) 2 years ago
hius07 b0eb0ce0e1
FileManager: add Select button to the file long-press menu (#9571) 2 years ago
poire-z 3bd27c3a76 ReaderFont: add "Font-family fonts" submenu
Allow associating a font to each of the generic
font-family names.

Bump crengine:
- CSS parsing: accept (and ignore) namesspaces
- isImage(): more checks for <object> as it can have inner content
- getFontFileNameAndFaceIndex(): returns if font has math support
- getFontFileNameAndFaceIndex(): returns if font has emojis
- CSS/Fonts: add support for font-family to font name mapping
2 years ago
poire-z 137b39416f ReaderLink:showAsFootnotePopup(): remove some logger.info() 2 years ago
NiLuJe 9bf19d1bb3
Assorted bag'o tweaks & fixes (#9569)
* UIManager: Support more specialized update modes for corner-cases:
  * A2, which we'll use for the VirtualKeyboards keys (they'd... inadvertently switched to UI with the highlight refactor).
  * NO_MERGE variants of ui & partial (for sunxi). Use `[ui]` in ReaderHighlight's popup, because of a Sage kernel bug that could otherwise make it translucent, sometimes completely so (*sigh*).
* UIManager: Assorted code cleanups & simplifications.
* Logger & dbg: Unify logging style, and code cleanups.
* SDL: Unbreak suspend/resume outside of the emulator (fix #9567).
* NetworkMgr: Cache the network status, and allow it to be queried. (Used by AutoSuspend to avoid repeatedly poking the system when computing the standby schedule delay).
* OneTimeMigration: Don't forget about `NETWORK_PROXY` & `STARDICT_DATA_DIR` when migrating `defaults.persistent.lua` (fix #9573)
* WakeupMgr: Workaround an apparent limitation of the RTC found on i.MX5 Kobo devices, where setting a wakealarm further than UINT16_MAX seconds in the future would apparently overflow and wraparound... (fix #8039, many thanks to @yfede for the extensive deep-dive and for actually accurately pinpointing the issue!).
* Kobo: Handle standby transitions at full CPU clock speeds, in order to limit the latency hit.
* UIManager: Properly quit on reboot & exit. This ensures our exit code is preserved, as we exit on our own terms (instead of being killed by the init system). This is important on platforms where exit codes are semantically meaningful (e.g., Kobo).
* UIManager: Speaking of reboot & exit, make sure the Screensaver shows in all circumstances (e.g., autoshutdown, re: #9542)), and that there aren't any extraneous refreshes triggered. (Additionally, fix a minor regression since #9448 about tracking this very transient state on Kobo & Cervantes).
* Kindle: ID the upcoming Scribe.
* Bump base (https://github.com/koreader/koreader-base/pull/1524)
2 years ago
NiLuJe 4d48b6e2fe
Misc: Use the ^ operator instead of math.pow (#9550)
And some minor code simplifications, thanks to @zwim ;).
2 years ago
NiLuJe 62059f8d68
Misc: Get rid of the legacy defaults.lua globals (#9546)
* This removes support for the following deprecated constants: `DTAP_ZONE_FLIPPING`, `DTAP_ZONE_BOOKMARK`, `DCREREADER_CONFIG_DEFAULT_FONT_GAMMA`
* The "Advanced settings" panel now highlights modified values in bold (think about:config in Firefox ;)).
* LuaData: Isolate global table lookup shenanigans, and fix a few issues in unused-in-prod codepaths.
* CodeStyle: Require module locals for Lua/C modules, too.
* ScreenSaver: Actually garbage collect our widget on close (ScreenSaver itself is not an instantiated object).
* DateTimeWidget: Code cleanups to ensure child widgets can be GC'ed.
2 years ago
NiLuJe b0d8919399
ImageViewer: Followup to #9529 (#9544)
* ImageViewer: Minor code cleanups
* GestureDetector: Fix the `distance` field of `two_finger_pan` & `two_finger_swipe` gestures so that it's no longer the double of the actual distance traveled. Get rid of existing workarounds throughout the codebase that had to deal with this quirk.
2 years ago
poire-z a8c81a90c3
ReaderDict: fix use of dicts with ifo with DOS line endings (#9536)
Fixed in upstream sdcv, but we need to also do it in
our parsing of .ifo and picking out dict name.
Also includes minor bump of base/sdcv.
2 years ago
hius07 45e4f38c41
CloudStorage: remove cloudmgr (#9532)
Use downloadmgr instead.
2 years ago
NiLuJe 83a2965d6b
Misc: Unify error logging on network errors (#9523)
Making sure we get the relevant information in the logs, and that the UI feedback (if any), is meaningful and readable.
2 years ago
NiLuJe 2fe2515ace
FontList: Always use the binary cache format (#9519)
Since I never actually needed to look into that data ever until today, let's just get rid of the weird debug-specific behavior.

Instead, just add a dedicated "Developer options" entry that will dump it on demand (and it'll be sorted to boot, which makes it 500% more usable).

Plus, since yesterday's change, the cache format switch between debug or not miiiight actually be crashy, so re-trigger the migration ;p.

* Includes a couple of noteworthy base bumps:

https://github.com/koreader/koreader-base/pull/1516 (update to sdcv 0.5.4 + fixes pending upstream)
https://github.com/koreader/koreader-base/pull/1517 (fix ffiUtil.orderedPairs with keys of mixed types)
2 years ago
NiLuJe 13e8213e0a
A random assortment of fixes (#9513)
* Android: Make sure sdcv can find the STL
* DocCache: Be less greedy when serializing to disk, and only do that for the *current* document ;).
* CanvasContext: Explicitly document API quirks.
* Fontlist: Switch the on-disk Persist format to zstd (it's ever so slightly faster).
* Bump base for https://github.com/koreader/koreader-base/pull/1515 (fix #9506)
2 years ago
hius07 56388aa491
TextViewer: add Find (#9507) 2 years ago
poire-z 76a7d83079 CRE/ImageViewer: get scaled blitbuffer when long-press on SVG
Get a Lua userdata wrapping a crengine LVSvgImageSource object
when long-press on a SVG image, and have crengine/LunaSVG render
it smoothly scaled to the requested size by ImageViewer.
2 years ago
poire-z 087f605fd9 Allow F5 key to reload document 2 years ago
zwim d972b7fcfa
[core] Remove a bunch of superflous semicolons (#9449) 2 years ago
NiLuJe 8e1bb9bafc
GestureDetector: Full refactor for almost-sane(TM) MT gesture handling (#9463)
Should hopefully make two-contact gestures *much* more reliable, among other things.

See the PR for all the details ;).
2 years ago
hius07 f67469bab4
Highlight: add note marker (#9395) 2 years ago
hius07 460d42293a
PathChooser: add creating folder (#9354) 2 years ago
poire-z 5e2ed5ae2a
bump crengine: monospace and fallback fonts tweaks (#9343)
Includes:
- Text: fix possible overflow with "white-space: pre"
- Fonts: getFontFileNameAndFaceIndex(): return family type
- Fonts: account for _bias in Font hash
- epub.css, fb2.css: remove hardcoded monospace font names
- Fonts: allow scaling monospace fonts
- Fonts: allow adjusting fallback font sizes to x-height
- HTML parser: trust xml encoding before html charset

In our list of fonts, show a "M" indicator alongside
monospace fonts, and allow long-press to select the one
to be use for "font-family: monospace".
Add 2 options to Font settings, to scale monospace fonts
by a percentage, and to adjust fallback fonts to their
x-height.
2 years ago
zwim 22fe3933c3
[fix, SDL] Time: fix crash when scrolling in continuous mode (#9314)
Introduced with #8999.

Fixes #9311.
2 years ago
poire-z 10a6ffd927 Style tweaks: fix typos and global tweak conflict
Minor logic fix: allow global_conflicts_with to be not only
a function, but also a string or a table, as documented.
2 years ago
poire-z 6fb266cb71 Style tweaks: handle conflicting/redundant tweaks
Disable redundant or incompatible tweaks when enabling some.
This makes the menu more dynamic to show what's impacted,
save some re-renderings, and may avoid the user trying
combinations that would have no effect.
2 years ago
poire-z e4eb1c61d1 Footnote popup: allow using book font as popup font
Also move footnote popup settings into a submenu.
2 years ago
poire-z 38bd2b4c46 ReaderRolling: fix marker sometimes not removed
Noticed when jump to a footnote and quickly going back.
2 years ago
Martín Fernández b7a27a3db3
Fullscreen refactor (#9237)
Commonize fullscreen code across different devices.

Add fullscreen toggle on SDL desktop targets. 
Expose the toggle to the dispatcher and map it to F11.

Hide touchmenu when resizing.
2 years ago
weijiuqiao cafbf36bb2
Vocabulary builder: store word context, other tweaks and fixes (#9195)
Add a copy button and save word context (off by default), shown
via the three-dot menu of word entries.
Also some db refactoring and minor UI improvements:
- a dedicated book title table in order to shrink db size by storing
  references to title names instead of repeated actual strings,
- alignment of different forms of the "more" button and possible
 clipped words in translations.
- fix plugin name so it can be disabled
2 years ago
zwim e8597c2e0c
Footer: update on network disconnect (#9185) 2 years ago
poire-z b9724f1e93 Text highlighting: extend to include punctuations
When selected text seems to be a "sentence segment"
(that is, when there are punctuations around start
AND end), extend the selection to include the relevant
punctuation.
Do this only when saving highlights and for translation
(but not when dict or wikipedia lookups, or search).
2 years ago
poire-z 141fa98a32 bump crengine: text selection tweaks and helpers
Includes:
- lvtext: fix m_kerning_mode type
- XML: let 'gb2312' (Chinese) encoding be known
- Add ldomXPointer::getChar()
- LVDocView::getNodeByPoint(): tweak for text selection
- Fonts: allow fetching the list of embedded fonts
cre.cpp:
- getTextFromPositions(): use getNodeByPoint(forTextSelection=true)
  to allow panning in margins and get the nearest text instead
  of nothing.
- add extendXPointersToSentenceSegment() to allow extending some
  xpointer range to include punctuations at start or end (with
  for now a quite rudimentory implementation).
- add getEmbeddedFontList() to allow fetching the list of
  embedded fonts in the current EPUB book.
2 years ago
NiLuJe dcb11c2542
Make luacheck >= 0.26 happy (#9174)
Re: https://github.com/koreader/koreader-base/pull/1487
2 years ago
Martín Fdez d644b1a851 android: update doShareText signature 2 years ago
NiLuJe 73b2b38954
AutoSuspend: Make sure we send a LeaveStandby event ASAP (#9173)
Even in corner cases where we're woken up without user input (e.g., rtc alarm).

(Followup to #9124)
2 years ago
poire-z c825d50c8f CRE: add "CJK width scaling" option
The setting is handled like all other bottom menu options
but, as it's really not useful and its target audience is
very limited, make it not shown in the bottom menu, but
available via another button in the (also quite not useful)
Word Expansion fine tuning widget.
2 years ago
poire-z f29ee8475e Style tweaks: add "Tailor widths and text-indent for CJK"
Also add a timeout to the "Changed language for
typography rules" InfoMessages.
2 years ago
weijiuqiao e1b137339c
[feat, plugin] Vocabulary builder (#9132)
Made the old dictionary lookup history into a flashcard-ish vocabulary builder.
2 years ago
zwim 5a033f1221
DateTimeWidget: don't make ":" and "/" translatable (#9145)
* And the ellipsis
2 years ago
NiLuJe ae5b2d68ca
AutoSuspend: Don't send LeaveStandby events from a zombie plugin instance (#9124)
Long story short: the LeaveStandby event is sent via `tickAfterNext`, so if we tear down the plugin right after calling it (in this case, that means that the very input event that wakes the device up from suspend is one that kills ReaderUI or FileManager), what's in UIManager's task queue isn't the actual function, but the anonymous nextTick wrapper constructed by `tickAfterNext` (c.f., 
https://github.com/koreader/koreader/issues/9112#issuecomment-1133999385).

Tweak `UIManager:tickAfterNext` to return a reference to said wrapper, so that we can store it and unschedule that one, too, in `AutoSuspend:onCloseWidget`.

Fix #9112 (many thanks to [@boredhominid](https://github.com/boredhominid) for his help in finding a repro for this ;)).
Re: #8638, as the extra debugging facilities (i.e., ebb81b9845) added during testing might help pinpoint the root issue for that one, too.

Also includes a minor simplification to `UIManager:_checkTasks`, and various other task queue related codepaths (e.g., `WakeupMgr`) ;).
2 years ago
hius07 e336983fd2
Cloudstorage WebDAV: more fix slash in server address (#9128)
Honor server addresses with or without trailing slash.
Regression since #9061. Closes #9125.
2 years ago
zwim d5d5867d4e
DoubleSpinWidget, SpinWidget: add units, make usage more consistent (#9046) 2 years ago
yparitcher 8f316b1e8c
Merge `discardEvents` & `inhibitInput` (#9065)
Rename `discardEvents` to `inhibitInputUntil`
only discard Input events
2 years ago
yparitcher a97dbb05ed
Page turn animations: add to dispatcher (#9123)
xref: https://www.mobileread.com/forums/showthread.php?p=4224443&postcount=1119
2 years ago
hius07 f2c3fd54a1
filemanagershortcuts: fix adding the first shortcut (#9107)
Closes #9105.
2 years ago
zwim 84dd58f9df
Power-savings in readerdevicestatus: Schedule on full minute and fix multiple scheduling. (#9032) 2 years ago
NiLuJe 60b043ebe9
ReaderFooter: Refresh the footer on frontlight state changes issued by the frontlight widget (#9084)
c.f, https://www.mobileread.com/forums/showpost.php?p=4220159&postcount=7
2 years ago
poire-z f286787ff5 ReaderPageMap: fix page labels in 2-columns mode
Page labels on the right page could have some bad y position
(they were never above the last page label on the left page)
2 years ago
Philip Chan d6ff983243
Show TitleBar left and right buttons on non-touch devices (#9041)
Titlebar button navigation in menu, including ListMenu and MosaicMenu in FileManager, History, Favourites and Shortcuts.
Hide show password checkbox in non-touch devices
2 years ago
zwim 9b9cfe29a4
[feat] Replace TimeVal (RIP) with time, fixed point time seconds (#8999) 2 years ago
yparitcher 54ead5fc88 Page turn animations
Kindle PW5 (MTK) with hardware support
Currently only in Crengine
2 years ago
hius07 9de0df81da
Cloudstorage WebDAV: fix leading slash for root folder (#9061) 2 years ago
NiLuJe 86c35ad066
A host of low power states related tweaks (#9036)
* Disable all non power management related input during suspend. (This prevents wonky touch events from being tripped when closing a sleep cover on an already-in-suspend device, among other things).
* Kobo: Use our WakeupMgr instance, not the class.
* WakupMgr: split `removeTask` in two: 
* `removeTask`, which *only* takes a queue index as input, and only removes a single task. Greatly simplifies the function (i.e., it's just a `table.remove`).
* `removeTasks`, which takes an epoch or a cb ref, and removes *every* task that matches.
* Both of these will also *always* re-schedule the next task (if any) on exit, since we can have multiple WakeupMgr tasks queued, but we can only have a single RTC wake alarm set ;).
* `wakeupAction` now takes a `proximity` argument, which it passes on to its `validateWakeupAlarmByProximity` call, allowing call sites to avoir having to duplicate that call themselves when they want to use a custom proximity window.
* `wakeupAction` now re-schedules the next task (if any) on exit.
* Simplify `Kobo:checkUnexpectedWakeup`, by removing the duplicate `WakerupMgr:validateWakeupAlarmByProximity` call, now that we can pass a proximity window to `WakeuoMgr:wakeupAction`.
* The various network activity timeouts are now halved when autostandby is enabled.
* Autostandby: get rid of the dummy deadline_guard task, as it's no longer necessary since #9009.
* UIManager: The previous change allows us to simplify `getNextTaskTimes` into a simpler `getNextTaskTime` variant, getting rid of a table & a loop.
* ReaderFooter & ReaderHeader: Make sure we only perform a single refresh when exiting standby.
* Kobo: Rewrite sysfs writes to use ANSI C via FFI instead of stdio via Lua, as it obscured some common error cases (e.g., EBUSY on /sys/power/state).
* Kobo: Simplify `suspend`, now that we have sane error handling in sysfs writes.
* Kobo.powerd: Change `isCharging` & `isAuxCharging` behavior to match the behavior of the NTX ioctl (i.e., Charging == Plugged-in). This has the added benefit of making the AutoSuspend checks behave sensibly in the "fully-charged but still plugged in" scenario (because being plugged in is enough to break PM on `!canPowerSaveWhileCharging` devices).
* AutoSuspend: Disable our `AllowStandby` handler when auto standby is disabled, so as to not interfere with other modules using `UIManager:allowStandby` (fix #9038).
* PowerD: Allow platforms to implement `isCharged`, indicating that the battery is full while still plugged in to a power source (battery icon becomes a power plug icon).
* Kobo.powerd: Implement `isCharged`, and kill charging LEDs once battery is full.
* Kindle.powerd: Implement `isCharged` on post-Wario devices. (`isCharging` is still true in that state, as it ought to).
2 years ago
hius07 74d0d22a15 readerhighlight: keep highlight for default action 'Translate' 2 years ago
zwim 71f6bd8ba5
ReaderFooter: Make setDirty happy (#9005)
Don't pass a non-window-level widget.
Painting is handled explicitly via widgetRepaint, so passing a widget to setDirty was just plain wrong anyway ;).
2 years ago
Philip Chan 77accf6546
Non-touch: highlight movement improvement and enable page crop (#8947) 2 years ago
poire-z 814f42cce0 UIManager:discardEvents(): use accurate "now"
Instead of UIManager possibly staled _now, which could have
no effect after a long ReaderRolling re-rendering.
Also lower the delay after such ReaderRolling re-rendering,
so we can change settings quicker when comparing renderings.
2 years ago
zwim eaa6e77398
Status bar: fix battery display (threshold with aux battery) (#8959) 2 years ago
zwim d820dd84d6
Readerview: fix checkAutoSaveSettings() with enabled standby (#8961) 2 years ago
zwim 158f4be724
Autosuspend: add autostandby (#8815)
Allows the device to go into standby (if available in `/sys/power/state`) to save power.
Adds an entry in the device menu to tune the timeout for standby.
(Shows total standby- and suspend-time in system statistics.)
2 years ago
lennonhill eb34fbb818
PDF: align page view with target when following internal link (#8907) 2 years ago
zwim 8f3e9a5a61
UserHyph: Scrub and sort user dict (#8863) 2 years ago
Philip Chan 9f755dd202
[NT] Hide "Start content selection" and "Select on text" menu item on touch devices (#8914)
only center hold_pos and highlight indicator position with crengine document which has stable screen position
2 years ago
Frans de Jonge 0fe3a9d19c
[i18n] Add context to book status filter options (#8906)
Fixes #8903.
2 years ago
NiLuJe 217a73f3c0
Initial Kindle PW5 support (#8856)
* Rejig frontlight warmth API to more closely match the existing API, and, hopefully, clarify some of its quirks, and reduce boilerplate and duplicate code in platform implementations.
* Tweak Kindle:setDateTime to prefer using the platform's custom script, as in interacts better with the stock UI. And make the fallbacks handle old busybox versions better.
* Add Kindle PW5 support ;).
* Add warmth support to the Kindle platform.
* Random TextBoxWidget cleanups: make sure we immediately free destroyed instances.
* FrontLightWidget: Refactor to make it slightly less obnoxious to grok and update; i.e., separate layout from update, and properly separate brightness from warmth handling. Move to simpler widgets instead of reinventing the wheel.
* TextBoxWidgets: Implement `setText` to match TextWidget's API, as some callers may be using the two interchangeably (i.e., Button).
* NaturalLightWidget: Make sure we pass a string to InputText
* InputText: Add debug guards to catch bad callers not passing strings ;).
2 years ago
Philip Chan 36fc981b7c
Non-touch: fix crash when expanding ToC (#8892) 2 years ago
Philip Chan 4f849c23ab
Non-touch: highlight support (#8877)
readerhighlight: non-touch support
focusmanager: fix same type container share same selected field
radiobuttonwidget: non touch support
sortwidget: non touch support
openwithdialog: fix layout contains textinput, checkboxes added to layout twice
2 years ago
hius07 7b4d6fd205
History: filter by book status (#8820) 2 years ago
hius07 d7549dbd87
File searcher: fix show folders, include subfolders checkbutton (#8807) 2 years ago
poire-z 831488b9e9
Bidi: keep invert() generic, handle settings in ReaderView (#8876)
Follow up to 42dd5aad. Handle settings only in
ReaderView:shouldInvertBiDiLayoutMirroring().
2 years ago
yparitcher 23d12c3f04
TOC: use bidi_wrap_func (#8879)
Fixes RTL issue noticed at https://github.com/koreader/koreader/pull/8876#issue-1161280868
2 years ago
Philip Chan 107156c0a8
[feat] Non-touch improvements (#8859)
FocusManager: fix round x use y layout
FocusManager: add tab and shift tab focus navigation support
FocusManager: handle Press key by default
FocusManager: make sure selected in instance level
FocusManager: add hold event support
FocusManager: Half move instead of edge move
FocusManager: add keymap override support
FocusManager: refocusWidget will delegate to parent FocusManager
Focusmanager: refocusWidget can execute on next tick
inputtext: can move out of focus on back
inputtext: fix cannot exit for non-touch device
inputtext: fix cannot input text with kindle dx physical keyboard
fontlightwidget: add non-touch support
datetimewidget: add non-touch support
datetimewidget: fix set date failed in kindle DX, fix datetimewidget month range to 1~23 by default
datetimewidget: make hour max value to 23
multiinputdialog: add non-touch support
checkbox: focusable and focus style
virtualkeyboard: no need to press two back to unfocus inputtext
virtualkeyboard: collect FocusManager event key names to let VirtualKeyboard disable them
openwithdialog: add non-touch support
inputdialog: can close via back button
enable all InputDialog and MultiInputDialog can be close by back
keyboardlayoutdialog: non-touch support
readertoc: non touch device can expand/collapse in toc
bookstatuswidget: non touch support
keyvaluepage: non-touch support
calendarview: non-touch support
2 years ago
Frans de Jonge d691964c0b
ReaderPaging: allow for page diff greater than 1 in onScrollPageRel (#8836)
Cf. <https://www.mobileread.com/forums/showthread.php?p=4200567>.
2 years ago
yparitcher 7172adc6ec Toc: expanded_nodes: loopless O(1) instead of O(n) 2 years ago
yparitcher d8087b37e3 Toc: collapse child when parent is collapsed 2 years ago
yparitcher 73bb76f92d menu: separate indentation from text 2 years ago
yparitcher 60f68023d8 BD invert: enable for TOC BookMap & PageBrowser 2 years ago
yparitcher 62c6c757cc _mirroredUI do not set at require time 2 years ago
hius07 8bfd7ca340 warning on file size over 400000 b 2 years ago
hius07 fbdb021268 Update filemanager.lua 2 years ago
hius07 56b277f72e filemanager: free home button, text viewer 2 years ago
hius07 8bb08b503a
Cloud storage: enhance download dialog, fix Dropbox uploading (#8809)
(1) ButtonDialogTitle: new method setTitle()

(2) OPDSbrowser
-use setTitle() instead of open/close ButtonDialogTitle (no visual changes to the download dialog)
-reduce logger.info output to avoid flooding crash.log

(3) CloudStorage
-enhance download dialog (similar to OPDS), much optimized code of downloadFile
-fix a bug: cannot create new folder or upload files to the root of the Dropbox storage
2 years ago
hius07 4ccdbc90a5
Doc settings reset: fix default block_rendering_mode (#8792) 2 years ago
NiLuJe 35776f1f87 "Simplify" HW/SW dithering checks
Make it a real Document property, updated at init & toggle time.

Also, simplify a bunch of redundant nested lookups in ReaderView
(self.ui.view is self, self.ui.document is self.document).
2 years ago
NiLuJe 3122bcd9bc KOptOptions: Allow toggling SW dithering
Fix #8748
2 years ago
hius07 a9a75f503f FilemanagerShortcuts: call from PathChooser 2 years ago
NiLuJe 0408816a54 ReaderFooter: Take the PowerCover into account in the battery level
widget

Since we only use a single icon, we have to take a few shortcuts:

* The icon itself is computed based on the average of both batteries.
* The actual value is the sum of both batteries.
* Much like everywhere else, charging means the *aux* battery charging
  (i.e., connected to a power source).

Re #8741, which does the same for ReaderHeader.
2 years ago
zwim 43f14b313f
AltStatusBar: take the PowerCover into account in the battery level (#8741)
Don't show [+] in top status line when device is charging
from a power cover, but the sum of both battery levels.
2 years ago
hius07 c1c89dd611
TouchMenu: use radio buttons for single choice menu items (#8757) 2 years ago
poire-z d39f4ea35e CRE: fix switching to scroll mode from 2-pages mode 2 years ago
hius07 1c863f76aa
Bookmarks: start Add note with empty text, add some buttons (#8738)
- New button Go to bookmark in Bookmark details dialog.
- New button Latest bookmark in the popup menu.
- Empty input box for new note, new button Paste to
  paste highlighted text (auto-text).
- Allow duplicated bookmarks to avoid orphaned highlights.
- TextBoxWidget: fix enabled up-arrow on empty box in InputDialog.
2 years ago
hius07 b7a2a27590
Highlights: add strikeout style, fix pdf highlights (#8725)
- Add new strikeout highlight style.
- Fix highlight style in pdf documents (save_document enabled)
not updated when KOReader highlight style changed.
- Fix ugly combination of mupdf and KOReader highlights
2 years ago
Philip Chan 3af268dd7a
Non-Touch: improve bottom menu usability (#8712)
- FocusManager: allow managing sub widgets by merging their
  "layout" in the main one; make "press" support simpler by
  handling it as a fake tap event at the center of the
  focused widget.
- Setup gestures on non-touch devices for new focus manager.
- ToggleSwitch: use child layout.
- ButtonProgressWidget: use child layout.
- SpinWidget and DoubleSpinWidget: add keyboard navigation.
2 years ago
hius07 1ad7b7151a FilemanagerShortcuts: add Plus button 2 years ago
poire-z 16e3b2f0ac Allow Backspace to work as back button 2 years ago
Frans de Jonge d7c00c586f
[lang] Add missing plurals to Dropbox download messages (#8705)
Fixes #6465.
2 years ago
hius07 f83ee0d739
Bookmarks: do not duplicate datetime request on creation (#8699) 2 years ago
hius07 1c2b01a51e
Bookmarks: fix compare invalid xpointers (#8690) 2 years ago
poire-z 0216493c43 Wikipedia: rework wiki languages internal handling
Fix various issues with stacked Wikipedia lookup results,
and follow up lookups when invoked from Wikipedia lookup
history (where going to a search for language LL would
not use language LL when hitting "Full wikipedia").
2 years ago
yparitcher 87dbb9885e FM select mode: let the icon survive through reinit not only rotation 2 years ago
hius07 2a244278e3
Translator: copy translation to clipboard or save to note (#8669) 2 years ago
hius07 958077364a
Filemanager: insert TitleBar (#8648) 2 years ago
hius07 5c39c19a73
[chore] Remove leftover: cface (#8659)
Ancient menu widget had it.

Not used anymore.
2 years ago
hius07 1bfb49c6a5
PathChooser: add left Home button (#8646) 2 years ago
poire-z 99171b5267
ReaderBookmark: fix issue with unit tests (#8645)
Revert some bits from 55532b13, as the otherwise uneeded
CenterContainer is used by unit tests.
2 years ago
hius07 55532b1397
Menu widget: insert TitileBar (#8639) 2 years ago
poire-z 48ca7e820c DictQuickLookup: update to TitleBar widget
Also tweak ReaderHighlight:onHoldRelease() to avoid
doing its stuff when onHold() is clearing highlight
(previous CheckButton was closing/clearing on hold
release, new TitleBar close button does that on hold).
2 years ago
hius07 00b08d7b54
Bookmarks: fix sort within one page (#8616)
Accurate sorting of bookmarks located in one page depending on their positions in text.
2 years ago
poire-z bc16b32395 Add Book map and Page browser features
- Book map: shows a map of content, including TOC,
  boomarks, read pages, non-linear flows...
- Page browser: shows thumbnails of pages.

- ReaderThumbnail: new Reader module that provides
  a service for generating thumbnails of book pages.
  It makes available these 2 new fullscreen widgets.
- ReaderBookmark, ReaderLink, Statistics: add methods
  to return new views of bookmarks, previous locations
  and read pages, that are needed by BookMapWidget.
- ReaderToc: compute TOC max_depth.
- ReaderBookmark, ReaderHighlight: send events on
  bookmark add/update/remove so thumbnails of the
  pages impacted can be trashed.
2 years ago
hius07 eae07af157
Dropbox: upload file, create folder (#8610) 2 years ago
hius07 04763cdb18
ReaderHighlight leftover fix (#8609) 2 years ago
hius07 3450290af9
Bookmarks/Highlights: left button, show note in book (#8600)
Bookmark list: added title bar left button for multiple actions
Highlighted text: show note on tap
2 years ago
poire-z b35c28e8b4
[Non-Touch] Don't add touch-related menu items (#8608)
They were ending up orphaned as "New:" in the top menu first tab.
2 years ago
hius07 dd07112de7
Filemanager select mode: add folder buttons (#8595)
"New folder" and "Folder shortcuts" buttons
2 years ago
hius07 b8d6455c3f
[UX] CloudStorage redesign (#8569)
Cloud storage redesign, including:
(1) show server type in the list of storages
(2) add new cloud storage with a "plus" button (requires #8564)
(3) when browsing in a storage, the "plus" button is changed to the "home" button, to return to the CloudStorage home screen.
2 years ago
hius07 d0dd1ee888
[fix] readerhighlight: "View HTML" was always disabled (#8573) 2 years ago
hius07 f83eee02dd
[fix] filechooser: disable long-press in select mode (#8567) 2 years ago
yparitcher 035be38430 Dispatcher: Set font
Closes: #8531
2 years ago
hius07 1df6ab751b
ButtonDialogTitle: no bold font in the title by default (#8557) 2 years ago
hius07 a703b213f7
File manager: group operations (#8536)
Copy/Move/Delete for group of files.
"Select files" button in the filemanager Plus menu.
2 years ago
hius07 3deac02b71
ReaderHighlight: don't highlight text when long-press disabled (#8541) 2 years ago
poire-z 301eb387e9 ReaderRolling: fix a few re-rendering issues
When switching screen rotation, have the re-rendering
properly done only via :onUpdatePos().
When changing alt status bar font size, also have it
done via :onUpdatePos() instead of the next painting
(this also update any dogear position after the resize).
When in scroll mode (no alt status bar), be sure to
draw crengine progress bar at top (and not below the
not shown alt status bar).
2 years ago
zwim a001a13ab6
ReaderRolling: avoid ANR on Android when (re)rendering. (#8501)
Wrap document opening and re-renderings (which can block
the app for some time) with setIgnoreInput() to avoid ANR
on Android.
Any setting update that could possibly cause a re-rendering
should send the UpdatePos event, to ensure the re-rendering
happens in ReaderRolling:onUpdatePos() where precautions
are taken to avoid ANR.
2 years ago
poire-z cc4009e88f
ReaderDictionary: merge dict & dict_ext results (#8523)
So the presence of a dict_ext and results from it
are transparent to callers.
(This fixes the warning log when dict_ext is there.)
2 years ago
hius07 19271c08c4
Checkbutton widget optimization (#8522)
-checkmark toggling is separated from the callback
-default width added
2 years ago
hius07 785eb5f3ef
Bookmark search (#8504)
From bookmark list, main menu and with a gesture.
2 years ago
Frans de Jonge 91c4aeb2e5
[i18n] Add context to CSS style vs highlight style (#8510)
Cf. <https://github.com/koreader/koreader/pull/8489#issuecomment-985319434>.
2 years ago
hius07 ad09411c3f
DoubleSpinWidget buttons move (#8490)
Move Default and extra buttons above Cancel/OK.
Default values shown in the default button.
Precisions can be set for both values separately.
Minor geometry fix for consistence with SpinWidget.
2 years ago
Dylan Garrett 7495ea29ef
InputDialog: add 'use_available_height' option (#8467)
Use it with bookmark edit, to allow entering longer notes.
2 years ago
Martín Fernández 3427c207b0
android: bump test activity (#8483)
Now users can test light drivers too. See https://github.com/koreader/android-luajit-launcher/pull/339#issuecomment-977822717
2 years ago
hius07 e66b26865b
Highlights backup fix (#8479)
Fixes opening book with old highlights, when (after deleting the last highlight on a page) empty table of highlights for this page was not deleted.
2 years ago
hius07 3a7cba38c2
Customize page turns tap zones (#8475)
Settings for page turn tap zones position (vertical or horizontal) and width.
2 years ago
hius07 1c9e21389d
Backup and restore bookmarks/highlights: fix logic (#8473) 2 years ago
Frans de Jonge dc88fdc66d
[chore] Fix "Compact items" capitalization (#8465)
Follow-up to <https://github.com/koreader/koreader/pull/8424>.
2 years ago
Frans de Jonge 59d09f54f8
[bug] Don't translate empty strings (#8464)
Introduced in https://github.com/koreader/koreader/pull/8419

Unfortunately it's not just useless, but it causes some edge case issue.
2 years ago
hius07 0eeb8bd2b7
Backup and restore bookmarks/highlights when switching engines (#8455)
Bookmark/highlight formats in crengine and mupdf are incompatible.
This backups and restores bookmarks and highlights when opening the
document with an incompatible engine, instead of deleting them.
2 years ago
poire-z 6f2fdd96f8
[chore] Fix a few luacheck errors (#8461) 2 years ago
Aleksa Sarai 3461f8af31
Dictionary: disable fuzzy search when CJK words (#8458)
Fuzzy searching doesn't work with CJK text: with Japanese,
we get large numbers of useless results because sdcv
decides to strip off the wrong part of the word.
It seems unlikely that sdcv correctly handles Korean
or Chinese, so just disable fuzzy searching on all
CJK-containing word lookups.
2 years ago
zwim 8ef426d79f
ReaderMenu/FileManagerMenu: deduplicate Exit menu code (#8459) 2 years ago
zwim 1d92ee19fb
Navigation menu: cleanup, use colons in menu (#8442) 2 years ago
zwim e56aae263a
AltStatusBar: cleanup, use colons in menu (#8436) 2 years ago
Frans de Jonge c11ea4f389
[chore] Fix a few luacheck errors (#8460)
Inadvertently introduced in <https://github.com/koreader/koreader/pull/8432> and <https://github.com/koreader/koreader/pull/8445>.
2 years ago
hius07 217937a5bc
ReaderPaging/Rolling: deduplicate inverse_reading_order code (#8445) 2 years ago
hius07 c7229d90bc
ReaderHighlight: allow for 2-steps text selection (#8432)
Add a "Select" button in the highlight dialog to initiate
text selection; on the next text selection, the text between
these 2 points will be selected.
Limited to a single page with non-CRE documents.
Also move "Search" button at end, so it's the one that
will be wide in case of an odd number of buttons.
2 years ago
hius07 58c4db694e
readersearch: do not show regexp checkbutton in pdf (#8450)
Minor optimization.
2 years ago
zwim 89064487b7
ReaderDictionary: Colons in menus (#8431) 3 years ago
zwim c6e415d646
[Status bar] Consistent menu entries; Add "centered dot" as separator (#8424)
* Consistent menu entries; Add "centered dot" as separator

* Menu entry: Colon
3 years ago
zwim abcd989ec4
[Status bar] Add custom text to footer (#8419)
Allows to add any text to the status bar. Can be a placeholder (empty space) for better positioning of the indicators.
3 years ago
hius07 3dabbd5d73
Typeset menu: adds "Reset document settings to default" (#8412) 3 years ago
hius07 e6d2c1cae6
ReaderGoto: adds Go to % (#8395) 3 years ago
Aleksa Sarai 3fd931bb2f
readerhighlight: ignore cases where no text is selected (#8399)
It's possible for the user to have selected nothing, and trying to
operate on the nil highlight can cause confusion or crashes. This
restores the behaviour before commit 7a0e3d5e68 ("readerhighlight:
remove selected_word and use selected_text everywhere"), which missed
this case.

In addition, add some debug guards to ReaderHighlight methods which
cannot handle selected_text being nil (or at least, shouldn't be called
with selected_text being nil).

Fixes: 7a0e3d5e68 ("readerhighlight: remove selected_word and use selected_text everywhere")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
NiLuJe f94101178f ReaderFooter: Add a compact prefix for frontlight_warmth
Fix #8398

Also, tweak the actual codepoints being used so that they somewhat look
like their icon brothers. May or may not actually be compact :D.
3 years ago
zwim 7887c9b1cf
Fix crash in readerhighlight (#8396) 3 years ago
Aleksa Sarai de7c1e20c5 languagesupport: check that ui.languagesupport is non-nil
Now that FileManager registers its UI modules in the same way as Reader,
this shouldn't be necessary but this protects us against some other app
creating a ReaderDictionary instance without having ui.languagesupport
registered properly.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai cdbedcbcce filemanager: align UI plugin registration with reader
With the addition of the language support module, ReaderDictionary
tries to use modules registered with the UI instance, but the
FileManager doesn't provide key-based registration of its UI modules.

In order to allow the same code to be used by both FileManager and
Reader seamlessly, copy the :registerPlugin() method from Reader and use
it with FileManager. This will ensure any other hidden assumptions about
UI module registration are handled properly.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
hius07 f301ca59b7
Bookmarks: icon by type, combined view, filter, bulk remove (#8347)
- Add an icon to distinguish between page bookmarks, plain
  highlights, and highlights with an added note
- Bookmark details: show both highlighted text and added note
- Bookmark list: allow filtering by type and/or by keyword
- New bookmark selection mode, to allow multiple removals
- New option: show separator line
3 years ago
Aleksa Sarai d0d2d0d1d6
*: luacheck fixes (#8368)
These weren't caught during the Japanese support plugin review.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Frans de Jonge 59710ec67a
[chore] Fix todo and fixme tags (#8365)
Slightly overlooked in #8312.
3 years ago
Aleksa Sarai 7c5243667b reader: implement language-support plugin system
This creates a new plugin system which hooks into a handful of reader
operations in order to allow plugins to add language-specific support
where the default reader falls short. The two hooks added are:

 * During hold-without-pan taps, language plugins can modify the
   selection in order to better match what users expect koreader to
   highlight when selecting a single word.

   The vast majority of CJK language words are more than one character,
   but KOReader treats all CJK characters as a single word by default,
   so adding this hook means that readers no longer need to manually
   select the whole word every time they need to look something.

 * During dictionary lookup, language plugins can propose alternative
   candidate words to look up if the selected word could not be found in
   the dictionary.

   This is pretty necessary for Japanese and Korean, both of which are
   highly agglutinative languages and the fuzzy searching system of
   StarDict is simply not usable because often the inflection of the
   word is so much longer than the dictionary form that sdcv decides to
   chop off the actual word and search for the inflection (which yields
   useless results).

This system is of particular interest for readers of CJK languages
(without this, looking up words using KOReader was fairly painful) but
this system is designed to be minimal and language-agnostic enough that
other languages could make use of it by creating their own plugins if
the default "whole word" highlight and fuzzy-search system doesn't match
their needs.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai dca65a793e readerdictionary: separate out raw sdcv handling from startSdcv
In order to make startSdcv usable for plugins that might need to do
dictionary lookups in order to work, it is necessary to split out the
core of startSdcv into another method which returns the raw data from
sdcv.

In addition, in order to make it possible to amortise the cost of each
lookup (which could be fairly expensive) make it possible to pass
multiple words to rawSdcv at the same time. Sdcv supports passing
multiple words as arguments (which it then looks up in order and returns
a separate JSON array per line for each word) so we just need to tweak
the return style accordingly.

All of the deduplication and dummy results handling remains in startSdcv
because plugins might strongly depend on whether sdcv returned actual
results.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai 7a0e3d5e68 readerhighlight: remove selected_word and use selected_text everywhere
There were two ways of specifing selected text for a highlight depending
on whether it was a "single word" or text selected using hold-and-pan.
In addition to being a bit more complicated than is necessary, with the
addition of the language support plugin system (where the "single word"
selected might be expanded), it makes more sense to simply use the same
logic and table structure for both cases.

The dictionary lookup special case (hold-without-pan triggering a
dictionary lookup by default) still works as before.

In addition, this patch fixes a minor inefficiency during dictionary
quick lookup -- before this patch, the highlight would be re-selected
because the quick lookup window is run concurrently and tries to fetch
ReaderHighlight.selected_text but this is set to nil immediately after
triggering the lookup. This is unnecessary because :clear() will be
called anyway when the quick pop-up closes, and so clearing this can be
left until then.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Frans de Jonge 8e017de898
ReaderSearch: remove stray newline from regex help (#8358)
Noticed due to #8356.
3 years ago
NiLuJe 942ea70235 ProgressWidget: Simplify painting logic.
* Use paintRect and plain colors instead of lightenRect and a weird
  dimming factor.
* Update call sites to the new API
* Handle FP maths properly (i.e., floor coordinates & ceil dimensions at
  the latest possible time).
* Fix border handling in the fill bar (make sure we actually honor it
  when computin the x position, and that we won't overflow into it when
  computing the width).
* Update docs
3 years ago
NiLuJe b996b8282f ReaderRolling: Unbreak CRe spinner on e-Ink
Regression since #8195, but the fact that it sometimes worked before
that was already a fluke ;).

c.f., https://github.com/koreader/koreader/pull/5406#issuecomment-948632160
3 years ago
poire-z 37eb53f6e4
DocSettings/Purge .sdr: reword, don't purge other books (#8348)
Reword "Purge .sdr" to "Reset settings".
When purging, remove only the known document metadata
files, and not those for a document with the same name but
a different suffix.
3 years ago
hius07 2c6943e5d6
FileManager: no notification on successful file operations (#8330) 3 years ago