diff Libs/DF/panel.lua @ 18:680465749fc7

- framework update.
author Tercio
date Fri, 26 Jun 2015 14:03:10 -0300
parents 0c160948ac5e
children 215f0dd37a6c
line wrap: on
line diff
--- a/Libs/DF/panel.lua	Tue Jun 23 14:16:13 2015 -0300
+++ b/Libs/DF/panel.lua	Fri Jun 26 14:03:10 2015 -0300
@@ -1,9 +1,11 @@
-
-
 
 local DF = _G ["DetailsFramework"]
 local _
 
+if (not DF) then -- or not DetailsFrameWorkLoadValid
+	return 
+end
+
 --> lua locals
 local _rawset = rawset --> lua local
 local _rawget = rawget --> lua local
@@ -1335,6 +1337,7 @@
 function DF:SavePositionOnScreen (frame)
 	if (frame.db and frame.db.position) then
 		local x, y = DF:GetPositionOnScreen (frame)
+		--print ("saving...", x, y, frame:GetName())
 		frame.db.position.x, frame.db.position.y = x, y
 	end
 end
@@ -1359,6 +1362,15 @@
 	end
 end
 
+local Panel1PxHasPosition = function (self)
+	local db = self.db
+	if (db) then
+		if (db.position and db.position.x and (db.position.x ~= 0 or db.position.y ~= 0)) then
+			return true
+		end
+	end
+end
+
 function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_special_frame)
 	local f = CreateFrame ("frame", name, parent or UIParent)
 	f:SetSize (w or 100, h or 75)
@@ -1380,6 +1392,7 @@
 	f:SetUserPlaced (true)
 	
 	f.db = config
+	--print (config.position.x, config.position.x)
 	Panel1PxReadConfig (f)
 	
 	local close = CreateFrame ("button", name and name .. "CloseButton", f)
@@ -1426,6 +1439,7 @@
 	f.Title = title_string
 	f.Lock = lock
 	f.Close = close
+	f.HasPosition = Panel1PxHasPosition
 	
 	f.IsLocked = not f.IsLocked
 	Panel1PxOnToggleLock (f)