Mercurial > wow > reaction
comparison ReAction.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 | 20003239af0b |
children | 2ee41dcd673f |
comparison
equal
deleted
inserted
replaced
59:7430a8dd4e90 | 60:44649a10378d |
---|---|
148 self:RegisterChatCommand("reaction", SlashHandler) | 148 self:RegisterChatCommand("reaction", SlashHandler) |
149 self:RegisterChatCommand("rxn", SlashHandler) | 149 self:RegisterChatCommand("rxn", SlashHandler) |
150 self:RegisterEvent("PLAYER_REGEN_DISABLED") | 150 self:RegisterEvent("PLAYER_REGEN_DISABLED") |
151 | 151 |
152 self.bars = {} | 152 self.bars = {} |
153 self.options = {} | |
154 self.defaultBarConfig = {} | 153 self.defaultBarConfig = {} |
155 | 154 |
156 self:RegisterOptions("global", self, { | 155 self.options = { |
157 unlock = { | 156 type = "group", |
158 type = "toggle", | 157 name = "ReAction", |
159 handler = module, | 158 childGroups = "tab", |
160 name = L["Unlock Bars"], | 159 args = { |
161 desc = L["Unlock bars for dragging and resizing with the mouse"], | 160 _desc = { |
162 get = function() return self.configMode end, | 161 type = "description", |
163 set = function(info, value) self:SetConfigMode(value) end, | 162 name = L["Customizable replacement for Blizzard's Action Bars"], |
164 disabled = InCombatLockdown, | 163 order = 1, |
165 order = 1 | 164 }, |
165 global = { | |
166 type = "group", | |
167 name = L["Global Settings"], | |
168 desc = L["Global configuration settings"], | |
169 args = { | |
170 unlock = { | |
171 type = "toggle", | |
172 handler = module, | |
173 name = L["Unlock Bars"], | |
174 desc = L["Unlock bars for dragging and resizing with the mouse"], | |
175 get = function() return self.configMode end, | |
176 set = function(info, value) self:SetConfigMode(value) end, | |
177 disabled = InCombatLockdown, | |
178 order = 1 | |
179 }, | |
180 }, | |
181 plugins = { }, | |
182 order = 2, | |
183 }, | |
184 module = { | |
185 type = "group", | |
186 childGroups = "select", | |
187 name = L["Module Settings"], | |
188 desc = L["Configuration settings for each module"], | |
189 args = { }, | |
190 plugins = { }, | |
191 order = 3, | |
192 }, | |
193 profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) | |
166 }, | 194 }, |
167 }) | 195 plugins = { } |
196 } | |
168 | 197 |
169 end | 198 end |
170 | 199 |
171 function ReAction:OnEnable() | 200 function ReAction:OnEnable() |
172 InitializeBars() | 201 InitializeBars() |
342 self.defaultBarConfigChoice = nil | 371 self.defaultBarConfigChoice = nil |
343 end | 372 end |
344 self:RefreshOptions() | 373 self:RefreshOptions() |
345 end | 374 end |
346 | 375 |
347 -- See modules/ReAction_ConfigUI for valid options contexts. | 376 function ReAction:RegisterOptions(module, options, global) |
348 function ReAction:RegisterOptions(context, module, opts) | 377 self.options.args[global and "global" or "module"].plugins[module:GetName()] = options |
349 if module == nil or context == nil then | |
350 error("ReAction:RegisterOptions requires a module object and context ID") | |
351 end | |
352 if not self.options[context] then | |
353 self.options[context] = {} | |
354 end | |
355 self.options[context][module] = opts | |
356 self.callbacks:Fire("OnOptionsRegistered", context, module, opts) | |
357 end | |
358 | |
359 function ReAction:GetOptions(context) | |
360 if context then | |
361 if not self.options[context] then | |
362 self.options[context] = { } | |
363 end | |
364 return self.options[context] | |
365 end | |
366 end | 378 end |
367 | 379 |
368 function ReAction:RefreshOptions() | 380 function ReAction:RefreshOptions() |
369 self.callbacks:Fire("OnOptionsRefreshed") | 381 self.callbacks:Fire("OnOptionsRefreshed") |
370 end | 382 end |