diff classes/State.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/classes/State.lua	Fri Mar 25 16:50:43 2011 -0700
+++ b/classes/State.lua	Fri Mar 25 17:06:56 2011 -0700
@@ -13,75 +13,20 @@
 local RegisterStateDriver = RegisterStateDriver
 local tfetch = addonTable.tfetch
 local tbuild = addonTable.tbuild
+local ApplyStates   = Bar.ApplyStates
+local CleanupStates = Bar.CleanupStates
+local SetProperty   = Bar.SetStateProperty
+local GetProperty   = Bar.GetStateProperty
 
 -- module declaration
 local moduleID = "State"
 local module = ReAction:NewModule( moduleID, "AceEvent-3.0" )
 
--- Utility --
-
-
-
-local ApplyStates, CleanupStates, SetProperty, GetProperty
-
--- PRIVATE --
-do
-  function GetProperty( bar, state, propname )
-    return tfetch(bar:GetConfig(), "states", state, propname)
-  end
-
-  function SetProperty( bar, state, propname, value )
-    local s = tbuild(bar:GetConfig(), "states", state)
-    s[propname] = value
-    bar:SetSecureStateData(state, propname, value)
-  end
-
-  function ApplyStates( bar )
-    local states = tfetch(bar:GetConfig(), "states")
-    if states then
-      bar:SetStateDriver(states)
-    end
-  end
-
-  function CleanupStates( bar )
-    bar:SetStateDriver(nil)
-  end
-end
-
-
 
 -- module event handlers --
 
 function module:OnInitialize()
-  self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
-
   ReAction:RegisterBarOptionGenerator(self, "GetBarOptions")
-
-  ReAction.RegisterCallback(self, "OnCreateBar","OnRefreshBar")
-  ReAction.RegisterCallback(self, "OnDestroyBar")
-  ReAction.RegisterCallback(self, "OnRefreshBar")
-end
-
-function module:OnEnable()
-  self:UPDATE_SHAPESHIFT_FORMS() -- it doesn't fire on a /reloadui
-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 ReAction:IterateBars() do
-    ApplyStates(bar)
-  end
-end
-
-function module:OnRefreshBar(event, bar, name)
-  ApplyStates(bar)
-end
-
-function module:OnDestroyBar(event, bar, name)
-  CleanupStates(bar)
 end