fix: remove page number checking in displaying TOC

Former showTOC() method checks the page number in each
entry and only display entry whose page number is greater
than the previous one. However, I think this is too
"clever", we should better leave the TOC untouched to keep
consistent with other pdf readers.
pull/2/merge
Qingping Hou 12 years ago
parent 9dd3994dd8
commit c8f87d5661

@ -101,16 +101,17 @@ static int walkTableOfContent(lua_State *L, fz_outline* ol, int *count, int dept
lua_pushstring(L, "page");
lua_pushnumber(L, ol->dest.ld.gotor.page + 1);
lua_settable(L, -3);
lua_pushstring(L, "depth");
lua_pushnumber(L, depth);
lua_settable(L, -3);
lua_pushstring(L, "title");
lua_pushstring(L, "title");
lua_pushstring(L, ol->title);
lua_settable(L, -3);
lua_settable(L, -3);
lua_settable(L, -3);
(*count)++;
if (ol->down) {
walkTableOfContent(L, ol->down, count, depth);

@ -678,15 +678,11 @@ function UniReader:showTOC()
end
local menu_items = {}
local filtered_toc = {}
local curr_page = -1
-- build menu items
for _k,_v in ipairs(self.toc) do
if(_v.page >= curr_page) then
table.insert(menu_items,
(" "):rep(_v.depth-1)..self:cleanUpTOCTitle(_v.title))
table.insert(filtered_toc,_v.page)
curr_page = _v.page
end
table.insert(menu_items,
(" "):rep(_v.depth-1)..self:cleanUpTOCTitle(_v.title))
table.insert(filtered_toc,_v.page)
end
toc_menu = SelectMenu:new{
menu_title = "Table of Contents",

Loading…
Cancel
Save