- remove cyCircled support

- add preliminary ButtonFacade support (still some bugs in it)
- this also replaces the built-in skin selection for the bars (for now)
This commit is contained in:
Hendrik Leppkes
2008-04-11 17:14:46 +00:00
parent 8b4d98cce6
commit acbaae01eb
9 changed files with 47 additions and 122 deletions
-1
View File
@@ -153,7 +153,6 @@ function ActionBar:UpdateButtons(numbuttons)
-- show active buttons
for i = 1, numbuttons do
buttons[i]:Show()
buttons[i]:ApplyStyle(self.config.style)
buttons[i]:UpdateAction(true)
end
+14
View File
@@ -61,6 +61,9 @@ function BT4ActionBars:OnInitialize()
ActionBar_MT = {__index = ActionBar}
end
local LBF = LibStub("LibButtonFacade", true)
-- setup the 10 actionbars
local first = true
function BT4ActionBars:OnEnable()
@@ -77,6 +80,10 @@ function BT4ActionBars:OnEnable()
end
end
if LBF then
LBF:RegisterSkinCallback("Bartender4", self.UpdateSkin, self)
end
first = nil
end
@@ -132,6 +139,13 @@ function BT4ActionBars:ApplyConfig()
end
end
function BT4ActionBars:UpdateSkin(SkinID, Gloss, Backdrop, Group, Button)
local id = tonumber(Group)
if id and self.actionbars[id] then
self.actionbars[id]:ForAll("Update")
end
end
-- we do not allow to disable the actionbars module
function BT4ActionBars:ToggleModule()
return
+3 -4
View File
@@ -25,11 +25,10 @@ function Bartender4:OnInitialize()
MainMenuBar:Hide()
end
function Bartender4:OnEnable()
if IsAddOnLoaded("cyCircled") then
self:SecureHook(cyCircled, "LoadPlugins", "cyLoaded")
end
--[[ function Bartender4:OnEnable()
--
end
--]]
function Bartender4:RegisterDefaultsKey(key, subdefaults)
defaults.profile[key] = subdefaults
+1 -1
View File
@@ -3,7 +3,7 @@
## Title: Bartender4
## Author: Nevcairiel
## SavedVariables: Bartender4DB
## OptionalDeps: Ace3
## OptionalDeps: Ace3, ButtonFacade
## X-Embeds: Ace3
## X-Category: Action Bars
## Version: 4.0
+13 -2
View File
@@ -15,6 +15,8 @@ local format = string.format
local IsUsableAction = IsUsableAction
local IsActionInRange = IsActionInRange
local LBF = LibStub("LibButtonFacade", true)
Bartender4.Button = {}
Bartender4.Button.prototype = Button
function Bartender4.Button:Create(id, parent)
@@ -100,6 +102,17 @@ function Bartender4.Button:Create(id, parent)
--button:Show()
--button:UpdateAction(true)
if LBF and parent.LBFGroup then
local group = parent.LBFGroup
button.LBFButtonData = {
Button = button.Proxy,
Highlight = button:GetHighlightTexture(),
Pushed = button:GetPushedTexture(),
Checked = button:GetCheckedTexture(),
}
group:AddButton(button.Proxy, button.LBFButtonData)
end
return button
end
@@ -167,8 +180,6 @@ function onUpdate(self, elapsed)
end
end
Button.ApplyStyle = Bartender4.ButtonStyle.ApplyStyle
function Button:SetStateAction(state, action)
for i=1,2 do
self:SetAttribute(("*action-S%d%d"):format(state, i), action)
+6 -23
View File
@@ -9,16 +9,21 @@ local ButtonBar_MT = {__index = ButtonBar}
local defaults = Bartender4:Merge({
padding = 2,
rows = 1,
style = "dream",
}, Bartender4.Bar.defaults)
Bartender4.ButtonBar = {}
Bartender4.ButtonBar.prototype = ButtonBar
Bartender4.ButtonBar.defaults = defaults
local LBF = LibStub("LibButtonFacade", true)
function Bartender4.ButtonBar:Create(id, template, config)
local bar = setmetatable(Bartender4.Bar:Create(id, template, config), ButtonBar_MT)
if LBF then
bar.LBFGroup = LBF:Group("Bartender4", tostring(id))
end
return bar
end
@@ -35,7 +40,6 @@ do
optionMap = {
rows = "Rows",
padding = "Padding",
style = "Style",
}
-- retrieves a valid bar object from the barregistry table
@@ -80,15 +84,6 @@ function ButtonBar:GetOptionObject()
set = optSetter,
get = optGetter,
},
style = {
order = 59,
name = "Style",
type = "select",
desc = "Button Style",
values = Bartender4.ButtonStyle:GetStyles(),
set = optSetter,
get = optGetter,
},
rows = {
order = 70,
name = "Rows",
@@ -171,18 +166,6 @@ function ButtonBar:UpdateButtonLayout()
end
end
function ButtonBar:GetStyle()
return self.config.style
end
function ButtonBar:SetStyle(style)
if style then
self.config.style = style
end
self:ForAll("ApplyStyle", self.config.style)
end
--[[===================================================================================
Utility function
===================================================================================]]--
-86
View File
@@ -4,89 +4,3 @@
--[[ $Id$ ]]
Bartender4.ButtonStyle = {}
local styles = {
["default"] = "Default",
["zoom"] = "Full Zoom",
["dream"] = "Dreamlayout",
}
local styledata = {
["default"] = {},
["zoom"] = { texCoord = {0.07, 0.93, 0.07, 0.93} },
["dream"] = {
texCoord = {0.08,0.92,0.08,0.92},
padding = 3,
overlay = true,
FrameFunc = function(button)
button = button.Proxy or button
local name = button:GetName().."DreamLayout"
local frame = _G[name] or CreateFrame("Frame", name, button)
frame:ClearAllPoints()
frame:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 1, edgeFile = "", edgeSize = 0, insets = {left = 0, right = 0, top = 0, bottom = 0},})
frame:SetBackdropColor(0, 0, 0, 0.6)
frame:SetAllPoints(button)
frame:SetFrameLevel(button:GetFrameLevel() - 2)
frame:Show()
frame.type = "dream"
frame.hidegrid = true
return frame
end,
},
}
local cydb
function Bartender4.ButtonStyle.ApplyStyle(button, styleName)
if not button.icon then return end
local style = styledata[styleName]
local cy = cydb and cydb.profile[button:GetParent().id]
--DevTools_Dump(cydb and cydb.profile)
if cy then
style = styledata.default
end
if style.overlay and style.FrameFunc then
if not button.overlay or button.overlay.type ~= styleName then
if button.overlay then button.overlay:Hide() end
button.overlay = style.FrameFunc(button)
end
else
if button.overlay then
button.overlay:Hide()
button.overlay = nil
end
end
if cy then return end
if style.texCoord then
button.icon:SetTexCoord(unpack(style.texCoord))
else
button.icon:SetTexCoord(0,1,0,1)
end
button.icon:ClearAllPoints()
if style.padding then
button.icon:SetPoint("TOPLEFT", button, "TOPLEFT", style.padding, -style.padding)
button.icon:SetPoint("BOTTOMRIGHT",button, "BOTTOMRIGHT", -style.padding, style.padding)
else
button.icon:SetAllPoints(button)
end
if type(button.Update) == "function" then
button:Update()
end
end
function Bartender4.ButtonStyle:GetStyles()
return styles
end
function Bartender4:cyLoaded()
cydb = cyCircled_Bartender4 and cyCircled_Bartender4.db
Bartender4.Bar:ForAll("SetStyle")
end
-3
View File
@@ -266,9 +266,6 @@ function PetButtonPrototype:UpdateCooldown()
CooldownFrame_SetTimer(self.cooldown, start, duration, enable)
end
-- import style function
PetButtonPrototype.ApplyStyle = Bartender4.ButtonStyle.ApplyStyle
function PetButtonPrototype:GetHotkey()
local key = GetBindingKey(format("BONUSACTIONBUTTON%d", self:GetID())) or GetBindingKey("CLICK "..self:GetName()..":LeftButton")
return key and KeyBound:ToShortKey(key)
+10 -2
View File
@@ -14,6 +14,8 @@ local StanceButton_MT = {__index = StanceButtonPrototype}
local format = string.format
local LBF = LibStub("LibButtonFacade", true)
local defaults = { profile = Bartender4:Merge({
enabled = true,
scale = 1.5,
@@ -143,8 +145,6 @@ function StanceButtonPrototype:Update()
end
end
StanceButtonPrototype.ApplyStyle = Bartender4.ButtonStyle.ApplyStyle
function StanceButtonPrototype:GetHotkey()
local key = GetBindingKey(format("SHAPESHIFTBUTTON%d", self:GetID())) or GetBindingKey("CLICK "..self:GetName()..":LeftButton")
return key and KeyBound:ToShortKey(key)
@@ -208,6 +208,14 @@ function StanceBarMod:CreateStanceButton(id)
button.OnEnter = button:GetScript("OnEnter")
button:SetScript("OnEnter", onEnter)
if LBF then
local group = self.bar.LBFGroup
button.LBFButtonData = {
Button = button
}
group:AddButton(button, button.LBFButtonData)
end
return button
end