From f1ff77e487d1fd798176c4128e607a30d530c08b Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 5 Jul 2010 01:51:42 -0400 Subject: [PATCH] Pressing the "Reset Window Position" button from the Display Options now works immediately. --- Config.lua | 2 ++ Frame.lua | 68 ++++++++++++++++++++++++++++++++---------------------------- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/Config.lua b/Config.lua index be3ad5f..ecdd9a2 100644 --- a/Config.lua +++ b/Config.lua @@ -35,6 +35,7 @@ local function giveProfiles() end local function ResetGUI() + addon.Frame:Hide() addon.db.profile.frameopts.offsetx = 0 addon.db.profile.frameopts.offsety = 0 addon.db.profile.frameopts.anchorTo = "" @@ -42,6 +43,7 @@ local function ResetGUI() addon.db.profile.frameopts.uiscale = 1 addon.db.profile.frameopts.tooltipscale = .9 addon.db.profile.frameopts.fontsize = 11 + addon.Frame:Show() end local options diff --git a/Frame.lua b/Frame.lua index 3aaf9c5..1d033b8 100644 --- a/Frame.lua +++ b/Frame.lua @@ -4281,38 +4281,6 @@ do self.is_linked = is_linked ------------------------------------------------------------------------------- - -- Restore the panel's position on the screen. - ------------------------------------------------------------------------------- - local opts = addon.db.profile.frameopts - local FixedOffsetX = opts.offsetx - - self:ClearAllPoints() - - if opts.anchorTo == "" then -- no values yet, clamp to whatever frame is appropriate - if _G.ATSWFrame then - self:SetPoint("CENTER", _G.ATSWFrame, "CENTER", 490, 0) - elseif _G.CauldronFrame then - self:SetPoint("CENTER", _G.CauldronFrame, "CENTER", 490, 0) - elseif _G.Skillet then - self:SetPoint("CENTER", _G.SkilletFrame, "CENTER", 468, 0) - else - self:SetPoint("TOPLEFT", _G.TradeSkillFrame, "TOPRIGHT", 10, 0) - end - else - if self.is_expanded then - if opts.anchorFrom == "TOPLEFT" or opts.anchorFrom == "LEFT" or opts.anchorFrom == "BOTTOMLEFT" then - FixedOffsetX = opts.offsetx - elseif opts.anchorFrom == "TOP" or opts.anchorFrom == "CENTER" or opts.anchorFrom == "BOTTOM" then - FixedOffsetX = opts.offsetx + 151/2 - elseif opts.anchorFrom == "TOPRIGHT" or opts.anchorFrom == "RIGHT" or opts.anchorFrom == "BOTTOMRIGHT" then - FixedOffsetX = opts.offsetx + 151 - end - end - self:SetPoint(opts.anchorFrom, UIParent, opts.anchorTo, FixedOffsetX, opts.offsety) - end - self:SetScale(addon.db.profile.frameopts.uiscale) - - ------------------------------------------------------------------------------- -- Set the profession. ------------------------------------------------------------------------------- local prev_profession = self.profession @@ -4361,6 +4329,42 @@ do self:UpdateTitle() self:Show() end + + ------------------------------------------------------------------------------- + -- Restore the panel's position on the screen. + ------------------------------------------------------------------------------- + local function Reset_Position(self) + local opts = addon.db.profile.frameopts + local FixedOffsetX = opts.offsetx + + self:ClearAllPoints() + + if opts.anchorTo == "" then -- no values yet, clamp to whatever frame is appropriate + if _G.ATSWFrame then + self:SetPoint("CENTER", _G.ATSWFrame, "CENTER", 490, 0) + elseif _G.CauldronFrame then + self:SetPoint("CENTER", _G.CauldronFrame, "CENTER", 490, 0) + elseif _G.Skillet then + self:SetPoint("CENTER", _G.SkilletFrame, "CENTER", 468, 0) + else + self:SetPoint("TOPLEFT", _G.TradeSkillFrame, "TOPRIGHT", 10, 0) + end + else + if self.is_expanded then + if opts.anchorFrom == "TOPLEFT" or opts.anchorFrom == "LEFT" or opts.anchorFrom == "BOTTOMLEFT" then + FixedOffsetX = opts.offsetx + elseif opts.anchorFrom == "TOP" or opts.anchorFrom == "CENTER" or opts.anchorFrom == "BOTTOM" then + FixedOffsetX = opts.offsetx + 151/2 + elseif opts.anchorFrom == "TOPRIGHT" or opts.anchorFrom == "RIGHT" or opts.anchorFrom == "BOTTOMRIGHT" then + FixedOffsetX = opts.offsetx + 151 + end + end + self:SetPoint(opts.anchorFrom, UIParent, opts.anchorTo, FixedOffsetX, opts.offsety) + end + self:SetScale(addon.db.profile.frameopts.uiscale) + end + + MainPanel:SetScript("OnShow", Reset_Position) end -- do-block -------------------------------------------------------------------------------- -- 1.7.9.5