Commit Graph

41113 Commits

Author SHA1 Message Date
Kovid Goyal 53c0c3fb68 Allow for offsets larger than text length in decode_with_range()
This can happen if the book is edited, for example. And rather than fail
in such cases, better to use a close but not perfect match.
2020-08-22 18:48:34 +05:30
Kovid Goyal 120107e9d2 spacial -> spatial 2020-08-22 18:48:34 +05:30
Kovid Goyal 200a3cba71 fixes from static checking 2020-08-22 18:48:34 +05:30
Mark W. Gabby-Li 8b39fea8f8 Vertical RTL Book Reading Support
Added a variety of functions to viewport to allow working based on block and inline direction rather than X and Y.

Changed paged mode and flow mode to be based on block and inline directions, making them agnostic to writing direction.

Added jump_to_cfi function to flow mode code, and use this in iframe. This fixes some issues with CFI jumping in flow mode.

Use self.jump_to_cfi in iframe so that it is based on the current mode.

Removed a redundant self.onscroll call that was causing CFIs to be queried twice on load, doubling the time they took.

Fixed some bugs related to scrolling in flow mode related to a decorator not working with keyword arguments, by removing the keyword arguments.

Fixed some bugs with flow mode visibility anchor function.

CFI changes:
 Renamed some functions and variables to clarify meaning.

 Remove use of exceptions, since they were causing CFI calculation to run about six times more slowly in benchmarks. (Worst-case went from ~6 to ~1 second.)

 Remove forward flag and allow text offset to be equal to node length, and correct for this by adding a flag to the decoded CFI to indicate this.

 Added comments clarifying the results of decoding a CFI.

 Fix bugs in the point (now decode_with_range) function and simplified it.

 Added new functions that get CFI position from decoded CFIs, to replace places where this was being done in slightly different ways.

 Fixed some issues with cfi.pyj's scroll_to that were exposed by vertical writing support, mainly caching and using span's parent to create the start and end ranges, which causes re-creating the range to succeed. Also, don't store the span's bounding rect, since it's not needed anymore.

 Rewrote at_current to do a simplified scan of the viewport in the inline and then block direction.
2020-08-22 18:48:34 +05:30
Kovid Goyal c5b9677809 Select highlight in panel when it is selected in text 2020-08-22 18:48:34 +05:30
Kovid Goyal 74644b31ae Use an <iframe> rather than a new window for editing metadata from the viewer 2020-08-22 18:48:33 +05:30
Kovid Goyal 4154c3be14 Fix multiple dots for highlights with notes that have multiple internal ranges 2020-08-22 18:48:33 +05:30
Kovid Goyal 10f3414426 ... 2020-08-22 18:48:33 +05:30
Kovid Goyal 140ef318ce Fix accidental re-execing for calibre_parallel as well on macOS 2020-08-22 18:48:33 +05:30
Kovid Goyal 4b0622e6d9 Bump beta version 2020-08-22 18:48:33 +05:30
Kovid Goyal e79a765ac6 Content server viewer: Allow easily jumping back to either the book details page or the book list page for the current book. Fixes #1890483 2020-08-22 18:48:33 +05:30
Kovid Goyal 1867cadd5c Content server viewer: Allow editing metadata from the view metadata panel
Fixes #1890755
2020-08-22 18:48:33 +05:30
Kovid Goyal e304300fc6 Increase the threshold for swipe detection to 64px 2020-08-22 18:48:33 +05:30
Kovid Goyal 054a7e374f Micro-optimization 2020-08-22 18:48:33 +05:30
Kovid Goyal 41717d5eca Use caret position from point rahter than range from point as the former is standards compliant 2020-08-22 18:48:32 +05:30
Kovid Goyal 6d0cc73d93 Remove unused code 2020-08-22 18:48:32 +05:30
Kovid Goyal 640ca33197 py3ize some shebangs 2020-08-22 18:48:32 +05:30
Kovid Goyal 5de7f24814 Use a standard delete confirmation for deleting annotations fromthe browse tool 2020-08-22 18:48:32 +05:30
Kovid Goyal 31acd459a9 Use a standard delete confirmation for deleting highlights 2020-08-22 18:48:32 +05:30
Kovid Goyal 4bf48d8d99 Better error message when clipboard is not available 2020-08-22 18:48:32 +05:30
Kovid Goyal 34375f5891 Make drag scrolling semantics read mode dependant 2020-08-22 18:48:32 +05:30
Kovid Goyal aca602c118 Use Yes/No for confirm_delete dialogs 2020-08-22 18:48:32 +05:30
Kovid Goyal 2bedd3bfb2 Fix undragged handle position not being updated during drag scroll 2020-08-22 18:48:32 +05:30
Kovid Goyal 08105adbc8 Fix triple clicking of start and end paragraphs in paged mode 2020-08-22 18:48:32 +05:30
Kovid Goyal 1911ec41b4 Simply adjusting selection on handle move
Also re-enable drag scrollign with handles though it does not really
work yet
2020-08-22 18:48:31 +05:30
Kovid Goyal 1e24b66dad Simplify the selection extents function 2020-08-22 18:48:31 +05:30
Kovid Goyal 72fcbbc93a Restore triple-click to select paragraphs 2020-08-22 18:48:31 +05:30
Kovid Goyal 3af812813c Make the details panel buttons clickable links instead
Looks nicer and no longer any need for a delete button
2020-08-22 18:48:31 +05:30
Kovid Goyal f1a8dbc2a0 Viewer: Auto-hide the mouse cursor when unused. Can be turned off via a preference in the Miscellaneous section of the viewer preferences 2020-08-22 18:48:31 +05:30
Kovid Goyal 5cfb18055f No need for a nbsp in the notes indicator 2020-08-22 18:48:31 +05:30
Kovid Goyal 6f80fa05cd Fix quick highlight icon in preferences not same as in selection bar 2020-08-22 18:48:31 +05:30
Kovid Goyal 60f37faefd Fix extra dot below quick highlight icon 2020-08-22 18:48:31 +05:30
Kovid Goyal 62c82232c5 Show an indicator for a highlight that has notes 2020-08-22 18:48:31 +05:30
Kovid Goyal 3f90a15a04 String changes 2020-08-22 18:48:30 +05:30
Kovid Goyal 476e6a6bbc Fix text color for edit comments iframe dark mode 2020-08-22 18:48:30 +05:30
Kovid Goyal 8a322d1a69 Fix scrollbar not visible in footnote popup 2020-08-22 18:48:30 +05:30
Kovid Goyal 2d1b73b99b Fix footnote popup colors not being overriden in dark mode 2020-08-22 18:48:30 +05:30
Kovid Goyal 4a24987fee Only show the delete selected button if more than one item is selected 2020-08-22 18:48:30 +05:30
Kovid Goyal a7ad9e87d2 Fix delete selected button not working 2020-08-22 18:48:30 +05:30
Kovid Goyal e0f142f1c8 Better internet search icon 2020-08-22 18:48:30 +05:30
Kovid Goyal 31710ba335 DRYer 2020-08-22 18:48:30 +05:30
Kovid Goyal 36198d500c Content server: Fix incorrect text color in detailed book list in dark mode 2020-08-22 18:48:30 +05:30
Kovid Goyal 0906c226ea Content server book details: Fix incorrect text color for comments in dark mode 2020-08-22 18:48:30 +05:30
Kovid Goyal 9238df38d6 Fix get_color_as_rgba() not working with var() colors 2020-08-22 18:48:29 +05:30
Kovid Goyal 132f6a710d Content server book details: Fix next/previous cover overlay buttons not visible in dark theme 2020-08-22 18:48:29 +05:30
Kovid Goyal 5361db6916 Ensure selection bar position is updated after a resize 2020-08-22 18:48:29 +05:30
Kovid Goyal 976012bdf4 Have shortcut to toggle highlights panel work when selection bar is visible 2020-08-22 18:48:29 +05:30
Kovid Goyal 0ac9313bdf ... 2020-08-22 18:48:29 +05:30
Kovid Goyal c96a1dc31e Make input controls dark in the dark theme 2020-08-22 18:48:29 +05:30
Kovid Goyal c82c7d1a27 Notes should be rendered the same way in the viewer highlights panel and the browse annotations details panel 2020-08-22 18:48:29 +05:30