Titan Logo

 Menu

 Developer

TitanMovable.lua


TitanMovable.lua
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.
However addons can tell Titan to not adjust some or all frames using TitanUtils_AddonAdjust(frame, bool). This is useful to addons that replace all or parts of the Blizzard UI. The routine overrides the user settings while active - it is NOT saved across logins, instance enter / leave, etc.

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)


Ace timer notes
Declare the Ace routines
local AceTimer = LibStub("AceTimer-3.0")
i.e. TitanPanelAce.ScheduleTimer("LDBToTitanSetText", TitanLDBRefreshButton, 2);
or
i.e. TitanPanelAce:ScheduleTimer(TitanLDBRefreshButton, 2);

Be careful that the 'self' is proper to cancel timers!!!


TitanMovableData table
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


TitanMovable_AdjustTimer
Cancel then add the given timer. The timer must be in TitanTimers.

Inputs
ttype - The timer type (string) as defined in TitanTimers

Outputs
None


TitanMovable_AddonAdjust
Set the given frame to be adjusted or not by another addon. This is called from TitanUtils for a developer API.

Inputs
frame - frame name (string)
bool - true (addon will adjust) or false (Titan will use its settings)

Outputs
None


TitanMovable_GetPanelYOffset
Get the Y axis offset Titan needs (1 or 2 bars) at the given position - top or bottom.

Inputs
framePosition - TITAN_PANEL_PLACE_TOP or TITAN_PANEL_PLACE_BOTTOM

Outputs
Y axis offset, in pixels

Notes
- The prefered method to determine the Y offset needed by using TitanUtils_GetBarAnchors().


TitanMovableFrame_GetXOffset
Get the x axis offset Titan needs to adjust the given frame.

Inputs
frame - frame object
point - "LEFT" / "RIGHT" / "TOP" / "BOTTOM" / "CENTER"

Outputs
X axis offset, in pixels


TitanMovableFrame_MoveFrames
Actually adjust the frames at the given position.

Inputs
position - TITAN_PANEL_PLACE_TOP / TITAN_PANEL_PLACE_BOTTOM / TITAN_PANEL_PLACE_BOTH

Outputs
None


Titan_FCF_UpdateDockPosition
Secure post hook to help adjust the chat / log frame.

Inputs
None

Outputs
None

Notes
- This is required because Blizz adjusts the chat frame relative to other frames so some of the Blizz code is copied.
- 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.


Titan_ContainerFrames_Relocate
Secure post hook to help adjust the bag frames.

Inputs
None

Outputs
None

Notes
- The frame is adjusted in the Y axis only.
- The Blizz routine "ContainerFrames_Relocate" should be examined for any conditions it checks and any changes to the SetPoint.
If Blizz changes the anchor points the SetPoint here must change as well!!
The Blizz routine calculates X & Y offsets to UIParent (screen) so there is not need to store the prior offsets.
Like the Blizz routine we search through the visible bags. Unlike the Blizz routine we only care about the first of each column to adjust for Titan.
This way the Blizz code does not need to be copied here.


TitanMovableFrame_AdjustBlizzardFrames
Calls the helper routines to adjust the chat / log frame and bag frames.

Inputs
None

Outputs
None

Notes
- 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.


Titan_AdjustUIScale
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'.

Inputs
None

Outputs
None


Titan_Hook_Adjust_Both
Adjust top and bottom frames. This is called by the secure post hooks.

Inputs
None

Outputs
None

Notes
- 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.


TitanPanel_AdjustFrames
Adjust the frames Titan is to adjust.

Inputs
None

Outputs
None


Titan_ManageFramesNew
Adjust the frames at TITAN_PANEL_PLACE_BOTH.

Inputs
None

Outputs
None


Titan_AdjustScale
Update the bars and plugins to the user selected scale.

Inputs
None

Outputs
None

Notes
- Ensure Titan has done its initialization before this is run.


TitanMovable_SecureFrames
Once Titan is initialized create the post hooks we need to help adjust frames properly.

Inputs
None

Outputs
None

Notes
- The secure post hooks are required because Blizz adjusts frames Titan is interested in at times other than the events Titan registers for.
- This used to be inline code but was moved to a routine to avoid errors as Titan loaded.