Merge pull request #18 from houqp/master

bug fix for font menu & switch key binds in pdfreader.lua
pull/2/merge
HW 12 years ago
commit f05e295688

@ -153,12 +153,15 @@ function FileChooser:choose(ypos, height)
elseif ev.code == KEY_FW_DOWN then elseif ev.code == KEY_FW_DOWN then
nextItem() nextItem()
elseif ev.code == KEY_F then -- invoke fontchooser menu elseif ev.code == KEY_F then -- invoke fontchooser menu
FontChooser:init()
fonts_menu = SelectMenu:new{ fonts_menu = SelectMenu:new{
menu_title = "Fonts Menu", menu_title = "Fonts Menu",
item_array = FontChooser.fonts, item_array = FontChooser.fonts,
} }
FontChooser.cfont = FontChooser.fonts[fonts_menu:choose(0, height)] local re = fonts_menu:choose(0, height)
if re then
FontChooser.cfont = FontChooser.fonts[re]
FontChooser:init()
end
pagedirty = true pagedirty = true
elseif ev.code == KEY_S then -- invoke search input elseif ev.code == KEY_S then -- invoke search input
keywords = InputBox:input(height-100, 100, "Search:") keywords = InputBox:input(height-100, 100, "Search:")

@ -116,7 +116,6 @@ function FileSearcher:choose(ypos, height, keywords)
local perpage = math.floor(height / self.spacing) - 2 local perpage = math.floor(height / self.spacing) - 2
local pagedirty = true local pagedirty = true
local markerdirty = false local markerdirty = false
self:updateFont()
local prevItem = function () local prevItem = function ()
if self.current == 1 then if self.current == 1 then
@ -154,6 +153,7 @@ function FileSearcher:choose(ypos, height, keywords)
end end
while true do while true do
self:updateFont()
if pagedirty then if pagedirty then
markerdirty = true markerdirty = true
fb.bb:paintRect(0, ypos, fb.bb:getWidth(), height, 0) fb.bb:paintRect(0, ypos, fb.bb:getWidth(), height, 0)
@ -248,6 +248,17 @@ function FileSearcher:choose(ypos, height, keywords)
keywords = old_keywords keywords = old_keywords
end end
pagedirty = true pagedirty = true
elseif ev.code == KEY_F then -- invoke fontchooser menu
fonts_menu = SelectMenu:new{
menu_title = "Fonts Menu",
item_array = FontChooser.fonts,
}
local re = fonts_menu:choose(0, height)
if re then
FontChooser.cfont = FontChooser.fonts[re]
FontChooser:init()
end
pagedirty = true
elseif ev.code == KEY_ENTER or ev.code == KEY_FW_PRESS then elseif ev.code == KEY_ENTER or ev.code == KEY_FW_PRESS then
file_entry = self.result[perpage*(self.page-1)+self.current] file_entry = self.result[perpage*(self.page-1)+self.current]
file_path = file_entry.dir .. "/" .. file_entry.name file_path = file_entry.dir .. "/" .. file_entry.name

@ -377,12 +377,7 @@ function PDFReader:inputloop()
end end
elseif ev.code == KEY_BACK then elseif ev.code == KEY_BACK then
if self.altmode then if self.altmode then
-- in altmode, back to last jump -- altmode, exit pdfreader
if #self.jump_stack ~= 0 then
self:goto(self.jump_stack[1].page)
end
else
-- not shiftmode, exit pdfreader
self:clearcache() self:clearcache()
if self.doc ~= nil then if self.doc ~= nil then
self.doc:close() self.doc:close()
@ -393,6 +388,11 @@ function PDFReader:inputloop()
self.settings:close() self.settings:close()
end end
return return
else
-- not altmode, back to last jump
if #self.jump_stack ~= 0 then
self:goto(self.jump_stack[1].page)
end
end end
elseif ev.code == KEY_VPLUS then elseif ev.code == KEY_VPLUS then
self:modify_gamma( 1.25 ) self:modify_gamma( 1.25 )

Loading…
Cancel
Save