|
Tercio@11
|
1
|
|
Tercio@42
|
2 local dversion = 48
|
|
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@11
|
18
|
|
Tercioo@29
|
19 --> will always give a very random name for our widgets
|
|
Tercioo@29
|
20 local init_counter = math.random (1, 1000000)
|
|
Tercioo@29
|
21
|
|
Tercioo@29
|
22 DF.LabelNameCounter = DF.LabelNameCounter or init_counter
|
|
Tercioo@29
|
23 DF.PictureNameCounter = DF.PictureNameCounter or init_counter
|
|
Tercioo@29
|
24 DF.BarNameCounter = DF.BarNameCounter or init_counter
|
|
Tercioo@29
|
25 DF.DropDownCounter = DF.DropDownCounter or init_counter
|
|
Tercioo@29
|
26 DF.PanelCounter = DF.PanelCounter or init_counter
|
|
Tercioo@29
|
27 DF.SimplePanelCounter = DF.SimplePanelCounter or init_counter
|
|
Tercioo@29
|
28 DF.ButtonCounter = DF.ButtonCounter or init_counter
|
|
Tercioo@29
|
29 DF.SliderCounter = DF.SliderCounter or init_counter
|
|
Tercioo@29
|
30 DF.SwitchCounter = DF.SwitchCounter or init_counter
|
|
Tercioo@29
|
31 DF.SplitBarCounter = DF.SplitBarCounter or init_counter
|
|
Tercio@11
|
32
|
|
Tercio@39
|
33 DF.FRAMELEVEL_OVERLAY = 750
|
|
Tercio@39
|
34 DF.FRAMELEVEL_BACKGROUND = 150
|
|
Tercio@39
|
35
|
|
Tercio@25
|
36 DF.FrameWorkVersion = tostring (dversion)
|
|
Tercio@25
|
37 function DF:PrintVersion()
|
|
Tercio@25
|
38 print ("Details! Framework Version:", DF.FrameWorkVersion)
|
|
Tercio@25
|
39 end
|
|
Tercio@25
|
40
|
|
Tercio@22
|
41 LibStub:GetLibrary("AceTimer-3.0"):Embed (DF)
|
|
Tercio@22
|
42
|
|
Tercioo@29
|
43 --> get the working folder
|
|
Tercio@11
|
44 do
|
|
Tercio@11
|
45 local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua")
|
|
Tercio@11
|
46 if (path) then
|
|
Tercio@11
|
47 DF.folder = "Interface\\AddOns\\" .. path
|
|
Tercio@11
|
48 else
|
|
Tercioo@29
|
49 --> if not found, try to use the last valid one
|
|
Tercioo@29
|
50 DF.folder = DF.folder or ""
|
|
Tercio@11
|
51 end
|
|
Tercio@11
|
52 end
|
|
Tercio@11
|
53
|
|
Tercio@11
|
54 DF.debug = false
|
|
Tercio@11
|
55
|
|
Tercio@11
|
56 _G ["DetailsFramework"] = DF
|
|
Tercio@11
|
57
|
|
Tercio@11
|
58 DF.embeds = DF.embeds or {}
|
|
Tercio@11
|
59 local embed_functions = {
|
|
Tercio@20
|
60 "RemoveRealName",
|
|
Tercio@20
|
61 "table",
|
|
Tercio@20
|
62 "BuildDropDownFontList",
|
|
Tercio@11
|
63 "SetFontSize",
|
|
Tercio@11
|
64 "SetFontFace",
|
|
Tercio@11
|
65 "SetFontColor",
|
|
Tercio@11
|
66 "GetFontSize",
|
|
Tercio@11
|
67 "GetFontFace",
|
|
Tercio@17
|
68 "SetFontOutline",
|
|
Tercio@11
|
69 "trim",
|
|
Tercio@11
|
70 "Msg",
|
|
Tercio@11
|
71 "CreateFlashAnimation",
|
|
Tercio@11
|
72 "Fade",
|
|
Tercio@11
|
73 "NewColor",
|
|
Tercio@11
|
74 "IsHtmlColor",
|
|
Tercio@11
|
75 "ParseColors",
|
|
Tercio@11
|
76 "BuildMenu",
|
|
Tercio@11
|
77 "ShowTutorialAlertFrame",
|
|
Tercio@11
|
78 "GetNpcIdFromGuid",
|
|
Tercio@11
|
79 "ShowFeedbackPanel",
|
|
Tercio@20
|
80 "SetAsOptionsPanel",
|
|
Tercio@11
|
81
|
|
Tercio@11
|
82 "CreateDropDown",
|
|
Tercio@11
|
83 "CreateButton",
|
|
Tercio@11
|
84 "CreateColorPickButton",
|
|
Tercio@11
|
85 "CreateLabel",
|
|
Tercio@11
|
86 "CreateBar",
|
|
Tercio@11
|
87 "CreatePanel",
|
|
Tercio@11
|
88 "CreateFillPanel",
|
|
Tercio@11
|
89 "ColorPick",
|
|
Tercio@11
|
90 "IconPick",
|
|
Tercio@11
|
91 "CreateSimplePanel",
|
|
Tercio@11
|
92 "CreateChartPanel",
|
|
Tercio@11
|
93 "CreateImage",
|
|
Tercio@11
|
94 "CreateScrollBar",
|
|
Tercio@11
|
95 "CreateSwitch",
|
|
Tercio@11
|
96 "CreateSlider",
|
|
Tercio@11
|
97 "CreateSplitBar",
|
|
Tercio@11
|
98 "CreateTextEntry",
|
|
Tercio@11
|
99 "Create1PxPanel",
|
|
Tercio@11
|
100 "CreateFeedbackButton",
|
|
Tercio@20
|
101 "CreateOptionsFrame",
|
|
Tercio@22
|
102 "NewSpecialLuaEditorEntry",
|
|
Tercio@20
|
103 "ShowPromptPanel",
|
|
Tercio@22
|
104 "ShowTextPromptPanel",
|
|
Tercio@11
|
105 "www_icons",
|
|
Tercio@22
|
106 "GetTemplate",
|
|
Tercioo@29
|
107 "InstallTemplate",
|
|
Tercio@22
|
108 "GetFrameworkFolder",
|
|
Tercioo@29
|
109 "ShowPanicWarning",
|
|
Tercio@39
|
110 "SetFrameworkDebugState",
|
|
Tercio@39
|
111 "FindHighestParent",
|
|
Tercio@39
|
112 "OpenInterfaceProfile",
|
|
Tercio@40
|
113 "CreateInCombatTexture",
|
|
Tercio@40
|
114 "CreateAnimationHub",
|
|
Tercio@40
|
115 "CreateAnimation",
|
|
Tercio@40
|
116 "CreateScrollBox",
|
|
Tercio@40
|
117 "CreateBorder",
|
|
Tercio@42
|
118 "FormatNumber",
|
|
Tercio@11
|
119 }
|
|
Tercio@11
|
120
|
|
Tercio@20
|
121 DF.table = {}
|
|
Tercio@20
|
122
|
|
Tercio@22
|
123 function DF:GetFrameworkFolder()
|
|
Tercio@22
|
124 return DF.folder
|
|
Tercio@22
|
125 end
|
|
Tercio@22
|
126
|
|
Tercio@39
|
127 function DF:SetFrameworkDebugState (state)
|
|
Tercio@39
|
128 DF.debug = state
|
|
Tercio@39
|
129 end
|
|
Tercio@39
|
130
|
|
Tercio@26
|
131 function DF:FadeFrame (frame, t)
|
|
Tercio@26
|
132 if (t == 0) then
|
|
Tercio@26
|
133 frame.hidden = false
|
|
Tercio@26
|
134 frame.faded = false
|
|
Tercio@26
|
135 frame.fading_out = false
|
|
Tercio@26
|
136 frame.fading_in = false
|
|
Tercio@26
|
137 frame:Show()
|
|
Tercio@26
|
138 frame:SetAlpha (1)
|
|
Tercio@26
|
139
|
|
Tercio@26
|
140 elseif (t == 1) then
|
|
Tercio@26
|
141 frame.hidden = true
|
|
Tercio@26
|
142 frame.faded = true
|
|
Tercio@26
|
143 frame.fading_out = false
|
|
Tercio@26
|
144 frame.fading_in = false
|
|
Tercio@26
|
145 frame:SetAlpha (0)
|
|
Tercio@26
|
146 frame:Hide()
|
|
Tercio@26
|
147 end
|
|
Tercio@26
|
148 end
|
|
Tercio@26
|
149
|
|
Tercio@20
|
150 function DF.table.reverse (t)
|
|
Tercio@20
|
151 local new = {}
|
|
Tercio@20
|
152 local index = 1
|
|
Tercio@20
|
153 for i = #t, 1, -1 do
|
|
Tercio@20
|
154 new [index] = t[i]
|
|
Tercio@20
|
155 index = index + 1
|
|
Tercio@20
|
156 end
|
|
Tercio@20
|
157 return new
|
|
Tercio@20
|
158 end
|
|
Tercio@20
|
159
|
|
Tercio@20
|
160 --> copy from table2 to table1 overwriting values
|
|
Tercio@20
|
161 function DF.table.copy (t1, t2)
|
|
Tercio@20
|
162 for key, value in pairs (t2) do
|
|
Tercio@20
|
163 if (type (value) == "table") then
|
|
Tercio@20
|
164 t1 [key] = t1 [key] or {}
|
|
Tercio@20
|
165 DF.table.copy (t1 [key], t2 [key])
|
|
Tercio@20
|
166 else
|
|
Tercio@20
|
167 t1 [key] = value
|
|
Tercio@20
|
168 end
|
|
Tercio@20
|
169 end
|
|
Tercio@20
|
170 return t1
|
|
Tercio@20
|
171 end
|
|
Tercio@20
|
172
|
|
Tercio@20
|
173 --> copy values that does exist on table2 but not on table1
|
|
Tercio@20
|
174 function DF.table.deploy (t1, t2)
|
|
Tercio@20
|
175 for key, value in pairs (t2) do
|
|
Tercio@20
|
176 if (type (value) == "table") then
|
|
Tercio@20
|
177 t1 [key] = t1 [key] or {}
|
|
Tercio@20
|
178 DF.table.deploy (t1 [key], t2 [key])
|
|
Tercio@22
|
179 elseif (t1 [key] == nil) then
|
|
Tercio@20
|
180 t1 [key] = value
|
|
Tercio@20
|
181 end
|
|
Tercio@20
|
182 end
|
|
Tercio@20
|
183 end
|
|
Tercio@20
|
184
|
|
Tercio@20
|
185 function DF.table.dump (t, s, deep)
|
|
Tercio@20
|
186 s = s or ""
|
|
Tercio@20
|
187 deep = deep or 0
|
|
Tercio@20
|
188 local space = ""
|
|
Tercio@20
|
189 for i = 1, deep do
|
|
Tercio@20
|
190 space = space .. " "
|
|
Tercio@20
|
191 end
|
|
Tercio@20
|
192 for key, value in pairs (t) do
|
|
Tercio@20
|
193 local tpe = _type (value)
|
|
Tercio@20
|
194 if (type (key) ~= "string") then
|
|
Tercio@20
|
195 key = "unknown?"
|
|
Tercio@20
|
196 end
|
|
Tercio@20
|
197 if (tpe == "table") then
|
|
Tercio@20
|
198 s = s .. space .. "[" .. key .. "] = |cFFa9ffa9table {|r\n"
|
|
Tercio@20
|
199 s = s .. DF.table.dump (value, nil, deep+1)
|
|
Tercio@20
|
200 s = s .. space .. "|cFFa9ffa9}|r\n"
|
|
Tercio@20
|
201 elseif (tpe == "string") then
|
|
Tercio@20
|
202 s = s .. space .. "[" .. key .. "] = '|cFFfff1c1" .. value .. "|r'\n"
|
|
Tercio@20
|
203 elseif (tpe == "number") then
|
|
Tercio@20
|
204 s = s .. space .. "[" .. key .. "] = |cFFffc1f4" .. value .. "|r\n"
|
|
Tercio@20
|
205 elseif (tpe == "function") then
|
|
Tercio@20
|
206 s = s .. space .. "[" .. key .. "] = function()\n"
|
|
Tercio@20
|
207 elseif (tpe == "boolean") then
|
|
Tercio@20
|
208 s = s .. space .. "[" .. key .. "] = |cFF99d0ff" .. (value and "true" or "false") .. "|r\n"
|
|
Tercio@20
|
209 end
|
|
Tercio@20
|
210 end
|
|
Tercio@20
|
211 return s
|
|
Tercio@20
|
212 end
|
|
Tercio@20
|
213
|
|
Tercio@11
|
214 DF.www_icons = {
|
|
Tercio@11
|
215 texture = "feedback_sites",
|
|
Tercio@11
|
216 wowi = {0, 0.7890625, 0, 37/128},
|
|
Tercio@11
|
217 curse = {0, 0.7890625, 38/123, 79/128},
|
|
Tercio@11
|
218 mmoc = {0, 0.7890625, 80/123, 123/128},
|
|
Tercio@11
|
219 }
|
|
Tercio@11
|
220
|
|
Tercio@42
|
221 local symbol_1K, symbol_10K, symbol_1B
|
|
Tercio@42
|
222 if (GetLocale() == "koKR") then
|
|
Tercio@42
|
223 symbol_1K, symbol_10K, symbol_1B = "천", "만", "억"
|
|
Tercio@42
|
224 elseif (GetLocale() == "zhCN") then
|
|
Tercio@42
|
225 symbol_1K, symbol_10K, symbol_1B = "千", "万", "亿"
|
|
Tercio@42
|
226 elseif (GetLocale() == "zhTW") then
|
|
Tercio@42
|
227 symbol_1K, symbol_10K, symbol_1B = "千", "萬", "億"
|
|
Tercio@42
|
228 end
|
|
Tercio@42
|
229
|
|
Tercio@42
|
230 if (symbol_1K) then
|
|
Tercio@42
|
231 function DF.FormatNumber (numero)
|
|
Tercio@42
|
232 if (numero > 99999999) then
|
|
Tercio@42
|
233 return format ("%.2f", numero/100000000) .. symbol_1B
|
|
Tercio@42
|
234 elseif (numero > 999999) then
|
|
Tercio@42
|
235 return format ("%.2f", numero/10000) .. symbol_10K
|
|
Tercio@42
|
236 elseif (numero > 99999) then
|
|
Tercio@42
|
237 return floor (numero/10000) .. symbol_10K
|
|
Tercio@42
|
238 elseif (numero > 9999) then
|
|
Tercio@42
|
239 return format ("%.1f", (numero/10000)) .. symbol_10K
|
|
Tercio@42
|
240 elseif (numero > 999) then
|
|
Tercio@42
|
241 return format ("%.1f", (numero/1000)) .. symbol_1K
|
|
Tercio@42
|
242 end
|
|
Tercio@42
|
243 return format ("%.1f", numero)
|
|
Tercio@42
|
244 end
|
|
Tercio@42
|
245 else
|
|
Tercio@42
|
246 function DF.FormatNumber (numero)
|
|
Tercio@42
|
247 if (numero > 999999) then
|
|
Tercio@42
|
248 return format ("%.2f", numero/1000000) .. "M"
|
|
Tercio@42
|
249 elseif (numero > 99999) then
|
|
Tercio@42
|
250 return floor (numero/1000) .. "K"
|
|
Tercio@42
|
251 elseif (numero > 999) then
|
|
Tercio@42
|
252 return format ("%.1f", (numero/1000)) .. "K"
|
|
Tercio@42
|
253 end
|
|
Tercio@42
|
254 return format ("%.1f", numero)
|
|
Tercio@42
|
255 end
|
|
Tercio@42
|
256 end
|
|
Tercio@42
|
257
|
|
Tercio@24
|
258 function DF:IntegerToTimer (value)
|
|
Tercio@24
|
259 return "" .. floor (value/60) .. ":" .. format ("%02.f", value%60)
|
|
Tercio@24
|
260 end
|
|
Tercio@24
|
261
|
|
Tercio@11
|
262 function DF:Embed (target)
|
|
Tercio@11
|
263 for k, v in pairs (embed_functions) do
|
|
Tercio@11
|
264 target[v] = self[v]
|
|
Tercio@11
|
265 end
|
|
Tercio@11
|
266 self.embeds [target] = true
|
|
Tercio@11
|
267 return target
|
|
Tercio@11
|
268 end
|
|
Tercio@11
|
269
|
|
Tercioo@28
|
270 function DF:RemoveRealmName (name)
|
|
Tercioo@28
|
271 return name:gsub (("%-.*"), "")
|
|
Tercioo@28
|
272 end
|
|
Tercioo@28
|
273
|
|
Tercio@20
|
274 function DF:RemoveRealName (name)
|
|
Tercio@20
|
275 return name:gsub (("%-.*"), "")
|
|
Tercio@20
|
276 end
|
|
Tercio@20
|
277
|
|
Tercio@11
|
278 function DF:SetFontSize (fontString, ...)
|
|
Tercio@11
|
279 local fonte, _, flags = fontString:GetFont()
|
|
Tercio@11
|
280 fontString:SetFont (fonte, max (...), flags)
|
|
Tercio@11
|
281 end
|
|
Tercio@11
|
282 function DF:SetFontFace (fontString, fontface)
|
|
Tercio@25
|
283 local font = SharedMedia:Fetch ("font", fontface, true)
|
|
Tercio@25
|
284 if (font) then
|
|
Tercio@25
|
285 fontface = font
|
|
Tercio@25
|
286 end
|
|
Tercio@25
|
287
|
|
Tercio@11
|
288 local _, size, flags = fontString:GetFont()
|
|
Tercio@11
|
289 fontString:SetFont (fontface, size, flags)
|
|
Tercio@11
|
290 end
|
|
Tercio@11
|
291 function DF:SetFontColor (fontString, r, g, b, a)
|
|
Tercio@11
|
292 r, g, b, a = DF:ParseColors (r, g, b, a)
|
|
Tercio@11
|
293 fontString:SetTextColor (r, g, b, a)
|
|
Tercio@11
|
294 end
|
|
Tercio@11
|
295
|
|
Tercio@11
|
296 function DF:GetFontSize (fontString)
|
|
Tercio@11
|
297 local _, size = fontString:GetFont()
|
|
Tercio@11
|
298 return size
|
|
Tercio@11
|
299 end
|
|
Tercio@11
|
300 function DF:GetFontFace (fontString)
|
|
Tercio@11
|
301 local fontface = fontString:GetFont()
|
|
Tercio@11
|
302 return fontface
|
|
Tercio@11
|
303 end
|
|
Tercio@11
|
304
|
|
Tercio@11
|
305 function DF:SetFontOutline (fontString, outline)
|
|
Tercio@11
|
306 local fonte, size = fontString:GetFont()
|
|
Tercio@11
|
307 if (outline) then
|
|
Tercio@11
|
308 if (_type (outline) == "boolean" and outline) then
|
|
Tercio@11
|
309 outline = "OUTLINE"
|
|
Tercio@11
|
310 elseif (outline == 1) then
|
|
Tercio@11
|
311 outline = "OUTLINE"
|
|
Tercio@11
|
312 elseif (outline == 2) then
|
|
Tercio@11
|
313 outline = "THICKOUTLINE"
|
|
Tercio@11
|
314 end
|
|
Tercio@11
|
315 end
|
|
Tercio@11
|
316
|
|
Tercio@11
|
317 fontString:SetFont (fonte, size, outline)
|
|
Tercio@11
|
318 end
|
|
Tercio@11
|
319
|
|
Tercio@11
|
320 function DF:trim (s)
|
|
Tercio@11
|
321 local from = s:match"^%s*()"
|
|
Tercio@11
|
322 return from > #s and "" or s:match(".*%S", from)
|
|
Tercio@11
|
323 end
|
|
Tercio@11
|
324
|
|
Tercio@11
|
325 function DF:Msg (msg)
|
|
Tercio@11
|
326 print ("|cFFFFFFAA" .. self.__name .. "|r " .. msg)
|
|
Tercio@11
|
327 end
|
|
Tercio@11
|
328
|
|
Tercio@11
|
329 function DF:GetNpcIdFromGuid (guid)
|
|
Tercio@11
|
330 local NpcId = select ( 6, strsplit ( "-", guid ) )
|
|
Tercio@11
|
331 if (NpcId) then
|
|
Tercio@11
|
332 return tonumber ( NpcId )
|
|
Tercio@11
|
333 end
|
|
Tercio@11
|
334 return 0
|
|
Tercio@11
|
335 end
|
|
Tercio@11
|
336
|
|
Tercio@11
|
337 local onFinish = function (self)
|
|
Tercio@11
|
338 if (self.showWhenDone) then
|
|
Tercio@11
|
339 self.frame:SetAlpha (1)
|
|
Tercio@11
|
340 else
|
|
Tercio@11
|
341 self.frame:SetAlpha (0)
|
|
Tercio@11
|
342 self.frame:Hide()
|
|
Tercio@11
|
343 end
|
|
Tercio@11
|
344
|
|
Tercio@11
|
345 if (self.onFinishFunc) then
|
|
Tercio@11
|
346 self:onFinishFunc (self.frame)
|
|
Tercio@11
|
347 end
|
|
Tercio@11
|
348 end
|
|
Tercio@11
|
349
|
|
Tercio@11
|
350 local stop = function (self)
|
|
Tercio@11
|
351 local FlashAnimation = self.FlashAnimation
|
|
Tercio@11
|
352 FlashAnimation:Stop()
|
|
Tercio@11
|
353 end
|
|
Tercio@11
|
354
|
|
Tercio@11
|
355 local flash = function (self, fadeInTime, fadeOutTime, flashDuration, showWhenDone, flashInHoldTime, flashOutHoldTime, loopType)
|
|
Tercio@11
|
356
|
|
Tercio@11
|
357 local FlashAnimation = self.FlashAnimation
|
|
Tercio@11
|
358
|
|
Tercio@11
|
359 local fadeIn = FlashAnimation.fadeIn
|
|
Tercio@11
|
360 local fadeOut = FlashAnimation.fadeOut
|
|
Tercio@11
|
361
|
|
Tercio@11
|
362 fadeIn:Stop()
|
|
Tercio@11
|
363 fadeOut:Stop()
|
|
Tercio@11
|
364
|
|
Tercio@11
|
365 fadeIn:SetDuration (fadeInTime or 1)
|
|
Tercio@11
|
366 fadeIn:SetEndDelay (flashInHoldTime or 0)
|
|
Tercio@11
|
367
|
|
Tercio@11
|
368 fadeOut:SetDuration (fadeOutTime or 1)
|
|
Tercio@11
|
369 fadeOut:SetEndDelay (flashOutHoldTime or 0)
|
|
Tercio@11
|
370
|
|
Tercio@11
|
371 FlashAnimation.duration = flashDuration
|
|
Tercio@11
|
372 FlashAnimation.loopTime = FlashAnimation:GetDuration()
|
|
Tercio@11
|
373 FlashAnimation.finishAt = GetTime() + flashDuration
|
|
Tercio@11
|
374 FlashAnimation.showWhenDone = showWhenDone
|
|
Tercio@11
|
375
|
|
Tercio@11
|
376 FlashAnimation:SetLooping (loopType or "REPEAT")
|
|
Tercio@11
|
377
|
|
Tercio@11
|
378 self:Show()
|
|
Tercio@11
|
379 self:SetAlpha (0)
|
|
Tercio@11
|
380 FlashAnimation:Play()
|
|
Tercio@11
|
381 end
|
|
Tercio@11
|
382
|
|
Tercio@11
|
383 function DF:CreateFlashAnimation (frame, onFinishFunc, onLoopFunc)
|
|
Tercio@11
|
384 local FlashAnimation = frame:CreateAnimationGroup()
|
|
Tercio@11
|
385
|
|
Tercio@11
|
386 FlashAnimation.fadeOut = FlashAnimation:CreateAnimation ("Alpha") --> fade out anime
|
|
Tercio@11
|
387 FlashAnimation.fadeOut:SetOrder (1)
|
|
Tercio@39
|
388 FlashAnimation.fadeOut:SetFromAlpha (0)
|
|
Tercio@39
|
389 FlashAnimation.fadeOut:SetToAlpha (1)
|
|
Tercio@11
|
390
|
|
Tercio@11
|
391 FlashAnimation.fadeIn = FlashAnimation:CreateAnimation ("Alpha") --> fade in anime
|
|
Tercio@11
|
392 FlashAnimation.fadeIn:SetOrder (2)
|
|
Tercio@39
|
393 FlashAnimation.fadeIn:SetFromAlpha (1)
|
|
Tercio@39
|
394 FlashAnimation.fadeIn:SetToAlpha (0)
|
|
Tercio@11
|
395
|
|
Tercio@11
|
396 frame.FlashAnimation = FlashAnimation
|
|
Tercio@11
|
397 FlashAnimation.frame = frame
|
|
Tercio@11
|
398 FlashAnimation.onFinishFunc = onFinishFunc
|
|
Tercio@11
|
399
|
|
Tercio@11
|
400 FlashAnimation:SetScript ("OnLoop", onLoopFunc)
|
|
Tercio@11
|
401 FlashAnimation:SetScript ("OnFinished", onFinish)
|
|
Tercio@11
|
402
|
|
Tercio@11
|
403 frame.Flash = flash
|
|
Tercio@11
|
404 frame.Stop = stop
|
|
Tercio@11
|
405 end
|
|
Tercio@11
|
406
|
|
Tercio@11
|
407 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
408 --> points
|
|
Tercio@11
|
409
|
|
Tercio@11
|
410 function DF:CheckPoints (v1, v2, v3, v4, v5, object)
|
|
Tercio@11
|
411
|
|
Tercio@11
|
412 if (not v1 and not v2) then
|
|
Tercio@11
|
413 return "topleft", object.widget:GetParent(), "topleft", 0, 0
|
|
Tercio@11
|
414 end
|
|
Tercio@11
|
415
|
|
Tercio@11
|
416 if (_type (v1) == "string") then
|
|
Tercio@11
|
417 local frameGlobal = _G [v1]
|
|
Tercio@11
|
418 if (frameGlobal and frameGlobal.GetObjectType) then
|
|
Tercio@11
|
419 return DF:CheckPoints (frameGlobal, v2, v3, v4, v5, object)
|
|
Tercio@11
|
420 end
|
|
Tercio@11
|
421
|
|
Tercio@11
|
422 elseif (_type (v2) == "string") then
|
|
Tercio@11
|
423 local frameGlobal = _G [v2]
|
|
Tercio@11
|
424 if (frameGlobal and frameGlobal.GetObjectType) then
|
|
Tercio@11
|
425 return DF:CheckPoints (v1, frameGlobal, v3, v4, v5, object)
|
|
Tercio@11
|
426 end
|
|
Tercio@11
|
427 end
|
|
Tercio@11
|
428
|
|
Tercio@11
|
429 if (_type (v1) == "string" and _type (v2) == "table") then --> :setpoint ("left", frame, _, _, _)
|
|
Tercio@11
|
430 if (not v3 or _type (v3) == "number") then --> :setpoint ("left", frame, 10, 10)
|
|
Tercio@11
|
431 v1, v2, v3, v4, v5 = v1, v2, v1, v3, v4
|
|
Tercio@11
|
432 end
|
|
Tercio@11
|
433
|
|
Tercio@11
|
434 elseif (_type (v1) == "string" and _type (v2) == "number") then --> :setpoint ("topleft", x, y)
|
|
Tercio@11
|
435 v1, v2, v3, v4, v5 = v1, object.widget:GetParent(), v1, v2, v3
|
|
Tercio@11
|
436
|
|
Tercio@11
|
437 elseif (_type (v1) == "number") then --> :setpoint (x, y)
|
|
Tercio@11
|
438 v1, v2, v3, v4, v5 = "topleft", object.widget:GetParent(), "topleft", v1, v2
|
|
Tercio@11
|
439
|
|
Tercio@11
|
440 elseif (_type (v1) == "table") then --> :setpoint (frame, x, y)
|
|
Tercio@11
|
441 v1, v2, v3, v4, v5 = "topleft", v1, "topleft", v2, v3
|
|
Tercio@11
|
442
|
|
Tercio@11
|
443 end
|
|
Tercio@11
|
444
|
|
Tercio@11
|
445 if (not v2) then
|
|
Tercio@11
|
446 v2 = object.widget:GetParent()
|
|
Tercio@11
|
447 elseif (v2.dframework) then
|
|
Tercio@11
|
448 v2 = v2.widget
|
|
Tercio@11
|
449 end
|
|
Tercio@11
|
450
|
|
Tercio@11
|
451 return v1 or "topleft", v2, v3 or "topleft", v4 or 0, v5 or 0
|
|
Tercio@11
|
452 end
|
|
Tercio@11
|
453
|
|
Tercio@11
|
454
|
|
Tercio@11
|
455 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
456 --> colors
|
|
Tercio@11
|
457
|
|
Tercio@11
|
458 function DF:NewColor (_colorname, _colortable, _green, _blue, _alpha)
|
|
Tercio@11
|
459 assert (_type (_colorname) == "string", "NewColor: colorname must be a string.")
|
|
Tercio@11
|
460 assert (not DF.alias_text_colors [_colorname], "NewColor: colorname already exists.")
|
|
Tercio@11
|
461
|
|
Tercio@11
|
462 if (_type (_colortable) == "table") then
|
|
Tercio@11
|
463 if (_colortable[1] and _colortable[2] and _colortable[3]) then
|
|
Tercio@11
|
464 _colortable[4] = _colortable[4] or 1
|
|
Tercio@11
|
465 DF.alias_text_colors [_colorname] = _colortable
|
|
Tercio@11
|
466 else
|
|
Tercio@11
|
467 error ("invalid color table.")
|
|
Tercio@11
|
468 end
|
|
Tercio@11
|
469 elseif (_colortable and _green and _blue) then
|
|
Tercio@11
|
470 _alpha = _alpha or 1
|
|
Tercio@11
|
471 DF.alias_text_colors [_colorname] = {_colortable, _green, _blue, _alpha}
|
|
Tercio@11
|
472 else
|
|
Tercio@11
|
473 error ("invalid parameter.")
|
|
Tercio@11
|
474 end
|
|
Tercio@11
|
475
|
|
Tercio@11
|
476 return true
|
|
Tercio@11
|
477 end
|
|
Tercio@11
|
478
|
|
Tercio@11
|
479 function DF:IsHtmlColor (color)
|
|
Tercio@11
|
480 return DF.alias_text_colors [color]
|
|
Tercio@11
|
481 end
|
|
Tercio@11
|
482
|
|
Tercio@11
|
483 local tn = tonumber
|
|
Tercio@11
|
484 function DF:ParseColors (_arg1, _arg2, _arg3, _arg4)
|
|
Tercio@11
|
485 if (_type (_arg1) == "table") then
|
|
Tercio@25
|
486 if (not _arg1[1] and _arg1.r) then
|
|
Tercio@25
|
487 _arg1, _arg2, _arg3, _arg4 = _arg1.r, _arg1.g, _arg1.b, _arg1.a
|
|
Tercio@25
|
488 else
|
|
Tercio@25
|
489 _arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
|
|
Tercio@25
|
490 end
|
|
Tercio@11
|
491
|
|
Tercio@11
|
492 elseif (_type (_arg1) == "string") then
|
|
Tercio@11
|
493
|
|
Tercio@11
|
494 if (string.find (_arg1, "#")) then
|
|
Tercio@11
|
495 _arg1 = _arg1:gsub ("#","")
|
|
Tercio@11
|
496 if (string.len (_arg1) == 8) then --alpha
|
|
Tercio@11
|
497 _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
|
498 else
|
|
Tercio@11
|
499 _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
|
500 end
|
|
Tercio@11
|
501
|
|
Tercio@11
|
502 else
|
|
Tercio@11
|
503 local color = DF.alias_text_colors [_arg1]
|
|
Tercio@11
|
504 if (color) then
|
|
Tercio@11
|
505 _arg1, _arg2, _arg3, _arg4 = _unpack (color)
|
|
Tercio@11
|
506 else
|
|
Tercio@11
|
507 _arg1, _arg2, _arg3, _arg4 = _unpack (DF.alias_text_colors.none)
|
|
Tercio@11
|
508 end
|
|
Tercio@11
|
509 end
|
|
Tercio@11
|
510 end
|
|
Tercio@11
|
511
|
|
Tercio@11
|
512 if (not _arg1) then
|
|
Tercio@11
|
513 _arg1 = 1
|
|
Tercio@11
|
514 end
|
|
Tercio@11
|
515 if (not _arg2) then
|
|
Tercio@11
|
516 _arg2 = 1
|
|
Tercio@11
|
517 end
|
|
Tercio@11
|
518 if (not _arg3) then
|
|
Tercio@11
|
519 _arg3 = 1
|
|
Tercio@11
|
520 end
|
|
Tercio@11
|
521 if (not _arg4) then
|
|
Tercio@11
|
522 _arg4 = 1
|
|
Tercio@11
|
523 end
|
|
Tercio@11
|
524
|
|
Tercio@11
|
525 return _arg1, _arg2, _arg3, _arg4
|
|
Tercio@11
|
526 end
|
|
Tercio@11
|
527
|
|
Tercio@11
|
528 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
529 --> menus
|
|
Tercio@11
|
530
|
|
Tercio@39
|
531 local disable_on_combat = {}
|
|
Tercio@39
|
532
|
|
Tercio@22
|
533 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
|
534
|
|
Tercio@22
|
535 if (not parent.widget_list) then
|
|
Tercio@22
|
536 DF:SetAsOptionsPanel (parent)
|
|
Tercio@22
|
537 end
|
|
Tercio@11
|
538
|
|
Tercio@11
|
539 local cur_x = x_offset
|
|
Tercio@11
|
540 local cur_y = y_offset
|
|
Tercio@11
|
541 local max_x = 0
|
|
Tercio@11
|
542
|
|
Tercio@11
|
543 height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20)
|
|
Tercio@11
|
544 height = height*-1
|
|
Tercio@11
|
545
|
|
Tercio@11
|
546 for index, widget_table in ipairs (menu) do
|
|
Tercio@11
|
547
|
|
Tercio@39
|
548 local widget_created
|
|
Tercio@39
|
549
|
|
Tercio@20
|
550 if (widget_table.type == "blank" or widget_table.type == "space") then
|
|
Tercio@20
|
551 -- do nothing
|
|
Tercio@20
|
552
|
|
Tercio@20
|
553 elseif (widget_table.type == "label" or widget_table.type == "text") then
|
|
Tercio@22
|
554 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
|
555 label._get = widget_table.get
|
|
Tercio@20
|
556 label.widget_type = "label"
|
|
Tercio@20
|
557 label:SetPoint (cur_x, cur_y)
|
|
Tercio@20
|
558 tinsert (parent.widget_list, label)
|
|
Tercio@20
|
559
|
|
Tercio@20
|
560 elseif (widget_table.type == "select" or widget_table.type == "dropdown") then
|
|
Tercio@22
|
561 local dropdown = DF:NewDropDown (parent, nil, "$parentWidget" .. index, nil, 140, 18, widget_table.values, widget_table.get(), dropdown_template)
|
|
Tercio@11
|
562 dropdown.tooltip = widget_table.desc
|
|
Tercio@20
|
563 dropdown._get = widget_table.get
|
|
Tercio@20
|
564 dropdown.widget_type = "select"
|
|
Tercio@22
|
565 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
|
566 dropdown:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
567 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
568
|
|
Tercio@11
|
569 local size = label.widget:GetStringWidth() + 140 + 4
|
|
Tercio@11
|
570 if (size > max_x) then
|
|
Tercio@11
|
571 max_x = size
|
|
Tercio@11
|
572 end
|
|
Tercio@11
|
573
|
|
Tercio@20
|
574 tinsert (parent.widget_list, dropdown)
|
|
Tercio@39
|
575 widget_created = dropdown
|
|
Tercio@20
|
576
|
|
Tercio@11
|
577 elseif (widget_table.type == "toggle" or widget_table.type == "switch") then
|
|
Tercio@22
|
578 local switch = DF:NewSwitch (parent, nil, "$parentWidget" .. index, nil, 60, 20, nil, nil, widget_table.get(), nil, nil, nil, nil, switch_template)
|
|
Tercio@11
|
579 switch.tooltip = widget_table.desc
|
|
Tercio@20
|
580 switch._get = widget_table.get
|
|
Tercio@20
|
581 switch.widget_type = "toggle"
|
|
Tercio@11
|
582 switch.OnSwitch = widget_table.set
|
|
Tercio@11
|
583
|
|
Tercio@22
|
584 if (switch_is_box) then
|
|
Tercio@22
|
585 switch:SetAsCheckBox()
|
|
Tercio@22
|
586 end
|
|
Tercio@22
|
587
|
|
Tercio@22
|
588 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
|
589 switch:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
590 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
591
|
|
Tercio@11
|
592 local size = label.widget:GetStringWidth() + 60 + 4
|
|
Tercio@11
|
593 if (size > max_x) then
|
|
Tercio@11
|
594 max_x = size
|
|
Tercio@11
|
595 end
|
|
Tercio@11
|
596
|
|
Tercio@20
|
597 tinsert (parent.widget_list, switch)
|
|
Tercio@39
|
598 widget_created = switch
|
|
Tercio@20
|
599
|
|
Tercio@11
|
600 elseif (widget_table.type == "range" or widget_table.type == "slider") then
|
|
Tercio@11
|
601 local is_decimanls = widget_table.usedecimals
|
|
Tercio@22
|
602 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
|
603 slider.tooltip = widget_table.desc
|
|
Tercio@20
|
604 slider._get = widget_table.get
|
|
Tercio@20
|
605 slider.widget_type = "range"
|
|
Tercio@11
|
606 slider:SetHook ("OnValueChange", widget_table.set)
|
|
Tercio@11
|
607
|
|
Tercio@40
|
608 if (widget_table.thumbscale) then
|
|
Tercio@40
|
609 slider:SetThumbSize (slider.thumb:GetWidth()*widget_table.thumbscale, nil)
|
|
Tercio@40
|
610 end
|
|
Tercio@40
|
611
|
|
Tercio@22
|
612 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
|
613 slider:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
614 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
615
|
|
Tercio@11
|
616 local size = label.widget:GetStringWidth() + 140 + 6
|
|
Tercio@11
|
617 if (size > max_x) then
|
|
Tercio@11
|
618 max_x = size
|
|
Tercio@11
|
619 end
|
|
Tercio@11
|
620
|
|
Tercio@20
|
621 tinsert (parent.widget_list, slider)
|
|
Tercio@39
|
622 widget_created = slider
|
|
Tercio@20
|
623
|
|
Tercio@11
|
624 elseif (widget_table.type == "color" or widget_table.type == "color") then
|
|
Tercio@22
|
625 local colorpick = DF:NewColorPickButton (parent, "$parentWidget" .. index, nil, widget_table.set, nil, button_template)
|
|
Tercio@11
|
626 colorpick.tooltip = widget_table.desc
|
|
Tercio@20
|
627 colorpick._get = widget_table.get
|
|
Tercio@20
|
628 colorpick.widget_type = "color"
|
|
Tercio@11
|
629
|
|
Tercio@11
|
630 local default_value, g, b, a = widget_table.get()
|
|
Tercio@11
|
631 if (type (default_value) == "table") then
|
|
Tercio@11
|
632 colorpick:SetColor (unpack (default_value))
|
|
Tercio@11
|
633 else
|
|
Tercio@11
|
634 colorpick:SetColor (default_value, g, b, a)
|
|
Tercio@11
|
635 end
|
|
Tercio@11
|
636
|
|
Tercio@22
|
637 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
|
638 colorpick:SetPoint ("left", label, "right", 2)
|
|
Tercio@11
|
639 label:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
640
|
|
Tercio@11
|
641 local size = label.widget:GetStringWidth() + 60 + 4
|
|
Tercio@11
|
642 if (size > max_x) then
|
|
Tercio@11
|
643 max_x = size
|
|
Tercio@11
|
644 end
|
|
Tercio@11
|
645
|
|
Tercio@20
|
646 tinsert (parent.widget_list, colorpick)
|
|
Tercio@39
|
647 widget_created = colorpick
|
|
Tercio@20
|
648
|
|
Tercio@11
|
649 elseif (widget_table.type == "execute" or widget_table.type == "button") then
|
|
Tercio@11
|
650
|
|
Tercio@22
|
651 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)
|
|
Tercio@22
|
652 if (not button_template) then
|
|
Tercio@22
|
653 button:InstallCustomTexture()
|
|
Tercio@22
|
654 end
|
|
Tercio@22
|
655
|
|
Tercio@11
|
656 button:SetPoint (cur_x, cur_y)
|
|
Tercio@11
|
657 button.tooltip = widget_table.desc
|
|
Tercio@20
|
658 button.widget_type = "execute"
|
|
Tercio@11
|
659
|
|
Tercio@11
|
660 local size = button:GetWidth() + 4
|
|
Tercio@11
|
661 if (size > max_x) then
|
|
Tercio@11
|
662 max_x = size
|
|
Tercio@11
|
663 end
|
|
Tercio@11
|
664
|
|
Tercio@20
|
665 tinsert (parent.widget_list, button)
|
|
Tercio@39
|
666 widget_created = button
|
|
Tercio@20
|
667
|
|
Tercio@11
|
668 end
|
|
Tercio@39
|
669
|
|
Tercio@39
|
670 if (widget_table.nocombat) then
|
|
Tercio@39
|
671 tinsert (disable_on_combat, widget_created)
|
|
Tercio@39
|
672 end
|
|
Tercio@11
|
673
|
|
Tercio@11
|
674 if (widget_table.spacement) then
|
|
Tercio@11
|
675 cur_y = cur_y - 30
|
|
Tercio@11
|
676 else
|
|
Tercio@11
|
677 cur_y = cur_y - 20
|
|
Tercio@11
|
678 end
|
|
Tercio@11
|
679
|
|
Tercio@39
|
680 if (widget_table.type == "breakline" or cur_y < height) then
|
|
Tercio@11
|
681 cur_y = y_offset
|
|
Tercio@11
|
682 cur_x = cur_x + max_x + 30
|
|
Tercio@11
|
683 max_x = 0
|
|
Tercio@11
|
684 end
|
|
Tercio@11
|
685
|
|
Tercio@11
|
686 end
|
|
Tercio@11
|
687
|
|
Tercio@39
|
688 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
689
|
|
Tercio@11
|
690 end
|
|
Tercio@39
|
691
|
|
Tercio@39
|
692 local lock_notsafe_widgets = function()
|
|
Tercio@39
|
693 for _, widget in ipairs (disable_on_combat) do
|
|
Tercio@39
|
694 widget:Disable()
|
|
Tercio@39
|
695 end
|
|
Tercio@39
|
696 end
|
|
Tercio@39
|
697 local unlock_notsafe_widgets = function()
|
|
Tercio@39
|
698 for _, widget in ipairs (disable_on_combat) do
|
|
Tercio@39
|
699 widget:Enable()
|
|
Tercio@39
|
700 end
|
|
Tercio@39
|
701 end
|
|
Tercio@39
|
702 function DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
703 if (DF.PlayerHasCombatFlag) then
|
|
Tercio@39
|
704 lock_notsafe_widgets()
|
|
Tercio@39
|
705 else
|
|
Tercio@39
|
706 unlock_notsafe_widgets()
|
|
Tercio@39
|
707 end
|
|
Tercio@39
|
708 end
|
|
Tercio@39
|
709 DF.PlayerHasCombatFlag = false
|
|
Tercio@39
|
710 local ProtectCombatFrame = CreateFrame ("frame")
|
|
Tercio@39
|
711 ProtectCombatFrame:RegisterEvent ("PLAYER_REGEN_ENABLED")
|
|
Tercio@39
|
712 ProtectCombatFrame:RegisterEvent ("PLAYER_REGEN_DISABLED")
|
|
Tercio@39
|
713 ProtectCombatFrame:RegisterEvent ("PLAYER_ENTERING_WORLD")
|
|
Tercio@39
|
714 ProtectCombatFrame:SetScript ("OnEvent", function (self, event)
|
|
Tercio@39
|
715 if (event == "PLAYER_ENTERING_WORLD") then
|
|
Tercio@39
|
716 if (InCombatLockdown()) then
|
|
Tercio@39
|
717 DF.PlayerHasCombatFlag = true
|
|
Tercio@39
|
718 else
|
|
Tercio@39
|
719 DF.PlayerHasCombatFlag = false
|
|
Tercio@39
|
720 end
|
|
Tercio@39
|
721 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
722
|
|
Tercio@39
|
723 elseif (event == "PLAYER_REGEN_ENABLED") then
|
|
Tercio@39
|
724 DF.PlayerHasCombatFlag = false
|
|
Tercio@39
|
725 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
726
|
|
Tercio@39
|
727 elseif (event == "PLAYER_REGEN_DISABLED") then
|
|
Tercio@39
|
728 DF.PlayerHasCombatFlag = true
|
|
Tercio@39
|
729 DF.RefreshUnsafeOptionsWidgets()
|
|
Tercio@39
|
730
|
|
Tercio@39
|
731 end
|
|
Tercio@39
|
732 end)
|
|
Tercio@40
|
733
|
|
Tercio@40
|
734 function DF:CreateInCombatTexture (frame)
|
|
Tercio@40
|
735 if (DF.debug and not frame) then
|
|
Tercio@40
|
736 error ("Details! Framework: CreateInCombatTexture invalid frame on parameter 1.")
|
|
Tercio@40
|
737 end
|
|
Tercio@40
|
738
|
|
Tercio@40
|
739 local in_combat_background = DF:CreateImage (frame)
|
|
Tercio@40
|
740 in_combat_background:SetColorTexture (.6, 0, 0, .1)
|
|
Tercio@40
|
741 in_combat_background:Hide()
|
|
Tercio@40
|
742
|
|
Tercio@40
|
743 local in_combat_label = Plater:CreateLabel (frame, "you are in combat", 24, "silver")
|
|
Tercio@40
|
744 in_combat_label:SetPoint ("right", in_combat_background, "right", -10, 0)
|
|
Tercio@40
|
745 in_combat_label:Hide()
|
|
Tercio@40
|
746
|
|
Tercio@40
|
747 frame:RegisterEvent ("PLAYER_REGEN_DISABLED")
|
|
Tercio@40
|
748 frame:RegisterEvent ("PLAYER_REGEN_ENABLED")
|
|
Tercio@40
|
749 frame:SetScript ("OnEvent", function (self, event)
|
|
Tercio@40
|
750 if (event == "PLAYER_REGEN_DISABLED") then
|
|
Tercio@40
|
751 in_combat_background:Show()
|
|
Tercio@40
|
752 in_combat_label:Show()
|
|
Tercio@40
|
753 elseif (event == "PLAYER_REGEN_ENABLED") then
|
|
Tercio@40
|
754 in_combat_background:Hide()
|
|
Tercio@40
|
755 in_combat_label:Hide()
|
|
Tercio@40
|
756 end
|
|
Tercio@40
|
757 end)
|
|
Tercio@40
|
758
|
|
Tercio@40
|
759 return in_combat_background
|
|
Tercio@40
|
760 end
|
|
Tercio@11
|
761
|
|
Tercio@11
|
762 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@11
|
763 --> tutorials
|
|
Tercio@11
|
764
|
|
Tercio@11
|
765 function DF:ShowTutorialAlertFrame (maintext, desctext, clickfunc)
|
|
Tercio@11
|
766
|
|
Tercio@11
|
767 local TutorialAlertFrame = _G.DetailsFrameworkTutorialAlertFrame
|
|
Tercio@11
|
768
|
|
Tercio@11
|
769 if (not TutorialAlertFrame) then
|
|
Tercio@11
|
770
|
|
Tercio@11
|
771 TutorialAlertFrame = CreateFrame ("ScrollFrame", "DetailsFrameworkTutorialAlertFrame", UIParent, "DetailsFrameworkTutorialAlertFrameTemplate")
|
|
Tercio@11
|
772 TutorialAlertFrame.isFirst = true
|
|
Tercio@11
|
773 TutorialAlertFrame:SetPoint ("left", UIParent, "left", -20, 100)
|
|
Tercio@11
|
774
|
|
Tercio@11
|
775 TutorialAlertFrame:SetWidth (290)
|
|
Tercio@11
|
776 TutorialAlertFrame.ScrollChild:SetWidth (256)
|
|
Tercio@11
|
777
|
|
Tercio@11
|
778 local scrollname = TutorialAlertFrame.ScrollChild:GetName()
|
|
Tercio@11
|
779 _G [scrollname .. "BorderTopLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
780 _G [scrollname .. "BorderTopRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
781 _G [scrollname .. "BorderBotLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
782 _G [scrollname .. "BorderBotRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
783 _G [scrollname .. "BorderLeft"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
784 _G [scrollname .. "BorderRight"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
785 _G [scrollname .. "BorderBottom"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
786 _G [scrollname .. "BorderTop"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
787
|
|
Tercio@11
|
788 local iconbg = _G [scrollname .. "QuestIconBg"]
|
|
Tercio@11
|
789 iconbg:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
|
|
Tercio@11
|
790 iconbg:SetTexCoord (0, 1, 0, 1)
|
|
Tercio@11
|
791 iconbg:SetSize (100, 100)
|
|
Tercio@11
|
792 iconbg:ClearAllPoints()
|
|
Tercio@11
|
793 iconbg:SetPoint ("bottomleft", TutorialAlertFrame.ScrollChild, "bottomleft")
|
|
Tercio@11
|
794
|
|
Tercio@11
|
795 _G [scrollname .. "Exclamation"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
796 _G [scrollname .. "QuestionMark"]:SetVertexColor (1, 0.8, 0, 1)
|
|
Tercio@11
|
797
|
|
Tercio@11
|
798 _G [scrollname .. "TopText"]:SetText ("Details!") --string
|
|
Tercio@11
|
799 _G [scrollname .. "QuestName"]:SetText ("") --string
|
|
Tercio@11
|
800 _G [scrollname .. "BottomText"]:SetText ("") --string
|
|
Tercio@11
|
801
|
|
Tercio@11
|
802 TutorialAlertFrame.ScrollChild.IconShine:SetTexture ([[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]])
|
|
Tercio@11
|
803
|
|
Tercio@11
|
804 TutorialAlertFrame:SetScript ("OnMouseUp", function (self)
|
|
Tercio@11
|
805 if (self.clickfunc and type (self.clickfunc) == "function") then
|
|
Tercio@11
|
806 self.clickfunc()
|
|
Tercio@11
|
807 end
|
|
Tercio@11
|
808 self:Hide()
|
|
Tercio@11
|
809 end)
|
|
Tercio@11
|
810 TutorialAlertFrame:Hide()
|
|
Tercio@11
|
811 end
|
|
Tercio@11
|
812
|
|
Tercio@11
|
813 if (type (maintext) == "string") then
|
|
Tercio@11
|
814 TutorialAlertFrame.ScrollChild.QuestName:SetText (maintext)
|
|
Tercio@11
|
815 else
|
|
Tercio@11
|
816 TutorialAlertFrame.ScrollChild.QuestName:SetText ("")
|
|
Tercio@11
|
817 end
|
|
Tercio@11
|
818
|
|
Tercio@11
|
819 if (type (desctext) == "string") then
|
|
Tercio@11
|
820 TutorialAlertFrame.ScrollChild.BottomText:SetText (desctext)
|
|
Tercio@11
|
821 else
|
|
Tercio@11
|
822 TutorialAlertFrame.ScrollChild.BottomText:SetText ("")
|
|
Tercio@11
|
823 end
|
|
Tercio@11
|
824
|
|
Tercio@11
|
825 TutorialAlertFrame.clickfunc = clickfunc
|
|
Tercio@11
|
826 TutorialAlertFrame:Show()
|
|
Tercio@11
|
827 DetailsTutorialAlertFrame_SlideInFrame (TutorialAlertFrame, "AUTOQUEST")
|
|
Tercio@11
|
828 end
|
|
Tercio@11
|
829
|
|
Tercio@20
|
830 local refresh_options = function (self)
|
|
Tercio@20
|
831 for _, widget in ipairs (self.widget_list) do
|
|
Tercio@20
|
832 if (widget._get) then
|
|
Tercio@20
|
833 if (widget.widget_type == "label") then
|
|
Tercio@20
|
834 if (widget._get()) then
|
|
Tercio@20
|
835 widget:SetText (widget._get())
|
|
Tercio@20
|
836 end
|
|
Tercio@20
|
837 elseif (widget.widget_type == "select") then
|
|
Tercio@20
|
838 widget:Select (widget._get())
|
|
Tercio@20
|
839 elseif (widget.widget_type == "toggle" or widget.widget_type == "range") then
|
|
Tercio@20
|
840 widget:SetValue (widget._get())
|
|
Tercio@20
|
841 elseif (widget.widget_type == "color") then
|
|
Tercio@20
|
842 local default_value, g, b, a = widget._get()
|
|
Tercio@20
|
843 if (type (default_value) == "table") then
|
|
Tercio@20
|
844 widget:SetColor (unpack (default_value))
|
|
Tercio@20
|
845 else
|
|
Tercio@20
|
846 widget:SetColor (default_value, g, b, a)
|
|
Tercio@20
|
847 end
|
|
Tercio@20
|
848 end
|
|
Tercio@20
|
849 end
|
|
Tercio@20
|
850 end
|
|
Tercio@20
|
851 end
|
|
Tercio@20
|
852
|
|
Tercio@20
|
853 function DF:SetAsOptionsPanel (frame)
|
|
Tercio@20
|
854 frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
855 frame.widget_list = {}
|
|
Tercio@20
|
856 end
|
|
Tercio@20
|
857
|
|
Tercio@11
|
858 function DF:CreateOptionsFrame (name, title, template)
|
|
Tercio@11
|
859
|
|
Tercio@11
|
860 template = template or 1
|
|
Tercio@11
|
861
|
|
Tercio@11
|
862 if (template == 2) then
|
|
Tercio@11
|
863 local options_frame = CreateFrame ("frame", name, UIParent, "ButtonFrameTemplate")
|
|
Tercio@11
|
864 tinsert (UISpecialFrames, name)
|
|
Tercio@11
|
865 options_frame:SetSize (500, 200)
|
|
Tercio@20
|
866 options_frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
867 options_frame.widget_list = {}
|
|
Tercio@11
|
868
|
|
Tercio@11
|
869 options_frame:SetScript ("OnMouseDown", function(self, button)
|
|
Tercio@11
|
870 if (button == "RightButton") then
|
|
Tercio@11
|
871 if (self.moving) then
|
|
Tercio@11
|
872 self.moving = false
|
|
Tercio@11
|
873 self:StopMovingOrSizing()
|
|
Tercio@11
|
874 end
|
|
Tercio@11
|
875 return options_frame:Hide()
|
|
Tercio@11
|
876 elseif (button == "LeftButton" and not self.moving) then
|
|
Tercio@11
|
877 self.moving = true
|
|
Tercio@11
|
878 self:StartMoving()
|
|
Tercio@11
|
879 end
|
|
Tercio@11
|
880 end)
|
|
Tercio@11
|
881 options_frame:SetScript ("OnMouseUp", function(self)
|
|
Tercio@11
|
882 if (self.moving) then
|
|
Tercio@11
|
883 self.moving = false
|
|
Tercio@11
|
884 self:StopMovingOrSizing()
|
|
Tercio@11
|
885 end
|
|
Tercio@11
|
886 end)
|
|
Tercio@11
|
887
|
|
Tercio@11
|
888 options_frame:SetMovable (true)
|
|
Tercio@11
|
889 options_frame:EnableMouse (true)
|
|
Tercio@11
|
890 options_frame:SetFrameStrata ("DIALOG")
|
|
Tercio@11
|
891 options_frame:SetToplevel (true)
|
|
Tercio@11
|
892
|
|
Tercio@11
|
893 options_frame:Hide()
|
|
Tercio@11
|
894
|
|
Tercio@11
|
895 options_frame:SetPoint ("center", UIParent, "center")
|
|
Tercio@11
|
896 options_frame.TitleText:SetText (title)
|
|
Tercio@11
|
897 options_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]])
|
|
Tercio@11
|
898
|
|
Tercio@11
|
899 return options_frame
|
|
Tercio@11
|
900
|
|
Tercio@11
|
901 elseif (template == 1) then
|
|
Tercio@11
|
902
|
|
Tercio@11
|
903 local options_frame = CreateFrame ("frame", name, UIParent)
|
|
Tercio@11
|
904 tinsert (UISpecialFrames, name)
|
|
Tercio@11
|
905 options_frame:SetSize (500, 200)
|
|
Tercio@20
|
906 options_frame.RefreshOptions = refresh_options
|
|
Tercio@20
|
907 options_frame.widget_list = {}
|
|
Tercio@11
|
908
|
|
Tercio@11
|
909 options_frame:SetScript ("OnMouseDown", function(self, button)
|
|
Tercio@11
|
910 if (button == "RightButton") then
|
|
Tercio@11
|
911 if (self.moving) then
|
|
Tercio@11
|
912 self.moving = false
|
|
Tercio@11
|
913 self:StopMovingOrSizing()
|
|
Tercio@11
|
914 end
|
|
Tercio@11
|
915 return options_frame:Hide()
|
|
Tercio@11
|
916 elseif (button == "LeftButton" and not self.moving) then
|
|
Tercio@11
|
917 self.moving = true
|
|
Tercio@11
|
918 self:StartMoving()
|
|
Tercio@11
|
919 end
|
|
Tercio@11
|
920 end)
|
|
Tercio@11
|
921 options_frame:SetScript ("OnMouseUp", function(self)
|
|
Tercio@11
|
922 if (self.moving) then
|
|
Tercio@11
|
923 self.moving = false
|
|
Tercio@11
|
924 self:StopMovingOrSizing()
|
|
Tercio@11
|
925 end
|
|
Tercio@11
|
926 end)
|
|
Tercio@11
|
927
|
|
Tercio@11
|
928 options_frame:SetMovable (true)
|
|
Tercio@11
|
929 options_frame:EnableMouse (true)
|
|
Tercio@11
|
930 options_frame:SetFrameStrata ("DIALOG")
|
|
Tercio@11
|
931 options_frame:SetToplevel (true)
|
|
Tercio@11
|
932
|
|
Tercio@11
|
933 options_frame:Hide()
|
|
Tercio@11
|
934
|
|
Tercio@11
|
935 options_frame:SetPoint ("center", UIParent, "center")
|
|
Tercio@11
|
936
|
|
Tercio@11
|
937 options_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
|
|
Tercio@18
|
938 edgeFile = DF.folder .. "border_2", edgeSize = 32,
|
|
Tercio@11
|
939 insets = {left = 1, right = 1, top = 1, bottom = 1}})
|
|
Tercio@11
|
940 options_frame:SetBackdropColor (0, 0, 0, .7)
|
|
Tercio@11
|
941
|
|
Tercio@11
|
942 local texturetitle = options_frame:CreateTexture (nil, "artwork")
|
|
Tercio@11
|
943 texturetitle:SetTexture ([[Interface\CURSOR\Interact]])
|
|
Tercio@11
|
944 texturetitle:SetTexCoord (0, 1, 0, 1)
|
|
Tercio@11
|
945 texturetitle:SetVertexColor (1, 1, 1, 1)
|
|
Tercio@11
|
946 texturetitle:SetPoint ("topleft", options_frame, "topleft", 2, -3)
|
|
Tercio@11
|
947 texturetitle:SetWidth (36)
|
|
Tercio@11
|
948 texturetitle:SetHeight (36)
|
|
Tercio@11
|
949
|
|
Tercio@11
|
950 local title = DF:NewLabel (options_frame, nil, "$parentTitle", nil, title, nil, 20, "yellow")
|
|
Tercio@11
|
951 title:SetPoint ("left", texturetitle, "right", 2, -1)
|
|
Tercio@11
|
952 DF:SetFontOutline (title, true)
|
|
Tercio@11
|
953
|
|
Tercio@11
|
954 local c = CreateFrame ("Button", nil, options_frame, "UIPanelCloseButton")
|
|
Tercio@11
|
955 c:SetWidth (32)
|
|
Tercio@11
|
956 c:SetHeight (32)
|
|
Tercio@11
|
957 c:SetPoint ("TOPRIGHT", options_frame, "TOPRIGHT", -3, -3)
|
|
Tercio@11
|
958 c:SetFrameLevel (options_frame:GetFrameLevel()+1)
|
|
Tercio@11
|
959
|
|
Tercio@11
|
960 return options_frame
|
|
Tercio@11
|
961 end
|
|
Tercio@22
|
962 end
|
|
Tercio@22
|
963
|
|
Tercio@22
|
964 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@22
|
965 --> templates
|
|
Tercio@22
|
966
|
|
Tercio@22
|
967 DF.font_templates = {}
|
|
Tercio@22
|
968 DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
|
|
Tercio@22
|
969 DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
|
|
Tercio@22
|
970
|
|
Tercio@22
|
971 DF.dropdown_templates = {}
|
|
Tercio@22
|
972 DF.dropdown_templates ["OPTIONS_DROPDOWN_TEMPLATE"] = {
|
|
Tercio@22
|
973 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
974 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
975 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
976 onentercolor = {1, 1, 1, .5},
|
|
Tercio@22
|
977 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
978 }
|
|
Tercio@22
|
979
|
|
Tercio@22
|
980 DF.switch_templates = {}
|
|
Tercio@22
|
981 DF.switch_templates ["OPTIONS_CHECKBOX_TEMPLATE"] = {
|
|
Tercio@22
|
982 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
983 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
984 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
985 width = 18,
|
|
Tercio@22
|
986 height = 18,
|
|
Tercio@22
|
987 enabled_backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
988 disabled_backdropcolor = {1, 1, 1, .2},
|
|
Tercio@22
|
989 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
990 }
|
|
Tercio@22
|
991 DF.switch_templates ["OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"] = {
|
|
Tercio@22
|
992 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
993 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
994 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
995 width = 18,
|
|
Tercio@22
|
996 height = 18,
|
|
Tercio@22
|
997 enabled_backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
998 disabled_backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
999 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
1000 }
|
|
Tercio@22
|
1001
|
|
Tercio@22
|
1002 DF.button_templates = {}
|
|
Tercio@22
|
1003 DF.button_templates ["OPTIONS_BUTTON_TEMPLATE"] = {
|
|
Tercio@22
|
1004 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
1005 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1006 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
1007 }
|
|
Tercio@22
|
1008
|
|
Tercio@22
|
1009 DF.slider_templates = {}
|
|
Tercio@22
|
1010 DF.slider_templates ["OPTIONS_SLIDER_TEMPLATE"] = {
|
|
Tercio@22
|
1011 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
|
Tercio@22
|
1012 backdropcolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1013 backdropbordercolor = {0, 0, 0, 1},
|
|
Tercio@22
|
1014 onentercolor = {1, 1, 1, .5},
|
|
Tercio@22
|
1015 onenterbordercolor = {1, 1, 1, 1},
|
|
Tercio@22
|
1016 thumbtexture = [[Interface\Tooltips\UI-Tooltip-Background]],
|
|
Tercio@22
|
1017 thumbwidth = 16,
|
|
Tercio@22
|
1018 thumbheight = 14,
|
|
Tercio@22
|
1019 thumbcolor = {0, 0, 0, 0.5},
|
|
Tercio@22
|
1020 }
|
|
Tercio@22
|
1021
|
|
Tercioo@29
|
1022 function DF:InstallTemplate (widget_type, template_name, template)
|
|
Tercioo@29
|
1023 widget_type = string.lower (widget_type)
|
|
Tercioo@29
|
1024
|
|
Tercio@22
|
1025 local template_table
|
|
Tercioo@29
|
1026 if (widget_type == "font") then
|
|
Tercio@22
|
1027 template_table = DF.font_templates
|
|
Tercioo@29
|
1028 elseif (widget_type == "dropdown") then
|
|
Tercio@22
|
1029 template_table = DF.dropdown_templates
|
|
Tercioo@29
|
1030 elseif (widget_type == "button") then
|
|
Tercio@22
|
1031 template_table = DF.button_templates
|
|
Tercioo@29
|
1032 elseif (widget_type == "switch") then
|
|
Tercio@22
|
1033 template_table = DF.switch_templates
|
|
Tercioo@29
|
1034 elseif (widget_type == "slider") then
|
|
Tercioo@29
|
1035 template_table = DF.slider_templates
|
|
Tercioo@29
|
1036 end
|
|
Tercioo@29
|
1037
|
|
Tercioo@29
|
1038 template_table [template_name] = template
|
|
Tercioo@29
|
1039
|
|
Tercioo@29
|
1040 return template
|
|
Tercioo@29
|
1041 end
|
|
Tercioo@29
|
1042
|
|
Tercioo@29
|
1043 function DF:GetTemplate (widget_type, template_name)
|
|
Tercioo@29
|
1044 widget_type = string.lower (widget_type)
|
|
Tercioo@29
|
1045
|
|
Tercioo@29
|
1046 local template_table
|
|
Tercioo@29
|
1047 if (widget_type == "font") then
|
|
Tercioo@29
|
1048 template_table = DF.font_templates
|
|
Tercioo@29
|
1049 elseif (widget_type == "dropdown") then
|
|
Tercioo@29
|
1050 template_table = DF.dropdown_templates
|
|
Tercioo@29
|
1051 elseif (widget_type == "button") then
|
|
Tercioo@29
|
1052 template_table = DF.button_templates
|
|
Tercioo@29
|
1053 elseif (widget_type == "switch") then
|
|
Tercioo@29
|
1054 template_table = DF.switch_templates
|
|
Tercioo@29
|
1055 elseif (widget_type == "slider") then
|
|
Tercio@22
|
1056 template_table = DF.slider_templates
|
|
Tercio@22
|
1057 end
|
|
Tercio@22
|
1058 return template_table [template_name]
|
|
Tercio@22
|
1059 end
|
|
Tercioo@28
|
1060
|
|
Tercioo@28
|
1061 function DF.GetParentName (frame)
|
|
Tercioo@28
|
1062 local parentName = frame:GetName()
|
|
Tercioo@28
|
1063 if (not parentName) then
|
|
Tercioo@28
|
1064 error ("Details! FrameWork: called $parent but parent was no name.", 2)
|
|
Tercioo@28
|
1065 end
|
|
Tercioo@28
|
1066 return parentName
|
|
Tercioo@28
|
1067 end
|
|
Tercio@39
|
1068
|
|
Tercio@39
|
1069 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@39
|
1070 --> widget scripts and hooks
|
|
Tercio@39
|
1071
|
|
Tercio@39
|
1072 function DF:RunHooksForWidget (event, ...)
|
|
Tercio@39
|
1073 local hooks = self.HookList [event]
|
|
Tercio@39
|
1074
|
|
Tercio@39
|
1075 if (not hooks) then
|
|
Tercio@39
|
1076 print (self.widget:GetName(), "sem hook para", event)
|
|
Tercio@39
|
1077 return
|
|
Tercio@39
|
1078 end
|
|
Tercio@39
|
1079
|
|
Tercio@39
|
1080 for i, func in ipairs (hooks) do
|
|
Tercio@39
|
1081 local success, canInterrupt = pcall (func, ...)
|
|
Tercio@39
|
1082 if (not success) then
|
|
Tercio@39
|
1083 error ("Details! Framework: " .. event .. " hook for " .. self:GetName() .. ": " .. canInterrupt)
|
|
Tercio@39
|
1084 elseif (canInterrupt) then
|
|
Tercio@39
|
1085 return true
|
|
Tercio@39
|
1086 end
|
|
Tercio@39
|
1087 end
|
|
Tercio@39
|
1088 end
|
|
Tercio@39
|
1089
|
|
Tercio@39
|
1090 function DF:SetHook (hookType, func)
|
|
Tercio@39
|
1091 if (self.HookList [hookType]) then
|
|
Tercio@39
|
1092 if (type (func) == "function") then
|
|
Tercio@39
|
1093 local isRemoval = false
|
|
Tercio@39
|
1094 for i = #self.HookList [hookType], 1, -1 do
|
|
Tercio@39
|
1095 if (self.HookList [hookType] [i] == func) then
|
|
Tercio@39
|
1096 tremove (self.HookList [hookType], i)
|
|
Tercio@39
|
1097 isRemoval = true
|
|
Tercio@39
|
1098 break
|
|
Tercio@39
|
1099 end
|
|
Tercio@39
|
1100 end
|
|
Tercio@39
|
1101 if (not isRemoval) then
|
|
Tercio@39
|
1102 tinsert (self.HookList [hookType], func)
|
|
Tercio@39
|
1103 end
|
|
Tercio@39
|
1104 else
|
|
Tercio@39
|
1105 if (DF.debug) then
|
|
Tercio@39
|
1106 error ("Details! Framework: invalid function for widget " .. self.WidgetType .. ".")
|
|
Tercio@39
|
1107 end
|
|
Tercio@39
|
1108 end
|
|
Tercio@39
|
1109 else
|
|
Tercio@39
|
1110 if (DF.debug) then
|
|
Tercio@39
|
1111 error ("Details! Framework: unknown hook type for widget " .. self.WidgetType .. ": '" .. hookType .. "'.")
|
|
Tercio@39
|
1112 end
|
|
Tercio@39
|
1113 end
|
|
Tercio@39
|
1114 end
|
|
Tercio@39
|
1115
|
|
Tercio@39
|
1116 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Tercio@39
|
1117 --> members
|
|
Tercio@39
|
1118
|
|
Tercio@39
|
1119 DF.GlobalWidgetControlNames = {
|
|
Tercio@39
|
1120 textentry = "DF_TextEntryMetaFunctions",
|
|
Tercio@39
|
1121 button = "DF_ButtonMetaFunctions",
|
|
Tercio@39
|
1122 panel = "DF_PanelMetaFunctions",
|
|
Tercio@39
|
1123 dropdown = "DF_DropdownMetaFunctions",
|
|
Tercio@39
|
1124 label = "DF_LabelMetaFunctions",
|
|
Tercio@39
|
1125 normal_bar = "DF_NormalBarMetaFunctions",
|
|
Tercio@39
|
1126 image = "DF_ImageMetaFunctions",
|
|
Tercio@39
|
1127 slider = "DF_SliderMetaFunctions",
|
|
Tercio@39
|
1128 split_bar = "DF_SplitBarMetaFunctions",
|
|
Tercio@40
|
1129 aura_tracker = "DF_AuraTracker",
|
|
Tercio@39
|
1130 }
|
|
Tercio@39
|
1131
|
|
Tercio@39
|
1132 function DF:AddMemberForWidget (widgetName, memberType, memberName, func)
|
|
Tercio@39
|
1133 if (DF.GlobalWidgetControlNames [widgetName]) then
|
|
Tercio@39
|
1134 if (type (memberName) == "string" and (memberType == "SET" or memberType == "GET")) then
|
|
Tercio@39
|
1135 if (func) then
|
|
Tercio@39
|
1136 local widgetControlObject = _G [DF.GlobalWidgetControlNames [widgetName]]
|
|
Tercio@39
|
1137
|
|
Tercio@39
|
1138 if (memberType == "SET") then
|
|
Tercio@39
|
1139 widgetControlObject ["SetMembers"] [memberName] = func
|
|
Tercio@39
|
1140 elseif (memberType == "GET") then
|
|
Tercio@39
|
1141 widgetControlObject ["GetMembers"] [memberName] = func
|
|
Tercio@39
|
1142 end
|
|
Tercio@39
|
1143 else
|
|
Tercio@39
|
1144 if (DF.debug) then
|
|
Tercio@39
|
1145 error ("Details! Framework: AddMemberForWidget invalid function.")
|
|
Tercio@39
|
1146 end
|
|
Tercio@39
|
1147 end
|
|
Tercio@39
|
1148 else
|
|
Tercio@39
|
1149 if (DF.debug) then
|
|
Tercio@39
|
1150 error ("Details! Framework: AddMemberForWidget unknown memberName or memberType.")
|
|
Tercio@39
|
1151 end
|
|
Tercio@39
|
1152 end
|
|
Tercio@39
|
1153 else
|
|
Tercio@39
|
1154 if (DF.debug) then
|
|
Tercio@39
|
1155 error ("Details! Framework: AddMemberForWidget unknown widget type: " .. (widgetName or "") .. ".")
|
|
Tercio@39
|
1156 end
|
|
Tercio@39
|
1157 end
|
|
Tercio@39
|
1158 end
|
|
Tercio@39
|
1159
|
|
Tercio@39
|
1160 -----------------------------
|
|
Tercio@39
|
1161
|
|
Tercio@39
|
1162 function DF:OpenInterfaceProfile()
|
|
Tercio@39
|
1163 InterfaceOptionsFrame_OpenToCategory (self.__name)
|
|
Tercio@39
|
1164 InterfaceOptionsFrame_OpenToCategory (self.__name)
|
|
Tercio@39
|
1165 for i = 1, 100 do
|
|
Tercio@39
|
1166 local button = _G ["InterfaceOptionsFrameAddOnsButton" .. i]
|
|
Tercio@39
|
1167 if (button) then
|
|
Tercio@39
|
1168 local text = _G ["InterfaceOptionsFrameAddOnsButton" .. i .. "Text"]
|
|
Tercio@39
|
1169 if (text) then
|
|
Tercio@39
|
1170 text = text:GetText()
|
|
Tercio@39
|
1171 if (text == self.__name) then
|
|
Tercio@39
|
1172 local toggle = _G ["InterfaceOptionsFrameAddOnsButton" .. i .. "Toggle"]
|
|
Tercio@39
|
1173 if (toggle) then
|
|
Tercio@39
|
1174 if (toggle:GetNormalTexture():GetTexture():find ("PlusButton")) then
|
|
Tercio@39
|
1175 --is minimized, need expand
|
|
Tercio@39
|
1176 toggle:Click()
|
|
Tercio@39
|
1177 _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click()
|
|
Tercio@39
|
1178 elseif (toggle:GetNormalTexture():GetTexture():find ("MinusButton")) then
|
|
Tercio@39
|
1179 --isn't minimized
|
|
Tercio@39
|
1180 _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click()
|
|
Tercio@39
|
1181 end
|
|
Tercio@39
|
1182 end
|
|
Tercio@39
|
1183 break
|
|
Tercio@39
|
1184 end
|
|
Tercio@39
|
1185 end
|
|
Tercio@39
|
1186 else
|
|
Tercio@39
|
1187 self:Msg ("Couldn't not find the profile panel.")
|
|
Tercio@39
|
1188 break
|
|
Tercio@39
|
1189 end
|
|
Tercio@39
|
1190 end
|
|
Tercio@39
|
1191 end
|
|
Tercio@39
|
1192
|
|
Tercio@39
|
1193 -----------------------------
|
|
Tercio@39
|
1194 --safe copy from blizz api
|
|
Tercio@39
|
1195 function DF:Mixin (object, ...)
|
|
Tercio@39
|
1196 for i = 1, select("#", ...) do
|
|
Tercio@39
|
1197 local mixin = select(i, ...);
|
|
Tercio@39
|
1198 for k, v in pairs(mixin) do
|
|
Tercio@39
|
1199 object[k] = v;
|
|
Tercio@39
|
1200 end
|
|
Tercio@39
|
1201 end
|
|
Tercio@39
|
1202
|
|
Tercio@39
|
1203 return object;
|
|
Tercio@39
|
1204 end
|
|
Tercio@40
|
1205
|
|
Tercio@40
|
1206 -----------------------------
|
|
Tercio@40
|
1207 --> animations
|
|
Tercio@40
|
1208
|
|
Tercio@40
|
1209 function DF:CreateAnimationHub (parent, onPlay, onFinished)
|
|
Tercio@40
|
1210 local newAnimation = parent:CreateAnimationGroup()
|
|
Tercio@40
|
1211 newAnimation:SetScript ("OnPlay", onPlay)
|
|
Tercio@40
|
1212 newAnimation:SetScript ("OnFinished", onFinished)
|
|
Tercio@40
|
1213 newAnimation.NextAnimation = 1
|
|
Tercio@40
|
1214 return newAnimation
|
|
Tercio@40
|
1215 end
|
|
Tercio@40
|
1216
|
|
Tercio@40
|
1217 function DF:CreateAnimation (animation, type, order, duration, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
|
Tercio@40
|
1218 local anim = animation:CreateAnimation (type)
|
|
Tercio@40
|
1219
|
|
Tercio@40
|
1220 anim:SetOrder (order or animation.NextAnimation)
|
|
Tercio@40
|
1221 anim:SetDuration (duration)
|
|
Tercio@40
|
1222
|
|
Tercio@40
|
1223 type = string.upper (type)
|
|
Tercio@40
|
1224
|
|
Tercio@40
|
1225 if (type == "ALPHA") then
|
|
Tercio@40
|
1226 anim:SetFromAlpha (arg1)
|
|
Tercio@40
|
1227 anim:SetToAlpha (arg2)
|
|
Tercio@40
|
1228
|
|
Tercio@40
|
1229 elseif (type == "SCALE") then
|
|
Tercio@40
|
1230 anim:SetFromScale (arg1, arg2)
|
|
Tercio@40
|
1231 anim:SetToScale (arg3, arg4)
|
|
Tercio@40
|
1232 anim:SetOrigin (arg5 or "center", arg6 or 0, arg7 or 0) --point, x, y
|
|
Tercio@40
|
1233
|
|
Tercio@40
|
1234 elseif (type == "ROTATION") then
|
|
Tercio@40
|
1235 anim:SetDegrees (arg1) --degree
|
|
Tercio@40
|
1236 anim:SetOrigin (arg2 or "center", arg3 or 0, arg4 or 0) --point, x, y
|
|
Tercio@40
|
1237
|
|
Tercio@40
|
1238 elseif (type == "TRANSLATION") then
|
|
Tercio@40
|
1239 anim:SetOffset (arg1, arg2)
|
|
Tercio@40
|
1240
|
|
Tercio@40
|
1241 end
|
|
Tercio@40
|
1242
|
|
Tercio@40
|
1243 animation.NextAnimation = animation.NextAnimation + 1
|
|
Tercio@40
|
1244 return anim
|
|
Tercio@40
|
1245 end
|
|
Tercio@40
|
1246
|
|
Tercio@40
|
1247
|
|
Tercio@40
|
1248 -----------------------------
|
|
Tercio@40
|
1249 --> borders
|
|
Tercio@40
|
1250
|
|
Tercio@40
|
1251 local default_border_color1 = .5
|
|
Tercio@40
|
1252 local default_border_color2 = .3
|
|
Tercio@40
|
1253 local default_border_color3 = .1
|
|
Tercio@40
|
1254
|
|
Tercio@40
|
1255 local SetBorderAlpha = function (self, alpha1, alpha2, alpha3)
|
|
Tercio@40
|
1256 self.Borders.Alpha1 = alpha1 or self.Borders.Alpha1
|
|
Tercio@40
|
1257 self.Borders.Alpha2 = alpha2 or self.Borders.Alpha2
|
|
Tercio@40
|
1258 self.Borders.Alpha3 = alpha3 or self.Borders.Alpha3
|
|
Tercio@40
|
1259
|
|
Tercio@40
|
1260 for _, texture in ipairs (self.Borders.Layer1) do
|
|
Tercio@40
|
1261 texture:SetAlpha (self.Borders.Alpha1)
|
|
Tercio@40
|
1262 end
|
|
Tercio@40
|
1263 for _, texture in ipairs (self.Borders.Layer2) do
|
|
Tercio@40
|
1264 texture:SetAlpha (self.Borders.Alpha2)
|
|
Tercio@40
|
1265 end
|
|
Tercio@40
|
1266 for _, texture in ipairs (self.Borders.Layer3) do
|
|
Tercio@40
|
1267 texture:SetAlpha (self.Borders.Alpha3)
|
|
Tercio@40
|
1268 end
|
|
Tercio@40
|
1269 end
|
|
Tercio@40
|
1270
|
|
Tercio@40
|
1271 function DF:CreateBorder (parent, alpha1, alpha2, alpha3)
|
|
Tercio@40
|
1272
|
|
Tercio@40
|
1273 parent.Borders = {
|
|
Tercio@40
|
1274 Layer1 = {},
|
|
Tercio@40
|
1275 Layer2 = {},
|
|
Tercio@40
|
1276 Layer3 = {},
|
|
Tercio@40
|
1277 Alpha1 = alpha1 or default_border_color1,
|
|
Tercio@40
|
1278 Alpha2 = alpha2 or default_border_color2,
|
|
Tercio@40
|
1279 Alpha3 = alpha3 or default_border_color3,
|
|
Tercio@40
|
1280 }
|
|
Tercio@40
|
1281
|
|
Tercio@40
|
1282 parent.SetBorderAlpha = SetBorderAlpha
|
|
Tercio@40
|
1283
|
|
Tercio@40
|
1284 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1285 border1:SetPoint ("topleft", parent, "topleft", -1, 1)
|
|
Tercio@40
|
1286 border1:SetPoint ("bottomleft", parent, "bottomleft", -1, -1)
|
|
Tercio@40
|
1287 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@40
|
1288 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1289 border2:SetPoint ("topleft", parent, "topleft", -2, 2)
|
|
Tercio@40
|
1290 border2:SetPoint ("bottomleft", parent, "bottomleft", -2, -2)
|
|
Tercio@40
|
1291 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@40
|
1292 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1293 border3:SetPoint ("topleft", parent, "topleft", -3, 3)
|
|
Tercio@40
|
1294 border3:SetPoint ("bottomleft", parent, "bottomleft", -3, -3)
|
|
Tercio@40
|
1295 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@40
|
1296
|
|
Tercio@40
|
1297 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@40
|
1298 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@40
|
1299 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@40
|
1300
|
|
Tercio@40
|
1301 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1302 border1:SetPoint ("topleft", parent, "topleft", 0, 1)
|
|
Tercio@40
|
1303 border1:SetPoint ("topright", parent, "topright", 1, 1)
|
|
Tercio@40
|
1304 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@40
|
1305 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1306 border2:SetPoint ("topleft", parent, "topleft", -1, 2)
|
|
Tercio@40
|
1307 border2:SetPoint ("topright", parent, "topright", 2, 2)
|
|
Tercio@40
|
1308 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@40
|
1309 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1310 border3:SetPoint ("topleft", parent, "topleft", -2, 3)
|
|
Tercio@40
|
1311 border3:SetPoint ("topright", parent, "topright", 3, 3)
|
|
Tercio@40
|
1312 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@40
|
1313
|
|
Tercio@40
|
1314 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@40
|
1315 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@40
|
1316 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@40
|
1317
|
|
Tercio@40
|
1318 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1319 border1:SetPoint ("topright", parent, "topright", 1, 0)
|
|
Tercio@40
|
1320 border1:SetPoint ("bottomright", parent, "bottomright", 1, -1)
|
|
Tercio@40
|
1321 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@40
|
1322 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1323 border2:SetPoint ("topright", parent, "topright", 2, 1)
|
|
Tercio@40
|
1324 border2:SetPoint ("bottomright", parent, "bottomright", 2, -2)
|
|
Tercio@40
|
1325 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@40
|
1326 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1327 border3:SetPoint ("topright", parent, "topright", 3, 2)
|
|
Tercio@40
|
1328 border3:SetPoint ("bottomright", parent, "bottomright", 3, -3)
|
|
Tercio@40
|
1329 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@40
|
1330
|
|
Tercio@40
|
1331 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@40
|
1332 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@40
|
1333 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@40
|
1334
|
|
Tercio@40
|
1335 local border1 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1336 border1:SetPoint ("bottomleft", parent, "bottomleft", 0, -1)
|
|
Tercio@40
|
1337 border1:SetPoint ("bottomright", parent, "bottomright", 0, -1)
|
|
Tercio@40
|
1338 border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1)
|
|
Tercio@40
|
1339 local border2 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1340 border2:SetPoint ("bottomleft", parent, "bottomleft", -1, -2)
|
|
Tercio@40
|
1341 border2:SetPoint ("bottomright", parent, "bottomright", 1, -2)
|
|
Tercio@40
|
1342 border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2)
|
|
Tercio@40
|
1343 local border3 = parent:CreateTexture (nil, "background")
|
|
Tercio@40
|
1344 border3:SetPoint ("bottomleft", parent, "bottomleft", -2, -3)
|
|
Tercio@40
|
1345 border3:SetPoint ("bottomright", parent, "bottomright", 2, -3)
|
|
Tercio@40
|
1346 border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3)
|
|
Tercio@40
|
1347
|
|
Tercio@40
|
1348 tinsert (parent.Borders.Layer1, border1)
|
|
Tercio@40
|
1349 tinsert (parent.Borders.Layer2, border2)
|
|
Tercio@40
|
1350 tinsert (parent.Borders.Layer3, border3)
|
|
Tercio@40
|
1351
|
|
Tercio@40
|
1352 end
|
|
Tercio@40
|
1353
|
|
Tercio@40
|
1354 function DF:ReskinSlider (slider, heightOffset)
|
|
Tercio@40
|
1355 if (slider.slider) then
|
|
Tercio@40
|
1356 slider.cima:SetNormalTexture ([[Interface\Buttons\Arrow-Up-Up]])
|
|
Tercio@40
|
1357 slider.cima:SetPushedTexture ([[Interface\Buttons\Arrow-Up-Down]])
|
|
Tercio@40
|
1358 slider.cima:SetDisabledTexture ([[Interface\Buttons\Arrow-Up-Disabled]])
|
|
Tercio@40
|
1359 slider.cima:GetNormalTexture():ClearAllPoints()
|
|
Tercio@40
|
1360 slider.cima:GetPushedTexture():ClearAllPoints()
|
|
Tercio@40
|
1361 slider.cima:GetDisabledTexture():ClearAllPoints()
|
|
Tercio@40
|
1362 slider.cima:GetNormalTexture():SetPoint ("center", slider.cima, "center", 1, 1)
|
|
Tercio@40
|
1363 slider.cima:GetPushedTexture():SetPoint ("center", slider.cima, "center", 1, 1)
|
|
Tercio@40
|
1364 slider.cima:GetDisabledTexture():SetPoint ("center", slider.cima, "center", 1, 1)
|
|
Tercio@40
|
1365 slider.cima:SetSize (16, 16)
|
|
Tercio@40
|
1366 slider.cima:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
|
|
Tercio@40
|
1367 slider.cima:SetBackdropColor (0, 0, 0, 0.3)
|
|
Tercio@40
|
1368 slider.cima:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
1369
|
|
Tercio@40
|
1370 slider.baixo:SetNormalTexture ([[Interface\Buttons\Arrow-Down-Up]])
|
|
Tercio@40
|
1371 slider.baixo:SetPushedTexture ([[Interface\Buttons\Arrow-Down-Down]])
|
|
Tercio@40
|
1372 slider.baixo:SetDisabledTexture ([[Interface\Buttons\Arrow-Down-Disabled]])
|
|
Tercio@40
|
1373 slider.baixo:GetNormalTexture():ClearAllPoints()
|
|
Tercio@40
|
1374 slider.baixo:GetPushedTexture():ClearAllPoints()
|
|
Tercio@40
|
1375 slider.baixo:GetDisabledTexture():ClearAllPoints()
|
|
Tercio@40
|
1376 slider.baixo:GetNormalTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
|
|
Tercio@40
|
1377 slider.baixo:GetPushedTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
|
|
Tercio@40
|
1378 slider.baixo:GetDisabledTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
|
|
Tercio@40
|
1379 slider.baixo:SetSize (16, 16)
|
|
Tercio@40
|
1380 slider.baixo:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
|
|
Tercio@40
|
1381 slider.baixo:SetBackdropColor (0, 0, 0, 0.35)
|
|
Tercio@40
|
1382 slider.baixo:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
1383
|
|
Tercio@40
|
1384 slider.slider:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
|
|
Tercio@40
|
1385 slider.slider:SetBackdropColor (0, 0, 0, 0.35)
|
|
Tercio@40
|
1386 slider.slider:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
1387
|
|
Tercio@40
|
1388 --slider.slider:Altura (164)
|
|
Tercio@40
|
1389 slider.slider:cimaPoint (0, 13)
|
|
Tercio@40
|
1390 slider.slider:baixoPoint (0, -13)
|
|
Tercio@40
|
1391 slider.slider.thumb:SetTexture ([[Interface\AddOns\Details\images\icons2]])
|
|
Tercio@40
|
1392 slider.slider.thumb:SetTexCoord (482/512, 492/512, 104/512, 120/512)
|
|
Tercio@40
|
1393 slider.slider.thumb:SetSize (12, 12)
|
|
Tercio@40
|
1394 slider.slider.thumb:SetVertexColor (0.6, 0.6, 0.6, 0.95)
|
|
Tercio@40
|
1395 else
|
|
Tercio@40
|
1396
|
|
Tercio@40
|
1397 slider.ScrollBar.ScrollUpButton:SetNormalTexture ([[Interface\Buttons\Arrow-Up-Up]])
|
|
Tercio@40
|
1398 slider.ScrollBar.ScrollUpButton:GetNormalTexture():SetTexCoord (0, 1, 0, 1)
|
|
Tercio@40
|
1399 slider.ScrollBar.ScrollUpButton:SetPushedTexture ([[Interface\Buttons\Arrow-Up-Down]])
|
|
Tercio@40
|
1400 slider.ScrollBar.ScrollUpButton:GetPushedTexture():SetTexCoord (0, 1, 0, 1)
|
|
Tercio@40
|
1401 slider.ScrollBar.ScrollUpButton:SetDisabledTexture ([[Interface\Buttons\Arrow-Up-Disabled]])
|
|
Tercio@40
|
1402 slider.ScrollBar.ScrollUpButton:GetDisabledTexture():SetTexCoord (0, 1, 0, 1)
|
|
Tercio@40
|
1403
|
|
Tercio@40
|
1404 slider.ScrollBar.ScrollUpButton:SetSize (16, 16)
|
|
Tercio@40
|
1405 slider.ScrollBar.ScrollUpButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
|
|
Tercio@40
|
1406 slider.ScrollBar.ScrollUpButton:SetBackdropColor (0, 0, 0, 0.3)
|
|
Tercio@40
|
1407 slider.ScrollBar.ScrollUpButton:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
1408
|
|
Tercio@40
|
1409 slider.ScrollBar.ScrollUpButton:GetNormalTexture():ClearAllPoints()
|
|
Tercio@40
|
1410 slider.ScrollBar.ScrollUpButton:GetPushedTexture():ClearAllPoints()
|
|
Tercio@40
|
1411 slider.ScrollBar.ScrollUpButton:GetDisabledTexture():ClearAllPoints()
|
|
Tercio@40
|
1412 slider.ScrollBar.ScrollUpButton:GetNormalTexture():SetPoint ("center", slider.ScrollBar.ScrollUpButton, "center", 1, 1)
|
|
Tercio@40
|
1413 slider.ScrollBar.ScrollUpButton:GetPushedTexture():SetPoint ("center", slider.ScrollBar.ScrollUpButton, "center", 1, 1)
|
|
Tercio@40
|
1414 slider.ScrollBar.ScrollUpButton:GetDisabledTexture():SetPoint ("center", slider.ScrollBar.ScrollUpButton, "center", 1, 1)
|
|
Tercio@40
|
1415
|
|
Tercio@40
|
1416 --
|
|
Tercio@40
|
1417
|
|
Tercio@40
|
1418 slider.ScrollBar.ScrollDownButton:SetNormalTexture ([[Interface\Buttons\Arrow-Down-Up]])
|
|
Tercio@40
|
1419 slider.ScrollBar.ScrollDownButton:GetNormalTexture():SetTexCoord (0, 1, 0, 1)
|
|
Tercio@40
|
1420 slider.ScrollBar.ScrollDownButton:SetPushedTexture ([[Interface\Buttons\Arrow-Down-Down]])
|
|
Tercio@40
|
1421 slider.ScrollBar.ScrollDownButton:GetPushedTexture():SetTexCoord (0, 1, 0, 1)
|
|
Tercio@40
|
1422 slider.ScrollBar.ScrollDownButton:SetDisabledTexture ([[Interface\Buttons\Arrow-Down-Disabled]])
|
|
Tercio@40
|
1423 slider.ScrollBar.ScrollDownButton:GetDisabledTexture():SetTexCoord (0, 1, 0, 1)
|
|
Tercio@40
|
1424
|
|
Tercio@40
|
1425 slider.ScrollBar.ScrollDownButton:SetSize (16, 16)
|
|
Tercio@40
|
1426 slider.ScrollBar.ScrollDownButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
|
|
Tercio@40
|
1427 slider.ScrollBar.ScrollDownButton:SetBackdropColor (0, 0, 0, 0.3)
|
|
Tercio@40
|
1428 slider.ScrollBar.ScrollDownButton:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
1429
|
|
Tercio@40
|
1430 slider.ScrollBar.ScrollDownButton:GetNormalTexture():ClearAllPoints()
|
|
Tercio@40
|
1431 slider.ScrollBar.ScrollDownButton:GetPushedTexture():ClearAllPoints()
|
|
Tercio@40
|
1432 slider.ScrollBar.ScrollDownButton:GetDisabledTexture():ClearAllPoints()
|
|
Tercio@40
|
1433 slider.ScrollBar.ScrollDownButton:GetNormalTexture():SetPoint ("center", slider.ScrollBar.ScrollDownButton, "center", 1, -5)
|
|
Tercio@40
|
1434 slider.ScrollBar.ScrollDownButton:GetPushedTexture():SetPoint ("center", slider.ScrollBar.ScrollDownButton, "center", 1, -5)
|
|
Tercio@40
|
1435 slider.ScrollBar.ScrollDownButton:GetDisabledTexture():SetPoint ("center", slider.ScrollBar.ScrollDownButton, "center", 1, -5)
|
|
Tercio@40
|
1436
|
|
Tercio@40
|
1437 --
|
|
Tercio@40
|
1438 slider.ScrollBar:SetPoint ("TOPLEFT", slider, "TOPRIGHT", 6, -16)
|
|
Tercio@40
|
1439 slider.ScrollBar:SetPoint ("BOTTOMLEFT", slider, "BOTTOMRIGHT", 6, 16 + (heightOffset and heightOffset*-1 or 0))
|
|
Tercio@40
|
1440
|
|
Tercio@40
|
1441 slider.ScrollBar.ThumbTexture:SetColorTexture (.5, .5, .5, .3)
|
|
Tercio@40
|
1442 slider.ScrollBar.ThumbTexture:SetSize (12, 8)
|
|
Tercio@40
|
1443
|
|
Tercio@40
|
1444 --
|
|
Tercio@40
|
1445
|
|
Tercio@40
|
1446 slider.ScrollBar:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
|
|
Tercio@40
|
1447 slider.ScrollBar:SetBackdropColor (0, 0, 0, 0.35)
|
|
Tercio@40
|
1448 slider.ScrollBar:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@40
|
1449 end
|
|
Tercio@40
|
1450 end
|
|
Tercio@40
|
1451
|
|
Tercio@40
|
1452 --doo elsee |