vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | TITAN_PANEL_PLACE_TOP = 1; |
2 | TITAN_PANEL_PLACE_BOTTOM = 2; |
||
3 | |||
4 | TitanMovable = {}; |
||
5 | TitanMovableData = { |
||
6 | PlayerFrame = {frameName = "PlayerFrame", frameArchor = "TOPLEFT", xArchor = "LEFT", y = -4, position = TITAN_PANEL_PLACE_TOP}, |
||
7 | TargetFrame = {frameName = "TargetFrame", frameArchor = "TOPLEFT", xArchor = "LEFT", y = -4, position = TITAN_PANEL_PLACE_TOP}, |
||
8 | PartyMemberFrame1 = {frameName = "PartyMemberFrame1", frameArchor = "TOPLEFT", xArchor = "LEFT", y = -128, position = TITAN_PANEL_PLACE_TOP}, |
||
9 | TicketStatusFrame = {frameName = "TicketStatusFrame", frameArchor = "TOPRIGHT", xArchor = "RIGHT", y = 0, position = TITAN_PANEL_PLACE_TOP}, |
||
10 | TemporaryEnchantFrame = {frameName = "TemporaryEnchantFrame", frameArchor = "TOPRIGHT", xArchor = "RIGHT", y = -13, position = TITAN_PANEL_PLACE_TOP}, |
||
11 | MinimapCluster = {frameName = "MinimapCluster", frameArchor = "TOPRIGHT", xArchor = "RIGHT", y = 0, position = TITAN_PANEL_PLACE_TOP}, |
||
12 | WorldStateAlwaysUpFrame = {frameName = "WorldStateAlwaysUpFrame", frameArchor = "TOP", xArchor = "CENTER", y = -15, position = TITAN_PANEL_PLACE_TOP}, |
||
13 | MainMenuBar = {frameName = "MainMenuBar", frameArchor = "BOTTOM", xArchor = "CENTER", y = 0, position = TITAN_PANEL_PLACE_BOTTOM}, |
||
14 | MultiBarRight = {frameName = "MultiBarRight", frameArchor = "BOTTOMRIGHT", xArchor = "RIGHT", y = 98, position = TITAN_PANEL_PLACE_BOTTOM}, |
||
15 | CT_PlayerFrame_Drag = {frameName = "CT_PlayerFrame_Drag", frameArchor = "TOPLEFT", xArchor = "LEFT", y = -25, position = TITAN_PANEL_PLACE_TOP}, |
||
16 | CT_TargetFrame_Drag = {frameName = "CT_TargetFrame_Drag", frameArchor = "TOPLEFT", xArchor = "LEFT", y = -25, position = TITAN_PANEL_PLACE_TOP}, |
||
17 | Gypsy_PlayerFrameCapsule = {frameName = "Gypsy_PlayerFrameCapsule", frameArchor = "TOPLEFT", xArchor = "LEFT", y = 14, position = TITAN_PANEL_PLACE_TOP}, |
||
18 | Gypsy_TargetFrameCapsule = {frameName = "Gypsy_TargetFrameCapsule", frameArchor = "TOPLEFT", xArchor = "LEFT", y = 16, position = TITAN_PANEL_PLACE_TOP}, |
||
19 | } |
||
20 | |||
21 | function TitanMovableFrame_OnLoad() |
||
22 | -- Overwrite Blizzard Frame positioning functions |
||
23 | WoW_TicketStatusFrame_OnEvent = TicketStatusFrame_OnEvent; |
||
24 | TicketStatusFrame_OnEvent = Titan_TicketStatusFrame_OnEvent; |
||
25 | |||
26 | WoW_FCF_UpdateDockPosition = FCF_UpdateDockPosition; |
||
27 | FCF_UpdateDockPosition = Titan_FCF_UpdateDockPosition; |
||
28 | |||
29 | WoW_FCF_UpdateCombatLogPosition = FCF_UpdateCombatLogPosition; |
||
30 | FCF_UpdateCombatLogPosition = Titan_FCF_UpdateCombatLogPosition; |
||
31 | |||
32 | if TitanPanelGetVar("CastingBar") then |
||
33 | WoW_CastingBarFrame_UpdatePosition = CastingBarFrame_UpdatePosition; |
||
34 | CastingBarFrame_UpdatePosition = Titan_CastingBarFrame_UpdatePosition; |
||
35 | end |
||
36 | |||
37 | WoW_UIParent_ManageRightSideFrames = UIParent_ManageRightSideFrames; |
||
38 | UIParent_ManageRightSideFrames = Titan_UIParent_ManageRightSideFrames; |
||
39 | end |
||
40 | |||
41 | function TitanMovableFrame_CheckFrames(position) |
||
42 | local top, bottom, panelYOffset, frameTop; |
||
43 | |||
44 | TitanMovable = {}; |
||
45 | |||
46 | if (position == TITAN_PANEL_PLACE_TOP) then |
||
47 | |||
48 | panelYOffset = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_TOP, TitanPanelGetVar("BothBars")); |
||
49 | |||
50 | -- Move PlayerFrame |
||
51 | if (CT_PlayerFrame_Drag) then |
||
52 | frameTop = TitanMovableFrame_GetOffset(CT_PlayerFrame_Drag, "TOP"); |
||
53 | top = -25 + panelYOffset; |
||
54 | TitanMovableFrame_CheckTopFrame(frameTop, top, CT_PlayerFrame_Drag:GetName()); |
||
55 | elseif (Gypsy_PlayerFrameCapsule) then |
||
56 | frameTop = TitanMovableFrame_GetOffset(Gypsy_PlayerFrameCapsule, "TOP"); |
||
57 | top = 14 + panelYOffset; |
||
58 | TitanMovableFrame_CheckTopFrame(frameTop, top, Gypsy_PlayerFrameCapsule:GetName()); |
||
59 | else |
||
60 | frameTop = TitanMovableFrame_GetOffset(PlayerFrame, "TOP"); |
||
61 | top = -4 + panelYOffset; |
||
62 | TitanMovableFrame_CheckTopFrame(frameTop, top, PlayerFrame:GetName()) |
||
63 | end |
||
64 | |||
65 | -- Move TargetFrame |
||
66 | if (CT_TargetFrame_Drag) then |
||
67 | frameTop = TitanMovableFrame_GetOffset(CT_TargetFrame_Drag, "TOP"); |
||
68 | top = -25 + panelYOffset; |
||
69 | TitanMovableFrame_CheckTopFrame(frameTop, top, CT_TargetFrame_Drag:GetName()); |
||
70 | elseif (Gypsy_TargetFrameCapsule) then |
||
71 | frameTop = TitanMovableFrame_GetOffset(Gypsy_TargetFrameCapsule, "TOP"); |
||
72 | top = 14 + panelYOffset; |
||
73 | TitanMovableFrame_CheckTopFrame(frameTop, top, Gypsy_TargetFrameCapsule:GetName()); |
||
74 | else |
||
75 | frameTop = TitanMovableFrame_GetOffset(TargetFrame, "TOP"); |
||
76 | top = -4 + panelYOffset; |
||
77 | TitanMovableFrame_CheckTopFrame(frameTop, top, TargetFrame:GetName()) |
||
78 | end |
||
79 | |||
80 | -- Move PartyMemberFrame |
||
81 | if (not CT_MovableParty1_Drag and not Gypsy_PartyFrameCapsule) then |
||
82 | frameTop = TitanMovableFrame_GetOffset(PartyMemberFrame1, "TOP"); |
||
83 | top = -128 + panelYOffset; |
||
84 | TitanMovableFrame_CheckTopFrame(frameTop, top, PartyMemberFrame1:GetName()) |
||
85 | end |
||
86 | |||
87 | -- Move TicketStatusFrame |
||
88 | frameTop = TitanMovableFrame_GetOffset(TicketStatusFrame, "TOP"); |
||
89 | top = 0 + panelYOffset; |
||
90 | TitanMovableFrame_CheckTopFrame(frameTop, top, TicketStatusFrame:GetName()) |
||
91 | |||
92 | -- Move TemporaryEnchantFrame |
||
93 | frameTop = TitanMovableFrame_GetOffset(TemporaryEnchantFrame, "TOP"); |
||
94 | if (TicketStatusFrame:IsVisible()) then |
||
95 | top = 0 - TicketStatusFrame:GetHeight() + panelYOffset; |
||
96 | else |
||
97 | top = -13 + panelYOffset; |
||
98 | end |
||
99 | TitanMovableFrame_CheckTopFrame(frameTop, top, TemporaryEnchantFrame:GetName()) |
||
100 | |||
101 | -- Move MinimapCluster |
||
102 | if (not CleanMinimap) then |
||
103 | frameTop = TitanMovableFrame_GetOffset(MinimapCluster, "TOP"); |
||
104 | top = 0 + panelYOffset; |
||
105 | TitanMovableFrame_CheckTopFrame(frameTop, top, MinimapCluster:GetName()) |
||
106 | end |
||
107 | |||
108 | -- Move WorldStateAlwaysUpFrame |
||
109 | frameTop = TitanMovableFrame_GetOffset(WorldStateAlwaysUpFrame, "TOP"); |
||
110 | top = -15 + panelYOffset; |
||
111 | TitanMovableFrame_CheckTopFrame(frameTop, top, WorldStateAlwaysUpFrame:GetName()); |
||
112 | |||
113 | elseif (position == TITAN_PANEL_PLACE_BOTTOM) then |
||
114 | |||
115 | panelYOffset = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_BOTTOM, TitanPanelGetVar("BothBars")); |
||
116 | |||
117 | -- Move MainMenuBar |
||
118 | if (not Gypsy_ActionBar and not BibActionBar1) then |
||
119 | bottom = 0 + panelYOffset; |
||
120 | frameBottom = TitanMovableFrame_GetOffset(MainMenuBar, "BOTTOM"); |
||
121 | if (frameBottom >= 0) then |
||
122 | TitanMovableFrame_CheckBottomFrame(frameBottom, bottom, MainMenuBar:GetName()); |
||
123 | end |
||
124 | end |
||
125 | |||
126 | -- Move MultiBarRight |
||
127 | bottom = 98 + panelYOffset; |
||
128 | frameBottom = TitanMovableFrame_GetOffset(MultiBarRight, "BOTTOM"); |
||
129 | TitanMovableFrame_CheckBottomFrame(frameBottom, bottom, MultiBarRight:GetName()); |
||
130 | end |
||
131 | |||
132 | end |
||
133 | |||
134 | function TitanMovableFrame_MoveFrames(position, override) |
||
135 | local frameData, frame, frameName, frameArchor, xArchor, y, xOffset, yOffset, panelYOffset; |
||
136 | |||
137 | for index, value in TitanMovable do |
||
138 | frameData = TitanMovableData[value]; |
||
139 | frame = getglobal(frameData.frameName); |
||
140 | frameName = frameData.frameName; |
||
141 | frameArchor = frameData.frameArchor; |
||
142 | |||
143 | if (not frame:IsUserPlaced()) then |
||
144 | xArchor = frameData.xArchor; |
||
145 | y = frameData.y; |
||
146 | |||
147 | panelYOffset = TitanMovable_GetPanelYOffset(frameData.position, TitanPanelGetVar("BothBars"), override); |
||
148 | |||
149 | xOffset = TitanMovableFrame_GetOffset(frame, xArchor); |
||
150 | if (frameName == "TemporaryEnchantFrame" and TicketStatusFrame:IsVisible()) then |
||
151 | yOffset = (-TicketStatusFrame:GetHeight()) + panelYOffset; |
||
152 | else |
||
153 | yOffset = y + panelYOffset; |
||
154 | end |
||
155 | |||
156 | frame:ClearAllPoints(); |
||
157 | frame:SetPoint(frameArchor, "UIParent", frameArchor, xOffset, yOffset); |
||
158 | else |
||
159 | --Leave frame where it is as it has been moved by a user |
||
160 | end |
||
161 | end |
||
162 | end |
||
163 | |||
164 | function TitanMovableFrame_AdjustBlizzardFrames() |
||
165 | Titan_FCF_UpdateDockPosition(); |
||
166 | Titan_FCF_UpdateCombatLogPosition(); |
||
167 | if TitanPanelGetVar("CastingBar") then |
||
168 | Titan_CastingBarFrame_UpdatePosition(); |
||
169 | end |
||
170 | Titan_UIParent_ManageRightSideFrames(); |
||
171 | end |
||
172 | |||
173 | function TitanMovableFrame_GetOffset(frame, point) |
||
174 | if (frame and point) then |
||
175 | if (point == "LEFT" and frame:GetLeft() and UIParent:GetLeft()) then |
||
176 | return frame:GetLeft() - UIParent:GetLeft(); |
||
177 | elseif (point == "RIGHT" and frame:GetRight() and UIParent:GetRight()) then |
||
178 | return frame:GetRight() - UIParent:GetRight(); |
||
179 | elseif (point == "TOP" and frame:GetTop() and UIParent:GetTop()) then |
||
180 | return frame:GetTop() - UIParent:GetTop(); |
||
181 | elseif (point == "BOTTOM" and frame:GetBottom() and UIParent:GetBottom()) then |
||
182 | return frame:GetBottom() - UIParent:GetBottom(); |
||
183 | elseif (point == "CENTER" and frame:GetLeft() and frame:GetRight() and UIParent:GetLeft() and UIParent:GetRight()) then |
||
184 | return (frame:GetLeft() + frame:GetRight() - UIParent:GetLeft() - UIParent:GetRight()) / 2; |
||
185 | end |
||
186 | end |
||
187 | return 0; |
||
188 | end |
||
189 | |||
190 | function TitanMovable_GetPanelYOffset(framePosition, bothbars, override) |
||
191 | local barPosition = TitanPanelGetVar("Position"); |
||
192 | local barnumber = 0; |
||
193 | |||
194 | if override then |
||
195 | if framePosition == TITAN_PANEL_PLACE_TOP then |
||
196 | if TitanPanelGetVar("ScreenAdjust") then |
||
197 | return 0; |
||
198 | end |
||
199 | elseif framePosition == TITAN_PANEL_PLACE_BOTTOM and bothbars == nil then |
||
200 | if TitanPanelGetVar("ScreenAdjust") then |
||
201 | return 0; |
||
202 | end |
||
203 | elseif framePosition == TITAN_PANEL_PLACE_BOTTOM and bothbars == 1 then |
||
204 | if TitanPanelGetVar("AuxScreenAdjust") then |
||
205 | return 0; |
||
206 | end |
||
207 | else |
||
208 | return 0; |
||
209 | end |
||
210 | end |
||
211 | |||
212 | if bothbars ~= nil then |
||
213 | barPosition = framePosition; |
||
214 | else |
||
215 | barPosition = TitanPanelGetVar("Position"); |
||
216 | end |
||
217 | |||
218 | barnumber = TitanUtils_GetDoubleBar(bothbars, framePosition); |
||
219 | |||
220 | local scale = TitanPanelGetVar("Scale"); |
||
221 | if (scale and framePosition and barPosition and framePosition == barPosition) then |
||
222 | if (framePosition == TITAN_PANEL_PLACE_TOP) then |
||
223 | return (-24 * scale)*(barnumber); |
||
224 | elseif (framePosition == TITAN_PANEL_PLACE_BOTTOM) then |
||
225 | return (24 * scale)*(barnumber); |
||
226 | end |
||
227 | end |
||
228 | return 0; |
||
229 | end |
||
230 | |||
231 | function TitanMovableFrame_CheckTopFrame(frameTop, top, frameName) |
||
232 | -- if (frameTop + 1 >= top) then |
||
233 | --TitanDebug(frameTop .." - " .. top); |
||
234 | table.insert(TitanMovable, frameName); |
||
235 | -- end |
||
236 | end |
||
237 | |||
238 | function TitanMovableFrame_CheckBottomFrame(frameBottom, bottom, frameName) |
||
239 | -- if (frameBottom - 1 <= bottom) then |
||
240 | table.insert(TitanMovable, frameName); |
||
241 | -- end |
||
242 | end |
||
243 | |||
244 | function Titan_TicketStatusFrame_OnEvent() |
||
245 | local panelYOffset = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_TOP, TitanPanelGetVar("BothBars")); |
||
246 | |||
247 | if ( event == "PLAYER_ENTERING_WORLD" ) then |
||
248 | GetGMTicket(); |
||
249 | else |
||
250 | if ( arg1 ~= 0 ) then |
||
251 | this:Show(); |
||
252 | TemporaryEnchantFrame:SetPoint("TOPRIGHT", this:GetParent():GetName(), "TOPRIGHT", -205, 0 - this:GetHeight() + panelYOffset); -- ATTN |
||
253 | refreshTime = GMTICKET_CHECK_INTERVAL; |
||
254 | else |
||
255 | this:Hide(); |
||
256 | TemporaryEnchantFrame:SetPoint("TOPRIGHT", "UIParent", "TOPRIGHT", -205, -13 + panelYOffset); -- ATTN |
||
257 | end |
||
258 | end |
||
259 | end |
||
260 | |||
261 | function Titan_FCF_UpdateDockPosition() |
||
262 | local panelYOffset = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_BOTTOM, TitanPanelGetVar("BothBars")); |
||
263 | |||
264 | if ( DEFAULT_CHAT_FRAME:IsUserPlaced() ) then |
||
265 | if ( SIMPLE_CHAT ~= "1" ) then |
||
266 | return; |
||
267 | end |
||
268 | end |
||
269 | |||
270 | local chatOffset = 85 + panelYOffset; |
||
271 | if ( GetNumShapeshiftForms() > 0 or HasPetUI() or PetHasActionBar() ) then |
||
272 | if ( MultiBarBottomLeft:IsVisible() or BOTTOMBAR_OFFSET_Y ) then |
||
273 | chatOffset = chatOffset + 55; |
||
274 | else |
||
275 | chatOffset = chatOffset + 15; |
||
276 | end |
||
277 | elseif ( MultiBarBottomLeft:IsVisible() or BOTTOMBAR_OFFSET_Y ) then |
||
278 | chatOffset = chatOffset + 15; |
||
279 | end |
||
280 | DEFAULT_CHAT_FRAME:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 32, chatOffset); |
||
281 | FCF_DockUpdate(); |
||
282 | end |
||
283 | |||
284 | function Titan_FCF_UpdateCombatLogPosition() |
||
285 | local panelYOffset = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_BOTTOM, TitanPanelGetVar("BothBars")); |
||
286 | |||
287 | if ( SIMPLE_CHAT == "1" ) then |
||
288 | local xOffset = -32; |
||
289 | local yOffset = 75 + panelYOffset; |
||
290 | if ( MultiBarBottomRight:IsVisible() ) then |
||
291 | yOffset = yOffset + 40; |
||
292 | end |
||
293 | if ( MultiBarLeft:IsVisible() ) then |
||
294 | xOffset = xOffset - 88; |
||
295 | elseif ( MultiBarRight:IsVisible() ) then |
||
296 | xOffset = xOffset - 43; |
||
297 | end |
||
298 | ChatFrame2:SetPoint("BOTTOMRIGHT", "UIParent", "BOTTOMRIGHT", xOffset, yOffset); |
||
299 | end |
||
300 | end |
||
301 | |||
302 | function Titan_CastingBarFrame_UpdatePosition() |
||
303 | local panelYOffset = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_BOTTOM, TitanPanelGetVar("BothBars")); |
||
304 | |||
305 | local castingBarPosition = 60 + panelYOffset; |
||
306 | if ( PetActionBarFrame:IsVisible() or ShapeshiftBarFrame:IsVisible() ) then |
||
307 | castingBarPosition = castingBarPosition + 40; |
||
308 | end |
||
309 | if ( MultiBarBottomLeft:IsVisible() or MultiBarBottomRight:IsVisible() ) then |
||
310 | castingBarPosition = castingBarPosition + 40; |
||
311 | end |
||
312 | CastingBarFlash:ClearAllPoints(); |
||
313 | CastingBarFlash:SetPoint("BOTTOM", "UIParent", "BOTTOM", 0, castingBarPosition - 22); |
||
314 | CastingBarText:ClearAllPoints(); |
||
315 | CastingBarText:SetPoint("BOTTOM", "UIParent", "BOTTOM", 0, castingBarPosition); |
||
316 | CastingBarFrameStatusBar:ClearAllPoints(); |
||
317 | CastingBarFrameStatusBar:SetPoint("BOTTOM", "UIParent", "BOTTOM", 0, castingBarPosition); |
||
318 | CastingBarFrame:ClearAllPoints(); |
||
319 | CastingBarFrame:SetPoint("BOTTOM", "UIParent", "BOTTOM", 0, castingBarPosition); |
||
320 | end |
||
321 | |||
322 | function Titan_UIParent_ManageRightSideFrames() |
||
323 | local panelYOffset = TitanMovable_GetPanelYOffset(TITAN_PANEL_PLACE_BOTTOM, TitanPanelGetVar("BothBars")); |
||
324 | |||
325 | local anchorX = 0; |
||
326 | local anchorY = 0 + panelYOffset; |
||
327 | |||
328 | -- Update group loot frame anchor |
||
329 | if ( MultiBarBottomRight:IsVisible() or MultiBarBottomLeft:IsVisible() ) then |
||
330 | GroupLootFrame1:SetPoint("BOTTOM", "UIParent", "BOTTOM", 0, 102 + panelYOffset); |
||
331 | else |
||
332 | GroupLootFrame1:SetPoint("BOTTOM", "UIParent", "BOTTOM", 0, 60 + panelYOffset); |
||
333 | end |
||
334 | |||
335 | -- Update tutorial anchor |
||
336 | if ( MultiBarBottomRight:IsVisible() or MultiBarBottomLeft:IsVisible() ) then |
||
337 | TutorialFrameParent:SetPoint("BOTTOM", "UIParent", "BOTTOM", 0, 94 + panelYOffset); |
||
338 | FramerateLabel:SetPoint("BOTTOM", "WorldFrame", "BOTTOM", 0, 104 + panelYOffset); |
||
339 | else |
||
340 | TutorialFrameParent:SetPoint("BOTTOM", "UIParent", "BOTTOM", 0, 52 + panelYOffset); |
||
341 | FramerateLabel:SetPoint("BOTTOM", "WorldFrame", "BOTTOM", 0, 64 + panelYOffset); |
||
342 | end |
||
343 | |||
344 | -- Update bag anchor |
||
345 | if ( MultiBarBottomRight:IsVisible() ) then |
||
346 | CONTAINER_OFFSET_Y = 97 + panelYOffset; |
||
347 | else |
||
348 | CONTAINER_OFFSET_Y = 70 + panelYOffset; |
||
349 | end |
||
350 | -- Setup x anchor |
||
351 | if ( MultiBarLeft:IsVisible() ) then |
||
352 | CONTAINER_OFFSET_X = 90; |
||
353 | anchorX = 90; |
||
354 | elseif ( MultiBarRight:IsVisible() ) then |
||
355 | CONTAINER_OFFSET_X = 45; |
||
356 | anchorX = 45; |
||
357 | else |
||
358 | CONTAINER_OFFSET_X = 0; |
||
359 | anchorX = 0; |
||
360 | end |
||
361 | -- Setup y anchors |
||
362 | QuestTimerFrame:SetPoint("TOPRIGHT", "MinimapCluster", "BOTTOMRIGHT", -anchorX, anchorY); |
||
363 | if ( QuestTimerFrame:IsVisible() ) then |
||
364 | anchorY = anchorY - QuestTimerFrame:GetHeight(); |
||
365 | end |
||
366 | DurabilityFrame:SetPoint("TOPRIGHT", "MinimapCluster", "BOTTOMRIGHT", -anchorX-20, anchorY); |
||
367 | if ( DurabilityFrame:IsVisible() ) then |
||
368 | anchorY = anchorY - DurabilityFrame:GetHeight(); |
||
369 | end |
||
370 | QuestWatchFrame:SetPoint("TOPRIGHT", "MinimapCluster", "BOTTOMRIGHT", -anchorX, anchorY); |
||
371 | |||
372 | -- Update combat log anchor |
||
373 | FCF_UpdateCombatLogPosition(); |
||
374 | end |