comparison ReAction.lua @ 38:00f08528faaf

HideBlizzard now reroutes InterfaceOptions->ActionBars to InterfaceOptions->AddOns->ReAction if hide-blizzard-bars is checked
author Flick <flickerstreak@gmail.com>
date Thu, 03 Apr 2008 21:08:52 +0000
parents 52ac6db0c8ca
children e0d8074a5bc7
comparison
equal deleted inserted replaced
37:413f61e038b1 38:00f08528faaf
111 if type(m) ~= "string" then 111 if type(m) ~= "string" then
112 error("Invalid method") 112 error("Invalid method")
113 end 113 end
114 end 114 end
115 115
116 local function CallOptsModule(method,...)
117 local m = ReAction:GetModule("ConfigUI",true)
118 if not m then
119 LoadAddOn("ReAction_ConfigUI")
120 m = ReAction:GetModule("ConfigUI")
121 end
122 if m then
123 if type(m) == "table" and type(m[method]) == "function" then
124 m[method](m,...)
125 else
126 dbprint(("Bad call '%s' to options module"):format(tostring(method)));
127 end
128 else
129 ReAction:Print("Options module not found")
130 end
131 end
132
133 SlashHandler = function(option) 116 SlashHandler = function(option)
134 if option == "config" then 117 if option == "config" then
135 CallOptsModule("OpenConfig",true) 118 ReAction:ShowConfig()
136 elseif option == "unlock" then 119 elseif option == "unlock" then
137 ReAction:SetConfigMode(true) 120 ReAction:SetConfigMode(true)
138 elseif option == "lock" then 121 elseif option == "lock" then
139 ReAction:SetConfigMode(false) 122 ReAction:SetConfigMode(false)
140 else 123 else
226 SafeCall(m or x[method], x, ...) 209 SafeCall(m or x[method], x, ...)
227 end 210 end
228 end 211 end
229 end 212 end
230 213
214 function ReAction:CallModuleMethod(modulename, method, ...)
215 local m = self:GetModule(modulename,true)
216 if not m then
217 LoadAddOn(("ReAction_%s"):format(modulename))
218 m = self:GetModule(modulename,true)
219 end
220 if m then
221 if type(m) == "table" and type(m[method]) == "function" then
222 m[method](m,...)
223 else
224 dbprint(("Bad call '%s' to %s module"):format(tostring(method),modulename));
225 end
226 else
227 self:Print(("Module '%s' not found"):format(tostring(modulename)))
228 end
229 end
230
231
231 function ReAction:CreateBar(name, defaultConfig, prefix) 232 function ReAction:CreateBar(name, defaultConfig, prefix)
232 local profile = self.db.profile 233 local profile = self.db.profile
233 defaultConfig = defaultConfig or profile.defaultBar 234 defaultConfig = defaultConfig or profile.defaultBar
234 prefix = prefix or L["Bar "] 235 prefix = prefix or L["Bar "]
235 if not name then 236 if not name then
318 function ReAction:SetConfigMode( mode ) 319 function ReAction:SetConfigMode( mode )
319 self:CallMethodOnAllBars("ShowControls",mode) 320 self:CallMethodOnAllBars("ShowControls",mode)
320 self:CallMethodOnAllModules("ApplyConfigMode",mode,self.bars) 321 self:CallMethodOnAllModules("ApplyConfigMode",mode,self.bars)
321 self.configMode = mode 322 self.configMode = mode
322 end 323 end
324
325 function ReAction:ShowConfig()
326 self:CallModuleMethod("ConfigUI","OpenConfig")
327 end
328