vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function DFM_Add_Frame(frameName, name, header, addChildren, override, changeHeaderOrName, custom) |
2 | local frame = getglobal(frameName); |
||
3 | |||
4 | if (not frame) and (not custom) then |
||
5 | DL_Debug("A frame named "..frameName.." does not exist. Double-check your spelling and capitalization."); |
||
6 | return; |
||
7 | end |
||
8 | |||
9 | local oldHeader; |
||
10 | for h,frames in DFM_Settings[DFM_INDEX] do |
||
11 | for f in frames do |
||
12 | if (f == frameName) then |
||
13 | if (changeHeaderOrName) then |
||
14 | oldHeader = h; |
||
15 | break; |
||
16 | else |
||
17 | DL_Error(frameName.." is already listed as "..frames[f].name.." beneath the "..h.." header."); |
||
18 | return; |
||
19 | end |
||
20 | end |
||
21 | end |
||
22 | end |
||
23 | |||
24 | if (not header) then |
||
25 | header = DFM_TEXT.UserAdded; |
||
26 | end |
||
27 | if (not DFM_Settings[DFM_INDEX][header]) then |
||
28 | DFM_Settings[DFM_INDEX][header] = {}; |
||
29 | end |
||
30 | if (not name or name == "") then |
||
31 | name = frameName; |
||
32 | end |
||
33 | |||
34 | if (oldHeader) then |
||
35 | if (oldHeader == header) then |
||
36 | DFM_Settings[DFM_INDEX][header][frameName].name = name; |
||
37 | else |
||
38 | DFM_Settings[DFM_INDEX][header][frameName] = {}; |
||
39 | DL_Copy_Table(DFM_Settings[DFM_INDEX][oldHeader][frameName], DFM_Settings[DFM_INDEX][header][frameName]); |
||
40 | DFM_Settings[DFM_INDEX][header][frameName].name = name; |
||
41 | DFM_Settings[DFM_INDEX][oldHeader][frameName] = nil; |
||
42 | end |
||
43 | else |
||
44 | DFM_Settings[DFM_INDEX][header][frameName] = {name=name}; |
||
45 | |||
46 | if (addChildren and frame.GetChildren) then |
||
47 | local children = {frame:GetChildren()}; |
||
48 | if (children) then |
||
49 | for _, child in children do |
||
50 | if (child.GetName and child:GetName()) then |
||
51 | DFM_Add_Frame(child:GetName(), child:GetName(), header, 1, 1); |
||
52 | end |
||
53 | end |
||
54 | end |
||
55 | end |
||
56 | end |
||
57 | |||
58 | if (DFM_Options and (not override)) then |
||
59 | if (oldHeader) then |
||
60 | DFM_SELECTED_INDEX = nil; |
||
61 | DFM_OPTIONS_LIST = {}; |
||
62 | end |
||
63 | DFM_Update_FrameList(); |
||
64 | DFM_FrameMenu_Update(); |
||
65 | DFM_OptionsMenu_Update(); |
||
66 | end |
||
67 | end |
||
68 | |||
69 | function DFM_Call_Method(header, frame, method) |
||
70 | if (not DFM_Settings[DFM_INDEX][header][frame][method].use) then return; end |
||
71 | local param = DFM_Settings[DFM_INDEX][header][frame][method]; |
||
72 | local prefix = ""; |
||
73 | if (DFM_Settings[DFM_INDEX][header][frame][method].lock) then |
||
74 | prefix = "DFM_"; |
||
75 | end |
||
76 | method = DFM_METHODS_LIST[method].method; |
||
77 | frame = getglobal(frame); |
||
78 | if (string.find(method, "Color")) then |
||
79 | frame[prefix..method](frame, param[1].r, param[1].g, param[1].b, param[2]); |
||
80 | elseif (method == "SetBackdrop") then |
||
81 | frame[prefix.."SetBackdrop"](frame, {bgFile = param[1], edgeFile = param[2], tile = param[3], tileSize = param[4], edgeSize = param[5], insets = { left = param[6], right = param[7], top = param[8], bottom = param[9] }}); |
||
82 | elseif (method == "SetFont") then |
||
83 | local mc = "false"; |
||
84 | if (param[4]) then |
||
85 | mc = "true"; |
||
86 | end |
||
87 | --local flags = "outline='"..param[3].."', monochrome='"..mc.."'"; |
||
88 | frame[prefix.."SetFont"](frame, param[1], param[2]); |
||
89 | elseif (method == "SetParent") then |
||
90 | local parent = param[1]; |
||
91 | if (not getglobal(parent)) then |
||
92 | parent = UIParent; |
||
93 | end |
||
94 | frame:SetParent(parent); |
||
95 | elseif (method == "EnableMouse" or method == "EnableMouseWheel") then |
||
96 | local value; |
||
97 | if (not param[1]) then |
||
98 | value = 1; |
||
99 | end |
||
100 | frame[prefix..method](frame, value); |
||
101 | else |
||
102 | frame[prefix..method](frame, param[1], param[2], param[3], param[4], param[5], param[6], param[7], param[8]); |
||
103 | end |
||
104 | end |
||
105 | |||
106 | function DFM_CastingBarFrame_UpdatePosition() |
||
107 | if (not CastingBarFrame.dfmmoved) then |
||
108 | DFM_Old_CastingBarFrame_UpdatePosition(); |
||
109 | end |
||
110 | end |
||
111 | |||
112 | function DFM_Create_Profile(index) |
||
113 | if (not index) then |
||
114 | if (DFM_Options) then |
||
115 | index = DFM_Options_NewProfile:GetText(); |
||
116 | if (not index or index == "") then return; end |
||
117 | else |
||
118 | return; |
||
119 | end |
||
120 | end |
||
121 | if (DFM_Settings[index]) then |
||
122 | DL_Error("That profile name already exists. If you wish to overwrite it, you must first delete it."); |
||
123 | return; |
||
124 | end |
||
125 | DFM_Settings[index] = {}; |
||
126 | DL_Copy_Table(DFM_Settings[DFM_INDEX], DFM_Settings[index]); |
||
127 | DFM_INDEX = index; |
||
128 | DFM_Settings[DFM_PROFILE_INDEX] = index; |
||
129 | if (DFM_Options) then |
||
130 | DFM_Options_ProfileLabel:SetText(DFM_TEXT.CurrentProfile.."|cFFFFFFFF "..DFM_INDEX); |
||
131 | DFM_Update_Profiles(); |
||
132 | DFM_Options_NewProfile:SetText(""); |
||
133 | DFM_Options_NewProfile:ClearFocus(); |
||
134 | end |
||
135 | end |
||
136 | |||
137 | function DFM_GameTooltip_SetDefaultAnchor(tooltip, parent) |
||
138 | if (DFM_Settings.usetooltipanchor) then |
||
139 | tooltip:SetOwner(parent, "ANCHOR_NONE"); |
||
140 | local prefix = "TOP"; |
||
141 | local suffix = "RIGHT"; |
||
142 | local x, y = UIParent:GetCenter(); |
||
143 | local x2, y2 = DFM_GameTooltipAnchor:GetCenter(); |
||
144 | if (x2 < x) then |
||
145 | suffix = "LEFT"; |
||
146 | end |
||
147 | if (y2 < y) then |
||
148 | prefix = "BOTTOM"; |
||
149 | end |
||
150 | tooltip:SetPoint(prefix..suffix, DFM_GameTooltipAnchor, prefix..suffix, 0, 0); |
||
151 | else |
||
152 | DFM_Old_GameTooltip_SetDefaultAnchor(tooltip, parent); |
||
153 | end |
||
154 | end |
||
155 | |||
156 | function DFM_Initialize() |
||
157 | if (DFM_INITIALIZED) then return; end |
||
158 | |||
159 | if (not DFM_Settings) then |
||
160 | DFM_Settings = {}; |
||
161 | elseif (not DFM_Settings["INITIALIZED1.0"]) then |
||
162 | DFM_Settings = {}; |
||
163 | end |
||
164 | DFM_Settings["INITIALIZED1.0"] = 1; |
||
165 | |||
166 | DFM_PROFILE_INDEX = UnitName("player").." :: "..GetCVar("realmName"); |
||
167 | if (DFM_Settings[DFM_PROFILE_INDEX]) then |
||
168 | DFM_INDEX = DFM_Settings[DFM_PROFILE_INDEX]; |
||
169 | else |
||
170 | DFM_INDEX = DFM_TEXT.Default; |
||
171 | DFM_Settings[DFM_PROFILE_INDEX] = DFM_TEXT.Default; |
||
172 | end |
||
173 | |||
174 | if (not DFM_Settings[DFM_INDEX]) then |
||
175 | local err = DFM_Load_DefaultSettings(); |
||
176 | if (err) then |
||
177 | DL_Debug("** Default settings not found for Discord Frame Modifier. Unable to initialize. **"); |
||
178 | return; |
||
179 | end |
||
180 | end |
||
181 | |||
182 | if (not DFM_Initialized) then |
||
183 | DFM_Initialized = {}; |
||
184 | end |
||
185 | |||
186 | if (DFM_CUSTOM_SETTINGS) then |
||
187 | DFM_Settings.Custom = {}; |
||
188 | DL_Copy_Table(DFM_CUSTOM_SETTINGS, DFM_Settings.Custom); |
||
189 | DFM_CUSTOM_SETTINGS = nil; |
||
190 | end |
||
191 | |||
192 | if (not DFM_Settings.LoadOnDemandFunctions) then |
||
193 | DFM_Settings.LoadOnDemandFunctions = { |
||
194 | "AuctionFrame_LoadUI", |
||
195 | "BattlefieldMinimap_LoadUI", |
||
196 | "ClassTrainerFrame_LoadUI", |
||
197 | "CraftFrame_LoadUI", |
||
198 | "InspectFrame_LoadUI", |
||
199 | "KeyBindingFrame_LoadUI", |
||
200 | "MacroFrame_LoadUI", |
||
201 | "RaidFrame_LoadUI", |
||
202 | "TalentFrame_LoadUI", |
||
203 | "TradeSkillFrame_LoadUI" |
||
204 | } |
||
205 | end |
||
206 | |||
207 | DFM_INITIALIZED = true; |
||
208 | DL_Hook("CastingBarFrame_UpdatePosition", "DFM"); |
||
209 | DL_Hook("GameTooltip_SetDefaultAnchor", "DFM"); |
||
210 | |||
211 | for _,func in DFM_Settings.LoadOnDemandFunctions do |
||
212 | RunScript(string.gsub(DFM_LODHOOKFUNC, "$f", func)); |
||
213 | DL_Hook(func, "DFM"); |
||
214 | end |
||
215 | |||
216 | DFM_Initialize_AllFrames(); |
||
217 | end |
||
218 | |||
219 | function DFM_Initialize_AllFrames(lod) |
||
220 | if (not DFM_Initialized[DFM_INDEX]) then |
||
221 | DFM_Initialized[DFM_INDEX] = {}; |
||
222 | end |
||
223 | DFM_Initialized[DFM_INDEX]["1.2"] = 1; |
||
224 | if (not DFM_Initialized[DFM_INDEX]["1.2"]) then |
||
225 | DFM_Add_Frame("MasterFont", nil, "Fonts", nil, 1); |
||
226 | DFM_Add_Frame("SystemFont", nil, "Fonts", nil, 1); |
||
227 | DFM_Add_Frame("GameFontNormal", nil, "Fonts", nil, 1); |
||
228 | DFM_Add_Frame("GameFontHighlight", nil, "Fonts", nil, 1); |
||
229 | DFM_Add_Frame("GameFontDisable", nil, "Fonts", nil, 1); |
||
230 | DFM_Add_Frame("GameFontGreen", nil, "Fonts", nil, 1); |
||
231 | DFM_Add_Frame("GameFontRed", nil, "Fonts", nil, 1); |
||
232 | DFM_Add_Frame("GameFontBlack", nil, "Fonts", nil, 1); |
||
233 | DFM_Add_Frame("GameFontWhite", nil, "Fonts", nil, 1); |
||
234 | DFM_Add_Frame("GameFontNormalSmall", nil, "Fonts", nil, 1); |
||
235 | DFM_Add_Frame("GameFontHighlightSmall", nil, "Fonts", nil, 1); |
||
236 | DFM_Add_Frame("GameFontDisableSmall", nil, "Fonts", nil, 1); |
||
237 | DFM_Add_Frame("GameFontDarkGraySmall", nil, "Fonts", nil, 1); |
||
238 | DFM_Add_Frame("GameFontGreenSmall", nil, "Fonts", nil, 1); |
||
239 | DFM_Add_Frame("GameFontRedSmall", nil, "Fonts", nil, 1); |
||
240 | DFM_Add_Frame("GameFontHighlightSmallOutline", nil, "Fonts", nil, 1); |
||
241 | DFM_Add_Frame("GameFontNormalLarge", nil, "Fonts", nil, 1); |
||
242 | DFM_Add_Frame("GameFontHighlightLarge", nil, "Fonts", nil, 1); |
||
243 | DFM_Add_Frame("GameFontDisableLarge", nil, "Fonts", nil, 1); |
||
244 | DFM_Add_Frame("GameFontGreenLarge", nil, "Fonts", nil, 1); |
||
245 | DFM_Add_Frame("GameFontRedLarge", nil, "Fonts", nil, 1); |
||
246 | DFM_Add_Frame("NumberFontNormal", nil, "Fonts", nil, 1); |
||
247 | DFM_Add_Frame("NumberFontNormalSmall", nil, "Fonts", nil, 1); |
||
248 | DFM_Add_Frame("NumberFontNormalLarge", nil, "Fonts", nil, 1); |
||
249 | DFM_Add_Frame("NumberFontNormalYellow", nil, "Fonts", nil, 1); |
||
250 | DFM_Add_Frame("NumberFontNormalSmallGray", nil, "Fonts", nil, 1); |
||
251 | DFM_Add_Frame("NumberFontNormalHuge", nil, "Fonts", nil, 1); |
||
252 | DFM_Add_Frame("ChatFontNormal", nil, "Fonts", nil, 1); |
||
253 | DFM_Add_Frame("QuestTitleFont", nil, "Fonts", nil, 1); |
||
254 | DFM_Add_Frame("QuestFont", nil, "Fonts", nil, 1); |
||
255 | DFM_Add_Frame("QuestFontNormalSmall", nil, "Fonts", nil, 1); |
||
256 | DFM_Add_Frame("QuestFontHighlight", nil, "Fonts", nil, 1); |
||
257 | DFM_Add_Frame("ItemTextFontNormal", nil, "Fonts", nil, 1); |
||
258 | DFM_Add_Frame("MailTextFontNormal", nil, "Fonts", nil, 1); |
||
259 | DFM_Add_Frame("SubSpellFont", nil, "Fonts", nil, 1); |
||
260 | DFM_Add_Frame("DialogButtonNormalText", nil, "Fonts", nil, 1); |
||
261 | DFM_Add_Frame("DialogButtonHighlightText", nil, "Fonts", nil, 1); |
||
262 | DFM_Add_Frame("ZoneTextFont", nil, "Fonts", nil, 1); |
||
263 | DFM_Add_Frame("SubZoneTextFont", nil, "Fonts", nil, 1); |
||
264 | DFM_Add_Frame("ErrorFont", nil, "Fonts", nil, 1); |
||
265 | DFM_Add_Frame("TextStatusBarText", nil, "Fonts", nil, 1); |
||
266 | DFM_Add_Frame("TextStatusBarTextSmall", nil, "Fonts", nil, 1); |
||
267 | DFM_Add_Frame("CombatLogFont", nil, "Fonts", nil, 1); |
||
268 | DFM_Add_Frame("GameTooltipText", nil, "Fonts", nil, 1); |
||
269 | DFM_Add_Frame("GameTooltipTextSmall", nil, "Fonts", nil, 1); |
||
270 | DFM_Add_Frame("GameTooltipHeaderText", nil, "Fonts", nil, 1); |
||
271 | DFM_Add_Frame("WorldMapTextFont", nil, "Fonts", nil, 1); |
||
272 | DFM_Add_Frame("InvoiceTextFontNormal", nil, "Fonts", nil, 1); |
||
273 | DFM_Add_Frame("InvoiceTextFontSmall", nil, "Fonts", nil, 1); |
||
274 | DFM_Initialized[DFM_INDEX]["1.2"] = 1; |
||
275 | end |
||
276 | for header in DFM_Settings[DFM_INDEX] do |
||
277 | for frame in DFM_Settings[DFM_INDEX][header] do |
||
278 | if (lod) then |
||
279 | if (getglobal(frame) and (not getglobal(frame).dfminitialized)) then |
||
280 | DFM_Initialize_Frame(header, frame); |
||
281 | end |
||
282 | else |
||
283 | DFM_Initialize_Frame(header, frame); |
||
284 | end |
||
285 | end |
||
286 | end |
||
287 | if (DFM_Options and DFM_Options:IsVisible()) then |
||
288 | DFM_Update_FrameList(); |
||
289 | DFM_OptionsMenu_Update(); |
||
290 | end |
||
291 | end |
||
292 | |||
293 | function DFM_Initialize_Frame(header, frame) |
||
294 | if (DFM_Settings[DFM_INDEX][header][frame] and DFM_Settings[DFM_INDEX][header][frame].customFrame and (not getglobal(frame))) then |
||
295 | if (DFM_Settings[DFM_INDEX][header][frame].frameType == "Texture") then |
||
296 | UIParent:CreateTexture(frame, "ARTWORK"); |
||
297 | elseif (DFM_Settings[DFM_INDEX][header][frame].frameType == "FontString") then |
||
298 | UIParent:CreateFontString(frame, "ARTWORK"); |
||
299 | getglobal(frame):SetFontObject(GameFontNormal); |
||
300 | elseif (DFM_Settings[DFM_INDEX][header][frame].frameType == "Font") then |
||
301 | CreateFont(frame); |
||
302 | else |
||
303 | CreateFrame(DFM_Settings[DFM_INDEX][header][frame].frameType, frame, UIParent); |
||
304 | end |
||
305 | local f = getglobal(frame); |
||
306 | f:SetHeight(10); |
||
307 | f:SetWidth(10); |
||
308 | f:SetPoint("CENTER", UIParent, "CENTER", 0, 0); |
||
309 | end |
||
310 | if (not getglobal(frame)) then return; end |
||
311 | local f = getglobal(frame); |
||
312 | f.dfminitialized = true; |
||
313 | for method=1, table.getn(DFM_METHODS_LIST) do |
||
314 | if (DFM_Settings[DFM_INDEX][header][frame][method]) then |
||
315 | if (DFM_Settings[DFM_INDEX][header][frame][method].lock) then |
||
316 | local methodName = DFM_METHODS_LIST[method].method; |
||
317 | if (not f["DFM_"..methodName]) then |
||
318 | f["DFM_"..methodName] = f[methodName]; |
||
319 | f[methodName] = function() end; |
||
320 | end |
||
321 | end |
||
322 | DFM_Call_Method(header, frame, method); |
||
323 | end |
||
324 | end |
||
325 | DFM_Initialize_FrameLocation(header, frame); |
||
326 | if (DFM_Settings[DFM_INDEX][header][frame].forceHide) then |
||
327 | f.DFMShow = f.Show; |
||
328 | f.Show = function() end; |
||
329 | f:Hide(); |
||
330 | elseif (f.DFMShow) then |
||
331 | f:DFMShow(); |
||
332 | end |
||
333 | for header in DFM_Settings[DFM_INDEX] do |
||
334 | for frameName in DFM_Settings[DFM_INDEX][header] do |
||
335 | local checkParent = getglobal(frameName); |
||
336 | if (checkParent and checkParent.GetParent and checkParent:GetParent() and checkParent:GetParent().GetName and checkParent:GetParent():GetName() == frame) then |
||
337 | DFM_Initialize_Frame(header, checkParent); |
||
338 | end |
||
339 | end |
||
340 | end |
||
341 | end |
||
342 | |||
343 | function DFM_Initialize_FrameLocation(header, frame) |
||
344 | local settings = DFM_Settings[DFM_INDEX][header][frame].Location; |
||
345 | if (not settings or not settings.use) then |
||
346 | getglobal(frame).dfmmoved = nil; |
||
347 | return; |
||
348 | end |
||
349 | local anchorFrame = settings.frame; |
||
350 | if (not getglobal(anchorFrame)) then |
||
351 | anchorFrame = "UIParent"; |
||
352 | end |
||
353 | local prefix = ""; |
||
354 | frame = getglobal(frame); |
||
355 | frame.dfmmoved = true; |
||
356 | if (settings.lock) then |
||
357 | prefix = "DFM_"; |
||
358 | if (not frame.DFM_SetPoint) then |
||
359 | frame.DFM_SetPoint = frame.SetPoint; |
||
360 | frame.SetPoint = function() end; |
||
361 | end |
||
362 | elseif (frame.DFM_SetPoint) then |
||
363 | frame.SetPoint = frame.DFM_SetPoint; |
||
364 | frame.DFM_SetPoint = nil; |
||
365 | end |
||
366 | |||
367 | frame:ClearAllPoints(); |
||
368 | frame[prefix.."SetPoint"](frame, settings.point, anchorFrame, settings.to, settings.x, settings.y); |
||
369 | end |
||
370 | |||
371 | function DFM_Load_DefaultSettings() |
||
372 | DFM_Settings[DFM_INDEX] = {}; |
||
373 | if (DFM_DEFAULT_SETTINGS) then |
||
374 | DL_Copy_Table(DFM_DEFAULT_SETTINGS, DFM_Settings[DFM_INDEX]); |
||
375 | else |
||
376 | return true; |
||
377 | end |
||
378 | end |
||
379 | |||
380 | function DFM_Load_Options(framefinder) |
||
381 | if (DFM_Options) then return; end |
||
382 | UIParentLoadAddOn("DiscordFrameModifierOptions"); |
||
383 | DL_Set_OptionsTitle("DFM_Options", "DiscordFrameModifierOptions\\title", DFM_VERSION); |
||
384 | DL_Layout_Menu("DFM_DropMenu", DFM_DropMenu_OnClick); |
||
385 | DL_Layout_ScrollButtons("DFM_ScrollMenu_Button", 10, DFM_ScrollMenu_OnClick); |
||
386 | DL_Layout_ScrollButtons("DFM_Options_FrameMenu_Button", 14, DFM_FrameMenu_OnClick); |
||
387 | DL_Layout_VerticalFrames("DFM_Options_OptionsMenu_Button", 7, DFM_OptionsMenu_OnClick); |
||
388 | DL_Layout_VerticalFrames("DFM_LoDFrame_Menu_Button", 7); |
||
389 | DFM_Options_ProfileLabel:SetText(DFM_TEXT.CurrentProfile.."|cFFFFFFFF "..DFM_INDEX); |
||
390 | DFM_Update_FrameList(); |
||
391 | DFM_Update_Profiles(); |
||
392 | DFM_CreateFrameForm_FrameType_Setting:SetText("Frame"); |
||
393 | if (framefinder) then |
||
394 | DFM_FrameFinder:Show(); |
||
395 | else |
||
396 | DFM_Options:Show(); |
||
397 | end |
||
398 | DFM_FrameMenu_Update(); |
||
399 | end |
||
400 | |||
401 | function DFM_Load_Profile(index) |
||
402 | if (not index) then |
||
403 | if (DFM_Options) then |
||
404 | index = DFM_Options_LoadProfile_Setting:GetText(); |
||
405 | if (not index or index == "") then return; end |
||
406 | else |
||
407 | return; |
||
408 | end |
||
409 | end |
||
410 | DFM_Settings[DFM_PROFILE_INDEX] = index; |
||
411 | ReloadUI(); |
||
412 | end |
||
413 | |||
414 | function DFM_Main_OnLoad() |
||
415 | DiscordLib_RegisterInitFunc(DFM_Initialize); |
||
416 | |||
417 | SlashCmdList["DFM"] = DFM_Slash_Handler; |
||
418 | SLASH_DFM1 = "/dfm"; |
||
419 | SLASH_DFM2 = "/discordframemodifier"; |
||
420 | end |
||
421 | |||
422 | function DFM_Slash_Handler(msg) |
||
423 | if (msg == "resetall") then |
||
424 | DFM_Settings = nil; |
||
425 | ReloadUI(); |
||
426 | elseif (msg == "usetooltipanchor") then |
||
427 | if (DFM_Settings.usetooltipanchor) then |
||
428 | DFM_Settings.usetooltipanchor = nil; |
||
429 | DL_Feedback("Discord Frame Modifier will no longer use its tooltip anchor to position the tooltip."); |
||
430 | else |
||
431 | DFM_Settings.usetooltipanchor = 1; |
||
432 | DL_Feedback("Discord Frame Modifier will now use its tooltip anchor to position the tooltip."); |
||
433 | end |
||
434 | elseif (msg == "usecontaineranchors") then |
||
435 | if (DFM_Settings.usecontineranchors) then |
||
436 | DFM_Settings.usecontineranchors = nil; |
||
437 | else |
||
438 | DFM_Settings.usecontineranchors = 1; |
||
439 | end |
||
440 | else |
||
441 | DFM_Toggle_Options(); |
||
442 | end |
||
443 | end |
||
444 | |||
445 | function DFM_Toggle_FrameFinder() |
||
446 | if (DFM_Options) then |
||
447 | if (DFM_FrameFinder:IsVisible()) then |
||
448 | DFM_FrameFinder:Hide(); |
||
449 | else |
||
450 | DFM_FrameFinder:Show(); |
||
451 | end |
||
452 | else |
||
453 | DFM_Load_Options(1); |
||
454 | end |
||
455 | end |
||
456 | |||
457 | function DFM_Toggle_Options() |
||
458 | if (DFM_Options) then |
||
459 | if (DFM_Options:IsVisible()) then |
||
460 | DFM_Options:Hide(); |
||
461 | else |
||
462 | DFM_Options:Show(); |
||
463 | end |
||
464 | else |
||
465 | DFM_Load_Options(); |
||
466 | end |
||
467 | end |
||
468 | |||
469 | DFM_Old_CastingBarFrame_OnUpdate = CastingBarFrame_OnUpdate; |
||
470 | function DFM_CastingBarFrame_OnUpdate() |
||
471 | DFM_Old_CastingBarFrame_OnUpdate(); |
||
472 | if ( this.casting ) then |
||
473 | local status = GetTime(); |
||
474 | local sparkPosition = ((status - this.startTime) / (this.maxValue - this.startTime)) * CastingBarFrame:GetWidth(); |
||
475 | if ( sparkPosition < 0 ) then |
||
476 | sparkPosition = 0; |
||
477 | end |
||
478 | CastingBarSpark:SetPoint("CENTER", CastingBarFrame, "LEFT", sparkPosition, 2); |
||
479 | elseif ( this.channeling ) then |
||
480 | local time = GetTime(); |
||
481 | local barValue = this.startTime + (this.endTime - time); |
||
482 | local sparkPosition = ((barValue - this.startTime) / (this.endTime - this.startTime)) * CastingBarFrame:GetWidth(); |
||
483 | CastingBarSpark:SetPoint("CENTER", CastingBarFrame, "LEFT", sparkPosition, 2); |
||
484 | end |
||
485 | end |
||
486 | CastingBarFrame_OnUpdate = DFM_CastingBarFrame_OnUpdate; |