vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2  
3 Bar1 = ActionButton1-12
4 Bar2 = MultiBarBottomLeft
5 Bar3 = MultiBarBottomRight
6 Bar4 = MultiBarRight
7 Bar5 = MultiBarLeft
8 Bar6 = ShapeshiftButton1-10
9 Bar7 = PetActionButton1-10
10 Bar8 = Bags
11 Bar9 = MicroButtons
12 Bar10 = BonusActionButton1-12
13  
14 ]]--
15  
16 StaticPopupDialogs["BARTENDER2CONFIRM"] = { text = "Reset ALL settings?", button1 = "Yes", button2 = "No", timeout = 0, whileDead = 1, OnAccept = function() Bartender:ResetALL() end}
17  
18 Bartender = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceHook-2.0", "AceDB-2.0", "AceConsole-2.0", "AceModuleCore-2.0")
19 Bartender:RegisterDB("BarDB")
20 Bartender:SetModuleMixins("AceEvent-2.0")
21  
22 Bartender.version = "2.0." .. string.sub("$Revision: 11401 $", 12, -3)
23 Bartender.date = string.sub("$Date: 2006-09-19 22:35:24 +0300 (Tue, 19 Sep 2006) $", 8, 17)
24  
25 Bartender:RegisterDefaults('profile', BT2Defaults )
26  
27 local _G = getfenv(0)
28 local DBVersion = "Bar2DB-2"
29  
30 function Bartender:OnEnable()
31 self:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
32 self:Hook("ActionButton_ShowGrid")
33 self:Hook("ActionButton_HideGrid")
34 self:Hook("MultiActionBar_ShowAllGrids")
35 self:Hook("MultiActionBar_HideAllGrids")
36 self:Hook("UpdateTalentButton")
37 self:Hook("MainMenuBar_UpdateKeyRing")
38 self:MakeFrames()
39 self:OnProfileEnable()
40 self:ScheduleEvent(self.EnableAllBars, 10.0, self);
41 self:Print("How may I serve you?")
42 end
43  
44 function Bartender:EnableAllBars()
45 SHOW_MULTI_ACTIONBAR_1 = 1
46 SHOW_MULTI_ACTIONBAR_2 = 1
47 SHOW_MULTI_ACTIONBAR_3 = 1
48 SHOW_MULTI_ACTIONBAR_4 = 1
49 MultiActionBar_Update()
50 SetActionBarToggles(1,1,1,1)
51 end
52  
53 function Bartender:OnProfileEnable()
54 self:AllowMoving()
55 if not self.db.profile.Extra[DBVersion] then
56 self:ResetALL()
57 end
58 self:SetAllParents()
59 self:SetupBars()
60 self:ButtonHideCheck()
61 self:ButtonScaleCheck()
62 self:ButtonHotKeyCheck()
63 self:ButtonAlphaCheck()
64 self:ButtonNoCustomPositionCheck()
65 self:ButtonZoomCheck()
66 self:LoadAllPositions()
67 self:UPDATE_BONUS_ACTIONBAR()
68 MainMenuBar:Hide()
69 MultiActionBar_Update()
70 self:HideNormalTexture()
71 end
72  
73 function Bartender:AllowMoving()
74 MultiBarLeft:ClearAllPoints()
75 MultiBarRight:ClearAllPoints()
76 MultiBarBottomLeft:ClearAllPoints()
77 MultiBarBottomRight:ClearAllPoints()
78 for i,v in ipairs(AllButtons) do v:ClearAllPoints() end
79 end
80  
81 function Bartender:MakeFrames()
82 for i=1,10 do
83 self:CreateFrame("Bar"..i)
84 end
85 end
86  
87 function Bartender:DefaultBars()
88 for i=1,10 do
89 _G["Bar"..i]:ClearAllPoints()
90 _G["Bar"..i]:Show()
91 _G["Bar"..i]:SetScale(1)
92 end
93 for i=1,12 do
94 _G["Bar1Button"..i]:SetAlpha(1)
95 _G["Bar2Button"..i]:SetAlpha(1)
96 _G["Bar3Button"..i]:SetAlpha(1)
97 _G["Bar4Button"..i]:SetAlpha(1)
98 _G["Bar5Button"..i]:SetAlpha(1)
99 _G["Bar10Button"..i]:SetAlpha(1)
100 end
101 for i=1,10 do
102 _G["Bar6Button"..i]:SetAlpha(1)
103 _G["Bar7Button"..i]:SetAlpha(1)
104 end
105 for i=1,5 do
106 _G["Bar8Button"..i]:SetAlpha(1)
107 end
108 for i=1,8 do
109 _G["Bar9Button"..i]:SetAlpha(1)
110 end
111 Bar1:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, -5)
112 Bar2:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, 31)
113 Bar3:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, 67)
114 Bar4:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -41, 100)
115 Bar5:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -77, 100)
116 Bar6:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 20, 110)
117 Bar7:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 20, 140)
118 Bar8:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -190, 30)
119 Bar9:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -205, -5)
120 Bar10:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, -5)
121 self.db.profile.Extra[DBVersion] = true
122 end
123  
124 function Bartender:SetAllParents()
125 for i=1,12 do
126 _G["Bar1Button"..i]:SetParent("Bar1")
127 _G["Bar10Button"..i]:SetParent("Bar10")
128 end
129 MultiBarBottomLeft:SetParent("Bar2")
130 MultiBarBottomRight:SetParent("Bar3")
131 MultiBarRight:SetParent("Bar4")
132 MultiBarLeft:SetParent("Bar5")
133 for i=1,10 do
134 _G["Bar6Button"..i]:SetParent("Bar6")
135 _G["Bar7Button"..i]:SetParent("Bar7")
136 end
137 for i=1,5 do
138 _G["Bar8Button"..i]:SetParent("Bar8")
139 end
140 for i=1,8 do
141 _G["Bar9Button"..i]:SetParent("Bar9")
142 end
143 KeyRingButton:SetParent("UIParent")
144 end
145  
146 function Bartender:SetupBars()
147 for i=1,10 do
148 self["SetupBar"..i](self)
149 end
150 end
151  
152 -- for bars 1-5 + 10
153 function Bartender:SetupActionBars(bar)
154 local BarString = bar:GetName()
155 local Rows = self.db.profile[BarString].Rows
156 local ButtonPerRow = math.floor(12 / Rows) -- just a precaution
157 local Padding = self.db.profile[BarString].Padding
158 bar:SetWidth(36 * ButtonPerRow + ((ButtonPerRow - 1) * Padding) + 8)
159 bar:SetHeight(36 * Rows + ((Rows - 1) * Padding) + 8)
160 for i=1,Rows do
161 if i > 1 then
162 local FirstButton = (ButtonPerRow * (i - 1) + 1)
163 _G[BarString.."Button"..FirstButton]:ClearAllPoints()
164 _G[BarString.."Button"..FirstButton]:SetPoint("TOPLEFT", BarString.."Button"..(FirstButton - ButtonPerRow), "BOTTOMLEFT", 0, -Padding)
165 end
166 for k=(ButtonPerRow * (i - 1) + 2),(ButtonPerRow * i) do
167 _G[BarString.."Button"..k]:ClearAllPoints()
168 _G[BarString.."Button"..k]:SetPoint("BOTTOMLEFT", BarString.."Button"..k - 1, "BOTTOMRIGHT", Padding, 0)
169 end
170 end
171 _G[BarString.."Button1"]:ClearAllPoints()
172 _G[BarString.."Button1"]:SetPoint("TOPLEFT", BarString, "TOPLEFT", 5, -3)
173 self:LoadPosition(bar)
174 end
175  
176 function Bartender:SetupBar1()
177 self:SetupActionBars(Bar1)
178 end
179  
180 function Bartender:SetupBar2()
181 self:SetupActionBars(Bar2)
182 end
183  
184 function Bartender:SetupBar3()
185 self:SetupActionBars(Bar3)
186 end
187  
188 function Bartender:SetupBar4()
189 self:SetupActionBars(Bar4)
190 end
191  
192 function Bartender:SetupBar5()
193 self:SetupActionBars(Bar5)
194 end
195  
196 function Bartender:SetupBar6()
197 local pad = self.db.profile.Bar6.Padding
198 if self.db.profile.Bar6.Swap then
199 Bar6:SetWidth(38)
200 Bar6:SetHeight(308 + (pad * 9))
201 for i=2,10 do
202 _G["Bar6Button"..i]:SetPoint("BOTTOMLEFT", "Bar6Button"..i - 1, "TOPLEFT", 0, pad)
203 end
204 else
205 Bar6:SetWidth(308 + (pad * 9))
206 Bar6:SetHeight(38)
207 for i=2,10 do
208 _G["Bar6Button"..i]:SetPoint("BOTTOMLEFT", "Bar6Button"..i - 1, "BOTTOMRIGHT", pad, 0)
209 end
210 end
211 Bar6Button1:SetPoint("BOTTOMLEFT", "Bar6", "BOTTOMLEFT", 5, 5)
212 self:LoadPosition(Bar6)
213 end
214  
215 function Bartender:SetupBar7()
216 local pad = self.db.profile.Bar7.Padding
217 if self.db.profile.Bar7.Swap then
218 Bar7:SetWidth(38)
219 Bar7:SetHeight(308 + (pad * 9))
220 for i=2,10 do
221 _G["Bar7Button"..i]:SetPoint("BOTTOMLEFT", "Bar7Button"..i - 1, "TOPLEFT", 0, pad)
222 end
223 else
224 Bar7:SetWidth(308 + (pad * 9))
225 Bar7:SetHeight(38)
226 for i=2,10 do
227 _G["Bar7Button"..i]:SetPoint("BOTTOMLEFT", "Bar7Button"..i - 1, "BOTTOMRIGHT", pad, 0)
228 end
229 end
230 Bar7Button1:SetPoint("BOTTOMLEFT", "Bar7", "BOTTOMLEFT", 5, 5)
231 self:LoadPosition(Bar7)
232 end
233  
234 function Bartender:SetupBar8()
235 local pad = self.db.profile.Bar8.Padding
236 if self.db.profile.Bar8.Swap then
237 Bar8:SetWidth(45)
238 Bar8:SetHeight(193 + (pad *4))
239 for i=2,5 do
240 _G["Bar8Button"..i]:SetPoint("BOTTOMLEFT", "Bar8Button"..i - 1, "TOPLEFT", 0, pad)
241 end
242 else
243 Bar8:SetWidth(193 + (pad * 4))
244 Bar8:SetHeight(45)
245 for i=2,5 do
246 _G["Bar8Button"..i]:SetPoint("BOTTOMLEFT", "Bar8Button"..i - 1, "BOTTOMRIGHT", pad, 0)
247 end
248 end
249 Bar8Button1:SetPoint("BOTTOMLEFT", "Bar8", "BOTTOMLEFT", 5, 5)
250 self:LoadPosition(Bar8)
251 end
252  
253 function Bartender:SetupBar9()
254 local pad = self.db.profile.Bar9.Padding
255 if self.db.profile.Bar9.Swap then
256 Bar9:SetWidth(34)
257 Bar9:SetHeight(302 + (pad * 7))
258 for i=2,8 do
259 _G["Bar9Button"..i]:SetPoint("BOTTOMLEFT", "Bar9Button"..i - 1, "TOPLEFT", 0, pad - 21)
260 end
261 else
262 Bar9:SetWidth(236 + (pad * 7))
263 Bar9:SetHeight(43)
264 for i=2,8 do
265 _G["Bar9Button"..i]:SetPoint("BOTTOMLEFT", "Bar9Button"..i - 1, "BOTTOMRIGHT", pad, 0)
266 end
267 end
268 Bar9Button1:SetPoint("BOTTOMLEFT", "Bar9", "BOTTOMLEFT", 3, 4)
269 self:LoadPosition(Bar9)
270 end
271  
272 function Bartender:SetupBar10()
273 self:SetupActionBars(Bar10)
274 end
275  
276 function Bartender:ButtonHideCheck()
277 for i=1,10 do
278 if self.db.profile["Bar"..i].Hide then _G["Bar"..i]:Hide() end
279 end
280 end
281  
282 function Bartender:ButtonScaleCheck()
283 for i=1,10 do
284 _G["Bar"..i]:SetScale(self.db.profile["Bar"..i].Scale)
285 end
286 end
287  
288 function Bartender:ButtonHotKeyCheck()
289 for i=1,12 do
290 if self.db.profile.Bar1.HideHotKey then _G["Bar1Button"..i.."HK"]:Hide() end
291 if self.db.profile.Bar2.HideHotKey then _G["Bar2Button"..i.."HK"]:Hide() end
292 if self.db.profile.Bar3.HideHotKey then _G["Bar3Button"..i.."HK"]:Hide() end
293 if self.db.profile.Bar4.HideHotKey then _G["Bar4Button"..i.."HK"]:Hide() end
294 if self.db.profile.Bar5.HideHotKey then _G["Bar5Button"..i.."HK"]:Hide() end
295 if self.db.profile.Bar10.HideHotKey then _G["Bar10Button"..i.."HK"]:Hide() end
296 end
297 end
298  
299 function Bartender:ButtonAlphaCheck()
300 for i=1,12 do
301 _G["Bar1Button"..i]:SetAlpha(self.db.profile.Bar1.Alpha)
302 _G["Bar2Button"..i]:SetAlpha(self.db.profile.Bar2.Alpha)
303 _G["Bar3Button"..i]:SetAlpha(self.db.profile.Bar3.Alpha)
304 _G["Bar4Button"..i]:SetAlpha(self.db.profile.Bar4.Alpha)
305 _G["Bar5Button"..i]:SetAlpha(self.db.profile.Bar5.Alpha)
306 _G["Bar10Button"..i]:SetAlpha(self.db.profile.Bar10.Alpha)
307 end
308 for i=1,10 do
309 _G["Bar6Button"..i]:SetAlpha(self.db.profile.Bar6.Alpha)
310 _G["Bar7Button"..i]:SetAlpha(self.db.profile.Bar7.Alpha)
311 end
312 for i=1,5 do
313 _G["Bar8Button"..i]:SetAlpha(self.db.profile.Bar8.Alpha)
314 end
315 for i=1,8 do
316 _G["Bar9Button"..i]:SetAlpha(self.db.profile.Bar9.Alpha)
317 end
318 end
319  
320 function Bartender:ButtonNoCustomPositionCheck()
321 if ((not self.db.profile.Bar1.PosX) and (not self.db.profile.Bar1.PosY)) then Bar1:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, -5) end
322 if ((not self.db.profile.Bar2.PosX) and (not self.db.profile.Bar2.PosY)) then Bar2:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, 31) end
323 if ((not self.db.profile.Bar3.PosX) and (not self.db.profile.Bar3.PosY)) then Bar3:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, 67) end
324 if ((not self.db.profile.Bar4.PosX) and (not self.db.profile.Bar4.PosY)) then Bar4:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -41, 100) end
325 if ((not self.db.profile.Bar5.PosX) and (not self.db.profile.Bar5.PosY)) then Bar5:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -77, 100) end
326 if ((not self.db.profile.Bar6.PosX) and (not self.db.profile.Bar6.PosY)) then Bar6:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 20, 110) end
327 if ((not self.db.profile.Bar7.PosX) and (not self.db.profile.Bar7.PosY)) then Bar7:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 20, 140) end
328 if ((not self.db.profile.Bar8.PosX) and (not self.db.profile.Bar8.PosY)) then Bar8:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -190, 30) end
329 if ((not self.db.profile.Bar9.PosX) and (not self.db.profile.Bar9.PosY)) then Bar9:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -205, -5) end
330 if ((not self.db.profile.Bar10.PosX) and (not self.db.profile.Bar10.PosY)) then Bar10:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, -5) end
331 end
332  
333 function Bartender:ButtonZoomCheck()
334 if self.db.profile.Extra.HideBorder then
335 for i,v in ipairs(AllIcons) do v:SetTexCoord(0.07,0.93,0.07,0.93) end
336 else
337 for i,v in ipairs(AllIcons) do v:SetTexCoord(0,1,0,1) end
338 end
339 end
340  
341 function Bartender:LoadAllPositions()
342 for i=1,10 do
343 if self.db.profile["Bar"..i].PosX and self.db.profile["Bar"..i].PosY then self:LoadPosition(_G["Bar"..i]) end
344 end
345 end
346  
347 function Bartender:CreateFrame(name, text)
348 if not name then return end
349 local frame = CreateFrame("Button", name, UIParent)
350 frame:EnableMouse(false)
351 frame:SetMovable(true)
352 frame:RegisterForDrag("LeftButton")
353 frame:SetWidth(10)
354 frame:SetHeight(10)
355 frame:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16, insets = {left = 5, right = 3, top = 3, bottom = 5},})
356 frame:ClearAllPoints()
357 frame:SetBackdropColor(0, 0, 0, 0)
358 frame:SetBackdropBorderColor(0.5, 0.5, 0, 0)
359 frame:SetPoint("CENTER", "UIParent", "CENTER", 0, 0)
360 frame.Text = frame:CreateFontString(nil, "ARTWORK")
361 frame.Text:SetFontObject(GameFontNormal)
362 frame.Text:SetText(text)
363 frame.Text:Show()
364 frame.Text:ClearAllPoints()
365 frame.Text:SetPoint("CENTER", name, "CENTER",0,0)
366 end
367  
368 function Bartender:SavePosition(arg1)
369 if not arg1 then return end
370 local frame = arg1:GetName()
371 local x,y = arg1:GetLeft(), arg1:GetBottom()
372 local s = arg1:GetEffectiveScale()
373 x,y = x*s,y*s
374 self.db.profile[frame].PosX = x
375 self.db.profile[frame].PosY = y
376 end
377  
378 function Bartender:LoadPosition(arg1)
379 if not arg1 then return end
380 local frame = arg1:GetName()
381 local x = self.db.profile[frame].PosX
382 local y = self.db.profile[frame].PosY
383 if ((not x) or (not y)) then return end
384 local s = arg1:GetEffectiveScale()
385 x,y = x/s,y/s
386 arg1:ClearAllPoints()
387 arg1:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", x, y)
388 end
389  
390 function Bartender:HideBar(arg1)
391 self.db.profile[arg1:GetName()].Hide = true
392 arg1:Hide()
393 end
394  
395 function Bartender:ShowBar(arg1)
396 self.db.profile[arg1:GetName()].Hide = nil
397 arg1:Show()
398 end
399  
400 function Bartender:HideBorder()
401 self.db.profile.Extra.HideBorder = true
402 self:ButtonZoomCheck()
403 end
404  
405 function Bartender:ShowBorder()
406 self.db.profile.Extra.HideBorder = nil
407 self:ButtonZoomCheck()
408 end
409  
410 function Bartender:SwapOff(arg1)
411 self.db.profile[arg1:GetName()].Swap = false
412 self["Setup"..arg1:GetName()](self)
413 end
414  
415 function Bartender:SwapOn(arg1)
416 self.db.profile[arg1:GetName()].Swap = true
417 self["Setup"..arg1:GetName()](self)
418 end
419  
420 function Bartender:Rows(arg1,arg2)
421 self.db.profile[arg1:GetName()].Rows = 12 / math.floor(12 / arg2)
422 self["Setup"..arg1:GetName()](self)
423 end
424  
425 function Bartender:ShowHK(arg1)
426 self.db.profile[arg1:GetName()].HideHotKey = nil
427 for i=1,12 do
428 _G[arg1:GetName().."Button"..i.."HK"]:Show()
429 end
430 end
431  
432 function Bartender:HideHK(arg1)
433 self.db.profile[arg1:GetName()].HideHotKey = true
434 for i=1,12 do
435 _G[arg1:GetName().."Button"..i.."HK"]:Hide()
436 end
437 end
438  
439 function Bartender:Scale(arg1,arg2)
440 arg1:SetScale(arg2)
441 self.db.profile[arg1:GetName()].Scale = arg2
442 self:LoadPosition(arg1)
443 end
444  
445 function Bartender:Alpha(arg1,arg2)
446 if self.unlock then
447 self:Print("Please lock your bars first")
448 return
449 elseif ((arg1 == Bar1) or (arg1 == Bar2) or (arg1 == Bar3) or (arg1 == Bar4) or (arg1 == Bar5) or (arg1 == Bar10)) then
450 for i=1,12 do
451 _G[arg1:GetName().."Button"..i]:SetAlpha(arg2)
452 end
453 self.db.profile[arg1:GetName()].Alpha = arg2
454 elseif ((arg1 == Bar6) or (arg1 == Bar7)) then
455 for i=1,10 do
456 _G[arg1:GetName().."Button"..i]:SetAlpha(arg2)
457 end
458 self.db.profile[arg1:GetName()].Alpha = arg2
459 elseif arg1 == Bar8 then
460 for i=1,5 do
461 _G[arg1:GetName().."Button"..i]:SetAlpha(arg2)
462 end
463 self.db.profile[arg1:GetName()].Alpha = arg2
464 elseif arg1 == Bar9 then
465 for i=1,8 do
466 _G[arg1:GetName().."Button"..i]:SetAlpha(arg2)
467 end
468 self.db.profile[arg1:GetName()].Alpha = arg2
469 end
470 end
471  
472 function Bartender:Padding(arg1,arg2)
473 self.db.profile[arg1:GetName()].Padding = arg2
474 self["Setup"..arg1:GetName()](self)
475 end
476  
477 function Bartender:ResetPadding(arg1)
478 self.db.profile[arg1:GetName()].Padding = nil
479 self["Setup"..arg1:GetName()](self)
480 end
481  
482 function Bartender:ResetScale(arg1)
483 arg1:SetScale(1)
484 self.db.profile[arg1:GetName()].Scale = nil
485 self:LoadPosition(arg1)
486 end
487  
488 function Bartender:ResetAlpha(arg1)
489 if self.unlock then
490 self:Print("Please lock your bars first")
491 return
492 elseif ((arg1 == Bar1) or (arg1 == Bar2) or (arg1 == Bar3) or (arg1 == Bar4) or (arg1 == Bar5) or (arg1 == Bar10)) then
493 for i=1,12 do
494 _G[arg1:GetName().."Button"..i]:SetAlpha(1)
495 end
496 self.db.profile[arg1:GetName()].Alpha = nil
497 elseif ((arg1 == Bar6) or (arg1 == Bar7)) then
498 for i=1,10 do
499 _G[arg1:GetName().."Button"..i]:SetAlpha(1)
500 end
501 self.db.profile[arg1:GetName()].Alpha = nil
502 elseif arg1 == Bar8 then
503 for i=1,5 do
504 _G[arg1:GetName().."Button"..i]:SetAlpha(1)
505 end
506 self.db.profile[arg1:GetName()].Alpha = nil
507 elseif arg1 == Bar9 then
508 for i=1,8 do
509 _G[arg1:GetName().."Button"..i]:SetAlpha(1)
510 end
511 self.db.profile[arg1:GetName()].Alpha = nil
512 end
513 end
514  
515 function Bartender:ResetPosition(arg1)
516 self.db.profile[arg1:GetName()].PosX = nil
517 self.db.profile[arg1:GetName()].PosY = nil
518 arg1:ClearAllPoints()
519 if arg1 == Bar1 then
520 Bar1:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, -5)
521 elseif arg1 == Bar2 then
522 Bar2:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, 31)
523 elseif arg1 == Bar3 then
524 Bar3:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, 67)
525 elseif arg1 == Bar4 then
526 Bar4:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -41, 100)
527 elseif arg1 == Bar5 then
528 Bar5:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -77, 100)
529 elseif arg1 == Bar6 then
530 Bar6:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 20, 110)
531 elseif arg1 == Bar7 then
532 Bar7:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 20, 140)
533 elseif arg1 == Bar8 then
534 Bar8:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -190, 30)
535 elseif arg1 == Bar9 then
536 Bar9:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMRIGHT", -205, -5)
537 elseif arg1 == Bar10 then
538 Bar10:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", -5, -5)
539 end
540 end
541  
542 function Bartender:ResetBar(arg1)
543 if self.unlock then
544 self:Print("Please lock your bars first")
545 return
546 else
547 self.db.profile[arg1:GetName()].Scale = nil
548 self.db.profile[arg1:GetName()].Padding = nil
549 self.db.profile[arg1:GetName()].Swap = nil
550 self.db.profile[arg1:GetName()].Hide = nil
551 arg1:Show()
552 arg1:SetScale(1)
553 if ((arg1 == Bar1) or (arg1 == Bar2) or (arg1 == Bar3) or (arg1 == Bar4) or (arg1 == Bar5) or (arg1 == Bar10)) then
554 self:ShowHK(arg1)
555 end
556 self:ResetAlpha(arg1)
557 self:ResetPosition(arg1)
558 self["Setup"..arg1:GetName()](self)
559 end
560 end
561  
562 function Bartender:ResetALL()
563 self:Print("Creating new DB")
564 self:ResetDB("profile")
565 self:DefaultBars()
566 self:SetupBars()
567 self:ShowBorder()
568 self:UPDATE_BONUS_ACTIONBAR()
569 self:Lock()
570 end
571  
572 function Bartender:LockButtons()
573 if LOCK_ACTIONBAR == "1" then
574 LOCK_ACTIONBAR = "0"
575 Bartender:Print("ActionBar lock |cffffffcf[|r|cffff0000Off|cffffffcf]|r")
576 else
577 LOCK_ACTIONBAR = "1"
578 Bartender:Print("ActionBar lock |cffffffcf[|r|cff00ff00On|cffffffcf]|r")
579 end
580 end
581  
582 function Bartender:Move()
583 for i=1,10 do
584 _G["Bar"..i]:EnableMouse(true)
585 _G["Bar"..i]:SetScript("OnEnter", function() this:SetBackdropBorderColor(0.5, 0.5, 0, 1) end)
586 _G["Bar"..i]:SetScript("OnLeave", function() this:SetBackdropBorderColor(0, 0, 0, 0) end)
587 _G["Bar"..i]:SetScript("OnDragStart", function() this:StartMoving() this:SetBackdropBorderColor(0, 0, 0, 0) end)
588 _G["Bar"..i]:SetScript("OnDragStop", function() this:StopMovingOrSizing() self:SavePosition(this) end)
589 _G["Bar"..i]:SetBackdropColor(0, 1, 0, 0.5)
590 _G["Bar"..i]:SetFrameLevel(3)
591 end
592 for i,v in ipairs(AllButtons) do v:SetAlpha(0.5) v:SetFrameLevel(2) end
593 Bar1.Text:SetText("Bar1")
594 Bar2.Text:SetText("Bar2")
595 Bar3.Text:SetText("Bar3")
596 Bar4.Text:SetText("Bar4")
597 Bar5.Text:SetText("Bar5")
598 Bar6.Text:SetText("Bar6 (Shapebar)")
599 Bar7.Text:SetText("Bar7 (Petbar)")
600 Bar8.Text:SetText("Bar8 (Bagbar)")
601 Bar9.Text:SetText("Bar9 (Microbar)")
602 Bar10.Text:SetText("Bar10 (Bonusbar)")
603 self.unlock = true
604 self:EnableAllBars()
605 end
606  
607 function Bartender:Lock()
608 for i=1,10 do
609 _G["Bar"..i]:EnableMouse(false)
610 _G["Bar"..i]:SetScript("OnEnter", function() self:DummyFunction() end)
611 _G["Bar"..i]:SetScript("OnLeave", function() self:DummyFunction() end)
612 _G["Bar"..i]:SetScript("OnDragStart", function() self:DummyFunction() end)
613 _G["Bar"..i]:SetScript("OnDragStop", function() self:DummyFunction() end)
614 _G["Bar"..i]:SetBackdropColor(0, 0, 0, 0)
615 _G["Bar"..i]:SetBackdropBorderColor(0, 0, 0, 0)
616 _G["Bar"..i].Text:SetText("")
617 _G["Bar"..i]:SetFrameLevel(1)
618 end
619 for i,v in ipairs(AllButtons) do v:SetAlpha(self.db.profile.Bar8.Alpha) v:SetFrameLevel(2) end
620 self.unlock = nil
621 end
622  
623 function Bartender:DummyFunction()
624 end
625  
626 function Bartender:ActionButton_ShowGrid(button)
627 if ( not button ) then
628 button = this;
629 end
630 button.showgrid = button.showgrid+1
631 for i=1,12 do
632 _G[button:GetName().."NormalTexture"]:SetVertexColor(0,0,0)
633 _G[button:GetName().."NormalTexture"]:SetAlpha(0.3)
634 end
635 button:Show()
636 end
637  
638 function Bartender:ActionButton_HideGrid(button)
639 if ( not button ) then
640 button = this;
641 end
642 button.showgrid = button.showgrid-1
643 if ( button.showgrid == 0 and not HasAction(ActionButton_GetPagedID(button)) ) then
644 button:Hide()
645 self:HideNormalTexture()
646 end
647 end
648  
649 function Bartender:MultiActionBar_ShowAllGrids()
650 self.hooks["MultiActionBar_ShowAllGrids"].orig()
651 for i=1,12 do
652 _G["Bar1Button"..i]:Show()
653 _G["Bar1Button"..i.."NT"]:SetVertexColor(0,0,0)
654 _G["Bar1Button"..i.."NT"]:SetAlpha(0.3)
655 end
656 self:HideNormalTexture()
657 end
658  
659 function Bartender:MultiActionBar_HideAllGrids()
660 self.hooks["MultiActionBar_HideAllGrids"].orig()
661 for i=1,12 do
662 local buttons = _G["Bar1Button"..i]
663 if ( not HasAction(ActionButton_GetPagedID(buttons)) ) then
664 buttons:Hide()
665 end
666 end
667 self:HideNormalTexture()
668 end
669  
670 function Bartender:UpdateTalentButton()
671 end
672  
673 function Bartender:MainMenuBar_UpdateKeyRing()
674 KeyRingButton:Hide()
675 end
676  
677 function Bartender:HideNormalTexture()
678 for i,v in ipairs(AllNormalTextures) do v:SetAlpha(0) end
679 end
680  
681 function Bartender:UPDATE_BONUS_ACTIONBAR()
682 if self.db.profile.Bar10.NoSwap then
683 Bar10:Hide()
684 Bar1:Show()
685 CURRENT_ACTIONBAR_PAGE = 1
686 ChangeActionBarPage()
687 BonusActionBarFrame:Hide()
688 return
689 else
690 local x = GetBonusBarOffset()
691 if x == 3 then
692 Bar1:Hide()
693 if not self.db.profile.Bar10.Hide then
694 Bar10:Show()
695 BonusActionBarFrame:Show()
696 end
697 CURRENT_ACTIONBAR_PAGE = 9
698 ChangeActionBarPage()
699 elseif x == 2 then
700 Bar1:Hide()
701 if not self.db.profile.Bar10.Hide then
702 Bar10:Show()
703 BonusActionBarFrame:Show()
704 end
705 CURRENT_ACTIONBAR_PAGE = 8
706 ChangeActionBarPage()
707 elseif x == 1 then
708 Bar1:Hide()
709 if not self.db.profile.Bar10.Hide then
710 Bar10:Show()
711 BonusActionBarFrame:Show()
712 end
713 CURRENT_ACTIONBAR_PAGE = 7
714 ChangeActionBarPage()
715 else
716 Bar10:Hide()
717 if not self.db.profile.Bar1.Hide then
718 Bar1:Show()
719 BonusActionBarFrame:Hide()
720 end
721 CURRENT_ACTIONBAR_PAGE = 1
722 ChangeActionBarPage()
723 BonusActionBarFrame:Hide()
724 end
725 end
726 end