Mercurial > wow > reaction
changeset 46:aa0b7fd68462
rearranged options table initialization a little
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Thu, 10 Apr 2008 23:27:58 +0000 |
parents | 38ee32135d86 |
children | e12b736c23c3 |
files | ReAction.lua locale/enUS.lua modules/ReAction_ConfigUI/ReAction_ConfigUI.lua |
diffstat | 3 files changed, 87 insertions(+), 114 deletions(-) [+] |
line wrap: on
line diff
--- a/ReAction.lua Thu Apr 03 23:18:45 2008 +0000 +++ b/ReAction.lua Thu Apr 10 23:27:58 2008 +0000 @@ -149,6 +149,21 @@ self:RegisterEvent("PLAYER_REGEN_DISABLED") self.bars = {} + self.options = {} + + self:RegisterOptions("global", self, { + unlock = { + type = "toggle", + handler = module, + name = L["Unlock Bars"], + desc = L["Unlock bars for dragging and resizing with the mouse"], + get = function() return self.configMode end, + set = function(info, value) self:SetConfigMode(value) end, + disabled = InCombatLockdown, + order = 1 + }, + }) + end function ReAction:OnEnable() @@ -286,7 +301,6 @@ end end -ReAction.options = {} -- See modules/ReAction_ConfigUI for valid options contexts. function ReAction:RegisterOptions(context, module, opts) if module == nil or context == nil then
--- a/locale/enUS.lua Thu Apr 03 23:18:45 2008 +0000 +++ b/locale/enUS.lua Thu Apr 10 23:27:58 2008 +0000 @@ -42,10 +42,8 @@ L["Unlock bars for dragging and resizing with the mouse"] = true L["Module Settings"] = true L["Configuration settings for each module"] = true -L["Bar Settings"] = true +L["Bar Config"] = true L["Configuration settings for bars"] = true -L["All Bars"] = true -L["Settings applicable to all bars"] = true --L["Rename Bar"] = true --L["Set a name for the bar"] = true
--- a/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Thu Apr 03 23:18:45 2008 +0000 +++ b/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Thu Apr 10 23:27:58 2008 +0000 @@ -12,123 +12,19 @@ local moduleID = "ConfigUI" local module = ReAction:NewModule( moduleID ) --- options table basic layer -module.configOptions = { - type = "group", - childGroups = "tab", - args = { - desc = { - type = "description", - name = L["Customizable replacement for Blizzard's Action Bars"], - }, - global = { - type = "group", - name = L["Global Settings"], - desc = L["Global configuration settings"], - args = { - unlock = { - type = "toggle", - handler = module, - name = L["Unlock Bars"], - desc = L["Unlock bars for dragging and resizing with the mouse"], - get = function() return ReAction.configMode end, - set = function(info, value) ReAction:SetConfigMode(value) end, - disabled = InCombatLockdown, - order = 1 - }, - }, - order = 1, - }, - bar = { - type = "group", - name = L["Bar Settings"], - desc = L["Configuration settings for bars"], - childGroups = "select", - args = { - all = { - type = "group", - name = L["All Bars"], - desc = L["Settings applicable to all bars"], - args = { - foo = { - type = "toggle", - name = "foo", - desc = "description", - get = function() return true end, - set = function() end, - } - }, - order = 1 - } - }, - order = 2 - }, - module = { - type = "group", - childGroups = "select", - name = L["Module Settings"], - desc = L["Configuration settings for each module"], - args = { - configUI = { - type = "group", - name = "Config UI", - desc = "description", - args = { - foo = { - type = "toggle", - handler = module, - name = "foo", - desc = "description", - get = function() return true end, - set = function() end, - } - } - }, - }, - order = -1, - }, - }, - plugins = { } -} - -- module methods function module:OnInitialize() - self.db = ReAction.db:RegisterNamespace( moduleID, - { - profile = { } - } - ) - - for _, m in pairs(ReAction:GetOptions("global")) do - for k, v in pairs(m) do - self.configOptions.args.global.args[k] = v - end - end - - self.configOptions.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db) - self.configOptions.args.profile.order = -2 - - LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("ReAction",self.configOptions) - self.frame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ReAction", "ReAction") - self.frame.obj.SetCallback(self,"default") - ReAction.RegisterCallback(self,"OnOptionsRegistered") ReAction.RegisterCallback(self,"OnOptionsRefreshed") + self:InitializeOptions() end function module:OnOptionsRegistered(evt, context, module, opts) - if context == "global" then + local c = self.configOptions.args[context] + if c then for k, v in pairs(opts) do - self.configOptions.args.global.args[k] = v + c.args[k] = v end - elseif context == "module" then - for k, v in pairs(opts) do - self.configOptions.args.module.args[k] = v - end - elseif context == "bar" then - - elseif context == "barMenu" then - end end @@ -143,8 +39,72 @@ end end -function module:default() - -- called from the Interface Options panel, this returns the current profile to the default - ReAction.db:ResetProfile() +function module:InitializeOptions() + self.configOptions = { + type = "group", + childGroups = "tab", + args = { + global = { + type = "group", + name = L["Global Settings"], + desc = L["Global configuration settings"], + args = { }, + order = 1, + }, + bar = { + type = "group", + name = L["Bar Config"], + desc = L["Configuration settings for bars"], + args = { }, + order = 2, + }, + module = { + type = "group", + childGroups = "select", + name = L["Module Settings"], + desc = L["Configuration settings for each module"], + args = { }, + order = -1, + }, + }, + plugins = { } + } + + for c, tbl in pairs(self.configOptions.args) do + for _, m in pairs(ReAction:GetOptions(c)) do + for k, v in pairs(m) do + tbl.args[k] = v + end + end + end + + self.configOptions.args.desc = { + type = "description", + name = L["Customizable replacement for Blizzard's Action Bars"], + } + self.configOptions.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db) + self.configOptions.args.profile.order = -2 + + ReAction:RegisterOptions("module",self, { + configUI = { + type = "group", + name = "Config UI", + desc = "description", + args = { + foo = { + type = "toggle", + handler = self, + name = "foo", + desc = "description", + get = function() return true end, + set = function() end, + } + } + }, + }) + + LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("ReAction",self.configOptions) + self.frame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ReAction", "ReAction") + self.frame.obj:SetCallback("default", function() ReAction.db:ResetProfile() end) end