Commit Graph

1559 Commits (039947886fbc1de89f0236837015b1d817db99f5)

Author SHA1 Message Date
Frans de Jonge 039947886f
Revert "Hyphenation: add custom hyphenation rules (#7746)" (#7785)
This reverts commit f25da5d0d5.
3 years ago
hius07 2df54251a7
ReaderHighlight: close popup menu on 'Copy' (#7776) 3 years ago
zwim f25da5d0d5
Hyphenation: add custom hyphenation rules (#7746)
The hyphenation of a word can be changed from its default
by long pressing for 3 seconds and selecting 'Hyphenate'.
These overrides are stored in a per-language file, i.e:
koreader/settings/user-German.hyph.
3 years ago
yparitcher b30e366ccd
ReaderLink: option to add location to stack on opening book (#7685) 3 years ago
NiLuJe d2ad6a83e1 ReaderTypeset: Minor reword after #7759
c.f., https://github.com/koreader/koreader/pull/7759#discussion_r638929468
3 years ago
Frans de Jonge 1054137641
[lang] Improve "set to" consistency (#7773)
Also remove a double space pointed out by @NiLuJe.
3 years ago
zwim 203e434a51
[lang] Slightly reword some notification sentences (#7759) 3 years ago
NiLuJe 887138f57f
ReaderDictionary: Handle all dictionaries being disabled better. (#7737)
By showing a warning, instead of not passing any -u flag to sdcv and letting it query *all* dictionaries if FS order...

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
3 years ago
NiLuJe 2067a16fa1
ReaderZooming: Unconditionally update the configurables on SetZoomMode (#7735)
Expand #7728 to also catch SetZoomMode (mostly for Dispatcher's sake, but other things also send it).
3 years ago
NiLuJe bee2a605f1
ReaderStatus: Don't crash in EndOfDocument actions that *immediately* destroy the ReaderUI instance. (#7733)
This is handled in an Event handler, but we have zero guarantee that
we're actually the *final* Event sent to the Document, and other Events
usually kinda need the Document instance to still be alive ;).

Delay action until the next tick to avoid potential crashes.
3 years ago
NiLuJe c05b1a4ee4
ReaderZooming: Deal with some more fallout of the new zoom modes (#7728)
* Namely, ensure zoom_mode is consistent with genus & type *both ways*. (I only dealt with the "no zoom_mode" case in my original fixup).
Because documents with settings dating back from before the new zoom modes had "old" zoom_mode settings mixed with "new" genus/type defaults that didn't agree with each other.
It lead to super-confusing ConfigDialog behavior, because ConfigDialog was in fact not reflecting the reality.
(As the source of truth is actually `zoom_mode`).

* There was a snafu in manual mode, because of the extremely weird way prefixes are handled by Configurable/ReaderConfig/DocSettings/ConfigDialog.
So, make sure we only have a *single* zoom_factor, and that it's updated and saved properly under the right name everywhere.

Fixes inconsistencies between first swapping to manual mode, and what the ConfigDialog said/did (because again: possibly a lie), vs., re-opening the same document, which would magically use *different* settings, closer to what was expected (but still broken because of the prefix mismatch and a disagreement on defaults between the two variants).

Fallout from #6885
3 years ago
NiLuJe 0e83551e8d History: Don't flash when swapping documents
(i.e., when History is spawned from ReaderUI, delay the flash until we
*show* the next widget, instead of when we close the current RD
instance).

Prevents flashing the InfoMessage.
3 years ago
poire-z 7dea979ef4 ReaderHighlight: fix long-long-press regression 3 years ago
poire-z 26750dab99 ReaderHighlight: clearer symbols on selection start/end buttons 3 years ago
zwim 6e2be98edc
Notifications: options to show none/some/more (#7718)
Notification: adds some functions so it can be used as
a notification manager.
Have various bits of code emitting events that may generate
notifications advertize themselves as the source for following
notifications.
Add a menu to allow selecting some subsets of sources
to show or hide.
3 years ago
poire-z d0165f8bd1 Fix scrolling, add inertial scroll on non-eInk devices
Add a new reader module: ReaderScrolling, that exposes
some Scrolling options to the menu (which are to be used
by and implemented in ReaderPaging and ReaderRolling
themselves) and implement some inertial scrolling logic
used by both of them.
Default to "Classic scrolling" which is the expected
behaviour on phones and tablets.
The old CreDocument buggy behaviour is available as
"Turbo scrolling" for both Paging and Rolling documents.
Added a "On release scrolling" option that might be
useful on eInk to avoid dynamic pan/scrolling.

Try to avoid bad interactions between pan and swipe,
cancelling unwanted panning if we ended up doing a
swipe or multiswipe.
3 years ago
poire-z e4fd45ef08 Pan zoom mode: update footer when panning in a same page 3 years ago
poire-z 0a3978f60b Reader: remove full refresh on vertical swipes
Small diagonal swipes is what can be used for
full refrehes. Tweak a bit how it is done.
3 years ago
poire-z 33744217de Chapter navigation: fix possible crash in scroll mode
Update self.current_page on each pos change,
so getPreviousChapter() and al. have something
to work with.
3 years ago
poire-z 001d48f6cc Fix a few possible crashes
- TextWidget: avoid crash with small max_width (could happen
  when opening menu on a small emulator window)
- TextWidget: avoid crash if re-used after :free()
- ReaderHighlight:clear(): fix possible crash when
  scheduled and run after document closed
- DictQuickLookup: minor canSearch() tweak ('selected_text'
  is normally available only on multiple words selection,
  but is currently available on single word selection thanks
  to some unrelated side effect)
3 years ago
zwim 067ece7281
Fix changeFontSize after added granularity (#7689)
Whith the new font size step of 0.5 (46a2d9c), the gesture
for increasing or decreasing font size would change the
size by only half of the given value.
3 years ago
NiLuJe d56a944b79 Tests: Handle FM/ReaderUI instances slightly more sanely
* Tear down FM instances properly
* Don't manhandle ReaderUI too much, and document when the tests do
  actively broken shit, like bypassing safeties to open two // ReaderUI
  instances.
3 years ago
NiLuJe 90c38e2d0d ReadHistory: nil guard a Document instance access
We're now more careful about this, so, I suppose weird timings may mean
we might be trying to access a nil here.

Fix #7706

Guard a few other similar constructs
3 years ago
NiLuJe 6dc1c1efca Unbreak ReaderFooter test
Tests: Update the ffi.metatype wrapper

(Better idea: move to busted master).
3 years ago
NiLuJe 189035cafc ReaderFooter: Get rid of magic nil settings
And go through one-time-migration to ensure the settings are properly
filled.

Also, disable hold-to-skim by default.
3 years ago
NiLuJe 8d3aacbac3 ReaderFooter: Fix the madness related to its hold footer
Namely, instead of making it lower priority than readerhighlight and
hoping for the best, make it higher priority, as it should (ReaderFooter
itself is *above* Reader, after all), with a sane set of fallthroughs:

* No footer
* No hold-to-skim
* Held outside the footer (but inside the footer tap zone)

This made the crap workaround from #7466 unnecessary, and actually fixes
the behavior in PDFs (because readerhighlight will match the *physical*
page, which may include off-screen content) and ePubs w/r eclaim bar
height (in which case, there's actual content behind the footer that
readerhighlight could have matched on).

Fix #7697
3 years ago
NiLuJe 056eeef747 ReaderPaging: Unbreak flipping mode's double taps
As discussed in #7646, regression since #6322
3 years ago
NiLuJe 94f708b53b BookInfoManager: Actually close the document after extraction
DocumentRegistry just decreases a ref, it doesn't close anything.

Plug the same Document leak in a few other places, and document this.
3 years ago
zwim 6cb2ba65cd
CRe: draw progress bar under alt status bar (#7667) 3 years ago
NiLuJe ba00f3879d
ReaderHighlight: nil guard a few self.hold_pos accesses (#7700)
Fix #7698

That only leaves a single unguarded access in onUnhighlight
3 years ago
NiLuJe 4b265bcd7a Allow ingoring the B288 feature bans, for debugging purposes. 3 years ago
Frans de Jonge 529c681851
CloudStorage: log error (#7694)
References <https://github.com/koreader/koreader/issues/7688>.
3 years ago
NiLuJe bb65a69193
Geom: nil guard a few rect methods (#7664)
We've managed to trip a few of those on dimen fields post-init but
pre-paintTo in a few weird coner-cases, a point at which dimen is often
nil.

ConfigDialog: Deal with that very thing in update()

Fix #7656
3 years ago
poire-z f0ecbeb1d5
ReaderToc: option to show a dotted line (#7669)
A dotted line joining the ToC entry text to the
page number may make it easier to use.
(This replaces the menu item separator from d879062e.)
Also fix baselines aligment, which could be a bit off.
3 years ago
zwim a20cac6904
[chore] Remove dead code (#7665) 3 years ago
NiLuJe de6f2e84a3
FileManager/ReaderUI: Clarify the current instance accessor (#7658)
* FileManager/ReaderUI: Clarify the current instance accessor

Make it clearer that we actually store it in a *module/class* member, not an *instance* member.

Also, warn if there's a close/open mismatch.
3 years ago
NiLuJe ed0aa1ed11 ReaderUI: Ensure we flash when opening a document
Regression since #7624
3 years ago
hius07 3d713dc34c
Dictionary: disable 'Clean history' when the history is empty (#7636) 3 years ago
hius07 c129354ca3
Wikipedia: disable 'Clean history' when the history is empty (#7637) 3 years ago
mergen3107 2c1cae64b6
Remove notification on font change (#7589)
Should reduce refreshes competition and avoid glitches.
3 years ago
Kevin Reuning 1cefd27946
DropboxAPI: Handle pagination (#7621)
Fix #7600 

Co-authored-by: NiLuJe <ninuje@gmail.com>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
3 years ago
hius07 752ec49c6f
FM: Make "Refresh content" an actual Event/Gesture (#7592)
* And enable it by default in the FM as the "hold on top-right corner" Gesture, instead of the onHold handler of the "+" button.
3 years ago
zwim 3d9ed32458
Android: Send Suspend/Resume Events on STOP/START (#7630)
* ReaderHeader: Refresh it *now* on Resume, instead of just re-scheduling an update if auto-refresh is enabled..
3 years ago
NiLuJe 06a273b48d Port ffiUtil.getTimestamp users to TimeVal:now()
They were all using it to compute durations,
something which is going to be more sensible
from a monotonic clock source.
3 years ago
NiLuJe 21b067792d Cache: Rewrite based on lua-lru
Ought to be faster than our naive array-based approach.
Especially for the glyph cache, which has a solid amount of elements,
and is mostly cache hits.
(There are few things worse for performance in Lua than
table.remove @ !tail and table.insert @ !tail, which this was full of :/).

DocCache: New module that's now an actual Cache instance instead of a
weird hack. Replaces "Cache" (the instance) as used across Document &
co.
Only Cache instance with on-disk persistence.

ImageCache: Update to new Cache.

GlyphCache: Update to new Cache.
Also, actually free glyph bbs on eviction.
3 years ago
NiLuJe ce624be8b8 Cache: Fix a whole lot of things.
* Minor updates to the min & max cache sizes (16 & 64MB). Mostly to satisfy my power-of-two OCD.
  * Purge broken on-disk cache files
  * Optimize free RAM computations
  * Start dropping LRU items when running low on memory before pre-rendring (hinting) pages in non-reflowable documents.
  * Make serialize dump the most recently *displayed* page, as the actual MRU item is the most recently *hinted* page, not the current one.
  * Use more accurate item size estimations across the whole codebase.

TileCacheItem:

  * Drop lua-serialize in favor of Persist.

KoptInterface:

  * Drop lua-serialize in favor of Persist.
  * Make KOPTContext caching actually work by ensuring its hash is stable.
3 years ago
NiLuJe e7acec1526 ReaderUI: Saner FM/RD lifecycle
* Ensure that going from one to the other tears down the former and
    its plugins before instantiating the latter and its plugins.

UIManager: Unify Event sending & broadcasting
  * Make the two behave the same way (walk the widget stack from top to
    bottom), and properly handle the window stack shrinking shrinking
    *and* growing.
    Previously, broadcasting happened bottom-to-top and didn't really
    handle the list shrinking/growing, while sending only handled the list
    shrinking by a single element, and hopefully that element being the one
    the event was just sent to.

These two items combined allowed us to optimize suboptimal
refresh behavior with Menu and other Menu classes when
opening/closing a document.
e.g., the "opening document" Notification is now properly regional,
and the "open last doc" option no longer flashes like a crazy person
anymore.

Plugins: Allow optimizing Menu refresh with custom menus, too.

Requires moving Menu's close_callback *after* onMenuSelect, which, eh,
probably makes sense, and is probably harmless in the grand scheme of
things.
3 years ago
NiLuJe 9f835156d1
PluginLoader: Allow querying whether a specific plugin is loaded (#7607)
* PluginLoader: Allow querying whether a specific plugin is loaded (instantiated, actually).

Re #7598

* PluginLoader: Add a method to access a specific Plugin's instance
(Besides `self.ui[plugin_name]`, that is).

Requires some nastiness to avoid pinning stale references in memory :s.

* PluginLoader:  Tweak genPluginManagerSubItem to keep from rebuilding `self.all_plugins`, it's using `loadPlugins`, which is cached, so it made no sense to re-compute this one.
3 years ago
poire-z 9ef435c97a
bump crengine: more granular font weights (#7616)
Includes:
- MathML: a few minor fixes
- (Upstream) lvtext: fix possible index out of range
- Fonts: RegisterExternalFont() should take a documentId
- Fonts: fix: letter-spacing should not be applied on diacritic
- (Upstream) Fonts: more granular synthetic weights
- Fonts: synthesized weights: tweak some comments
- Fonts: keep hinting with synthetic weight
- Fonts: fix synthesized weight inconsitencies
- Fonts: fix getFontFileNameAndFaceIndex()
- Fonts: adds LVFontMan::RegularizeRegisteredFontsWeights()
- Fonts: handle synth_weight tweaks in glyph/glyphinfo slots
- (Upstream) Fonts: fix some compiler warnings
- Fix hyphenation on Armenian and Georgian text

Update the bottom menu widget "Font Weight" to allow more
granular weights than the previous "regular | bold".

Also bump thirdparty/luasec to v1.0.1.
3 years ago
hius07 3cb9508185
Filemanager: enhance file operations dialogs (#7582) 3 years ago