Merge pull request #659 from houqp/new_ui_houqp

multiple fixes & cre view mode support & update from master
pull/2/merge
{Qingping,Dave} Hou 12 years ago
commit 946679aa2f

@ -98,8 +98,8 @@ DJVULIBS := $(DJVUDIR)/build/libdjvu/.libs/libdjvulibre.so \
$(LIBDIR)/libdjvulibre.so
DJVULIB := $(LIBDIR)/libdjvulibre.so.21
DJVULIBDIR := $(DJVUDIR)/build/libdjvu/.libs/
CRENGINELIBS := $(CRENGINEDIR)/crengine/libcrengine.a \
$(CRENGINEDIR)/thirdparty/chmlib/libchmlib.a \
CRELIB = $(LIBDIR)/libcrengine.so
CRE_3RD_LIBS := $(CRENGINEDIR)/thirdparty/chmlib/libchmlib.a \
$(CRENGINEDIR)/thirdparty/libpng/libpng.a \
$(CRENGINEDIR)/thirdparty/antiword/libantiword.a
THIRDPARTYLIBS := $(MUPDFLIBDIR)/libfreetype.a \
@ -121,7 +121,7 @@ K2PDFOPTLIB := $(LIBDIR)/libk2pdfopt.so.1
all: kpdfview extr
VERSION?=$(shell git describe HEAD)
kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o drawcontext.o koptcontext.o input.o $(POPENNSLIB) util.o ft.o lfs.o mupdfimg.o $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB) djvu.o $(DJVULIBS) cre.o $(CRENGINELIBS) pic.o pic_jpeg.o
kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o drawcontext.o koptcontext.o input.o $(POPENNSLIB) util.o ft.o lfs.o mupdfimg.o $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB) djvu.o $(DJVULIBS) cre.o $(CRELIB) $(CRE_3RD_LIBS) pic.o pic_jpeg.o
echo $(VERSION) > git-rev
$(CC) \
$(CFLAGS) \
@ -143,12 +143,13 @@ kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o drawcontext.o koptcontext.o inp
$(THIRDPARTYLIBS) \
djvu.o \
cre.o \
$(CRENGINELIBS) \
$(STATICLIBSTDCPP) \
$(LDFLAGS) \
-Wl,-rpath=$(LIBDIR)/ \
-o $@ \
-lm -ldl -lpthread -lk2pdfopt -ldjvulibre -lluajit-5.1 -L$(MUPDFLIBDIR) -L$(LIBDIR)\
-lm -ldl -lpthread -lk2pdfopt -ldjvulibre -lluajit-5.1 -lcrengine \
-L$(MUPDFLIBDIR) -L$(LIBDIR) \
$(CRE_3RD_LIBS) \
$(EMU_LDFLAGS) \
$(DYNAMICLIBSTDCPP)
@ -250,10 +251,12 @@ endif
test -d $(LIBDIR) || mkdir $(LIBDIR)
cp -a $(DJVULIBDIR)/libdjvulibre.so* $(LIBDIR)
$(CRENGINELIBS):
$(CRE_3RD_LIBS) $(CRELIB):
cd $(KPVCRLIBDIR) && rm -rf CMakeCache.txt CMakeFiles && \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS)" cmake . && \
$(MAKE)
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS)" cmake -D CMAKE_BUILD_TYPE=Release . && \
$(MAKE) VERBOSE=1
test -d $(LIBDIR) || mkdir $(LIBDIR)
cp -a $(KPVCRLIBDIR)/libcrengine.so $(CRELIB)
$(LUALIB):
ifdef EMULATE_READER
@ -274,7 +277,7 @@ $(K2PDFOPTLIB):
test -d $(LIBDIR) || mkdir $(LIBDIR)
cp -a $(K2PDFOPTLIBDIR)/libk2pdfopt.so* $(LIBDIR)
thirdparty: $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB) $(DJVULIBS) $(CRENGINELIBS) $(POPENNSLIB) $(K2PDFOPTLIB)
thirdparty: $(MUPDFLIBS) $(THIRDPARTYLIBS) $(LUALIB) $(DJVULIBS) $(CRELIB) $(CRE_3RD_LIBS) $(POPENNSLIB) $(K2PDFOPTLIB)
INSTALL_DIR=kindlepdfviewer
@ -290,11 +293,11 @@ customupdate: all
mkdir -p $(INSTALL_DIR)/{history,screenshots,clipboard,libs}
cp -p README.md COPYING kpdfview extr kpdf.sh $(LUA_FILES) $(INSTALL_DIR)
mkdir $(INSTALL_DIR)/data
cp -L $(DJVULIB) $(LUALIB) $(K2PDFOPTLIB) $(INSTALL_DIR)/libs
cp -L $(DJVULIB) $(CRELIB) $(LUALIB) $(K2PDFOPTLIB) $(INSTALL_DIR)/libs
$(STRIP) --strip-unneeded $(INSTALL_DIR)/libs/*
cp -rpL data/*.css $(INSTALL_DIR)/data
cp -rpL fonts $(INSTALL_DIR)
rm $(INSTALL_DIR)/fonts/droid/DroidSansFallback.ttf
rm $(INSTALL_DIR)/fonts/droid/DroidSansFallbackFull.ttf
cp -r git-rev resources $(INSTALL_DIR)
cp -rpL frontend $(INSTALL_DIR)
mkdir $(INSTALL_DIR)/fonts/host

@ -39,6 +39,7 @@ static int initCache(lua_State *L) {
int cache_size = luaL_optint(L, 1, (2 << 20) * 64); // 64Mb on disk cache for DOM
ldomDocCache::init(lString16("./cr3cache"), cache_size);
HyphMan::initDictionaries(lString16("data/hyph/"));
return 0;
}
@ -46,9 +47,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,9 +64,11 @@ 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->text_view->setPageHeaderInfo(PGHDR_AUTHOR|PGHDR_TITLE|PGHDR_PAGE_NUMBER|PGHDR_PAGE_COUNT|PGHDR_CHAPTER_MARKS|PGHDR_CLOCK);
doc->text_view->setStatusFontFace(lString8("Droid Sans"));
doc->dom_doc = doc->text_view->getDocument();
doc->text_view->Render();

@ -6,6 +6,7 @@ CreDocument = Document:new{
line_space_percent = 100,
default_font = "Droid Sans Fallback",
view_mode = "page",
}
-- NuPogodi, 20.05.12: inspect the zipfile content
@ -68,8 +69,13 @@ function CreDocument:init()
end
local style_sheet = "./data/"..file_type..".css"
-- view_mode default to page mode
local view_mode = 1
if self.view_mode == "scroll" then
view_mode = 0
end
ok, self._document = pcall(cre.openDocument, self.file, style_sheet,
Screen:getWidth(), Screen:getHeight())
Screen:getWidth(), Screen:getHeight(), view_mode)
if not ok then
self.error_message = self.doc -- will contain error message
return
@ -105,6 +111,12 @@ function CreDocument:getFontSize()
return self._document:getFontSize()
end
function CreDocument:setFontSize(new_font_size)
if new_font_size then
self._document:setFontSize(new_font_size)
end
end
function CreDocument:zoomFont(delta)
self._document:zoomFont(delta)
end

@ -40,12 +40,7 @@ function Device:getModel()
end
function Device:isKindle4()
re_val = os.execute("cat /proc/cpuinfo | grep MX50")
if re_val == 0 then
return true
else
return false
end
return (self:getModel() == "Kindle4")
end
function Device:isKindle3()

@ -3,7 +3,7 @@ require "settings" -- for DEBUG()
Font = {
fontmap = {
-- default font for menu contents
cfont = "droid/DroidSansFallbackFull.ttf",
cfont = "droid/DroidSansFallback.ttf",
-- default font for title
tfont = "NimbusSanL-BoldItal.cff",
-- default font for footer

@ -173,7 +173,7 @@ end
function MenuItem:onUnfocus()
self._underline_container.color = 0
self.key_events = { }
self.key_events = {}
return true
end
@ -267,6 +267,9 @@ function Menu:init()
dimen = {w = self.dimen.w},
self.menu_title,
}
if not self.is_borderless then
self.title_bar.dimen.w = self.title_bar.dimen.w - 14
end
-- group for items
self.item_group = VerticalGroup:new{}
self.page_info = TextWidget:new{
@ -327,14 +330,16 @@ function Menu:init()
self.key_events.PrevPage = {
{Input.group.PgBack}, doc = "goto previous page of the menu"
}
-- we won't catch presses to "Right"
-- we won't catch presses to "Right", leave that to MenuItem.
self.key_events.FocusRight = nil
-- shortcut icon is not needed for touch device
if self.is_enable_shortcut then
self.key_events.SelectByShortCut = { {self.item_shortcuts} }
end
self.key_events.Select = {
{"Press"}, doc = "select current menu item"
}
end
self.key_events.Select = { {"Press"}, doc = "select current menu item"}
if #self.item_table > 0 then
@ -391,10 +396,13 @@ function Menu:updateItems(select_number)
end -- if i <= self.items
end -- for c=1, self.perpage
if self.item_group[1] then
-- reset focus manager accordingly
self.selected = { x = 1, y = select_number }
-- set focus to requested menu item
self.item_group[select_number]:onFocus()
if not Device:isTouchDevice() then
-- only draw underline for nontouch device
-- reset focus manager accordingly
self.selected = { x = 1, y = select_number }
-- set focus to requested menu item
self.item_group[select_number]:onFocus()
end
-- update page information
self.page_info.text = "page "..self.page.."/"..self.page_num
else

@ -1,31 +1,47 @@
ReaderFont = InputContainer:new{
key_events = {
ShowFontMenu = { {"F"}, doc = "show font menu"},
IncreaseSize = {
{ "Shift", Input.group.PgFwd },
doc = "increase font size",
event = "ChangeSize", args = "increase" },
DecreaseSize = {
{ "Shift", Input.group.PgBack },
doc = "decrease font size",
event = "ChangeSize", args = "decrease" },
IncreaseLineSpace = {
{ "Alt", Input.group.PgFwd },
doc = "increase line space",
event = "ChangeLineSpace", args = "increase" },
DecreaseLineSpace = {
{ "Alt", Input.group.PgBack },
doc = "decrease line space",
event = "ChangeLineSpace", args = "decrease" },
},
dimen = Geom:new{ w = Screen:getWidth()-20, h = Screen:getHeight()-20},
font_face = nil,
font_size = nil,
line_space_percent = 100,
font_menu_title = "Font Menu",
face_table = nil,
}
function ReaderFont:init()
if not Device:hasNoKeyboard() then
-- add shortcut for keyboard
self.key_events = {
ShowFontMenu = { {"F"}, doc = "show font menu" },
IncreaseSize = {
{ "Shift", Input.group.PgFwd },
doc = "increase font size",
event = "ChangeSize", args = "increase" },
DecreaseSize = {
{ "Shift", Input.group.PgBack },
doc = "decrease font size",
event = "ChangeSize", args = "decrease" },
IncreaseLineSpace = {
{ "Alt", Input.group.PgFwd },
doc = "increase line space",
event = "ChangeLineSpace", args = "increase" },
DecreaseLineSpace = {
{ "Alt", Input.group.PgBack },
doc = "decrease line space",
event = "ChangeLineSpace", args = "decrease" },
}
end
-- build face_table for menu
self.face_table = {}
local face_list = cre.getFontFaces()
for k,v in ipairs(face_list) do
table.insert(self.face_table, {
text = v,
callback = function()
self:setFont(v)
end
})
face_list[k] = {text = v}
end
self.ui.menu:registerToMainMenu(self)
end
function ReaderFont:onSetDimensions(dimen)
@ -35,54 +51,39 @@ end
function ReaderFont:onReadSettings(config)
self.font_face = config:readSetting("font_face")
if not self.font_face then
self.font_face = self.ui.document:getFontFace()
self.font_face = self.ui.document.default_font
end
self.ui.document:setFontFace(self.font_face)
self.font_size = config:readSetting("font_size")
if not self.font_size then
self.font_size = self.ui.document:getFontSize()
end
self.ui.document:setFontSize(self.font_size)
end
function ReaderFont:onShowFontMenu()
-- build menu item_table
local face_list = cre.getFontFaces()
for k,v in ipairs(face_list) do
face_list[k] = {text = v}
end
-- NuPogodi, 18.05.12: define the number of the current font in face_list
--local item_no = 0
--while face_list[item_no] ~= self.font_face and item_no < #face_list do
--item_no = item_no + 1
--end
--local fonts_menu = Menu:new{
--menu_title = "Fonts Menu",
--item_array = face_list,
--current_entry = item_no - 1,
--}
local font_menu = Menu:new{
title = "Font Menu",
item_table = face_list,
dimen = self.dimen,
caller = self,
ui = self.ui
-- build menu widget
local main_menu = Menu:new{
title = self.font_menu_title,
item_table = self.face_table,
width = Screen:getWidth() - 100,
}
function font_menu:onMenuChoice(item)
if item.text and self.font_face ~= item.text then
self.caller.font_face = item.text
msg = InfoMessage:new{ text = "Redrawing with "..item.text}
UIManager:show(msg)
self.ui.document:setFontFace(item.text)
-- signal readerrolling to update pos in new height
self.ui:handleEvent(Event:new("UpdatePos"))
UIManager:close(msg)
function main_menu:onMenuChoice(item)
if item.callback then
item.callback()
end
end
UIManager:show(font_menu)
-- build container
local menu_container = CenterContainer:new{
main_menu,
dimen = Screen:getSize(),
}
main_menu.close_callback = function ()
UIManager:close(menu_container)
end
-- show menu
UIManager:show(menu_container)
return true
end
@ -121,3 +122,25 @@ function ReaderFont:onCloseDocument()
self.ui.doc_settings:saveSetting("font_face", self.font_face)
self.ui.doc_settings:saveSetting("font_size", self.font_size)
end
function ReaderFont:setFont(face)
if face and self.font_face ~= face then
self.font_face = face
msg = InfoMessage:new{ text = "Redrawing with "..face }
UIManager:show(msg)
self.ui.document:setFontFace(face)
-- signal readerrolling to update pos in new height
self.ui:handleEvent(Event:new("UpdatePos"))
UIManager:close(msg)
end
end
function ReaderFont:addToMainMenu(item_table)
-- insert table to main reader menu
table.insert(item_table, {
text = self.font_menu_title,
sub_item_table = self.face_table,
})
end

@ -1,6 +1,12 @@
ReaderMenu = InputContainer:new{}
ReaderMenu = InputContainer:new{
item_table = {},
registered_widgets = {},
}
function ReaderMenu:init()
self.item_table = {}
self.registered_widgets = {}
if Device:isTouchDevice() then
self.ges_events = {
TapShowMenu = {
@ -21,16 +27,8 @@ function ReaderMenu:init()
end
end
function ReaderMenu:genSetZoomModeCallBack(mode)
return function()
self.ui:handleEvent(Event:new("SetZoomMode", mode))
end
end
function ReaderMenu:onShowMenu()
local item_table = {}
table.insert(item_table, {
function ReaderMenu:setUpdateItemTable()
table.insert(self.item_table, {
text = "Screen rotate",
sub_item_table = {
{
@ -52,56 +50,27 @@ function ReaderMenu:onShowMenu()
}
})
if self.ui.document.info.has_pages then
table.insert(item_table, {
text = "Switch zoom mode",
sub_item_table = {
{
text = "Zoom to fit content width",
callback = self:genSetZoomModeCallBack("contentwidth")
},
{
text = "Zoom to fit content height",
callback = self:genSetZoomModeCallBack("contentheight")
},
{
text = "Zoom to fit page width",
callback = self:genSetZoomModeCallBack("pagewidth")
},
{
text = "Zoom to fit page height",
callback = self:genSetZoomModeCallBack("pageheight")
},
{
text = "Zoom to fit content",
callback = self:genSetZoomModeCallBack("content")
},
{
text = "Zoom to fit page",
callback = self:genSetZoomModeCallBack("page")
},
}
})
else
table.insert(item_table, {
text = "Font menu",
callback = function()
self.ui:handleEvent(Event:new("ShowFontMenu"))
end
})
for _, widget in pairs(self.registered_widgets) do
widget:addToMainMenu(self.item_table)
end
table.insert(item_table, {
table.insert(self.item_table, {
text = "Return to file browser",
callback = function()
UIManager:close(self.menu_container)
self.ui:onClose()
end
})
end
function ReaderMenu:onShowMenu()
if #self.item_table == 0 then
self:setUpdateItemTable()
end
local main_menu = Menu:new{
title = "Document menu",
item_table = item_table,
item_table = self.item_table,
width = Screen:getWidth() - 100,
}
function main_menu:onMenuChoice(item)
@ -111,8 +80,8 @@ function ReaderMenu:onShowMenu()
end
local menu_container = CenterContainer:new{
main_menu,
dimen = Screen:getSize(),
main_menu,
}
main_menu.close_callback = function ()
UIManager:close(menu_container)
@ -131,7 +100,14 @@ function ReaderMenu:onTapShowMenu()
end
function ReaderMenu:onSetDimensions(dimen)
-- update gesture listenning range according to new screen orientation
self:init()
-- @TODO update gesture listenning range according to new screen
-- orientation 15.12 2012 (houqp)
end
function ReaderMenu:onCloseDocument()
end
function ReaderMenu:registerToMainMenu(widget)
table.insert(self.registered_widgets, widget)
end

@ -85,11 +85,11 @@ function ReaderRolling:init()
end
function ReaderRolling:onReadSettings(config)
self:gotoPercent(config:readSetting("last_percent") or 0)
local soe = config:readSetting("show_overlap_enable")
if not soe then
self.show_overlap_enable = soe
end
self:gotoPercent(config:readSetting("last_percent") or 0)
end
function ReaderRolling:onCloseDocument()
@ -120,7 +120,7 @@ end
function ReaderRolling:onGotoViewRel(diff)
DEBUG("goto relative screen:", diff)
local pan_diff = diff * self.ui.dimen.h
if self.show_overlap_enable then
if self.ui.document.view_mode ~= "page" and self.show_overlap_enable then
if pan_diff > self.overlap then
pan_diff = pan_diff - self.overlap
elseif pan_diff < -self.overlap then
@ -163,7 +163,7 @@ function ReaderRolling:gotoPos(new_pos)
if new_pos < 0 then new_pos = 0 end
if new_pos > self.doc_height then new_pos = self.doc_height end
-- adjust dim_area according to new_pos
if self.show_overlap_enable then
if self.ui.document.view_mode ~= "page" and self.show_overlap_enable then
local panned_step = new_pos - self.current_pos
self.view.dim_area.x = 0
self.view.dim_area.h = self.ui.dimen.h - math.abs(panned_step)

@ -57,7 +57,8 @@ function ReaderView:paintTo(bb, x, y)
self.state.pos)
end
-- dim last read area
if self.dim_area.w ~= 0 and self.dim_area.h ~= 0 then
if self.document.view_mode ~= "page"
and self.dim_area.w ~= 0 and self.dim_area.h ~= 0 then
bb:dimRect(
self.dim_area.x, self.dim_area.y,
self.dim_area.w, self.dim_area.h

@ -49,6 +49,10 @@ ReaderZooming = InputContainer:new{
rotation = 0
}
function ReaderZooming:init()
self.ui.menu:registerToMainMenu(self)
end
function ReaderZooming:onReadSettings(config)
-- @TODO config file from old code base uses globalzoom_mode
-- instead of zoom_mode, we need to handle this imcompatibility
@ -147,4 +151,42 @@ function ReaderZooming:setZoom()
self.view:onZoomUpdate(self.zoom)
end
function ReaderZooming:genSetZoomModeCallBack(mode)
return function()
self.ui:handleEvent(Event:new("SetZoomMode", mode))
end
end
function ReaderZooming:addToMainMenu(item_table)
if self.ui.document.info.has_pages then
table.insert(item_table, {
text = "Switch zoom mode",
sub_item_table = {
{
text = "Zoom to fit content width",
callback = self:genSetZoomModeCallBack("contentwidth")
},
{
text = "Zoom to fit content height",
callback = self:genSetZoomModeCallBack("contentheight")
},
{
text = "Zoom to fit page width",
callback = self:genSetZoomModeCallBack("pagewidth")
},
{
text = "Zoom to fit page height",
callback = self:genSetZoomModeCallBack("pageheight")
},
{
text = "Zoom to fit content",
callback = self:genSetZoomModeCallBack("content")
},
{
text = "Zoom to fit page",
callback = self:genSetZoomModeCallBack("page")
},
}
})
end
end

@ -47,7 +47,8 @@ function ReaderUI:init()
self[1] = ReaderView:new{
dialog = self.dialog,
dimen = self.dimen,
ui = self
ui = self,
document = self.document,
}
-- rotation controller
self[2] = ReaderRotation:new{
@ -66,6 +67,8 @@ function ReaderUI:init()
view = self[1],
ui = self
}
self.menu = self[4] -- hold reference to menu widget
if self.document.info.has_pages then
-- for page specific controller
@ -125,9 +128,10 @@ function ReaderUI:onClose()
DEBUG("closing reader")
self:handleEvent(Event:new("CloseDocument"))
self.doc_settings:flush()
if self.document then
if self.document ~= nil then
self.document:close()
self.document = false
self.document = nil
self.start_pos = nil
end
UIManager:close(self.dialog)
return true

@ -144,8 +144,7 @@ FrameContainer = WidgetContainer:new{
}
function FrameContainer:getSize()
local content_size = WidgetContainer.getSize(self)
local content_size =self[1]:getSize()
return {
w = content_size.w + ( self.margin + self.bordersize + self.padding ) * 2,
h = content_size.h + ( self.margin + self.bordersize + self.padding ) * 2
@ -590,8 +589,22 @@ and store that table as configuration setting
InputContainer = WidgetContainer:new{}
function InputContainer:_init()
self.key_events = {}
self.ges_events = {}
-- we need to do deep copy here
local new_key_events = {}
if self.key_events then
for k,v in pairs(self.key_events) do
new_key_events[k] = v
end
end
self.key_events = new_key_events
local new_ges_events = {}
if self.ges_events then
for k,v in pairs(self.ges_events) do
new_ges_events[k] = v
end
end
self.ges_events = new_ges_events
end
function InputContainer:paintTo(bb, x, y)

@ -1,8 +1,10 @@
#!/bin/sh
export LC_ALL="en_US.UTF-8"
echo unlock > /proc/keypad
echo unlock > /proc/fiveway
PROC_KEYPAD="/proc/keypad"
PROC_FIVEWAY="/proc/fiveway"
test -e $PROC_KEYPAD && echo unlock > $PROC_KEYPAD
test -e $PROC_FIVEWAY && echo unlock > $PROC_FIVEWAY
# we're always starting from our working directory
cd /mnt/us/kindlepdfviewer/

@ -5,6 +5,7 @@ cmake_minimum_required(VERSION 2.6)
SET(MUPDF_DIR ../mupdf)
SET(MUPDF_3RDPARTY_DIR ${MUPDF_DIR}/thirdparty)
SET(CR_3RDPARTY_DIR crengine/thirdparty)
SET(CRE_DIR crengine/crengine)
SET(CR3_PNG 1)
#SET(CR3_JPEG 1)
@ -19,15 +20,17 @@ SET(ZLIB_INCLUDE_DIR ${MUPDF_3RDPARTY_DIR}/zlib)
SET(JPEGLIB_INCLUDE_DIR ${MUPDF_3RDPARTY_DIR}/jpeg)
#SET(JPEGLIB_INCLUDE_DIR ${CR_3RDPARTY_DIR}/libjpeg)
SET(JCONFIG_INCLUDE_DIR ${MUPDF_DIR}/scripts)
SET(CREGINE_INCLUDE_DIR ${CRE_DIR}/include)
INCLUDE_DIRECTORIES(
${JCONFIG_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIRS}
${ANTIWORD_INCLUDE_DIR}
${CHM_INCLUDE_DIRS}
${PNG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${JPEGLIB_INCLUDE_DIR}
${JCONFIG_INCLUDE_DIR}
${CREGINE_INCLUDE_DIR}
)
ADD_DEFINITIONS(-DLINUX=1 -D_LINUX=1 -DUSE_FONTCONFIG=0 -DUSE_FREETYPE=1 -DCR3_PATCH=1 -DNDEBUG=1)
@ -49,8 +52,45 @@ ADD_DEFINITIONS(-DCR3_ANTIWORD_PATCH=1)
ADD_SUBDIRECTORY(${CR_3RDPARTY_DIR}/antiword)
message("Will build crengine library")
SET(GUI kpv)
#ADD_DEFINITIONS(-DJCONFIG_INCLUDED=1)
ADD_SUBDIRECTORY(crengine/crengine)
#SET(GUI kpv)
#ADD_SUBDIRECTORY(crengine/crengine)
ADD_DEFINITIONS(-DHAVE_PROTOTYPES)
ADD_DEFINITIONS(-DHAVE_UNSIGNED_CHAR)
ADD_DEFINITIONS(-Dmain=xxxmain)
SET (CRENGINE_SOURCES
${CRE_DIR}/src/cp_stats.cpp
${CRE_DIR}/src/lvstring.cpp
${CRE_DIR}/src/props.cpp
${CRE_DIR}/src/lstridmap.cpp
${CRE_DIR}/src/rtfimp.cpp
${CRE_DIR}/src/lvmemman.cpp
${CRE_DIR}/src/lvstyles.cpp
${CRE_DIR}/src/crtxtenc.cpp
${CRE_DIR}/src/lvtinydom.cpp
${CRE_DIR}/src/lvstream.cpp
${CRE_DIR}/src/lvxml.cpp
${CRE_DIR}/src/chmfmt.cpp
${CRE_DIR}/src/epubfmt.cpp
${CRE_DIR}/src/pdbfmt.cpp
${CRE_DIR}/src/wordfmt.cpp
${CRE_DIR}/src/lvstsheet.cpp
${CRE_DIR}/src/txtselector.cpp
${CRE_DIR}/src/crtest.cpp
${CRE_DIR}/src/lvbmpbuf.cpp
${CRE_DIR}/src/lvfnt.cpp
${CRE_DIR}/src/hyphman.cpp
${CRE_DIR}/src/lvfntman.cpp
${CRE_DIR}/src/lvimg.cpp
${CRE_DIR}/src/crskin.cpp
${CRE_DIR}/src/lvdrawbuf.cpp
${CRE_DIR}/src/lvdocview.cpp
${CRE_DIR}/src/lvpagesplitter.cpp
${CRE_DIR}/src/lvtextfm.cpp
${CRE_DIR}/src/lvrend.cpp
${CRE_DIR}/src/wolutil.cpp
${CRE_DIR}/src/hist.cpp
${CRE_DIR}/src/cri18n.cpp
)
ADD_LIBRARY(crengine SHARED ${CRENGINE_SOURCES})

@ -1 +1 @@
Subproject commit a9516b455e811b9f57f2805d6c08b6744f797083
Subproject commit 79ef67e1538ef431d6531a3aed5617946ed1d20f

@ -14,23 +14,13 @@ function showReader(file, pass)
return
end
local readerwindow = FrameContainer:new{
dimen = Screen:getSize(),
background = 0,
margin = 0,
padding = 0,
bordersize = 0
}
local reader = ReaderUI:new{
dialog = readerwindow,
dimen = Screen:getSize(),
document = document,
password = pass
}
readerwindow[1] = reader
UIManager:show(readerwindow)
UIManager:show(reader)
end
function showFileManager(path)
@ -136,6 +126,8 @@ Screen:setRotationMode(Screen.native_rotation_mode)
input.closeAll()
if util.isEmulated()==0 then
os.execute("killall -cont cvm")
-- send double menu key press events to trigger screen refresh
os.execute("echo 'send 139' > /proc/keypad;echo 'send 139' > /proc/keypad")
if Device:isKindle3() or (Device:getModel() == "KindleDXG") then
-- send double menu key press events to trigger screen refresh
os.execute("echo 'send 139' > /proc/keypad;echo 'send 139' > /proc/keypad")
end
end

Loading…
Cancel
Save