From 01046fe478a910cef100715ad4c7e3f10afdc2a0 Mon Sep 17 00:00:00 2001 From: chrox Date: Thu, 26 Dec 2013 02:00:48 +0800 Subject: [PATCH 1/4] fix font size change when reopening the same credocument --- frontend/ui/reader/readercoptlistener.lua | 8 -------- frontend/ui/reader/readerfont.lua | 3 ++- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/frontend/ui/reader/readercoptlistener.lua b/frontend/ui/reader/readercoptlistener.lua index 78fd4e2fd..7371b96f6 100644 --- a/frontend/ui/reader/readercoptlistener.lua +++ b/frontend/ui/reader/readercoptlistener.lua @@ -22,14 +22,6 @@ function ReaderCoptListener:onReadSettings(config) end) end - local copt_font_size = config:readSetting("copt_font_size") - if copt_font_size then - table.insert(self.ui.postInitCallback, function() - self.ui.document:setFontSize(copt_font_size) - self.ui:handleEvent(Event:new("UpdatePos")) - end) - end - local copt_margins = config:readSetting("copt_page_margins") if copt_margins then table.insert(self.ui.postInitCallback, function() diff --git a/frontend/ui/reader/readerfont.lua b/frontend/ui/reader/readerfont.lua index f85f65c33..67e002db0 100644 --- a/frontend/ui/reader/readerfont.lua +++ b/frontend/ui/reader/readerfont.lua @@ -8,6 +8,7 @@ local Input = require("ui/input") local Event = require("ui/event") local UIManager = require("ui/uimanager") local Screen = require("ui/screen") +local DEBUG = require("dbg") local _ = require("gettext") local ReaderFont = InputContainer:new{ @@ -80,7 +81,7 @@ function ReaderFont:onReadSettings(config) --@TODO change this! 12.01 2013 (houqp) self.font_size = 29 end - self.ui.document:setFontSize(self.font_size) + self.ui.document:setFontSize(Screen:scaleByDPI(self.font_size)) self.line_space_percent = config:readSetting("line_space_percent") if not self.line_space_percent then From 2f9e65871a6ebfc5990d195e2c12637a090f0218 Mon Sep 17 00:00:00 2001 From: chrox Date: Thu, 26 Dec 2013 06:18:38 +0800 Subject: [PATCH 2/4] invert item when tapping on filemanager --- frontend/apps/filemanager/filemanager.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/apps/filemanager/filemanager.lua b/frontend/apps/filemanager/filemanager.lua index 64b201fc2..acd10f38a 100644 --- a/frontend/apps/filemanager/filemanager.lua +++ b/frontend/apps/filemanager/filemanager.lua @@ -40,6 +40,7 @@ function FileManager:init() local file_chooser = FileChooser:new{ -- remeber to adjust the height when new item is added to the group path = self.root_path, + show_parent = self.show_parent, height = Screen:getHeight() - self.banner:getSize().h, is_popout = false, is_borderless = true, From b0d27a021d97fdca6374830448d12bd1132c3001 Mon Sep 17 00:00:00 2001 From: chrox Date: Thu, 26 Dec 2013 06:19:48 +0800 Subject: [PATCH 3/4] tweaks on menu font size --- frontend/ui/widget/menu.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/ui/widget/menu.lua b/frontend/ui/widget/menu.lua index bc4effcea..e2e00863e 100644 --- a/frontend/ui/widget/menu.lua +++ b/frontend/ui/widget/menu.lua @@ -169,7 +169,7 @@ function MenuItem:init() end local text_container = LeftContainer:new{ - dimen = Geom:new{w = self.content_width}, + dimen = Geom:new{w = self.content_width, h = self.dimen.h}, TextWidget:new{ text = self.text, face = self.face, @@ -177,7 +177,7 @@ function MenuItem:init() } local mandatory_container = RightContainer:new{ - dimen = Geom:new{w = self.content_width}, + dimen = Geom:new{w = self.content_width, h = self.dimen.h}, TextWidget:new{ text = mandatory, face = self.info_face, @@ -192,6 +192,7 @@ function MenuItem:init() HorizontalGroup:new{ align = "center", OverlapGroup:new{ + dimen = Geom:new{w = self.content_width, h = self.dimen.h}, text_container, mandatory_container, }, @@ -245,16 +246,15 @@ function MenuItem:onTapSelect() return true end - --[[ Widget that displays menu --]] local Menu = FocusManager:new{ show_parent = nil, -- face for displaying item contents - cface = Font:getFace("cfont", 22), + cface = Font:getFace("cfont", 24), -- face for menu title - tface = Font:getFace("tfont", 25), + tface = Font:getFace("tfont", 26), -- face for paging info display fface = Font:getFace("ffont", 16), -- font for item shortcut @@ -302,7 +302,7 @@ function Menu:_recalculateDimen() end self.item_dimen = Geom:new{ w = self.dimen.w, - h = Screen:scaleByDPI(36), -- hardcoded for now + h = Screen:scaleByDPI(46), -- hardcoded for now } self.perpage = math.floor((self.dimen.h - self.dimen.x) / self.item_dimen.h) - 2 self.page_num = math.ceil(#self.item_table / self.perpage) From b5fd38f897347f2f6eabf95e1c216476304df567 Mon Sep 17 00:00:00 2001 From: chrox Date: Thu, 26 Dec 2013 06:24:29 +0800 Subject: [PATCH 4/4] delayed calling of gotoXPointer when internal properties are changed This should fix #400 and fix #300. --- frontend/ui/reader/readerrolling.lua | 9 +++++++-- frontend/ui/reader/readerview.lua | 1 + frontend/ui/widget/configdialog.lua | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/ui/reader/readerrolling.lua b/frontend/ui/reader/readerrolling.lua index 1f8e4aec0..318eedc2e 100644 --- a/frontend/ui/reader/readerrolling.lua +++ b/frontend/ui/reader/readerrolling.lua @@ -6,6 +6,7 @@ local Input = require("ui/input") local Event = require("ui/event") local GestureRange = require("ui/gesturerange") local ReaderPanning = require("ui/reader/readerpanning") +local UIManager = require("ui/uimanager") local DEBUG = require("dbg") local _ = require("gettext") @@ -243,7 +244,7 @@ end function ReaderRolling:onZoom() --@TODO re-read doc_height info after font or lineheight changes 05.06 2012 (houqp) - self:onUpdatePos() + self:updatePos() end --[[ @@ -251,6 +252,11 @@ end font has been changed, or line height has been changed. --]] function ReaderRolling:onUpdatePos() + UIManager:scheduleIn(0.1, function () self:updatePos() end) + return true +end + +function ReaderRolling:updatePos() -- reread document height self.ui.document:_readMetadata() -- update self.current_pos if the height of document has been changed. @@ -262,7 +268,6 @@ function ReaderRolling:onUpdatePos() self.old_page = new_page self.ui:handleEvent(Event:new("UpdateToc")) end - return true end function ReaderRolling:onChangeViewMode() diff --git a/frontend/ui/reader/readerview.lua b/frontend/ui/reader/readerview.lua index f4edb981b..f472d45ea 100644 --- a/frontend/ui/reader/readerview.lua +++ b/frontend/ui/reader/readerview.lua @@ -573,6 +573,7 @@ function ReaderView:onSetPageMargins(margins) local right = margins[3] local bottom = margins[4] self.ui.document:setPageMargins(left, top, right, bottom) + self.ui:handleEvent(Event:new("UpdatePos")) return true end diff --git a/frontend/ui/widget/configdialog.lua b/frontend/ui/widget/configdialog.lua index bbc4231e3..6e4ed9a71 100644 --- a/frontend/ui/widget/configdialog.lua +++ b/frontend/ui/widget/configdialog.lua @@ -509,6 +509,7 @@ function ConfigDialog:onConfigChoice(option_name, option_value) --DEBUG("config option value", option_name, option_value) self.configurable[option_name] = option_value self.ui:handleEvent(Event:new("StartActivityIndicator")) + self:closeDialog() return true end