From acc67ba2a099476a38bbdb0dcf1394c9e44a808a Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Tue, 20 Jan 2009 15:33:02 +0100 Subject: [PATCH 1/8] First work on LibWindow-1.1 usage, plumbing for new bar resizing/button positioning --- .pkgmeta | 1 + Bar.lua | 53 +++++++++++++++++++++++++++++++++----------------- Bartender4.lua | 2 ++ Bartender4.toc | 3 ++- MicroMenu.lua | 4 +++- PetBar.lua | 1 - StanceBar.lua | 4 +++- 7 files changed, 46 insertions(+), 22 deletions(-) diff --git a/.pkgmeta b/.pkgmeta index 4819ad5..bd74148 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -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 diff --git a/Bar.lua b/Bar.lua index e1d5a76..a4b3592 100644 --- a/Bar.lua +++ b/Bar.lua @@ -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,14 @@ local defaults = { possess = true, stance = {}, }, + position = { + scale = 1, + }, 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 @@ -170,7 +173,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 +190,29 @@ function Bar:ApplyConfig(config) self:InitVisibilityDriver() 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 + x, y = x/s, y/s + self:ClearSetPoint(point, UIParent, relPoint, x, y) + LibWin.SavePosition(self) + pos.relPoint = nil + end + end + self.config.version = Bartender4.CONFIG_VERSION +end + function Bar:Unlock() if self.disabled or self.unlocked then return end self.unlocked = true @@ -206,22 +236,11 @@ 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) @@ -243,15 +262,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() diff --git a/Bartender4.lua b/Bartender4.lua index 0c07f26..4cf841f 100644 --- a/Bartender4.lua +++ b/Bartender4.lua @@ -20,6 +20,8 @@ local defaults = { } } +Bartender4.CONFIG_VERSION = 2 + function Bartender4:OnInitialize() self.db = LibStub("AceDB-3.0"):New("Bartender4DB", defaults) self.db.RegisterCallback(self, "OnProfileChanged", "UpdateModuleConfigs") diff --git a/Bartender4.toc b/Bartender4.toc index 76fa3fa..deeba23 100644 --- a/Bartender4.toc +++ b/Bartender4.toc @@ -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 diff --git a/MicroMenu.lua b/MicroMenu.lua index 8efbc51..85dd842 100644 --- a/MicroMenu.lua +++ b/MicroMenu.lua @@ -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() diff --git a/PetBar.lua b/PetBar.lua index f24e726..31a53de 100644 --- a/PetBar.lua +++ b/PetBar.lua @@ -11,7 +11,6 @@ local PetBar = setmetatable({}, {__index = ButtonBar}) local defaults = { profile = Bartender4:Merge({ enabled = true, - scale = 1.0, hidehotkey = true, visibility = { nopet = true, diff --git a/StanceBar.lua b/StanceBar.lua index 8de7a52..149f44f 100644 --- a/StanceBar.lua +++ b/StanceBar.lua @@ -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) } From 6f5086adc8e40b817772247d7e9bd2cda6bafa2f Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 21 Feb 2009 14:12:49 +0100 Subject: [PATCH 2/8] Added plumbing to change the growth direction of the bars. Currently always defaults to DOWN and RIGHT, as that is the "old" behaviour. --- Bar.lua | 18 ++++++++++++++---- ButtonBar.lua | 14 ++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Bar.lua b/Bar.lua index a4b3592..86b2375 100644 --- a/Bar.lua +++ b/Bar.lua @@ -21,6 +21,8 @@ local defaults = { }, position = { scale = 1, + growVertical = "DOWN", + growHorizontal = "RIGHT", }, clickthrough = false, } @@ -109,9 +111,13 @@ function Bartender4.Bar:Create(id, config, name) 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:EnableMouse(true) @@ -142,10 +148,10 @@ function Bartender4.Bar:Create(id, config, name) overlay:SetFrameLevel(bar:GetFrameLevel() + 10) overlay:ClearAllPoints() - overlay:SetAllPoints(bar) + local anchor = bar:GetAnchor() + overlay:SetPoint(anchor, bar, anchor) overlay:Hide() - bar.config = config bar.elapsed = 0 bar.hidedriver = {} @@ -190,6 +196,10 @@ 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:UpgradeConfig() local version = self.config.version or 1 if version < 2 then @@ -244,8 +254,8 @@ function Bar:SavePosition() end function Bar:SetSize(width, height) - self:SetWidth(width) - self:SetHeight(height or width) + self.overlay:SetWidth(width) + self.overlay:SetHeight(height or width) end function Bar:GetConfigAlpha() diff --git a/ButtonBar.lua b/ButtonBar.lua index 688fbad..8dbc13a 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -155,16 +155,22 @@ function ButtonBar:UpdateButtonLayout() self:SetSize((self.button_width + hpad) * ButtonPerRow - pad + 8, (self.button_height + vpad) * Rows - pad + 8) - -- 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)) + local anchor = self:GetAnchor() + -- anchor button 1 + buttons[1]:ClearSetPoint(anchor, self, anchor, 5 - (self.hpad_offset or 0), -3 - (self.vpad_offset or 0)) + + local h1 = (self.config.position.growHorizontal == "RIGHT") and "LEFT" or "RIGHT" + local h2 = (self.config.position.growHorizontal == "RIGHT") and "RIGHT" or "LEFT" + local v1 = (self.config.position.growVertical == "DOWN") and "TOP" or "BOTTOM" + local v2 = (self.config.position.growVertical == "DOWN") and "BOTTOM" or "TOP" -- 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 From e9071dc3d06292f0aa15593c8934f333fc407989 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 21 Feb 2009 14:14:53 +0100 Subject: [PATCH 3/8] Try to preserve the old position properly during the migration to the new system. --- Bar.lua | 14 ++++++++++++++ Bartender4.lua | 2 +- ButtonBar.lua | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Bar.lua b/Bar.lua index 86b2375..3a1f6a8 100644 --- a/Bar.lua +++ b/Bar.lua @@ -220,6 +220,10 @@ function Bar:UpgradeConfig() pos.relPoint = nil end end + if version < 3 then + -- Size adjustment is done in first SetSize + self.needSizeFix = true + end self.config.version = Bartender4.CONFIG_VERSION end @@ -256,6 +260,16 @@ end function Bar:SetSize(width, height) 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() diff --git a/Bartender4.lua b/Bartender4.lua index 4cf841f..db113ed 100644 --- a/Bartender4.lua +++ b/Bartender4.lua @@ -20,7 +20,7 @@ local defaults = { } } -Bartender4.CONFIG_VERSION = 2 +Bartender4.CONFIG_VERSION = 3 function Bartender4:OnInitialize() self.db = LibStub("AceDB-3.0"):New("Bartender4DB", defaults) diff --git a/ButtonBar.lua b/ButtonBar.lua index 8dbc13a..aa63b99 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -155,8 +155,8 @@ function ButtonBar:UpdateButtonLayout() self:SetSize((self.button_width + hpad) * ButtonPerRow - pad + 8, (self.button_height + vpad) * Rows - pad + 8) - local anchor = self:GetAnchor() -- anchor button 1 + local anchor = self:GetAnchor() buttons[1]:ClearSetPoint(anchor, self, anchor, 5 - (self.hpad_offset or 0), -3 - (self.vpad_offset or 0)) local h1 = (self.config.position.growHorizontal == "RIGHT") and "LEFT" or "RIGHT" From 4529c41327fc14f5c4f7ceacf59d58af4a69cd35 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 21 Feb 2009 14:23:25 +0100 Subject: [PATCH 4/8] Use our SavePosition function instead of LibWindow directly --- Bar.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bar.lua b/Bar.lua index 3a1f6a8..a1ec1f3 100644 --- a/Bar.lua +++ b/Bar.lua @@ -216,7 +216,7 @@ function Bar:UpgradeConfig() local point, relPoint = pos.point, pos.relPoint x, y = x/s, y/s self:ClearSetPoint(point, UIParent, relPoint, x, y) - LibWin.SavePosition(self) + self:SavePosition() pos.relPoint = nil end end From a1189dbad8071433378a1c726988cfe98cdbcf7f Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 21 Feb 2009 14:58:17 +0100 Subject: [PATCH 5/8] Added options to adjust the vertical and horizontal growth direction --- Bar.lua | 10 +++++++--- ButtonBar.lua | 21 +++++++++++++++++++++ Options/ButtonBar.lua | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/Bar.lua b/Bar.lua index a1ec1f3..9fabbef 100644 --- a/Bar.lua +++ b/Bar.lua @@ -147,9 +147,7 @@ function Bartender4.Bar:Create(id, config, name) overlay:SetScript("OnClick", barOnClick) overlay:SetFrameLevel(bar:GetFrameLevel() + 10) - overlay:ClearAllPoints() - local anchor = bar:GetAnchor() - overlay:SetPoint(anchor, bar, anchor) + bar:AnchorOverlay() overlay:Hide() bar.elapsed = 0 @@ -200,6 +198,12 @@ 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 diff --git a/ButtonBar.lua b/ButtonBar.lua index aa63b99..dc70594 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -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 diff --git a/Options/ButtonBar.lua b/Options/ButtonBar.lua index 4fdd6b6..5bbd507 100644 --- a/Options/ButtonBar.lua +++ b/Options/ButtonBar.lua @@ -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"], From 571fe6cca4994e9049f86ccacdc9ae5aa1fc3c64 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 21 Feb 2009 15:16:34 +0100 Subject: [PATCH 6/8] Fixed behaviour of padding on alternate growth directions and fixed the alignment of the drag-overlay. --- ButtonBar.lua | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/ButtonBar.lua b/ButtonBar.lua index dc70594..693ae42 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -174,16 +174,34 @@ 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, 5 - (self.hpad_offset or 0), -3 - (self.vpad_offset or 0)) + buttons[1]:ClearSetPoint(anchor, self, anchor, xOff - (self.hpad_offset or 0), yOff - (self.vpad_offset or 0)) - local h1 = (self.config.position.growHorizontal == "RIGHT") and "LEFT" or "RIGHT" - local h2 = (self.config.position.growHorizontal == "RIGHT") and "RIGHT" or "LEFT" - local v1 = (self.config.position.growVertical == "DOWN") and "TOP" or "BOTTOM" - local v2 = (self.config.position.growVertical == "DOWN") and "BOTTOM" or "TOP" -- and anchor all other buttons relative to our button 1 for i = 2, numbuttons do -- jump into a new row From 204ac6a67119afad7191ca340475f411d36a579b Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 21 Feb 2009 15:42:57 +0100 Subject: [PATCH 7/8] Fix the behaviour of snapping for the new bar positioning. --- Bar.lua | 24 +++++++++++++++++++++++- libs/SimpleSticky.lua | 4 ++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Bar.lua b/Bar.lua index 9fabbef..2c5d3bc 100644 --- a/Bar.lua +++ b/Bar.lua @@ -43,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() @@ -60,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() @@ -107,7 +128,6 @@ 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 @@ -120,6 +140,8 @@ function Bartender4.Bar:Create(id, config, name) 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") diff --git a/libs/SimpleSticky.lua b/libs/SimpleSticky.lua index 43096ac..536622d 100644 --- a/libs/SimpleSticky.lua +++ b/libs/SimpleSticky.lua @@ -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 From 044899f52524523f70cad8840f073580d8220fa1 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 21 Feb 2009 15:53:41 +0100 Subject: [PATCH 8/8] Fixed initial positions for all bars --- ActionBar.lua | 2 +- BagBar.lua | 2 +- Bar.lua | 10 ++++++---- MicroMenu.lua | 4 ++-- PetBar.lua | 2 +- StanceBar.lua | 2 +- VehicleBar.lua | 8 ++++---- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ActionBar.lua b/ActionBar.lua index eb5f6f8..beb1cfc 100644 --- a/ActionBar.lua +++ b/ActionBar.lua @@ -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) diff --git a/BagBar.lua b/BagBar.lua index 8b3684a..a5bb565 100644 --- a/BagBar.lua +++ b/BagBar.lua @@ -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 diff --git a/Bar.lua b/Bar.lua index 2c5d3bc..e5c5b5f 100644 --- a/Bar.lua +++ b/Bar.lua @@ -240,10 +240,12 @@ function Bar:UpgradeConfig() self:SetScale(pos.scale) 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) - self:SavePosition() - pos.relPoint = nil + 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 diff --git a/MicroMenu.lua b/MicroMenu.lua index 85dd842..82ecb3e 100644 --- a/MicroMenu.lua +++ b/MicroMenu.lua @@ -72,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 diff --git a/PetBar.lua b/PetBar.lua index 31a53de..ac619d8 100644 --- a/PetBar.lua +++ b/PetBar.lua @@ -95,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 diff --git a/StanceBar.lua b/StanceBar.lua index 149f44f..a27c3a7 100644 --- a/StanceBar.lua +++ b/StanceBar.lua @@ -208,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 diff --git a/VehicleBar.lua b/VehicleBar.lua index 0eb5e30..1a630e6 100644 --- a/VehicleBar.lua +++ b/VehicleBar.lua @@ -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