annotate modules/ReAction_ConfigUI/ReAction_ConfigUI.lua @ 44:2232b8336903

- Added bar config tab - rearranged locale string grouping
author Flick <flickerstreak@gmail.com>
date Thu, 03 Apr 2008 23:17:47 +0000
parents 11ddb9610770
children aa0b7fd68462
rev   line source
flickerstreak@25 1 --[[
flickerstreak@25 2 ReAction Configuration UI module
flickerstreak@25 3
flickerstreak@33 4 Hooks into Blizzard Interface Options AddOns panel
flickerstreak@25 5 --]]
flickerstreak@25 6
flickerstreak@25 7 -- local imports
flickerstreak@25 8 local ReAction = ReAction
flickerstreak@25 9 local L = ReAction.L
flickerstreak@25 10
flickerstreak@25 11 -- module declaration
flickerstreak@25 12 local moduleID = "ConfigUI"
flickerstreak@33 13 local module = ReAction:NewModule( moduleID )
flickerstreak@25 14
flickerstreak@33 15 -- options table basic layer
flickerstreak@25 16 module.configOptions = {
flickerstreak@25 17 type = "group",
flickerstreak@30 18 childGroups = "tab",
flickerstreak@25 19 args = {
flickerstreak@30 20 desc = {
flickerstreak@30 21 type = "description",
flickerstreak@30 22 name = L["Customizable replacement for Blizzard's Action Bars"],
flickerstreak@30 23 },
flickerstreak@25 24 global = {
flickerstreak@25 25 type = "group",
flickerstreak@25 26 name = L["Global Settings"],
flickerstreak@25 27 desc = L["Global configuration settings"],
flickerstreak@30 28 args = {
flickerstreak@30 29 unlock = {
flickerstreak@30 30 type = "toggle",
flickerstreak@30 31 handler = module,
flickerstreak@30 32 name = L["Unlock Bars"],
flickerstreak@30 33 desc = L["Unlock bars for dragging and resizing with the mouse"],
flickerstreak@42 34 get = function() return ReAction.configMode end,
flickerstreak@42 35 set = function(info, value) ReAction:SetConfigMode(value) end,
flickerstreak@30 36 disabled = InCombatLockdown,
flickerstreak@30 37 order = 1
flickerstreak@30 38 },
flickerstreak@30 39 },
flickerstreak@25 40 order = 1,
flickerstreak@25 41 },
flickerstreak@44 42 bar = {
flickerstreak@44 43 type = "group",
flickerstreak@44 44 name = L["Bar Settings"],
flickerstreak@44 45 desc = L["Configuration settings for bars"],
flickerstreak@44 46 childGroups = "select",
flickerstreak@44 47 args = {
flickerstreak@44 48 all = {
flickerstreak@44 49 type = "group",
flickerstreak@44 50 name = L["All Bars"],
flickerstreak@44 51 desc = L["Settings applicable to all bars"],
flickerstreak@44 52 args = {
flickerstreak@44 53 foo = {
flickerstreak@44 54 type = "toggle",
flickerstreak@44 55 name = "foo",
flickerstreak@44 56 desc = "description",
flickerstreak@44 57 get = function() return true end,
flickerstreak@44 58 set = function() end,
flickerstreak@44 59 }
flickerstreak@44 60 },
flickerstreak@44 61 order = 1
flickerstreak@44 62 }
flickerstreak@44 63 },
flickerstreak@44 64 order = 2
flickerstreak@44 65 },
flickerstreak@25 66 module = {
flickerstreak@25 67 type = "group",
flickerstreak@30 68 childGroups = "select",
flickerstreak@25 69 name = L["Module Settings"],
flickerstreak@25 70 desc = L["Configuration settings for each module"],
flickerstreak@30 71 args = {
flickerstreak@30 72 configUI = {
flickerstreak@30 73 type = "group",
flickerstreak@30 74 name = "Config UI",
flickerstreak@30 75 desc = "description",
flickerstreak@30 76 args = {
flickerstreak@30 77 foo = {
flickerstreak@30 78 type = "toggle",
flickerstreak@30 79 handler = module,
flickerstreak@30 80 name = "foo",
flickerstreak@30 81 desc = "description",
flickerstreak@30 82 get = function() return true end,
flickerstreak@30 83 set = function() end,
flickerstreak@30 84 }
flickerstreak@30 85 }
flickerstreak@30 86 },
flickerstreak@30 87 },
flickerstreak@30 88 order = -1,
flickerstreak@25 89 },
flickerstreak@30 90 },
flickerstreak@30 91 plugins = { }
flickerstreak@25 92 }
flickerstreak@25 93
flickerstreak@25 94 -- module methods
flickerstreak@25 95 function module:OnInitialize()
flickerstreak@28 96 self.db = ReAction.db:RegisterNamespace( moduleID,
flickerstreak@25 97 {
flickerstreak@28 98 profile = { }
flickerstreak@25 99 }
flickerstreak@25 100 )
flickerstreak@25 101
flickerstreak@30 102 for _, m in pairs(ReAction:GetOptions("global")) do
flickerstreak@30 103 for k, v in pairs(m) do
flickerstreak@30 104 self.configOptions.args.global.args[k] = v
flickerstreak@30 105 end
flickerstreak@30 106 end
flickerstreak@33 107
flickerstreak@33 108 self.configOptions.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db)
flickerstreak@33 109 self.configOptions.args.profile.order = -2
flickerstreak@33 110
flickerstreak@33 111 LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("ReAction",self.configOptions)
flickerstreak@44 112 self.frame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ReAction", "ReAction")
flickerstreak@44 113 self.frame.obj.SetCallback(self,"default")
flickerstreak@44 114
flickerstreak@30 115 ReAction.RegisterCallback(self,"OnOptionsRegistered")
flickerstreak@33 116 ReAction.RegisterCallback(self,"OnOptionsRefreshed")
flickerstreak@25 117 end
flickerstreak@25 118
flickerstreak@30 119 function module:OnOptionsRegistered(evt, context, module, opts)
flickerstreak@30 120 if context == "global" then
flickerstreak@30 121 for k, v in pairs(opts) do
flickerstreak@30 122 self.configOptions.args.global.args[k] = v
flickerstreak@30 123 end
flickerstreak@30 124 elseif context == "module" then
flickerstreak@30 125 for k, v in pairs(opts) do
flickerstreak@30 126 self.configOptions.args.module.args[k] = v
flickerstreak@30 127 end
flickerstreak@30 128 elseif context == "bar" then
flickerstreak@30 129
flickerstreak@30 130 elseif context == "barMenu" then
flickerstreak@30 131
flickerstreak@30 132 end
flickerstreak@25 133 end
flickerstreak@25 134
flickerstreak@33 135 function module:OnOptionsRefreshed(evt)
flickerstreak@33 136 -- TODO: refresh options frame (just OpenConfig again?)
flickerstreak@25 137 end
flickerstreak@25 138
flickerstreak@25 139 function module:OpenConfig(bar)
flickerstreak@30 140 InterfaceOptionsFrame_OpenToFrame("ReAction")
flickerstreak@33 141 if bar then
flickerstreak@33 142 -- TODO: select the correct bar pane
flickerstreak@25 143 end
flickerstreak@25 144 end
flickerstreak@44 145
flickerstreak@44 146 function module:default()
flickerstreak@44 147 -- called from the Interface Options panel, this returns the current profile to the default
flickerstreak@44 148 ReAction.db:ResetProfile()
flickerstreak@44 149 end
flickerstreak@44 150