Speed up page turning on big cre documents (#3740)

Page turning, menu opening, ... everything actually
This commit is contained in:
poire-z
2018-03-12 20:46:40 +01:00
committed by GitHub
parent c5b547f6b3
commit 7d71d73cc4
2 changed files with 22 additions and 0 deletions

View File

@@ -540,6 +540,19 @@ function CreDocument:findText(pattern, origin, reverse, caseInsensitive)
pattern, origin, reverse, caseInsensitive and 1 or 0)
end
function CreDocument:enableInternalHistory(toggle)
-- Setting this to 0 unsets crengine internal bookmarks highlighting,
-- and as a side effect, disable internal history and the need to build
-- a bookmark at each page turn: this speeds up a lot page turning
-- and menu opening on big books.
-- It has to be called late in the document opening process, and setting
-- it to false needs to be followed by a redraw.
-- It needs to be temporarily re-enabled on page resize for crengine to
-- keep track of position in page and restore it after resize.
logger.dbg("CreDocument: set bookmarks highlight and internal history", toggle)
self._document:setIntProperty("crengine.highlight.bookmarks", toggle and 2 or 0)
end
function CreDocument:register(registry)
registry:addProvider("azw", "application/vnd.amazon.mobi8-ebook", self, 90)
registry:addProvider("chm", "application/vnd.ms-htmlhelp", self, 90)