mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
@@ -209,8 +209,10 @@ function ReaderBookmark:onPosUpdate(pos)
|
||||
end
|
||||
|
||||
function ReaderBookmark:gotoBookmark(pn_or_xp)
|
||||
local event = self.ui.document.info.has_pages and "GotoPage" or "GotoXPointer"
|
||||
self.ui:handleEvent(Event:new(event, pn_or_xp))
|
||||
if pn_or_xp then
|
||||
local event = self.ui.document.info.has_pages and "GotoPage" or "GotoXPointer"
|
||||
self.ui:handleEvent(Event:new(event, pn_or_xp))
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderBookmark:onShowBookmark()
|
||||
@@ -607,6 +609,16 @@ function ReaderBookmark:onGotoNextBookmark(pn_or_xp)
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderBookmark:onGotoNextBookmarkFromPage()
|
||||
self:gotoBookmark(self:getNextBookmarkedPageFromPage(self.ui:getCurrentPage()))
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderBookmark:onGotoPreviousBookmarkFromPage()
|
||||
self:gotoBookmark(self:getPreviousBookmarkedPageFromPage(self.ui:getCurrentPage()))
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderBookmark:getLatestBookmark()
|
||||
local latest_bookmark = nil
|
||||
local latest_bookmark_datetime = "0"
|
||||
|
||||
@@ -203,12 +203,7 @@ local footerTextGeneratorMap = {
|
||||
book_time_to_read = function(footer)
|
||||
local symbol_type = footer.settings.item_prefix or "icons"
|
||||
local prefix = symbol_prefix[symbol_type].book_time_to_read
|
||||
local current_page
|
||||
if footer.view.document.info.has_pages then
|
||||
current_page = footer.ui.paging.current_page
|
||||
else
|
||||
current_page = footer.view.document:getCurrentPage()
|
||||
end
|
||||
local current_page = footer.ui:getCurrentPage()
|
||||
return footer:getDataFromStatistics(prefix .. " ", footer.pages - current_page)
|
||||
end,
|
||||
chapter_time_to_read = function(footer)
|
||||
|
||||
@@ -28,6 +28,8 @@ local action_strings = {
|
||||
page_jmp_fwd_1 = _("Next page"),
|
||||
prev_chapter = _("Previous chapter"),
|
||||
next_chapter = _("Next chapter"),
|
||||
prev_bookmark = _("Previous bookmark"),
|
||||
next_bookmark = _("Next bookmark"),
|
||||
go_to = _("Go to"),
|
||||
skim = _("Skim"),
|
||||
back = _("Back"),
|
||||
@@ -702,6 +704,8 @@ function ReaderGesture:buildMenu(ges, default)
|
||||
{"page_jmp_fwd_1", not self.is_docless},
|
||||
{"prev_chapter", not self.is_docless},
|
||||
{"next_chapter", not self.is_docless},
|
||||
{"prev_bookmark", not self.is_docless},
|
||||
{"next_bookmark", not self.is_docless},
|
||||
{"go_to", true},
|
||||
{"skim", not self.is_docless},
|
||||
{"back", true},
|
||||
@@ -1300,6 +1304,10 @@ function ReaderGesture:gestureAction(action, ges)
|
||||
self.ui:handleEvent(Event:new("GotoNextChapter"))
|
||||
elseif action == "prev_chapter" then
|
||||
self.ui:handleEvent(Event:new("GotoPrevChapter"))
|
||||
elseif action == "next_bookmark" then
|
||||
self.ui:handleEvent(Event:new("GotoNextBookmarkFromPage"))
|
||||
elseif action == "prev_bookmark" then
|
||||
self.ui:handleEvent(Event:new("GotoPreviousBookmarkFromPage"))
|
||||
elseif action == "go_to" then
|
||||
self.ui:handleEvent(Event:new("ShowGotoDialog"))
|
||||
elseif action == "skim" then
|
||||
@@ -1564,12 +1572,7 @@ function ReaderGesture:multiswipeAction(multiswipe_directions, ges)
|
||||
end
|
||||
|
||||
function ReaderGesture:pageUpdate(page)
|
||||
local curr_page
|
||||
if self.document.info.has_pages then
|
||||
curr_page = self.ui.paging.current_page
|
||||
else
|
||||
curr_page = self.document:getCurrentPage()
|
||||
end
|
||||
local curr_page = self.ui:getCurrentPage()
|
||||
if curr_page and page then
|
||||
curr_page = curr_page + page
|
||||
self.ui:handleEvent(Event:new("GotoPage", curr_page))
|
||||
|
||||
@@ -747,4 +747,12 @@ function ReaderUI:switchDocument(new_file)
|
||||
self:showReader(new_file)
|
||||
end
|
||||
|
||||
function ReaderUI:getCurrentPage()
|
||||
if self.document.info.has_pages then
|
||||
return self.paging.current_page
|
||||
else
|
||||
return self.document:getCurrentPage()
|
||||
end
|
||||
end
|
||||
|
||||
return ReaderUI
|
||||
|
||||
@@ -63,11 +63,7 @@ function SkimToWidget:init()
|
||||
}
|
||||
end
|
||||
local dialog_title = _("Skim")
|
||||
if self.document.info.has_pages then
|
||||
self.curr_page = self.ui.paging.current_page
|
||||
else
|
||||
self.curr_page = self.document:getCurrentPage()
|
||||
end
|
||||
self.curr_page = self.ui:getCurrentPage()
|
||||
self.page_count = self.document:getPageCount()
|
||||
|
||||
local ticks_candidates = {}
|
||||
@@ -242,21 +238,10 @@ function SkimToWidget:init()
|
||||
width = self.button_width,
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
local page
|
||||
if self.document.info.has_pages then
|
||||
page = self.ui.bookmark:getNextBookmarkedPageFromPage(self.ui.paging.current_page)
|
||||
else
|
||||
page = self.ui.bookmark:getNextBookmarkedPageFromPage(self.curr_page)
|
||||
end
|
||||
self:goToBookmark(page)
|
||||
self.ui:handleEvent(Event:new("GotoNextBookmarkFromPage"))
|
||||
end,
|
||||
hold_callback = function()
|
||||
local page
|
||||
if self.document.info.has_pages then
|
||||
page = self.ui.bookmark:getLastBookmarkedPageFromPage(self.ui.paging.current_page)
|
||||
else
|
||||
page = self.ui.bookmark:getLastBookmarkedPageFromPage(self.curr_page)
|
||||
end
|
||||
local page = self.ui.bookmark:getLastBookmarkedPageFromPage(self.ui:getCurrentPage())
|
||||
self:goToBookmark(page)
|
||||
end,
|
||||
}
|
||||
@@ -270,21 +255,10 @@ function SkimToWidget:init()
|
||||
width = self.button_width,
|
||||
show_parent = self,
|
||||
callback = function()
|
||||
local page
|
||||
if self.document.info.has_pages then
|
||||
page = self.ui.bookmark:getPreviousBookmarkedPageFromPage(self.ui.paging.current_page)
|
||||
else
|
||||
page = self.ui.bookmark:getPreviousBookmarkedPageFromPage(self.curr_page)
|
||||
end
|
||||
self:goToBookmark(page)
|
||||
self.ui:handleEvent(Event:new("GotoPreviousBookmarkFromPage"))
|
||||
end,
|
||||
hold_callback = function()
|
||||
local page
|
||||
if self.document.info.has_pages then
|
||||
page = self.ui.bookmark:getFirstBookmarkedPageFromPage(self.ui.paging.current_page)
|
||||
else
|
||||
page = self.ui.bookmark:getFirstBookmarkedPageFromPage(self.curr_page)
|
||||
end
|
||||
local page = self.ui.bookmark:getFirstBookmarkedPageFromPage(self.ui:getCurrentPage())
|
||||
self:goToBookmark(page)
|
||||
end,
|
||||
}
|
||||
@@ -421,11 +395,7 @@ function SkimToWidget:goToBookmark(page)
|
||||
if page then
|
||||
self:addOriginToLocationStack()
|
||||
self.ui.bookmark:gotoBookmark(page)
|
||||
if self.document.info.has_pages then
|
||||
self.curr_page = self.ui.paging.current_page
|
||||
else
|
||||
self.curr_page = self.document:getCurrentPage()
|
||||
end
|
||||
self.curr_page = self.ui:getCurrentPage()
|
||||
self:update()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -677,11 +677,7 @@ function ReaderStatistics:getStatisticEnabledMenuItem()
|
||||
self:initData()
|
||||
self.pages_stats = {}
|
||||
self.start_current_period = TimeVal:now().sec
|
||||
if self.document.info.has_pages then
|
||||
self.curr_page = self.ui.paging.current_page
|
||||
else
|
||||
self.curr_page = self.document:getCurrentPage()
|
||||
end
|
||||
self.curr_page = self.ui:getCurrentPage()
|
||||
self.pages_stats[self.start_current_period] = self.curr_page
|
||||
end
|
||||
self:saveSettings()
|
||||
|
||||
Reference in New Issue
Block a user