vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function DAB_Bar_Backdrop(bar, bgtexture, bordertexture, tileSize, edgeSize, left, right, top, bottom) |
2 | if (not bar) then return; end |
||
3 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
4 | if (not barFrame) then |
||
5 | DL_Error("Invalid bar number ("..bar..") sent to DAB_Bar_Backdrop."); |
||
6 | return; |
||
7 | end |
||
8 | local settings = DAB_Settings[DAB_INDEX].Bar[bar].Background; |
||
9 | if (bgtexture) then settings.texture = bgtexture; else bgtexture = settings.texture; end |
||
10 | if (bordertexture) then settings.btexture = bordertexture; else bordertexture = settings.btexture end |
||
11 | if (tileSize) then settings.tileSize = tileSize; else tileSize = settings.tileSize end |
||
12 | if (edgeSize) then settings.edgeSize = edgeSize; else edgeSize = settings.edgeSize end |
||
13 | if (left) then settings.left = left; else left = settings.left end |
||
14 | if (right) then settings.right = right; else right = settings.right end |
||
15 | if (top) then settings.top = top; else top = settings.top end |
||
16 | if (bottom) then settings.bottom = bottom; else bottom = settings.bottom end |
||
17 | barFrame:SetBackdrop({bgFile = bgtexture, edgeFile = bordertexture, tile = settings.tile, tileSize = tileSize, edgeSize = edgeSize, insets = { left = left, right = right, top = top, bottom = bottom }}); |
||
18 | if (settings.hide) then |
||
19 | barFrame:SetBackdropColor(0, 0, 0, 0); |
||
20 | barFrame:SetBackdropBorderColor(0, 0, 0, 0); |
||
21 | else |
||
22 | barFrame:SetBackdropColor(settings.color.r, settings.color.g, settings.color.b, settings.alpha); |
||
23 | barFrame:SetBackdropBorderColor(settings.bcolor.r, settings.bcolor.g, settings.bcolor.b, settings.balpha); |
||
24 | end |
||
25 | end |
||
26 | |||
27 | function DAB_Bar_BackdropPadding(bar, left, right, top, bottom) |
||
28 | if (not bar) then return; end |
||
29 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
30 | if (not barFrame) then |
||
31 | DL_Error("Invalid bar number ("..bar..") sent to DAB_Bar_BackdropPadding."); |
||
32 | return; |
||
33 | end |
||
34 | if (not left) then left = DAB_Settings[DAB_INDEX].Bar[bar].Background.leftpadding; end |
||
35 | if (not right) then right = DAB_Settings[DAB_INDEX].Bar[bar].Background.rightpadding; end |
||
36 | if (not top) then top = DAB_Settings[DAB_INDEX].Bar[bar].Background.toppadding; end |
||
37 | if (not bottom) then bottom = DAB_Settings[DAB_INDEX].Bar[bar].Background.bottompadding; end |
||
38 | DAB_Settings[DAB_INDEX].Bar[bar].Background.leftpadding = left; |
||
39 | DAB_Settings[DAB_INDEX].Bar[bar].Background.rightpadding = right; |
||
40 | DAB_Settings[DAB_INDEX].Bar[bar].Background.toppadding = top; |
||
41 | DAB_Settings[DAB_INDEX].Bar[bar].Background.bottompadding = bottom; |
||
42 | local button, yoffset; |
||
43 | for row = 1, DAB_Settings[DAB_INDEX].Bar[bar].rows do |
||
44 | button = getglobal("DAB_ActionButton_"..barFrame.rows[row][1]); |
||
45 | button:ClearAllPoints(); |
||
46 | if (row == 1) then |
||
47 | button:SetPoint("TOPLEFT", barFrame, "TOPLEFT", left, -top); |
||
48 | else |
||
49 | yoffset = top + 36 * (row - 1) + DAB_Settings[DAB_INDEX].Bar[bar].vspacing * (row - 1); |
||
50 | button:SetPoint("TOPLEFT", barFrame, "TOPLEFT", left, -yoffset); |
||
51 | button.yoffset = yoffset; |
||
52 | end |
||
53 | end |
||
54 | DAB_Bar_Size(bar); |
||
55 | end |
||
56 | |||
57 | function DAB_Bar_BGAlpha(bar, a) |
||
58 | if (not bar) then return; end |
||
59 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
60 | if (not barFrame) then |
||
61 | DL_Error("Invalid bar number ("..bar..") sent to DAB_Bar_BGAlpha."); |
||
62 | return; |
||
63 | elseif (a and (a > 1 or a < 0)) then |
||
64 | DL_Error("Invalid alpha value ("..a..") sent to DAB_Bar_BGAlpha."); |
||
65 | return; |
||
66 | end |
||
67 | if (not a) then |
||
68 | a = DAB_Settings[DAB_INDEX].Bar[bar].Background.alpha; |
||
69 | else |
||
70 | DAB_Settings[DAB_INDEX].Bar[bar].Background.alpha = a; |
||
71 | end |
||
72 | if (DAB_Settings[DAB_INDEX].Bar[bar].Background.hide) then return; end |
||
73 | barFrame:SetBackdropColor(DAB_Settings[DAB_INDEX].Bar[bar].Background.color.r, DAB_Settings[DAB_INDEX].Bar[bar].Background.color.g, DAB_Settings[DAB_INDEX].Bar[bar].Background.color.b, a); |
||
74 | end |
||
75 | |||
76 | function DAB_Bar_BGColor(bar, r, g, b, a) |
||
77 | if (not bar) then return; end |
||
78 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
79 | if (not barFrame) then |
||
80 | DL_Error("Invalid bar number sent to DAB_Bar_BGColor: "..bar); |
||
81 | return; |
||
82 | end |
||
83 | if (not r) then r = DAB_Settings[DAB_INDEX].Bar[bar].Background.color.r; end |
||
84 | if (not g) then g = DAB_Settings[DAB_INDEX].Bar[bar].Background.color.g; end |
||
85 | if (not b) then b = DAB_Settings[DAB_INDEX].Bar[bar].Background.color.b; end |
||
86 | if (not a) then |
||
87 | a = DAB_Settings[DAB_INDEX].Bar[bar].Background.alpha; |
||
88 | else |
||
89 | DAB_Settings[DAB_INDEX].Bar[bar].Background.alpha = a; |
||
90 | end |
||
91 | DAB_Settings[DAB_INDEX].Bar[bar].Background.color = {r=r, g=g, b=b}; |
||
92 | if (DAB_Settings[DAB_INDEX].Bar[bar].Background.hide) then return; end |
||
93 | barFrame:SetBackdropColor(r, g, b, a); |
||
94 | end |
||
95 | |||
96 | function DAB_Bar_BorderAlpha(bar, a) |
||
97 | if (not bar) then return; end |
||
98 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
99 | if (not barFrame) then |
||
100 | DL_Error("Invalid bar number sent to DAB_Bar_BorderAlpha: "..bar); |
||
101 | return; |
||
102 | end |
||
103 | if (not a) then |
||
104 | a = DAB_Settings[DAB_INDEX].Bar[bar].Background.balpha; |
||
105 | else |
||
106 | DAB_Settings[DAB_INDEX].Bar[bar].Background.balpha = a; |
||
107 | end |
||
108 | if (DAB_Settings[DAB_INDEX].Bar[bar].Background.hide) then return; end |
||
109 | barFrame:SetBackdropBorderColor(DAB_Settings[DAB_INDEX].Bar[bar].Background.bcolor.r, DAB_Settings[DAB_INDEX].Bar[bar].Background.bcolor.g, DAB_Settings[DAB_INDEX].Bar[bar].Background.bcolor.b, a); |
||
110 | end |
||
111 | |||
112 | function DAB_Bar_BorderColor(bar, r, g, b, a) |
||
113 | if (not bar) then return; end |
||
114 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
115 | if (not barFrame) then |
||
116 | DL_Error("Invalid bar number sent to DAB_Bar_BorderColor: "..bar); |
||
117 | return; |
||
118 | end |
||
119 | if (not r) then r = DAB_Settings[DAB_INDEX].Bar[bar].Background.bcolor.r; end |
||
120 | if (not g) then g = DAB_Settings[DAB_INDEX].Bar[bar].Background.bcolor.g; end |
||
121 | if (not b) then b = DAB_Settings[DAB_INDEX].Bar[bar].Background.bcolor.b; end |
||
122 | if (not a) then |
||
123 | a = DAB_Settings[DAB_INDEX].Bar[bar].Background.balpha; |
||
124 | else |
||
125 | DAB_Settings[DAB_INDEX].Bar[bar].Background.balpha = a; |
||
126 | end |
||
127 | DAB_Settings[DAB_INDEX].Bar[bar].Background.bcolor = {r=r, g=g, b=b}; |
||
128 | if (DAB_Settings[DAB_INDEX].Bar[bar].Background.hide) then return; end |
||
129 | barFrame:SetBackdropBorderColor(r, g, b, a); |
||
130 | end |
||
131 | |||
132 | function DAB_Bar_ButtonAlpha(bar, a) |
||
133 | if (not bar) then return; end |
||
134 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
135 | if (not barFrame) then |
||
136 | DL_Error("Invalid bar number sent to DAB_Bar_ButtonAlpha: "..bar); |
||
137 | return; |
||
138 | elseif (a and (a > 1 or a < 0)) then |
||
139 | DL_Error("Invalid alpha sent to DAB_Bar_ButtonAlpha: "..a..". Must be between 0 and 1"); |
||
140 | return; |
||
141 | end |
||
142 | if (not a) then |
||
143 | a = DAB_Settings[DAB_INDEX].Bar[bar].alpha; |
||
144 | else |
||
145 | DAB_Settings[DAB_INDEX].Bar[bar].alpha = a; |
||
146 | end |
||
147 | for i=1, 120 do |
||
148 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
149 | getglobal("DAB_ActionButton_"..i):SetAlpha(a); |
||
150 | end |
||
151 | end |
||
152 | end |
||
153 | |||
154 | function DAB_Bar_ButtonBorderColor(bar, r, g, b) |
||
155 | if (not bar) then return; end |
||
156 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
157 | if (not barFrame) then |
||
158 | DL_Error("Invalid bar number sent to DAB_Bar_ButtonBorderColor: "..bar); |
||
159 | return; |
||
160 | elseif (r and (r > 1 or r < 0)) then |
||
161 | DL_Error("Invalid red sent to DAB_Bar_ButtonBorderColor: "..r..". Must be between 0 and 1"); |
||
162 | return; |
||
163 | elseif (g and (g > 1 or g < 0)) then |
||
164 | DL_Error("Invalid alpha sent to DAB_Bar_ButtonBorderColor: "..g..". Must be between 0 and 1"); |
||
165 | return; |
||
166 | elseif (b and (b > 1 or b < 0)) then |
||
167 | DL_Error("Invalid alpha sent to DAB_Bar_ButtonBorderColor: "..b..". Must be between 0 and 1"); |
||
168 | return; |
||
169 | end |
||
170 | if (not r) then r = DAB_Settings[DAB_INDEX].Bar[bar].ButtonBorder.color.r; end |
||
171 | if (not g) then g = DAB_Settings[DAB_INDEX].Bar[bar].ButtonBorder.color.g; end |
||
172 | if (not b) then b = DAB_Settings[DAB_INDEX].Bar[bar].ButtonBorder.color.b; end |
||
173 | for i=1, 120 do |
||
174 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
175 | getglobal("DAB_ActionButton_"..i.."_Border"):SetVertexColor(r, g, b, DAB_Settings[DAB_INDEX].Bar[bar].alpha); |
||
176 | end |
||
177 | end |
||
178 | end |
||
179 | |||
180 | function DAB_Bar_ButtonSize(bar, size) |
||
181 | if (not bar) then return; end |
||
182 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
183 | if (not barFrame) then |
||
184 | DL_Error("Invalid bar number sent to DAB_Bar_ButtonSize: "..bar); |
||
185 | return; |
||
186 | end |
||
187 | if (not size) then |
||
188 | size = DAB_Settings[DAB_INDEX].Bar[bar].size; |
||
189 | else |
||
190 | DAB_Settings[DAB_INDEX].Bar[bar].size = size; |
||
191 | end |
||
192 | local scale = size / 36; |
||
193 | for i=1, 120 do |
||
194 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
195 | getglobal("DAB_ActionButton_"..i):SetScale(scale); |
||
196 | end |
||
197 | end |
||
198 | DAB_Bar_Size(bar); |
||
199 | end |
||
200 | |||
201 | function DAB_Bar_ButtonText(bar) |
||
202 | local settings = DAB_Settings[DAB_INDEX].Bar[bar]; |
||
203 | local text, cooldown; |
||
204 | for i=1, 120 do |
||
205 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
206 | button = "DAB_ActionButton_"..i; |
||
207 | |||
208 | text = getglobal(button.."_HotKey"); |
||
209 | text:SetFont(settings.Keybinding.font, settings.Keybinding.size, "outline='NORMAL'"); |
||
210 | text:SetTextColor(settings.Keybinding.color.r, settings.Keybinding.color.g, settings.Keybinding.color.b, 1); |
||
211 | if (settings.Keybinding.hide) then |
||
212 | text:Hide(); |
||
213 | else |
||
214 | text:Show(); |
||
215 | end |
||
216 | |||
217 | text = getglobal(button.."_Count"); |
||
218 | text:SetFont(settings.Count.font, settings.Count.size, "outline='NORMAL'"); |
||
219 | text:SetTextColor(settings.Count.color.r, settings.Count.color.g, settings.Count.color.b, 1); |
||
220 | if (settings.Count.hide) then |
||
221 | text:Hide(); |
||
222 | else |
||
223 | text:Show(); |
||
224 | end |
||
225 | |||
226 | text = getglobal(button.."_CooldownCount"); |
||
227 | text:SetFont(settings.Cooldown.font, settings.Cooldown.size, "outline='NORMAL'"); |
||
228 | text:SetTextColor(settings.Cooldown.color.r, settings.Cooldown.color.g, settings.Cooldown.color.b, 1); |
||
229 | if (settings.Cooldown.hide) then |
||
230 | text:Hide(); |
||
231 | else |
||
232 | text:Show(); |
||
233 | end |
||
234 | |||
235 | text = getglobal(button.."_Timer"); |
||
236 | text:SetFont(settings.Cooldown.font, settings.Cooldown.size, "outline='NORMAL'"); |
||
237 | text:SetTextColor(settings.Cooldown.color.r, settings.Cooldown.color.g, settings.Cooldown.color.b, 1); |
||
238 | |||
239 | text = getglobal(button.."_Name"); |
||
240 | text:SetFont(settings.Macro.font, settings.Macro.size, "outline='NORMAL'"); |
||
241 | text:SetTextColor(settings.Macro.color.r, settings.Macro.color.g, settings.Macro.color.b, 1); |
||
242 | if (settings.Macro.hide) then |
||
243 | text:Hide(); |
||
244 | else |
||
245 | text:Show(); |
||
246 | end |
||
247 | end |
||
248 | end |
||
249 | end |
||
250 | |||
251 | function DAB_Bar_ButtonTextures(bar) |
||
252 | local settings = DAB_Settings[DAB_INDEX].Bar[bar]; |
||
253 | local checked, highlight, border, background, equipped; |
||
254 | for i=1, 120 do |
||
255 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
256 | button = "DAB_ActionButton_"..i; |
||
257 | icon = getglobal(button.."_Icon"); |
||
258 | if (settings.trimEdges) then |
||
259 | icon:SetTexCoord(.078, .92, .079, .937); |
||
260 | else |
||
261 | icon:SetTexCoord(0, 1, 0, 1); |
||
262 | end |
||
263 | |||
264 | background = getglobal(button.."_Background"); |
||
265 | background:SetTexture(settings.buttonbg); |
||
266 | background:SetVertexColor(settings.buttonbgcolor.r, settings.buttonbgcolor.g, settings.buttonbgcolor.b, settings.alpha); |
||
267 | |||
268 | checked = getglobal(button.."_Checked"); |
||
269 | checked:SetTexture(settings.checked); |
||
270 | checked:SetVertexColor(settings.checkedcolor.r, settings.checkedcolor.g, settings.checkedcolor.b, settings.alpha); |
||
271 | |||
272 | highlight = getglobal(button.."_Highlight"); |
||
273 | highlight:SetTexture(settings.highlight); |
||
274 | highlight:SetVertexColor(settings.highlightcolor.r, settings.highlightcolor.g, settings.highlightcolor.b, settings.alpha); |
||
275 | |||
276 | equipped = getglobal(button.."_EquippedBorder"); |
||
277 | equipped:SetTexture(settings.ButtonBorder.etexture); |
||
278 | equipped:SetVertexColor(settings.ButtonBorder.ecolor.r, settings.ButtonBorder.ecolor.g, settings.ButtonBorder.ecolor.b, settings.alpha); |
||
279 | |||
280 | border = getglobal(button.."_Border"); |
||
281 | border:ClearAllPoints(); |
||
282 | border:SetPoint("TOPLEFT", button, "TOPLEFT", -settings.ButtonBorder.leftpadding, settings.ButtonBorder.toppadding); |
||
283 | border:SetHeight(36 + settings.ButtonBorder.toppadding + settings.ButtonBorder.bottompadding); |
||
284 | border:SetWidth(36 + settings.ButtonBorder.leftpadding + settings.ButtonBorder.rightpadding); |
||
285 | border:SetTexture(settings.ButtonBorder.texture); |
||
286 | border:SetVertexColor(settings.ButtonBorder.color.r, settings.ButtonBorder.color.g, settings.ButtonBorder.color.b, settings.ButtonBorder.alpha); |
||
287 | end |
||
288 | end |
||
289 | end |
||
290 | |||
291 | function DAB_Bar_FauxHide(bar) |
||
292 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
293 | if (barFrame.fauxhidden) then return; end |
||
294 | barFrame:SetAlpha(0); |
||
295 | barFrame:EnableMouse(false); |
||
296 | barFrame:EnableMouseWheel(false); |
||
297 | local button; |
||
298 | for i=1,120 do |
||
299 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
300 | button = getglobal("DAB_ActionButton_"..i); |
||
301 | DAB_ActionButton_FauxHide(i); |
||
302 | button:Hide(); |
||
303 | end |
||
304 | end |
||
305 | barFrame.hidden = true; |
||
306 | barFrame.fauxhidden = true; |
||
307 | end |
||
308 | |||
309 | function DAB_Bar_FauxShow(bar) |
||
310 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
311 | barFrame:SetAlpha(1); |
||
312 | if (not DAB_Settings[DAB_INDEX].Bar[bar].disableMouse) then |
||
313 | barFrame:EnableMouse(1); |
||
314 | barFrame:EnableMouseWheel(1); |
||
315 | end |
||
316 | barFrame.hidden = nil; |
||
317 | barFrame.fauxhidden = nil; |
||
318 | for i=1,120 do |
||
319 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
320 | local button = getglobal("DAB_ActionButton_"..i); |
||
321 | button.activeConditions = {}; |
||
322 | button.fauxhidden = true; |
||
323 | DAB_ActionButton_Show(i); |
||
324 | DAB_ActionButton_FauxShow(i); |
||
325 | end |
||
326 | end |
||
327 | DAB_Bar_Size(bar); |
||
328 | end |
||
329 | |||
330 | function DAB_Bar_GetRealPage(bar, page) |
||
331 | if (not DAB_INITIALIZED) then return; end |
||
332 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
333 | if (not page) then |
||
334 | page = DAB_Settings[DAB_INDEX].Bar[bar].page; |
||
335 | end |
||
336 | if (barFrame.pagemap[page]) then |
||
337 | return barFrame.pagemap[page]; |
||
338 | else |
||
339 | return page; |
||
340 | end |
||
341 | end |
||
342 | |||
343 | function DAB_Bar_Hide(bar) |
||
344 | DAB_Settings[DAB_INDEX].Bar[bar].hide = 1; |
||
345 | getglobal("DAB_ActionBar_"..bar):Hide(); |
||
346 | end |
||
347 | |||
348 | function DAB_Bar_Initialize(bar) |
||
349 | local settings = DAB_Settings[DAB_INDEX].Bar[bar]; |
||
350 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
351 | local scale = settings.size / 36; |
||
352 | local previous; |
||
353 | local button, bar2, icon, cooldown; |
||
354 | |||
355 | for page=1,settings.numBars do |
||
356 | if (not settings.pages[page]) then settings.pages[page] = {}; end |
||
357 | if (not settings.pageconditions[page]) then settings.pageconditions[page] = {}; end |
||
358 | for button=1, settings.numButtons do |
||
359 | if (not settings.pages[page][button]) then settings.pages[page][button] = 1; end |
||
360 | if (not settings.pageconditions[page][button]) then settings.pageconditions[page][button] = {}; end |
||
361 | end |
||
362 | end |
||
363 | |||
364 | barFrame:SetFrameStrata(settings.frameStrata); |
||
365 | barFrame:SetAlpha(1); |
||
366 | if (settings.disableMouse) then |
||
367 | barFrame:EnableMouse(false); |
||
368 | barFrame:EnableMouseWheel(false); |
||
369 | else |
||
370 | barFrame:EnableMouse(1); |
||
371 | barFrame:EnableMouseWheel(1); |
||
372 | end |
||
373 | |||
374 | barFrame.bttnpos = {}; |
||
375 | local bc = 0; |
||
376 | for i=1, 120 do |
||
377 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
378 | bc = bc + 1; |
||
379 | barFrame.bttnpos[i] = bc; |
||
380 | button = getglobal("DAB_ActionButton_"..i); |
||
381 | button:SetParent(barFrame); |
||
382 | button:SetFrameStrata(settings.frameStrata); |
||
383 | cooldown = getglobal("DAB_ActionButton_"..i.."_Cooldown"); |
||
384 | cooldown:SetFrameStrata(settings.frameStrata); |
||
385 | cooldown:SetFrameLevel(button:GetFrameLevel() + 1); |
||
386 | button:ClearAllPoints(); |
||
387 | local box = getglobal("DAB_FloaterBox_"..i); |
||
388 | box:ClearAllPoints(); |
||
389 | if (previous) then |
||
390 | button:SetPoint("LEFT", previous, "RIGHT", settings.hspacing, 0); |
||
391 | else |
||
392 | button:SetPoint("TOPLEFT", barFrame, "TOPLEFT", settings.Background.leftpadding, -settings.Background.toppadding); |
||
393 | end |
||
394 | box:SetPoint("CENTER", button, "CENTER", 0, 0); |
||
395 | box:SetHeight(settings.size); |
||
396 | box:SetWidth(settings.size); |
||
397 | previous = button:GetName(); |
||
398 | |||
399 | button.hidden = nil; |
||
400 | button.collapsed = nil; |
||
401 | button.activeConditions = {}; |
||
402 | button.yoffset = nil; |
||
403 | button.OOR = nil; |
||
404 | button.OOM = nil; |
||
405 | button.AUN = nil; |
||
406 | end |
||
407 | end |
||
408 | |||
409 | barFrame.rows = {}; |
||
410 | barFrame.buttonLocation = {}; |
||
411 | barFrame.pagemap = {}; |
||
412 | local resetrow = math.mod(settings.numButtons, settings.rows) + 1; |
||
413 | |||
414 | local buttonCount = 0; |
||
415 | local rowCount = 1; |
||
416 | local perrow = math.ceil(settings.numButtons / settings.rows); |
||
417 | barFrame.rows = { {} }; |
||
418 | for button=1,120 do |
||
419 | if (DAB_Settings[DAB_INDEX].Buttons[button].Bar == bar) then |
||
420 | buttonCount = buttonCount + 1; |
||
421 | barFrame.rows[rowCount][buttonCount] = button; |
||
422 | barFrame.buttonLocation[button] = { row = rowCount, loc = buttonCount }; |
||
423 | if (buttonCount == 1 and rowCount > 1) then |
||
424 | local actionbutton = getglobal("DAB_ActionButton_"..button); |
||
425 | local yoffset = settings.Background.toppadding + 36 * (rowCount - 1) + settings.vspacing * (rowCount - 1); |
||
426 | actionbutton:ClearAllPoints(); |
||
427 | actionbutton:SetPoint("TOPLEFT", barFrame, "TOPLEFT", settings.Background.leftpadding, -yoffset); |
||
428 | actionbutton.yoffset = yoffset; |
||
429 | end |
||
430 | if (buttonCount == perrow) then |
||
431 | buttonCount = 0; |
||
432 | rowCount = rowCount + 1; |
||
433 | barFrame.rows[rowCount] = {}; |
||
434 | if (rowCount == resetrow) then |
||
435 | perrow = perrow - 1; |
||
436 | end |
||
437 | end |
||
438 | end |
||
439 | end |
||
440 | |||
441 | DAB_Bar_Size(bar); |
||
442 | DAB_Bar_SetPage(bar, settings.page, 1); |
||
443 | DAB_Bar_Update(bar); |
||
444 | |||
445 | if (settings.hide) then |
||
446 | barFrame:Hide(); |
||
447 | else |
||
448 | barFrame:Show(); |
||
449 | end |
||
450 | barFrame.initialized = true; |
||
451 | barFrame.activeConditions = {}; |
||
452 | if (barFrame.fauxhidden) then |
||
453 | DAB_Bar_FauxShow(bar); |
||
454 | end |
||
455 | end |
||
456 | |||
457 | function DAB_Bar_Label(bar) |
||
458 | local label = "DAB_ActionBar_"..bar.."_Label"; |
||
459 | local frame = getglobal(label); |
||
460 | local text = getglobal(label.."_Text"); |
||
461 | local bg = getglobal(label.."_Background"); |
||
462 | local settings = DAB_Settings[DAB_INDEX].Bar[bar].Label; |
||
463 | |||
464 | frame:ClearAllPoints(); |
||
465 | frame:SetPoint(settings.attachpoint, "DAB_ActionBar_"..bar, settings.attachto, settings.x, settings.y); |
||
466 | frame:SetHeight(settings.height); |
||
467 | text:SetHeight(settings.height); |
||
468 | frame:SetWidth(settings.width); |
||
469 | text:SetWidth(settings.width); |
||
470 | text:SetFont(settings.font, settings.fontsize); |
||
471 | text:SetText(settings.text); |
||
472 | text:SetTextColor(settings.color.r, settings.color.g, settings.color.b, settings.alpha); |
||
473 | frame:SetBackdrop({bgFile = settings.texture, edgeFile = settings.btexture, tile = settings.tile, tileSize = settings.tileSize, edgeSize = settings.edgeSize, insets = { left = settings.left, right = settings.right, top = settings.top, bottom = settings.bottom }}); |
||
474 | frame:SetBackdropColor(settings.bgcolor.r, settings.bgcolor.g, settings.bgcolor.b, settings.bgalpha); |
||
475 | frame:SetBackdropBorderColor(settings.bordcolor.r, settings.bordcolor.g, settings.bordcolor.b, settings.bordalpha); |
||
476 | text:SetJustifyV(settings.justifyV); |
||
477 | text:SetJustifyH(settings.justifyH); |
||
478 | |||
479 | if (settings.hide) then |
||
480 | frame:Hide(); |
||
481 | else |
||
482 | frame:Show(); |
||
483 | end |
||
484 | end |
||
485 | |||
486 | function DAB_Bar_LabelText(bar, text) |
||
487 | if (not bar) then return; end |
||
488 | if (not tonumber(bar)) then return; end |
||
489 | if (bar < 1 or bar > DAB_NUM_BARS) then return; end |
||
490 | if (not text) then return; end |
||
491 | DAB_Settings[DAB_INDEX].Bar[bar].Label.text = text; |
||
492 | getglobal("DAB_ActionBar_"..bar.."_Label_Text"):SetText(text); |
||
493 | end |
||
494 | |||
495 | function DAB_Bar_Location(bar, x, y, frame, point, to) |
||
496 | if (not bar) then return; end |
||
497 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
498 | if (not barFrame) then |
||
499 | DL_Error("Invalid bar number sent to DAB_Bar_Location: "..bar); |
||
500 | return; |
||
501 | elseif (point and (not DL_VALID_ANCHOR[point])) then |
||
502 | DL_Error("Invalid anchor point sent to DAB_Bar_Location: "..point); |
||
503 | return; |
||
504 | elseif (to and (not DL_VALID_ANCHOR[to])) then |
||
505 | DL_Error("Invalid anchor to sent to DAB_Bar_Location: "..to); |
||
506 | return; |
||
507 | end |
||
508 | if (not x) then x = DAB_Settings[DAB_INDEX].Bar[bar].Anchor.x; end |
||
509 | if (not y) then y = DAB_Settings[DAB_INDEX].Bar[bar].Anchor.y; end |
||
510 | if (not frame) then frame = DAB_Settings[DAB_INDEX].Bar[bar].Anchor.frame; end |
||
511 | if (not point) then point = DAB_Settings[DAB_INDEX].Bar[bar].Anchor.point; end |
||
512 | if (not to) then to = DAB_Settings[DAB_INDEX].Bar[bar].Anchor.to; end |
||
513 | DAB_Settings[DAB_INDEX].Bar[bar].Anchor = {frame=frame, point=point, to=to, x=x, y=y}; |
||
514 | barFrame:ClearAllPoints(); |
||
515 | barFrame:SetPoint(point, frame, to, x, y); |
||
516 | end |
||
517 | |||
518 | function DAB_Bar_OnDragStart(id, override) |
||
519 | if (not override) then |
||
520 | if (not DAB_DRAGGING_UNLOCKED) and (not DAB_Check_ModifierKey(DAB_Settings[DAB_INDEX].DragLockOverride)) then return; end |
||
521 | end |
||
522 | if (not id) then |
||
523 | id = this:GetID(); |
||
524 | end |
||
525 | local bar = getglobal("DAB_ActionBar_"..id); |
||
526 | if (not bar.moving) then |
||
527 | bar.moving = true; |
||
528 | bar:StartMoving(); |
||
529 | end |
||
530 | end |
||
531 | |||
532 | function DAB_Bar_OnDragStop(id) |
||
533 | if (not id) then |
||
534 | id = this:GetID(); |
||
535 | end |
||
536 | local bar = getglobal("DAB_ActionBar_"..id); |
||
537 | if (not bar.moving) then return; end |
||
538 | bar.moving = nil; |
||
539 | bar:StopMovingOrSizing(); |
||
540 | local settings = DAB_Settings[DAB_INDEX].Bar[id].Anchor; |
||
541 | local x, y = DL_Get_Offsets(bar, getglobal(settings.frame), settings.point, settings.to); |
||
542 | settings.x = x; |
||
543 | settings.y = y; |
||
544 | DAB_Bar_Location(id); |
||
545 | if (DAB_Options and DAB_OBJECT_SUBINDEX == id) then |
||
546 | DL_Init_EditBox(DAB_BarOptions_BarAppearance_XOffset, x); |
||
547 | DL_Init_EditBox(DAB_BarOptions_BarAppearance_YOffset, y); |
||
548 | end |
||
549 | end |
||
550 | |||
551 | function DAB_Bar_OnEnter() |
||
552 | local bar = this:GetID(); |
||
553 | DAB_ControlBox_Delay(DAB_Settings[DAB_INDEX].Bar[bar].cbgroup); |
||
554 | end |
||
555 | |||
556 | function DAB_Bar_OnHide() |
||
557 | this.activeConditions = {}; |
||
558 | end |
||
559 | |||
560 | function DAB_Bar_OnLeave() |
||
561 | local bar = this:GetID(); |
||
562 | DAB_ControlBox_Delay(DAB_Settings[DAB_INDEX].Bar[bar].cbgroup, 1); |
||
563 | end |
||
564 | |||
565 | function DAB_Bar_OnMouseWheel(direction) |
||
566 | local bar = this:GetID(); |
||
567 | if (DAB_Settings[DAB_INDEX].Bar[bar].disableMW) then return; end |
||
568 | if (direction > 0) then |
||
569 | DAB_Bar_PageDown(bar); |
||
570 | else |
||
571 | DAB_Bar_PageUp(bar); |
||
572 | end |
||
573 | end |
||
574 | |||
575 | function DAB_Bar_OnUpdate(elapsed) |
||
576 | if (not DAB_INITIALIZED) then return; end |
||
577 | local bar = this:GetID(); |
||
578 | |||
579 | if (DAB_SHOWING_EMPTY) then return; end |
||
580 | |||
581 | if (not this.timer) then this.timer = DAB_UPDATE_SPEED; end |
||
582 | this.timer = this.timer - elapsed; |
||
583 | if (this.timer < 0) then |
||
584 | this.timer = DAB_UPDATE_SPEED; |
||
585 | |||
586 | if (not this.lasttime) then this.lasttime = GetTime(); end |
||
587 | local timeelapsed = GetTime() - this.lasttime; |
||
588 | this.lasttime = GetTime(); |
||
589 | DAB_Run_Script("OnUpdate", "Bar", bar, timeelapsed); |
||
590 | |||
591 | local condition, response; |
||
592 | for i = 1, table.getn(DAB_Settings[DAB_INDEX].Bar[bar].Conditions) do |
||
593 | condition = DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].condition; |
||
594 | response = DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].response; |
||
595 | this = getglobal("DAB_ActionBar_"..bar); |
||
596 | local active; |
||
597 | local condition = DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].condition; |
||
598 | if (condition == 0) then |
||
599 | active = true; |
||
600 | this.activeConditions[i] = nil; |
||
601 | elseif (condition == 9 or condition == 10) then |
||
602 | active = DL_CheckCondition[condition](this); |
||
603 | else |
||
604 | active = DL_CheckCondition[condition](DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i]); |
||
605 | end |
||
606 | for _,override in DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].overrides do |
||
607 | if (this.activeConditions[override]) then |
||
608 | active = nil; |
||
609 | break; |
||
610 | end |
||
611 | end |
||
612 | |||
613 | if (active and (not this.activeConditions[i]) and response ~= 0) then |
||
614 | if (response == 1) then |
||
615 | DAB_Bar_SetPage(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].page); |
||
616 | elseif (response == 2) then |
||
617 | DAB_Bar_FauxHide(bar); |
||
618 | elseif (response == 3) then |
||
619 | DAB_Bar_FauxShow(bar); |
||
620 | elseif (response == 4) then |
||
621 | this:SetAlpha(DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].alpha); |
||
622 | elseif (response == 5) then |
||
623 | DAB_Bar_BGAlpha(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].alpha); |
||
624 | elseif (response == 6) then |
||
625 | DAB_Bar_BGColor(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].color.r, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].color.g, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].color.b); |
||
626 | elseif (response == 7) then |
||
627 | DAB_Bar_BorderAlpha(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].alpha); |
||
628 | elseif (response == 8) then |
||
629 | DAB_Bar_BorderColor(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].color.r, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].color.g, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].color.b); |
||
630 | elseif (response == 9) then |
||
631 | DAB_Bar_ButtonAlpha(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].alpha); |
||
632 | elseif (response == 10) then |
||
633 | DAB_Set_KeybindingGroup(DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].rnumber, bar); |
||
634 | elseif (response == 11) then |
||
635 | DAB_Bar_Location(bar, nil, DAB_Settings[DAB_INDEX].Bar[bar].Anchor.y + DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].amount); |
||
636 | elseif (response == 12) then |
||
637 | DAB_Bar_Location(bar, nil, DAB_Settings[DAB_INDEX].Bar[bar].Anchor.y - DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].amount); |
||
638 | elseif (response == 13) then |
||
639 | DAB_Bar_Location(bar, DAB_Settings[DAB_INDEX].Bar[bar].Anchor.x - DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].amount); |
||
640 | elseif (response == 14) then |
||
641 | DAB_Bar_Location(bar, DAB_Settings[DAB_INDEX].Bar[bar].Anchor.x + DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].amount); |
||
642 | elseif (response == 15) then |
||
643 | DAB_Bar_BackdropPadding(bar, nil, nil, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].amount); |
||
644 | elseif (response == 16) then |
||
645 | DAB_Bar_BackdropPadding(bar, nil, nil, nil, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].amount); |
||
646 | elseif (response == 17) then |
||
647 | DAB_Bar_BackdropPadding(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].amount); |
||
648 | elseif (response == 18) then |
||
649 | DAB_Bar_BackdropPadding(bar, nil, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].amount); |
||
650 | elseif (response == 19) then |
||
651 | DAB_Bar_ButtonSize(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].amount); |
||
652 | elseif (response == 20) then |
||
653 | DAB_Bar_ButtonBorderColor(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].color.r, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].color.g, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].color.b); |
||
654 | elseif (response == 21) then |
||
655 | local x, y = GetCursorPosition(); |
||
656 | x = x / UIParent:GetScale(); |
||
657 | y = y / UIParent:GetScale(); |
||
658 | DAB_Bar_Location(bar, x, y, "UIParent", "CENTER", "BOTTOMLEFT"); |
||
659 | elseif (response == 22) then |
||
660 | DAB_Bar_SetPage(bar, this.lastpage); |
||
661 | elseif (response == 32) then |
||
662 | this.pagemap[DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].page2] = DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].page; |
||
663 | if (DAB_Settings[DAB_INDEX].Bar[bar].page == DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].page2) then |
||
664 | DAB_Bar_SetPage(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].page2, 1); |
||
665 | end |
||
666 | elseif (response == 33) then |
||
667 | DAB_Bar_SetTarget(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].runit); |
||
668 | elseif (response == 34) then |
||
669 | DAB_Bar_SetTarget(bar); |
||
670 | elseif (response == 35) then |
||
671 | DAB_Bar_Location(bar, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].rx, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i].ry); |
||
672 | else |
||
673 | DAB_Global_Response(response, DAB_Settings[DAB_INDEX].Bar[bar].Conditions[i]); |
||
674 | end |
||
675 | end |
||
676 | |||
677 | getglobal("DAB_ActionBar_"..bar).activeConditions[i] = active; |
||
678 | end |
||
679 | end |
||
680 | |||
681 | if (this.timetohide) then |
||
682 | this.timetohide = this.timetohide - elapsed; |
||
683 | if (this.timetohide < 0) then |
||
684 | this.timetohide = nil; |
||
685 | DAB_Bar_Hide(this:GetID()); |
||
686 | end |
||
687 | end |
||
688 | end |
||
689 | |||
690 | function DAB_Bar_PageDown(bar) |
||
691 | if (DAB_Settings[DAB_INDEX].Bar[bar].numBars == 1) then return; end |
||
692 | local page = DAB_Settings[DAB_INDEX].Bar[bar].page; |
||
693 | page = page - 1; |
||
694 | if (page < 1) then |
||
695 | page = DAB_Settings[DAB_INDEX].Bar[bar].numBars; |
||
696 | end |
||
697 | local skippages = DAB_Get_SkipPages(bar, skippages); |
||
698 | if (skippages[page]) then |
||
699 | local newpage; |
||
700 | for i=page, 1, -1 do |
||
701 | if (not skippages[i]) then |
||
702 | newpage = i; |
||
703 | break; |
||
704 | end |
||
705 | end |
||
706 | if (not newpage) then |
||
707 | for i=DAB_Settings[DAB_INDEX].Bar[bar].numBars, 1, -1 do |
||
708 | if (not skippages[i]) then |
||
709 | newpage = i; |
||
710 | break; |
||
711 | end |
||
712 | end |
||
713 | end |
||
714 | if (not newpage) then |
||
715 | newpage = 1; |
||
716 | end |
||
717 | page = newpage; |
||
718 | end |
||
719 | DAB_Bar_SetPage(bar, page); |
||
720 | end |
||
721 | |||
722 | function DAB_Bar_PageUp(bar) |
||
723 | if (DAB_Settings[DAB_INDEX].Bar[bar].numBars == 1) then return; end |
||
724 | local page = DAB_Settings[DAB_INDEX].Bar[bar].page; |
||
725 | page = page + 1; |
||
726 | if (page > DAB_Settings[DAB_INDEX].Bar[bar].numBars) then |
||
727 | page = 1; |
||
728 | end |
||
729 | local skippages = DAB_Get_SkipPages(bar, skippages); |
||
730 | if (skippages[page]) then |
||
731 | local newpage; |
||
732 | for i=page, DAB_Settings[DAB_INDEX].Bar[bar].numBars do |
||
733 | if (not skippages[i]) then |
||
734 | newpage = i; |
||
735 | break; |
||
736 | end |
||
737 | end |
||
738 | if (not newpage) then |
||
739 | for i=1, DAB_Settings[DAB_INDEX].Bar[bar].numBars do |
||
740 | if (not skippages[i]) then |
||
741 | newpage = i; |
||
742 | break; |
||
743 | end |
||
744 | end |
||
745 | end |
||
746 | if (not newpage) then |
||
747 | newpage = 1; |
||
748 | end |
||
749 | page = newpage; |
||
750 | end |
||
751 | DAB_Bar_SetPage(bar, page); |
||
752 | end |
||
753 | |||
754 | function DAB_Bar_SetPage(bar, page, override) |
||
755 | if (not DAB_INITIALIZED) then return; end |
||
756 | if (not bar) then |
||
757 | DL_Error("You called DAB_Bar_SetPage without providing a bar number."); |
||
758 | return; |
||
759 | end |
||
760 | if (not page) then |
||
761 | DL_Error("You called DAB_Bar_SetPage without providing a page number."); |
||
762 | return; |
||
763 | end |
||
764 | if (bar < 1 or bar > DAB_NUM_BARS) then |
||
765 | DL_Error("You called DAB_Bar_SetPage with an invalid bar number: "..bar); |
||
766 | return; |
||
767 | end |
||
768 | if (page < 1 or page > DAB_Settings[DAB_INDEX].Bar[bar].numBars) then |
||
769 | DL_Error("You called DAB_Bar_SetPage with an invalid page number: "..page.." bar: "..bar); |
||
770 | return; |
||
771 | end |
||
772 | if (DAB_Settings[DAB_INDEX].Bar[bar].page == page and (not override)) then return; end |
||
773 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
774 | barFrame.lastpage = DAB_Settings[DAB_INDEX].Bar[bar].page; |
||
775 | DAB_Settings[DAB_INDEX].Bar[bar].page = page; |
||
776 | if (barFrame.pagemap[page]) then |
||
777 | page = barFrame.pagemap[page]; |
||
778 | end |
||
779 | if (page > DAB_Settings[DAB_INDEX].Bar[bar].numBars or page < 1) then |
||
780 | barFrame.pagemap[barFrame.lastpage] = nil; |
||
781 | page = 1; |
||
782 | DAB_Settings[DAB_INDEX].Bar[bar].page = 1; |
||
783 | end |
||
784 | local count = 0; |
||
785 | for i=1,120 do |
||
786 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
787 | count = count + 1; |
||
788 | DAB_Settings[DAB_INDEX].Buttons[i].action = DAB_Settings[DAB_INDEX].Bar[bar].pages[page][count]; |
||
789 | local actionbutton = getglobal("DAB_ActionButton_"..i); |
||
790 | actionbutton.fauxhidden = true; |
||
791 | DAB_ActionButton_FauxShow(i); |
||
792 | DAB_ActionButton_Show(i); |
||
793 | actionbutton.activeConditions = {}; |
||
794 | end |
||
795 | end |
||
796 | if (bar == 1) then |
||
797 | MainMenuBarPageNumber:SetText(DAB_Settings[DAB_INDEX].Bar[bar].page); |
||
798 | end |
||
799 | DAB_Bar_Update(bar); |
||
800 | DAB_Bar_Size(bar); |
||
801 | for i=1,10 do |
||
802 | if (DAB_Settings[DAB_INDEX].ControlBox[i].displayPage and DAB_Settings[DAB_INDEX].ControlBox[i].changePageBar == bar) then |
||
803 | getglobal("DAB_ControlBox_"..i.."_Text"):SetText(DAB_Settings[DAB_INDEX].Bar[bar].page); |
||
804 | end |
||
805 | end |
||
806 | end |
||
807 | |||
808 | function DAB_Bar_SetTarget(barID, unit) |
||
809 | local bar = getglobal("DAB_ActionBar_"..barID); |
||
810 | if (bar) then |
||
811 | bar.targetOverride = unit; |
||
812 | end |
||
813 | end |
||
814 | |||
815 | function DAB_Bar_Show(bar) |
||
816 | DAB_Settings[DAB_INDEX].Bar[bar].hide = nil; |
||
817 | getglobal("DAB_ActionBar_"..bar):Show(); |
||
818 | end |
||
819 | |||
820 | function DAB_Bar_Size(bar) |
||
821 | local barFrame = getglobal("DAB_ActionBar_"..bar); |
||
822 | local settings = DAB_Settings[DAB_INDEX].Bar[bar]; |
||
823 | local scale = settings.size / 36; |
||
824 | local visCount; |
||
825 | local visButtons = 0; |
||
826 | for row, buttons in barFrame.rows do |
||
827 | visCount = 0; |
||
828 | for _,button in buttons do |
||
829 | if (DAB_Settings[DAB_INDEX].Bar[bar].collapse) then |
||
830 | local ab = getglobal("DAB_ActionButton_"..button); |
||
831 | if (ab:IsShown() and (not ab.fauxhidden)) then |
||
832 | visCount = visCount + 1; |
||
833 | end |
||
834 | else |
||
835 | visCount = visCount + 1; |
||
836 | end |
||
837 | end |
||
838 | if (visCount > visButtons) then |
||
839 | visButtons = visCount; |
||
840 | end |
||
841 | end |
||
842 | local width = (visButtons * 36 + settings.hspacing * (visButtons - 1) + settings.Background.leftpadding + settings.Background.rightpadding) * scale; |
||
843 | local height = (settings.rows * 36 + settings.vspacing * (settings.rows - 1) + settings.Background.toppadding + settings.Background.bottompadding) * scale; |
||
844 | barFrame:SetWidth(width); |
||
845 | barFrame:SetHeight(height); |
||
846 | end |
||
847 | |||
848 | function DAB_Bar_TimeToHide(bar, seconds) |
||
849 | getglobal("DAB_ActionBar_"..bar).timetohide = seconds; |
||
850 | end |
||
851 | |||
852 | function DAB_Bar_Toggle(bar) |
||
853 | if (DAB_Settings[DAB_INDEX].Bar[bar].hide) then |
||
854 | DAB_Bar_Show(bar); |
||
855 | else |
||
856 | DAB_Bar_Hide(bar); |
||
857 | end |
||
858 | end |
||
859 | |||
860 | function DAB_Bar_Update(bar) |
||
861 | for i=1, 120 do |
||
862 | if (DAB_Settings[DAB_INDEX].Buttons[i].Bar == bar) then |
||
863 | this = getglobal("DAB_ActionButton_"..i); |
||
864 | DAB_ActionButton_Update(); |
||
865 | end |
||
866 | end |
||
867 | end |
||
868 | |||
869 | function DAB_Get_SkipPages(bar) |
||
870 | local list = {}; |
||
871 | if (not DAB_Settings[DAB_INDEX].Bar[bar].skipPages) then |
||
872 | return list; |
||
873 | end |
||
874 | local num = ""; |
||
875 | local char; |
||
876 | for i=1, string.len(DAB_Settings[DAB_INDEX].Bar[bar].skipPages) do |
||
877 | char = string.sub(DAB_Settings[DAB_INDEX].Bar[bar].skipPages, i, i); |
||
878 | if (char == ",") then |
||
879 | num = tonumber(num); |
||
880 | if (num) then |
||
881 | list[num] = 1; |
||
882 | end |
||
883 | num = ""; |
||
884 | else |
||
885 | num = num..char; |
||
886 | end |
||
887 | end |
||
888 | num = tonumber(num); |
||
889 | if (num) then |
||
890 | list[num] = 1; |
||
891 | end |
||
892 | return list; |
||
893 | end |