|
Tercio@11
|
1
|
|
Tercio@58
|
2 local dversion = 85
|
|
Tercio@25
|
3 local major, minor = "DetailsFramework-1.0", dversion
|
|
Tercio@11
|
4 local DF, oldminor = LibStub:NewLibrary (major, minor)
|
|
Tercio@11
|
5
|
|
Tercio@18
|
6 if (not DF) then
|
|
Tercio@20
|
7 DetailsFrameworkCanLoad = false
|
|
Tercio@11
|
8 return
|
|
Tercio@11
|
9 end
|
|
Tercio@11
|
10
|
|
Tercio@20
|
11 DetailsFrameworkCanLoad = true
|
|
Tercio@25
|
12 local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
|
|
Tercio@18
|
13
|
|
Tercioo@29
|
14 local _
|
|
Tercio@11
|
15 local _type = type
|
|
Tercio@11
|
16 local _unpack = unpack
|
|
Tercio@11
|
17 local upper = string.upper
|
|
Tercio@58
|
18 local string_match = string.match
|
|
Tercio@58
|
19
|
|
Tercio@58
|
20 SMALL_NUMBER = 0.000001
|
|
Tercio@58
|
21 ALPHA_BLEND_AMOUNT = 0.8400251
|
|
Tercio@11
|
22
|
|
Tercioo@29
|
23 --> will always give a very random name for our widgets
|
|
Tercioo@29
|
24 local init_counter = math.random (1, 1000000)
|
|
Tercioo@29
|
25
|
|
Tercioo@29
|
26 DF.LabelNameCounter = DF.LabelNameCounter or init_counter
|
|
Tercioo@29
|
27 DF.PictureNameCounter = DF.PictureNameCounter or init_counter
|
|
Tercioo@29
|
28 DF.BarNameCounter = DF.BarNameCounter or init_counter
|
|
Tercioo@29
|
29 DF.DropDownCounter = DF.DropDownCounter or init_counter
|
|
Tercioo@29
|
30 DF.PanelCounter = DF.PanelCounter or init_counter
|
|
Tercioo@29
|
31 DF.SimplePanelCounter = DF.SimplePanelCounter or init_counter
|
|
Tercioo@29
|
32 DF.ButtonCounter = DF.ButtonCounter or init_counter
|
|
Tercioo@29
|
33 DF.SliderCounter = DF.SliderCounter or init_counter
|
|
Tercioo@29
|
34 DF.SwitchCounter = DF.SwitchCounter or init_counter
|
|
Tercioo@29
|
35 DF.SplitBarCounter = DF.SplitBarCounter or init_counter
|
|
Tercio@11
|
36
|
|
Tercio@39
|
37 DF.FRAMELEVEL_OVERLAY = 750
|
|
Tercio@39
|
38 DF.FRAMELEVEL_BACKGROUND = 150
|
|
Tercio@39
|
39
|
|
Tercio@25
|
40 DF.FrameWorkVersion = tostring (dversion)
|
|
Tercio@25
|
41 function DF:PrintVersion()
|
|
Tercio@25
|
42 print ("Details! Framework Version:", DF.FrameWorkVersion)
|
|
Tercio@25
|
43 end
|
|
Tercio@25
|
44
|
|
Tercio@22
|
45 LibStub:GetLibrary("AceTimer-3.0"):Embed (DF)
|
|
Tercio@22
|
46
|
|
Tercioo@29
|
47 --> get the working folder
|
|
Tercio@11
|
48 do
|
|
Tercio@11
|
49 local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua")
|
|
Tercio@11
|
50 if (path) then
|
|
Tercio@11
|
51 DF.folder = "Interface\\AddOns\\" .. path
|
|
Tercio@11
|
52 else
|
|
Tercioo@29
|
53 --> if not found, try to use the last valid one
|
|
Tercioo@29
|
54 DF.folder = DF.folder or ""
|
|
Tercio@11
|
55 end
|
|
Tercio@11
|
56 end
|
|
Tercio@11
|
57
|
|
Tercio@11
|
58 DF.debug = false
|
|
Tercio@11
|
59
|
|
Tercio@11
|
60 _G ["DetailsFramework"] = DF
|
|
Tercio@11
|
61
|
|
Tercio@11
|
62 DF.embeds = DF.embeds or {}
|
|
Tercio@11
|
63 local embed_functions = {
|
|
Tercio@20
|
64 "RemoveRealName",
|
|
Tercio@20
|
65 "table",
|
|
Tercio@20
|
66 "BuildDropDownFontList",
|
|
Tercio@11
|
67 "SetFontSize",
|
|
Tercio@11
|
68 "SetFontFace",
|
|
Tercio@11
|
69 "SetFontColor",
|
|
Tercio@11
|
70 "GetFontSize",
|
|
Tercio@11
|
71 "GetFontFace",
|
|
Tercio@17
|
72 "SetFontOutline",
|
|
Tercio@11
|
73 "trim",
|
|
Tercio@11
|
74 "Msg",
|
|
Tercio@11
|
75 "CreateFlashAnimation",
|
|
Tercio@11
|
76 "Fade",
|
|
Tercio@11
|
77 "NewColor",
|
|
Tercio@11
|
78 "IsHtmlColor",
|
|
Tercio@11
|
79 "ParseColors",
|
|
Tercio@11
|
80 "BuildMenu",
|
|
Tercio@11
|
81 "ShowTutorialAlertFrame",
|
|
Tercio@11
|
82 "GetNpcIdFromGuid",
|
|
Tercio@11
|
83 "ShowFeedbackPanel",
|
|
Tercio@20
|
84 "SetAsOptionsPanel",
|
|
Tercio@11
|
85
|
|
Tercio@11
|
86 "CreateDropDown",
|
|
Tercio@11
|
87 "CreateButton",
|
|
Tercio@11
|
88 "CreateColorPickButton",
|
|
Tercio@11
|
89 "CreateLabel",
|
|
Tercio@11
|
90 "CreateBar",
|
|
Tercio@11
|
91 "CreatePanel",
|
|
Tercio@11
|
92 "CreateFillPanel",
|
|
Tercio@11
|
93 "ColorPick",
|
|
Tercio@11
|
94 "IconPick",
|
|
Tercio@11
|
95 "CreateSimplePanel",
|
|
Tercio@11
|
96 "CreateChartPanel",
|
|
Tercio@11
|
97 "CreateImage",
|
|
Tercio@11
|
98 "CreateScrollBar",
|
|
Tercio@11
|
99 "CreateSwitch",
|
|
Tercio@11
|
100 "CreateSlider",
|
|
Tercio@11
|
101 "CreateSplitBar",
|
|
Tercio@11
|
102 "CreateTextEntry",
|
|
Tercio@11
|
103 "Create1PxPanel",
|
|
Tercio@11
|
104 "CreateFeedbackButton",
|
|
Tercio@20
|
105 "CreateOptionsFrame",
|
|
Tercio@22
|
106 "NewSpecialLuaEditorEntry",
|
|
Tercio@20
|
107 "ShowPromptPanel",
|
|
Tercio@22
|
108 "ShowTextPromptPanel",
|
|
Tercio@11
|
109 "www_icons",
|
|
Tercio@22
|
110 "GetTemplate",
|
|
Tercioo@29
|
111 "InstallTemplate",
|
|
Tercio@22
|
112 "GetFrameworkFolder",
|
|
Tercioo@29
|
113 "ShowPanicWarning",
|
|
Tercio@39
|
114 "SetFrameworkDebugState",
|
|
Tercio@39
|
115 "FindHighestParent",
|
|
Tercio@39
|
116 "OpenInterfaceProfile",
|
|
Tercio@40
|
117 "CreateInCombatTexture",
|
|
Tercio@40
|
118 "CreateAnimationHub",
|
|
Tercio@40
|
119 "CreateAnimation",
|
|
Tercio@40
|
120 "CreateScrollBox",
|
|
Tercio@40
|
121 "CreateBorder",
|
|
Tercio@42
|
122 "FormatNumber",
|
|
Tercio@53
|
123 "IntegerToTimer",
|
|
Tercio@58
|
124 "QuickDispatch",
|
|
Tercio@58
|
125 "CommaValue",
|
|
Tercio@58
|
126 "RemoveRealmName",
|
|
Tercio@58
|
127 "Trim",
|
|
Tercio@58
|
128 "CreateGlowOverlay",
|
|
Tercio@58
|
129 "CreateFrameShake",
|
|
Tercio@11
|
130 }
|
|
Tercio@11
|
131
|
|
Tercio@20
|
132 DF.table = {}
|
|
Tercio@20
|
133
|
|
Tercio@22
|
134 function DF:GetFrameworkFolder()
|
|
Tercio@22
|
135 return DF.folder
|
|
Tercio@22
|
136 end
|
|
Tercio@22
|
137
|
|
Tercio@39
|
138 function DF:SetFrameworkDebugState (state)
|
|
Tercio@39
|
139 DF.debug = state
|
|
Tercio@39
|
140 end
|
|
Tercio@39
|
141
|
|
Tercio@26
|
142 function DF:FadeFrame (frame, t)
|
|
Tercio@26
|
143 if (t == 0) then
|
|
Tercio@26
|
144 frame.hidden = false
|
|
Tercio@26
|
145 frame.faded = false
|
|
Tercio@26
|
146 frame.fading_out = false
|
|
Tercio@26
|
147 frame.fading_in = false
|
|
Tercio@26
|
148 frame:Show()
|
|
Tercio@26
|
149 frame:SetAlpha (1)
|
|
Tercio@26
|
150
|
|
Tercio@26
|
151 elseif (t == 1) then
|
|
Tercio@26
|
152 frame.hidden = true
|
|
Tercio@26
|
153 frame.faded = true
|
|
Tercio@26
|
154 frame.fading_out = false
|
|
Tercio@26
|
155 frame.fading_in = false
|
|
Tercio@26
|
156 frame:SetAlpha (0)
|
|
Tercio@26
|
157 frame:Hide()
|
|
Tercio@26
|
158 end
|
|
Tercio@26
|
159 end
|
|
Tercio@26
|
160
|
|
Tercio@20
|
161 function DF.table.reverse (t)
|
|
Tercio@20
|
162 local new = {}
|
|
Tercio@20
|
163 local index = 1
|
|
Tercio@20
|
164 for i = #t, 1, -1 do
|
|
Tercio@20
|
165 new [index] = t[i]
|
|
Tercio@20
|
166 index = index + 1
|
|
Tercio@20
|
167 end
|
|
Tercio@20
|
168 return new
|
|
Tercio@20
|
169 end
|
|
Tercio@20
|
170
|
|
Tercio@20
|
171 --> copy from table2 to table1 overwriting values
|
|
Tercio@20
|
172 function DF.table.copy (t1, t2)
|
|
Tercio@20
|
173 for key, value in pairs (t2) do
|
|
Tercio@20
|
174 if (type (value) == "table") then
|
|
Tercio@20
|
175 t1 [key] = t1 [key] or {}
|
|
Tercio@20
|
176 DF.table.copy (t1 [key], t2 [key])
|
|
Tercio@20
|
177 else
|
|
Tercio@20
|
178 t1 [key] = value
|
|
Tercio@20
|
179 end
|
|
Tercio@20
|
180 end
|
|
Tercio@20
|
181 return t1
|
|
Tercio@20
|
182 end
|
|
Tercio@20
|
183
|
|
Tercio@20
|
184 --> copy values that does exist on table2 but not on table1
|
|
Tercio@20
|
185 function DF.table.deploy (t1, t2)
|
|
Tercio@20
|
186 for key, value in pairs (t2) do
|
|
Tercio@20
|
187 if (type (value) == "table") then
|
|
Tercio@20
|
188 t1 [key] = t1 [key] or {}
|
|
Tercio@20
|
189 DF.table.deploy (t1 [key], t2 [key])
|
|
Tercio@22
|
190 elseif (t1 [key] == nil) then
|
|
Tercio@20
|
191 t1 [key] = value
|
|
Tercio@20
|
192 end
|
|
Tercio@20
|
193 end
|
|
Tercio@58
|
194 return t1
|
|
Tercio@20
|
195 end
|
|
Tercio@20
|
196
|
|
Tercio@20
|
197 function DF.table.dump (t, s, deep)
|
|
Tercio@20
|
198 s = s or ""
|
|
Tercio@20
|
199 deep = deep or 0
|
|
Tercio@20
|
200 local space = ""
|
|
Tercio@20
|
201 for i = 1, deep do
|
|
Tercio@20
|
202 space = space .. " "
|
|
Tercio@20
|
203 end
|
|
Tercio@20
|
204 for key, value in pairs (t) do
|
|
Tercio@20
|
205 local tpe = _type (value)
|
|
Tercio@20
|
206 if (type (key) ~= "string") then
|
|
Tercio@20
|
207 key = "unknown?"
|
|
Tercio@20
|
208 end
|
|
Tercio@20
|
209 if (tpe == "table") then
|
|
Tercio@20
|
210 s = s .. space .. "[" .. key .. "] = |cFFa9ffa9table {|r\n"
|
|
Tercio@20
|
211 s = s .. DF.table.dump (value, nil, deep+1)
|
|
Tercio@20
|
212 s = s .. space .. "|cFFa9ffa9}|r\n"
|
|
Tercio@20
|
213 elseif (tpe == "string") then
|
|
Tercio@20
|
214 s = s .. space .. "[" .. key .. "] = '|cFFfff1c1" .. value .. "|r'\n"
|
|
Tercio@20
|
215 elseif (tpe == "number") then
|
|
Tercio@20
|
216 s = s .. space .. "[" .. key .. "] = |cFFffc1f4" .. value .. "|r\n"
|
|
Tercio@20
|
217 elseif (tpe == "function") then
|
|
Tercio@20
|
218 s = s .. space .. "[" .. key .. "] = function()\n"
|
|
Tercio@20
|
219 elseif (tpe == "boolean") then
|
|
Tercio@20
|
220 s = s .. space .. "[" .. key .. "] = |cFF99d0ff" .. (value and "true" or "false") .. "|r\n"
|
|
Tercio@20
|
221 end
|
|
Tercio@20
|
222 end
|
|
Tercio@20
|
223 return s
|
|
Tercio@20
|
224 end
|
|
Tercio@20
|
225
|
|
Tercio@11
|
226 DF.www_icons = {
|
|
Tercio@11
|
227 texture = "feedback_sites",
|
|
Tercio@11
|
228 wowi = {0, 0.7890625, 0, 37/128},
|
|
Tercio@11
|
229 curse = {0, 0.7890625, 38/123, 79/128},
|
|
Tercio@11
|
230 mmoc = {0, 0.7890625, 80/123, 123/128},
|
|
Tercio@11
|
231 }
|
|
Tercio@11
|
232
|
|
Tercio@42
|
233 local symbol_1K, symbol_10K, symbol_1B
|
|
Tercio@42
|
234 if (GetLocale() == "koKR") then
|
|
Tercio@42
|
235 symbol_1K, symbol_10K, symbol_1B = "천", "만", "억"
|
|
Tercio@42
|
236 elseif (GetLocale() == "zhCN") then
|
|
Tercio@42
|
237 symbol_1K, symbol_10K, symbol_1B = "千", "万", "亿"
|
|
Tercio@42
|
238 elseif (GetLocale() == "zhTW") then
|
|
Tercio@42
|
239 symbol_1K, symbol_10K, symbol_1B = "千", "萬", "億"
|
|
Tercio@42
|
240 end
|
|
Tercio@42
|
241
|
|
Tercio@42
|
242 if (symbol_1K) then
|
|
Tercio@42
|
243 function DF.FormatNumber (numero)
|
|
Tercio@42
|
244 if (numero > 99999999) then
|
|
Tercio@42
|
245 return format ("%.2f", numero/100000000) .. symbol_1B
|
|
Tercio@42
|
246 elseif (numero > 999999) then
|
|
Tercio@42
|
247 return format ("%.2f", numero/10000) .. symbol_10K
|
|
Tercio@42
|
248 elseif (numero > 99999) then
|
|
Tercio@42
|
249 return floor (numero/10000) .. symbol_10K
|
|
Tercio@42
|
250 elseif (numero > 9999) then
|
|
Tercio@42
|
251 return format ("%.1f", (numero/10000)) .. symbol_10K
|
|
Tercio@42
|
252 elseif (numero > 999) then
|
|
Tercio@42
|
253 return format ("%.1f", (numero/1000)) .. symbol_1K
|
|
Tercio@42
|
254 end
|
|
Tercio@42
|
255 return format ("%.1f", numero)
|
|
Tercio@42
|
256 end
|
|
Tercio@42
|
257 else
|
|
Tercio@42
|
258 function DF.FormatNumber (numero)
|
|
Tercio@47
|
259 if (numero > 999999999) then
|
|
Tercio@47
|
260 return format ("%.2f", numero/1000000000) .. "B"
|
|
Tercio@47
|
261 elseif (numero > 999999) then
|
|
Tercio@42
|
262 return format ("%.2f", numero/1000000) .. "M"
|
|
Tercio@42
|
263 elseif (numero > 99999) then
|
|
Tercio@42
|
264 return floor (numero/1000) .. "K"
|
|
Tercio@42
|
265 elseif (numero > 999) then
|
|
Tercio@42
|
266 return format ("%.1f", (numero/1000)) .. "K"
|
|
Tercio@42
|
267 end
|
|
Tercio@42
|
268 return format ("%.1f", numero)
|
|
Tercio@42
|
269 end
|
|
Tercio@42
|
270 end
|
|
Tercio@42
|
271
|
|
Tercio@58
|
272 function DF:CommaValue (value)
|
|
Tercio@58
|
273 if (not value) then
|
|
Tercio@58
|
274 return "0"
|
|
Tercio@58
|
275 end
|
|
Tercio@58
|
276
|
|
Tercio@58
|
277 value = floor (value)
|
|
Tercio@58
|
278
|
|
Tercio@58
|
279 if (value == 0) then
|
|
Tercio@58
|
280 return "0"
|
|
Tercio@58
|
281 end
|
|
Tercio@58
|
282
|
|
Tercio@58
|
283 --source http://richard.warburton.it
|
|
Tercio@58
|
284 local left, num, right = string_match (value, '^([^%d]*%d)(%d*)(.-)$')
|
|
Tercio@58
|
285 return left .. (num:reverse():gsub ('(%d%d%d)','%1,'):reverse()) .. right
|
|
Tercio@58
|
286 end
|
|
Tercio@58
|
287
|
|
Tercio@24
|
288 function DF:IntegerToTimer (value)
|
|
Tercio@24
|
289 return "" .. floor (value/60) .. ":" .. format ("%02.f", value%60)
|
|
Tercio@24
|
290 end
|
|
Tercio@24
|
291
|
|
Tercio@11
|
292 function DF:Embed (target)
|
|
Tercio@11
|
293 for k, v in pairs (embed_functions) do
|
|
Tercio@11
|
294 target[v] = self[v]
|
|
Tercio@11
|
295 end
|
|
Tercio@11
|
296 self.embeds [target] = true
|
|
Tercio@11
|
297 return target
|
|
Tercio@11
|
298 end
|
|
Tercio@11
|
299
|
|
Tercioo@28
|
300 function DF:RemoveRealmName (name)
|
|
Tercioo@28
|
301 return name:gsub (("%-.*"), "")
|
|
Tercioo@28
|
302 end
|
|
Tercioo@28
|
303
|
|
Tercio@20
|
304 function DF:RemoveRealName (name)
|
|
Tercio@20
|
305 return name:gsub (("%-.*"), "")
|
|
Tercio@20
|
306 end
|
|
Tercio@20
|
307
|
|
Tercio@11
|
308 function DF:SetFontSize (fontString, ...)
|
|
Tercio@11
|
309 local fonte, _, flags = fontString:GetFont()
|
|
Tercio@11
|
310 fontString:SetFont (fonte, max (...), flags)
|
|
Tercio@11
|
311 end
|
|
Tercio@11
|
312 function DF:SetFontFace (fontString, fontface)
|
|
Tercio@25
|
313 local font = SharedMedia:Fetch ("font", fontface, true)
|
|
Tercio@25
|
314 if (font) then
|
|
Tercio@25
|
315 fontface = font
|
|
Tercio@25
|
316 end
|
|
Tercio@25
|
317
|
|
Tercio@11
|
318 local _, size, flags = fontString:GetFont()
|
|
Tercio@11
|
319 fontString:SetFont (fontface, size, flags)
|
|
Tercio@11
|
320 end
|
|
Tercio@11
|
321 function DF:SetFontColor (fontString, r, g, b, a)
|
|
Tercio@11
|
322 r, g, b, a = DF:ParseColors (r, g, b, a)
|
|
Tercio@11
|
323 fontString:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
324 end
|
|
Tercio@11
|
325
|
|
Tercio@11
|
326 function DF:GetFontSize (fontString)
|
|
Tercio@11
|
327 local _, size = fontString:GetFont()
|
|
Tercio@11
|
328 return size
|
|
Tercio@11
|
329 end
|
|
Tercio@11
|
330 function DF:GetFontFace (fontString)
|
|
Tercio@11
|
331 local fontface = fontString:GetFont()
|
|
Tercio@11
|
332 return fontface
|
|
Tercio@11
|
333 end
|
|
Tercio@11
|
334
|
|
Tercio@49
|
335 local ValidOutlines = {
|
|
Tercio@49
|
336 ["NONE"] = true,
|
|
Tercio@49
|
337 ["MONOCHROME"] = true,
|
|
Tercio@49
|
338 ["OUTLINE"] = true,
|
|
Tercio@49
|
339 ["THICKOUTLINE"] = true,
|
|
Tercio@49
|
340 }
|
|
Tercio@11
|
341 function DF:SetFontOutline (fontString, outline)
|
|
Tercio@11
|
342 local fonte, size = fontString:GetFont()
|
|
Tercio@11
|
343 if (outline) then
|
|
Tercio@49
|
344 if (ValidOutlines [outline]) then
|
|
Tercio@49
|
345 outline = outline
|
|
Tercio@49
|
346 elseif (_type (outline) == "boolean" and outline) then
|
|
Tercio@11
|
347 outline = "OUTLINE"
|
|
Tercio@11
|
348 elseif (outline == 1) then
|
|
Tercio@11
|
349 outline = "OUTLINE"
|
|
Tercio@11
|
350 elseif (outline == 2) then
|
|
Tercio@11
|
351 outline = "THICKOUTLINE"
|
|
Tercio@11
|
352 end
|
|
Tercio@11
|
353 end
|
|
Tercio@11
|
354
|
|
Tercio@11
|
355 fontString:SetFont (fonte, size, outline)
|
|
Tercio@11
|
356 end
|
|
Tercio@11
|
357
|
|
Tercio@58
|
358 function DF:Trim (s) --hello name conventions!
|
|
Tercio@58
|
359 return DF:trim (s)
|
|
Tercio@58
|
360 end
|
|
Tercio@58
|
361
|
|
Tercio@11
|
362 function DF:trim (s)
|
|
Tercio@11
|
363 local from = s:match"^%s*()"
|
|
Tercio@11
|
364 return from > #s and "" or s:match(".*%S", from)
|
|
Tercio@11
|
365 end
|
|
Tercio@11
|
366
|
|
Tercio@11
|
367 function DF:Msg (msg)
|
|
Tercio@58
|
368 print ("|cFFFFFFAA" .. (self.__name or "FW Msg:") .. "|r ", msg)
|
|
Tercio@11
|
369 end
|
|
Tercio@11
|
370
|
|
Tercio@11
|
371 function DF:GetNpcIdFromGuid (guid)
|
|
Tercio@11
|
372 local NpcId = select ( 6, strsplit ( "-", guid ) )
|
|
Tercio@11
|
373 if (NpcId) then
|
|
Tercio@11
|
374 return tonumber ( NpcId )
|
|
Tercio@11
|
375 end
|
|
Tercio@11
|
376 return 0
|
|
Tercio@11
|
377 end
|
|
Tercio@11
|
378
|
|
Tercio@58
|
379 function DF.SortOrder1 (t1, t2)
|
|
Tercio@58
|
380 return t1[1] > t2[1]
|
|
Tercio@58
|
381 end
|
|
Tercio@58
|
382 function DF.SortOrder2 (t1, t2)
|
|
Tercio@58
|
383 return t1[2] > t2[2]
|
|
Tercio@58
|
384 end
|
|
Tercio@58
|
385 function DF.SortOrder3 (t1, t2)
|
|
Tercio@58
|
386 return t1[3] > t2[3]
|
|
Tercio@58
|
387 end
|
|
Tercio@58
|
388 function DF.SortOrder1R (t1, t2)
|
|
Tercio@58
|
389 return t1[1] < t2[1]
|
|
Tercio@58
|
390 end
|
|
Tercio@58
|
391 function DF.SortOrder2R (t1, t2)
|
|
Tercio@58
|
392 return t1[2] < t2[2]
|
|
Tercio@58
|
393 end
|
|
Tercio@58
|
394 function DF.SortOrder3R (t1, t2)
|
|
Tercio@58
|
395 return t1[3] < t2[3]
|
|
Tercio@58
|
396 end
|
|
Tercio@58
|
397
|
|
Tercio@11
|
398 local onFinish = function (self)
|
|
Tercio@11
|
399 if (self.showWhenDone) then
|
|
Tercio@11
|
400 self.frame:SetAlpha (1)
|
|
Tercio@11
|
401 else
|
|
Tercio@11
|
402 self.frame:SetAlpha (0)
|
|
Tercio@11
|
403 self.frame:Hide()
|
|
Tercio@11
|
404 end
|
|
Tercio@11
|
405
|
|
Tercio@11
|
406 if (self.onFinishFunc) then
|
|
Tercio@11
|
407 self:onFinishFunc (self.frame)
|
|
Tercio@11
|
408 end
|
|
Tercio@11
|
409 end
|
|
Tercio@11
|
410
|
|
Tercio@11
|
411 local stop = function (self)
|
|
Tercio@11
|
412 local FlashAnimation = self.FlashAnimation
|
|
Tercio@11
|
413 FlashAnimation:Stop()
|
|
Tercio@11
|
414 end
|
|
Tercio@11
|
415
|
|
Tercio@11
|
416 local flash = function (self, fadeInTime, fadeOutTime, flashDuration, showWhenDone, flashInHoldTime, flashOutHoldTime, loopType)
|
|
Tercio@11
|
417
|
|
Tercio@11
|
418 local FlashAnimation = self.FlashAnimation
|
|
Tercio@11
|
419
|
|
Tercio@11
|
420 local fadeIn = FlashAnimation.fadeIn
|
|
Tercio@11
|
421 local fadeOut = FlashAnimation.fadeOut
|
|
Tercio@11
|
422
|
|
Tercio@11
|
423 fadeIn:Stop()
|
|
Tercio@11
|
424 fadeOut:Stop()
|
|
Tercio@11
|
425
|
|
Tercio@11
|
426 fadeIn:SetDuration (fadeInTime or 1)
|
|
Tercio@11
|
427 fadeIn:SetEndDelay (flashInHoldTime or 0)
|
|
Tercio@11
|
428
|
|
Tercio@11
|
429 fadeOut:SetDuration (fadeOutTime or 1)
|
|
Tercio@11
|
430 fadeOut:SetEndDelay (flashOutHoldTime or 0)
|
|
Tercio@11
|
431
|
|
Tercio@11
|
432 FlashAnimation.duration = flashDuration
|
|
Tercio@11
|
433 FlashAnimation.loopTime = FlashAnimation:GetDuration()
|
|
Tercio@11
|
434 FlashAnimation.finishAt = GetTime() + flashDuration
|
|
Tercio@11
|
435 FlashAnimation.showWhenDone = showWhenDone
|
|
Tercio@11
|
436
|
|
Tercio@11
|
437 FlashAnimation:SetLooping (loopType or "REPEAT")
|
|
Tercio@11
|
438
|
|
Tercio@11
|
439 self:Show()
|
|
Tercio@11
|
440 self:SetAlpha (0)
|
|
Tercio@11
|
441 FlashAnimation:Play()
|
|
Tercio@11
|
442 end
|
|
Tercio@11
|
443
|
|
Tercio@11
|
444 function DF:CreateFlashAnimation (frame, onFinishFunc, onLoopFunc)
|
|
Tercio@11
|
445 local FlashAnimation = frame:CreateAnimationGroup()
|
|
Tercio@11
|
446
|
|
Tercio@11
|
447 FlashAnimation.fadeOut = FlashAnimation:CreateAnimation ("Alpha") --> fade out anime
|
|
Tercio@11
|
448 FlashAnimation.fadeOut:SetOrder (1)
|
|
Tercio@39
|
449 FlashAnimation.fadeOut:SetFromAlpha (0)
|
|
Tercio@39
|
450 FlashAnimation.fadeOut:SetToAlpha (1)
|
|
Tercio@11
|
451
|
|
Tercio@11
|
452 FlashAnimation.fadeIn = FlashAnimation:CreateAnimation ("Alpha") --> fade in anime
|
|
Tercio@11
|
453 FlashAnimation.fadeIn:SetOrder (2)
|
|
Tercio@39
|
454 FlashAnimation.fadeIn:SetFromAlpha (1)
|
|
Tercio@39
|
455 FlashAnimation.fadeIn:SetToAlpha (0)
|
|
Tercio@11
|
456
|
|
Tercio@11
|
457 frame.FlashAnimation = FlashAnimation
|
|
Tercio@11
|
458 FlashAnimation.frame = frame
|
|
Tercio@11
|
459 FlashAnimation.onFinishFunc = onFinishFunc
|
|
Tercio@11
|
460
|
|
Tercio@11
|
461 FlashAnimation:SetScript ("OnLoop", onLoopFunc)
|
|
Tercio@11
|
462 FlashAnimation:SetScript ("OnFinished", onFinish)
|
|
Tercio@11
|
463
|
|
Tercio@11
|
464 frame.Flash = flash
|
|
Tercio@11
|
465 frame.Stop = stop
|
|
Tercio@11
|
466 end
|
|
Tercio@11
|
467
|
|
Tercio@11
|
468 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
469 --> points
|
|
Tercio@11
|
470
|
|
Tercio@11
|
471 function DF:CheckPoints (v1, v2, v3, v4, v5, object)
|
|
Tercio@11
|
472
|
|
Tercio@11
|
473 if (not v1 and not v2) then
|
|
Tercio@11
|
474 return "topleft", object.widget:GetParent(), "topleft", 0, 0
|
|
Tercio@11
|
475 end
|
|
Tercio@11
|
476
|
|
Tercio@11
|
477 if (_type (v1) == "string") then
|
|
Tercio@11
|
478 local frameGlobal = _G [v1]
|
|
Tercio@53
|
479 if (frameGlobal and type (frameGlobal) == "table" and frameGlobal.GetObjectType) then
|
|
Tercio@11
|
480 return DF:CheckPoints (frameGlobal, v2, v3, v4, v5, object)
|
|
Tercio@11
|
481 end
|
|
Tercio@11
|
482
|
|
Tercio@11
|
483 elseif (_type (v2) == "string") then
|
|
Tercio@11
|
484 local frameGlobal = _G [v2]
|
|
Tercio@53
|
485 if (frameGlobal and type (frameGlobal) == "table" and frameGlobal.GetObjectType) then
|
|
Tercio@11
|
486 return DF:CheckPoints (v1, frameGlobal, v3, v4, v5, object)
|
|
Tercio@11
|
487 end
|
|
Tercio@11
|
488 end
|
|
Tercio@11
|
489
|
|
Tercio@11
|
490 if (_type (v1) == "string" and _type (v2) == "table") then --> :setpoint ("left", frame, _, _, _)
|
|
Tercio@11
|
491 if (not v3 or _type (v3) == "number") then --> :setpoint ("left", frame, 10, 10)
|
|
Tercio@11
|
492 v1, v2, v3, v4, v5 = v1, v2, v1, v3, v4
|
|
Tercio@11
|
493 end
|
|
Tercio@11
|
494
|
|
Tercio@11
|
495 elseif (_type (v1) == "string" and _type (v2) == "number") then --> :setpoint ("topleft", x, y)
|
|
Tercio@11
|
496 v1, v2, v3, v4, v5 = v1, object.widget:GetParent(), v1, v2, v3
|
|
Tercio@11
|
497
|
|
Tercio@11
|
498 elseif (_type (v1) == "number") then --> :setpoint (x, y)
|
|
Tercio@11
|
499 v1, v2, v3, v4, v5 = "topleft", object.widget:GetParent(), "topleft", v1, v2
|
|
Tercio@11
|
500
|
|
Tercio@11
|
501 elseif (_type (v1) == "table") then --> :setpoint (frame, x, y)
|
|
Tercio@11
|
502 v1, v2, v3, v4, v5 = "topleft", v1, "topleft", v2, v3
|
|
Tercio@11
|
503
|
|
Tercio@11
|
504 end
|
|
Tercio@11
|
505
|
|
Tercio@11
|
506 if (not v2) then
|
|
Tercio@11
|
507 v2 = object.widget:GetParent()
|
|
Tercio@11
|
508 elseif (v2.dframework) then
|
|
Tercio@11
|
509 v2 = v2.widget
|
|
Tercio@11
|
510 end
|
|
Tercio@11
|
511
|
|
Tercio@11
|
512 return v1 or "topleft", v2, v3 or "topleft", v4 or 0, v5 or 0
|
|
Tercio@11
|
513 end
|
|
Tercio@11
|
514
|
|
Tercio@58
|
515 local anchoring_functions = {
|
|
Tercio@58
|
516 function (frame, anchorTo, offSetX, offSetY) --> 1 TOP LEFT
|
|
Tercio@58
|
517 frame:ClearAllPoints()
|
|
Tercio@58
|
518 frame:SetPoint ("bottomleft", anchorTo, "topleft", offSetX, offSetY)
|
|
Tercio@58
|
519 end,
|
|
Tercio@58
|
520
|
|
Tercio@58
|
521 function (frame, anchorTo, offSetX, offSetY) --> 2 LEFT
|
|
Tercio@58
|
522 frame:ClearAllPoints()
|
|
Tercio@58
|
523 frame:SetPoint ("right", anchorTo, "left", offSetX, offSetY)
|
|
Tercio@58
|
524 end,
|
|
Tercio@58
|
525
|
|
Tercio@58
|
526 function (frame, anchorTo, offSetX, offSetY) --> 3 BOTTOM LEFT
|
|
Tercio@58
|
527 frame:ClearAllPoints()
|
|
Tercio@58
|
528 frame:SetPoint ("topleft", anchorTo, "bottomleft", offSetX, offSetY)
|
|
Tercio@58
|
529 end,
|
|
Tercio@58
|
530
|
|
Tercio@58
|
531 function (frame, anchorTo, offSetX, offSetY) --> 4 BOTTOM
|
|
Tercio@58
|
532 frame:ClearAllPoints()
|
|
Tercio@58
|
533 frame:SetPoint ("top", anchorTo, "bottom", offSetX, offSetY)
|
|
Tercio@58
|
534 end,
|
|
Tercio@58
|
535
|
|
Tercio@58
|
536 function (frame, anchorTo, offSetX, offSetY) --> 5 BOTTOM RIGHT
|
|
Tercio@58
|
537 frame:ClearAllPoints()
|
|
Tercio@58
|
538 frame:SetPoint ("topright", anchorTo, "bottomright", offSetX, offSetY)
|
|
Tercio@58
|
539 end,
|
|
Tercio@58
|
540
|
|
Tercio@58
|
541 function (frame, anchorTo, offSetX, offSetY) --> 6 RIGHT
|
|
Tercio@58
|
542 frame:ClearAllPoints()
|
|
Tercio@58
|
543 frame:SetPoint ("left", anchorTo, "right", offSetX, offSetY)
|
|
Tercio@58
|
544 end,
|
|
Tercio@58
|
545
|
|
Tercio@58
|
546 function (frame, anchorTo, offSetX, offSetY) --> 7 TOP RIGHT
|
|
Tercio@58
|
547 frame:ClearAllPoints()
|
|
Tercio@58
|
548 frame:SetPoint ("bottomright", anchorTo, "topright", offSetX, offSetY)
|
|
Tercio@58
|
549 end,
|
|
Tercio@58
|
550
|
|
Tercio@58
|
551 function (frame, anchorTo, offSetX, offSetY) --> 8 TOP
|
|
Tercio@58
|
552 frame:ClearAllPoints()
|
|
Tercio@58
|
553 frame:SetPoint ("bottom", anchorTo, "top", offSetX, offSetY)
|
|
Tercio@58
|
554 end,
|
|
Tercio@58
|
555
|
|
Tercio@58
|
556 function (frame, anchorTo, offSetX, offSetY) --> 9 CENTER
|
|
Tercio@58
|
557 frame:ClearAllPoints()
|
|
Tercio@58
|
558 frame:SetPoint ("center", anchorTo, "center", offSetX, offSetY)
|
|
Tercio@58
|
559 end,
|
|
Tercio@58
|
560
|
|
Tercio@58
|
561 function (frame, anchorTo, offSetX, offSetY) --> 10
|
|
Tercio@58
|
562 frame:ClearAllPoints()
|
|
Tercio@58
|
563 frame:SetPoint ("left", anchorTo, "left", offSetX, offSetY)
|
|
Tercio@58
|
564 end,
|
|
Tercio@58
|
565
|
|
Tercio@58
|
566 function (frame, anchorTo, offSetX, offSetY) --> 11
|
|
Tercio@58
|
567 frame:ClearAllPoints()
|
|
Tercio@58
|
568 frame:SetPoint ("right", anchorTo, "right", offSetX, offSetY)
|
|
Tercio@58
|
569 end,
|
|
Tercio@58
|
570
|
|
Tercio@58
|
571 function (frame, anchorTo, offSetX, offSetY) --> 12
|
|
Tercio@58
|
572 frame:ClearAllPoints()
|
|
Tercio@58
|
573 frame:SetPoint ("top", anchorTo, "top", offSetX, offSetY)
|
|
Tercio@58
|
574 end,
|
|
Tercio@58
|
575
|
|
Tercio@58
|
576 function (frame, anchorTo, offSetX, offSetY) --> 13
|
|
Tercio@58
|
577 frame:ClearAllPoints()
|
|
Tercio@58
|
578 frame:SetPoint ("bottom", anchorTo, "bottom", offSetX, offSetY)
|
|
Tercio@58
|
579 end
|
|
Tercio@58
|
580 }
|
|
Tercio@58
|
581
|
|
Tercio@58
|
582 function DF:SetAnchor (widget, config, anchorTo)
|
|
Tercio@58
|
583 anchorTo = anchorTo or widget:GetParent()
|
|
Tercio@58
|
584 anchoring_functions [config.side] (widget, anchorTo, config.x, config.y)
|
|
Tercio@58
|
585 end
|
|
Tercio@11
|
586
|
|
Tercio@11
|
587 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
588 --> colors
|
|
Tercio@11
|
589
|
|
Tercio@11
|
590 function DF:NewColor (_colorname, _colortable, _green, _blue, _alpha)
|
|
Tercio@11
|
591 assert (_type (_colorname) == "string", "NewColor: colorname must be a string.")
|
|
Tercio@11
|
592 assert (not DF.alias_text_colors [_colorname], "NewColor: colorname already exists.")
|
|
Tercio@11
|
593
|
|
Tercio@11
|
594 if (_type (_colortable) == "table") then
|
|
Tercio@11
|
595 if (_colortable[1] and _colortable[2] and _colortable[3]) then
|
|
Tercio@11
|
596 _colortable[4] = _colortable[4] or 1
|
|
Tercio@11
|
597 DF.alias_text_colors [_colorname] = _colortable
|
|
Tercio@11
|
598 else
|
|
Tercio@11
|
599 error ("invalid color table.")
|
|
Tercio@11
|
600 end
|
|
Tercio@11
|
601 elseif (_colortable and _green and _blue) then
|
|
Tercio@11
|
602 _alpha = _alpha or 1
|
|
Tercio@11
|
603 DF.alias_text_colors [_colorname] = {_colortable, _green, _blue, _alpha}
|
|
Tercio@11
|
604 else
|
|
Tercio@11
|
605 error ("invalid parameter.")
|
|
Tercio@11
|
606 end
|
|
Tercio@11
|
607
|
|
Tercio@11
|
608 return true
|
|
Tercio@11
|
609 end
|
|
Tercio@11
|
610
|
|
Tercio@11
|
611 function DF:IsHtmlColor (color)
|
|
Tercio@11
|
612 return DF.alias_text_colors [color]
|
|
Tercio@11
|
613 end
|
|
Tercio@11
|
614
|
|
Tercio@11
|
615 local tn = tonumber
|
|
Tercio@11
|
616 function DF:ParseColors (_arg1, _arg2, _arg3, _arg4)
|
|
Tercio@11
|
617 if (_type (_arg1) == "table") then
|
|
Tercio@25
|
618 if (not _arg1[1] and _arg1.r) then
|
|
Tercio@25
|
619 _arg1, _arg2, _arg3, _arg4 = _arg1.r, _arg1.g, _arg1.b, _arg1.a
|
|
Tercio@25
|
620 else
|
|
Tercio@25
|
621 _arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
|
|
Tercio@25
|
622 end
|
|
Tercio@11
|
623
|
|
Tercio@11
|
624 elseif (_type (_arg1) == "string") then
|
|
Tercio@11
|
625
|
|
Tercio@11
|
626 if (string.find (_arg1, "#")) then
|
|
Tercio@11
|
627 _arg1 = _arg1:gsub ("#","")
|
|
Tercio@11
|
628 if (string.len (_arg1) == 8) then --alpha
|
|
Tercio@11
|
629 _arg1, _arg2, _arg3, _arg4 = tn ("0x" .. _arg1:sub (3, 4))/255, tn ("0x" .. _arg1:sub (5, 6))/255, tn ("0x" .. _arg1:sub (7, 8))/255, tn ("0x" .. _arg1:sub (1, 2))/255
|
|
Tercio@11
|
630 else
|
|
Tercio@11
|
631 _arg1, _arg2, _arg3, _arg4 = tn ("0x" .. _arg1:sub (1, 2))/255, tn ("0x" .. _arg1:sub (3, 4))/255, tn ("0x" .. _arg1:sub (5, 6))/255, 1
|
|
Tercio@11
|
632 end
|
|
Tercio@11
|
633
|
|
Tercio@11
|
634 else
|
|
Tercio@11
|
635 local color = DF.alias_text_colors [_arg1]
|
|
Tercio@11
|
636 if (color) then
|
|
Tercio@11
|
637 _arg1, _arg2, _arg3, _arg4 = _unpack (color)
|
|
Tercio@11
|
638 else
|
|
Tercio@11
|
639 _arg1, _arg2, _arg3, _arg4 = _unpack (DF.alias_text_colors.none)
|
|
Tercio@11
|
640 end
|
|
Tercio@11
|
641 end
|
|
Tercio@11
|
642 end
|
|
Tercio@11
|
643
|
|
Tercio@11
|
644 if (not _arg1) then
|
|
Tercio@11
|
645 _arg1 = 1
|
|
Tercio@11
|
646 end
|
|
Tercio@11
|
647 if (not _arg2) then
|
|
Tercio@11
|
648 _arg2 = 1
|
|
Tercio@11
|
649 end
|
|
Tercio@11
|
650 if (not _arg3) then
|
|
Tercio@11
|
651 _arg3 = 1
|
|
Tercio@11
|
652 end
|
|
Tercio@11
|
653 if (not _arg4) then
|
|
Tercio@11
|
654 _arg4 = 1
|
|
Tercio@11
|
655 end
|
|
Tercio@11
|
656
|
|
Tercio@11
|
657 return _arg1, _arg2, _arg3, _arg4
|
|
Tercio@11
|
658 end
|
|
Tercio@11
|
659
|
|
Tercio@11
|
660 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
661 --> menus
|
|
Tercio@11
|
662
|
|
Tercio@39
|
663 local disable_on_combat = {}
|
|
Tercio@39
|
664
|
|
Tercio@22
|
665 function DF:BuildMenu (parent, menu, x_offset, y_offset, height, use_two_points, text_template, dropdown_template, switch_template, switch_is_box, slider_template, button_template)
|
|
Tercio@22
|
666
|
|
Tercio@22
|
667 if (not parent.widget_list) then
|
|
Tercio@22
|
668 DF:SetAsOptionsPanel (parent)
|
|
Tercio@22
|
669 end
|
|
Tercio@11
|
670
|
|
Tercio@11
|
671 local cur_x = x_offset
|
|
Tercio@11
|
672 local cur_y = y_offset
|
|
Tercio@11
|
673 local max_x = 0
|
|
Tercio@58
|
674 local line_widgets_created = 0 --how many widgets has been created on this line loop pass
|
|
Tercio@11
|
675
|
|
Tercio@11
|
676 height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20)
|
|
Tercio@11
|
677 height = height*-1
|
|
Tercio@11
|
678
|
|
Tercio@11
|
679 for index, widget_table in ipairs (menu) do
|
|
Tercio@11
|
680
|
|
Tercio@39
|
681 local widget_created
|
|
Tercio@39
|
682
|
|
Tercio@20
|
683 if (widget_table.type == "blank" or widget_table.type == "space") then
|
|
Tercio@20
|
684 -- do nothing
|
|
Tercio@20
|
685
|
|
Tercio@20
|
686 elseif (widget_table.type == "label" or widget_table.type == "text") then
|
|
Tercio@22
|
687 local label = DF:CreateLabel (parent, widget_table.get() or widget_table.text, widget_table.text_template or text_template or widget_table.size, widget_table.color, widget_table.font, nil, "$parentWidget" .. index, "overlay")
|
|
Tercio@20
|
688 label._get = widget_table.get
|
|
Tercio@20
|
689 label.widget_type = "label"
|
|
Tercio@20
|
690 label:SetPoint (cur_x, cur_y)
|
|
Tercio@20
|
691 tinsert (parent.widget_list, label)
|
|
Tercio@58
|
692 line_widgets_created = line_widgets_created + 1
|
|
Tercio@20
|
693
|
|
Tercio@20
|
694 elseif (widget_table.type == "select" or widget_table.type == "dropdown") then
|
|
Tercio@22
|
695 local dropdown = DF:NewDropDown (parent, nil, "$parentWidget" .. index, nil, 140, 18, widget_table.values, widget_table.get(), dropdown_template)
|
|
Tercio@11
|
696 dropdown.tooltip = widget_table.desc
|
|
Tercio@20
|
697 dropdown._get = widget_table.get
|
|
Tercio@20
|
698 dropdown.widget_type = "select"
|
|
Tercio@22
|
699 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
|
Tercio@11
|
700 dropdown:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
701 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
702
|
|
Tercio@11
|
703 local size = label.widget:GetStringWidth() + 140 + 4
|
|
Tercio@11
|
704 if (size > max_x) then
|
|
Tercio@11
|
705 max_x = size
|
|
Tercio@11
|
706 end
|
|
Tercio@11
|
707
|
|
Tercio@20
|
708 tinsert (parent.widget_list, dropdown)
|
|
Tercio@39
|
709 widget_created = dropdown
|
|
Tercio@58
|
710 line_widgets_created = line_widgets_created + 1
|
|
Tercio@20
|
711
|
|
Tercio@11
|
712 elseif (widget_table.type == "toggle" or widget_table.type == "switch") then
|
|
Tercio@22
|
713 local switch = DF:NewSwitch (parent, nil, "$parentWidget" .. index, nil, 60, 20, nil, nil, widget_table.get(), nil, nil, nil, nil, switch_template)
|
|
Tercio@11
|
714 switch.tooltip = widget_table.desc
|
|
Tercio@20
|
715 switch._get = widget_table.get
|
|
Tercio@20
|
716 switch.widget_type = "toggle"
|
|
Tercio@11
|
717 switch.OnSwitch = widget_table.set
|
|
Tercio@11
|
718
|
|
Tercio@22
|
719 if (switch_is_box) then
|
|
Tercio@22
|
720 switch:SetAsCheckBox()
|
|
Tercio@22
|
721 end
|
|
Tercio@22
|
722
|
|
Tercio@22
|
723 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
|
Tercio@11
|
724 switch:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
725 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
726
|
|
Tercio@11
|
727 local size = label.widget:GetStringWidth() + 60 + 4
|
|
Tercio@11
|
728 if (size > max_x) then
|
|
Tercio@11
|
729 max_x = size
|
|
Tercio@11
|
730 end
|
|
Tercio@11
|
731
|
|
Tercio@20
|
732 tinsert (parent.widget_list, switch)
|
|
Tercio@39
|
733 widget_created = switch
|
|
Tercio@58
|
734 line_widgets_created = line_widgets_created + 1
|
|
Tercio@20
|
735
|
|
Tercio@11
|
736 elseif (widget_table.type == "range" or widget_table.type == "slider") then
|
|
Tercio@11
|
737 local is_decimanls = widget_table.usedecimals
|
|
Tercio@22
|
738 local slider = DF:NewSlider (parent, nil, "$parentWidget" .. index, nil, 140, 20, widget_table.min, widget_table.max, widget_table.step, widget_table.get(), is_decimanls, nil, nil, slider_template)
|
|
Tercio@11
|
739 slider.tooltip = widget_table.desc
|
|
Tercio@20
|
740 slider._get = widget_table.get
|
|
Tercio@20
|
741 slider.widget_type = "range"
|
|
Tercio@11
|
742 slider:SetHook ("OnValueChange", widget_table.set)
|
|
Tercio@11
|
743
|
|
Tercio@40
|
744 if (widget_table.thumbscale) then
|
|
Tercio@40
|
745 slider:SetThumbSize (slider.thumb:GetWidth()*widget_table.thumbscale, nil)
|
|
Tercio@40
|
746 end
|
|
Tercio@40
|
747
|
|
Tercio@22
|
748 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
|
Tercio@11
|
749 slider:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
750 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
751
|
|
Tercio@11
|
752 local size = label.widget:GetStringWidth() + 140 + 6
|
|
Tercio@11
|
753 if (size > max_x) then
|
|
Tercio@11
|
754 max_x = size
|
|
Tercio@11
|
755 end
|
|
Tercio@11
|
756
|
|
Tercio@20
|
757 tinsert (parent.widget_list, slider)
|
|
Tercio@39
|
758 widget_created = slider
|
|
Tercio@58
|
759 line_widgets_created = line_widgets_created + 1
|
|
Tercio@20
|
760
|
|
Tercio@11
|
761 elseif (widget_table.type == "color" or widget_table.type == "color") then
|
|
Tercio@22
|
762 local colorpick = DF:NewColorPickButton (parent, "$parentWidget" .. index, nil, widget_table.set, nil, button_template)
|
|
Tercio@11
|
763 colorpick.tooltip = widget_table.desc
|
|
Tercio@20
|
764 colorpick._get = widget_table.get
|
|
Tercio@20
|
765 colorpick.widget_type = "color"
|
|
Tercio@11
|
766
|
|
Tercio@11
|
767 local default_value, g, b, a = widget_table.get()
|
|
Tercio@11
|
768 if (type (default_value) == "table") then
|
|
Tercio@11
|
769 colorpick:SetColor (unpack (default_value))
|
|
Tercio@11
|
770 else
|
|
Tercio@11
|
771 colorpick:SetColor (default_value, g, b, a)
|
|
Tercio@11
|
772 end
|
|
Tercio@11
|
773
|
|
Tercio@22
|
774 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
|
Tercio@11
|
775 colorpick:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
776 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
777
|
|
Tercio@11
|
778 local size = label.widget:GetStringWidth() + 60 + 4
|
|
Tercio@11
|
779 if (size > max_x) then
|
|
Tercio@11
|
780 max_x = size
|
|
Tercio@11
|
781 end
|
|
Tercio@11
|
782
|
|
Tercio@20
|
783 tinsert (parent.widget_list, colorpick)
|
|
Tercio@39
|
784 widget_created = colorpick
|
|
Tercio@58
|
785 line_widgets_created = line_widgets_created + 1
|
|
Tercio@20
|
786
|
|
Tercio@11
|
787 elseif (widget_table.type == "execute" or widget_table.type == "button") then
|
|
Tercio@11
|
788
|
|
Tercio@49
|
789 local button = DF:NewButton (parent, nil, "$parentWidget" .. index, nil, 120, 18, widget_table.func, widget_table.param1, widget_table.param2, nil, widget_table.name, nil, button_template, text_template)
|
|
Tercio@22
|
790 if (not button_template) then
|
|
Tercio@22
|
791 button:InstallCustomTexture()
|
|
Tercio@22
|
792 end
|
|
Tercio@22
|
793
|
|
Tercio@11
|
794 button:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
795 button.tooltip = widget_table.desc
|
|
Tercio@20
|
796 button.widget_type = "execute"
|
|
Tercio@11
|
797
|
|
Tercio@11
|
798 local size = button:GetWidth() + 4
|
|
Tercio@11
|
799 if (size > max_x) then
|
|
Tercio@11
|
800 max_x = size
|
|
Tercio@11
|
801 end
|
|
Tercio@11
|
802
|
|
Tercio@20
|
803 tinsert (parent.widget_list, button)
|
|
Tercio@39
|
804 widget_created = button
|
|
Tercio@58
|
805 line_widgets_created = line_widgets_created + 1
|
|
Tercio@49
|
806
|
|
Tercio@49
|
807 elseif (widget_table.type == "textentry") then
|
|
Tercio@49
|
808 local textentry = DF:CreateTextEntry (parent, widget_table.func, 120, 18, nil, "$parentWidget" .. index, nil, button_template)
|
|
Tercio@49
|
809 textentry.tooltip = widget_table.desc
|
|
Tercio@49
|
810 textentry.text = widget_table.get()
|
|
Tercio@49
|
811 textentry._get = widget_table.get
|
|
Tercio@49
|
812 textentry.widget_type = "textentry"
|
|
Tercio@49
|
813 textentry:SetHook ("OnEnterPressed", widget_table.set)
|
|
Tercio@49
|
814 textentry:SetHook ("OnEditFocusLost", widget_table.set)
|
|
Tercio@49
|
815
|
|
Tercio@49
|
816 local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
|
Tercio@49
|
817 textentry:SetPoint ("left", label, "right", 2)
|
|
Tercio@49
|
818 label:SetPoint (cur_x, cur_y)
|
|
Tercio@49
|
819
|
|
Tercio@49
|
820 local size = label.widget:GetStringWidth() + 60 + 4
|
|
Tercio@49
|
821 if (size > max_x) then
|
|
Tercio@49
|
822 max_x = size
|
|
Tercio@49
|
823 end
|
|
Tercio@49
|
824
|
|
Tercio@49
|
825 tinsert (parent.widget_list, textentry)
|
|
Tercio@49
|
826 widget_created = textentry
|
|
Tercio@58
|
827 line_widgets_created = line_widgets_created + 1
|
|
Tercio@49
|
828
|
|
Tercio@11
|
829 end
|
|
Tercio@39
|
830
|
|
Tercio@39
|
831 if (widget_table.nocombat) then
|
|
Tercio@39
|
832 tinsert (disable_on_combat, widget_created)
|
|
Tercio@39
|
833 end
|
|
Tercio@11
|
834
|
|
Tercio@11
|
835 if (widget_table.spacement) then
|
|
Tercio@11
|
836 cur_y = cur_y - 30
|
|
Tercio@11
|
837 else
|
|
Tercio@11
|
838 cur_y = cur_y - 20
|
|
Tercio@11
|
839 end
|
|
Tercio@11
|
840
|
|
Tercio@39
|
841 if (widget_table.type == "breakline" or cur_y < height) then
|
|
Tercio@11
|
842 cur_y = y_offset
|
|
Tercio@11
|
843 cur_x = cur_x + max_x + 30
|
|
Tercio@58
|
844 line_widgets_created = 0
|
|
Tercio@11
|
845 max_x = 0
|
|
Tercio@11
|
846 end
|
|
Tercio@11
|
847
|
|
Tercio@11
|
848 end
|
|
Tercio@11
|
849
|
|
Tercio@39
|
850 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
851
|
|
Tercio@11
|
852 end
|
|
Tercio@39
|
853
|
|
Tercio@39
|
854 local lock_notsafe_widgets = function()
|
|
Tercio@39
|
855 for _, widget in ipairs (disable_on_combat) do
|
|
Tercio@39
|
856 widget:Disable()
|
|
Tercio@39
|
857 end
|
|
Tercio@39
|
858 end
|
|
Tercio@39
|
859 local unlock_notsafe_widgets = function()
|
|
Tercio@39
|
860 for _, widget in ipairs (disable_on_combat) do
|
|
Tercio@39
|
861 widget:Enable()
|
|
Tercio@39
|
862 end
|
|
Tercio@39
|
863 end
|
|
Tercio@39
|
864 function DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
865 if (DF.PlayerHasCombatFlag) then
|
|
Tercio@39
|
866 lock_notsafe_widgets()
|
|
Tercio@39
|
867 else
|
|
Tercio@39
|
868 unlock_notsafe_widgets()
|
|
Tercio@39
|
869 end
|
|
Tercio@39
|
870 end
|
|
Tercio@39
|
871 DF.PlayerHasCombatFlag = false
|
|
Tercio@39
|
872 local ProtectCombatFrame = CreateFrame ("frame")
|
|
Tercio@39
|
873 ProtectCombatFrame:RegisterEvent ("PLAYER_REGEN_ENABLED")
|
|
Tercio@39
|
874 ProtectCombatFrame:RegisterEvent ("PLAYER_REGEN_DISABLED")
|
|
Tercio@39
|
875 ProtectCombatFrame:RegisterEvent ("PLAYER_ENTERING_WORLD")
|
|
Tercio@39
|
876 ProtectCombatFrame:SetScript ("OnEvent", function (self, event)
|
|
Tercio@39
|
877 if (event == "PLAYER_ENTERING_WORLD") then
|
|
Tercio@39
|
878 if (InCombatLockdown()) then
|
|
Tercio@39
|
879 DF.PlayerHasCombatFlag = true
|
|
Tercio@39
|
880 else
|
|
Tercio@39
|
881 DF.PlayerHasCombatFlag = false
|
|
Tercio@39
|
882 end
|
|
Tercio@39
|
883 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
884
|
|
Tercio@39
|
885 elseif (event == "PLAYER_REGEN_ENABLED") then
|
|
Tercio@39
|
886 DF.PlayerHasCombatFlag = false
|
|
Tercio@39
|
887 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
888
|
|
Tercio@39
|
889 elseif (event == "PLAYER_REGEN_DISABLED") then
|
|
Tercio@39
|
890 DF.PlayerHasCombatFlag = true
|
|
Tercio@39
|
891 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
892
|
|
Tercio@39
|
893 end
|
|
Tercio@39
|
894 end)
|
|
Tercio@40
|
895
|
|
Tercio@40
|
896 function DF:CreateInCombatTexture (frame)
|
|
Tercio@40
|
897 if (DF.debug and not frame) then
|
|
Tercio@40
|
898 error ("Details! Framework: CreateInCombatTexture invalid frame on parameter 1.")
|
|
Tercio@40
|
899 end
|
|
Tercio@40
|
900
|
|
Tercio@40
|
901 local in_combat_background = DF:CreateImage (frame)
|
|
Tercio@40
|
902 in_combat_background:SetColorTexture (.6, 0, 0, .1)
|
|
Tercio@40
|
903 in_combat_background:Hide()
|
|
Tercio@40
|
904
|
|
Tercio@40
|
905 local in_combat_label = Plater:CreateLabel (frame, "you are in combat", 24, "silver")
|
|
Tercio@40
|
906 in_combat_label:SetPoint ("right", in_combat_background, "right", -10, 0)
|
|
Tercio@40
|
907 in_combat_label:Hide()
|
|
Tercio@40
|
908
|
|
Tercio@40
|
909 frame:RegisterEvent ("PLAYER_REGEN_DISABLED")
|
|
Tercio@40
|
910 frame:RegisterEvent ("PLAYER_REGEN_ENABLED")
|
|
Tercio@40
|
911 frame:SetScript ("OnEvent", function (self, event)
|
|
Tercio@40
|
912 if (event == "PLAYER_REGEN_DISABLED") then
|
|
Tercio@40
|
913 in_combat_background:Show()
|
|
Tercio@40
|
914 in_combat_label:Show()
|
|
Tercio@40
|
915 elseif (event == "PLAYER_REGEN_ENABLED") then
|
|
Tercio@40
|
916 in_combat_background:Hide()
|
|
Tercio@40
|
917 in_combat_label:Hide()
|
|
Tercio@40
|
918 end
|
|
Tercio@40
|
919 end)
|
|
Tercio@40
|
920
|
|
Tercio@40
|
921 return in_combat_background
|
|
Tercio@40
|
922 end
|
|
Tercio@11
|
923
|
|
Tercio@11
|
924 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
925 --> tutorials
|
|
Tercio@11
|
926
|
|
Tercio@11
|
927 function DF:ShowTutorialAlertFrame (maintext, desctext, clickfunc)
|
|
Tercio@11
|
928
|
|
Tercio@11
|
929 local TutorialAlertFrame = _G.DetailsFrameworkTutorialAlertFrame
|
|
Tercio@11
|
930
|
|
Tercio@11
|
931 if (not TutorialAlertFrame) then
|
|
Tercio@11
|
932
|
|
Tercio@11
|
933 TutorialAlertFrame = CreateFrame ("ScrollFrame", "DetailsFrameworkTutorialAlertFrame", UIParent, "DetailsFrameworkTutorialAlertFrameTemplate")
|
|
Tercio@11
|
934 TutorialAlertFrame.isFirst = true
|
|
Tercio@11
|
935 TutorialAlertFrame:SetPoint ("left", UIParent, "left", -20, 100)
|
|
Tercio@11
|
936
|
|
Tercio@11
|
937 TutorialAlertFrame:SetWidth (290)
|
|
Tercio@11
|
938 TutorialAlertFrame.ScrollChild:SetWidth (256)
|
|
Tercio@11
|
939
|
|
Tercio@11
|
940 local scrollname = TutorialAlertFrame.ScrollChild:GetName()
|
|
Tercio@11
|
941 _G [scrollname .. "BorderTopLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
942 _G [scrollname .. "BorderTopRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
943 _G [scrollname .. "BorderBotLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
944 _G [scrollname .. "BorderBotRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
945 _G [scrollname .. "BorderLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
946 _G [scrollname .. "BorderRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
947 _G [scrollname .. "BorderBottom"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
948 _G [scrollname .. "BorderTop"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
949
|
|
Tercio@11
|
950 local iconbg = _G [scrollname .. "QuestIconBg"]
|
|
Tercio@11
|
951 iconbg:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
|
|
Tercio@11
|
952 iconbg:SetTexCoord (0, 1, 0, 1)
|
|
Tercio@11
|
953 iconbg:SetSize (100, 100)
|
|
Tercio@11
|
954 iconbg:ClearAllPoints()
|
|
Tercio@11
|
955 iconbg:SetPoint ("bottomleft", TutorialAlertFrame.ScrollChild, "bottomleft")
|
|
Tercio@11
|
956
|
|
Tercio@11
|
957 _G [scrollname .. "Exclamation"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
958 _G [scrollname .. "QuestionMark"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
959
|
|
Tercio@11
|
960 _G [scrollname .. "TopText"]:SetText ("Details!") --string
|
|
Tercio@11
|
961 _G [scrollname .. "QuestName"]:SetText ("") --string
|
|
Tercio@11
|
962 _G [scrollname .. "BottomText"]:SetText ("") --string
|
|
Tercio@11
|
963
|
|
Tercio@11
|
964 TutorialAlertFrame.ScrollChild.IconShine:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
|
|
Tercio@11
|
965
|
|
Tercio@11
|
966 TutorialAlertFrame:SetScript ("OnMouseUp", function (self)
|
|
Tercio@11
|
967 if (self.clickfunc and type (self.clickfunc) == "function") then
|
|
Tercio@11
|
968 self.clickfunc()
|
|
Tercio@11
|
969 end
|
|
Tercio@11
|
970 self:Hide()
|
|
Tercio@11
|
971 end)
|
|
Tercio@11
|
972 TutorialAlertFrame:Hide()
|
|
Tercio@11
|
973 end
|
|
Tercio@11
|
974
|
|
Tercio@11
|
975 if (type (maintext) == "string") then
|
|
Tercio@11
|
976 TutorialAlertFrame.ScrollChild.QuestName:SetText (maintext)
|
|
Tercio@11
|
977 else
|
|
Tercio@11
|
978 TutorialAlertFrame.ScrollChild.QuestName:SetText ("")
|
|
Tercio@11
|
979 end
|
|
Tercio@11
|
980
|
|
Tercio@11
|
981 if (type (desctext) == "string") then
|
|
Tercio@11
|
982 TutorialAlertFrame.ScrollChild.BottomText:SetText (desctext)
|
|
Tercio@11
|
983 else
|
|
Tercio@11
|
984 TutorialAlertFrame.ScrollChild.BottomText:SetText ("")
|
|
Tercio@11
|
985 end
|
|
Tercio@11
|
986
|
|
Tercio@11
|
987 TutorialAlertFrame.clickfunc = clickfunc
|
|
Tercio@11
|
988 TutorialAlertFrame:Show()
|
|
Tercio@11
|
989 DetailsTutorialAlertFrame_SlideInFrame (TutorialAlertFrame, "AUTOQUEST")
|
|
Tercio@11
|
990 end
|
|
Tercio@11
|
991
|
|
Tercio@20
|
992 local refresh_options = function (self)
|
|
Tercio@20
|
993 for _, widget in ipairs (self.widget_list) do
|
|
Tercio@20
|
994 if (widget._get) then
|
|
Tercio@20
|
995 if (widget.widget_type == "label") then
|
|
Tercio@20
|
996 if (widget._get()) then
|
|
Tercio@20
|
997 widget:SetText (widget._get())
|
|
Tercio@20
|
998 end
|
|
Tercio@20
|
999 elseif (widget.widget_type == "select") then
|
|
Tercio@20
|
1000 widget:Select (widget._get())
|
|
Tercio@20
|
1001 elseif (widget.widget_type == "toggle" or widget.widget_type == "range") then
|
|
Tercio@20
|
1002 widget:SetValue (widget._get())
|
|
Tercio@49
|
1003 elseif (widget.widget_type == "textentry") then
|
|
Tercio@49
|
1004 widget:SetText (widget._get())
|
|
Tercio@20
|
1005 elseif (widget.widget_type == "color") then
|
|
Tercio@20
|
1006 local default_value, g, b, a = widget._get()
|
|
Tercio@20
|
1007 if (type (default_value) == "table") then
|
|
Tercio@20
|
1008 widget:SetColor (unpack (default_value))
|
|
Tercio@20
|
1009 else
|
|
Tercio@20
|
1010 widget:SetColor (default_value, g, b, a)
|
|
Tercio@20
|
1011 end
|
|
Tercio@20
|
1012 end
|
|
Tercio@20
|
1013 end
|
|
Tercio@20
|
1014 end
|
|
Tercio@20
|
1015 end
|
|
Tercio@20
|
1016
|
|
Tercio@20
|
1017 function DF:SetAsOptionsPanel (frame)
|
|
Tercio@20
|
1018 frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
1019 frame.widget_list = {}
|
|
Tercio@20
|
1020 end
|
|
Tercio@20
|
1021
|
|
Tercio@11
|
1022 function DF:CreateOptionsFrame (name, title, template)
|
|
Tercio@11
|
1023
|
|
Tercio@11
|
1024 template = template or 1
|
|
Tercio@11
|
1025
|
|
Tercio@11
|
1026 if (template == 2) then
|
|
Tercio@11
|
1027 local options_frame = CreateFrame ("frame", name, UIParent, "ButtonFrameTemplate")
|
|
Tercio@11
|
1028 tinsert (UISpecialFrames, name)
|
|
Tercio@11
|
1029 options_frame:SetSize (500, 200)
|
|
Tercio@20
|
1030 options_frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
1031 options_frame.widget_list = {}
|
|
Tercio@11
|
1032
|
|
Tercio@11
|
1033 options_frame:SetScript ("OnMouseDown", function(self, button)
|
|
Tercio@11
|
1034 if (button == "RightButton") then
|
|
Tercio@11
|
1035 if (self.moving) then
|
|
Tercio@11
|
1036 self.moving = false
|
|
Tercio@11
|
1037 self:StopMovingOrSizing()
|
|
Tercio@11
|
1038 end
|
|
Tercio@11
|
1039 return options_frame:Hide()
|
|
Tercio@11
|
1040 elseif (button == "LeftButton" and not self.moving) then
|
|
Tercio@11
|
1041 self.moving = true
|
|
Tercio@11
|
1042 self:StartMoving()
|
|
Tercio@11
|
1043 end
|
|
Tercio@11
|
1044 end)
|
|
Tercio@11
|
1045 options_frame:SetScript ("OnMouseUp", function(self)
|
|
Tercio@11
|
1046 if (self.moving) then
|
|
Tercio@11
|
1047 self.moving = false
|
|
Tercio@11
|
1048 self:StopMovingOrSizing()
|
|
Tercio@11
|
1049 end
|
|
Tercio@11
|
1050 end)
|
|
Tercio@11
|
1051
|
|
Tercio@11
|
1052 options_frame:SetMovable (true)
|
|
Tercio@11
|
1053 options_frame:EnableMouse (true)
|
|
Tercio@11
|
1054 options_frame:SetFrameStrata ("DIALOG")
|
|
Tercio@11
|
1055 options_frame:SetToplevel (true)
|
|
Tercio@11
|
1056
|
|
Tercio@11
|
1057 options_frame:Hide()
|
|
Tercio@11
|
1058
|
|
Tercio@11
|
1059 options_frame:SetPoint ("center", UIParent, "center")
|
|
Tercio@11
|
1060 options_frame.TitleText:SetText (title)
|
|
Tercio@11
|
1061 options_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]])
|
|
Tercio@11
|
1062
|
|
Tercio@11
|
1063 return options_frame
|
|
Tercio@11
|
1064
|
|
Tercio@11
|
1065 elseif (template == 1) then
|
|
Tercio@11
|
1066
|
|
Tercio@11
|
1067 local options_frame = CreateFrame ("frame", name, UIParent)
|
|
Tercio@11
|
1068 tinsert (UISpecialFrames, name)
|
|
Tercio@11
|
1069 options_frame:SetSize (500, 200)
|
|
Tercio@20
|
1070 options_frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
1071 options_frame.widget_list = {}
|
|
Tercio@11
|
1072
|
|
Tercio@11
|
1073 options_frame:SetScript ("OnMouseDown", function(self, button)
|
|
Tercio@11
|
1074 if (button == "RightButton") then
|
|
Tercio@11
|
1075 if (self.moving) then
|
|
Tercio@11
|
1076 self.moving = false
|
|
Tercio@11
|
1077 self:StopMovingOrSizing()
|
|
Tercio@11
|
1078 end
|
|
Tercio@11
|
1079 return options_frame:Hide()
|
|
Tercio@11
|
1080 elseif (button == "LeftButton" and not self.moving) then
|
|
Tercio@11
|
1081 self.moving = true
|
|
Tercio@11
|
1082 self:StartMoving()
|
|
Tercio@11
|
1083 end
|
|
Tercio@11
|
1084 end)
|
|
Tercio@11
|
1085 options_frame:SetScript ("OnMouseUp", function(self)
|
|
Tercio@11
|
1086 if (self.moving) then
|
|
Tercio@11
|
1087 self.moving = false
|
|
Tercio@11
|
1088 self:StopMovingOrSizing()
|
|
Tercio@11
|
1089 end
|
|
Tercio@11
|
1090 end)
|
|
Tercio@11
|
1091
|
|
Tercio@11
|
1092 options_frame:SetMovable (true)
|
|
Tercio@11
|
1093 options_frame:EnableMouse (true)
|
|
Tercio@11
|
1094 options_frame:SetFrameStrata ("DIALOG")
|
|
Tercio@11
|
1095 options_frame:SetToplevel (true)
|
|
Tercio@11
|
1096
|
|
Tercio@11
|
1097 options_frame:Hide()
|
|
Tercio@11
|
1098
|
|
Tercio@11
|
1099 options_frame:SetPoint ("center", UIParent, "center")
|
|
Tercio@11
|
1100
|
|
Tercio@11
|
1101 options_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
|
|
Tercio@18
|
1102 edgeFile = DF.folder .. "border_2", edgeSize = 32,
|
|
Tercio@11
|
1103 insets = {left = 1, right = 1, top = 1, bottom = 1}})
|
|
Tercio@11
|
1104 options_frame:SetBackdropColor (0, 0, 0, .7)
|
|
Tercio@11
|
1105
|
|
Tercio@11
|
1106 local texturetitle = options_frame:CreateTexture (nil, "artwork")
|
|
Tercio@11
|
1107 texturetitle:SetTexture ([[Interface\CURSOR\Interact]])
|
|
Tercio@11
|
1108 texturetitle:SetTexCoord (0, 1, 0, 1)
|
|
Tercio@11
|
1109 texturetitle:SetVertexColor (1, 1, 1, 1)
|
|
Tercio@11
|
1110 texturetitle:SetPoint ("topleft", options_frame, "topleft", 2, -3)
|
|
Tercio@11
|
1111 texturetitle:SetWidth (36)
|
|
Tercio@11
|
1112 texturetitle:SetHeight (36)
|
|
Tercio@11
|
1113
|
|
Tercio@11
|
1114 local title = DF:NewLabel (options_frame, nil, "$parentTitle", nil, title, nil, 20, "yellow")
|
|
Tercio@11
|
1115 title:SetPoint ("left", texturetitle, "right", 2, -1)
|
|
Tercio@11
|
1116 DF:SetFontOutline (title, true)
|
|
Tercio@11
|
1117
|
|
Tercio@11
|
1118 local c = CreateFrame ("Button", nil, options_frame, "UIPanelCloseButton")
|
|
Tercio@11
|
1119 c:SetWidth (32)
|
|
Tercio@11
|
1120 c:SetHeight (32)
|
|
Tercio@11
|
1121 c:SetPoint ("TOPRIGHT", options_frame, "TOPRIGHT", -3, -3)
|
|
Tercio@11
|
1122 c:SetFrameLevel (options_frame:GetFrameLevel()+1)
|
|
Tercio@11
|
1123
|
|
Tercio@11
|
1124 return options_frame
|
|
Tercio@11
|
1125 end
|
|
Tercio@22
|
1126 end
|
|
Tercio@22
|
1127
|
|
Tercio@22
|
1128 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@22
|
1129 --> templates
|
|
Tercio@22
|
1130
|
|
Tercio@56
|
1131 --fonts
|
|
Tercio@56
|
1132
|
|
Tercio@56
|
1133 DF.font_templates = DF.font_templates or {}
|
|
Tercio@22
|
1134 DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
|
|
Tercio@22
|
1135 DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
|
|
Tercio@22
|
1136
|
|
Tercio@56
|
1137 -- dropdowns
|
|
Tercio@56
|
1138
|
|
Tercio@56
|
1139 DF.dropdown_templates = DF.dropdown_templates or {}
|
|
Tercio@22
|
1140 DF.dropdown_templates ["OPTIONS_DROPDOWN_TEMPLATE"] = {
|
|
Tercio@22
|
1141 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
1142 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1143 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
1144 onentercolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1145 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
1146 }
|
|
Tercio@22
|
1147
|
|
Tercio@56
|
1148 -- switches
|
|
Tercio@56
|
1149
|
|
Tercio@56
|
1150 DF.switch_templates = DF.switch_templates or {}
|
|
Tercio@22
|
1151 DF.switch_templates ["OPTIONS_CHECKBOX_TEMPLATE"] = {
|
|
Tercio@22
|
1152 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
1153 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1154 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
1155 width = 18,
|
|
Tercio@22
|
1156 height = 18,
|
|
Tercio@22
|
1157 enabled_backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1158 disabled_backdropcolor = {1, 1, 1, .2},
|
|
Tercio@22
|
1159 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
1160 }
|
|
Tercio@22
|
1161 DF.switch_templates ["OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"] = {
|
|
Tercio@22
|
1162 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
1163 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1164 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
1165 width = 18,
|
|
Tercio@22
|
1166 height = 18,
|
|
Tercio@22
|
1167 enabled_backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1168 disabled_backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1169 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
1170 }
|
|
Tercio@22
|
1171
|
|
Tercio@56
|
1172 -- buttons
|
|
Tercio@56
|
1173
|
|
Tercio@56
|
1174 DF.button_templates = DF.button_templates or {}
|
|
Tercio@22
|
1175 DF.button_templates ["OPTIONS_BUTTON_TEMPLATE"] = {
|
|
Tercio@22
|
1176 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
1177 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1178 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
1179 }
|
|
Tercio@22
|
1180
|
|
Tercio@56
|
1181 -- sliders
|
|
Tercio@56
|
1182
|
|
Tercio@56
|
1183 DF.slider_templates = DF.slider_templates or {}
|
|
Tercio@22
|
1184 DF.slider_templates ["OPTIONS_SLIDER_TEMPLATE"] = {
|
|
Tercio@22
|
1185 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
1186 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1187 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
1188 onentercolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1189 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
1190 thumbtexture = [[Interface\Tooltips\UI-Tooltip-Background]],
|
|
Tercio@22
|
1191 thumbwidth = 16,
|
|
Tercio@22
|
1192 thumbheight = 14,
|
|
Tercio@22
|
1193 thumbcolor = {0, 0, 0, 0.5},
|
|
Tercio@22
|
1194 }
|
|
Tercio@22
|
1195
|
|
Tercio@56
|
1196 function DF:InstallTemplate (widget_type, template_name, template, parent_name)
|
|
Tercio@56
|
1197
|
|
Tercio@56
|
1198 local newTemplate = {}
|
|
Tercio@56
|
1199
|
|
Tercio@56
|
1200 --if has a parent, just copy the parent to the new template
|
|
Tercio@56
|
1201 if (parent_name and type (parent_name) == "string") then
|
|
Tercio@56
|
1202 local parentTemplate = DF:GetTemplate (widget_type, parent_name)
|
|
Tercio@56
|
1203 if (parentTemplate) then
|
|
Tercio@56
|
1204 DF.table.copy (newTemplate, parentTemplate)
|
|
Tercio@56
|
1205 end
|
|
Tercio@56
|
1206 end
|
|
Tercio@56
|
1207
|
|
Tercio@56
|
1208 --copy the template passed into the new template
|
|
Tercio@56
|
1209 DF.table.copy (newTemplate, template)
|
|
Tercio@56
|
1210
|
|
Tercioo@29
|
1211 widget_type = string.lower (widget_type)
|
|
Tercioo@29
|
1212
|
|
Tercio@22
|
1213 local template_table
|
|
Tercioo@29
|
1214 if (widget_type == "font") then
|
|
Tercio@22
|
1215 template_table = DF.font_templates
|
|
Tercioo@29
|
1216 elseif (widget_type == "dropdown") then
|
|
Tercio@22
|
1217 template_table = DF.dropdown_templates
|
|
Tercioo@29
|
1218 elseif (widget_type == "button") then
|
|
Tercio@22
|
1219 template_table = DF.button_templates
|
|
Tercioo@29
|
1220 elseif (widget_type == "switch") then
|
|
Tercio@22
|
1221 template_table = DF.switch_templates
|
|
Tercioo@29
|
1222 elseif (widget_type == "slider") then
|
|
Tercioo@29
|
1223 template_table = DF.slider_templates
|
|
Tercioo@29
|
1224 end
|
|
Tercioo@29
|
1225
|
|
Tercio@56
|
1226 template_table [template_name] = newTemplate
|
|
Tercioo@29
|
1227
|
|
Tercio@56
|
1228 return newTemplate
|
|
Tercioo@29
|
1229 end
|
|
Tercioo@29
|
1230
|
|
Tercioo@29
|
1231 function DF:GetTemplate (widget_type, template_name)
|
|
Tercioo@29
|
1232 widget_type = string.lower (widget_type)
|
|
Tercioo@29
|
1233
|
|
Tercioo@29
|
1234 local template_table
|
|
Tercioo@29
|
1235 if (widget_type == "font") then
|
|
Tercioo@29
|
1236 template_table = DF.font_templates
|
|
Tercioo@29
|
1237 elseif (widget_type == "dropdown") then
|
|
Tercioo@29
|
1238 template_table = DF.dropdown_templates
|
|
Tercioo@29
|
1239 elseif (widget_type == "button") then
|
|
Tercioo@29
|
1240 template_table = DF.button_templates
|
|
Tercioo@29
|
1241 elseif (widget_type == "switch") then
|
|
Tercioo@29
|
1242 template_table = DF.switch_templates
|
|
Tercioo@29
|
1243 elseif (widget_type == "slider") then
|
|
Tercio@22
|
1244 template_table = DF.slider_templates
|
|
Tercio@22
|
1245 end
|
|
Tercio@22
|
1246 return template_table [template_name]
|
|
Tercio@22
|
1247 end
|
|
Tercioo@28
|
1248
|
|
Tercioo@28
|
1249 function DF.GetParentName (frame)
|
|
Tercioo@28
|
1250 local parentName = frame:GetName()
|
|
Tercioo@28
|
1251 if (not parentName) then
|
|
Tercioo@28
|
1252 error ("Details! FrameWork: called $parent but parent was no name.", 2)
|
|
Tercioo@28
|
1253 end
|
|
Tercioo@28
|
1254 return parentName
|
|
Tercioo@28
|
1255 end
|
|
Tercio@39
|
1256
|
|
Tercio@39
|
1257 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@39
|
1258 --> widget scripts and hooks
|
|
Tercio@39
|
1259
|
|
Tercio@39
|
1260 function DF:RunHooksForWidget (event, ...)
|
|
Tercio@39
|
1261 local hooks = self.HookList [event]
|
|
Tercio@39
|
1262
|
|
Tercio@39
|
1263 if (not hooks) then
|
|
Tercio@39
|
1264 print (self.widget:GetName(), "sem hook para", event)
|
|
Tercio@39
|
1265 return
|
|
Tercio@39
|
1266 end
|
|
Tercio@39
|
1267
|
|
Tercio@39
|
1268 for i, func in ipairs (hooks) do
|
|
Tercio@39
|
1269 local success, canInterrupt = pcall (func, ...)
|
|
Tercio@39
|
1270 if (not success) then
|
|
Tercio@39
|
1271 error ("Details! Framework: " .. event .. " hook for " .. self:GetName() .. ": " .. canInterrupt)
|
|
Tercio@39
|
1272 elseif (canInterrupt) then
|
|
Tercio@39
|
1273 return true
|
|
Tercio@39
|
1274 end
|
|
Tercio@39
|
1275 end
|
|
Tercio@39
|
1276 end
|
|
Tercio@39
|
1277
|
|
Tercio@39
|
1278 function DF:SetHook (hookType, func)
|
|
Tercio@39
|
1279 if (self.HookList [hookType]) then
|
|
Tercio@39
|
1280 if (type (func) == "function") then
|
|
Tercio@39
|
1281 local isRemoval = false
|
|
Tercio@39
|
1282 for i = #self.HookList [hookType], 1, -1 do
|
|
Tercio@39
|
1283 if (self.HookList [hookType] [i] == func) then
|
|
Tercio@39
|
1284 tremove (self.HookList [hookType], i)
|
|
Tercio@39
|
1285 isRemoval = true
|
|
Tercio@39
|
1286 break
|
|
Tercio@39
|
1287 end
|
|
Tercio@39
|
1288 end
|
|
Tercio@39
|
1289 if (not isRemoval) then
|
|
Tercio@39
|
1290 tinsert (self.HookList [hookType], func)
|
|
Tercio@39
|
1291 end
|
|
Tercio@39
|
1292 else
|
|
Tercio@39
|
1293 if (DF.debug) then
|
|
Tercio@39
|
1294 error ("Details! Framework: invalid function for widget " .. self.WidgetType .. ".")
|
|
Tercio@39
|
1295 end
|
|
Tercio@39
|
1296 end
|
|
Tercio@39
|
1297 else
|
|
Tercio@39
|
1298 if (DF.debug) then
|
|
Tercio@39
|
1299 error ("Details! Framework: unknown hook type for widget " .. self.WidgetType .. ": '" .. hookType .. "'.")
|
|
Tercio@39
|
1300 end
|
|
Tercio@39
|
1301 end
|
|
Tercio@39
|
1302 end
|
|
Tercio@39
|
1303
|
|
Tercio@39
|
1304 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@39
|
1305 --> members
|
|
Tercio@39
|
1306
|
|
Tercio@39
|
1307 DF.GlobalWidgetControlNames = {
|
|
Tercio@39
|
1308 textentry = "DF_TextEntryMetaFunctions",
|
|
Tercio@39
|
1309 button = "DF_ButtonMetaFunctions",
|
|
Tercio@39
|
1310 panel = "DF_PanelMetaFunctions",
|
|
Tercio@39
|
1311 dropdown = "DF_DropdownMetaFunctions",
|
|
Tercio@39
|
1312 label = "DF_LabelMetaFunctions",
|
|
Tercio@39
|
1313 normal_bar = "DF_NormalBarMetaFunctions",
|
|
Tercio@39
|
1314 image = "DF_ImageMetaFunctions",
|
|
Tercio@39
|
1315 slider = "DF_SliderMetaFunctions",
|
|
Tercio@39
|
1316 split_bar = "DF_SplitBarMetaFunctions",
|
|
Tercio@40
|
1317 aura_tracker = "DF_AuraTracker",
|
|
Tercio@39
|
1318 }
|
|
Tercio@39
|
1319
|
|
Tercio@39
|
1320 function DF:AddMemberForWidget (widgetName, memberType, memberName, func)
|
|
Tercio@39
|
1321 if (DF.GlobalWidgetControlNames [widgetName]) then
|
|
Tercio@39
|
1322 if (type (memberName) == "string" and (memberType == "SET" or memberType == "GET")) then
|
|
Tercio@39
|
1323 if (func) then
|
|
Tercio@39
|
1324 local widgetControlObject = _G [DF.GlobalWidgetControlNames [widgetName]]
|
|
Tercio@39
|
1325
|
|
Tercio@39
|
1326 if (memberType == "SET") then
|
|
Tercio@39
|
1327 widgetControlObject ["SetMembers"] [memberName] = func
|
|
Tercio@39
|
1328 elseif (memberType == "GET") then
|
|
Tercio@39
|
1329 widgetControlObject ["GetMembers"] [memberName] = func
|
|
Tercio@39
|
1330 end
|
|
Tercio@39
|
1331 else
|
|
Tercio@39
|
1332 if (DF.debug) then
|
|
Tercio@39
|
1333 error ("Details! Framework: AddMemberForWidget invalid function.")
|
|
Tercio@39
|
1334 end
|
|
Tercio@39
|
1335 end
|
|
Tercio@39
|
1336 else
|
|
Tercio@39
|
1337 if (DF.debug) then
|
|
Tercio@39
|
1338 error ("Details! Framework: AddMemberForWidget unknown memberName or memberType.")
|
|
Tercio@39
|
1339 end
|
|
Tercio@39
|
1340 end
|
|
Tercio@39
|
1341 else
|
|
Tercio@39
|
1342 if (DF.debug) then
|
|
Tercio@39
|
1343 error ("Details! Framework: AddMemberForWidget unknown widget type: " .. (widgetName or "") .. ".")
|
|
Tercio@39
|
1344 end
|
|
Tercio@39
|
1345 end
|
|
Tercio@39
|
1346 end
|
|
Tercio@39
|
1347
|
|
Tercio@39
|
1348 -----------------------------
|
|
Tercio@39
|
1349
|
|
Tercio@39
|
1350 function DF:OpenInterfaceProfile()
|
|
Tercio@39
|
1351 InterfaceOptionsFrame_OpenToCategory (self.__name)
|
|
Tercio@39
|
1352 InterfaceOptionsFrame_OpenToCategory (self.__name)
|
|
Tercio@39
|
1353 for i = 1, 100 do
|
|
Tercio@39
|
1354 local button = _G ["InterfaceOptionsFrameAddOnsButton" .. i]
|
|
Tercio@39
|
1355 if (button) then
|
|
Tercio@39
|
1356 local text = _G ["InterfaceOptionsFrameAddOnsButton" .. i .. "Text"]
|
|
Tercio@39
|
1357 if (text) then
|
|
Tercio@39
|
1358 text = text:GetText()
|
|
Tercio@39
|
1359 if (text == self.__name) then
|
|
Tercio@39
|
1360 local toggle = _G ["InterfaceOptionsFrameAddOnsButton" .. i .. "Toggle"]
|
|
Tercio@39
|
1361 if (toggle) then
|
|
Tercio@39
|
1362 if (toggle:GetNormalTexture():GetTexture():find ("PlusButton")) then
|
|
Tercio@39
|
1363 --is minimized, need expand
|
|
Tercio@39
|
1364 toggle:Click()
|
|
Tercio@39
|
1365 _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click()
|
|
Tercio@39
|
1366 elseif (toggle:GetNormalTexture():GetTexture():find ("MinusButton")) then
|
|
Tercio@39
|
1367 --isn't minimized
|
|
Tercio@39
|
1368 _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click()
|
|
Tercio@39
|
1369 end
|
|
Tercio@39
|
1370 end
|
|
Tercio@39
|
1371 break
|
|
Tercio@39
|
1372 end
|
|
Tercio@39
|
1373 end
|
|
Tercio@39
|
1374 else
|
|
Tercio@39
|
1375 self:Msg ("Couldn't not find the profile panel.")
|
|
Tercio@39
|
1376 break
|
|
Tercio@39
|
1377 end
|
|
Tercio@39
|
1378 end
|
|
Tercio@39
|
1379 end
|
|
Tercio@39
|
1380
|
|
Tercio@39
|
1381 -----------------------------
|
|
Tercio@39
|
1382 --safe copy from blizz api
|
|
Tercio@39
|
1383 function DF:Mixin (object, ...)
|
|
Tercio@39
|
1384 for i = 1, select("#", ...) do
|
|
Tercio@39
|
1385 local mixin = select(i, ...);
|
|
Tercio@39
|
1386 for k, v in pairs(mixin) do
|
|
Tercio@39
|
1387 object[k] = v;
|
|
Tercio@39
|
1388 end
|
|
Tercio@39
|
1389 end
|
|
Tercio@39
|
1390
|
|
Tercio@39
|
1391 return object;
|
|
Tercio@39
|
1392 end
|
|
Tercio@40
|
1393
|
|
Tercio@40
|
1394 -----------------------------
|
|
Tercio@40
|
1395 --> animations
|
|
Tercio@40
|
1396
|
|
Tercio@40
|
1397 function DF:CreateAnimationHub (parent, onPlay, onFinished)
|
|
Tercio@40
|
1398 local newAnimation = parent:CreateAnimationGroup()
|
|
Tercio@40
|
1399 newAnimation:SetScript ("OnPlay", onPlay)
|
|
Tercio@40
|
1400 newAnimation:SetScript ("OnFinished", onFinished)
|
|
Tercio@40
|
1401 newAnimation.NextAnimation = 1
|
|
Tercio@40
|
1402 return newAnimation
|
|
Tercio@40
|
1403 end
|
|
Tercio@40
|
1404
|
|
Tercio@40
|
1405 function DF:CreateAnimation (animation, type, order, duration, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
|
Tercio@40
|
1406 local anim = animation:CreateAnimation (type)
|
|
Tercio@40
|
1407
|
|
Tercio@40
|
1408 anim:SetOrder (order or animation.NextAnimation)
|
|
Tercio@40
|
1409 anim:SetDuration (duration)
|
|
Tercio@40
|
1410
|
|
Tercio@40
|
1411 type = string.upper (type)
|
|
Tercio@40
|
1412
|
|
Tercio@40
|
1413 if (type == "ALPHA") then
|
|
Tercio@40
|
1414 anim:SetFromAlpha (arg1)
|
|
Tercio@40
|
1415 anim:SetToAlpha (arg2)
|
|
Tercio@40
|
1416
|
|
Tercio@40
|
1417 elseif (type == "SCALE") then
|
|
Tercio@40
|
1418 anim:SetFromScale (arg1, arg2)
|
|
Tercio@40
|
1419 anim:SetToScale (arg3, arg4)
|
|
Tercio@40
|
1420 anim:SetOrigin (arg5 or "center", arg6 or 0, arg7 or 0) --point, x, y
|
|
Tercio@40
|
1421
|
|
Tercio@40
|
1422 elseif (type == "ROTATION") then
|
|
Tercio@40
|
1423 anim:SetDegrees (arg1) --degree
|
|
Tercio@40
|
1424 anim:SetOrigin (arg2 or "center", arg3 or 0, arg4 or 0) --point, x, y
|
|
Tercio@40
|
1425
|
|
Tercio@40
|
1426 elseif (type == "TRANSLATION") then
|
|
Tercio@40
|
1427 anim:SetOffset (arg1, arg2)
|
|
Tercio@40
|
1428
|
|
Tercio@40
|
1429 end
|
|
Tercio@40
|
1430
|
|
Tercio@40
|
1431 animation.NextAnimation = animation.NextAnimation + 1
|
|
Tercio@40
|
1432 return anim
|
|
Tercio@40
|
1433 end
|
|
Tercio@40
|
1434
|
|
Tercio@58
|
1435 local frameshake_shake_finished = function (parent, shakeObject)
|
|
Tercio@58
|
1436 if (shakeObject.IsPlaying) then
|
|
Tercio@58
|
1437 shakeObject.IsPlaying = false
|
|
Tercio@58
|
1438
|
|
Tercio@58
|
1439 --> update the amount of shake running on this frame
|
|
Tercio@58
|
1440 parent.__frameshakes.enabled = parent.__frameshakes.enabled - 1
|
|
Tercio@58
|
1441
|
|
Tercio@58
|
1442 --> restore the default anchors, in case where deltaTime was too small that didn't triggered an update
|
|
Tercio@58
|
1443 for i = 1, #shakeObject.Anchors do
|
|
Tercio@58
|
1444 local anchor = shakeObject.Anchors [i]
|
|
Tercio@58
|
1445
|
|
Tercio@58
|
1446 if (#anchor == 3) then
|
|
Tercio@58
|
1447 local anchorTo, point1, point2 = unpack (anchor)
|
|
Tercio@58
|
1448 parent:SetPoint (anchorTo, point1, point2)
|
|
Tercio@58
|
1449
|
|
Tercio@58
|
1450 elseif (#anchor == 5) then
|
|
Tercio@58
|
1451 local anchorName1, anchorTo, anchorName2, point1, point2 = unpack (anchor)
|
|
Tercio@58
|
1452 parent:SetPoint (anchorName1, anchorTo, anchorName2, point1, point2)
|
|
Tercio@58
|
1453 end
|
|
Tercio@58
|
1454 end
|
|
Tercio@58
|
1455 end
|
|
Tercio@58
|
1456 end
|
|
Tercio@58
|
1457
|
|
Tercio@58
|
1458 local frameshake_do_update = function (parent, shakeObject, deltaTime)
|
|
Tercio@58
|
1459
|
|
Tercio@58
|
1460 --> check delta time
|
|
Tercio@58
|
1461 deltaTime = deltaTime or 0
|
|
Tercio@58
|
1462
|
|
Tercio@58
|
1463 --> update time left
|
|
Tercio@58
|
1464 shakeObject.TimeLeft = max (shakeObject.TimeLeft - deltaTime, 0)
|
|
Tercio@58
|
1465
|
|
Tercio@58
|
1466 if (shakeObject.TimeLeft > 0) then
|
|
Tercio@58
|
1467
|
|
Tercio@58
|
1468 --> update fade in and out
|
|
Tercio@58
|
1469 if (shakeObject.IsFadingIn) then
|
|
Tercio@58
|
1470 shakeObject.IsFadingInTime = shakeObject.IsFadingInTime + deltaTime
|
|
Tercio@58
|
1471 end
|
|
Tercio@58
|
1472 if (shakeObject.IsFadingOut) then
|
|
Tercio@58
|
1473 shakeObject.IsFadingOutTime = shakeObject.IsFadingOutTime + deltaTime
|
|
Tercio@58
|
1474 end
|
|
Tercio@58
|
1475
|
|
Tercio@58
|
1476 --> check if can disable fade in
|
|
Tercio@58
|
1477 if (shakeObject.IsFadingIn and shakeObject.IsFadingInTime > shakeObject.FadeInTime) then
|
|
Tercio@58
|
1478 shakeObject.IsFadingIn = false
|
|
Tercio@58
|
1479 end
|
|
Tercio@58
|
1480
|
|
Tercio@58
|
1481 --> check if can enable fade out
|
|
Tercio@58
|
1482 if (not shakeObject.IsFadingOut and shakeObject.TimeLeft < shakeObject.FadeOutTime) then
|
|
Tercio@58
|
1483 shakeObject.IsFadingOut = true
|
|
Tercio@58
|
1484 shakeObject.IsFadingOutTime = shakeObject.FadeOutTime - shakeObject.TimeLeft
|
|
Tercio@58
|
1485 end
|
|
Tercio@58
|
1486
|
|
Tercio@58
|
1487 --> update position
|
|
Tercio@58
|
1488 local scaleShake = min (shakeObject.IsFadingIn and (shakeObject.IsFadingInTime / shakeObject.FadeInTime) or 1, shakeObject.IsFadingOut and (1 - shakeObject.IsFadingOutTime / shakeObject.FadeOutTime) or 1)
|
|
Tercio@58
|
1489
|
|
Tercio@58
|
1490 if (scaleShake > 0) then
|
|
Tercio@58
|
1491
|
|
Tercio@58
|
1492 --> delate the time by the frequency on both X and Y offsets
|
|
Tercio@58
|
1493 shakeObject.XSineOffset = shakeObject.XSineOffset + (deltaTime * shakeObject.Frequency)
|
|
Tercio@58
|
1494 shakeObject.YSineOffset = shakeObject.YSineOffset + (deltaTime * shakeObject.Frequency)
|
|
Tercio@58
|
1495
|
|
Tercio@58
|
1496 --> calc the new position
|
|
Tercio@58
|
1497 local newX, newY
|
|
Tercio@58
|
1498 if (shakeObject.AbsoluteSineX) then
|
|
Tercio@58
|
1499 --absoluting only the sine wave, passing a negative scale will reverse the absolute direction
|
|
Tercio@58
|
1500 newX = shakeObject.Amplitude * abs (math.sin (shakeObject.XSineOffset)) * scaleShake * shakeObject.ScaleX
|
|
Tercio@58
|
1501 else
|
|
Tercio@58
|
1502 newX = shakeObject.Amplitude * math.sin (shakeObject.XSineOffset) * scaleShake * shakeObject.ScaleX
|
|
Tercio@58
|
1503 end
|
|
Tercio@58
|
1504
|
|
Tercio@58
|
1505 if (shakeObject.AbsoluteSineY) then
|
|
Tercio@58
|
1506 newY = shakeObject.Amplitude * abs (math.sin (shakeObject.YSineOffset)) * scaleShake * shakeObject.ScaleY
|
|
Tercio@58
|
1507 else
|
|
Tercio@58
|
1508 newY = shakeObject.Amplitude * math.sin (shakeObject.YSineOffset) * scaleShake * shakeObject.ScaleY
|
|
Tercio@58
|
1509 end
|
|
Tercio@58
|
1510
|
|
Tercio@58
|
1511 --> apply the offset to the frame anchors
|
|
Tercio@58
|
1512 for i = 1, #shakeObject.Anchors do
|
|
Tercio@58
|
1513 local anchor = shakeObject.Anchors [i]
|
|
Tercio@58
|
1514
|
|
Tercio@58
|
1515 if (#anchor == 3) then
|
|
Tercio@58
|
1516 local anchorTo, point1, point2 = unpack (anchor)
|
|
Tercio@58
|
1517 parent:SetPoint (anchorTo, point1 + newX, point2 + newY)
|
|
Tercio@58
|
1518
|
|
Tercio@58
|
1519 elseif (#anchor == 5) then
|
|
Tercio@58
|
1520 local anchorName1, anchorTo, anchorName2, point1, point2 = unpack (anchor)
|
|
Tercio@58
|
1521 parent:SetPoint (anchorName1, anchorTo, anchorName2, point1 + newX, point2 + newY)
|
|
Tercio@58
|
1522 end
|
|
Tercio@58
|
1523 end
|
|
Tercio@58
|
1524
|
|
Tercio@58
|
1525 end
|
|
Tercio@58
|
1526 else
|
|
Tercio@58
|
1527 frameshake_shake_finished (parent, shakeObject)
|
|
Tercio@58
|
1528 end
|
|
Tercio@58
|
1529 end
|
|
Tercio@58
|
1530
|
|
Tercio@58
|
1531 local frameshake_update_all = function (parent, deltaTime)
|
|
Tercio@58
|
1532 --> check if there's a shake running
|
|
Tercio@58
|
1533 --print ("Shakes Enabled: ", parent.__frameshakes.enabled)
|
|
Tercio@58
|
1534 if (parent.__frameshakes.enabled > 0) then
|
|
Tercio@58
|
1535 --update all shakes
|
|
Tercio@58
|
1536 for i = 1, #parent.__frameshakes do
|
|
Tercio@58
|
1537 local shakeObject = parent.__frameshakes [i]
|
|
Tercio@58
|
1538 if (shakeObject.IsPlaying) then
|
|
Tercio@58
|
1539 frameshake_do_update (parent, shakeObject, deltaTime)
|
|
Tercio@58
|
1540 end
|
|
Tercio@58
|
1541 end
|
|
Tercio@58
|
1542 end
|
|
Tercio@58
|
1543 end
|
|
Tercio@58
|
1544
|
|
Tercio@58
|
1545 --> scale direction scales the X and Y coordinates, scale strength scales the amplitude and frequency
|
|
Tercio@58
|
1546 local frameshake_play = function (parent, shakeObject, scaleDirection, scaleAmplitude, scaleFrequency, scaleDuration)
|
|
Tercio@58
|
1547
|
|
Tercio@58
|
1548 --> check if is already playing
|
|
Tercio@58
|
1549 if (shakeObject.TimeLeft > 0) then
|
|
Tercio@58
|
1550 --> reset the time left
|
|
Tercio@58
|
1551 shakeObject.TimeLeft = shakeObject.Duration
|
|
Tercio@58
|
1552
|
|
Tercio@58
|
1553 if (shakeObject.IsFadingOut) then
|
|
Tercio@58
|
1554 if (shakeObject.FadeInTime > 0) then
|
|
Tercio@58
|
1555 shakeObject.IsFadingIn = true
|
|
Tercio@58
|
1556 --> scale the current fade out into fade in, so it starts the fade in at the point where it was fading out
|
|
Tercio@58
|
1557 shakeObject.IsFadingInTime = shakeObject.FadeInTime * (1 - shakeObject.IsFadingOutTime / shakeObject.FadeOutTime)
|
|
Tercio@58
|
1558 else
|
|
Tercio@58
|
1559 shakeObject.IsFadingIn = false
|
|
Tercio@58
|
1560 shakeObject.IsFadingInTime = 0
|
|
Tercio@58
|
1561 end
|
|
Tercio@58
|
1562
|
|
Tercio@58
|
1563 --> disable fade out and enable fade in
|
|
Tercio@58
|
1564 shakeObject.IsFadingOut = false
|
|
Tercio@58
|
1565 shakeObject.IsFadingOutTime = 0
|
|
Tercio@58
|
1566 end
|
|
Tercio@58
|
1567
|
|
Tercio@58
|
1568 else
|
|
Tercio@58
|
1569 --> create a new random offset
|
|
Tercio@58
|
1570 shakeObject.XSineOffset = math.pi * 2 * math.random()
|
|
Tercio@58
|
1571 shakeObject.YSineOffset = math.pi * 2 * math.random()
|
|
Tercio@58
|
1572
|
|
Tercio@58
|
1573 --> store the initial position if case it needs a reset
|
|
Tercio@58
|
1574 shakeObject.StartedXSineOffset = shakeObject.XSineOffset
|
|
Tercio@58
|
1575 shakeObject.StartedYSineOffset = shakeObject.YSineOffset
|
|
Tercio@58
|
1576
|
|
Tercio@58
|
1577 --> check if there's a fade in time
|
|
Tercio@58
|
1578 if (shakeObject.FadeInTime > 0) then
|
|
Tercio@58
|
1579 shakeObject.IsFadingIn = true
|
|
Tercio@58
|
1580 else
|
|
Tercio@58
|
1581 shakeObject.IsFadingIn = false
|
|
Tercio@58
|
1582 end
|
|
Tercio@58
|
1583
|
|
Tercio@58
|
1584 shakeObject.IsFadingInTime = 0
|
|
Tercio@58
|
1585 shakeObject.IsFadingOut = false
|
|
Tercio@58
|
1586 shakeObject.IsFadingOutTime = 0
|
|
Tercio@58
|
1587
|
|
Tercio@58
|
1588 --> apply custom scale
|
|
Tercio@58
|
1589 shakeObject.ScaleX = (scaleDirection or 1) * shakeObject.OriginalScaleX
|
|
Tercio@58
|
1590 shakeObject.ScaleY = (scaleDirection or 1) * shakeObject.OriginalScaleY
|
|
Tercio@58
|
1591 shakeObject.Frequency = (scaleFrequency or 1) * shakeObject.OriginalFrequency
|
|
Tercio@58
|
1592 shakeObject.Amplitude = (scaleAmplitude or 1) * shakeObject.OriginalAmplitude
|
|
Tercio@58
|
1593 shakeObject.Duration = (scaleDuration or 1) * shakeObject.OriginalDuration
|
|
Tercio@58
|
1594
|
|
Tercio@58
|
1595 --> update the time left
|
|
Tercio@58
|
1596 shakeObject.TimeLeft = shakeObject.Duration
|
|
Tercio@58
|
1597
|
|
Tercio@58
|
1598 --> check if is dynamic points
|
|
Tercio@58
|
1599 if (shakeObject.IsDynamicAnchor) then
|
|
Tercio@58
|
1600 wipe (shakeObject.Anchors)
|
|
Tercio@58
|
1601 for i = 1, parent:GetNumPoints() do
|
|
Tercio@58
|
1602 local p1, p2, p3, p4, p5 = parent:GetPoint (i)
|
|
Tercio@58
|
1603 shakeObject.Anchors [#shakeObject.Anchors+1] = {p1, p2, p3, p4, p5}
|
|
Tercio@58
|
1604 end
|
|
Tercio@58
|
1605 end
|
|
Tercio@58
|
1606
|
|
Tercio@58
|
1607 --> update the amount of shake running on this frame
|
|
Tercio@58
|
1608 parent.__frameshakes.enabled = parent.__frameshakes.enabled + 1
|
|
Tercio@58
|
1609 end
|
|
Tercio@58
|
1610
|
|
Tercio@58
|
1611 shakeObject.IsPlaying = true
|
|
Tercio@58
|
1612
|
|
Tercio@58
|
1613 frameshake_do_update (parent, shakeObject)
|
|
Tercio@58
|
1614 end
|
|
Tercio@58
|
1615
|
|
Tercio@58
|
1616 function DF:CreateFrameShake (parent, duration, amplitude, frequency, absoluteSineX, absoluteSineY, scaleX, scaleY, fadeInTime, fadeOutTime, anchorPoints)
|
|
Tercio@58
|
1617
|
|
Tercio@58
|
1618 --> create the shake table
|
|
Tercio@58
|
1619 local frameShake = {
|
|
Tercio@58
|
1620 Amplitude = amplitude or 2,
|
|
Tercio@58
|
1621 Frequency = frequency or 5,
|
|
Tercio@58
|
1622 Duration = duration or 0.3,
|
|
Tercio@58
|
1623 FadeInTime = fadeInTime or 0.01,
|
|
Tercio@58
|
1624 FadeOutTime = fadeOutTime or 0.01,
|
|
Tercio@58
|
1625 ScaleX = scaleX or 0.2,
|
|
Tercio@58
|
1626 ScaleY = scaleY or 1,
|
|
Tercio@58
|
1627 AbsoluteSineX = absoluteSineX,
|
|
Tercio@58
|
1628 AbsoluteSineY = absoluteSineY,
|
|
Tercio@58
|
1629 --
|
|
Tercio@58
|
1630 IsPlaying = false,
|
|
Tercio@58
|
1631 TimeLeft = 0,
|
|
Tercio@58
|
1632 }
|
|
Tercio@58
|
1633
|
|
Tercio@58
|
1634 frameShake.OriginalScaleX = frameShake.ScaleX
|
|
Tercio@58
|
1635 frameShake.OriginalScaleY = frameShake.ScaleY
|
|
Tercio@58
|
1636 frameShake.OriginalFrequency = frameShake.Frequency
|
|
Tercio@58
|
1637 frameShake.OriginalAmplitude = frameShake.Amplitude
|
|
Tercio@58
|
1638 frameShake.OriginalDuration = frameShake.Duration
|
|
Tercio@58
|
1639
|
|
Tercio@58
|
1640 if (type (anchorPoints) ~= "table") then
|
|
Tercio@58
|
1641 frameShake.IsDynamicAnchor = true
|
|
Tercio@58
|
1642 frameShake.Anchors = {}
|
|
Tercio@58
|
1643 else
|
|
Tercio@58
|
1644 frameShake.Anchors = anchorPoints
|
|
Tercio@58
|
1645 end
|
|
Tercio@58
|
1646
|
|
Tercio@58
|
1647 --> inject frame shake table into the frame
|
|
Tercio@58
|
1648 if (not parent.__frameshakes) then
|
|
Tercio@58
|
1649 parent.__frameshakes = {
|
|
Tercio@58
|
1650 enabled = 0,
|
|
Tercio@58
|
1651 }
|
|
Tercio@58
|
1652 parent.PlayFrameShake = frameshake_play
|
|
Tercio@58
|
1653 parent.UpdateFrameShake = frameshake_do_update
|
|
Tercio@58
|
1654 parent.UpdateAllFrameShake = frameshake_update_all
|
|
Tercio@58
|
1655 parent:HookScript ("OnUpdate", frameshake_update_all)
|
|
Tercio@58
|
1656 end
|
|
Tercio@58
|
1657
|
|
Tercio@58
|
1658 tinsert (parent.__frameshakes, frameShake)
|
|
Tercio@58
|
1659
|
|
Tercio@58
|
1660 return frameShake
|
|
Tercio@58
|
1661 end
|
|
Tercio@58
|
1662
|
|
Tercio@58
|
1663
|
|
Tercio@58
|
1664 -----------------------------
|
|
Tercio@58
|
1665 --> glow overlay
|
|
Tercio@58
|
1666
|
|
Tercio@58
|
1667 local play_glow_overlay = function (self)
|
|
Tercio@58
|
1668 self:Show()
|
|
Tercio@58
|
1669 if (self.animOut:IsPlaying()) then
|
|
Tercio@58
|
1670 self.animOut:Stop()
|
|
Tercio@58
|
1671 end
|
|
Tercio@58
|
1672 self.animIn:Play()
|
|
Tercio@58
|
1673 end
|
|
Tercio@58
|
1674
|
|
Tercio@58
|
1675 local stop_glow_overlay = function (self)
|
|
Tercio@58
|
1676 self.animOut:Stop()
|
|
Tercio@58
|
1677 self.animIn:Stop()
|
|
Tercio@58
|
1678 self:Hide()
|
|
Tercio@58
|
1679 end
|
|
Tercio@58
|
1680
|
|
Tercio@58
|
1681 local defaultColor = {1, 1, 1, 1}
|
|
Tercio@58
|
1682
|
|
Tercio@58
|
1683 --this is most copied from the wow client code, few changes applied to customize it
|
|
Tercio@58
|
1684 function DF:CreateGlowOverlay (parent, antsColor, glowColor)
|
|
Tercio@58
|
1685 local glowFrame = CreateFrame ("frame", parent:GetName() and "$parentGlow2" or "OverlayActionGlow" .. math.random (1, 10000000), parent, "ActionBarButtonSpellActivationAlert")
|
|
Tercio@58
|
1686
|
|
Tercio@58
|
1687 glowFrame.Play = play_glow_overlay
|
|
Tercio@58
|
1688 glowFrame.Stop = stop_glow_overlay
|
|
Tercio@58
|
1689
|
|
Tercio@58
|
1690 parent.overlay = glowFrame
|
|
Tercio@58
|
1691 local frameWidth, frameHeight = parent:GetSize()
|
|
Tercio@58
|
1692
|
|
Tercio@58
|
1693 local scale = 1.4
|
|
Tercio@58
|
1694
|
|
Tercio@58
|
1695 --Make the height/width available before the next frame:
|
|
Tercio@58
|
1696 parent.overlay:SetSize(frameWidth * scale, frameHeight * scale)
|
|
Tercio@58
|
1697 parent.overlay:SetPoint("TOPLEFT", parent, "TOPLEFT", -frameWidth * 0.2, frameHeight * 0.2)
|
|
Tercio@58
|
1698 parent.overlay:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", frameWidth * 0.2, -frameHeight * 0.2)
|
|
Tercio@58
|
1699
|
|
Tercio@58
|
1700 local r, g, b, a = DF:ParseColors (antsColor or defaultColor)
|
|
Tercio@58
|
1701 glowFrame.ants:SetVertexColor (r, g, b, a)
|
|
Tercio@58
|
1702
|
|
Tercio@58
|
1703 local r, g, b, a = DF:ParseColors (glowColor or defaultColor)
|
|
Tercio@58
|
1704 glowFrame.outerGlow:SetVertexColor (r, g, b, a)
|
|
Tercio@58
|
1705
|
|
Tercio@58
|
1706 glowFrame.outerGlow:SetScale (1.2)
|
|
Tercio@58
|
1707
|
|
Tercio@58
|
1708 return glowFrame
|
|
Tercio@58
|
1709 end
|
|
Tercio@40
|
1710
|
|
Tercio@40
|
1711 -----------------------------
|
|
Tercio@40
|
1712 --> borders
|
|
Tercio@40
|
1713
|
|
Tercio@40
|
1714 local default_border_color1 = .5
|
|
Tercio@40
|
1715 local default_border_color2 = .3
|
|
Tercio@40
|
1716 local default_border_color3 = .1
|
|
Tercio@40
|
1717
|
|
Tercio@40
|
1718 local SetBorderAlpha = function (self, alpha1, alpha2, alpha3)
|
|
Tercio@40
|
1719 self.Borders.Alpha1 = alpha1 or self.Borders.Alpha1
|
|
Tercio@40
|
1720 self.Borders.Alpha2 = alpha2 or self.Borders.Alpha2
|
|
Tercio@40
|
1721 self.Borders.Alpha3 = alpha3 or self.Borders.Alpha3
|
|
Tercio@40
|
1722
|
|
Tercio@40
|
1723 for _, texture in ipairs (self.Borders.Layer1) do
|
|
Tercio@40
|
1724 texture:SetAlpha (self.Borders.Alpha1)
|
|
Tercio@40
|
1725 end
|
|
Tercio@40
|
1726 for _, texture in ipairs (self.Borders.Layer2) do
|
|
Tercio@40
|
1727 texture:SetAlpha (self.Borders.Alpha2)
|
|
Tercio@40
|
1728 end
|
|
Tercio@40
|
1729 for _, texture in ipairs (self.Borders.Layer3) do
|
|
Tercio@40
|
1730 texture:SetAlpha (self.Borders.Alpha3)
|
|
Tercio@40
|
1731 end
|
|
Tercio@40
|
1732 end
|
|
Tercio@40
|
1733
|
|
Tercio@58
|
1734 local SetBorderColor = function (self, r, g, b)
|
|
Tercio@58
|
1735 for _, texture in ipairs (self.Borders.Layer1) do
|
|
Tercio@58
|
1736 texture:SetColorTexture (r, g, b)
|
|
Tercio@58
|
1737 end
|
|
Tercio@58
|
1738 for _, texture in ipairs (self.Borders.Layer2) do
|
|
Tercio@58
|
1739 texture:SetColorTexture (r, g, b)
|
|
Tercio@58
|
1740 end
|
|
Tercio@58
|
1741 for _, texture in ipairs (self.Borders.Layer3) do
|
|
Tercio@58
|
1742 texture:SetColorTexture (r, g, b)
|
|
Tercio@58
|
1743 end
|
|
Tercio@58
|
1744 end
|
|
Tercio@58
|
1745
|
|
Tercio@58
|
1746 local SetLayerVisibility = function (self, layer1Shown, layer2Shown, layer3Shown)
|
|
Tercio@58
|
1747
|
|
Tercio@58
|
1748 for _, texture in ipairs (self.Borders.Layer1) do
|
|
Tercio@58
|
1749 texture:SetShown (layer1Shown)
|
|
Tercio@58
|
1750 end
|
|
Tercio@58
|
1751
|
|
Tercio@58
|
1752 for _, texture in ipairs (self.Borders.Layer2) do
|
|
Tercio@58
|
1753 texture:SetShown (layer2Shown)
|
|
Tercio@58
|
1754 end
|
|
Tercio@58
|
1755
|
|
Tercio@58
|
1756 for _, texture in ipairs (self.Borders.Layer3) do
|
|
Tercio@58
|
1757 texture:SetShown (layer3Shown)
|
|
Tercio@58
|
1758 end
|
|
Tercio@58
|
1759
|
|
Tercio@58
|
1760 end
|
|
Tercio@58
|
1761
|
|
Tercio@40
|
1762 function DF:CreateBorder (parent, alpha1, alpha2, alpha3)
|
|
Tercio@40
|
1763
|
|
Tercio@40
|
1764 parent.Borders = {
|
|
Tercio@40
|
1765 Layer1 = {},
|
|
Tercio@40
|
1766 Layer2 = {},
|
|
Tercio@40
|
1767 Layer3 = {},
|
|
Tercio@40
|
1768 Alpha1 = alpha1 or default_border_color1,
|
|
Tercio@40
|
1769 Alpha2 = alpha2 or default_border_color2,
|
|
Tercio@40
|
1770 Alpha3 = alpha3 or default_border_color3,
|
|
Tercio@40
|
1771 }
|
|
Tercio@40
|
1772
|
|
Tercio@40
|
1773 parent.SetBorderAlpha = SetBorderAlpha
|
|
Tercio@58
|
1774 parent.SetBorderColor = SetBorderColor
|
|
Tercio@58
|
1775 parent.SetLayerVisibility = SetLayerVisibility
|
|
Tercio@40
|
1776
|
|
Tercio@40
|
1777 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1778 border1:SetPoint ("topleft", parent, "topleft", -1, 1)
|
|
Tercio@40
|
1779 border1:SetPoint ("bottomleft", parent, "bottomleft", -1, -1)
|
|
Tercio@40
|
1780 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@40
|
1781 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1782 border2:SetPoint ("topleft", parent, "topleft", -2, 2)
|
|
Tercio@40
|
1783 border2:SetPoint ("bottomleft", parent, "bottomleft", -2, -2)
|
|
Tercio@40
|
1784 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@40
|
1785 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1786 border3:SetPoint ("topleft", parent, "topleft", -3, 3)
|
|
Tercio@40
|
1787 border3:SetPoint ("bottomleft", parent, "bottomleft", -3, -3)
|
|
Tercio@40
|
1788 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@40
|
1789
|
|
Tercio@40
|
1790 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@40
|
1791 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@40
|
1792 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@40
|
1793
|
|
Tercio@40
|
1794 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1795 border1:SetPoint ("topleft", parent, "topleft", 0, 1)
|
|
Tercio@40
|
1796 border1:SetPoint ("topright", parent, "topright", 1, 1)
|
|
Tercio@40
|
1797 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@40
|
1798 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1799 border2:SetPoint ("topleft", parent, "topleft", -1, 2)
|
|
Tercio@40
|
1800 border2:SetPoint ("topright", parent, "topright", 2, 2)
|
|
Tercio@40
|
1801 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@40
|
1802 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1803 border3:SetPoint ("topleft", parent, "topleft", -2, 3)
|
|
Tercio@40
|
1804 border3:SetPoint ("topright", parent, "topright", 3, 3)
|
|
Tercio@40
|
1805 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@40
|
1806
|
|
Tercio@40
|
1807 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@40
|
1808 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@40
|
1809 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@40
|
1810
|
|
Tercio@40
|
1811 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1812 border1:SetPoint ("topright", parent, "topright", 1, 0)
|
|
Tercio@40
|
1813 border1:SetPoint ("bottomright", parent, "bottomright", 1, -1)
|
|
Tercio@40
|
1814 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@40
|
1815 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1816 border2:SetPoint ("topright", parent, "topright", 2, 1)
|
|
Tercio@40
|
1817 border2:SetPoint ("bottomright", parent, "bottomright", 2, -2)
|
|
Tercio@40
|
1818 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@40
|
1819 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1820 border3:SetPoint ("topright", parent, "topright", 3, 2)
|
|
Tercio@40
|
1821 border3:SetPoint ("bottomright", parent, "bottomright", 3, -3)
|
|
Tercio@40
|
1822 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@40
|
1823
|
|
Tercio@40
|
1824 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@40
|
1825 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@40
|
1826 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@40
|
1827
|
|
Tercio@40
|
1828 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1829 border1:SetPoint ("bottomleft", parent, "bottomleft", 0, -1)
|
|
Tercio@40
|
1830 border1:SetPoint ("bottomright", parent, "bottomright", 0, -1)
|
|
Tercio@40
|
1831 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@40
|
1832 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1833 border2:SetPoint ("bottomleft", parent, "bottomleft", -1, -2)
|
|
Tercio@40
|
1834 border2:SetPoint ("bottomright", parent, "bottomright", 1, -2)
|
|
Tercio@40
|
1835 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@40
|
1836 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1837 border3:SetPoint ("bottomleft", parent, "bottomleft", -2, -3)
|
|
Tercio@40
|
1838 border3:SetPoint ("bottomright", parent, "bottomright", 2, -3)
|
|
Tercio@40
|
1839 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@40
|
1840
|
|
Tercio@40
|
1841 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@40
|
1842 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@40
|
1843 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@40
|
1844
|
|
Tercio@40
|
1845 end
|
|
Tercio@40
|
1846
|
|
Tercio@58
|
1847
|
|
Tercio@58
|
1848 function DF:CreateBorderWithSpread (parent, alpha1, alpha2, alpha3, size, spread)
|
|
Tercio@58
|
1849
|
|
Tercio@58
|
1850 parent.Borders = {
|
|
Tercio@58
|
1851 Layer1 = {},
|
|
Tercio@58
|
1852 Layer2 = {},
|
|
Tercio@58
|
1853 Layer3 = {},
|
|
Tercio@58
|
1854 Alpha1 = alpha1 or default_border_color1,
|
|
Tercio@58
|
1855 Alpha2 = alpha2 or default_border_color2,
|
|
Tercio@58
|
1856 Alpha3 = alpha3 or default_border_color3,
|
|
Tercio@58
|
1857 }
|
|
Tercio@58
|
1858
|
|
Tercio@58
|
1859 parent.SetBorderAlpha = SetBorderAlpha
|
|
Tercio@58
|
1860 parent.SetBorderColor = SetBorderColor
|
|
Tercio@58
|
1861 parent.SetLayerVisibility = SetLayerVisibility
|
|
Tercio@58
|
1862
|
|
Tercio@58
|
1863 --left
|
|
Tercio@58
|
1864 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1865 border1:SetPoint ("topleft", parent, "topleft", -1 + spread, 1 + (-spread))
|
|
Tercio@58
|
1866 border1:SetPoint ("bottomleft", parent, "bottomleft", -1 + spread, -1 + spread)
|
|
Tercio@58
|
1867 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@58
|
1868 border1:SetWidth (size)
|
|
Tercio@58
|
1869
|
|
Tercio@58
|
1870 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1871 border2:SetPoint ("topleft", parent, "topleft", -2 + spread, 2 + (-spread))
|
|
Tercio@58
|
1872 border2:SetPoint ("bottomleft", parent, "bottomleft", -2 + spread, -2 + spread)
|
|
Tercio@58
|
1873 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@58
|
1874 border2:SetWidth (size)
|
|
Tercio@58
|
1875
|
|
Tercio@58
|
1876 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1877 border3:SetPoint ("topleft", parent, "topleft", -3 + spread, 3 + (-spread))
|
|
Tercio@58
|
1878 border3:SetPoint ("bottomleft", parent, "bottomleft", -3 + spread, -3 + spread)
|
|
Tercio@58
|
1879 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@58
|
1880 border3:SetWidth (size)
|
|
Tercio@58
|
1881
|
|
Tercio@58
|
1882 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@58
|
1883 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@58
|
1884 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@58
|
1885
|
|
Tercio@58
|
1886 --top
|
|
Tercio@58
|
1887 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1888 border1:SetPoint ("topleft", parent, "topleft", 0 + spread, 1 + (-spread))
|
|
Tercio@58
|
1889 border1:SetPoint ("topright", parent, "topright", 1 + (-spread), 1 + (-spread))
|
|
Tercio@58
|
1890 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@58
|
1891 border1:SetHeight (size)
|
|
Tercio@58
|
1892
|
|
Tercio@58
|
1893 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1894 border2:SetPoint ("topleft", parent, "topleft", -1 + spread, 2 + (-spread))
|
|
Tercio@58
|
1895 border2:SetPoint ("topright", parent, "topright", 2 + (-spread), 2 + (-spread))
|
|
Tercio@58
|
1896 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@58
|
1897 border2:SetHeight (size)
|
|
Tercio@58
|
1898
|
|
Tercio@58
|
1899 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1900 border3:SetPoint ("topleft", parent, "topleft", -2 + spread, 3 + (-spread))
|
|
Tercio@58
|
1901 border3:SetPoint ("topright", parent, "topright", 3 + (-spread), 3 + (-spread))
|
|
Tercio@58
|
1902 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@58
|
1903 border3:SetHeight (size)
|
|
Tercio@58
|
1904
|
|
Tercio@58
|
1905 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@58
|
1906 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@58
|
1907 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@58
|
1908
|
|
Tercio@58
|
1909 --right
|
|
Tercio@58
|
1910 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1911 border1:SetPoint ("topright", parent, "topright", 1 + (-spread), 0 + (-spread))
|
|
Tercio@58
|
1912 border1:SetPoint ("bottomright", parent, "bottomright", 1 + (-spread), -1 + spread)
|
|
Tercio@58
|
1913 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@58
|
1914 border1:SetWidth (size)
|
|
Tercio@58
|
1915
|
|
Tercio@58
|
1916 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1917 border2:SetPoint ("topright", parent, "topright", 2 + (-spread), 1 + (-spread))
|
|
Tercio@58
|
1918 border2:SetPoint ("bottomright", parent, "bottomright", 2 + (-spread), -2 + spread)
|
|
Tercio@58
|
1919 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@58
|
1920 border2:SetWidth (size)
|
|
Tercio@58
|
1921
|
|
Tercio@58
|
1922 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1923 border3:SetPoint ("topright", parent, "topright", 3 + (-spread), 2 + (-spread))
|
|
Tercio@58
|
1924 border3:SetPoint ("bottomright", parent, "bottomright", 3 + (-spread), -3 + spread)
|
|
Tercio@58
|
1925 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@58
|
1926 border3:SetWidth (size)
|
|
Tercio@58
|
1927
|
|
Tercio@58
|
1928 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@58
|
1929 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@58
|
1930 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@58
|
1931
|
|
Tercio@58
|
1932 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1933 border1:SetPoint ("bottomleft", parent, "bottomleft", 0 + spread, -1 + spread)
|
|
Tercio@58
|
1934 border1:SetPoint ("bottomright", parent, "bottomright", 0 + (-spread), -1 + spread)
|
|
Tercio@58
|
1935 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@58
|
1936 border1:SetHeight (size)
|
|
Tercio@58
|
1937
|
|
Tercio@58
|
1938 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1939 border2:SetPoint ("bottomleft", parent, "bottomleft", -1 + spread, -2 + spread)
|
|
Tercio@58
|
1940 border2:SetPoint ("bottomright", parent, "bottomright", 1 + (-spread), -2 + spread)
|
|
Tercio@58
|
1941 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@58
|
1942 border2:SetHeight (size)
|
|
Tercio@58
|
1943
|
|
Tercio@58
|
1944 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@58
|
1945 border3:SetPoint ("bottomleft", parent, "bottomleft", -2 + spread, -3 + spread)
|
|
Tercio@58
|
1946 border3:SetPoint ("bottomright", parent, "bottomright", 2 + (-spread), -3 + spread)
|
|
Tercio@58
|
1947 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@58
|
1948 border3:SetHeight (size)
|
|
Tercio@58
|
1949
|
|
Tercio@58
|
1950 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@58
|
1951 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@58
|
1952 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@58
|
1953
|
|
Tercio@58
|
1954 end
|
|
Tercio@58
|
1955
|
|
Tercio@40
|
1956 function DF:ReskinSlider (slider, heightOffset)
|
|
Tercio@40
|
1957 if (slider.slider) then
|
|
Tercio@40
|
1958 slider.cima:SetNormalTexture ([[Interface\Buttons\Arrow-Up-Up]])
|
|
Tercio@40
|
1959 slider.cima:SetPushedTexture ([[Interface\Buttons\Arrow-Up-Down]])
|
|
Tercio@40
|
1960 slider.cima:SetDisabledTexture ([[Interface\Buttons\Arrow-Up-Disabled]])
|
|
Tercio@40
|
1961 slider.cima:GetNormalTexture():ClearAllPoints()
|
|
Tercio@40
|
1962 slider.cima:GetPushedTexture():ClearAllPoints()
|
|
Tercio@40
|
1963 slider.cima:GetDisabledTexture():ClearAllPoints()
|
|
Tercio@40
|
1964 slider.cima:GetNormalTexture():SetPoint ("center", slider.cima, "center", 1, 1)
|
|
Tercio@40
|
1965 slider.cima:GetPushedTexture():SetPoint ("center", slider.cima, "center", 1, 1)
|
|
Tercio@40
|
1966 slider.cima:GetDisabledTexture():SetPoint ("center", slider.cima, "center", 1, 1)
|
|
Tercio@40
|
1967 slider.cima:SetSize (16, 16)
|
|
Tercio@40
|
1968 slider.cima:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
|
|
Tercio@40
|
1969 slider.cima:SetBackdropColor (0, 0, 0, 0.3)
|
|
Tercio@40
|
1970 slider.cima:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
1971
|
|
Tercio@40
|
1972 slider.baixo:SetNormalTexture ([[Interface\Buttons\Arrow-Down-Up]])
|
|
Tercio@40
|
1973 slider.baixo:SetPushedTexture ([[Interface\Buttons\Arrow-Down-Down]])
|
|
Tercio@40
|
1974 slider.baixo:SetDisabledTexture ([[Interface\Buttons\Arrow-Down-Disabled]])
|
|
Tercio@40
|
1975 slider.baixo:GetNormalTexture():ClearAllPoints()
|
|
Tercio@40
|
1976 slider.baixo:GetPushedTexture():ClearAllPoints()
|
|
Tercio@40
|
1977 slider.baixo:GetDisabledTexture():ClearAllPoints()
|
|
Tercio@40
|
1978 slider.baixo:GetNormalTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
|
|
Tercio@40
|
1979 slider.baixo:GetPushedTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
|
|
Tercio@40
|
1980 slider.baixo:GetDisabledTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
|
|
Tercio@40
|
1981 slider.baixo:SetSize (16, 16)
|
|
Tercio@40
|
1982 slider.baixo:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
|
|
Tercio@40
|
1983 slider.baixo:SetBackdropColor (0, 0, 0, 0.35)
|
|
Tercio@40
|
1984 slider.baixo:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
1985
|
|
Tercio@40
|
1986 slider.slider:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
|
|
Tercio@40
|
1987 slider.slider:SetBackdropColor (0, 0, 0, 0.35)
|
|
Tercio@40
|
1988 slider.slider:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
1989
|
|
Tercio@40
|
1990 --slider.slider:Altura (164)
|
|
Tercio@40
|
1991 slider.slider:cimaPoint (0, 13)
|
|
Tercio@40
|
1992 slider.slider:baixoPoint (0, -13)
|
|
Tercio@40
|
1993 slider.slider.thumb:SetTexture ([[Interface\AddOns\Details\images\icons2]])
|
|
Tercio@40
|
1994 slider.slider.thumb:SetTexCoord (482/512, 492/512, 104/512, 120/512)
|
|
Tercio@40
|
1995 slider.slider.thumb:SetSize (12, 12)
|
|
Tercio@40
|
1996 slider.slider.thumb:SetVertexColor (0.6, 0.6, 0.6, 0.95)
|
|
Tercio@58
|
1997
|
|
Tercio@40
|
1998 else
|
|
Tercio@58
|
1999 --up button
|
|
Tercio@58
|
2000 do
|
|
Tercio@58
|
2001 local normalTexture = slider.ScrollBar.ScrollUpButton.Normal
|
|
Tercio@58
|
2002 normalTexture:SetTexture ([[Interface\Buttons\Arrow-Up-Up]])
|
|
Tercio@58
|
2003 normalTexture:SetTexCoord (0, 1, .2, 1)
|
|
Tercio@58
|
2004
|
|
Tercio@58
|
2005 normalTexture:SetPoint ("topleft", slider.ScrollBar.ScrollUpButton, "topleft", 1, 0)
|
|
Tercio@58
|
2006 normalTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", 1, 0)
|
|
Tercio@58
|
2007
|
|
Tercio@58
|
2008 local pushedTexture = slider.ScrollBar.ScrollUpButton.Pushed
|
|
Tercio@58
|
2009 pushedTexture:SetTexture ([[Interface\Buttons\Arrow-Up-Down]])
|
|
Tercio@58
|
2010 pushedTexture:SetTexCoord (0, 1, .2, 1)
|
|
Tercio@58
|
2011
|
|
Tercio@58
|
2012 pushedTexture:SetPoint ("topleft", slider.ScrollBar.ScrollUpButton, "topleft", 1, 0)
|
|
Tercio@58
|
2013 pushedTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", 1, 0)
|
|
Tercio@40
|
2014
|
|
Tercio@58
|
2015 local disabledTexture = slider.ScrollBar.ScrollUpButton.Disabled
|
|
Tercio@58
|
2016 disabledTexture:SetTexture ([[Interface\Buttons\Arrow-Up-Disabled]])
|
|
Tercio@58
|
2017 disabledTexture:SetTexCoord (0, 1, .2, 1)
|
|
Tercio@58
|
2018 disabledTexture:SetAlpha (.5)
|
|
Tercio@58
|
2019
|
|
Tercio@58
|
2020 disabledTexture:SetPoint ("topleft", slider.ScrollBar.ScrollUpButton, "topleft", 1, 0)
|
|
Tercio@58
|
2021 disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", 1, 0)
|
|
Tercio@58
|
2022
|
|
Tercio@58
|
2023 slider.ScrollBar.ScrollUpButton:SetSize (16, 16)
|
|
Tercio@58
|
2024 slider.ScrollBar.ScrollUpButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
|
|
Tercio@58
|
2025 slider.ScrollBar.ScrollUpButton:SetBackdropColor (0, 0, 0, 0.3)
|
|
Tercio@58
|
2026 slider.ScrollBar.ScrollUpButton:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@58
|
2027
|
|
Tercio@58
|
2028 --it was having problems with the texture anchor when calling ClearAllPoints() and setting new points different from the original
|
|
Tercio@58
|
2029 --now it is using the same points from the original with small offsets tp align correctly
|
|
Tercio@58
|
2030 end
|
|
Tercio@58
|
2031
|
|
Tercio@58
|
2032 --down button
|
|
Tercio@58
|
2033 do
|
|
Tercio@58
|
2034 local normalTexture = slider.ScrollBar.ScrollDownButton.Normal
|
|
Tercio@58
|
2035 normalTexture:SetTexture ([[Interface\Buttons\Arrow-Down-Up]])
|
|
Tercio@58
|
2036 normalTexture:SetTexCoord (0, 1, 0, .8)
|
|
Tercio@58
|
2037
|
|
Tercio@58
|
2038 normalTexture:SetPoint ("topleft", slider.ScrollBar.ScrollDownButton, "topleft", 1, -4)
|
|
Tercio@58
|
2039 normalTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", 1, -4)
|
|
Tercio@58
|
2040
|
|
Tercio@58
|
2041 local pushedTexture = slider.ScrollBar.ScrollDownButton.Pushed
|
|
Tercio@58
|
2042 pushedTexture:SetTexture ([[Interface\Buttons\Arrow-Down-Down]])
|
|
Tercio@58
|
2043 pushedTexture:SetTexCoord (0, 1, 0, .8)
|
|
Tercio@58
|
2044
|
|
Tercio@58
|
2045 pushedTexture:SetPoint ("topleft", slider.ScrollBar.ScrollDownButton, "topleft", 1, -4)
|
|
Tercio@58
|
2046 pushedTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", 1, -4)
|
|
Tercio@58
|
2047
|
|
Tercio@58
|
2048 local disabledTexture = slider.ScrollBar.ScrollDownButton.Disabled
|
|
Tercio@58
|
2049 disabledTexture:SetTexture ([[Interface\Buttons\Arrow-Down-Disabled]])
|
|
Tercio@58
|
2050 disabledTexture:SetTexCoord (0, 1, 0, .8)
|
|
Tercio@58
|
2051 disabledTexture:SetAlpha (.5)
|
|
Tercio@58
|
2052
|
|
Tercio@58
|
2053 disabledTexture:SetPoint ("topleft", slider.ScrollBar.ScrollDownButton, "topleft", 1, -4)
|
|
Tercio@58
|
2054 disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", 1, -4)
|
|
Tercio@58
|
2055
|
|
Tercio@58
|
2056 slider.ScrollBar.ScrollDownButton:SetSize (16, 16)
|
|
Tercio@58
|
2057 slider.ScrollBar.ScrollDownButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
|
|
Tercio@58
|
2058 slider.ScrollBar.ScrollDownButton:SetBackdropColor (0, 0, 0, 0.3)
|
|
Tercio@58
|
2059 slider.ScrollBar.ScrollDownButton:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
2060
|
|
Tercio@58
|
2061 --<Anchor point="TOP" relativePoint="BOTTOM"/>
|
|
Tercio@58
|
2062 --slider.ScrollBar.ScrollDownButton:SetPoint ("top", slider.ScrollBar, "bottom", 0, 0)
|
|
Tercio@58
|
2063 end
|
|
Tercio@58
|
2064
|
|
Tercio@40
|
2065 --
|
|
Tercio@40
|
2066
|
|
Tercio@40
|
2067 slider.ScrollBar:SetPoint ("TOPLEFT", slider, "TOPRIGHT", 6, -16)
|
|
Tercio@40
|
2068 slider.ScrollBar:SetPoint ("BOTTOMLEFT", slider, "BOTTOMRIGHT", 6, 16 + (heightOffset and heightOffset*-1 or 0))
|
|
Tercio@40
|
2069
|
|
Tercio@40
|
2070 slider.ScrollBar.ThumbTexture:SetColorTexture (.5, .5, .5, .3)
|
|
Tercio@40
|
2071 slider.ScrollBar.ThumbTexture:SetSize (12, 8)
|
|
Tercio@40
|
2072
|
|
Tercio@40
|
2073 --
|
|
Tercio@40
|
2074
|
|
Tercio@40
|
2075 slider.ScrollBar:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
|
|
Tercio@40
|
2076 slider.ScrollBar:SetBackdropColor (0, 0, 0, 0.35)
|
|
Tercio@40
|
2077 slider.ScrollBar:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
2078 end
|
|
Tercio@40
|
2079 end
|
|
Tercio@40
|
2080
|
|
Tercio@58
|
2081 function DF:GetCurrentSpec()
|
|
Tercio@58
|
2082 local specIndex = GetSpecialization()
|
|
Tercio@58
|
2083 if (specIndex) then
|
|
Tercio@58
|
2084 local specID = GetSpecializationInfo (specIndex)
|
|
Tercio@58
|
2085 if (specID and specID ~= 0) then
|
|
Tercio@58
|
2086 return specID
|
|
Tercio@58
|
2087 end
|
|
Tercio@58
|
2088 end
|
|
Tercio@58
|
2089 end
|
|
Tercio@58
|
2090
|
|
Tercio@58
|
2091 local specs_per_class = {
|
|
Tercio@58
|
2092 ["DEMONHUNTER"] = {577, 581},
|
|
Tercio@58
|
2093 ["DEATHKNIGHT"] = {250, 251, 252},
|
|
Tercio@58
|
2094 ["WARRIOR"] = {71, 72, 73},
|
|
Tercio@58
|
2095 ["MAGE"] = {62, 63, 64},
|
|
Tercio@58
|
2096 ["ROGUE"] = {259, 260, 261},
|
|
Tercio@58
|
2097 ["DRUID"] = {102, 103, 104, 105},
|
|
Tercio@58
|
2098 ["HUNTER"] = {253, 254, 255},
|
|
Tercio@58
|
2099 ["SHAMAN"] = {262, 263, 254},
|
|
Tercio@58
|
2100 ["PRIEST"] = {256, 257, 258},
|
|
Tercio@58
|
2101 ["WARLOCK"] = {265, 266, 267},
|
|
Tercio@58
|
2102 ["PALADIN"] = {65, 66, 70},
|
|
Tercio@58
|
2103 ["MONK"] = {268, 269, 270},
|
|
Tercio@58
|
2104 }
|
|
Tercio@58
|
2105
|
|
Tercio@58
|
2106 function DF:GetClassSpecIDs (class)
|
|
Tercio@58
|
2107 return specs_per_class [class]
|
|
Tercio@58
|
2108 end
|
|
Tercio@58
|
2109
|
|
Tercio@58
|
2110 local dispatch_error = function (context, errortext)
|
|
Tercio@58
|
2111 DF:Msg ( (context or "<no context>") .. " |cFFFF9900error|r: " .. (errortext or "<no error given>"))
|
|
Tercio@58
|
2112 end
|
|
Tercio@58
|
2113
|
|
Tercio@58
|
2114 --> safe call an external func with payload and without telling who is calling
|
|
Tercio@58
|
2115 function DF:QuickDispatch (func, ...)
|
|
Tercio@58
|
2116 if (type (func) ~= "function") then
|
|
Tercio@58
|
2117 return
|
|
Tercio@58
|
2118 end
|
|
Tercio@58
|
2119
|
|
Tercio@58
|
2120 local okay, errortext = pcall (func, ...)
|
|
Tercio@58
|
2121
|
|
Tercio@58
|
2122 if (not okay) then
|
|
Tercio@58
|
2123 --> trigger an error msg
|
|
Tercio@58
|
2124 dispatch_error (_, errortext)
|
|
Tercio@58
|
2125 return
|
|
Tercio@58
|
2126 end
|
|
Tercio@58
|
2127
|
|
Tercio@58
|
2128 return true
|
|
Tercio@58
|
2129 end
|
|
Tercio@58
|
2130
|
|
Tercio@58
|
2131
|
|
Tercio@58
|
2132
|
|
Tercio@58
|
2133 --doo elsee
|
|
Tercio@58
|
2134 --was doing double loops due to not enought height
|