# HG changeset patch # User Flick # Date 1290139668 28800 # Node ID 8ba8ab8bf6ddd1ef1486c84113ec73dd35beb189 # Parent e275a8663a169663bd059db704dc92905e4a631d Demodularize LBF diff -r e275a8663a16 -r 8ba8ab8bf6dd Options.lua --- a/Options.lua Thu Nov 18 13:12:16 2010 -0800 +++ b/Options.lua Thu Nov 18 20:07:48 2010 -0800 @@ -154,6 +154,7 @@ function ReAction:OnProfileChanged() + self:UpgradeProfile() self:RebuildAll() if not self.db.global.skipKeybindWarning then StaticPopup_Show("REACTION_KB_WARN") diff -r e275a8663a16 -r 8ba8ab8bf6dd Profile.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Profile.lua Thu Nov 18 20:07:48 2010 -0800 @@ -0,0 +1,50 @@ +local _, addonTable = ... +local ReAction = addonTable.ReAction + +ReAction.PROFILEVERSION_LATEST = 1 + +ReAction.defaultProfile = { + profile = { + dbversion = nil, + bars = { }, + options = { + hideBlizzardBars = false, + hideBlizzardVehicleBar = false, + }, + }, + global = { + skipKeybindWarning = false, + } +} + +function ReAction:UpgradeProfile() + local db = self.db + + if not db.profile.dbversion then + -- upgrade from legacy db to v1 + + -- (1) remove unused defaultBars table (cleanup) + db.profile.defaultBars = nil + + -- (2) HideBlizzard is no longer a module + local hb = db:RegisterNamespace("HideBlizzard") + if hb then + db.profile.options.hideBlizzardBars = hb.profile.hide + db.profile.options.hideBlizzardVehicleBar = hb.profile.hideVehicle + hb:ResetProfile() + end + + -- (3) LBF is no longer a module + local bf = db:RegisterNamespace("ButtonFacade") + if bf then + for name, bar in pairs(db.profile.bars) do + bar.ButtonFacade = bf.profile[name] or bar.ButtonFacade + end + bf:ResetProfile() + end + + db.profile.dbversion = 1 + end + + db.profile.dbversion = self.PROFILEVERSION_LATEST +end diff -r e275a8663a16 -r 8ba8ab8bf6dd ReAction.lua --- 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 ------ diff -r e275a8663a16 -r 8ba8ab8bf6dd ReAction.xml --- a/ReAction.xml Thu Nov 18 13:12:16 2010 -0800 +++ b/ReAction.xml Thu Nov 18 20:07:48 2010 -0800 @@ -8,7 +8,7 @@