annotate modules/ReAction_ConfigUI/ReAction_ConfigUI.lua @ 33:c54c481ad0ed

- Moved bar control frame from ConfigUI to Bar - Added LICENSE.txt - added profile management options - other minor cleanup
author Flick <flickerstreak@gmail.com>
date Thu, 03 Apr 2008 20:25:40 +0000
parents 0d95ce7a9ec2
children 11ddb9610770
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@30 34 get = function() return module.configMode end,
flickerstreak@30 35 set = function(info, value) module: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@25 42 module = {
flickerstreak@25 43 type = "group",
flickerstreak@30 44 childGroups = "select",
flickerstreak@25 45 name = L["Module Settings"],
flickerstreak@25 46 desc = L["Configuration settings for each module"],
flickerstreak@30 47 args = {
flickerstreak@30 48 configUI = {
flickerstreak@30 49 type = "group",
flickerstreak@30 50 name = "Config UI",
flickerstreak@30 51 desc = "description",
flickerstreak@30 52 args = {
flickerstreak@30 53 foo = {
flickerstreak@30 54 type = "toggle",
flickerstreak@30 55 handler = module,
flickerstreak@30 56 name = "foo",
flickerstreak@30 57 desc = "description",
flickerstreak@30 58 get = function() return true end,
flickerstreak@30 59 set = function() end,
flickerstreak@30 60 }
flickerstreak@30 61 }
flickerstreak@30 62 },
flickerstreak@30 63 },
flickerstreak@30 64 order = -1,
flickerstreak@25 65 },
flickerstreak@30 66 },
flickerstreak@30 67 plugins = { }
flickerstreak@25 68 }
flickerstreak@25 69
flickerstreak@25 70 -- module methods
flickerstreak@25 71 function module:OnInitialize()
flickerstreak@28 72 self.db = ReAction.db:RegisterNamespace( moduleID,
flickerstreak@25 73 {
flickerstreak@28 74 profile = { }
flickerstreak@25 75 }
flickerstreak@25 76 )
flickerstreak@25 77
flickerstreak@30 78 for _, m in pairs(ReAction:GetOptions("global")) do
flickerstreak@30 79 for k, v in pairs(m) do
flickerstreak@30 80 self.configOptions.args.global.args[k] = v
flickerstreak@30 81 end
flickerstreak@30 82 end
flickerstreak@33 83
flickerstreak@33 84 self.configOptions.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db)
flickerstreak@33 85 self.configOptions.args.profile.order = -2
flickerstreak@33 86
flickerstreak@33 87 LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("ReAction",self.configOptions)
flickerstreak@33 88 LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ReAction", "ReAction")
flickerstreak@30 89 ReAction.RegisterCallback(self,"OnOptionsRegistered")
flickerstreak@33 90 ReAction.RegisterCallback(self,"OnOptionsRefreshed")
flickerstreak@25 91 end
flickerstreak@25 92
flickerstreak@30 93 function module:OnOptionsRegistered(evt, context, module, opts)
flickerstreak@30 94 if context == "global" then
flickerstreak@30 95 for k, v in pairs(opts) do
flickerstreak@30 96 self.configOptions.args.global.args[k] = v
flickerstreak@30 97 end
flickerstreak@30 98 elseif context == "module" then
flickerstreak@30 99 for k, v in pairs(opts) do
flickerstreak@30 100 self.configOptions.args.module.args[k] = v
flickerstreak@30 101 end
flickerstreak@30 102 elseif context == "bar" then
flickerstreak@30 103
flickerstreak@30 104 elseif context == "barMenu" then
flickerstreak@30 105
flickerstreak@30 106 end
flickerstreak@25 107 end
flickerstreak@25 108
flickerstreak@33 109 function module:OnOptionsRefreshed(evt)
flickerstreak@33 110 -- TODO: refresh options frame (just OpenConfig again?)
flickerstreak@25 111 end
flickerstreak@25 112
flickerstreak@25 113 function module:OpenConfig(bar)
flickerstreak@30 114 InterfaceOptionsFrame_OpenToFrame("ReAction")
flickerstreak@33 115 if bar then
flickerstreak@33 116 -- TODO: select the correct bar pane
flickerstreak@25 117 end
flickerstreak@25 118 end