more work done and fixes applied

This commit is contained in:
Hendrik Leppkes
2007-12-11 13:02:06 +00:00
parent 13300aae6e
commit 37520f8b58
5 changed files with 85 additions and 12 deletions
+7 -3
View File
@@ -12,6 +12,7 @@ local stancedefaults = {
local defaults = Bartender4:Merge({
['**'] = {
Enabled = true,
Buttons = 12,
Padding = 2,
Rows = 1,
@@ -192,8 +193,6 @@ function BT4ActionBars:Create(id, config)
self:CreateBarOption(id, self:GetOptionsTable())
bar:ApplyConfig()
-- debugging
--bar:Unlock()
return bar
end
@@ -204,6 +203,7 @@ function BT4ActionBars:DisableBar(id)
if not bar then return end
bar.config.Enabled = false
bar.disabled = true
bar:Hide()
self:CreateBarOption(id, self.disabledoptions)
end
@@ -217,7 +217,11 @@ function BT4ActionBars:EnableBar(id)
bar = self:Create(id, config)
self.actionbars[id] = bar
else
bar.disabled = nil
self:CreateBarOption(id, self:GetOptionsTable())
bar:ApplyConfig(config)
end
if not Bartender4.Locked then
bar:Unlock()
end
bar:ApplyConfig(config)
end
+33 -3
View File
@@ -13,7 +13,6 @@ local Bar_MT = {__index = Bar}
local defaults = {
['**'] = {
Enabled = true,
Scale = 1,
Alpha = 1,
Show = true,
@@ -59,6 +58,19 @@ function Bartender4.Bar:Create(id, template, config)
return bar
end
function Bartender4.Bar:GetAll()
return pairs(barregistry)
end
function Bartender4.Bar:ForAll(method, ...)
for _,bar in self:GetAll() do
local func = bar[method]
if func then
func(bar, ...)
end
end
end
--[[===================================================================================
Bar Options
===================================================================================]]--
@@ -198,6 +210,7 @@ function Bar:ApplyConfig(config)
if config then
self.config = config
end
if self.disabled then return end
self:SetShow()
self:Lock()
self:LoadPosition()
@@ -206,6 +219,8 @@ function Bar:ApplyConfig(config)
end
function Bar:Unlock()
if self.disabled or self.unlocked then return end
self.unlocked = true
self:EnableMouse(true)
self:SetScript("OnEnter", barOnEnter)
self:SetScript("OnLeave", barOnLeave)
@@ -214,8 +229,9 @@ function Bar:Unlock()
self:SetScript("OnClick", barOnClick)
self.Text:Show()
self:Show()
self:SetFrameLevel(5)
if self.config.Hide then
if not self.config.Show then
self:SetBackdropColor(1, 0, 0, 0.5)
else
self:SetBackdropColor(0, 1, 0, 0.5)
@@ -223,6 +239,8 @@ function Bar:Unlock()
end
function Bar:Lock()
if self.disabled or not self.unlocked then return end
self.unlocked = nil
barOnDragStop(self)
self:EnableMouse(false)
self:SetScript("OnEnter", nil)
@@ -232,6 +250,10 @@ function Bar:Lock()
self:SetScript("OnClick", nil)
self.Text:Hide()
if not self.config.Show then
self:Hide()
end
self:SetBackdropColor(0, 0, 0, 0)
self:SetBackdropBorderColor(0, 0, 0, 0)
end
@@ -268,7 +290,15 @@ function Bar:SetShow(show)
if show ~= nil then
self.config.Show = show
end
self[self.config.Show and "Show" or "Hide"](self)
if not self.unlocked then
self[self.config.Show and "Show" or "Hide"](self)
else
if not self.config.Show then
self:SetBackdropColor(1, 0, 0, 0.5)
else
self:SetBackdropColor(0, 1, 0, 0.5)
end
end
end
function Bar:GetConfigAlpha()
+30
View File
@@ -16,6 +16,9 @@ function Bartender4:OnInitialize()
self.db.RegisterCallback(self, "OnProfileReset", "UpdateModuleConfigs")
self:SetupOptions()
self.Locked = true
self:RegisterEvent("PLAYER_REGEN_DISABLED", "CombatLockdown")
end
function Bartender4:RegisterDefaultsKey(key, subdefaults)
@@ -25,6 +28,7 @@ function Bartender4:RegisterDefaultsKey(key, subdefaults)
end
function Bartender4:UpdateModuleConfigs()
self:Lock()
for k,v in AceAddon:IterateModulesOfAddon("Bartender4") do
if type(v.ApplyConfig) == "function" then
v:ApplyConfig()
@@ -40,6 +44,32 @@ function Bartender4:Update()
end
end
function Bartender4:CombatLockdown()
self:Lock()
end
function Bartender4:ToggleLock()
if self.Locked then
self:Unlock()
else
self:Lock()
end
end
function Bartender4:Unlock()
if self.Locked then
self.Locked = false
Bartender4.Bar:ForAll("Unlock")
end
end
function Bartender4:Lock()
if not self.Locked then
self.Locked = true
Bartender4.Bar:ForAll("Lock")
end
end
function Bartender4:Merge(target, source)
if not target then target = {} end
for k,v in pairs(source) do
+8 -6
View File
@@ -34,13 +34,15 @@ function Bartender4.Button:Create(id, parent)
button.flash = _G[("%sFlash"):format(name)]
button.flash:Hide()
button:SetNormalTexture("")
local realNormalTexture = _G[("%sNormalTexture"):format(name)]
realNormalTexture:Hide()
--button:SetNormalTexture("")
--local realNormalTexture = _G[("%sNormalTexture"):format(name)]
button.normalTexture = button:CreateTexture(("%sBT4NormalTexture"):format(name))
button.normalTexture:SetAllPoints(realNormalTexture)
--button.normalTexture = button:CreateTexture(("%sBT4NormalTexture"):format(name))
--button.normalTexture:SetAllPoints(realNormalTexture)
--realNormalTexture:Hide()
button.normalTexture = button:GetNormalTexture() -- _G[("%sNormalTexture"):format(name)]
button.pushedTexture = button:GetPushedTexture()
button.highlightTexture = button:GetHighlightTexture()
@@ -66,7 +68,7 @@ function Bartender4.Button:Create(id, parent)
button:RegisterButtonEvents()
button:Show()
button:UpdateAction()
button:UpdateAction(true)
return button
end
+7
View File
@@ -37,6 +37,13 @@ function Bartender4:SetupOptions()
set = setFunc,
args = {},
},
lock = {
dialogHidden = true,
type = "toggle",
name = "Lock/Unlock the bars.",
get = function() return Bartender4.Locked end,
set = function(info, value) Bartender4:ToggleLock(value) end,
},
},
}
LibStub("AceConfig-3.0"):RegisterOptionsTable("Bartender4", self.options, {"bar", "bt", "bt4"})