Quantcast

Changes for tickets #1217, #1216, and #1206

urnati [12-18-18 - 03:22]
Changes for tickets #1217, #1216, and #1206
Filename
Titan/TitanConfig.lua
Titan/TitanMovable.lua
Titan/TitanUtils.lua
Titan/TitanVariables.lua
diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index cba44d3..875be5c 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -908,6 +908,23 @@ local optionsAuxBars = {
 			get = function() return TitanPanelGetVar("BagAdjust") end,
 			set = function() TitanPanelToggleVar("BagAdjust"); end,
 		},
+		confdesc4 = {
+			order = 400,
+			type = "header",
+			name = L["TITAN_PANEL_MAIN_MENU_BAR"],
+		},
+		mainMenuBarAdj = {
+			name = L["TITAN_PANEL_MAIN_MENU_BAR_ADJ"],
+			desc = L["TITAN_PANEL_MAIN_MENU_BAR_ADJ_DESC"],
+			order = 410, type = "range", width = "full",
+			min = -200, max = 200, step = 1,
+			get = function() return TitanPanelGetVar("MainMenuBarXAdj") end,
+			set = function(_, a)
+				TitanPanelSetVar("MainMenuBarXAdj", a);
+				-- Adjust frame positions
+				TitanPanel_AdjustFrames(TITAN_PANEL_PLACE_BOTH, true)
+			end,
+		},
 	}
 }
 -------------
diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua
index 871dc9c..70a9e41 100755
--- a/Titan/TitanMovable.lua
+++ b/Titan/TitanMovable.lua
@@ -268,7 +268,7 @@ OUT: top_bottom - Frame is at top or bottom, expecting Titan constant for top or
 --]]
 local function MoveFrame(frame_ptr, start_y, top_bottom, force)
 	local frame = _G[frame_ptr]
-	local adj = false
+
 	if frame and (frame:IsUserPlaced()
 			or frame.MALockPointHook  -- Allow MoveAnything to be used w/o error
 		)
@@ -278,9 +278,22 @@ local function MoveFrame(frame_ptr, start_y, top_bottom, force)
 		if DoAdjust(top_bottom, force) and frame:IsShown() then
 			local y = TitanMovable_GetPanelYOffset(top_bottom) + (start_y or 0) -- includes scale adjustment
 			local point, relativeTo, relativePoint, xOfs, yOfs = frame:GetPoint()
-			frame:ClearAllPoints();
-			frame:SetPoint(point, relativeTo:GetName(), relativePoint, xOfs, y)
-			adj = true
+			-- check for nil which will cause an error
+			if point and relativeTo and relativePoint and xOfs then -- do not care about yOfs
+				-- should be safe...
+				frame:ClearAllPoints();
+				frame:SetPoint(point, relativeTo:GetName(), relativePoint, xOfs, y)
+			else
+				-- do not proceed
+--[[
+				TitanDebug ("MoveFrame nil :"
+					.."point:"..tostring(point)
+					.."relativeTo:"..tostring(relativeTo)
+					.."relativePoint:"..tostring(relativePoint)
+					.."xOfs:"..tostring(xOfs)
+					)
+--]]
+			end
 		else
 			--[[
 			Some frames such as the ticket frame may not be visible or even created
@@ -289,6 +302,7 @@ 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 work. This is modeled after MoveFrame to keep it similar.
@@ -312,6 +326,9 @@ local function MoveMenuFrame(frame_ptr, start_y, top_bottom, force)
 		elseif ( StatusTrackingBarManager:GetNumberVisibleBars() == 1 ) then
 			yOffset = yOffset + 14;
 		end
+		xOfs = TitanPanelGetVar("MainMenuBarXAdj")
+
+--[[
 		-- 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"))
@@ -322,6 +339,7 @@ local function MoveMenuFrame(frame_ptr, start_y, top_bottom, force)
 			-- Slide the menu bar left depending on scaling to allow bag menu room
 			xOfs = xadj * 6 * -1
 		end
+--]]
 --		frame:ClearAllPoints();
 --		frame:SetPoint("BOTTOM", "UIParent", "BOTTOM", xOfs, yOffset);
 		SetPosition(frame, "BOTTOM", "UIParent", "BOTTOM", xOfs, yOffset)
diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua
index 06c7085..609ddac 100644
--- a/Titan/TitanUtils.lua
+++ b/Titan/TitanUtils.lua
@@ -1892,7 +1892,9 @@ function TitanDebug(debug_message, debug_type)
 		..dtype
 		..TitanUtils_GetGreenText(debug_message)

-	_G["DEFAULT_CHAT_FRAME"]:AddMessage(msg)
+	if TitanAllGetVar("Silenced") then
+		_G["DEFAULT_CHAT_FRAME"]:AddMessage(msg)
+	end
 --	Debug_array(msg)
 	--date("%m/%d/%y %H:%M:%S")
 end
diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua
index 7d507bc..f376c04 100644
--- a/Titan/TitanVariables.lua
+++ b/Titan/TitanVariables.lua
@@ -276,6 +276,7 @@ TITAN_PANEL_SAVED_VARIABLES = {
 	AuxBar2_Hide = false,
 	AuxBar2_Transparency = 0.7,
 	AuxBar2_Align = TITAN_PANEL_BUTTONS_ALIGN_LEFT,
+	MainMenuBarXAdj = 0,
 };

 --[[ Titan