diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua index 08cb120..080fc50 100755 --- a/Titan/TitanMovable.lua +++ b/Titan/TitanMovable.lua @@ -2,11 +2,10 @@ NAME: TitanMovable.lua DESC: Contains the routines to adjust the Blizzard frames to make room for the Titan bars the user has selected. There are a select set of Blizzard frames at the top of screen and at the bottom of the screen that Titan will move. -Each frame adjusted has an entry in TitanMovableData. TitanMovableData is local and not directly accessible via addons. +Each frame adjusted has an entry in MData which is local and not directly accessible via addons. However addons can tell Titan to not adjust some or all frames using TitanUtils_AddonAdjust(frame, bool). Addons that replace all or parts of the Blizzard UI use this. The user can turn turn on / off the adjusting of all top frames or all bottom frames. -In addition the user can select to turn off / on adjusting of select top frames (minimap or ticket frame) or select bottom frames (chat / log or bags) :DESC --]] -- Globals @@ -15,6 +14,7 @@ In addition the user can select to turn off / on adjusting of select top frames local _G = getfenv(0); local InCombatLockdown = _G.InCombatLockdown; +local move_count = 0 --[[ Titan Declare the Ace routines local AceTimer = LibStub("AceTimer-3.0") @@ -49,96 +49,6 @@ hooksecurefunc(FrameRef, "SetPoint", function(self) end) --]] ---[[ Titan -TitanMovable is a local table that is cleared then filled with the frames Titan needs to check and adjust, if necessary, with each 'adjust frame' check. ---]] -local TitanMovable = {}; ---[[ Titan -NAME: TitanMovableData table -DESC: TitanMovableData is a local table that holds each frame Titan may need to adjust. It also has the anchor points and offsets needed to make room for the Titan bar(s) - -The index is the frame name. Each record contains: -frameName - frame name (string) to adjust -frameArchor - the frame anchor point -xArchor - anchor relative to the frameName -y - any additional adjustment in the y axis -position - top or bottom -addonAdj - true if another addon is taking responsibility of adjusting this frame, if false Titan will use the user setttings to adjust or not -:DESC ---]] -local TitanMovableData = { - PlayerFrame = {frameName = "PlayerFrame", frameArchor = "TOPLEFT", xArchor = "LEFT", y = -4, - position = TITAN_PANEL_PLACE_TOP, addonAdj = false}, - TargetFrame = {frameName = "TargetFrame", frameArchor = "TOPLEFT", xArchor = "LEFT", y = -4, - position = TITAN_PANEL_PLACE_TOP, addonAdj = false}, - PartyMemberFrame1 = {frameName = "PartyMemberFrame1", frameArchor = "TOPLEFT", xArchor = "LEFT", y = -128, - position = TITAN_PANEL_PLACE_TOP, addonAdj = false}, - TicketStatusFrame = {frameName = "TicketStatusFrame", frameArchor = "TOPRIGHT", xArchor = "RIGHT", y = 0, - position = TITAN_PANEL_PLACE_TOP, addonAdj = false}, - BuffFrame = {frameName = "BuffFrame", frameArchor = "TOPRIGHT", xArchor = "RIGHT", y = -13, - position = TITAN_PANEL_PLACE_TOP, addonAdj = false}, - MinimapCluster = {frameName = "MinimapCluster", frameArchor = "TOPRIGHT", xArchor = "RIGHT", y = 0, - position = TITAN_PANEL_PLACE_TOP, addonAdj = false}, - MainMenuBar = {frameName = "MainMenuBar", frameArchor = "BOTTOM", xArchor = "CENTER", y = 0, - position = TITAN_PANEL_PLACE_BOTTOM, addonAdj = false}, - MultiBarRight = {frameName = "MultiBarRight", frameArchor = "BOTTOMRIGHT", xArchor = "RIGHT", y = 98, - position = TITAN_PANEL_PLACE_BOTTOM, addonAdj = false}, - OverrideActionBar = {frameName = "OverrideActionBar", frameArchor = "BOTTOM", xArchor = "CENTER", y = 0, - position = TITAN_PANEL_PLACE_BOTTOM, addonAdj = false}, - MicroButtonAndBagsBar = {frameName = "MicroButtonAndBagsBar", frameArchor = "BOTTOMRIGHT", xArchor = "RIGHT", y = 0, - position = TITAN_PANEL_PLACE_BOTTOM, addonAdj = false}, -} - ---[[ local -NAME: TitanMovableFrame_CheckThisFrame -DESC: Add the given frame to the list so it will be checked. Once 'full' the table will be looped through to see if the frame must be moved or not. -VAR: frameName - frame to check -OUT: None -NOTE: -- The frame is added to TitanMovable. -:NOTE ---]] -local function TitanMovableFrame_CheckThisFrame(frameName) - -- For safety check if the frame is in the table to adjust - if TitanMovableData[frameName] then - table.insert(TitanMovable, frameName) - end -end - ---[[ Titan -NAME: TitanMovable_AdjustTimer -DESC: Cancel then add the given timer. The timer must be in TitanTimers. -VAR: ttype - The timer type (string) as defined in TitanTimers -OUT: None ---]] -function TitanMovable_AdjustTimer(ttype) - local timer = TitanTimers[ttype] - if timer then - TitanPanelAce.CancelAllTimers(timer.obj) - TitanPanelAce.ScheduleTimer(timer.obj, timer.callback, timer.delay) - end -end - ---[[ Titan -NAME: TitanMovable_AddonAdjust -DESC: Set the given frame to be adjusted or not by another addon. This is called from TitanUtils for a developer API. -VAR: frame - frame name (string) -VAR: bool - true (addon will adjust) or false (Titan will use its settings) -OUT: None ---]] -function TitanMovable_AddonAdjust(frame, bool) - for index, value in pairs(TitanMovableData) do - frameData = value - if frameData then - frameName = frameData.frameName; - end - - if (frame == frameName) then - frameData.addonAdj = bool - end - end -end - --[[ API NAME: TitanMovable_GetPanelYOffset DESC: Get the Y axis offset Titan needs (1 or 2 bars) at the given position - top or bottom. @@ -149,11 +59,24 @@ NOTE: :NOTE --]] function TitanMovable_GetPanelYOffset(framePosition) -- used by other addons +-- TitanPanelTopAnchor, TitanPanelBottomAnchor + + -- Both top & bottom are figured out but only the - -- requested postion is returned - local barnum_top = 0; + -- requested position is returned +--[[ + local barnum_top = TitanPanelTopAnchor:GetBottom() + local barnum_bot = TitanPanelBottomAnchor:GetTop() + + if framePosition == TITAN_PANEL_PLACE_TOP then + return -barnum_top + elseif framePosition == TITAN_PANEL_PLACE_BOTTOM then + return barnum_bot - 1; + -- no idea why -1 is needed... seems anchoring to bottom is off a pixel + end +--]] + local barnum_top = 0 local barnum_bot = 0 - -- If user has the top adjust set then determine the -- top offset if not TitanPanelGetVar("ScreenAdjust") then @@ -174,7 +97,6 @@ function TitanMovable_GetPanelYOffset(framePosition) -- used by other addons barnum_bot = 2 end end - local scale = TitanPanelGetVar("Scale") -- return the requested offset -- 0 will be returned if the user has not bars showing @@ -221,173 +143,55 @@ local function TitanMovableFrame_GetXOffset(frame, point) return ret end ---[[ Titan -NAME: TitanMovableFrame_CheckFrames -DESC: Determine the frames that may need to be moved at the given position. -VAR: position - TITAN_PANEL_PLACE_TOP / TITAN_PANEL_PLACE_BOTTOM / TITAN_PANEL_PLACE_BOTH -OUT: None +--[[ local +NAME: MoveFrame +DESC: Adjust the given frame. Expected are frames where :GetPoint works +VAR: frame_ptr - Text string of the frame name +VAR: start_y - Any offset due to the specific frame +OUT: top_bottom - Frame is at top or bottom, expecting Titan constant for top or bottom --]] -function TitanMovableFrame_CheckFrames(position) - -- reset the frames to move - TitanMovable = {}; - - -- check top as requested - if (position == TITAN_PANEL_PLACE_TOP) - or position == TITAN_PANEL_PLACE_BOTH then - -- Move PlayerFrame - TitanMovableFrame_CheckThisFrame(PlayerFrame:GetName()) - - -- Move TargetFrame - TitanMovableFrame_CheckThisFrame(TargetFrame:GetName()) - - -- Move PartyMemberFrame - TitanMovableFrame_CheckThisFrame(PartyMemberFrame1:GetName()) - - -- Move TicketStatusFrame - if TitanPanelGetVar("TicketAdjust") then - TitanMovableFrame_CheckThisFrame(TicketStatusFrame:GetName()) - end - - -- Move MinimapCluster - if not CleanMinimap then - if not TitanPanelGetVar("MinimapAdjust") then - TitanMovableFrame_CheckThisFrame(MinimapCluster:GetName()) - end +local function MoveFrame(frame_ptr, start_y, top_bottom) + local frame = _G[frame_ptr] + if frame and frame:IsUserPlaced() then + -- skip this frame + else + if 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) + else + --[[ + Some frames such as the ticket frame may not be visible or even created + --]] end - -- Move BuffFrame - TitanMovableFrame_CheckThisFrame(BuffFrame:GetName()) - - -- Move UIWidgetTopCenterContainerFrame - TitanMovableFrame_CheckThisFrame(UIWidgetTopCenterContainerFrame:GetName()); - ---[[ -- Move OrderHallCommandBar - if OrderHallCommandBar then - TitanMovableFrame_CheckThisFrame(OrderHallCommandBar:GetName()); - end]]-- - end - - -- check bottom as requested - if (position == TITAN_PANEL_PLACE_BOTTOM) - or position == TITAN_PANEL_PLACE_BOTH then - - -- Move MainMenuBar - TitanMovableFrame_CheckThisFrame(MainMenuBar:GetName()); - - -- Move OverrideActionBar - TitanMovableFrame_CheckThisFrame(OverrideActionBar:GetName()); - - -- Move MicroButtonAndBagsBar - TitanMovableFrame_CheckThisFrame(MicroButtonAndBagsBar:GetName()); end end ---[[ Titan -NAME: TitanMovableFrame_MoveFrames -DESC: Actually adjust the frames at the given position. -VAR: position - TITAN_PANEL_PLACE_TOP / TITAN_PANEL_PLACE_BOTTOM / TITAN_PANEL_PLACE_BOTH -OUT: None +--[[ local +NAME: MoveMenuFrame +DESC: Adjust the MainMenuBar frame. Needed because :GetPoint does NOT work. This is modeled after MoveFrame to keep it similar. +Titan sets the IsUserPlaced for the MainMenuBar frame so Titan needs to adjust. +VAR: frame_ptr - Text string of the frame name +VAR: start_y - Any offset due to the specific frame +OUT: top_bottom - Frame is at top or bottom, expecting Titan constant for top or bottom --]] -function TitanMovableFrame_MoveFrames(position) - -- Once the frames to check have been collected, - -- move them as needed. - local frameData, frame, frameName, frameArchor, xArchor, y, xOffset, yOffset, panelYOffset; - - -- Collect the frames we need to move - TitanMovableFrame_CheckFrames(position); - - -- move them... - if not InCombatLockdown() then - local adj_frame = true - for index, value in pairs(TitanMovable) do - adj_frame = true -- assume the frame is to be adjusted - frameData = TitanMovableData[value]; - if frameData then - frame = _G[frameData.frameName]; - frameName = frameData.frameName; - frameArchor = frameData.frameArchor; - end - - if (frame and (frame:IsUserPlaced()) and frameName ~= "MainMenuBar") - then - -- The user has positioned the frame - adj_frame = false - end - if frameData.addonAdj then - -- An addon has taken control of the frame - adj_frame = false - end - - if adj_frame then - xArchor = frameData.xArchor; - y = frameData.y; - - panelYOffset = TitanMovable_GetPanelYOffset(frameData.position); - xOffset = TitanMovableFrame_GetXOffset(frame, xArchor); - - -- properly adjust buff frame(s) if GM Ticket is visible - - -- Use IsShown rather than IsVisible. In some cases (after closing - -- full screen map) the ticket may not yet be visible. - if (frameName == "BuffFrame") - and TicketStatusFrame:IsShown() - and TitanPanelGetVar("TicketAdjust") then - yOffset = (-TicketStatusFrame:GetHeight()) - + panelYOffset - else - yOffset = y + panelYOffset; - end - - -- properly adjust MinimapCluster if its border is hidden - if frameName == "MinimapCluster" - and MinimapBorderTop - and not MinimapBorderTop:IsShown() then - yOffset = yOffset + (MinimapBorderTop:GetHeight() * 3/5) - 5 - end - - -- adjust the MainMenuBar according to its scale - if frameName == "MainMenuBar" and MainMenuBar:IsVisible() then - local framescale = MainMenuBar:GetScale() or 1; - yOffset = yOffset / framescale; - if ( StatusTrackingBarManager:GetNumberVisibleBars() == 2 ) then - yOffset = yOffset + 17; - elseif ( StatusTrackingBarManager:GetNumberVisibleBars() == 1 ) then - yOffset = yOffset + 14; - end - end - - -- account for Reputation Status Bar (doh) - local playerlevel = UnitLevel("player"); - if frameName == "MultiBarRight" - and ReputationWatchStatusBar:IsVisible() - and playerlevel < _G["MAX_PLAYER_LEVEL"] then - yOffset = yOffset + 8; - end - - frame:ClearAllPoints(); - frame:SetPoint(frameArchor, "UIParent", frameArchor, - xOffset, yOffset); - else - --Leave frame where it is as it has been moved by a user - end - -- Move bags as needed - UpdateContainerFrameAnchors(); +local function MoveMenuFrame(frame_ptr, start_y, top_bottom) + local frame = _G[frame_ptr] + if frame then + local yOffset = TitanMovable_GetPanelYOffset(top_bottom) -- includes scale adjustment + xOffset = TitanMovableFrame_GetXOffset(frame, top_bottom); + if ( StatusTrackingBarManager:GetNumberVisibleBars() == 2 ) then + yOffset = yOffset + 17; + elseif ( StatusTrackingBarManager:GetNumberVisibleBars() == 1 ) then + yOffset = yOffset + 14; end - else - -- nothing to do + frame:ClearAllPoints(); + frame:SetPoint("BOTTOM", "UIParent", "BOTTOM", xOffset, yOffset); end end --[[ Titan -NAME: TitanAdjustBottomFrames -DESC: Adjust the frames at TITAN_PANEL_PLACE_BOTTOM. -VAR: None -OUT: None ---]] -function TitanAdjustBottomFrames() - TitanPanel_AdjustFrames(TITAN_PANEL_PLACE_BOTTOM, true) -end - ---[[ Titan NAME: Titan_FCF_UpdateDockPosition DESC: Secure post hook to help adjust the chat / log frame. VAR: None @@ -492,77 +296,168 @@ local function Titan_ContainerFrames_Relocate() end end ---[[ Titan -NAME: TitanMovableFrame_AdjustBlizzardFrames -DESC: Calls the helper routines to adjust the chat / log frame and bag frames. -VAR: None -OUT: None +--[[ local +NAME: MData table +DESC: MData is a local table that holds each frame Titan may need to adjust. It controls the offsets needed to make room for the Titan bar(s). +Each frame can be adjusted by modifying its 'move' function. +The index is the frame name. Each record contains: +frameName - frame name (string) to adjust +addonAdj - true if another addon is taking responsibility of adjusting this frame, if false Titan will use the user settings to adjust or not +:DESC NOTE: -- This is required because Blizz (or addons) could adjust the chat frame outside the events that Titan registers for. -- If in combat or if the user has moved the chat frame then no action is taken. -- The frame is adjusted in the Y axis only. +- Of course Blizzard had to make the MainMenuBar act differently <sigh>. :GetPoint() does not work on it so a special helper routine was needed. :NOTE --]] -local function TitanMovableFrame_AdjustBlizzardFrames() - if not InCombatLockdown() then - Titan_FCF_UpdateDockPosition(); - Titan_ContainerFrames_Relocate(); +local MData = { + [1] = {frameName = "PlayerFrame", + move = function () MoveFrame("PlayerFrame", 0, TITAN_PANEL_PLACE_TOP) end, + addonAdj = false, }, + [2] = {frameName = "TargetFrame", + move = function () MoveFrame("TargetFrame", 0, TITAN_PANEL_PLACE_TOP) end, + addonAdj = false, }, + [3] = {frameName = "PartyMemberFrame1", + move = function () MoveFrame("PartyMemberFrame1", -128, TITAN_PANEL_PLACE_TOP) end, + addonAdj = false, }, + [4] = {frameName = "TicketStatusFrame", + move = function () MoveFrame("TicketStatusFrame", 0, TITAN_PANEL_PLACE_TOP) end, + addonAdj = false, }, + [5] = {frameName = "BuffFrame", + move = function () + -- properly adjust buff frame(s) if GM Ticket is visible + + -- Use IsShown rather than IsVisible. In some cases (after closing + -- full screen map) the ticket may not yet be visible. + local yOffset = 0 + if TicketStatusFrame:IsShown() + and TitanPanelGetVar("TicketAdjust") + then + yOffset = (-TicketStatusFrame:GetHeight()) + else + yOffset = -13 + end + MoveFrame("BuffFrame", yOffset, TITAN_PANEL_PLACE_TOP) end, + addonAdj = false, }, + [6] = {frameName = "MinimapCluster", + move = function () + local yOffset = 0 + if MinimapBorderTop + and not MinimapBorderTop:IsShown() then + yOffset = yOffset + (MinimapBorderTop:GetHeight() * 3/5) - 5 + end + MoveFrame("MinimapCluster", yOffset, TITAN_PANEL_PLACE_TOP) end, + addonAdj = false, }, + [7] = {frameName = "MultiBarRight", + move = function () + -- account for Reputation Status Bar (doh) + local yOffset = 98 + local playerlevel = UnitLevel("player"); + if ReputationWatchStatusBar + and ReputationWatchStatusBar:IsVisible() + and playerlevel < _G["MAX_PLAYER_LEVEL"] then + yOffset = yOffset + 8; + end + MoveFrame("MultiBarRight", yOffset, TITAN_PANEL_PLACE_BOTTOM) end, + addonAdj = false, }, + [8] = {frameName = "OverrideActionBar", + move = function () MoveFrame("OverrideActionBar", 0, TITAN_PANEL_PLACE_BOTTOM) end, + addonAdj = false, }, + [9] = {frameName = "MicroButtonAndBagsBar", + move = function () MoveFrame("MicroButtonAndBagsBar", 0, TITAN_PANEL_PLACE_BOTTOM) end, + addonAdj = false, }, + [10] = {frameName = "MainMenuBar", + move = function () + MoveMenuFrame("MainMenuBar", 0, TITAN_PANEL_PLACE_BOTTOM) end, + addonAdj = false, }, +--]] +} + +--[[ Titan +NAME: TitanMovable_AdjustTimer +DESC: Cancel then add the given timer. The timer must be in TitanTimers. +VAR: ttype - The timer type (string) as defined in TitanTimers +OUT: None +--]] +function TitanMovable_AdjustTimer(ttype) + local timer = TitanTimers[ttype] + if timer then + TitanPanelAce.CancelAllTimers(timer.obj) + TitanPanelAce.ScheduleTimer(timer.obj, timer.callback, timer.delay) end end --[[ Titan -NAME: Titan_AdjustUIScale -DESC: Adjust the scale of Titan bars and plugins to the user selected scaling. This is called by the secure post hooks to the 'Video Options Frame'. -VAR: None +NAME: TitanMovable_AddonAdjust +DESC: Set the given frame to be adjusted or not by another addon. This is called from TitanUtils for a developer API. +VAR: frame - frame name (string) +VAR: bool - true (addon will adjust) or false (Titan will use its settings) OUT: None --]] -local function Titan_AdjustUIScale() - Titan_AdjustScale() +function TitanMovable_AddonAdjust(frame, bool) + for i = 1,#MData,1 do + local fData = MData[i] + local fName = nil + if fData then + fName = fData.frameName; + end + + if (frame == fName) then + fData.addonAdj = bool + end + end end ---[[ Titan -NAME: Titan_Hook_Adjust_Both -DESC: Adjust top and bottom frames. This is called by the secure post hooks. +--[[ local +NAME: TitanMovableFrame_MoveFrames +DESC: Loop through MData calling each frame's 'move' function for each Titan controlled frame. +Then update the chat and open bag frames. +OUT: None +--]] +local function TitanMovableFrame_MoveFrames() + if not InCombatLockdown() then + for i = 1,#MData,1 do + if MData[i] then + if MData[i].addonAdj then + -- An addon has taken control of the frame so skip + else + -- Adjust the frame per MData + MData[i].move() + end + end + end +--[[ +move_count = move_count + 1 +TitanPrint("Move " +.." "..move_count +) +--]] + Titan_FCF_UpdateDockPosition(); -- chat + UpdateContainerFrameAnchors(); -- Move bags as needed + else + -- nothing to do + end +end + +--[[ local +NAME: Titan_AdjustUIScale +DESC: Adjust the scale of Titan bars and plugins to the user selected scaling. This is called by the secure post hooks to the 'Video Options Frame'. VAR: None OUT: None -NOTE: -- Starts a timer () which is a callback to Titan_ManageFramesNew. -- These could arrive quickly. To prevent many adjusts from stacking, cancel any pending then queue this one. -:NOTE --]] -local function Titan_Hook_Adjust_Both() - TitanMovable_AdjustTimer("Adjust") +local function Titan_AdjustUIScale() + Titan_AdjustScale() end --[[ Titan NAME: TitanPanel_AdjustFrames -DESC: Adjust the frames at the given position. -VAR: position - TITAN_PANEL_PLACE_TOP / TITAN_PANEL_PLACE_BOTTOM / TITAN_PANEL_PLACE_BOTH -VAR: blizz - true or false +DESC: Adjust the frames for the Titan visible bars. +This is a shell for the actual Movable routine by other Titan routines and used by hooks OUT: None NOTE: -- if blizz is true then the post hook code for chat / log frame and the bag frames is run :NOTE --]] -function TitanPanel_AdjustFrames(position, blizz) - -- Adjust frame positions top only, bottom only, or both - TitanMovableFrame_MoveFrames(position) - - -- move the Blizzard frames if requested - if blizz and position == (TITAN_PANEL_PLACE_BOTTOM or TITAN_PANEL_PLACE_TOP) then - TitanMovableFrame_AdjustBlizzardFrames() - end -end - ---[[ Titan -NAME: Titan_ManageFramesNew -DESC: Adjust the frames at TITAN_PANEL_PLACE_BOTH. -VAR: None -OUT: None ---]] -function Titan_ManageFramesNew() - TitanPanel_AdjustFrames(TITAN_PANEL_PLACE_BOTH, false) - return +function TitanPanel_AdjustFrames() + -- Adjust frame positions top and bottom + TitanMovableFrame_MoveFrames() end --[[ Titan @@ -592,138 +487,6 @@ function Titan_AdjustScale() end end -function Titan_ManageFramesTest1() - if Titan__InitializedPEW then - -- We know the desired bars are now drawn so we can adjust - if InCombatLockdown() then - -- nothing - else ---TitanDebug ("Titan_ManageFramesTest1 ") - left = floor(OverrideActionBar:GetLeft() + 0.5) - left = GetScreenWidth() / 2 - bot = floor(OverrideActionBar:GetBottom() + 0.5) -TitanDebug("... OverrideActionBar " -..(bot or "?").." " -..(left or "?").." " -) - point, relFrame, relPoint, xOff, yOff = OverrideActionBar:GetPoint(OverrideActionBar:GetNumPoints()) - OverrideActionBar:ClearAllPoints() - OverrideActionBar:SetPoint("BOTTOM", TitanPanelBottomAnchor, "TOP", left, 0) - OverrideActionBar:SetPoint(point, relFrame, relPoint, xOff, TitanPanelBottomAnchor:GetTop()+0) - left = OverrideActionBar:GetCenter() - bot = OverrideActionBar:GetBottom() -TitanDebug("... OverrideActionBar " -..(bot or "?").." " -..(left or "?").." " -) - - end - end --- There is a chance the person stays in combat so this could --- keep looping... -end - -function Titan_GetFrameOrigPositions() - local orig = {} - local frameData - local point, relTo, relPoint, xOff, yOff = "", {}, "", 0, 0 - local relFrame = "" - for index, value in pairs(TitanMovableData) do - frameData = TitanMovableData[index]; - if frameData then - point, relTo, relPoint, xOff, yOff = "", {}, "", 0, 0 - frame = _G[frameData.frameName]; - point, relTo, relPoint, xOff, yOff = frame:GetPoint(frame:GetNumPoints()) -TitanDebug("Orig: " -..frameData.frameName.." " -..relTo:GetName() or "?".." " -) - orig = { - point = point, - relTo = relTo, - relPoint = relPoint, - xOff = xOff, - yOff = yOff, - } - TitanMovableOrig[frameData.frameName] = orig - end - end -end - -function Titan_SetFrameOrigPositions() - local left = 0 - local bot = 0 - -- TESTING!!! -TitanDebug("TESTING!!: Setting frames to Titan anchor " -..(TitanPanelBottomAnchor:GetTop() or "?").." " -) - left = MainMenuBar:GetLeft() - left = GetScreenWidth() / 2 - bot = MainMenuBar:GetBottom() -TitanDebug("... MainMenuBar " -..(bot or "?").." " -..(left or "?").." " -) --- local point, relFrame, relPoint, xOff, yOff = MainMenuBar:GetPoint(MainMenuBar:GetNumPoints()) - MainMenuBar:ClearAllPoints() - MainMenuBar:SetPoint("BOTTOM", TitanPanelBottomAnchor, "TOP", left, 0) --- MainMenuBar:SetPoint(point, relFrame, relPoint, xOff, TitanPanelBottomAnchor:GetTop()+0) - left = MainMenuBar:GetLeft() - bot = MainMenuBar:GetBottom() -TitanDebug("... MainMenuBar " -..(bot or "?").." " -..(left or "?").." " -) - - left = floor(OverrideActionBar:GetLeft() + 0.5) - left = GetScreenWidth() / 2 - bot = floor(OverrideActionBar:GetBottom() + 0.5) -TitanDebug("... OverrideActionBar " -..(bot or "?").." " -..(left or "?").." " -) --- point, relFrame, relPoint, xOff, yOff = OverrideActionBar:GetPoint(OverrideActionBar:GetNumPoints()) - OverrideActionBar:ClearAllPoints() - OverrideActionBar:SetPoint("BOTTOM", TitanPanelBottomAnchor, "TOP", left, 0) --- OverrideActionBar:SetPoint(point, relFrame, relPoint, xOff, TitanPanelBottomAnchor:GetTop()+0) - left = OverrideActionBar:GetCenter() - bot = OverrideActionBar:GetBottom() -TitanDebug("... OverrideActionBar " -..(bot or "?").." " -..(left or "?").." " -) - - if false then - left = MultiBarRight:GetLeft() - MultiBarRight:ClearAllPoints() - MultiBarRight:SetPoint("BOTTOMLEFT", TitanPanelBottomAnchor, "TOP", left, 98) - - left = TargetFrame:GetLeft() - TargetFrame:ClearAllPoints() - TargetFrame:SetPoint("TOPLEFT", TitanPanelTopAnchor, "BOTTOM", left, -4) - - left = PlayerFrame:GetLeft() - PlayerFrame:ClearAllPoints() - PlayerFrame:SetPoint("TOPLEFT", TitanPanelTopAnchor, "BOTTOM", left, -4) - - left = PartyMemberFrame1:GetLeft() - PartyMemberFrame1:ClearAllPoints() - PartyMemberFrame1:SetPoint("TOPLEFT", TitanPanelTopAnchor, "BOTTOM", left, -128) - - left = TicketStatusFrame:GetLeft() - TicketStatusFrame:ClearAllPoints() - TicketStatusFrame:SetPoint("TOPLEFT", TitanPanelTopAnchor, "BOTTOM", left, 0) - - left = BuffFrame:GetLeft() - BuffFrame:ClearAllPoints() - BuffFrame:SetPoint("TOPLEFT", TitanPanelTopAnchor, "BOTTOM", left, -13) - - left = MinimapCluster:GetLeft() - MinimapCluster:ClearAllPoints() - MinimapCluster:SetPoint("TOPLEFT", TitanPanelTopAnchor, "BOTTOM", left, 0) - end -end - --[[ Titan NAME: TitanMovable_SecureFrames DESC: Once Titan is initialized create the post hooks we need to help adjust frames properly. @@ -738,23 +501,27 @@ function TitanMovable_SecureFrames() if not TitanPanelAce:IsHooked("FCF_UpdateDockPosition", Titan_FCF_UpdateDockPosition) then TitanPanelAce:SecureHook("FCF_UpdateDockPosition", Titan_FCF_UpdateDockPosition) -- FloatingChatFrame end - if not TitanPanelAce:IsHooked("UIParent_ManageFramePositions", Titan_Hook_Adjust_Both) then - TitanPanelAce:SecureHook("UIParent_ManageFramePositions", Titan_Hook_Adjust_Both) -- UIParent.lua - TitanPanel_AdjustFrames(TITAN_PANEL_PLACE_BOTTOM, false) + if not TitanPanelAce:IsHooked("UIParent_ManageFramePositions", TitanPanel_AdjustFrames) then + TitanPanelAce:SecureHook("UIParent_ManageFramePositions", TitanPanel_AdjustFrames) -- UIParent.lua + TitanPanel_AdjustFrames() end - if not TitanPanelAce:IsHooked(TicketStatusFrame, "Show", Titan_Hook_Adjust_Both) then - TitanPanelAce:SecureHook(TicketStatusFrame, "Show", Titan_Hook_Adjust_Both) -- HelpFrame.xml - TitanPanelAce:SecureHook(TicketStatusFrame, "Hide", Titan_Hook_Adjust_Both) -- HelpFrame.xml - TitanPanelAce:SecureHook(MainMenuBar, "Show", Titan_Hook_Adjust_Both) -- HelpFrame.xml - TitanPanelAce:SecureHook(MainMenuBar, "Hide", Titan_Hook_Adjust_Both) -- HelpFrame.xml - TitanPanelAce:SecureHook(OverrideActionBar, "Show", Titan_Hook_Adjust_Both) -- HelpFrame.xml - TitanPanelAce:SecureHook(OverrideActionBar, "Hide", Titan_Hook_Adjust_Both) -- HelpFrame.xml + if not TitanPanelAce:IsHooked(TicketStatusFrame, "Show", TitanPanel_AdjustFrames) then + TitanPanelAce:SecureHook(TicketStatusFrame, "Show", TitanPanel_AdjustFrames) -- HelpFrame.xml + TitanPanelAce:SecureHook(TicketStatusFrame, "Hide", TitanPanel_AdjustFrames) -- HelpFrame.xml + TitanPanelAce:SecureHook(MainMenuBar, "Show", TitanPanel_AdjustFrames) -- HelpFrame.xml + TitanPanelAce:SecureHook(MainMenuBar, "Hide", TitanPanel_AdjustFrames) -- HelpFrame.xml + TitanPanelAce:SecureHook(OverrideActionBar, "Show", TitanPanel_AdjustFrames) -- HelpFrame.xml + TitanPanelAce:SecureHook(OverrideActionBar, "Hide", TitanPanel_AdjustFrames) -- HelpFrame.xml TitanPanelAce:SecureHook("UpdateContainerFrameAnchors", Titan_ContainerFrames_Relocate) -- ContainerFrame.lua - TitanPanelAce:SecureHook(WorldMapFrame.BorderFrame.MaximizeMinimizeFrame.MinimizeButton, "Show", Titan_Hook_Adjust_Both) -- WorldMapFrame.lua - TitanPanelAce:SecureHook("BuffFrame_Update", Titan_Hook_Adjust_Both) -- BuffFrame.lua - - TitanPrint("MainMenuBar:SetUserPlaced", "plain") + TitanPanelAce:SecureHook(WorldMapFrame.BorderFrame.MaximizeMinimizeFrame.MinimizeButton, "Show", TitanPanel_AdjustFrames) -- WorldMapFrame.lua + + --[[ + Setting the MainMenuBar was needed because in 8.0.0 Blizzard changed something in the + way they controlled the frame. With Titan panel and bottom bars the MainMenuBar + would 'bounce'. Figuring out what the root cause was a bust. + This fix came from a Titan user. + --]] MainMenuBar:SetMovable(true); MainMenuBar:SetUserPlaced(true); MainMenuBar:SetMovable(false); diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua index adb5e56..7d507bc 100644 --- a/Titan/TitanVariables.lua +++ b/Titan/TitanVariables.lua @@ -530,11 +530,11 @@ OUT: None local function Set_Timers(reset) -- Titan is loaded so set the timers we want to use TitanTimers = { - ["EnterWorld"] = {obj = "PEW", callback = TitanAdjustBottomFrames, delay = 4,}, - ["DualSpec"] = {obj = "SpecSwitch", callback = Titan_ManageFramesNew, delay = 2,}, + ["EnterWorld"] = {obj = "PEW", callback = TitanPanel_AdjustFrames, delay = 4,}, + ["DualSpec"] = {obj = "SpecSwitch", callback = TitanPanel_AdjustFrames, delay = 2,}, ["LDBRefresh"] = {obj = "LDB", callback = TitanLDBRefreshButton, delay = 2,}, - ["Adjust"] = {obj = "MoveAdj", callback = Titan_ManageFramesNew, delay = 1,}, - ["Vehicle"] = {obj = "Vehicle", callback = Titan_ManageFramesNew, delay = 1,}, + ["Adjust"] = {obj = "MoveAdj", callback = TitanPanel_AdjustFrames, delay = 1,}, + ["Vehicle"] = {obj = "Vehicle", callback = TitanPanel_AdjustFrames, delay = 1,}, } if reset then