comparison modules/ReAction_Action/ReAction_Action.lua @ 60:44649a10378d

Fixed options handling to create a separate table for each bar instead of a shared table with proxy handler. Also simplified options registration and moved some options around.
author Flick <flickerstreak@gmail.com>
date Sat, 10 May 2008 00:08:01 +0000
parents 7430a8dd4e90
children 768be7eb22a0
comparison
equal deleted inserted replaced
59:7430a8dd4e90 60:44649a10378d
25 buttons = { } 25 buttons = { }
26 } 26 }
27 } 27 }
28 ) 28 )
29 self.buttons = { } 29 self.buttons = { }
30 30 self.options = setmetatable({},{__mode="k"})
31 ReAction:RegisterOptions("global", self, { 31
32 hideEmpty = { 32 ReAction:RegisterOptions(self, {
33 type = "toggle", 33 [moduleID] = {
34 name = L["Hide Empty Buttons"], 34 type = "group",
35 get = function() return self.db.profile.hideEmptyButtons end, 35 name = L["Action Bars"],
36 set = function(info, val) module:SetHideEmptyButtons(val) end, 36 args = {
37 } 37 hideEmpty = {
38 }) 38 type = "toggle",
39 39 name = L["Hide Empty Buttons"],
40 ReAction:RegisterOptions("bar", self, { 40 get = function() return self.db.profile.hideEmptyButtons end,
41 type = "group", 41 set = function(info, val) module:SetHideEmptyButtons(val) end,
42 name = L["Action Buttons"], 42 }
43 hidden = "BarOptionsHidden", 43 }
44 args = { 44 }
45 } 45 })
46 })
47 end 46 end
48 47
49 function module:OnEnable() 48 function module:OnEnable()
50 ReAction:RegisterBarType(L["Action Bar"], 49 ReAction:RegisterBarType(L["Action Bar"],
51 { 50 {
176 button.actionIDLabel:Hide() 175 button.actionIDLabel:Hide()
177 end 176 end
178 end 177 end
179 178
180 179
181 ---- Options handlers ---- 180 ---- Options ----
182 function module:BarOptionsHidden(bar) 181 function module:GetBarOptions(bar)
183 return bar.config.type ~= moduleID 182 if not self.options[bar] then
183 self.options[bar] = {
184 type = "group",
185 name = L["Action Buttons"],
186 hidden = function() return bar.config.type ~= moduleID end,
187 args = {
188 }
189 }
190 end
191 return self.options[bar]
184 end 192 end
185 193
186 194
187 -- use-count of action IDs 195 -- use-count of action IDs
188 local nActionIDs = 120 196 local nActionIDs = 120