Commit Graph

76 Commits (bf6c0cdd6c5b22bbb38497b5df8abe428eb80307)

Author SHA1 Message Date
NiLuJe bf6c0cdd6c
LuaSettings: Add a method to initialize a setting properly (#7371)
* LuaSettings/DocSettings: Updated readSetting API to allow proper initialization to default.
Use it to initialize tables, e.g., fixing corner-cases in readerFooter that could prevent settings from being saved.
(Fixes an issue reported on Gitter).
* LuaSettings/DocSettings: Add simpler API than the the flip* ones to toggle boolean settings.
* Update LuaSettings/DocSettigns usage throughout the codebase to use the dedicated boolean methods wher appropriate, and clean up some of the more mind-bending uses.
* FileChooser: Implement an extended default exclusion list (fix #2360)
* ScreenSaver: Refactor to avoid the pile of kludges this was threatening to become. Code should be easier to follow and use, and fallbacks now behave as expected (fix #4418).
3 years ago
NiLuJe d8fc28df97
Page Overlap: Fix rectangle computation and arrow mode (#7269)
* In ReaderPaging, the panning step pre-PanningUpdate can be wildly overshot near page edges, so, use the corrected value instead by recomputing it after the panning has been effectively computed by ReaderView.
This fixes slight inaccuracies, as well as glaring mistakes when going backwards, or when near page edges.
This is in line with how ReaderRolling computes the value, which I only realized later because I'm an idiot. 
* Minor cleanups around the handling of the dim_area Geom object in general.

* Fix the "Arrow" page overlap mode to be painted in the right coordinates when going backward. Issue might not have been terribly clear because of the previous issue ;).
* Center the arrow's point, while we're here.
* Don't use AlphaContainer to make it translucent, because AlphaContainer is horribly broken, and has weird quirks and behavior that make no sense to me unless some very specific and unlikely constraints are met, and they definitely aren't here.
This fixes the arrow copying an arrow-sized square of the original page the book was opened on on the top-left corner of *every* page with an arrow. (lol).
* Do real proper alpha-blending via Icon/ImageWidget from the original icon, instead of faking it via addBlitFrom, in order to avoid the dimming *around* the triangle's shape.
3 years ago
poire-z 8f79c662cf Notification: closed by any event, but not consuming it
Make Notification have toast=true, and UIManager deal
specifically with such widget:
a "toast" widget gets closed by any event, and let
the event be handled by a lower widget.
This should allow us to not wait or tap to get rid
of a notification, and just go on with what we're
doing.
Also make them have a default timeout of 2s,
used with all existing ones.
3 years ago
jperon 3d8342a98c
Fix #6929 (#6930)
A check was missing on a flag not defined for images.
3 years ago
jperon 8eeb010dc9
Paged documents: rework zoom options (#6885)
- 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
3 years ago
Jellby 5e3c554dd7 Hide non-linear fragments
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.
4 years ago
poire-z 8403154d4d
Reader: rationalize "Back" key/action handling (#6840)
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.
4 years ago
yparitcher 70f89c4df1
ReaderGesture: cleanup (#6292)
convert all gesture actions to use events for better modularity
add network event handlers and device event handlers
4 years ago
Frans de Jonge 86db43a052
[UX] Move double tap to gesture manager (#6322)
Also replaces the default with +10/-10 pages instead of prev/next chapter.

Closes <https://github.com/koreader/koreader/issues/2721>.
4 years ago
Frans de Jonge 4a65cc666b
[UX] Implement hasFewKeys prototype (#6195)
This is a quick exploration into how the new Device:hasFewKeys() method could work to make things more usable on very limited devices.

In the reader, the right is repurposed to open the menu. Left in turn closes it.

The same principle is applied to ButtonDialog. This means you can select anything in principle, but once you go right you can't go back.

References <https://github.com/koreader/koreader/issues/4029>.
4 years ago
yparitcher b578d8aa8b Fix continuous scroll & footer overlap (#5657)
closes  #5654

like #5620 but for continuous mode.
4 years ago
poire-z 7952fa2c09 [RTL UI] update widgets and apps for UI mirroring
Small tweaks all around to handle UI mirroring:
- swap existing symbols like arrows, or use alternative ones
- rotate some images, like chevrons and dogear icons
- flip some left and right swipe handling
- flip some geometry arithmetic like tap on left or right
  side of page or dict window
- use new ProgressWidget:getPercentageFromPosition() instead
  of geometry arithmetic
- BD.wrap() some concatenated string bits, like in reader
  and menu footers
- flip inverse_reading_order when UI is mirrored

More specific tweaks:
- ReaderGesture: reset some specific gestures when UI direction
  has changed (tap on top/bottom left/right corners, for
  bookmarks and FileManager "Plus menu").
- ReaderRolling: show markers on the correct side of page,
  in single or dual page mode.
- KoptOptions: swap left and right icons in Alignment toggle
- CheckMark: proper rendering in all 4 mirroring/rtl combinations.
- VirtualKeyboard: forbid any mirroring
- Move util.getMenuText into Menu.lua
4 years ago
yparitcher 6d3e7fcef6 [fix] PDF footer margins (#5620)
closes #5612 

the change in `ReaderView:recalculate()` causes the viewable page size to be calculated by not including the footer, causing the text not to get cut off.

since the page area was not drawing under the footer `ReaderView:drawPageSurround()` had to be fixed to draw the margin under the footer so when tapping the footer off the area should be dran the background color.
5 years ago
yparitcher 83b7d8de2b [UX] Default setting option always enabled (#5580)
as per https://github.com/koreader/koreader/pull/5522#issuecomment-548006595 do not grey out the current default
5 years ago
yparitcher aa165cefe9 [UX] Set global settings independent of local setting (#5522) 5 years ago
Robert 5209493ba8 [UX] Option to show progress bar at the bottom of the screen (#5442) 5 years ago
yparitcher 09d49e29ad [UX] Add inverse reading order to gesture manager (#5423)
Also fixes #5354.
5 years ago
Frans de Jonge ed4396821f
[fix] ReadSettings Inverse reading order (#5350)
`self.inverse_reading_order == nil and G_reader_settings:has("inverse_reading_order")` could easily be false, which would then incorrectly turn the setting off.

Fixes <https://github.com/koreader/koreader/issues/5346>.
5 years ago
Frans de Jonge f1f6eebce0
[feat] Add MuPDF EPUB/FB2 dynamic font size (#5282)
Closes #4368.
5 years ago
Frans de Jonge ac16c8d547
[UX] Treat inverse_reading_order as a proper setting (#5284)
This is supported by ReaderPaging and ReaderRolling, but the menu entry was only shown in ReaderPaging.

Hold now sets the global default.

Fixes <https://github.com/koreader/koreader/issues/4983>.
Fixes <https://github.com/koreader/koreader/issues/4089>.
5 years ago
Frans de Jonge dd4bfb0a45
[UX] Ignore page flipping toggle while bookmark flipping (#5276)
See https://github.com/koreader/koreader/issues/5265#issuecomment-525626930
5 years ago
Frans de Jonge 2104bb6f98
[fix] Distinguish bookmark/page flipping in menu (#5266)
Fixes <https://github.com/koreader/koreader/issues/5265>.
5 years ago
Frans de Jonge a2dcfe9aec
[doc] Tag @todo, @fixme and @warning (#5244)
This commit standardizes the various todos around the code a bit in a manner recognized by LDoc.

Besides drawing more attention by being displayed in the developer docs, they're also extractable with LDoc on the command line:

```sh
ldoc --tags todo,fixme *.lua
```

However, whether that particular usage offers any advantage over other search tools is questionable at best.

* and some random beautification
5 years ago
Robert 803a143764 [sdl] Add support arrow key for next/prev page (#5149)
Close: #4997 
This PR add support arrow key and mouse scroll wheel for next/previous page.

- Document in page mode:

PageDown, Arrow down, Arrow right - go to next page
PageUp, Arrow up, arrow left - go to prev page
Mouse scroll wheel down - go to next page
Mouse scroll wheel up - go to prev page

- Document in scroll mode:

PageDown, Arrow right - go to next page
PageUp, Arrow, arrow left - go to prev page
Arrow down - scroll document down
Arrow up - scroll document up
Mouse scroll wheel down - scroll document down
Mouse scroll wheel up - scroll document up
5 years ago
poire-z cfd562697f
Fix Color rendering toggle not toggable (#4836)
Also refresh screen when toggling.
5 years ago
Frans de Jonge ba4bf7243d
[chore] Deprecate TapForward/TapBackward (#4689)
Also fix previous page action in gesture manager.
5 years ago
poire-z 1e4469fec2 [UX] Gesture manager: add actions - prev/next chapter (#4692)
Also adds rudimentary support for these in ReaderPaging.
5 years ago
Frans de Jonge 4547b2d65f
[fix] GestureDetector: add PAN_DELAYED_INTERVAL (#4666)
When multiswipes are enabled, this fixes the long-standing complaint that swiping to open the menu could unintentionally trigger some light panning. With the introduction of multiswipes, this problem has become more noticeable.
5 years ago
NiLuJe b274080846
Some more repaint/refresh tweaks (#4578)
* ReaderView & ReaderPaging panning should *probably* keep using "partial" ;). (Fix #4575)
* Try to avoid unnecessary footer repaints (mini status bar)
5 years ago
NiLuJe 8189945be9
A few graphics fixes after #4541 (#4554)
* Various FocusManager related tweaks to limit its usage to devices with a DPad, and prevent initial button highlights in Dialogs on devices where it makes no sense (i.e., those without a DPad. And even on DPad devices, I'm not even sure how we'd go about making one of those pop up anyway, because no Touch ;)!).
* One mysterious fix to text-only Buttons so that the flash_ui highlight always works, and always honors `FrameContainer`'s pill shape. (Before that, an unhighlight on a text button with a callback that didn't repaint anything [say, the find first/find last buttons in the Reader's search bar when you're already on the first/last match] would do a square black highlight, and a white pill-shaped unhighlight (leaving the black corners visible)).
The workaround makes *absolutely* no sense to me (as `self[1] -> self.frame`, AFAICT), but it works, and ensures all highlights/unhighlights are pill-shaped, so at least we're not doing maths for rounded corners for nothing ;).
5 years ago
poire-z 895589ddaa
Page overlap menu (cre): set nb of overlap lines (#4538)
Make this existing setting tunable with a menu item.
Also make the Page overlap and Highlight menus use a
checkbox, and their items grayed out when disabled.
5 years ago
FranMarelli 229c492979 [feat] Two-column navigation (#3674)
New zoom configuration available among the others
Allows to easily navigate in two-column documents
In order to  work properly, **scroll mode must be deactivated**
The best zoom is obtained with proper cropping around the two columns (should be the default one for content-width)

Fixes #501
6 years ago
poire-z 53f083f516 Allow for toggling color rendering
New menu item in Screen submenu.
hasColorScreen enabled for SDL device.
7 years ago
Frans de Jonge a970a1f034 MenuSorter: fix outside testability (for potential unit tests) 7 years ago
Frans de Jonge b7b5950e98 MenuSorter: review comments and various bug fixes
* fixed wrongful retention of submenus variable and added return to MenuSorter:findById
* fixed readerfooter_spec.lua error
* fixed review comments
7 years ago
Frans de Jonge 5b20106db7 MenuSorter: initial implementation
* Menus are now sanely configurable
* Custom separator placement for clearer menus
7 years ago
robert00s a2bfc3858d changes after comments 7 years ago
robert00s 4479d686a0 Refresh status bar after resume 7 years ago
Qingping Hou a943b73303 fix: adjust pan rate for eink and non-eink screens 7 years ago
poire-z 39d1afe37d Update footer when refreshing screen with diagonal swipe
And added diagonal swipe support to readerrolling.
7 years ago
Qingping Hou f95ad00b9e feat: add logger module & rewrite kobo suspend script in lua 7 years ago
Qingping Hou 0c49b915de refactor: add touch zone subsystem to inputcontainer
Touch zone decouples screen size from gesture event registration.

The win here is each individual widget does not need to update
gesture range on screen rotate/resize anymore.

Another advantage is we now have a centralized ordered array to handle
all registered touch event listeners, makes it much easier to resolve
gesture range conflicts between multiple widgets.

This patch also includes the following changes:

* migrate readerpaging to use readerui's touch zone
* migrate readerfooter to use readerui's touch zone
* move inverse read direction setting to touch menu's setting tab
* moved kobolight widget from readerview into readerui
* various dead code cleanups and comments
8 years ago
Qingping Hou cd24eb82d7 readerpaging(fix): handle edge cases where paging pan will crash the reader 8 years ago
Qingping Hou c619de324e chore: more luacheck fixes 8 years ago
Qingping Hou f30e487959 readerpaging(fix): set the corrent page number on GoBackLink event 8 years ago
chrox 551857ce6e fix some luacheck warnings 8 years ago
chrox 5983050d79 PDF free zoom mode revisit
this should implement feature request of zoom mode for multi-columns
page in #501
This PR depends on koreader/koreader-base#435

How to use?
1. Tap the top left corner of a PDF/Djvu page to get into the flipping
mode
2. Double-tap on text block will zoom in to that column
3. Double-tap on any area will zoom out to an overview of the page
4. repeat step 2 to focus to another page block

How does it work?
1. We first find the mask of text blocks in the page. (Pic 1)
2. Then we intersect page boxes with user tap to form a page block. (Pic 2)
3. Finally we zoom the page to the page block and center current view to
that block. (Pic 3)
8 years ago
chihyang a948ecb19a Add 'read from right to left' in readerrolling
- Fix problems in readerpaging.lua;
- Add the same feature in readerrolling.lua.
8 years ago
chihyang c161bc2f79 Add a new feature 'read from right to left'
A new feature 'read from right to left' is added, which is more fit for
Traditional Chinese and Japanese books. Once the feature is enabled:
1. The gesture region of TapForward and area will be flipped
horizonally;
2. The action for swiping to west and to east will be exchanged.
8 years ago
Qingping Hou 467199285f minor: rename Koreader to KOReader 8 years ago