Quantcast

Check for ElvUI or Bartender4; if present the 'back off' addusting frames they could control. Fixes an issue found in Curse comments where the zone ability would go to the 'middle of the screen'.

urnati [05-18-19 - 15:10]
Check for ElvUI or Bartender4; if present the 'back off' addusting frames they could control. Fixes an issue found in Curse comments where the zone ability would go to the 'middle of the screen'.
Filename
Titan/TitanMovable.lua
diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua
index 8112f6a..2259082 100755
--- a/Titan/TitanMovable.lua
+++ b/Titan/TitanMovable.lua
@@ -14,6 +14,7 @@ The user can turn turn on / off the adjusting of all top frames or all bottom fr
 -- Locals
 local _G = getfenv(0);
 local InCombatLockdown = _G.InCombatLockdown;
+local hooks_done = false;

 local move_count = 0
 --[[ Titan
@@ -263,6 +264,44 @@ local function SetPosition(frame, ...)
 end

 --[[ local
+NAME: CheckConflicts
+DESC: Check for other addons that control UI elements. Tell Titan to back off the frames the addon controls or can control.
+VAR: <none>
+NOTE:
+This is messy routine because the internals of each addon must be known to check for the frames that are controlled.
+Some addons use different names where Titan uses the Blizzard frame names
+:NOTE
+--]]
+local function CheckConflicts()
+	local addon = "Bartender4"
+	if (IsAddOnLoaded(addon)) then -- user has enabled
+		TitanDebug (addon.." active : Titan will not adjust frames that "..addon.." could control")
+		-- Check would be : BT4Bar<BT bar name>.config.enabled to check if the frame exists and if it is enabled in BT4
+		TitanMovable_AddonAdjust("MainMenuBar", true)
+		TitanMovable_AddonAdjust("MicroButtonAndBagsBar", true)
+		TitanMovable_AddonAdjust("MultiBarRight", true)
+		TitanMovable_AddonAdjust("ExtraActionBarFrame", true)
+		TitanMovable_AddonAdjust("OverrideActionBar", true) -- not sure about this one...
+    end
+	addon = "ElvUI"
+	if (IsAddOnLoaded(addon)) then -- user has enabled
+		TitanDebug (addon.." active : Titan will not adjust frames that "..addon.." could control")
+		-- ElvUI controls the whole UI
+		TitanMovable_AddonAdjust("PlayerFrame", true)
+		TitanMovable_AddonAdjust("TargetFrame", true)
+		TitanMovable_AddonAdjust("PartyMemberFrame1", true)
+		TitanMovable_AddonAdjust("TicketStatusFrame", true)
+		TitanMovable_AddonAdjust("BuffFrame", true)
+		TitanMovable_AddonAdjust("MinimapCluster", true)
+		TitanMovable_AddonAdjust("MultiBarRight", true)
+		TitanMovable_AddonAdjust("OverrideActionBar", true)
+		TitanMovable_AddonAdjust("MicroButtonAndBagsBar", true)
+		TitanMovable_AddonAdjust("MainMenuBar", true)
+		TitanMovable_AddonAdjust("ExtraActionBarFrame", true)
+    end
+end
+
+--[[ local
 NAME: MoveFrame
 DESC: Adjust the given frame. Expected are frames where :GetPoint works
 VAR: frame_ptr - Text string of the frame name
@@ -326,7 +365,6 @@ local function MoveFrame(frame_ptr, start_y, top_bottom, force)
 	end
 end

-xx_xOfs = 0
 --[[ local
 NAME: MoveMenuFrame
 DESC: Adjust the MainMenuBar frame. Needed because :GetPoint does NOT always work for MainMenuBar.
@@ -586,7 +624,7 @@ TitanDebug ("MData ExtraActionBarFrame :"
 		addonAdj = false, },
 --]]
 }
-
+xxyydata = MData
 --[[ Titan
 NAME: TitanMovable_AdjustTimer
 DESC: Cancel then add the given timer. The timer must be in TitanTimers.
@@ -630,6 +668,7 @@ OUT: None
 --]]
 local function TitanMovableFrame_MoveFrames(force)
 	local move_count = 0 -- debug
+	local str = "" -- debug
 	--[[
 	Setting the MainMenuBar as user placed is needed because in 8.0.0 Blizzard changed something in the
 	way they controlled the frame. With Titan panel and bottom bars enabled the MainMenuBar
@@ -648,8 +687,10 @@ local function TitanMovableFrame_MoveFrames(force)
 		for i = 1,#MData,1 do
 			if MData[i] then
 				if MData[i].addonAdj then
+if i == 11 then str = "addonAdj = T" end
 					-- An addon has taken control of the frame so skip
 				else
+if i == 11 then str = "addonAdj = F" end
 					-- Adjust the frame per MData
 					MData[i].move(force)
 --[[
@@ -667,8 +708,9 @@ local function TitanMovableFrame_MoveFrames(force)
 		end
 --[
 --]]
-		Titan_FCF_UpdateDockPosition(); -- chat
-		UpdateContainerFrameAnchors(); -- Move bags as needed
+if str ~= "" then TitanDebug (str) end
+--		Titan_FCF_UpdateDockPosition(); -- chat
+--		UpdateContainerFrameAnchors(); -- Move bags as needed
 	else
 		-- nothing to do
 	end
@@ -698,7 +740,9 @@ function TitanPanel_AdjustFrames(force)
 	local f = force or false -- do not require the parameter

 	-- Adjust frame positions top and bottom based on user choices
-	TitanMovableFrame_MoveFrames(f)
+	if hooks_done then
+		TitanMovableFrame_MoveFrames(f)
+	end
 end

 --[[ Titan
@@ -771,6 +815,11 @@ function TitanMovable_SecureFrames()
 		TitanPanelAce:SecureHook("VideoOptionsFrameOkay_OnClick", Titan_AdjustUIScale) -- VideoOptionsFrame.lua
 		TitanPanelAce:SecureHook(VideoOptionsFrame, "Hide", Titan_AdjustUIScale) -- VideoOptionsFrame.xml
 	end
+
+	-- Check for other addons that control UI frames. Tell Titan to back off of the frames these addons could control
+	CheckConflicts()
+
+	hooks_done = true
 end
 function TitanMovable_Unhook_SecureFrames()
 --[[