diff ReAction.lua @ 213:8ba8ab8bf6dd

Demodularize LBF
author Flick <flickerstreak@gmail.com>
date Thu, 18 Nov 2010 20:07:48 -0800
parents e275a8663a16
children 9c0691e91488
line wrap: on
line diff
--- a/ReAction.lua	Thu Nov 18 13:12:16 2010 -0800
+++ b/ReAction.lua	Thu Nov 18 20:07:48 2010 -0800
@@ -34,27 +34,20 @@
 ------ Handlers ------
 function ReAction:OnInitialize()
   self.db = LibStub("AceDB-3.0"):New("ReAction_DB", 
-    { 
-      profile = {
-        dbversion = nil,
-        bars = { },
-        options = { 
-          hideBlizzardBars = false,
-          hideBlizzardVehicleBar = false,
-        },
-      },
-      global = {
-        skipKeybindWarning = false,
-      }
-    },
+    self.defaultProfile,
     true -- use global 'Default' (locale-specific)
   )
 
-  self:UpdateDB()
+  self:UpgradeProfile()
 
   self.bars = { }
   self.defaultBarConfig = { }
 
+  self.LBF = LibStub("LibButtonFacade",true)
+  if self.LBF then
+    self.LBF:RegisterSkinCallback("ReAction", self.OnSkinChanged, self)
+  end
+
   -- It's fairly normal to use the Blizzard vehicle bar, and to have
   -- your regular buttons in the same location. If you do this, and don't
   -- bother to hide your buttons, they'll obscure some parts of the vehicle bar.
@@ -93,6 +86,24 @@
   return self:SetKeybindMode(false)
 end
 
+function ReAction:OnSkinChanged( skinID, gloss, backdrop, group, button, colors )
+  if group == nil then
+    -- don't store global
+  else
+    -- 'group' is the bar-name
+    local bar = self:GetBar(group)
+    if bar then
+      local c = bar:GetConfig().ButtonFacade
+      if c then
+        c.skinID   = skinID
+        c.gloss    = gloss
+        c.backdrop = backdrop
+        c.colors   = colors
+      end  
+    end
+  end
+end
+
 
 ------ Methods ------