From e7dc818c577ac35ec9833eef1d9689effdd6db52 Mon Sep 17 00:00:00 2001 From: Ackis Date: Thu, 20 Nov 2008 23:31:34 +0000 Subject: [PATCH] Dry-coded attempt at saving frame positions. Won't work with ATSW/Skillet yet. --- ARLFrame.lua | 37 +++++++++++++++++++++++++++++++++++-- AckisRecipeList.lua | 4 ++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ARLFrame.lua b/ARLFrame.lua index 6ade685..f72a740 100644 --- a/ARLFrame.lua +++ b/ARLFrame.lua @@ -3089,6 +3089,11 @@ function addon.ExpandAll_Clicked() end +-- Description: +-- Expected result: +-- Input: +-- Output: + function ARL_DD_Sort_Initialize() k = L["Name"] info.text = k @@ -3117,6 +3122,11 @@ function ARL_DD_Sort_Initialize() ARL_DD_SortText:SetText( L["Sort"] .. ": " .. addon.db.profile.sorting ) end +-- Description: +-- Expected result: +-- Input: +-- Output: + function ARL_DD_Sort_OnClick( button, value ) CloseDropDownMenus() addon.db.profile.sorting = value @@ -3124,6 +3134,22 @@ function ARL_DD_Sort_OnClick( button, value ) ReDisplay() end +-- Description: Saves the frame position into the database +-- Expected result: Frame coordinates are saved +-- Input: None +-- Output: Database values updated with frame position + +local function SaveFramePosition() + + local p = self.db.profile + + local _, _, _, offsetx, offsety = addon.Frame:GetPoint() + + p.offsetx = offsetx + p.offsety = offsety + +end + -- Description: -- Expected result: -- Input: @@ -3239,10 +3265,17 @@ function addon:CreateFrame( ) addon.Frame:SetScript("OnHide", function() self:CloseWindow() end) - addon.Frame:SetScript("OnMouseUp", function() addon.Frame:StopMovingOrSizing() end) + addon.Frame:SetScript("OnMouseUp", + function() + addon.Frame:StopMovingOrSizing() + SaveFramePosition() + end + ) addon.Frame:ClearAllPoints() + local p = self.db.profile + -- Anchor frame to ATSW if (ATSWFrame) then @@ -3254,7 +3287,7 @@ function addon:CreateFrame( else - addon.Frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0) + addon.Frame:SetPoint("CENTER", UIParent, "CENTER", p.offsetx, p.offsety) end diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua index d151cd0..180bf6c 100644 --- a/AckisRecipeList.lua +++ b/AckisRecipeList.lua @@ -137,6 +137,10 @@ function addon:OnInitialize() self.db:RegisterDefaults( { profile = { + -- Frame options + offsetx = 0, + offsety = 0, + -- Sorting Options sorting = L["Skill"], -- 1.7.9.5