Don't cleanup input text as much when entered manually
(or when it's sane) than when coming from book text
selection.
This may allow looking up words like "-suffix", or
do more precise Wikipedia queries.
Brainfart from 6162c287e8
Forgot to zap the original UIManager:show(), so we were stacking two
identical widgets on top of each other, which obviously affected alpha.
Re #7029
- Rework widget layout to avoid implicit (and wrong)
sizing, using proper padding/margins and correct
measurements of components.
- Adjust lookup word font size so it's not smaller
than the definition.
- Tweak small window positionning: keep it centered
if possible, only move it to keep the highlighted
word shown when we can.
- Large window: adjust to screen size correctly,
leaving room for footer.
- Always have a "Close" button at bottom right.
Former always displayed button "Follow link" will
be added as a 3rd row in the rare case we select
a word in a link.
- Replace "tap on lookup word to edit and redo the
query" with an icon on the right: tap on it to
edit the queries word, long-press to edit the
current result word. Only close the current dict
window when lookup is launched.
- Remove feature "tap on title to set current dict
as the default dict for this document", as it didn't
really work, and it was bad UX.
If interrupted quickly just after lookup launch, don't
display anything (this might help avoiding refreshes
and the need to dismiss after accidental long-press
when manipulating the device).
- InfoMessage: add an option show_delay.
- MovableContainer: avoid possible crash when
not yet painted.
- ReaderDictionary: use show_delay=0.5 instead of
scheduleIn(0.5n...) (a5b133da) as we need the
InfoWidget to be known to UIManager to catch tap
and allow interrupting lookups properly.
- ReaderDictionary: rework handling of no_refresh_on_close
(6162c287) with proper regions comparisons
Drop the use of crengine's getWordFromPosition() which
is a bit unreliable: it may returns wrong coordinates,
or words from far away in the book (ie. when holding
in the margins).
Rely only on the robust getTextFromPositions() that
we already use for multi words selection.
Having good coordinates allows refreshing a smaller region
(the higlighted word, or the 2 lines if hyphenated).
That way images can be made to work in a more generic, portable manner, such as:
```
return function(html, dict_path)
html = html:gsub('<rref[^>]*>([^<]*%.jpg)</rref>', '<img src="'..dict_path..'res/%1">')
return html
end
```
Cf. <https://github.com/koreader/koreader/issues/6056>.
- Add IconWidget, use it for icons instead of ImageWidget.
Specify icons by name only, look for them (with either
.svg or .png suffixes) in multiple directories (including
koreader/settings/icons/ to allow customizing them).
Don't crash when icon name not found, shown a black
background warning icon instead.
- Don't trust the icons' native sizes: replace
scale_for_dpi=true with width/height=DGENERIC_ICON_SIZE,
so all icons get the same (tunable) size - except in
a few specific use cases.
- Top and bottom menu bars: normalize, and have icons
properly centered in them, extend vertical line
separators up to the edges.
- TOC: adjust expand/collapse icons size to items size
* ReaderFooter:
* Honor the global twelve_hour_clock setting, instead of
duplicating a local one.
(Re #6969)
* os.date is a thin wrapper around strftime, so we might be able to get
away with some not-quite-standard extensions...
These are *definitely* supported on Linux, but are *NOT* the glibc
extension (that'd be e.g., %-I), so, hopefully, they're somewhat
portable...
They are also supported on BSD/macOS.
They are *not* supported by the MS UCRT. That means MinGW-w64, too.
This *appears* to be supported on current Bionic (it might even support
said glibc format altering extensions).
* And of course, Windows is terrible, so, make this terribly ugly to not
break it there...
* Turns out BSD also supports the dash trim format extension, so, leave
the trimming to the libc, and handle the special-casing in a way that
doesn't create stupid locals.
* Random unrelated cleanup ^^.
(https://gitter.im/koreader/koreader?at=5fd24be492aa1c4ef5d11f31)
* Update the testsuite
(Because the default used to be 24h clock).
Changed the default to 24h clock ;p.
* Explain why we don't try to fix it in Lua
* ReaderDictionary: Don't refresh when dimissing the lookup info
InfoMessage
Re #6932
* Fix dict_largewindow in Landscape
Have to leave some room for the UI chrome
* Top menu & bottom menu tapzones are now full-width, thanks to the now sane override system.
* A separate, extra tapzone was also created for each of them to provide a taller, but narrower tapzone extension (one that doesn't clash with the prev/next tapzones).
* The footer tapzone was made much taller.
nextTick was too early ;).
Prevents small hitches when turning the page for the page where this
triggers.
Apply the same trickery to the Stats DB insert, even if that one probably
had a much smaller impact.
* Warn on restart if the startup script has been updated, because a restart will not reload it.
* Also warn right after the update if it contained a startup script update...
- Move zoom options from top menu to bottom config
- Add option to manually define zoom (relative to
page width) and overlap (in percent)
- Add options to zoom to columns or rows, possibly
with overlap. Add panning direction options when
page forward in these modes
Some stuff was still hacked on manually instead of trusting the widget system to do things right, which it does, if you update the right stuff at the right time the right way ;). *This Is The Way*.
Fix#6893 (and address https://github.com/koreader/koreader/pull/6878#discussion_r523411883, because it was indeed redundant ^^).
Includes a bonus fix for a number of (footer) settings not being applied immediately in PDFs.
Add option to hide (skip) non-linear fragments, only working
in 1-page mode. Tweaks mostly to footer, toc and skim code
to make it clear(er) which pages belong to linear or non-linear
fragments.
* Use a CRe set* method when toggling nightmode
This ensures it gets flagged as add_reset by the call cache, and that
CRe will actually re-render, as it's necessary if nightmode_images is
enabled (the default).
Fix#6845
* Prevent ReaderHighlight:onTap from running ReaderHighlight:clear when
it's unnecessary.
Avoiding a clearSelection call in CRe that could invalidate the cache
and cause unnecessary redraws.
* Don't store empty highlight arrays when all HLs on a page have
been deleted
Have ReaderBack be the sole handler of onBack.
Add 4 mutually exclusive options for the Back key,
to avoid ReaderLink and ReaderBack location stacks
from interfering (ReaderBack's stack being always a
superset of ReaderLink's stack).
So, remove "Enable back history", which is replaced
by Back option "Go to previous read page".
Fix a few possible crashes and inconsistencies (when
zoom, scroll or reflow have changed) with ReaderPaging
and ReaderView when restoring previous page/view.
* When auto_refresh_time is enabled, don't actually refresh anything when the footer is hidden.
* Fix a bunch of state tracking related to height computations, meaning `getHeight()` is now actually accurate, always, and we don't need shitty workarounds anymore.
* `footer_container.dimen.h` *includes* the progress bar, so, never reset it to 0 unless the progress bar is disabled (some `settings.progress_bar_position` codepaths were mistakenly doing just that).
* More aggressively set/reset `footer_text.height` (not sure this one makes much of a difference, and/or if it's actually useful at all, but, the tracking was already there, but hella inconsistent, so, just fix it).
* Honor `settings.reclaim_height` in other bits of code that were only checking `footer_visible` to figure out the visible page area.
* Ask ReaderView to update the `visible_area` *now* when toggling the footer's visibility (for ReaderPaging).
* Update the data collection format & handler to make it much less tortuous
* Update the pagecount & resync the stats on document layout changes
* Update the database schema to allow doing most queries against a SQL view that rescales the collected data to be accurate regardless of document layout (thanks to @marek-g for the SQL magic ;)).
* Add a "reset stats for current book" entry in the list of reset options, one that won't horribly break stats in said book ;).
* Fixed a couple of resource (SQL connection) leaks (in ReaderStatistics:getCurrentBookStats & ReaderStatistics:getCurrentBookStats).
* Flush stats to the DB on periodical metadata saves.
* Minor cosmetic tweaks to the code
Includes:
- (Upstream) various unimpacting changes to keep in sync
- (Upstream) Fix issues with legacy text rendering
- (Upstream) FB3/DocX/ODT: get lang and description metadata
- (Upstream) remove some global settings, make them per-doc
- TextLang, hyphenation: add Armenian, Friulian, Piedmontese,
Romansh, Zulu and Brazilian Portuguese.
Also make cre the prefered engine for .xhtml (over MuPDF)
and for .xml (which might be HTML).