comparison ReAction.lua @ 242:b56cff349bd6

Move non-option stuff out of State.lua Remove unused callbacks
author Flick
date Fri, 25 Mar 2011 17:06:56 -0700
parents 09c8e9baa35a
children 0ea0cdd7f386
comparison
equal deleted inserted replaced
241:09c8e9baa35a 242:b56cff349bd6
107 self.db.RegisterCallback(self,"OnProfileCopied","OnProfileChanged") 107 self.db.RegisterCallback(self,"OnProfileCopied","OnProfileChanged")
108 self.db.RegisterCallback(self,"OnNewProfile") 108 self.db.RegisterCallback(self,"OnNewProfile")
109 self.db.RegisterCallback(self,"OnProfileReset", "OnNewProfile") 109 self.db.RegisterCallback(self,"OnProfileReset", "OnNewProfile")
110 110
111 self:RegisterEvent("PLAYER_REGEN_DISABLED") 111 self:RegisterEvent("PLAYER_REGEN_DISABLED")
112 self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
112 113
113 self:InitializeOptions() 114 self:InitializeOptions()
114 end 115 end
115 116
116 function ReAction:OnEnable() 117 function ReAction:OnEnable()
117 self:InitializeBars() 118 self:InitializeBars()
119 self:UPDATE_SHAPESHIFT_FORMS() -- it doesn't fire on a /reloadui
118 end 120 end
119 121
120 function ReAction:OnDisable() 122 function ReAction:OnDisable()
121 self:TearDownBars() 123 self:TearDownBars()
122 end 124 end
125 if self.configMode == true then 127 if self.configMode == true then
126 self:UserError(L["ReAction config mode disabled during combat."]) 128 self:UserError(L["ReAction config mode disabled during combat."])
127 self:SetConfigMode(false) 129 self:SetConfigMode(false)
128 self:SetKeybindMode(false) 130 self:SetKeybindMode(false)
129 self:CloseEditor() 131 self:CloseEditor()
132 end
133 end
134
135 function module:UPDATE_SHAPESHIFT_FORMS()
136 -- Re-parse the rules table according to the new form list.
137 -- This happens both at initial login (after PLAYER_ENTERING_WORLD)
138 -- as well as when gaining new abilities.
139 ReAction.Bar:InitRuleFormats()
140 for _, bar in self:IterateBars() do
141 bar:ApplyStates()
130 end 142 end
131 end 143 end
132 144
133 function ReAction:LIBKEYBOUND_ENABLED( evt ) 145 function ReAction:LIBKEYBOUND_ENABLED( evt )
134 self:SetKeybindMode(true) 146 self:SetKeybindMode(true)
240 self.callbacks:Fire("OnDestroyBar", bar, name) 252 self.callbacks:Fire("OnDestroyBar", bar, name)
241 bar:Destroy() 253 bar:Destroy()
242 end 254 end
243 end 255 end
244 256
245 function ReAction:RefreshBar(x)
246 local bar, name = self:GetBar(x)
247 if bar and name then
248 self.callbacks:Fire("OnRefreshBar", bar, name)
249 end
250 end
251
252 function ReAction:InitializeBars() 257 function ReAction:InitializeBars()
253 if not self.barsInitialized then 258 if not self.barsInitialized then
254 self:ManageBlizzardBars() 259 self:ManageBlizzardBars()
255 260
256 for name, config in pairs(self.db.profile.bars) do 261 for name, config in pairs(self.db.profile.bars) do
257 if config then 262 if config then
258 self:CreateBar(name, config) 263 self:CreateBar(name, config)
259 end 264 end
260 end 265 end
261 -- re-anchor and refresh in case anchor order does not match init order 266 -- re-anchor in case anchor order does not match init order
262 for name, bar in pairs(self.bars) do 267 for name, bar in pairs(self.bars) do
263 bar:ApplyAnchor() 268 bar:ApplyAnchor()
264 self.callbacks:Fire("OnRefreshBar", bar, name)
265 end 269 end
266 self.barsInitialized = true 270 self.barsInitialized = true
267 end 271 end
268 end 272 end
269 273
303 end 307 end
304 308
305 function ReAction:EraseBar(x) 309 function ReAction:EraseBar(x)
306 local bar, name = self:GetBar(x) 310 local bar, name = self:GetBar(x)
307 if bar and name then 311 if bar and name then
308 self.callbacks:Fire("OnEraseBar", bar, name)
309 self:DestroyBar(bar) 312 self:DestroyBar(bar)
310 self.db.profile.bars[name] = nil 313 self.db.profile.bars[name] = nil
311 end 314 end
312 end 315 end
313 316