Merge pull request #638 from houqp/new_ui_code_fix

zoom mode support in reader menu & menu module bug fix
This commit is contained in:
{Qingping,Dave} Hou
2012-11-29 07:33:54 -08:00
5 changed files with 96 additions and 22 deletions

View File

@@ -21,6 +21,12 @@ 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 = {}
@@ -31,14 +37,16 @@ function ReaderMenu:onShowMenu()
text = "rotate 90 degree clockwise",
callback = function()
Screen:screenRotate("clockwise")
self.ui:handleEvent(Event:new("SetDimensions", Screen:getSize()))
self.ui:handleEvent(
Event:new("SetDimensions", Screen:getSize()))
end
},
{
text = "rotate 90 degree anticlockwise",
callback = function()
Screen:screenRotate("anticlockwise")
self.ui:handleEvent(Event:new("SetDimensions", Screen:getSize()))
self.ui:handleEvent(
Event:new("SetDimensions", Screen:getSize()))
end
},
}
@@ -50,9 +58,27 @@ function ReaderMenu:onShowMenu()
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")
},
}
})