Fix alot of bugs with switching profiles

This commit is contained in:
Hendrik Leppkes
2008-10-15 10:02:40 +02:00
parent 9b35e84ef7
commit b549507c73
8 changed files with 20 additions and 46 deletions
+4 -2
View File
@@ -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
-6
View File
@@ -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
+9
View File
@@ -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)
+7
View File
@@ -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
-6
View File
@@ -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
-11
View File
@@ -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
-15
View File
@@ -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
-6
View File
@@ -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()