Menu key support for some widgets. would have closed#11783 and #6463 (cumulative with @comphilip's fixes)
It fixes a problem where some virtual keys were not available for non-touch users. closes#11862
Also, adds keyboard settings to non-touch devices. closes#11934
- forward unknown make targets to base
- add `cmake` and `staging` directories to ignored output artifacts
- drop `package.path` and `package.cpath` luarocks specific entries
1. Non-Kindle-specific `hasFiveWay` behavior is changed to `hasDPad and useDPadAsActionKeys`. For now they remain Kindle-specific in practice, unless one sets `useDPadAsActionKeys = yes` in a user patch.
2. With that disambiguation out of the way, `hasFiveWay` itself is further disambiguated into `hasScreenKB` and `hasSymKey`, as per the actual property being used, rather than something that tends to correlate with it. (It needn't be Kindle-specific per se, but non-Kindle devices have equivalent shortcuts with for example `Shift`.)
Running the emulator with `DISABLE_TOUCH=1` will set `hasSymKey = yes`, which can be tested with right shift.
Closes#11887.
Currently, links with a scheme other than http or https are rejected. But plugins may want to handle them. This allows them to, by registering the scheme with self.ui.link:registerScheme("example") during the plugin's init.
We now build the "page/total %" string ourselves,
with the same logic as used in the footer (including
when hidden flows or reference page numbers are used)
and give it to crengine to be displayed instead of
its own way of doing it.
When using Reference page numbers, "Pages left" was showing the
same info as "Current page", because Reference pages, being strings,
couldn't be used for arithmetics. But we can just count the number
of items left in the Reference pages array of strings.
Also fix edge case with "page progress" with hidden flow when
we are before the first chapter with a hidden flow before.
Includes:
- html5.css: really ensure ruby centering
- getRenderedWidths(): fix possible crash with 0-width images
- Page splitting: ignore empty non-linear flows
- LvDocView header: allow overriding "page/total %"
CreDocument: add setPageInfoOverride() to allow tweaking
top status bar display of page number/count/% (to be
implemented in a later commit).
Switch to a new `input.fdopen` API & wrapper so we can keep the fds opened by `fbink_input_scan` instead of closing them to re-open them right after that...
This should hopefully help on racy zForce devices that attempt to handle power management when opening/closing the device. We know this sometimes horribly fail to re-activate the IR grid (c.f., our manual activation on resume), but this apparently could also happen here (re: #11844) because of the quick succession of open->close->open.
The info messages for opening files always show the full path. By using `filemanagerutil.abbreviate`, the info messages now show the shortened home folder path (only if the setting "shorten home folder" is enabled).
Many PocketBook devices include a web browser, but when clicking a link in KOReader, there was no option to open the link in the browser, there was only an option to show a QR code (which can then be scanned by a smartphone).
This commit implements `canOpenLink`/`openLink` on PocketBook using the "browser.app", if available.
Tested on PB740 (InkPad 3).
Fixes: https://github.com/koreader/koreader/issues/11782
Related: https://github.com/koreader/koreader/issues/6597
updating metadata for 50 languages
short_description.txt: 8 new | 18 updated | 24 not translated
full_description.txt: 10 new | 15 updated | 25 not translated
* Kindle: Don't forget to open INPU_DPAD devices for the fiveways. Somehow managed to skip my mind, they're often on a separate input device.
Regression since #11807
* Update FBInk to fix a few cases of input_scan misdetection (on misconfigured drivers (e.g., no DIRECT prop on supported kernels), or old kernels with no EVIOCGPROP support).
Fix#11824
* Kobo: Drop a bunch of if ladder crap and switch to auto-detection of input devices via fbink_input
* Kindle: Drop an even larger bundle of crap to do the same ;p. (re: #11392)
* ExternalKeyboard: Switch to fbink_input to whitelist keyboards instead of the manual parsing of caps via its FindKeyboard class
* Input: Extended open/close wrappers to handle logging & tracking of dupe open/close calls.
Don't cache the whole base directory; instead independently cache:
- the build output directory
- the ccache directory
This allow completely avoiding the need for building base if a
cache (keyed on the relevant parts of the git tree for base) is
successfully restored, as well as reducing the amount of cached
data.
Additionally, ensure caches are isolated by branch name (but allow
falling back to a "master" cache for restore): we don't want PRs
using each others' caches.
If the Android NDK and/or SDK are not setup, `kodev` will try to invoke
the `android-ndk` and/or `android-sdk` make targets. This can't be done
with `TARGET=android`, as `base/Makefile.defs` will error out trying to
call the (missing) compiler to get the target machine. Those rules need
to be available to all targets.
Relates to https://github.com/koreader/koreader/issues/9268
Requires https://github.com/koreader/koreader-base/pull/1504
Usage:
- `kodev release linux` for native package (same arch as host)
- `LINUX_ARCH=arm release linux` for armhf on a x86_64 host.
- `LINUX_ARCH=arm64 release linux` for arm64 on a x86_64 host.
It produces a `koreader-linux-$ARCH-$VERSION.tar.xz` archive, where $ARCH follows `uname -m` convention {x86_64, armv7l, aarch64}
To generate the debian package from the generic archive the following command is required
`./platform/linux/do_debian_package.sh path_to.tar.xz`
The version of `7z` provided by `p7zip-full` is now the same as `7zip`:
- symlinks are dereferenced by default (no support for `-l`)
- `7z -ba h` appends a trailing `/` to directories
(not present in the output of `7z -slt l`)
* Support the Clara B&W, Clara Colour & Libra Colour
* Enable HW dithering on *all* the Kobo MTK devices
* Enforce 32bpp instead of 8bpp for Kobo devices with a color panel (the driver doesn't actually support 8bpp anyway)
* Enable standby support on MTK (whenever possible, i.e., not when plugged in, as that is horribly, horribly broken).
* Enforce the dedicated "color" waveform mode for image content in ScreenSaver, ImageViewer & Reader.
* Fix charging LED support on MTK
* Tweak the frontlight ramp on MTK + LM3630 so that it actually ramps smoothly
The `droid sans fallback` test incorrectly assumes `Droid Sans Mono`
will be the first font in the list of fallback fonts, but the list
is alphabetically sorted.
Cf. https://github.com/koreader/koreader/pull/10566
Search may highlight matches on the current page, and if there
are no others in the book, we would stay there and resume reading;
but we would get a spurious previous location (ie. in Book map)
that we would not expect keeping, and we may accidently go back
to previous location, losing our reading position.
Avoid this by only adding current page to location stack when
actually leaving the current page.
Because of complications with other reading modes, this is
currently only enabled for CRE document when in page mode.
As currently we only handle ReadingPaused/Resumed on suspend
and resume, no page change should happen while paused, so
there is no current issue to fix. But let's get ready for
other use cases (which may be brought in by user patches,
ie. pausing while the SkimWidget is displayed, and obviously
triggers page changes).
When on a page before the first ToC item (the first chapter),
that first chapter title may be shown in the footer instead
of a more correct blank title.
This bug might still have had other small effect elsewhere.
The FUSE detection is false positive under Gitlab's pipeline,
so just use the hidden `--appimage-extract-and-run` option to
automatically and always "extract & run" the appimage tool.
Instead of trying to detect if running under Docker, use a simpler
wildcard check to detect if FUSE support is available. This as the
advantage of supporting Docker, rootless Docker, and Podman.
Includes:
- Russian hyphenation: allow hyphens after Russian "не" prefix
- EPUB: add "identifiers" to doc props
- EPUB: avoid crash when '@font-face' in <head><style>
- FB2: fix block images sizing and centering
- lvrend: fix positioning of bottom border on empty block elements
Also includes:
- cre: add 'identifiers' to doc props
- build and ci: various tweaks
Device:getDefaultRoute parses /proc/net/route and converts the hex
addresses to textual IP addresses, but in `isOnline` we don't care what
address the gateway actually has, we only care about whether we have a
default route into the Internet.
This provides a simpler alternative that does the equivalent of
"ip route get 203.0.113.1 || ip route get 2001:db8::1" (note that it
does support IPv6-only connectivity as opposed to
Device:getDefaultRoute) and returns true if we have a route.
Inspired by https://github.com/pavel-odintsov/get_default_outgoing_ip_linux
Doing the `isOnline` check (`socket.dns.toip("dns.msftncsi.com")`)
without having internet connectivity (`!isConnected`) results in the
`isOnline` check never succeeding again even if connectivity is later
acquired. This is most likely caused by /etc/resolv.conf only being
parsed once - https://sourceware.org/bugzilla/show_bug.cgi?id=984, an
issue that was fixed in glibc 2.26 (PocketBook firmware U740.6.8.2461
has glibc 2.23).
This fix works around the problem by checking if we have a default route
first before even attempting to check `isOnline`. If we don't, then
`isOnline` is (almost) guaranteed to fail anyway.
We could alternatively check `isConnected` instead, but that only checks
wireless connectivity on many platforms, and we could have internet
access via USBNet instead. Checking for the default route via any
interface should work reliably for both wireless and USBNet
connectivity.
Another alternative fix is to add a fallback nameserver to
/etc/resolv.conf like we do for the Kobo platform [1]. Unfortunately,
this fix would not work in the following (rather common) scenario:
1. PocketBook boots, connects to WiFi
2. KOReader starts, /etc/resolv.conf looks all right, no fallback needed
3. PocketBook goes to sleep, disconnects from WiFi, clears resolv.conf
4. PocketBook wakes up, stays disconnected
5. KOReader user does a Wikipedia lookup, networking freezes
[1]: https://github.com/koreader/koreader/pull/6424/files#diff-be863601c59a2d6607af6b04b3be2392ec4494df6d25dae48250fae57b737f61R216-R224
Fixes: https://github.com/koreader/koreader/issues/10183
Related: https://github.com/koreader/koreader/issues/6421
Added in <https://github.com/koreader/koreader/pull/8722> and unproblematic for the past two years, but Weblate has now decided to complain about it to the extent of disabling translations:
> Error message
String contains control character: 'If some book titles, dictionary entries and such are not displayed well but shown as \ufffe\ufffe or ��, it may be necessary to download the required fonts for those languages. They can then be enabled as additional UI fallback fonts.\nFonts for many languages can be downloaded at:\n\nhttps://fonts.google.com/noto\n\nOnly fonts named "Noto Sans xyz" or "Noto Sans xyz UI" (regular, not bold nor italic, not Serif) will be available in this menu. However, bold fonts will be used if their corresponding regular fonts exist.'
Includes:
- In-page footnotes: avoid with '-cr-hint: noteref-ignore'
- In-page footnotes: ensure they don't cross "flows"
- Tables: fix rendering when negative text-indent
- FB2 cover drawing: ensure _invertImages flag
- EPUB: fallback to look for a cover in the first fragment
- TextLang: Russian: add typography rules
Also update to libunibreak 6.1.
A typo snuck in #11492, which should've read `not type(article.mimetype) == "string" or type(article.mimetype) == "string" and not article.mimetype:find("^text/html")`. But in most cases the behavior would've been identically broken because of the same underlying issue: Wallabag mimetype is actually HTTP content-type.
Fixes#11528.
Also introduces a new setting associated with the behavior in case people have different preferences.
Include in the EPUB stylesheet most of our epub.css
tweaks, so we get our expected styling even when
html5.css is used as the default stylesheet.
(Users liking the "web page" look can still get it
by enabling some of our existing style tweaks.)
- Reword and document most menu items.
- Handle internally two default styles, one applying only
to FB2/FB2 books, and the other to all other formats.
- Also don't reset the stylesheet to epub.css when
toggling Embedded Styles to off.
Includes:
- Hyphenation: update French.pattern
- [CI] Add stylelint to help prevent typos in CSS
- In-page footnotes: better handle duplicated ids
- lvrend: handle in-page footnotes in table <caption>
- lvstsheet: fix compiler warnings
- LVString: ignore CJK chars in lStr_findWordBounds()
- lvtext: AddLine(): handle some CJK + space edge case
- EPUB: look for EPUB3 cover even when EPUB2 cover advertized
- List items: proper per-specs positionning and sizing
- epub.css: add/use "@media (-cr-max-cre-dom-version: 20180527)"
- fb2def.h: add more HTML element and attributes names
- CSS: generic support for handling presentational hints
- CSS: add support for private -cr-apply-func:
- ldomDocumentWriterFilter: remove attribute to CSS conversion
- lvrend: more proper rendering of block images
- lvrend: keep margin_left/right updated when "auto"
- CSS: add support for handling HTML's align= attribute
- lvrend: fix HR and images positionning when floats involved
- epub.css, html5.css: minor updates for easier stylesheet switch
- epub.css, html5.css: major updates for better conformance
- fb2.css: fix CI stylelint warnings
Also update to libunibreak 6.0.
If there's only one contact, we won't get an ABS_MT_SLOT, so we need to
make sure we fall back to the main finger slot once we've caught a tool
switch.
Also, move the dedicated pen slot further away, so it has zero chance of
being detected as a potential buddy contact to a finger contact.
Fix#11514
Previously unnoticed or changed Wallabag behavior can provide a mimetype of for example `text/html; utf-8`, which wouldn't be an exact match to `text/html`.
Fixes#11481.
Added support
1. Select only this book
2. Select all books
3. Select all books on this page
4. Deselect all books on this page
when filtering.
Ref. #11471
When we open the document for the first time, the pan
positions are not being applied. If I use the bottom-to-top
mode we should see the bottom first, but the top is being
shown instead.
Can be used to inspect the state of the objects in
a running KOReader.
It can also be used to execute actions (like the ones
available to associate to a gesture) with HTTP requests
from a remote computer/devices/gadgets.
The TCP server side is provided either with a new
ZeroMQ StreamMessageQueueServer (thanks bneo99),
or with a LuaSocket based SimpleTCPServer.
Minor UIManager tweak to avoid uneeded inputevent
when such a ZeroMQ module is running.
The previous check was inlined in the dir walk, so it always saw a
relative path.
Here, it gets an absolute one instead, so act accordingly ;).
Fix#11390
Regression since #11056
FrameContainer now behaves like other widgets, and no longer re-computes
dimensions in paintTo *if you provide a dimen*.
Since we do here, for.... reasons I'm not entirely sure still make any
sense, make sure we actually compute valid dimensions,
instead of an empty rect from Geom:new ;).
Fix#11389
@hius07 mentioned something to that effect a while back, makes sense.
Unlike the set of checkmarks in the dev settings, this one flips both
debug + verbose at once, *and* asks for a restart for framebuffer's
sake.
Also update the "Report a bug" spiel to request verbose debug logs.
Allow for embedding "tags" (invalid Unicode codepoints)
in the text string to trigger some text formatting:
for now only bolding some parts of text is possible.
Use it with fulltext search "all results" to highlight the
matched word (instead of the previously used brackets).
Fixes issue #8023
Related to issue #4029
The fix takes exactly the same approach as other PRs like #6195 to add some usability to devices with few hardware keys. The front-light widget can now be closed using the left key on the d-pad.
We currently don't do anything with it, but this might help someone come
up with fancier smartcover handling, like we do on Kobo...
Simplify the fake events w/args checks:
We can just hitcheck the table directly, no need for another hash
Also catch ExitedSS on Kindle.
And, again, dn't do anything with it ;p.
Includes:
- Fix getToc() not cached on initial loading
- CSS: add support for forgotten "border-style: hidden"
- CSS: fix parsing of 'div :something' and 'div [attr]'
- CSS: fix checking E[foo~="value"]
- CSS: order rules as written when building a selector
- CSS: fix useragent vs. author stylesheet CSS cascade
- CSS: pass useragent_sheet flag all along parse() code
- CSS: add private selector syntax to match against text
- CSS: add support for :is(), :where() and :not() pseudoclasses
- EPUB: don't ignore any <spine> item
- bump CACHE_FILE_FORMAT_VERSION
People using 2-steps text selection (via the Select button) may
want to not be annoyed by this feature.
Also tweak a bit its behaviour, requiring now the text selection
to come from outside a corder into a corner to activate it, which
should allow starting text selection from a corner without
triggering a scroll yet.
* UIManager: Init a full Geom on region-less refreshes in _refresh
* Never call refreshFull with no arguments
I got rid of the low-level nil guards, because UIManager itself guarantees that it can never happen
* Bump base (https://github.com/koreader/koreader-base/pull/1718) (fix#11303)
* Kindle: Re-enable HW dithering on the Scribe
Now that the underlying issue is fixed in base ;).
* Input: Harden setCurrentMtSlotChecked
The current implementation was assuming that the only case where we
might be missing slot storage was for the *first* contact point,
given that ABS_MT_SLOT is (if all goes well) guaranteed to be present
and come first for every subsequent additional contact points.
While this works just fine in practice, we can simplify and generalize
the check by just checking if we've actually recorded the requested
slot, even if it's not the first contact point.
The hit check is possibly ever so slightly faster than the length
computation, to boot.
* Input: Handle snow_protocol devices with newer hardware revisions that do *NOT* need the snow quirks.
If a sane input frame is detected, the snow quirks will be disabled at runtime, ensuring sane behavior.
Given the extremely non-standard behavior of the snow quirks, this is fairly easy to detect,
as a snow device will *never* emit EV_ABS:ABS_MT_TRACKING_ID:-1, so if we catch one, it's not snow ;).
(We've had reports of this on a Clara HD, FWIW)
Namely, don't recompute layouts, as they do not change.
(The gyro codepaths were already doing something similar.)
* Keep ConfigDialog, FileManagerMenu & ReaderMenu open on rotation.
(In practice, only ConfigDialog is affected, as *Menu doesn't handle the rotation event.)
* Plugged an instance leak in the aforementioned Menu classes.
* Unify behavior & code with the gyro codepaths.
Creating tags on memos looked like "#This is a book title" meaning only "#This" would become a Tag. Replacing spaces with underscore to be more usable so that the following tag would be created "#This_is_a_book_title"
Something in the gettext/weblate pipeline doesn't like it...
These are real unicode codepoints, not custom nerdfont ones, so just
render the actual glyph instead of escaping it.
Fix#11328
Cf. #10845.
Simplify the code, because the bit trickery was fairly nasty to follow.
KISS: flip one value at a time, either in or out.
Actually allow flipping *all* of the things via the UI, to help track
what the hell is actually happening when you touch a button.
Make some of 'em radio to make it clear when flipping one might affect
the other(s).
Brought on by https://www.mobileread.com/forums/showthread.php?t=358166
These changes make the title bar in File manager, History and Collection windows of the same height.
The items and book covers thumbnail dimensions in Mosaic and Detailed list display modes are now equal, and up/down scaling of the thumbnails is not needed when switching between File manager, History and Collection.
Get rid of the silly precomputed tables, and do More Maths(TM) instead!
Thanks to @zwim for the magic sauce ;).
Minor simplification of the API while I'm in there, and unify the warmth
computations, do everything in the native scale (much like what
effectively happens for intensity) to workaround the silly public API
being an unhelpful PITA, ensuring consistent & effective changes.
For some mysterious reason, we init fl_warmth_max to 100 on Kobo &
Cervantes, despite this being the case on absolutely none of them.
TL;DR: We update it according to nl_max during init, but this was
missing on Cervantes.
Add some menu items under Screen>Rotation to allow inverting
the default rotation of ImageViewer, and to auto-rotate for
best fit on launch, so landscape images are auto-rotated to
the preferred rotation.
Maintain correct records in History and Favorites when moving/deleting folders or group of files.
Optimize Collection module to minimize storage requests.
Some platforms with horribly broken MT handling (hai, PB) will manage to
screw something up so bad that we end up with slots never running
through initialState on a contact down, so they never get an initial_tev
recorded.
Ensure we do that if necessary when switching a buddy to voidState to
avoid crashes throughout the code, which assumes everything is sane and
doesn't guard accesses to initial_tev
Re: #11196, #10950 & #11111Closes: #11111
Includes:
- Avoid unnecessary string modifications
- Optimize LVHTMLParser::CheckFormat()
- lvfntman: fix stupid mistake
- css: speedup class matching
- fb2.css: empty paragraphs should have some line height
- CJK: fix bad ruby drawing on last paragraph line
Fix#11164 and involves a drive-by fix:
Kindle: Send Suspend/Resume event regardless of the screen saver state
If we get the events, it means stuff happened, we can't just only honor
it in the most common workflows ;).
This effectively reverts a tiny bit of #10426 (I was sort of expecting
this to be problematic at the time, and I most likely hadn't tested it).
* afterResume had *two* different implementations, so the historical one
that handled frontlight fixups no longer ran
(regression since #10426)
* isFrontlightOn was completely broken, for a couple of reasons:
* There was no is isFrontlightOnHW implementation, so when it ran, it
mostly always thought the frontlight was on, because
self.fl_intensity doesn't change on toggle off.
* _decideFrontlightState was never called on Kindle,
so isFrontlightOnHW was never really called, making isFrontlightOn
completely useless. Call it in setIntensityHW's coda, as it ought to
be. And properly document that.
Generic *was* calling _decideFrontlightState is setIntensity, but
*before* actually setting the frontlight, which makes no goddamn sense,
so get rid of that, too.
* Also fix frontlight toggle notifications (regression since #10305)
TL;DR: The PowerD API being a mess strikes again.
As "global defaults" (i.e., "advanced settings" in the UI).
These were the only zones not available there, for some reason (probably
they were new and we try to avoid adding new defaults).
Fix#11142
They'll be disabled again when the widget in question is dismissed.
This exposes a couple of semi-obvious but edge-casey footguns to the user, but a hardened implementation is way uglier. See PR for details.
Optimize #11087 :
1. In `isReadyToExport`, check if the ip is set. If not, then the user cannot enable xmnote export.
2. Add author field in highlights.
Just prevent page thumbnails ImageWidgets to be nightmode
inverted, unlike all other ones which are expected to be
double inverted to get their original colors shown.
The same thumbnail can be used and cached in both day and
night modes, unless "nightmode_images" is enabled and have
crengine itself invert images, making thumbnails different.
* Bump base
includes:
koreader/koreader-base#1691koreader/koreader-base#1692koreader/koreader-base#1689koreader/koreader-base#1690koreader/koreader-base#1693
* Integrate decoding of SSIDs within wpa_supplicant
The UTF-8 decoding of SSIDs is specific to wpa_supplicant. In this
patch, we move all of this decoding logic to the wpa_supplicant module.
We expose the raw bytes of the SSID to the NetworkMgr code, and make
sure to always fix bad UTF-8 before we display the SSID to the user.
Within the wpa_supplicant module, we replace the call to the
wpa_passphrase binary to get the PSK with a direct function call to
OpenSSL. This allows us to calculate the PSK over any arbitrary bytes,
including UTF-8. In the same vein, we use the hex-encoded SSID to
communicate with wpa_supplicant when setting up the network to support
arbitrary bytes in the SSID.
Unfortunately, we also remove the tests, as there is no way to unit test
local functions.
@ -71,7 +71,7 @@ KOReader is developed and supported by volunteers all around the world. There ar
- document lesser-known features on the [wiki][link-wiki]
- help others with your knowledge on the [forum][link-forum]
Right now we only support [liberapay](https://liberapay.com/KOReader) donations, but you can also create a [bounty][link-bountysource] to motivate others to work on a specific bug or feature request.
Right now we only support [liberapay](https://liberapay.com/KOReader) donations.
@ -17,10 +17,10 @@ Each target has its own architecture and you'll need to setup a proper cross-com
A compatible version of the Android NDK and SDK will be downloaded automatically by `./kodev release android` if no NDK or SDK is provided in environment variables. For that purpose you can use:
If you want to use your own installed tools please make sure that you have the **NDKr15c** and the SDK for Android 9 (**API level 28**) already installed.
If you want to use your own installed tools please make sure that you have the **NDKr23c** and the SDK for Android 9 (**API level 28**) already installed.
text=_("Scan books in current folder and subfolders for their metadata location?"),
ok_text=_("Scan"),
ok_callback=function()
localbooks_to_move=scanPath()
localbooks_to_move_nb=#books_to_move
ifbooks_to_move_nb==0then
UIManager:show(InfoMessage:new{
text=_("No books with metadata not in your preferred location found."),
})
else
UIManager:show(ConfirmBox:new{
text=T(N_("1 book with metadata not in your preferred location found.",
"%1 books with metadata not in your preferred location found.",
books_to_move_nb),books_to_move_nb).."\n"..
_("Move book metadata to your preferred location?"),
ok_text=_("Move"),
ok_callback=function()
UIManager:close(self.menu_container)
for_,bookinipairs(books_to_move)do
DocSettings.updateLocation(book,book)
end
file_chooser:refreshPath()
end,
})
end
end,
})
end
functionBookInfo.showBooksWithHashBasedMetadata()
localheader=T(_("Hash-based metadata has been saved in %1 for the following documents. Hash-based storage may slow down file browser navigation in large directories. Thus, if not using hash-based metadata storage, it is recommended to open the associated documents in KOReader to automatically migrate their metadata to the preferred storage location, or to delete %1, which will speed up file browser navigation."),
-- We default to a flag (G2) that slightly boosts saturation,
-- but it *is* a destructive process, so we want to allow disabling it.
-- @translators CFA is a technical term for the technology behind eInk's color panels. It stands for Color Film/Filter Array, leave the abbreviation alone ;).
@ -119,6 +120,10 @@ function ReaderHandMade:onToggleHandmadeFlows()
end
functionReaderHandMade:addToMainMenu(menu_items)
-- As it's currently impossible to create custom hidden flows on non-touch, and really impractical to create a custom toc, it's better hide these features completely for now.
ifnotDevice:isTouchDevice()then
return
end
menu_items.handmade_toc={
text=_("Custom table of contents")..""..self.custom_toc_symbol,
checked_func=function()returnself.toc_enabledend,
@ -484,6 +489,7 @@ function ReaderHandMade:addOrEditPageTocItem(pageno, when_updated_callback, sele
@ -785,13 +784,123 @@ local BOOK_TWEAK_INPUT_HINT = T([[
%2]],_("You can add CSS snippets which will be applied only to this book."),BOOK_TWEAK_SAMPLE_CSS)
localCSS_SUGGESTIONS={
{"-cr-hint: footnote-inpage;",_("When set on a block element containing the target id of a href, this block element will be shown as an in-page footnote.")},
{"-cr-hint: non-linear-combining;",_("Can be set on some specific DocFragments (ie. DocFragment[id*=16]) to ignore them in the linear pages flow.")},
{"-cr-hint: toc-level1;",_("When set on an element, its text can be used to build the alternative table of contents.")},
{"display: run-in !important,",_("When set on a block element, this element content will be inlined with the next block element.")},
{"font-size: 1rem !important;",_("1rem will enforce your main font size")},
{"hyphens: none !important",_("Disables hyphenation inside the targeted elements.")},
{"text-indent: 1.2em !important;",_("1.2em is our default text indentation.")},
{"font-size: 1rem !important;",_("1rem will enforce your main font size.")},
{"font-weight: normal !important;",_("Remove bold. Use 'bold' to get bold.")},
{"hyphens: none !important;",_("Disables hyphenation inside the targeted elements.")},
{"text-indent: 1.2em !important;",_("1.2em is our default text indentation.")},
{"break-before: always !important;",_("Start a new page with this element. Use 'avoid' to avoid a new page.")},
{"color: black !important;",_("Force text to be black.")},
{"background: transparent !important;",_("Remove any background color.")},
{"max-width: 50vw !important;",_("Limit an element width to 50% of your screen width (use 'max-height: 50vh' for 50% of the screen height). Can be useful with <img> to limit their size.")},
}},
{_("Private CSS properties"),{
{"-cr-hint: footnote-inpage;",_("When set on a block element containing the target id of a href, this block element will be shown as an in-page footnote.")},
{"-cr-hint: non-linear;",_("Can be set on some specific DocFragments (e.g. DocFragment[id$=_16]) to ignore them in the linear pages flow.")},
{"-cr-hint: non-linear-combining;",_("Can be set on contiguous footnote blocks to ignore them in the linear pages flow.")},
{"-cr-hint: toc-level1;",_("When set on an element, its text can be used to build the alternative table of contents. toc-level2 to toc-level6 can be used for nested chapters.")},
{"-cr-hint: toc-ignore;",_("When set on an element, it will be ignored when building the alternative table of contents.")},
{"-cr-hint: footnote;",_("Can be set on target of links (<div id='..'>) to have their link trigger as footnote popup, in case KOReader wrongly detect this target is not a footnote.")},
{"-cr-hint: noteref;",_("Can be set on links (<a href='#..'>) to have them trigger as footnote popups, in case KOReader wrongly detect the links is not to a footnote.")},
{"::before {content: ' '}",_("Insert a visible space before an element.")},
{"::before {content: '\\A0 '}",_("Insert a visible non-breakable space before an element, so it sticks to what's before.")},
{"::before {content: '\\2060'}",_("U+2060 WORD JOINER may act as a glue (like an invisible non-breakable space) before an element, so it sticks to what's before.")},
{"::before {content: '\\200B'}",_("U+200B ZERO WIDTH SPACE may allow a linebreak before an element, in case the absence of any space prevents that.")},
{"::before {content: attr(title)}",_("Insert the value of the attribute 'title' at start of an element content.")},
{"::before {content: '▶ '}",_("Prepend a visible marker.")},
{"::before {content: '● '}",_("Prepend a visible marker.")},
{"::before {content: '█ '}",_("Prepend a visible marker.")},
@ -17,7 +17,6 @@ local ReaderTypeset = WidgetContainer:extend{
-- @translators This is style in the sense meant by CSS (cascading style sheets), relating to the layout and presentation of the document. See <https://en.wikipedia.org/wiki/CSS> for more information.
_("This sets an empty User-Agent stylesheet, and expects the document stylesheet to style everything (which publishers probably don't).\nThis is mostly only interesting for testing.")
))
table.insert(style_table,getStyleMenuItem(
_("Auto"),
nil,
_("This selects the default and preferred stylesheet for the document type."),
nil,
true-- separator
))
localcss_files={}
forfinlfs.dir("./data")do
@ -200,15 +227,39 @@ function ReaderTypeset:genStyleSheetMenu()
Itmaycausesomesmallissuesonsomebooks(miscenteredtitles,headingsorseparators,orunexpectedtextindentation),aspublishersdon't expect to have our added styles at play and need to reset them; try switching to html5.css when you notice such issues.]]),
table.insert(obsoleted_table,getStyleMenuItem(css,css_files[css], _("This stylesheet is obsolete: don't use it. It is kept solely to be able to open documents last read years ago and to migrate their highlights.")))
css_files[css]=nil
end
end
@ -227,7 +278,7 @@ function ReaderTypeset:genStyleSheetMenu()
timev=tev.timev,-- A ref is enough for this table, it's re-assigned to a new object on every SYN_REPORT
}
end
-- Contact object, it'll keep track of everything we need for a single contact across its lifetime
-- i.e., from this contact's down to up (or its *effective* up for double-taps, e.g., when the tap or double_tap is emitted).
-- We'll identify contacts by their slot numbers, and store 'em in GestureDetector's active_contacts table (hash).
@ -139,7 +149,7 @@ function GestureDetector:newContact(slot)
state=Contact.initialState,-- Current state function
slot=slot,-- Current ABS_MT_SLOT value (also its key in the active_contacts hash)
id=-1,-- Current ABS_MT_TRACKING_ID value
initial_tev=nil,-- Copy of the input event table at first contact (i.e., at contact down)
initial_tev=nil,-- Copy of the input event table at first contact (i.e., at contact down [iff the platform is sane, might be a copy of current_tev otherwise])
current_tev=nil,-- Pointer to the current input event table, ref is *stable*, c.f., NOTE in feedEvent below
down=false,-- Contact is down (as opposed to up, i.e., lifted). Only really happens for double-tap handling, in every other case the Contact object is destroyed on lift.
pending_double_tap_timer=false,-- Contact is pending a double_tap timer
@ -157,6 +167,12 @@ function GestureDetector:newContact(slot)
-- If we have a buddy contact, point its own buddy ref to us
-- Must be a class member, both because Input is a singleton and that state is process-wide anyway.
opened_devices={},
}
functionInput:new(o)
@ -223,6 +225,10 @@ function Input:init()
},
}
-- Always send pen data to a slot far enough away from our main finger slot that it can never be matched with a finger buddy in GestureDetector (i.e., +/- 1),
-- with an extra bit of leeway, since we don't even actually support three finger gestures ;).
self.pen_slot=self.main_finger_slot+4
self.gesture_detector=GestureDetector:new{
screen=self.device.screen,
input=self,
@ -246,8 +252,9 @@ function Input:init()
end
-- set up fake event map
self.event_map[10000]="IntoSS"-- go into screen saver
self.event_map[10001]="OutOfSS"-- go out of screen saver
self.event_map[10000]="IntoSS"-- Requested to go into screen saver
self.event_map[10001]="OutOfSS"-- Requested to go out of screen saver
self.event_map[10002]="ExitingSS"-- Specific to Kindle, SS *actually* closed
self.event_map[10010]="UsbPlugIn"
self.event_map[10011]="UsbPlugOut"
self.event_map[10020]="Charging"
@ -293,14 +300,97 @@ function Input:disableRotationMap()
-- NOTE: We do *NOT* send a broadcast manually, and instead rely on the main loop's sendEvent:
-- this ensures that only widgets that actually know how to handle a rotation will do so ;).
returnEvent:new("SetRotationMode",rotation)
end
end
end
@ -1053,29 +1171,29 @@ function Input:initMtSlot(slot)
end
end
functionInput:getMtSlot(slot)
returnself.ev_slots[slot]
end
functionInput:getCurrentMtSlot()
returnself.ev_slots[self.cur_slot]
end
functionInput:setMtSlot(slot,key,val)
self.ev_slots[slot][key]=val
end
functionInput:setCurrentMtSlot(key,val)
self:setMtSlot(self.cur_slot,key,val)
self.ev_slots[self.cur_slot][key]=val
end
-- Same as above, but ensures the current slot actually has a live ref first
functionInput:setCurrentMtSlotChecked(key,val)
if#self.MTSlots==0then
ifnotself.active_slots[self.cur_slot]then
self:addSlot(self.cur_slot)
end
self:setMtSlot(self.cur_slot,key,val)
end
functionInput:getMtSlot(slot)
returnself.ev_slots[slot]
end
functionInput:getCurrentMtSlot()
returnself:getMtSlot(self.cur_slot)
self.ev_slots[self.cur_slot][key]=val
end
functionInput:getCurrentMtSlotData(key)
@ -1102,22 +1220,13 @@ function Input:addSlot(value)
self.cur_slot=value
end
functionInput:addSlotIfChanged(value)
ifself.cur_slot~=valuethen
-- We've already seen that slot in this frame, don't insert a duplicate reference!
ifself.active_slots[value]then
self.cur_slot=value
else
self:addSlot(value)
end
end
end
functionInput:setupSlotData(value)
if#self.MTSlots==0then
ifnotself.active_slots[value]then
self:addSlot(value)
else
self:addSlotIfChanged(value)
-- We've already seen that slot in this frame, don't insert a duplicate reference!
-- NOTE: May already be set to the correct value if the driver repeats ABS_MT_SLOT (e.g., our android/PB translation layers; or ABS_MT_TRACKING_ID for snow_protocol).
night_mode={category="none",event="ToggleNightMode",title=_("Toggle night mode"),screen=true},
set_night_mode={category="string",event="SetNightMode",title=_("Set night mode"),screen=true,args={true,false},toggle={_("on"),_("off")},separator=true},
----
@ -131,12 +135,14 @@ local settingsList = {
open_next_document_in_folder={category="none",event="OpenNextDocumentInFolder",title=_("Open next document in folder"),reader=true,separator=true},
title=_("Ignore tables related HTML presentational hints"),
description=_("Ignore HTML attributes that contribute to styles on the <table> element and its sub-elements (ie. align, valign, frame, rules, border, cellpadding, cellspacing…)."),
text=T(_("KOReader %1\n\nA document viewer for E Ink devices.\n\nLicensed under Affero GPL v3. All dependencies are free software.\n\nhttp://koreader.rocks"),BD.ltr(Version:getCurrentRevision())),
icon="koreader",
})
end
UIManager:sendEvent(Event:new("ShowMenuSearch"))
end,
keep_menu_open=true,
}
common_info.report_bug={
text=_("Report a bug"),
text_func=function()
locallabel=_("Report a bug")
ifG_reader_settings:isTrue("debug_verbose")then
label=label.."".._("(verbose logging is enabled)")
localcommon_msg=T(_("Please report bugs to \nhttps://github.com/koreader/koreader/issues\n\nVersion:\n%1\n\nDetected device:\n%2"),
Version:getCurrentRevision(),Device:info())
locallog_msg=T(_("Attach %1 to your bug report."),log_path)
locallog_msg=T(_("Verbose logs will make our investigations easier. If possible, try to reproduce the issue while it's enabled, and attach %1 to your bug report."),log_path)
text=T(_("KOReader %1\n\nA document viewer for E Ink devices.\n\nLicensed under Affero GPL v3. All dependencies are free software.\n\nhttp://koreader.rocks"),BD.ltr(Version:getCurrentRevision())),
localmetadata_folder_help_doc=T(_(" - alongside the book file itself (the long time default): sdr folders will be visible when you browse your library directories with another file browser or from your computer, which may clutter your vision of your library. But this allows you to move them along when you reorganize your library, and also survives any renaming of parent directories. Also, if you perform directory synchronization or backups, your settings will be part of them."))
localmetadata_folder_help_dir=T(_(" - all in %1: sdr folders will only be visible and used by KOReader, and won't clutter your vision of your library directories with another file browser or from your computer. But any reorganisation of your library (directories or filename moves and renamings) may result in KOReader not finding your previous settings for these books. These settings won't be part of any synchronization or backups of your library."),DataStorage:getDocSettingsDir())
localmetadata_folder_help_hash=T(_(" - all inside %1 as hashes: sdr folders are identified not by filepath/filename but by partial MD5 hash, allowing you to rename, move, and copy documents outside of KOReader without sdr folder clutter while keeping them linked to their metadata. However, any file modifications such as writing highlights into PDFs or downloading from calibre may change the hash, and thus lose their linked metadata. Calculating file hashes may also slow down file browser navigation. This option may suit users with multiple copies of documents across different devices and directories."),DataStorage:getDocSettingsHashDir())
_("Book view settings, reading progress, highlights, bookmarks and notes (collectively known as metadata) are stored in a separate folder named <book-filename>.sdr (\".sdr\" meaning \"sidecar\")."),
"",
_("You can decide between three locations/methods where these will be saved:"),
_(" - alongside the book file itself (the long time default): sdr folders will be visible when you browse your library directories with another file browser or from your computer, which may clutter your vision of your library. But this allows you to move them along when you reorganize your library, and also survives any renaming of parent directories. Also, if you perform directory synchronization or backups, your settings will be part of them."),
T(_(" - all in %1: sdr folders will only be visible and used by KOReader, and won't clutter your vision of your library directories with another file browser or from your computer. But any reorganisation of your library (directories or filename moves and renamings) may result in KOReader not finding your previous settings for these books. These settings won't be part of any synchronization or backups of your library."),metadata_folder_str.dir),
T(_(" - all inside %1 as hashes: sdr folders are identified not by filepath/filename but by partial MD5 hash, allowing you to rename, move, and copy documents outside of KOReader without sdr folder clutter while keeping them linked to their metadata. However, any file modifications such as writing highlights into PDFs or downloading from calibre may change the hash, and thus lose their linked metadata. Calculating file hashes may also slow down file browser navigation. This option may suit users with multiple copies of documents across different devices and directories."),metadata_folder_str.hash),
localhash_filemod_warn=T(_([[%1 requires calculating partial file hashes of documents which may slow down file browser navigation. Any file modifications (such as embedding annotations into PDF files or downloading from calibre) may change the partial hash, thereby losing track of any highlights, bookmarks, and progress data. Embedding PDF annotations is currently set to "%s" and can be disabled at (⚙ → Document → Save Document (write highlights into PDF)).]]),DataStorage:getDocSettingsHashDir())
localleaving_hash_sdr_warn=T(_("Warning: You currently have documents with hash-based metadata. Until this metadata is moved by opening those documents, or deleted, file browser navigation may remain slower."))
localhash_filemod_warn=T(_("%1 requires calculating partial file hashes of documents which may slow down file browser navigation. Any file modifications (such as embedding annotations into PDF files or downloading from calibre) may change the partial hash, thereby losing track of any highlights, bookmarks, and progress data. Embedding PDF annotations is currently set to \"%s\" and can be disabled at (⚙ → Document → Save Document (write highlights into PDF))."),metadata_folder_str.hash)
localleaving_hash_sdr_warn=_("Warning: You currently have documents with hash-based metadata. Until this metadata is moved by opening those documents, or deleted, file browser navigation may remain slower.")
localfunctiongenMetadataFolderMenuItem(value)
return{
@ -574,7 +566,7 @@ local function genMetadataFolderMenuItem(value)
Onlyfontsnamed"Noto Sans xyz"or"Noto Sans xyz UI"(regular,notboldnoritalic,notSerif)willbeavailableinthismenu.However,boldfontswillbeusediftheircorrespondingregularfontsexist.]])
Onlyfontsnamed"Noto Sans xyz"or"Noto Sans xyz UI"(regular,notboldnoritalic,notSerif)willbeavailableinthismenu.However,boldfontswillbeusediftheircorrespondingregularfontsexist.]]),"","<EFBFBD><EFBFBD>")