Quantcast

- TitanMovable

urnati [09-29-18 - 03:59]
- TitanMovable
* Updated to MoveAnything to adjust Main Menu Bar
* Changed spacing of right hand vertical menu bars
* Adjusted main menu bar with scaling
Filename
Titan/TitanMovable.lua
diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua
index bd89eb6..cdeb08c 100755
--- a/Titan/TitanMovable.lua
+++ b/Titan/TitanMovable.lua
@@ -152,7 +152,10 @@ OUT: top_bottom - Frame is at top or bottom, expecting Titan constant for top or
 --]]
 local function MoveFrame(frame_ptr, start_y, top_bottom)
 	local frame = _G[frame_ptr]
-	if frame and frame:IsUserPlaced() then
+	if frame and (frame:IsUserPlaced()
+			or frame.MALockPointHook  -- Allow MoveAnything to be used w/o error
+		)
+	then
 		-- skip this frame
 	else
 		if frame:IsShown() then
@@ -187,7 +190,19 @@ local function MoveMenuFrame(frame_ptr, start_y, top_bottom)
 			yOffset = yOffset + 14;
 		end
 		frame:ClearAllPoints();
-		frame:SetPoint("BOTTOM", "UIParent", "BOTTOM", xOffset, yOffset);
+		-- This is a hack because GetPoint on MainMenuBar often returns all nil
+		-- If the scale is is around .85 or higher the bag menu overlaps the main menu
+		local fscale = tonumber(GetCVar("uiScale"))
+		local xadj = (fscale * 100) - 85
+		if xadj <= 0 then
+			xOfs = 0
+		else
+			-- Slide the menu bar left depending on scaling to allow bag menu room
+			xOfs = xadj * 6 * -1
+		end
+		frame:SetPoint("BOTTOM", "UIParent", "BOTTOM", xOfs, yOffset);
+	else
+		-- Unknown frame...
 	end
 end

@@ -348,7 +363,8 @@ local MData = {
 		addonAdj = false, },
 	[7] = {frameName = "MultiBarRight",
 		move = function ()
-				-- account for Reputation Status Bar (doh)
+			local yOffset = 0
+--[[
 			local yOffset = 98
 			local playerlevel = UnitLevel("player");
 			if ReputationWatchStatusBar
@@ -356,6 +372,7 @@ local MData = {
 			and playerlevel < _G["MAX_PLAYER_LEVEL"] then
 				yOffset = yOffset + 8;
 			end
+--]]
 			MoveFrame("MultiBarRight", yOffset, TITAN_PANEL_PLACE_BOTTOM) end,
 		addonAdj = false, },
 	[8] = {frameName = "OverrideActionBar",
@@ -364,7 +381,7 @@ local MData = {
 	[9] = {frameName = "MicroButtonAndBagsBar",
 		move = function () MoveFrame("MicroButtonAndBagsBar", 0, TITAN_PANEL_PLACE_BOTTOM) end,
 		addonAdj = false, },
-	[10] = {frameName = "MainMenuBar",
+	[10] = {frameName = "MainMenuBar", -- MainMenuBar
 		move = function ()
 			MoveMenuFrame("MainMenuBar", 0, TITAN_PANEL_PLACE_BOTTOM) end,
 		addonAdj = false, },
@@ -413,6 +430,7 @@ Then update the chat and open bag frames.
 OUT: None
 --]]
 local function TitanMovableFrame_MoveFrames()
+	local move_count = 0
 	if not InCombatLockdown() then
 		for i = 1,#MData,1 do
 			if MData[i] then
@@ -420,15 +438,18 @@ local function TitanMovableFrame_MoveFrames()
 					-- An addon has taken control of the frame so skip
 				else
 					-- Adjust the frame per MData
-					MData[i].move()
+					local ok, msg = pcall(function () MData[i].move() end)
+					if ok then
+						-- all is well
+					else
+						TitanPrint("Cannot Move"
+							.." '"..(MData[i].frameName or "?").."."
+							.." "..msg, "error")
+					end
 				end
 			end
 		end
---[[
-move_count = move_count + 1
-TitanPrint("Move "
-.." "..move_count
-)
+--[
 --]]
 		Titan_FCF_UpdateDockPosition(); -- chat
 		UpdateContainerFrameAnchors(); -- Move bags as needed