hidden flows removed from non-touch

reviewable/pr11690/r1
SomeGuy 2 months ago committed by GitHub
parent 12552f1c71
commit cbd5534259
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,4 +1,5 @@
local ConfirmBox = require("ui/widget/confirmbox") local ConfirmBox = require("ui/widget/confirmbox")
local Device = require("device")
local Event = require("ui/event") local Event = require("ui/event")
local InfoMessage = require("ui/widget/infomessage") local InfoMessage = require("ui/widget/infomessage")
local InputDialog = require("ui/widget/inputdialog") local InputDialog = require("ui/widget/inputdialog")
@ -119,6 +120,7 @@ function ReaderHandMade:onToggleHandmadeFlows()
end end
function ReaderHandMade:addToMainMenu(menu_items) function ReaderHandMade:addToMainMenu(menu_items)
if Device:isTouchDevice() then
menu_items.handmade_toc = { menu_items.handmade_toc = {
text = _("Custom table of contents") .. " " .. self.custom_toc_symbol, text = _("Custom table of contents") .. " " .. self.custom_toc_symbol,
checked_func = function() return self.toc_enabled end, checked_func = function() return self.toc_enabled end,
@ -150,14 +152,14 @@ function ReaderHandMade:addToMainMenu(menu_items)
callback = function() callback = function()
UIManager:show(InfoMessage:new{ UIManager:show(InfoMessage:new{
text = _([[ text = _([[
If the book has no table of contents or you would like to substitute it with your own, you can create a custom TOC. The original TOC (if available) will not be altered. If the book has no table of contents or you would like to substitute it with your own, you can create a custom TOC. The original TOC (if available) will not be altered.
You can create, edit and remove chapters: You can create, edit and remove chapters:
- in Page browser, by long-pressing on a thumbnail; - in Page browser, by long-pressing on a thumbnail;
- on a book page, by selecting some text to be used as the chapter title. - on a book page, by selecting some text to be used as the chapter title.
(Once you're done building it and don't want to see the buttons anymore, you can disable Edit mode.) (Once you're done building it and don't want to see the buttons anymore, you can disable Edit mode.)
This custom table of contents is currently limited to a single level and can't have sub-chapters.]]) This custom table of contents is currently limited to a single level and can't have sub-chapters.]])
}) })
end, end,
keep_menu_open = true, keep_menu_open = true,
@ -207,18 +209,18 @@ This custom table of contents is currently limited to a single level and can't h
callback = function() callback = function()
UIManager:show(InfoMessage:new{ UIManager:show(InfoMessage:new{
text = _([[ text = _([[
Custom hidden flows can be created to exclude sections of the book from your normal reading flow: Custom hidden flows can be created to exclude sections of the book from your normal reading flow:
- hidden flows will automatically be skipped when turning pages within the regular flow; - hidden flows will automatically be skipped when turning pages within the regular flow;
- pages part of hidden flows are assigned distinct page numbers and won't be considered in the various book & chapter progress and time to read features; - pages part of hidden flows are assigned distinct page numbers and won't be considered in the various book & chapter progress and time to read features;
- following direct links to pages in hidden flows will still work, including from the TOC or Book map. - following direct links to pages in hidden flows will still work, including from the TOC or Book map.
This can be useful to exclude long footnotes or bibliography sections. This can be useful to exclude long footnotes or bibliography sections.
It can also be handy when interested in reading only a subset of a book. It can also be handy when interested in reading only a subset of a book.
In Page browser, you can long-press on a thumbnail to start a hidden flow or restart the regular flow on this page. In Page browser, you can long-press on a thumbnail to start a hidden flow or restart the regular flow on this page.
(Once you're done building it and don't want to see the button anymore, you can disable Edit mode.) (Once you're done building it and don't want to see the button anymore, you can disable Edit mode.)
Hidden flows are shown with gray or hatched background in Book map and Page browser.]]) Hidden flows are shown with gray or hatched background in Book map and Page browser.]])
}) })
end, end,
keep_menu_open = true, keep_menu_open = true,
@ -297,8 +299,10 @@ Hidden flows are shown with gray or hatched background in Book map and Page brow
} }
end, end,
} }
end
end end
function ReaderHandMade:updateHandmagePages() function ReaderHandMade:updateHandmagePages()
if not self.ui.rolling then if not self.ui.rolling then
return return
@ -338,8 +342,10 @@ function ReaderHandMade:onDocumentRerendered()
-- Called with CRE document when partial rerendering not enabled -- Called with CRE document when partial rerendering not enabled
self:updateHandmagePages() self:updateHandmagePages()
-- Don't have these send events their own events -- Don't have these send events their own events
if Device:isTouchDevice() then
self:setupFlows(true) self:setupFlows(true)
self:setupToc(true) self:setupToc(true)
end
-- ReaderToc will process this event just after us, and will -- ReaderToc will process this event just after us, and will
-- call its onUpdateToc: we don't need to send it. -- call its onUpdateToc: we don't need to send it.
-- (Also, no need for InitScrollPageStates with CRE.) -- (Also, no need for InitScrollPageStates with CRE.)

Loading…
Cancel
Save