Fix for TOC breakage for crengine-related files.

In UniReader:showToc() function we cannot use goto() by page number
but have to use self:gotoTocEntry() because crereader defines its own
CREReader:gotoTocEntry() method which uses "xpointer" field of the TOC
entry for this purpose.
With this fix the TOC navigation in crengine-related files works
correctly, BUT after each jump you have to press Menu to refresh the
page for some reason (adding explicit self:redrawCurrentPage() in the
code before gotoTocEntry() doesn't help). This seems to be an unrelated
problem to do with cr3 caching or something else. I will try to
investigate it as well, but for now I am committing the fix for the TOC side
of the problem.
This commit is contained in:
Tigran Aivazian
2012-09-21 23:05:19 +01:00
parent 940408fc51
commit 3056bf440c

View File

@@ -1798,12 +1798,13 @@ function UniReader:showToc()
local ret_code, item_no, all = toc_menu:choose(0, fb.bb:getHeight())
if ret_code then -- normal item selection
-- check to make sure the destination is local
local pagenum = self.toc[self.toc_curidx_to_x[ret_code]].page
local toc_entry = self.toc[self.toc_curidx_to_x[ret_code]]
local pagenum = toc_entry.page
if pagenum < 1 or pagenum > self.doc:getPages() then
showInfoMsgWithDelay("External links unsupported", 1500, 1)
self.toc_curitem = ret_code
else
return self:goto(pagenum)
return self:gotoTocEntry(toc_entry)
end
elseif item_no then -- expand or collapse item
local abs_item_no = math.abs(item_no)