- build the config on demand (might break stuff, srsly)

- add options for configuring the modifier switching
This commit is contained in:
Hendrik Leppkes
2008-04-08 10:31:40 +00:00
parent 7bed8cdf21
commit b6adf401f6
6 changed files with 221 additions and 127 deletions
+8 -3
View File
@@ -22,7 +22,6 @@ local defaults = { profile = Bartender4:Merge({
function StanceBarMod:OnInitialize()
self.db = Bartender4.db:RegisterNamespace("StanceBar", defaults)
self:SetEnabledState(self.db.profile.enabled)
self:SetupOptions()
end
function StanceBarMod:OnEnable()
@@ -33,7 +32,7 @@ function StanceBarMod:OnEnable()
self.bar:ApplyConfig()
self.bar:SetScript("OnEvent", StanceBar.OnEvent)
end
self:SetupOptions()
self:ToggleOptions()
self.bar:RegisterEvent("PLAYER_ENTERING_WORLD")
self.bar:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
self.bar:RegisterEvent("SPELL_UPDATE_COOLDOWN")
@@ -49,7 +48,7 @@ function StanceBarMod:OnDisable()
if not self.bar then return end
self.bar:UnregisterAllEvents()
self.bar:Hide()
self:SetupOptions()
self:ToggleOptions()
end
function StanceBarMod:SetupOptions()
@@ -92,6 +91,12 @@ function StanceBarMod:SetupOptions()
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
end
function StanceBarMod:ToggleOptions()
if self.options then
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
end
end
function StanceBarMod:ApplyConfig()
if not self:IsEnabled() then return end
self.bar:ApplyConfig(self.db.profile)