Quantcast

5.3.201

Munglunch [12-03-14 - 18:07]
5.3.201
Filename
Interface/AddOns/SVUI/data/defaults.lua
Interface/AddOns/SVUI/framework/movers/mover_mentalo.lua
Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua
diff --git a/Interface/AddOns/SVUI/data/defaults.lua b/Interface/AddOns/SVUI/data/defaults.lua
index e970336..d13979f 100644
--- a/Interface/AddOns/SVUI/data/defaults.lua
+++ b/Interface/AddOns/SVUI/data/defaults.lua
@@ -54,6 +54,7 @@ SV.defaults["general"] = {
     ["cooldown"] = true,
     ["autoScale"] = true,
     ["multiMonitor"] = false,
+    ["saveDraggable"] = false,
     ["taintLog"] = false,
     ["stickyFrames"] = true,
     ["loginmessage"] = true,
diff --git a/Interface/AddOns/SVUI/framework/movers/mover_mentalo.lua b/Interface/AddOns/SVUI/framework/movers/mover_mentalo.lua
index d041845..364ef14 100644
--- a/Interface/AddOns/SVUI/framework/movers/mover_mentalo.lua
+++ b/Interface/AddOns/SVUI/framework/movers/mover_mentalo.lua
@@ -874,7 +874,34 @@ end
 DRAGGABLE HANDLERS
 ##########################################################
 ]]--
-local BlizzardFrame_OnUpdate = function(self)
+local UIPanelsAdjusted = {};
+
+local BlizzardFrame_OnDragStart = function(self)
+	if not self:IsMovable() then return end
+	self:StartMoving()
+	self.IsMoving = true
+end
+--[[
+##########################################################
+SAVED
+##########################################################
+]]--
+local BlizzardSavedFrame_OnDragStop = function(self)
+	if(not self:IsMovable()) then return end
+	local frameName = self:GetName();
+	self.IsMoving = false;
+	self:StopMovingOrSizing()
+	local anchor1, parent, anchor2, x, y = self:GetPoint()
+	parent = self:GetParent():GetName()
+	self:ClearAllPoints()
+	self:SetPoint(anchor1, parent, anchor2, x, y)
+	if(frameName == "QuestFrame") then
+		frameName = "GossipFrame"
+	end
+	Mentalo:SaveMovable(frameName)
+end
+
+local BlizzardSavedFrame_OnUpdate = function(self)
 	local frameName = self:GetName();
 	if(InCombatLockdown() or (self.IsMoving)) then return end
 	if(frameName == "QuestFrame") then
@@ -894,12 +921,43 @@ local BlizzardFrame_OnUpdate = function(self)
 	end
 end

-local BlizzardFrame_OnDragStart = function(self)
-	if not self:IsMovable() then return end
-	self:StartMoving()
-	self.IsMoving = true
-end
+local SavedDraggablesUpdate = function(self, event, ...)
+	if(InCombatLockdown()) then return end
+	for _, frameName in pairs(DraggableFrames) do
+		if((not self.Blizzard[frameName]) or (self.Blizzard[frameName] and (self.Blizzard[frameName] == "TBD"))) then
+			local frame = _G[frameName]
+			if(frame) then
+				frame:EnableMouse(true)

+				if(frameName == "LFGDungeonReadyPopup") then
+					LFGDungeonReadyDialog:EnableMouse(false)
+				end
+
+				frame:SetMovable(true)
+				frame:RegisterForDrag("LeftButton")
+				frame:SetClampedToScreen(true)
+				frame:HookScript("OnUpdate", BlizzardSavedFrame_OnUpdate)
+				frame:SetScript("OnDragStart", BlizzardFrame_OnDragStart)
+				frame:SetScript("OnDragStop", BlizzardSavedFrame_OnDragStop)
+
+				if(self.CenterEverything and (not UIPanelsAdjusted[panelName])) then
+					frame:ClearAllPoints()
+					frame:SetPoint('TOP', SV.Screen, 'TOP', 0, -180)
+					UIPanelsAdjusted[frameName] = true
+				end
+
+				self.Blizzard[frameName] = CurrentPosition(frame)
+			else
+				self.Blizzard[frameName] = "TBD"
+			end
+		end
+	end
+end
+--[[
+##########################################################
+NOT SAVED
+##########################################################
+]]--
 local BlizzardFrame_OnDragStop = function(self)
 	if(not self:IsMovable()) then return end
 	local frameName = self:GetName();
@@ -909,15 +967,24 @@ local BlizzardFrame_OnDragStop = function(self)
 	parent = self:GetParent():GetName()
 	self:ClearAllPoints()
 	self:SetPoint(anchor1, parent, anchor2, x, y)
+	Mentalo.Blizzard[frameName] = CurrentPosition(self)
+end
+
+local BlizzardFrame_OnUpdate = function(self)
+	local frameName = self:GetName();
+	if(InCombatLockdown() or (self.IsMoving)) then return end
 	if(frameName == "QuestFrame") then
 		frameName = "GossipFrame"
 	end
-	Mentalo:SaveMovable(frameName)
+	local defaultPoint = Mentalo.Blizzard[frameName]
+	if(defaultPoint and (type(defaultPoint) == "string")) then
+		local anchor1, parent, anchor2, x, y = split("\031", defaultPoint)
+		self:ClearAllPoints()
+		self:SetPoint(anchor1, parent, anchor2, x, y)
+	end
 end

-local UIPanelsAdjusted = {};
-
-local MentaloDraggablesUpdate = function(self, event, ...)
+local DefaultDraggablesUpdate = function(self, event, ...)
 	if(InCombatLockdown()) then return end
 	for _, frameName in pairs(DraggableFrames) do
 		if((not self.Blizzard[frameName]) or (self.Blizzard[frameName] and (self.Blizzard[frameName] == "TBD"))) then
@@ -987,20 +1054,26 @@ function Mentalo:Initialize()
 		tinsert(DraggableFrames, "ObjectiveTrackerFrame")
 	end

-	MentaloDraggablesUpdate(self)
+	self:RegisterEvent("ADDON_LOADED")
+	self:RegisterEvent("LFG_UPDATE")
+	self:RegisterEvent("ROLE_POLL_BEGIN")
+	self:RegisterEvent("READY_CHECK")
+	self:RegisterEvent("UPDATE_WORLD_STATES")
+	self:RegisterEvent("WORLD_STATE_TIMER_START")
+	self:RegisterEvent("WORLD_STATE_UI_TIMER_UPDATE")

-	self:SetPositions()
+	if(SV.db.general.saveDraggable) then
+		self.DraggableUpdate = SavedDraggablesUpdate
+	else
+		self.DraggableUpdate = DefaultDraggablesUpdate
+	end

-	Mentalo:RegisterEvent("ADDON_LOADED")
-	Mentalo:RegisterEvent("LFG_UPDATE")
-	Mentalo:RegisterEvent("ROLE_POLL_BEGIN")
-	Mentalo:RegisterEvent("READY_CHECK")
-	Mentalo:RegisterEvent("UPDATE_WORLD_STATES")
-	Mentalo:RegisterEvent("WORLD_STATE_TIMER_START")
-	Mentalo:RegisterEvent("WORLD_STATE_UI_TIMER_UPDATE")
-	Mentalo:SetScript("OnEvent", MentaloDraggablesUpdate)
+	self:DraggableUpdate()
+
+	self:SetPositions()
+	self:SetScript("OnEvent", self.DraggableUpdate)

-	--PET JOURNAL TAINT FIX (STILL NEEDED?)
+	-- PET JOURNAL TAINT FIX (STILL NEEDED?)
 	-- local info = UIPanelWindows["PetJournalParent"];
 	-- for name, value in pairs(info) do
 	-- 	PetJournalParent:SetAttribute("UIPanelLayout-"..name, value);
diff --git a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua
index 6de51fd..720a445 100644
--- a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua
+++ b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua
@@ -223,7 +223,7 @@ SV.Options.args.common = {
 									desc = L["Automatically scale the User Interface based on your screen resolution"],
 									type = "toggle",
 									get = function(j)return SV.db.general.autoScale end,
-									set = function(j,value)SV.db.general.autoScale = value;SV:StaticPopup_Show("RL_CLIENT")end
+									set = function(j,value)SV.db.general.autoScale = value; SV:StaticPopup_Show("RL_CLIENT") end
 								},
 								multiMonitor = {
 									order = 2,
@@ -231,17 +231,25 @@ SV.Options.args.common = {
 									desc = L["Adjust UI dimensions to accomodate for multiple monitor setups"],
 									type = "toggle",
 									get = function(j)return SV.db.general.multiMonitor end,
-									set = function(j,value)SV.db.general.multiMonitor = value;SV:StaticPopup_Show("RL_CLIENT")end
+									set = function(j,value)SV.db.general.multiMonitor = value; SV:StaticPopup_Show("RL_CLIENT") end
 								},
-								LoginMessage = {
+								saveDraggable = {
 									order = 3,
+									name = L["Save Draggable"],
+									desc = L["Save the positions of draggable frames when they are moved. NOTE: THIS WILL OVERRIDE BLIZZARD FRAME SNAPPING!"],
+									type = "toggle",
+									get = function(j)return SV.db.general.saveDraggable end,
+									set = function(j,value)SV.db.general.saveDraggable = value; SV:StaticPopup_Show("RL_CLIENT") end
+								},
+								LoginMessage = {
+									order = 4,
 									type = 'toggle',
 									name = L['Login Message'],
 									get = function(j)return SV.db.general.loginmessage end,
 									set = function(j,value)SV.db.general.loginmessage = value end
 								},
 								scaleAdjust = {
-									order = 4,
+									order = 5,
 									name = L["Base Scale"],
 									desc = L["You can use this to adjust the base value applied to auto-scaling."],
 									type = "range",