Commit Graph

8743 Commits (3427c207b0dc8eca0ace1dc25633dd6a76e910ab)
 

Author SHA1 Message Date
NiLuJe 98b53b0390 Kobo: More readable crash screen on sunxi (Sage, especially).
Switch to flashing GC16, because the screen is so fast that using GL16
simply leaves us with an unreadable mess of ghosting.

I'm halfway considering rewriting this in Lua so that I can do a proper
batched update...
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 23a1ef2db2
[Autowarmth plugin] Optimisations; Documentation (#8397)
* Documentation; Improved accuracy
* Documentation update
* Remove todo tag for circleCI
* Cleanup
3 years ago
zwim 7887c9b1cf
Fix crash in readerhighlight (#8396) 3 years ago
hius07 bfddf710d6
InputDialog: fix "number" input (#8383) 3 years ago
zwim a7cfc65928
Fix crash when entering a digit on the SDL keyboard (#8388)
Fixes #8387.
3 years ago
zwim 6aa0d802ec
[autowarmth, plugin] Bug if all scheduler entries are deleted (#8386) 3 years ago
Frans de Jonge 0aab7d7378
[fix] gettext: unescape \\ for ID matching (#8357)
Fixes <https://github.com/koreader/koreader/issues/8356>.
3 years ago
NiLuJe 3483238546
Fix reflow calls for DjVu documents (#8379)
The second argument is a ddjvu_render_mode_t
Try to actually honor the user settings instead of enforcing COLOR
while we're there.

Fix #8376
Regression since #8250
3 years ago
zwim 54605d8313
[Autowarmth, plugin] Corner case for warmth setting; warmth on resume for KA1 (#8373) 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
NiLuJe e17b136d67
Initial support for the Kobo Libra 2 (#8367)
* Initial support for the Kobo Libra 2

* It's the same touch panel as the Elipsa & Sage.
* Plug in proper nightmode waveforms on mxcfb.

* Bump base

https://github.com/koreader/koreader-base/pull/1423
3 years ago
Aleksa Sarai 501a6204f8
luacheckrc: allow busted's "match" global for spec/ (#8369)
This was fixed in luacheck 0.24.0 but our CI still uses an older version
at the moment.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
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
NiLuJe db21521968
Support frontlight warmth on the Sage (#8366)
Follow-up to #8361.
3 years ago
Frans de Jonge 59710ec67a
[chore] Fix todo and fixme tags (#8365)
Slightly overlooked in #8312.
3 years ago
Frans de Jonge db45881183
[chore] Spaces for indendation, not tabs (#8364)
Overlooked in #8312.
3 years ago
Aleksa Sarai 56899eab8e spec: add tests for LanguageSupport
This primarily consists of some spies added to ensure that the
LanguageSupport plugin is actually being called at the right time.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai 3d4e54c7e6 plugins: add Japanese Support plugin
This plugin provides support for Japanese deinflection during lookup as
well as making long-hold word selection actually select whole words
properly. With this plugin, word lookups in Japanese text in KOReader
become much easier, and no longer requires users to use special
dictionaries that have synonym-based deinflection rules defined (which
were always fairly annoying to use).

The basic idea and deinflection data for this plugin come from
Yomichan (which is also a GPL-3.0+ project), but everything was
implemented specifically for KOReader.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
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 da70fe9de1 common_settings: migrate document menu to menu_order ordering
This is necessary in order to allow the language support module to be
added to the menu outside of the common_settings menu table definition.

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
Aleksa Sarai 3ffb4c1692 kopt: add fallbacks for cases where kctx is not in cache
There were a handful of cases where if there was no cached kctx there
was no fallback and several KoptInterface methods would return nil,
causing issues in various parts of KOReader (this happened with the
migration to selected_text everywhere but it's unclear how that change
caused this regression).

In any case, from a correctness perspective it makes sense to have the
corresponding fallback paths to create a new kctx if we couldn't find a
cached one.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai b21029f1ac credocument: update getTextFromXPointers wrapper to support selections
With the latest koreader-base update, we can now create native
selections using getTextFromXPointers. In order to make the wrapper less
annoying to use, always enable segmented selection if selections are
enabled (to match getTextFromPositions).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai a29d24f86d geom: supplement :combine with more generic .boundingBox
It is a bit cleaner to do all of the necessary looping over lists of
Geoms within a straight-forward Geom.boundingBox function rather than
looping over :combine every time (or reimplementing :combine in some
cases). Geom:combine can be trivially reimplemented in terms of
Geom.boundingBox as well.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai 6f1b70e5eb util.utf8: improve CJK character detection
Previously the CJK character detection defined only characters in the
range U+4000..U+AFFF as "CJK characters". This excludes an incredibly
large number of CJK characters within the BMP, let alone the whole two
planes dedicated to rarer CJK characters (the SIP and TIP). As a result,
a very large number of Chinese, Japanese, and Korean characters were not
detected as being CJK characters.

While slightly less elegant-looking, it is far more accurate to compute
the codepoint from the utf8 character and then see if it falls within
one of the defined CJK blocks. This is not future-proof against future
CJK ideograph extensions in future Unicode versions, but there is no
real way to accurately predict such changes so this is the best we can
do without accidentally treating characters explicitily defined as being
non-CJK in Unicode as CJK.

While we're at it, copy Lua 5.3's utf8.charpattern constant definition
so that we can more easily write utf8 iterators with string.gmatch (at
least in the interim until there is a rework of utf8 handling in
KOReader and everything is rebuilt on top of utf8proc).

Some unit tests are added for Korean and Japanese text, and the existing
unit tests needed a minor adjustment to handle the fact that
isSplittable now correctly detects CJK punctuation as a character to
compare against the forbidden split rules.

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
Mike Kozlowski 2cd4d09db4
Add initial support for Kobo Sage (Cadmus) (#8361) 3 years ago
poire-z dade71d3c3
bump crengine: upstream sync, page splitting fix (#8360)
- Update German hyphenation patterns
- (Upstream) zip64 support: fixes and enhancements
- Page splitting: fix footnotes possibly delayed too long
3 years ago
NiLuJe 304e128031 Bump android-luajit-launcher
https://github.com/koreader/android-luajit-launcher/pull/336
3 years ago
NiLuJe c10597bcb0 Bump base
https://github.com/koreader/koreader-base/pull/1413
https://github.com/koreader/koreader-base/pull/1415
https://github.com/koreader/koreader-base/pull/1417
https://github.com/koreader/koreader-base/pull/1419
https://github.com/koreader/koreader-base/pull/1420
https://github.com/koreader/koreader-base/pull/1418
https://github.com/koreader/koreader-base/pull/1421
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
hius07 22a012e729
[chore] RadioButtonWidget: remove unused "Use default" string (#8354) 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
zwim 09725e518a
Autowarmth: wording, move expert-mode menu entry down (#8350) 3 years ago
yparitcher 61d02923e9
Dispatcher: fix horizontal margins (#8344)
Regression from #8287
3 years ago
zwim 6492583e96
Autowarmth: wording, help_text, menu tweaks (#8338) 3 years ago
hius07 d652eec2cd
ReaderHighlight: allow updating a highlight drawing style (#8323)
Also modify highlight dialog's "Edit" button to be "Add note"
or "Edit note" whether a note has already beed added.
Adds a new RadioButtonWidget.
3 years ago
hius07 f0b992d425
Bookmarks: new settings and tweaks (#8301)
Bookmarks list:
- page numbers are displayed
- page bookmarks are marked with a star
- new setting: Sort by largest page number (default: checked)
New bookmark setting: Add page number / timestamp to bookmark
- If enabled (default), bookmark name is 'Page # notes @ time'.
- If disabled, bookmark name is equal to the notes field.
Rename bookmark dialog:
- page number and timestamp are displayed in the input
  dialog description
- blank input renames bookmark to the default name in
  accordance with the new setting
Also fix: changing boundaries of the highlight: the name of the
highlight is not changed if it was previously edited by the user.
3 years ago
hius07 fd697f3c77
wbuilder: use correct call for BookStatus widget (#8342)
Correction required after #8318.
3 years ago
hius07 7036500f5b
Menu widget: adapt font size of shrunken items (#8340) 3 years ago
hius07 4ffabcf087
Screensaver: correct call of BookStatusWidget 3 years ago
ElimGarak1 863255c9f4
Add PocketBook InkPad Lite (PB970) (#8335)
Closes #8331.
3 years ago
Frans de Jonge 91b921505c
Update translations for 2021.10 (#8334) 3 years ago
poire-z ca1c3484d8
DictQuickLookup: two minor fixes (#8333)
- Allow Wikipedia languages cycling when invoked
  from File browser.
- Fix TextBoxWidget content not updated when next/prev
  when use_xtext=false.
3 years ago