BookMap: add "Overview" mode

Add a restricted but convenient mode showing BookMap like
in initial view, while still allowing chapter levels to be
tweaked. This allows getting back to this view with another
gesture to see the overall progress in the book, while
still having the normal BookMap in flat mode acting as
an alternative ToC.
Available as an action to associate to a gesture, and
with long-press on the "Book map" menu item.
This commit is contained in:
poire-z
2023-06-02 20:44:47 +02:00
parent b7078caf29
commit 04425b74fc
3 changed files with 85 additions and 18 deletions

View File

@@ -68,6 +68,12 @@ function ReaderThumbnail:addToMainMenu(menu_items)
callback = function()
self:onShowBookMap()
end,
-- Show the alternative overview mode (which is just a restricted
-- variation of the main book map) with long-press (let's avoid
-- adding another item in the crowded first menu).
hold_callback = function()
self:onShowBookMap(true)
end,
}
menu_items.page_browser = {
text = _("Page browser"),
@@ -77,10 +83,11 @@ function ReaderThumbnail:addToMainMenu(menu_items)
}
end
function ReaderThumbnail:onShowBookMap()
function ReaderThumbnail:onShowBookMap(overview_mode)
local BookMapWidget = require("ui/widget/bookmapwidget")
UIManager:show(BookMapWidget:new{
ui = self.ui,
overview_mode = overview_mode,
})
return true
end