Commit Graph

65 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 fe10d0bce5
Revamp flash_ui handling, once more, with feeling ;) (#7262)
* Simplify flash_ui handling (by handling the unhighlight pre-callback, c.f., #7262 for more details).
* UIManager: Handle translucent window-level widgets (and those wrapped in a translucent MovableContainer) properly in setDirty directly, making sure what's *underneath* them gets repainted to avoid alpha layering glitches. (This was previously handled via localized hacks).
* Update UIManager's documentation, and format it properly for ldoc parsing, making the HTML docs more useful.
* ReaderView: Reinitialize the various page areas when opening a new document, to prevent poisoning from the previous document.
* Event: Handle nils in an event's arguments.
* CheckButton/RadioButton: Switch to simple inversion to handle highlighting
* CheckButton: Make the highlight span the inner frame's width, instead of just the text's width, if possible.
* AlphaContainer: Fix & simplify, given the UIManager alpha handling.
* MovableContainer: When translucent, cache the canvas bb used for composition.
* Avoid spurious refreshes in a few widgets using various dummy *TextWidgets in order to first compute a text height.
* KeyValuePage: Avoid floats in size computations.
3 years ago
poire-z 3b89e32069 [UX] Add ToC/Bookmarks settings
- Menu widget: allow specifying the number of items per
  page and the item font size, so we can use other values
  than the default File browser ones
- Menu: fix setDirty when a border is used
- ToC: add item per page and font size settings, make
  Alternative ToC more visible (was previously
  available on long-press on Table of contents)
- Bookmarks: add item per page, font size, size reduction
- Progress bars (Skim widget and footer): allow selecting
  ToC depths from which ticks are made.
3 years ago
NiLuJe d4d5dd25ba TextViewer: Allow tweaking the region of the refresh done on close.
Use it in ReaderBookmarks to clear flash_ui highlights.

Fix #7230
3 years ago
poire-z e74c28efa9 CRe TOC, Bookmarks: show marker when jumping 3 years ago
NiLuJe df0bbc9db7
Tame some ButtonTable users into re-using Buttontable instances if possible (#7166)
* QuickDictLookup, ImageViewer, NumberPicker: Smarter `update` that will re-use most of the widget's layout instead of re-instantiating all the things.
* SpinWidget/DoubleSpinWidget: The NumberPicker change above renders a hack to preserve alpha on these widgets almost unnecessary. Also fixed said hack to also apply to the center, value button.

* Button: Don't re-instantiate the frame in setText/setIcon when unnecessary (e.g., no change at all, or no layout change).
* Button: Add a refresh method that repaints and refreshes a *specific* Button (provided it's been painted once) all on its lonesome.

* ConfigDialog: Free everything that's going to be re-instatiated on update
 
* A few more post #7118 fixes:
  * SkimTo: Always flag the chapter nav buttons as vsync
  * Button: Fix the highlight on rounded buttons when vsync is enabled (e.g., it's now entirely visible, instead of showing a weird inverted corner glitch).
  * Some more heuristic tweaks in Menu/TouchMenu/Button/IconButton
* ButtonTable: fix the annoying rounding issue I'd noticed in #7054 ;).

* Enable dithering in TextBoxWidget (e.g., in the Wikipedia full view). This involved moving the HW dithering align fixup to base, where it always ought to have been ;).

* Switch a few widgets that were using "partial" on close to "ui", or, more rarely, "flashui". The intent being to limit "partial" purely to the Reader, because it has a latency cost when mixed with other refreshes, which happens often enough in UI ;).

* Minor documentation tweaks around UIManager's `setDirty` to reflect that change.

* ReaderFooter: Force a footer repaint on resume if it is visible (otherwise, just update it).
* ReaderBookmark: In the same vein, don't repaint an invisible footer on bookmark count changes.
3 years ago
Frans de Jonge a96181d74f
Fix typo in "remove bookmark?" (#7062) 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
zwim f24d6f8aea
Update statusline immediately when toggling a bookmark (#6872) 4 years ago
smartscripts-nl 16ece06d45
[UX] Add bookmark count as footer item (#6629)
Optionally display number of bookmarks in footer. If no bookmarks defined, don't show this item
4 years ago
poire-z 27e953b127 Bookmarks: avoid possible crash
(Not sure how and with what this check works and if
we still get such kind of items, but avoid a crash
when item2.pos0 exists but item1.pos0 does not.)
4 years ago
yparitcher 2f3fda3fe8
allow some strings to be translated (#6428) 4 years ago
poire-z 9385728769
Bookmarks prev/next via gestures: add location to stack (#6306)
Was correctly done when jumping bookmarks via the Bookmarks
menu and the SkimTo widget, but not from gestures.
Also prevent fillToc() on each page turn when book has no TOC.
4 years ago
Galunid cd440acdc4
Add chapter title when exporting notes in Evernote (JSON/HTML, remote) (#6146)
closes #4566
closes #6138
4 years ago
poire-z 39345704ec
Statistics: fix number of highlights (#6173)
This number might have been leaking from a previously opened
book, and can be innacurate.
Reset it from the number of highlights stored in settings.
Note that the number of "Notes" shown does not mean much.
4 years ago
poire-z 026140f809 Adds ReaderPageMap, to optionally show source pages numbers
bump crengine: support for EPUB3 nav toc and page maps
Includes:
- Fix lvRect:isRectInside(rc) with 0-width or 0-height rect
- TOC: parse EPUB3 nav toc, fallback to spine when no toc
- Parse and cache various hardcopy page list maps
- epub.css: hide EPUB3 <span epub:type="pagebreak"> content
cre.cpp: add a few PageMap helper functions.

Adds ReaderPageMap which will add a new menu (under TOC and
Bookmarks) that will allow:
- to list source page numbers (like a TOC)
- to show visible page labels in the right margin
- to use these source page numbers in the footer, the TOC,
  the GoTo and SkimTo widgets, and to use the source page
  number in the standard bookmark and highlight initial text.
4 years ago
yparitcher 08359ee1b6
[UX] Next/Previous Bookmark Gestures (#5968)
Fixes #5965
4 years ago
poire-z 85a06ff995 Bookmarks: fix dogear not shown when highlights on same page
Depending on the random ordering of bookmarks and highlights
on a same page, the binary seach could not notice that a
bookmark exists for this page.
Solve this by putting bookmark before highlights on a same
page in the list, and skip them when searching.
4 years ago
yparitcher f6b23adb2c
skimto: add beginning and end as hold callback (#5820)
* first/last bookmark
4 years ago
poire-z 8110c68e29 [Fix] Update dogear when back from bookmarks list 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
Frans de Jonge 2104bb6f98
[fix] Distinguish bookmark/page flipping in menu (#5266)
Fixes <https://github.com/koreader/koreader/issues/5265>.
5 years ago
poire-z 9f3c85ed83 cre: toggable enhanced rendering (floats, collapsed margins...)
Adds "Render mode" toggle with 4 modes, to enable some or all
of crengine's new enhanced block rendering features.
Use "legacy" rendering for previously opened books to not mess
with bookmarks, and "web" (all of the new features) for new books.

Also make available the added "HTML5" stylesheet to the Style menu.
5 years ago
Frans de Jonge 728bb187fa
[UX] Gesture manager: add two-finger swipe left and right (#4815)
Also add Device:hasMultitouch() to control whether the configuration menu is shown.

Cf. #4727.
5 years ago
Galunid 015fb4d34e Allows adjusting highlight start and end (#4582)
Adds arrow buttons under Delete|Edit.
Tap to move by word, hold to move by char.
5 years ago
onde2rock 53e7a0b6c9 [Non-touch] Add a menu item to toggle a bookmark on the current page (#4262) 6 years ago
poire-z 0d66ea7555
Text input fixes and enhancements (#4084)
InputText, ScrollTextWidget, TextBoxWidget:
- proper line scrolling when moving cursor or inserting/deleting text
  to behave like most text editors do
- fix cursor navigation, optimize refreshes when moving only the cursor,
  don't recreate the textwidget when moving cursor up/down
- optimize refresh areas, stick to "ui" to avoid a "partial" black
  flash every 6 appended or deleted chars

InputText:
- fix issue when toggling Show password multiple times
- new option: InputText.cursor_at_end (default: true)
- if no InputText.height provided, measure the text widget height
  that we would start with, and use a ScrollTextWidget with that
  fixed height, so widget does not overflow container if we extend
  the text and increase the number of lines
- as we are using "ui" refreshes while text editing, allows refreshing
  the InputText with a diagonal swipe on it (actually, refresh the
  whole screen, which allows refreshing the keyboard too if needed)

ScrollTextWidget:
- properly align scrollbar with its TextBoxWidget

TextBoxWidget:
- some cleanup (added new properties to avoid many method calls), added
  proxy methods for upper widgets to get them
- reordered/renamed/refactored the *CharPos* methods for easier reading
  (sorry for the diff that won't help reviewing, but that was needed)

InputDialog:
- new options:
   allow_newline = false, -- allow entering new lines
   cursor_at_end = true, -- starts with cursor at end of text, ready to append
   fullscreen = false, -- adjust to full screen minus keyboard
   condensed = false, -- true will prevent adding air and balance between elements
   add_scroll_buttons = false, -- add scroll Up/Down buttons to first row of buttons
   add_nav_bar = false, -- append a row of page navigation buttons
- find the most adequate text height, when none provided or fullscreen, to
  not overflow screen (and not be stuck with Cancel/Save buttons hidden)
- had to disable the use of a MovableContainer (many issues like becoming
  transparent when a PathChooser comes in front, Hold to paste from
  clipboard, moving the InputDialog under the keyboard and getting stuck...)

GestureRange: fix possible crash (when event processed after widget
destruction ?)

LoginDialog: fix some ui stack increase and possible crash when switching
focus many times.
6 years ago
onde2rock e502bf04d3 [feat, UX] Support the virtualKeyboard on non touch-device (#3796)
* [VirtualKeyboard] Add support for keynaviguation

Also rename the variable "layout" to "keyboard_layout" because conflict
with the layout from the focusmanager

* Make the goto dialog compatible with key naviguation

My solution is to change the order of the widget. The last one will the
virtualkeybard so it catch all the keybinding, and below it, make the
dialog "is_always_active = true" so it can receive touch event.

* Correctly show the virtual keyboard on dpad devices

* change the order to call the virtualKeyboard so it end up on top

* Handle the multi input dialog

* Support reopening the virtualKeyboard by the Press key

* add check focusmanager

* Fix https://github.com/koreader/koreader/issues/3797

* MultiInputDialog : Now work on non touch-device

* Set the virtualkeyboard to be a modal widget

* Fix the layout in multiinputwidget

* Fix for the various combination of
hasKeys,hasDpad,isTouchDevice

* [Focusmanager] Better handling of malformed layout
6 years ago
poire-z 5e47a83e6a
UIManager: avoid painting widgets covered by a full screen widget (#3770)
Navigating the TOC, viewing a full screen image, browsing
reading stats... would call paintTo() on ReaderUI (so, asking
the engine to render the page) or FileManager (so, rendering cover
images) even though their content is hidden.
Widgets registering to UIManager have to explicitely states
they cover the full screen (UIManager can't know, parts of their
dimen may be transparent, e.g. if it is a CenterContainer).
6 years ago
poire-z e615345ffa TOC, bookmarks: remember current page so we can go back to it 6 years ago
Robert d163f8281d Menu: configure number of items per page, wrap entries (#3589)
Configure number of items per page (from 6 to 24) - default is 14
Allow filenames to wrap so that we can see the full name
Used by File browser, History, Search Result, Bookmarks, Table of contents (only single line), File chooser, OPDS catalog
6 years ago
Robert af61153df2 [feat] SkimToWidget chapter markers & next/prev chapter/bookmark (#3389)
https://github.com/koreader/koreader/issues/2819#issuecomment-332261968
+ refactoring code in skimtowidget
+ add chapter markers
+ add next/prev chapter buttons
+ add next/prev bookmark buttons
7 years ago
poire-z 29708884c7 Enable Edit (rename bookmark) when tap on highlight (#3369)
Also fix a few crash possibilities when unhighlighting.
Also fix bug with binary search that could not be able to remove bookmark
when there are multiple bookmarks/highlights on the same page.
7 years ago
Robert a2ea46bfdc Rename bookmark (#3275) 7 years ago
Robert bdf02f14aa Add bookmark browsing mode to menu (#3248) 7 years ago
poire-z 991b56664f Added Swipe to follow nearest link/to jump to latest bookmark (#3207) 7 years ago
robert00s 6d5859d11d Read bookmarks without having to view ebook page 7 years ago
Robert 4d0f66a354 Fix: Unhighlight is not clickable in dictionary view and Deleting highlights in bookmarks does not take effect (#3034)
* Fix: Unhighlight is not clickable in dictionary view
* Fix: Deleting highlights in bookmarks does not take effect
7 years ago
Frans de Jonge e1aa57f27e Font: unify font styling 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
Hzj_jie f91ad679d9 swithItemTable -> switchItemTable 7 years ago
Qingping Hou f95ad00b9e feat: add logger module & rewrite kobo suspend script in lua 7 years ago
poire-z 2c01f3add9 Fix: dog ears disappearance when switching fonts (#2394)
or switching orientation, or some other page layout setting.
Reverted commit a049edd, which should be done better (see #2395).
8 years ago
Qingping Hou c22a3747d8 fix all the tests 8 years ago
Qingping Hou a049eddcbc bookmark(fix): bookmark comparison for crengine 8 years ago
Qingping Hou eb37d9b8b6 kobo: fix screen probe for touch 8 years ago
Qingping Hou e422842256 minor: a lot of luacheck fixes 8 years ago
Qingping Hou 186673587e chore: fix some of the luacheck errors 9 years ago