Quantcast

Dry-coded attempt at saving frame positions. Won't work with ATSW/Skillet yet.

Ackis [11-20-08 - 23:31]
Dry-coded attempt at saving frame positions.  Won't work with ATSW/Skillet yet.
Filename
ARLFrame.lua
AckisRecipeList.lua
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"],