CRE: use same marks in top and bottom progress bars

Feed to crengine the same ticks (build from the TOC
entries) that we use in the bottom status bar.
(crengine otherwise builds a tick for each DocFragment,
which most often is really different than what's seen
in the bottom bar.)
This commit is contained in:
poire-z
2020-06-05 10:09:44 +02:00
committed by Frans de Jonge
parent 3e71e4985e
commit 5536ce996a
4 changed files with 35 additions and 18 deletions

View File

@@ -814,6 +814,7 @@ function ReaderRolling:updatePos()
self.ui:handleEvent(Event:new("UpdateToc"))
self.view.footer:updateFooter()
end
self:updateTopStatusBarMarkers()
UIManager:setDirty(self.view.dialog, "partial")
-- Allow for the new rendering to be shown before possibly showing
-- the "Styles have changes..." ConfirmBox so the user can decide
@@ -1005,6 +1006,15 @@ function ReaderRolling:onSetStatusLine(status_line, on_read_settings)
self.ui:handleEvent(Event:new("UpdatePos"))
end
function ReaderRolling:updateTopStatusBarMarkers()
if not self.cre_top_bar_enabled then
return
end
local pages = self.ui.document:getPageCount()
local ticks = self.ui.toc:getTocTicksForFooter()
self.ui.document:setHeaderProgressMarks(pages, ticks)
end
function ReaderRolling:updateBatteryState()
if self.view.view_mode == "page" and self.cre_top_bar_enabled then
logger.dbg("update battery state")