Merge pull request #566 from chrox/master

various tweaks and fixes
pull/568/head
Qingping Hou 10 years ago
commit b7ab1efe8a

@ -4,12 +4,6 @@ local Event = require("ui/event")
local ReaderCoptListener = EventListener:new{}
function ReaderCoptListener:onReadSettings(config)
local embedded_css = config:readSetting("copt_embedded_css")
local toggle_embedded_css = embedded_css == 0 and false or true
table.insert(self.ui.postInitCallback, function()
self.ui:handleEvent(Event:new("ToggleEmbeddedStyleSheet", toggle_embedded_css))
end)
local view_mode = config:readSetting("copt_view_mode")
if view_mode == 0 then
table.insert(self.ui.postInitCallback, function()
@ -20,7 +14,7 @@ function ReaderCoptListener:onReadSettings(config)
self.ui:handleEvent(Event:new("SetViewMode", "scroll"))
end)
end
local status_line = config:readSetting("copt_status_line") or DCREREADER_PROGRESS_BAR
self.document:setStatusLineProp(status_line)
end

@ -25,9 +25,10 @@ function ReaderTypeset:onReadSettings(config)
end
-- default to enable embedded css
self.embedded_css = config:readSetting("embedded_css") or true
self.embedded_css = config:readSetting("embedded_css")
if self.embedded_css == nil then self.embedded_css = true end
self.ui.document:setEmbeddedStyleSheet(self.embedded_css and 1 or 0)
-- set page margins
self:onSetPageMargins(config:readSetting("copt_page_margins") or DCREREADER_CONFIG_MARGIN_SIZES_MEDIUM)
end

@ -59,7 +59,8 @@ function CreDocument:engineInit()
-- we need to initialize the CRE font list
local fonts = Font:getFontList()
for _k, _v in ipairs(fonts) do
if _v ~= "Dingbats.cff" and _v ~= "StandardSymL.cff" then
if _v ~= "Dingbats.cff" and _v ~= "StandardSymL.cff"
and _v:sub(1, 6) ~= "Nimbus" then
local ok, err = pcall(cre.registerFont, Font.fontdir..'/'.._v)
if not ok then
DEBUG(err)

@ -325,7 +325,8 @@ function Menu:_recalculateDimen()
w = self.dimen.w,
h = Screen:scaleByDPI(46), -- hardcoded for now
}
self.perpage = math.floor((self.dimen.h - self.dimen.y - self.header_padding) / self.item_dimen.h) - 2
-- header and footer should approximately take up space of 2 items
self.perpage = math.floor(self.dimen.h / self.item_dimen.h) - (self.no_title and 1 or 2)
self.page_num = math.ceil(#self.item_table / self.perpage)
end

@ -1,7 +1,7 @@
local InputContainer = require("ui/widget/container/inputcontainer")
local FrameContainer = require("ui/widget/container/framecontainer")
local CenterContainer = require("ui/widget/container/centercontainer")
local TextBoxWidget = require("ui/widget/textboxwidget")
local TextWidget = require("ui/widget/textwidget")
local Font = require("ui/font")
local Geom = require("ui/geometry")
local Device = require("ui/device")
@ -17,6 +17,8 @@ local Notification = InputContainer:new{
face = Font:getFace("infofont", 20),
text = "Null Message",
timeout = nil,
margin = 5,
padding = 5,
}
function Notification:init()
@ -26,21 +28,27 @@ function Notification:init()
}
end
-- we construct the actual content here because self.text is only available now
local text_widget = TextWidget:new{
text = self.text,
face = self.face
}
local widget_size = text_widget:getSize()
self[1] = CenterContainer:new{
dimen = Geom:new{
w = Screen:getWidth(),
h = Screen:getHeight()/10,
},
ignore = "height",
FrameContainer:new{
background = 0,
radius = 0,
HorizontalGroup:new{
align = "center",
TextBoxWidget:new{
text = self.text,
face = self.face,
}
margin = self.margin,
padding = self.padding,
CenterContainer:new{
dimen = Geom:new{
w = widget_size.w,
h = widget_size.h
},
text_widget,
}
}
}

Loading…
Cancel
Save