Merge pull request #154 from houqp/master

Two bug fixes & patches from NuPogodi
Dobrica Pavlinušić 12 years ago
commit 0d4d7e7fb9

@ -30,10 +30,21 @@ end
function CREReader:open(filename)
local ok
local file_type = string.lower(string.match(filename, ".+%.([^.]+)"))
-- these two format use the same css file
if file_type == "html" then
file_type = "htm"
end
-- detect file type for documents inside zip file
-- @TODO do the detection after the file is unzipped 30.04 2012 (houqp)
if file_type == "zip" then
-- store filename without zip-extention to fn
local fn = string.lower(string.sub(filename,0,-4))
-- if no double extention then default file_type
file_type = string.lower(string.match(fn, ".+%.([^.]+)") or "fb2")
end
local style_sheet = "./data/"..file_type..".css"
ok, self.doc = pcall(cre.openDocument, filename, style_sheet,
G_width, G_height)
@ -51,7 +62,7 @@ end
----------------------------------------------------
function CREReader:loadSpecialSettings()
local font_face = self.settings:readSetting("font_face")
self.font_face = font_face or "FreeSerif"
self.font_face = font_face or "Droid Sans Fallback"
self.doc:setFontFace(self.font_face)
local gamma_index = self.settings:readSetting("gamma_index")

@ -97,7 +97,6 @@ function InputBox:delChar()
fb.bb:paintRect(self.input_cur_x, self.input_start_y-19,
self.fwidth, self.fheight, self.input_bg)
fb:refresh(1, self.input_cur_x, self.input_start_y-19, self.fwidth, self.fheight)
self.input_string = self.input_string:sub(0,-2)
-- draw new cursor
self.cursor:moveHorizontal(-self.fwidth)

@ -2402,6 +2402,17 @@ function UniReader:addAllCommands()
unireader:goto(unireader.pageno)
end
)
self.commands:add(KEY_P, MOD_SHIFT, "P",
"make screenshot",
function(unireader)
--@TODO convert bitmap to png or jpeg 30.04 2012 (houqp)
os.execute("mkdir ".."/mnt/us/kindlepdfviewer/screenshots")
local d = os.date("%Y%m%d%H%M%S")
InfoMessage:show("making screenshot...", 1)
os.execute("dd ".."if=/dev/fb0 ".."of=/mnt/us/kindlepdfviewer/screenshots/" .. d .. ".raw")
unireader:redrawCurrentPage()
end
)
-- commands.map is very large, impacts startup performance on device
--debug("defined commands "..dump(self.commands.map))
end

Loading…
Cancel
Save