add page margin options in CREOptions

This commit is contained in:
chrox
2013-06-28 17:12:04 +08:00
parent 67816852ac
commit 94526fa26d
5 changed files with 52 additions and 7 deletions

View File

@@ -1,13 +1,14 @@
ReaderCoptListener = EventListener:new{}
function ReaderKoptListener:onReadSettings(config)
function ReaderCoptListener:onReadSettings(config)
local embedded_css = config:readSetting("copt_embedded_css")
if embedded_css == 1 then
if embedded_css == 0 then
table.insert(self.ui.postInitCallback, function()
self.ui:handleEvent(Event:new("ToggleEmbeddedStyleSheet"))
self.ui:handleEvent(Event:new("ToggleEmbeddedStyleSheet", false))
end)
end
local view_mode = config:readSetting("copt_view_mode")
if view_mode == 0 then
table.insert(self.ui.postInitCallback, function()
@@ -18,4 +19,18 @@ function ReaderKoptListener:onReadSettings(config)
self.ui:handleEvent(Event:new("SetViewMode", "scroll"))
end)
end
local copt_font_size = config:readSetting("copt_font_size")
if copt_font_size then
table.insert(self.ui.postInitCallback, function()
self.ui:handleEvent(Event:new("SetFontSize", copt_font_size))
end)
end
local copt_margins = config:readSetting("copt_page_margins")
if copt_margins then
table.insert(self.ui.postInitCallback, function()
self.ui:handleEvent(Event:new("SetPageMargins", copt_margins))
end)
end
end