Merge branch 'libwindow'
This commit is contained in:
@@ -13,3 +13,4 @@ externals:
|
||||
libs/AceConfig-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConfig-3.0
|
||||
libs/LibKeyBound-1.0: svn://svn.wowace.com/wow/libkeybound-1-0/mainline/trunk/LibKeyBound-1.0
|
||||
libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0
|
||||
libs/LibWindow-1.1: svn://svn.wowace.com/wow/libwindow-1-1/mainline/trunk/LibWindow-1.1
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ end
|
||||
function ActionBar:ApplyConfig(config)
|
||||
ButtonBar.ApplyConfig(self, config)
|
||||
|
||||
if not self.config.position then initialPosition(self) end
|
||||
if not self.config.position.x then initialPosition(self) end
|
||||
|
||||
self:UpdateButtons()
|
||||
self:UpdateSelfCast(true)
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ end
|
||||
function BagBar:ApplyConfig(config)
|
||||
ButtonBar.ApplyConfig(self, config)
|
||||
|
||||
if not self.config.position then
|
||||
if not self.config.position.x then
|
||||
self:ClearSetPoint("CENTER", 142, -18)
|
||||
self:SavePosition()
|
||||
end
|
||||
|
||||
@@ -11,7 +11,6 @@ local table_concat, table_insert = table.concat, table.insert
|
||||
===================================================================================]]--
|
||||
|
||||
local defaults = {
|
||||
scale = 1,
|
||||
alpha = 1,
|
||||
fadeout = false,
|
||||
fadeoutalpha = 0.1,
|
||||
@@ -20,10 +19,16 @@ local defaults = {
|
||||
possess = true,
|
||||
stance = {},
|
||||
},
|
||||
position = {
|
||||
scale = 1,
|
||||
growVertical = "DOWN",
|
||||
growHorizontal = "RIGHT",
|
||||
},
|
||||
clickthrough = false,
|
||||
}
|
||||
|
||||
local Sticky = LibStub("LibSimpleSticky-1.0")
|
||||
local LibWin = LibStub("LibWindow-1.1")
|
||||
local snapBars = { WorldFrame, UIParent }
|
||||
|
||||
local barOnEnter, barOnLeave, barOnDragStart, barOnDragStop, barOnClick, barOnUpdateFunc, barOnAttributeChanged
|
||||
@@ -38,10 +43,30 @@ do
|
||||
self:SetBackdropBorderColor(0, 0, 0, 0)
|
||||
end
|
||||
|
||||
local function barReAnchorForSnap(self)
|
||||
local x,y,anchor = nil, nil, self:GetAnchor()
|
||||
x = (self.config.position.growHorizontal == "RIGHT") and self:GetLeft() or self:GetRight()
|
||||
y = (self.config.position.growVertical == "DOWN") and self:GetTop() or self:GetBottom()
|
||||
self:ClearSetPoint(anchor, UIParent, "BOTTOMLEFT", x, y)
|
||||
self:SetWidth(self.overlay:GetWidth())
|
||||
self:SetHeight(self.overlay:GetHeight())
|
||||
end
|
||||
|
||||
local function barReAnchorNormal(self)
|
||||
local x,y,anchor = nil, nil, self:GetAnchor()
|
||||
x = (self.config.position.growHorizontal == "RIGHT") and self:GetLeft() or self:GetRight()
|
||||
y = (self.config.position.growVertical == "DOWN") and self:GetTop() or self:GetBottom()
|
||||
self:ClearSetPoint(anchor, UIParent, "BOTTOMLEFT", x, y)
|
||||
self:SetWidth(1)
|
||||
self:SetHeight(1)
|
||||
end
|
||||
|
||||
function barOnDragStart(self)
|
||||
local parent = self:GetParent()
|
||||
if Bartender4.db.profile.snapping then
|
||||
local offset = 8 - (parent.config.padding or 0)
|
||||
-- we need to re-anchor the bar and set its proper width for snaping to work properly
|
||||
barReAnchorForSnap(parent)
|
||||
Sticky:StartMoving(parent, snapBars, offset, offset, offset, offset)
|
||||
else
|
||||
parent:StartMoving()
|
||||
@@ -55,6 +80,7 @@ do
|
||||
if parent.isMoving then
|
||||
if Bartender4.db.profile.snapping then
|
||||
local sticky, stickTo = Sticky:StopMoving(parent)
|
||||
barReAnchorNormal(parent)
|
||||
--Bartender4:Print(sticky, stickTo and stickTo:GetName() or nil)
|
||||
else
|
||||
parent:StopMovingOrSizing()
|
||||
@@ -102,15 +128,20 @@ function Bartender4.Bar:Create(id, config, name)
|
||||
|
||||
local bar = setmetatable(CreateFrame("Frame", ("BT4Bar%s"):format(id), UIParent, "SecureHandlerStateTemplate"), Bar_MT)
|
||||
barregistry[id] = bar
|
||||
table_insert(snapBars, bar)
|
||||
|
||||
bar.id = id
|
||||
bar.name = name or id
|
||||
bar.config = config
|
||||
bar:SetMovable(true)
|
||||
bar:HookScript("OnAttributeChanged", barOnAttributeChanged)
|
||||
|
||||
bar:SetWidth(1)
|
||||
bar:SetHeight(1)
|
||||
|
||||
local overlay = CreateFrame("Button", bar:GetName() .. "Overlay", bar)
|
||||
bar.overlay = overlay
|
||||
overlay.bar = bar
|
||||
table_insert(snapBars, overlay)
|
||||
overlay:EnableMouse(true)
|
||||
overlay:RegisterForDrag("LeftButton")
|
||||
overlay:RegisterForClicks("LeftButtonUp")
|
||||
@@ -138,11 +169,9 @@ function Bartender4.Bar:Create(id, config, name)
|
||||
overlay:SetScript("OnClick", barOnClick)
|
||||
|
||||
overlay:SetFrameLevel(bar:GetFrameLevel() + 10)
|
||||
overlay:ClearAllPoints()
|
||||
overlay:SetAllPoints(bar)
|
||||
bar:AnchorOverlay()
|
||||
overlay:Hide()
|
||||
|
||||
bar.config = config
|
||||
bar.elapsed = 0
|
||||
bar.hidedriver = {}
|
||||
|
||||
@@ -170,7 +199,11 @@ function Bar:ApplyConfig(config)
|
||||
if config then
|
||||
self.config = config
|
||||
end
|
||||
LibWin.RegisterConfig(self, self.config.position)
|
||||
|
||||
self:UpgradeConfig()
|
||||
if self.disabled then return end
|
||||
|
||||
if Bartender4.Locked then
|
||||
self:Lock()
|
||||
else
|
||||
@@ -183,6 +216,45 @@ function Bar:ApplyConfig(config)
|
||||
self:InitVisibilityDriver()
|
||||
end
|
||||
|
||||
function Bar:GetAnchor()
|
||||
return ((self.config.position.growVertical == "DOWN") and "TOP" or "BOTTOM") .. ((self.config.position.growHorizontal == "RIGHT") and "LEFT" or "RIGHT")
|
||||
end
|
||||
|
||||
function Bar:AnchorOverlay()
|
||||
self.overlay:ClearAllPoints()
|
||||
local anchor = self:GetAnchor()
|
||||
self.overlay:SetPoint(anchor, self, anchor)
|
||||
end
|
||||
|
||||
function Bar:UpgradeConfig()
|
||||
local version = self.config.version or 1
|
||||
if version < 2 then
|
||||
-- LibWindow migration, move scale into position
|
||||
if self.config.scale then
|
||||
self.config.position.scale = self.config.scale
|
||||
self.config.scale = nil
|
||||
end
|
||||
-- LibWindow migration, update position data
|
||||
do
|
||||
local pos = self.config.position
|
||||
self:SetScale(pos.scale)
|
||||
local x, y, s = pos.x, pos.y, self:GetEffectiveScale()
|
||||
local point, relPoint = pos.point, pos.relPoint
|
||||
if x and y and point and relPoint then
|
||||
x, y = x/s, y/s
|
||||
self:ClearSetPoint(point, UIParent, relPoint, x, y)
|
||||
self:SavePosition()
|
||||
pos.relPoint = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if version < 3 then
|
||||
-- Size adjustment is done in first SetSize
|
||||
self.needSizeFix = true
|
||||
end
|
||||
self.config.version = Bartender4.CONFIG_VERSION
|
||||
end
|
||||
|
||||
function Bar:Unlock()
|
||||
if self.disabled or self.unlocked then return end
|
||||
self.unlocked = true
|
||||
@@ -206,27 +278,26 @@ function Bar:StopDragging()
|
||||
end
|
||||
|
||||
function Bar:LoadPosition()
|
||||
if not self.config.position then return end
|
||||
local pos = self.config.position
|
||||
local x, y, s = pos.x, pos.y, self:GetEffectiveScale()
|
||||
local point, relPoint = pos.point, pos.relPoint
|
||||
x, y = x/s, y/s
|
||||
self:ClearSetPoint(point, UIParent, relPoint, x, y)
|
||||
LibWin.RestorePosition(self)
|
||||
end
|
||||
|
||||
function Bar:SavePosition()
|
||||
if not self.config.position then self.config.position = {} end
|
||||
local pos = self.config.position
|
||||
local point, parent, relPoint, x, y = self:GetPoint()
|
||||
local s = self:GetEffectiveScale()
|
||||
x, y = x*s, y*s
|
||||
pos.x, pos.y = x, y
|
||||
pos.point, pos.relPoint = point, relPoint
|
||||
LibWin.SavePosition(self)
|
||||
end
|
||||
|
||||
function Bar:SetSize(width, height)
|
||||
self:SetWidth(width)
|
||||
self:SetHeight(height or width)
|
||||
self.overlay:SetWidth(width)
|
||||
self.overlay:SetHeight(height or width)
|
||||
if self.needSizeFix then
|
||||
self:SetWidth(width)
|
||||
self:SetHeight(height or width)
|
||||
local x, y = self:GetLeft(), self:GetTop()
|
||||
self:ClearSetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x, y)
|
||||
self:SetWidth(1)
|
||||
self:SetHeight(1)
|
||||
self:SavePosition()
|
||||
self.needSizeFix = nil
|
||||
end
|
||||
end
|
||||
|
||||
function Bar:GetConfigAlpha()
|
||||
@@ -243,15 +314,13 @@ function Bar:SetConfigAlpha(alpha)
|
||||
end
|
||||
|
||||
function Bar:GetConfigScale()
|
||||
return self.config.scale
|
||||
return self.config.position.scale
|
||||
end
|
||||
|
||||
function Bar:SetConfigScale(scale)
|
||||
if scale then
|
||||
self.config.scale = scale
|
||||
LibWin.SetScale(self, scale)
|
||||
end
|
||||
self:SetScale(self.config.scale)
|
||||
self:LoadPosition()
|
||||
end
|
||||
|
||||
function Bar:GetClickThrough()
|
||||
|
||||
@@ -20,6 +20,8 @@ local defaults = {
|
||||
}
|
||||
}
|
||||
|
||||
Bartender4.CONFIG_VERSION = 3
|
||||
|
||||
function Bartender4:OnInitialize()
|
||||
self.db = LibStub("AceDB-3.0"):New("Bartender4DB", defaults)
|
||||
self.db.RegisterCallback(self, "OnProfileChanged", "UpdateModuleConfigs")
|
||||
|
||||
+2
-1
@@ -5,7 +5,7 @@
|
||||
## Author: Nevcairiel
|
||||
## X-Email: h.leppkes AT gmail DOT com
|
||||
## SavedVariables: Bartender4DB
|
||||
## OptionalDeps: Ace3, ButtonFacade, LibKeyBound-1.0, LibDBIcon-1.0
|
||||
## OptionalDeps: Ace3, ButtonFacade, LibKeyBound-1.0, LibDBIcon-1.0, LibWindow-1.1
|
||||
## X-Category: Action Bars
|
||||
## Version: 4.2.6
|
||||
|
||||
@@ -29,6 +29,7 @@ libs\AceConfig-3.0\AceConfig-3.0.xml
|
||||
|
||||
libs\LibKeyBound-1.0\lib.xml
|
||||
libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
|
||||
libs\LibWindow-1.1\LibWindow-1.1.lua
|
||||
#@end-no-lib-strip@
|
||||
|
||||
libs\SimpleSticky.lua
|
||||
|
||||
+50
-5
@@ -119,6 +119,27 @@ function ButtonBar:GetHideHotkey()
|
||||
return self.config.hidehotkey
|
||||
end
|
||||
|
||||
function ButtonBar:SetHGrowth(value)
|
||||
self.config.position.growHorizontal = value
|
||||
self:AnchorOverlay()
|
||||
self:UpdateButtonLayout()
|
||||
end
|
||||
|
||||
function ButtonBar:GetHGrowth()
|
||||
return self.config.position.growHorizontal
|
||||
end
|
||||
|
||||
function ButtonBar:SetVGrowth(value)
|
||||
self.config.position.growVertical = value
|
||||
self:AnchorOverlay()
|
||||
self:UpdateButtonLayout()
|
||||
end
|
||||
|
||||
function ButtonBar:GetVGrowth()
|
||||
return self.config.position.growVertical
|
||||
end
|
||||
|
||||
|
||||
ButtonBar.ClickThroughSupport = true
|
||||
function ButtonBar:SetClickThrough(click)
|
||||
if click ~= nil then
|
||||
@@ -153,18 +174,42 @@ function ButtonBar:UpdateButtonLayout()
|
||||
local hpad = pad + (self.hpad_offset or 0)
|
||||
local vpad = pad + (self.vpad_offset or 0)
|
||||
|
||||
self:SetSize((self.button_width + hpad) * ButtonPerRow - pad + 8, (self.button_height + vpad) * Rows - pad + 8)
|
||||
self:SetSize((self.button_width + hpad) * ButtonPerRow - pad + 10, (self.button_height + vpad) * Rows - pad + 10)
|
||||
|
||||
local h1, h2, v1, v2
|
||||
local xOff, yOff
|
||||
if self.config.position.growHorizontal == "RIGHT" then
|
||||
h1, h2 = "LEFT", "RIGHT"
|
||||
xOff = 5
|
||||
else
|
||||
h1, h2 = "RIGHT", "LEFT"
|
||||
xOff = -3
|
||||
|
||||
hpad = -hpad
|
||||
end
|
||||
|
||||
if self.config.position.growVertical == "DOWN" then
|
||||
v1, v2 = "TOP", "BOTTOM"
|
||||
yOff = -3
|
||||
else
|
||||
v1, v2 = "BOTTOM", "TOP"
|
||||
yOff = 5
|
||||
|
||||
vpad = -vpad
|
||||
end
|
||||
|
||||
-- anchor button 1
|
||||
local anchor = self:GetAnchor()
|
||||
buttons[1]:ClearSetPoint(anchor, self, anchor, xOff - (self.hpad_offset or 0), yOff - (self.vpad_offset or 0))
|
||||
|
||||
-- anchor button 1 to the topleft corner of the bar
|
||||
buttons[1]:ClearSetPoint("TOPLEFT", self, "TOPLEFT", 5 - (self.hpad_offset or 0), -3 - (self.vpad_offset or 0))
|
||||
-- and anchor all other buttons relative to our button 1
|
||||
for i = 2, numbuttons do
|
||||
-- jump into a new row
|
||||
if ((i-1) % ButtonPerRow) == 0 then
|
||||
buttons[i]:ClearSetPoint("TOPLEFT", buttons[i-ButtonPerRow], "BOTTOMLEFT", 0, -vpad)
|
||||
buttons[i]:ClearSetPoint(v1 .. h1, buttons[i-ButtonPerRow], v2 .. h1, 0, -vpad)
|
||||
-- align to the previous button
|
||||
else
|
||||
buttons[i]:ClearSetPoint("TOPLEFT", buttons[i-1], "TOPRIGHT", hpad, 0)
|
||||
buttons[i]:ClearSetPoint("TOP" .. h1, buttons[i-1], "TOP" .. h2, hpad, 0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+5
-3
@@ -17,7 +17,9 @@ local defaults = { profile = Bartender4:Merge({
|
||||
possess = false,
|
||||
},
|
||||
padding = -3,
|
||||
scale = 0.8,
|
||||
position = {
|
||||
scale = 0.8,
|
||||
},
|
||||
}, Bartender4.ButtonBar.defaults) }
|
||||
|
||||
function MicroMenuMod:OnInitialize()
|
||||
@@ -70,8 +72,8 @@ MicroMenuBar.vpad_offset = -21
|
||||
function MicroMenuBar:ApplyConfig(config)
|
||||
ButtonBar.ApplyConfig(self, config)
|
||||
|
||||
if not self.config.position then
|
||||
self:ClearSetPoint("CENTER", -105, 27)
|
||||
if not self.config.position.x then
|
||||
self:ClearSetPoint("CENTER", -105, 30)
|
||||
self:SavePosition()
|
||||
end
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ do
|
||||
zoom = "Zoom",
|
||||
macrotext = "HideMacroText",
|
||||
hotkey = "HideHotkey",
|
||||
vgrowth = "VGrowth",
|
||||
hgrowth = "HGrowth",
|
||||
}
|
||||
|
||||
-- retrieves a valid bar object from the barregistry table
|
||||
@@ -80,6 +82,24 @@ function ButtonBar:GetOptionObject()
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
vgrowth = {
|
||||
order = 75,
|
||||
name = L["Vertical Growth"],
|
||||
desc = L["Vertical growth direction for this bar."],
|
||||
type = "select",
|
||||
values = {UP = L["Up"], DOWN = L["Down"]},
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
hgrowth = {
|
||||
order = 76,
|
||||
name = L["Horizontal Growth"],
|
||||
desc = L["Horizontal growth direction for this bar."],
|
||||
type = "select",
|
||||
values = {LEFT = L["Left"], RIGHT = L["Right"]},
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
hidedesc = {
|
||||
order = 80,
|
||||
name = L["Button Look"],
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@ local PetBar = setmetatable({}, {__index = ButtonBar})
|
||||
|
||||
local defaults = { profile = Bartender4:Merge({
|
||||
enabled = true,
|
||||
scale = 1.0,
|
||||
hidehotkey = true,
|
||||
visibility = {
|
||||
nopet = true,
|
||||
@@ -96,7 +95,7 @@ end
|
||||
function PetBar:ApplyConfig(config)
|
||||
ButtonBar.ApplyConfig(self, config)
|
||||
|
||||
if not self.config.position then
|
||||
if not self.config.position.x then
|
||||
self:ClearSetPoint("CENTER", 0, 70)
|
||||
self:SavePosition()
|
||||
end
|
||||
|
||||
+4
-2
@@ -17,7 +17,9 @@ local KeyBound = LibStub("LibKeyBound-1.0")
|
||||
|
||||
local defaults = { profile = Bartender4:Merge({
|
||||
enabled = true,
|
||||
scale = 1.5,
|
||||
position = {
|
||||
scale = 1.5,
|
||||
},
|
||||
hidehotkey = true,
|
||||
}, Bartender4.ButtonBar.defaults) }
|
||||
|
||||
@@ -206,7 +208,7 @@ end
|
||||
function StanceBar:ApplyConfig(config)
|
||||
ButtonBar.ApplyConfig(self, config)
|
||||
|
||||
if not self.config.position then
|
||||
if not self.config.position.x then
|
||||
self:ClearSetPoint("CENTER", -55, -10)
|
||||
self:SavePosition()
|
||||
end
|
||||
|
||||
+4
-4
@@ -65,14 +65,14 @@ function VehicleBarMod:ApplyConfig()
|
||||
self.bar:ApplyConfig(self.db.profile)
|
||||
end
|
||||
|
||||
VehicleBar.button_width = 30
|
||||
VehicleBar.button_height = 30
|
||||
VehicleBar.button_width = 40
|
||||
VehicleBar.button_height = 40
|
||||
VehicleBar.LBFOverride = true
|
||||
function VehicleBar:ApplyConfig(config)
|
||||
ButtonBar.ApplyConfig(self, config)
|
||||
|
||||
if not self.config.position then
|
||||
self:ClearSetPoint("CENTER", -105, 27)
|
||||
if not self.config.position.x then
|
||||
self:ClearSetPoint("CENTER", 120, 27)
|
||||
self:SavePosition()
|
||||
end
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
This is a modified version by Nevcairiel for Bartender4
|
||||
------------------------------------------------------------------------------------]]
|
||||
|
||||
local MAJOR, MINOR = "LibSimpleSticky-1.0", 1
|
||||
local MAJOR, MINOR = "LibSimpleSticky-1.0", 2
|
||||
local StickyFrames, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not StickyFrames then return end
|
||||
@@ -136,7 +136,7 @@ function StickyFrames:GetUpdateFunc(frame, frameList, xoffset, yoffset, left, to
|
||||
StickyFrames.sticky[frame] = nil
|
||||
for i = 1, #frameList do
|
||||
local v = frameList[i]
|
||||
if frame ~= v and not IsShiftKeyDown() and v:IsVisible() then
|
||||
if frame ~= v and frame ~= v:GetParent() and not IsShiftKeyDown() and v:IsVisible() then
|
||||
if self:SnapFrame(frame, v, left, top, right, bottom) then
|
||||
StickyFrames.sticky[frame] = v
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user