flickerstreak@25: --[[ flickerstreak@25: ReAction Configuration UI module flickerstreak@25: flickerstreak@33: Hooks into Blizzard Interface Options AddOns panel flickerstreak@25: --]] flickerstreak@25: flickerstreak@25: -- local imports flickerstreak@25: local ReAction = ReAction flickerstreak@25: local L = ReAction.L flickerstreak@25: flickerstreak@25: -- module declaration flickerstreak@25: local moduleID = "ConfigUI" flickerstreak@33: local module = ReAction:NewModule( moduleID ) flickerstreak@25: flickerstreak@33: -- options table basic layer flickerstreak@25: module.configOptions = { flickerstreak@25: type = "group", flickerstreak@30: childGroups = "tab", flickerstreak@25: args = { flickerstreak@30: desc = { flickerstreak@30: type = "description", flickerstreak@30: name = L["Customizable replacement for Blizzard's Action Bars"], flickerstreak@30: }, flickerstreak@25: global = { flickerstreak@25: type = "group", flickerstreak@25: name = L["Global Settings"], flickerstreak@25: desc = L["Global configuration settings"], flickerstreak@30: args = { flickerstreak@30: unlock = { flickerstreak@30: type = "toggle", flickerstreak@30: handler = module, flickerstreak@30: name = L["Unlock Bars"], flickerstreak@30: desc = L["Unlock bars for dragging and resizing with the mouse"], flickerstreak@30: get = function() return module.configMode end, flickerstreak@30: set = function(info, value) module:SetConfigMode(value) end, flickerstreak@30: disabled = InCombatLockdown, flickerstreak@30: order = 1 flickerstreak@30: }, flickerstreak@30: }, flickerstreak@25: order = 1, flickerstreak@25: }, flickerstreak@25: module = { flickerstreak@25: type = "group", flickerstreak@30: childGroups = "select", flickerstreak@25: name = L["Module Settings"], flickerstreak@25: desc = L["Configuration settings for each module"], flickerstreak@30: args = { flickerstreak@30: configUI = { flickerstreak@30: type = "group", flickerstreak@30: name = "Config UI", flickerstreak@30: desc = "description", flickerstreak@30: args = { flickerstreak@30: foo = { flickerstreak@30: type = "toggle", flickerstreak@30: handler = module, flickerstreak@30: name = "foo", flickerstreak@30: desc = "description", flickerstreak@30: get = function() return true end, flickerstreak@30: set = function() end, flickerstreak@30: } flickerstreak@30: } flickerstreak@30: }, flickerstreak@30: }, flickerstreak@30: order = -1, flickerstreak@25: }, flickerstreak@30: }, flickerstreak@30: plugins = { } flickerstreak@25: } flickerstreak@25: flickerstreak@25: -- module methods flickerstreak@25: function module:OnInitialize() flickerstreak@28: self.db = ReAction.db:RegisterNamespace( moduleID, flickerstreak@25: { flickerstreak@28: profile = { } flickerstreak@25: } flickerstreak@25: ) flickerstreak@25: flickerstreak@30: for _, m in pairs(ReAction:GetOptions("global")) do flickerstreak@30: for k, v in pairs(m) do flickerstreak@30: self.configOptions.args.global.args[k] = v flickerstreak@30: end flickerstreak@30: end flickerstreak@33: flickerstreak@33: self.configOptions.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db) flickerstreak@33: self.configOptions.args.profile.order = -2 flickerstreak@33: flickerstreak@33: LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("ReAction",self.configOptions) flickerstreak@33: LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ReAction", "ReAction") flickerstreak@30: ReAction.RegisterCallback(self,"OnOptionsRegistered") flickerstreak@33: ReAction.RegisterCallback(self,"OnOptionsRefreshed") flickerstreak@25: end flickerstreak@25: flickerstreak@30: function module:OnOptionsRegistered(evt, context, module, opts) flickerstreak@30: if context == "global" then flickerstreak@30: for k, v in pairs(opts) do flickerstreak@30: self.configOptions.args.global.args[k] = v flickerstreak@30: end flickerstreak@30: elseif context == "module" then flickerstreak@30: for k, v in pairs(opts) do flickerstreak@30: self.configOptions.args.module.args[k] = v flickerstreak@30: end flickerstreak@30: elseif context == "bar" then flickerstreak@30: flickerstreak@30: elseif context == "barMenu" then flickerstreak@30: flickerstreak@30: end flickerstreak@25: end flickerstreak@25: flickerstreak@33: function module:OnOptionsRefreshed(evt) flickerstreak@33: -- TODO: refresh options frame (just OpenConfig again?) flickerstreak@25: end flickerstreak@25: flickerstreak@25: function module:OpenConfig(bar) flickerstreak@30: InterfaceOptionsFrame_OpenToFrame("ReAction") flickerstreak@33: if bar then flickerstreak@33: -- TODO: select the correct bar pane flickerstreak@25: end flickerstreak@25: end