From e9071dc3d06292f0aa15593c8934f333fc407989 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 21 Feb 2009 14:14:53 +0100 Subject: [PATCH] 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"