From b549507c731c66b00bb3eb3f30b5c3637127f81b Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Wed, 15 Oct 2008 10:02:40 +0200 Subject: [PATCH] Fix alot of bugs with switching profiles --- ActionBars.lua | 6 ++++-- BagBar.lua | 6 ------ Bartender4.lua | 9 +++++++++ ButtonBar.lua | 7 +++++++ MicroMenu.lua | 6 ------ PetBar.lua | 11 ----------- RepXPBar.lua | 15 --------------- StanceBar.lua | 6 ------ 8 files changed, 20 insertions(+), 46 deletions(-) diff --git a/ActionBars.lua b/ActionBars.lua index 149db20..c6593ab 100644 --- a/ActionBars.lua +++ b/ActionBars.lua @@ -134,8 +134,10 @@ end function BT4ActionBars:ApplyConfig() for i=1,10 do local config = self.db.profile.actionbars[i] - -- make sure the bar has its current config object - self.actionbars[i].config = config + -- make sure the bar has its current config object if it exists already + if self.actionbars[i] then + self.actionbars[i].config = config + end if config.enabled then self:EnableBar(i) else diff --git a/BagBar.lua b/BagBar.lua index 8764835..7607d9c 100644 --- a/BagBar.lua +++ b/BagBar.lua @@ -39,12 +39,6 @@ function BagBarMod:OnEnable() self.bar:ApplyConfig(self.db.profile) end -function BagBarMod:OnDisable() - if not self.bar then return end - self.bar:Disable() - self:ToggleOptions() -end - function BagBarMod:ApplyConfig() self.bar:ApplyConfig(self.db.profile) end diff --git a/Bartender4.lua b/Bartender4.lua index cf3d30b..2094967 100644 --- a/Bartender4.lua +++ b/Bartender4.lua @@ -116,6 +116,15 @@ function Bartender4.modulePrototype:ToggleOptions() self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions end end + +function Bartender4.modulePrototype:OnDisable() + if not self.bar then return end + -- assign new config table + self.bar.config = self.db.profile + self.bar:Disable() + self:ToggleOptions() +end + Bartender4:SetDefaultModulePrototype(Bartender4.modulePrototype) local LDB = LibStub("LibDataBroker-1.1", true) diff --git a/ButtonBar.lua b/ButtonBar.lua index d7e44a7..56d4739 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -46,8 +46,15 @@ function Bartender4.ButtonBar:SkinChanged(SkinID, Gloss, Backdrop, Group, Button bar:SkinChanged(SkinID, Gloss, Backdrop, Colors, Button) end +function ButtonBar:UpdateSkin() + if not self.LBFGroup then return end + local config = self.config + self.LBFGroup:Skin(config.skin.ID, config.skin.Gloss, config.skin.Backdrop, config.skin.Colors) +end + function ButtonBar:ApplyConfig(config) Bar.ApplyConfig(self, config) + ButtonBar.UpdateSkin(self) -- any module inherting this template should call UpdateButtonLayout after setting up its buttons, we cannot call it here --self:UpdateButtonLayout() end diff --git a/MicroMenu.lua b/MicroMenu.lua index bc4dfb3..7898082 100644 --- a/MicroMenu.lua +++ b/MicroMenu.lua @@ -58,12 +58,6 @@ function MicroMenuMod:OnEnable() self.bar:ApplyConfig(self.db.profile) end -function MicroMenuMod:OnDisable() - if not self.bar then return end - self.bar:Disable() - self:ToggleOptions() -end - function MicroMenuMod:ApplyConfig() self.bar:ApplyConfig(self.db.profile) end diff --git a/PetBar.lua b/PetBar.lua index 5ae3bac..8c1df23 100644 --- a/PetBar.lua +++ b/PetBar.lua @@ -59,17 +59,6 @@ function PetBarMod:OnEnable() self:ReassignBindings() end -function PetBarMod:OnDisable() - if not self.bar then return end - - UnregisterStateDriver(self.bar) - self:SetAttribute("state-visibility", nil) - self.bar:Hide() - - self.bar:Disable() - self:ToggleOptions() -end - function PetBarMod:ReassignBindings() if InCombatLockdown() then return end if not self.bar or not self.bar.buttons then return end diff --git a/RepXPBar.lua b/RepXPBar.lua index d2920ac..1d8ed89 100644 --- a/RepXPBar.lua +++ b/RepXPBar.lua @@ -1,16 +1,8 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4") --- register module -local XPBarMod = Bartender4:NewModule("RepXPBar") - --- create prototype information -local XPBar = setmetatable({}, {__index = Bar}) - -- fetch upvalues local Bar = Bartender4.Bar.prototype - - local table_insert = table.insert local defaults = { profile = Bartender4:Merge({ @@ -47,12 +39,6 @@ function RepBarMod:OnEnable() self.bar:ApplyConfig(self.db.profile) end -function RepBarMod:OnDisable() - if not self.bar then return end - self.bar:Disable() - self:ToggleOptions() -end - function RepBarMod:ApplyConfig() self.bar:ApplyConfig(self.db.profile) end @@ -97,7 +83,6 @@ function XPBarMod:OnEnable() self.bar:ApplyConfig(self.db.profile) end -XPBarMod.OnDisable = RepBarMod.OnDisable XPBarMod.ApplyConfig = RepBarMod.ApplyConfig XPBar.ApplyConfig = RepBar.ApplyConfig XPBar.PerformLayout = RepBar.PerformLayout diff --git a/StanceBar.lua b/StanceBar.lua index 964506e..33db241 100644 --- a/StanceBar.lua +++ b/StanceBar.lua @@ -48,12 +48,6 @@ function StanceBarMod:OnEnable() self.bar:ApplyConfig(self.db.profile) end -function StanceBarMod:OnDisable() - if not self.bar then return end - self.bar:Disable() - self:ToggleOptions() -end - StanceBarMod.button_count = 10 function StanceBarMod:ApplyConfig()