From c454d86b2cb6831e077411dda07f746577daa724 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Sun, 9 Dec 2012 01:45:25 +0800 Subject: [PATCH] add change view mode feature for crereader --- cre.cpp | 4 ++-- crereader.lua | 3 ++- defaults.lua | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cre.cpp b/cre.cpp index d14061319..8a01b7388 100644 --- a/cre.cpp +++ b/cre.cpp @@ -46,9 +46,9 @@ static int initCache(lua_State *L) { static int openDocument(lua_State *L) { const char *file_name = luaL_checkstring(L, 1); const char *style_sheet = luaL_checkstring(L, 2); - int width = luaL_checkint(L, 3); int height = luaL_checkint(L, 4); + LVDocViewMode view_mode = (LVDocViewMode)luaL_checkint(L, 5); lString8 css; CreDocument *doc = (CreDocument*) lua_newuserdata(L, sizeof(CreDocument)); @@ -63,7 +63,7 @@ static int openDocument(lua_State *L) { doc->text_view->setStyleSheet(css); } } - doc->text_view->setViewMode(DVM_SCROLL, -1); + doc->text_view->setViewMode(view_mode, -1); doc->text_view->Resize(width, height); doc->text_view->LoadDocument(file_name); doc->dom_doc = doc->text_view->getDocument(); diff --git a/crereader.lua b/crereader.lua index a1d67e856..8e885e06f 100644 --- a/crereader.lua +++ b/crereader.lua @@ -14,6 +14,7 @@ CREReader = UniReader:new{ font_zoom = 0, line_space_percent = 100, + view_mode = DCREREADER_VIEW_MODE, } function CREReader:init() @@ -82,7 +83,7 @@ function CREReader:open(filename) file_type = "cr3" end local style_sheet = "./data/"..file_type..".css" - ok, self.doc = pcall(cre.openDocument, filename, style_sheet, G_width, G_height) + ok, self.doc = pcall(cre.openDocument, filename, style_sheet, G_width, G_height, self.view_mode) if not ok then return false, "Error opening cre-document. " -- self.doc, will contain error message end diff --git a/defaults.lua b/defaults.lua index f2024eec5..4c0c2d913 100644 --- a/defaults.lua +++ b/defaults.lua @@ -68,6 +68,9 @@ DPICVIEWER_COMICS_MODE_ENABLE = true DPICVIEWER_RTL_MODE_ENABLE = false DPICVIEWER_PAGE_MODE_ENABLE = false +-- 0 for scroll mode, 1 for page mode +DCREREADER_VIEW_MODE = 1 + -- supported extensions DPDFREADER_EXT = ";pdf;xps;cbz;zip;" DDJVUREADER_EXT = ";djvu;"