use regional update when selecting config panels

pull/167/head
chrox 11 years ago
parent f2a6b7c4e3
commit 8dbaa2c76c

@ -37,12 +37,13 @@ end
OptionTextItem = InputContainer:new{} OptionTextItem = InputContainer:new{}
function OptionTextItem:init() function OptionTextItem:init()
local text_widget = self[1] local text_widget = self[1]
self.dimen = text_widget:getSize()
self[1] = UnderlineContainer:new{ self[1] = UnderlineContainer:new{
text_widget, text_widget,
padding = self.padding, padding = self.padding,
color = self.color, color = self.color,
} }
self.dimen = self[1]:getSize()
-- we need this table per-instance, so we declare it here -- we need this table per-instance, so we declare it here
if Device:isTouchDevice() then if Device:isTouchDevice() then
self.ges_events = { self.ges_events = {
@ -255,7 +256,6 @@ function ConfigOption:init()
end end
end end
end end
if self.options[c].item_text then if self.options[c].item_text then
for d = 1, #self.options[c].item_text do for d = 1, #self.options[c].item_text do
local option_item = nil local option_item = nil
@ -421,13 +421,10 @@ function ConfigDialog:init()
------------------------------------------ ------------------------------------------
-- start to set up widget layout --------- -- start to set up widget layout ---------
------------------------------------------ ------------------------------------------
self.config_panel = ConfigPanel:new{
config_dialog = self,
}
self.config_menubar = MenuBar:new{ self.config_menubar = MenuBar:new{
config_dialog = self, config_dialog = self,
} }
self:makeDialog() self:update()
------------------------------------------ ------------------------------------------
-- start to set up input event callback -- -- start to set up input event callback --
------------------------------------------ ------------------------------------------
@ -449,19 +446,17 @@ function ConfigDialog:init()
self.key_events.FocusRight = nil self.key_events.FocusRight = nil
end end
self.key_events.Select = { {"Press"}, doc = _("select current menu item") } self.key_events.Select = { {"Press"}, doc = _("select current menu item") }
UIManager:setDirty(self, "partial")
end end
function ConfigDialog:updateConfigPanel(index) function ConfigDialog:updateConfigPanel(index)
self.panel_index = index
end
function ConfigDialog:update()
self.config_panel = ConfigPanel:new{ self.config_panel = ConfigPanel:new{
index = index, index = self.panel_index,
config_dialog = self, config_dialog = self,
} }
end
function ConfigDialog:makeDialog()
self.dialog_frame = FrameContainer:new{ self.dialog_frame = FrameContainer:new{
background = 0, background = 0,
VerticalGroup:new{ VerticalGroup:new{
@ -474,12 +469,20 @@ function ConfigDialog:makeDialog()
dimen = Screen:getSize(), dimen = Screen:getSize(),
self.dialog_frame, self.dialog_frame,
} }
UIManager.repaint_all = true
end end
function ConfigDialog:onShowConfigPanel(index) function ConfigDialog:onShowConfigPanel(index)
self:updateConfigPanel(index) self.panel_index = index
self:makeDialog() local orig_dimen = self.dialog_frame and self.dialog_frame.dimen or Geom:new{}
UIManager.repaint_all = true
self:update()
UIManager.update_region_func = function()
local update_region = self.dialog_frame.dimen:combine(orig_dimen)
DEBUG("update region", update_region)
return update_region
end
return true return true
end end
@ -487,12 +490,13 @@ function ConfigDialog:onConfigChoice(option_name, option_value)
--DEBUG("config option value", option_name, option_value) --DEBUG("config option value", option_name, option_value)
self.configurable[option_name] = option_value self.configurable[option_name] = option_value
self.ui:handleEvent(Event:new("StartActivityIndicator")) self.ui:handleEvent(Event:new("StartActivityIndicator"))
return true
end end
function ConfigDialog:onConfigEvent(option_event, option_arg) function ConfigDialog:onConfigEvent(option_event, option_arg)
--DEBUG("config option event", option_event, option_arg) --DEBUG("config option event", option_event, option_arg)
self.ui:handleEvent(Event:new(option_event, option_arg)) self.ui:handleEvent(Event:new(option_event, option_arg))
self:onShowConfigPanel(self.panel_index) return true
end end
function ConfigDialog:closeDialog() function ConfigDialog:closeDialog()

Loading…
Cancel
Save