Commit Graph

1675 Commits (3427c207b0dc8eca0ace1dc25633dd6a76e910ab)

Author SHA1 Message Date
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
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
yparitcher 1c2e5eee1d
BookStatusWidget: fix status toggle (#8329)
Fix:  #8324

cf: #7671
3 years ago
git-help-eng 0d231cbbef
Footer: maybe shouldn't be visible on resume (#8289) 3 years ago
hius07 b2a7d0d5ce
BookStatusWidget: use correct read percentage (#8318)
Closes #8317.
3 years ago
hius07 8a750d4692
File searcher: fix FileManager invocation (#8257)
Do not start a new instance if not needed.
3 years ago
hius07 1e47cd7e5f
SpinWidget: similar size in portrait and landscape (#8226) 3 years ago
hius07 ed68445626
crash.log: write plugin regular information only in debug mode (#8230)
* Update pluginloader.lua

* Update filemanager.lua

* Update readerui.lua
3 years ago
hius07 859327dea5
Input dialogs: keep size in rotation (#8223) 3 years ago
hius07 5b049a5a82
Help text fixes (#8217)
* Update css_tweaks.lua

* Update readersearch.lua
3 years ago
hius07 1dd50381d0 ReaderTypography: Hyphenation Limits keep size in rotation 3 years ago
hius07 f6020a7260
Readerhighlight: manage actions (#8199)
Discussion in #6409.

Highlight action renamed to Long-press on text and moved from Gear - Document to Gear - Taps and gestures.

Added action Do nothing.
Removed menu item Typeset - Highlighting - Allow highlighting.

Fixed untranslated strings in the Cycle highlight action notification.

Long-press on images always opens ImageViewer. Closes #6409.
3 years ago
hius07 dd1b10332e Readersearch: reduce icon size in search dialog 3 years ago