diff 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
line wrap: on
line diff
--- a/ReAction.lua	Fri Mar 25 16:50:43 2011 -0700
+++ b/ReAction.lua	Fri Mar 25 17:06:56 2011 -0700
@@ -109,12 +109,14 @@
   self.db.RegisterCallback(self,"OnProfileReset", "OnNewProfile")
 
   self:RegisterEvent("PLAYER_REGEN_DISABLED")
+  self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
 
   self:InitializeOptions()
 end
 
 function ReAction:OnEnable()
   self:InitializeBars()
+  self:UPDATE_SHAPESHIFT_FORMS() -- it doesn't fire on a /reloadui
 end
 
 function ReAction:OnDisable()
@@ -130,6 +132,16 @@
   end
 end
 
+function module:UPDATE_SHAPESHIFT_FORMS()
+  -- Re-parse the rules table according to the new form list.
+  -- This happens both at initial login (after PLAYER_ENTERING_WORLD)
+  -- as well as when gaining new abilities. 
+  ReAction.Bar:InitRuleFormats()
+  for _, bar in self:IterateBars() do
+    bar:ApplyStates()
+  end
+end
+
 function ReAction:LIBKEYBOUND_ENABLED( evt )
   self:SetKeybindMode(true)
 end
@@ -242,13 +254,6 @@
   end
 end
 
-function ReAction:RefreshBar(x)
-  local bar, name = self:GetBar(x)
-  if bar and name then
-    self.callbacks:Fire("OnRefreshBar", bar, name)
-  end
-end
-
 function ReAction:InitializeBars()
   if not self.barsInitialized then
     self:ManageBlizzardBars()
@@ -258,10 +263,9 @@
         self:CreateBar(name, config)
       end
     end
-    -- re-anchor and refresh in case anchor order does not match init order
+    -- re-anchor in case anchor order does not match init order
     for name, bar in pairs(self.bars) do
       bar:ApplyAnchor()
-      self.callbacks:Fire("OnRefreshBar", bar, name)
     end
     self.barsInitialized = true
   end
@@ -305,7 +309,6 @@
 function ReAction:EraseBar(x)
   local bar, name = self:GetBar(x)
   if bar and name then
-    self.callbacks:Fire("OnEraseBar", bar, name)
     self:DestroyBar(bar)
     self.db.profile.bars[name] = nil
   end