vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 function DAB_OtherBar_Hide(bar)
2 DAB_Settings[DAB_INDEX].OtherBar[bar].hide = 1;
3 getglobal("DAB_OtherBar"..DAB_OTHER_BAR[bar][0].tag):Hide();
4 end
5  
6 function DAB_OtherBar_Initialize(bar)
7 if (not DAB_INITIALIZED) then return; end
8 local settings = DAB_Settings[DAB_INDEX].OtherBar[bar];
9 local barFrame = getglobal("DAB_OtherBar"..DAB_OTHER_BAR[bar][0].tag);
10 local numButtons = DAB_OTHER_BAR[bar][0].numButtons;
11  
12 if (bar == 12) then
13 numButtons = GetNumShapeshiftForms();
14 if (numButtons == 0) then numButtons = 10; end
15 end
16  
17 barFrame:SetFrameStrata(settings.frameStrata);
18 barFrame:ClearAllPoints();
19 barFrame:SetPoint(settings.Anchor.point, settings.Anchor.frame, settings.Anchor.to, settings.Anchor.x, settings.Anchor.y);
20 if (settings.Background.hide) then
21 barFrame:SetBackdropColor(0, 0, 0, 0);
22 barFrame:SetBackdropBorderColor(0, 0, 0, 0);
23 else
24 barFrame:SetBackdrop({bgFile = settings.Background.texture, edgeFile = settings.Background.btexture, tile = settings.Background.tile, tileSize = settings.Background.tileSize, edgeSize = settings.Background.edgeSize, insets = { left = settings.Background.left, right = settings.Background.right, top = settings.Background.top, bottom = settings.Background.bottom }});
25 barFrame:SetBackdropColor(settings.Background.color.r, settings.Background.color.g, settings.Background.color.b, settings.Background.alpha);
26 barFrame:SetBackdropBorderColor(settings.Background.bcolor.r, settings.Background.bcolor.g, settings.Background.bcolor.b, settings.Background.balpha);
27 end
28  
29 TalentMicroButton:Show();
30  
31 if (bar < 13) then
32 for i=1,10 do
33 local cctext;
34 if (bar == 11) then
35 cctext = getglobal("DAB_PetCooldown_"..i.."_Text");
36 else
37 cctext = getglobal("DAB_ShapeshiftCooldown_"..i.."_Text");
38 end
39 cctext:SetFont(settings.Cooldown.font, settings.Cooldown.size, "outline='NORMAL'");
40 cctext:SetTextColor(settings.Cooldown.color.r, settings.Cooldown.color.g, settings.Cooldown.color.b);
41 if (settings.cooldownCount) then
42 cctext:Show();
43 else
44 cctext:Hide();
45 end
46 end
47 end
48  
49 local scale = settings.scale;
50 for i=1, numButtons do
51 local button = getglobal(DAB_OTHER_BAR[bar][i]);
52 button:SetParent(barFrame);
53 button:SetScale(scale);
54 button:SetAlpha(settings.alpha);
55 button:Show();
56 if (i == 1) then
57 button:ClearAllPoints();
58 button:SetPoint("TOPLEFT", barFrame, "TOPLEFT", settings.Background.leftpadding, -settings.Background.toppadding + DAB_OTHER_BAR[bar][0].offset);
59 elseif (settings.layout < 3) then
60 button:ClearAllPoints();
61 button:SetPoint("LEFT", DAB_OTHER_BAR[bar][i - 1], "RIGHT", settings.hspacing, 0);
62 else
63 button:ClearAllPoints();
64 button:SetPoint("TOP", DAB_OTHER_BAR[bar][i - 1], "BOTTOM", 0, -settings.vspacing + DAB_OTHER_BAR[bar][0].offset);
65 end
66 if (bar == 12) then
67 local border = getglobal(DAB_OTHER_BAR[bar][i].."NormalTexture");
68 border:Hide();
69 border.Show = function() end;
70 end
71 end
72  
73 local buttonH = DAB_OTHER_BAR[bar][0].height;
74 local buttonW = DAB_OTHER_BAR[bar][0].width;
75 local row2button = getglobal(DAB_OTHER_BAR[bar][math.ceil(numButtons / 2) + 1]);
76 local row1button = getglobal(DAB_OTHER_BAR[bar][1]);
77 local buttonsWidth, buttonsHigh;
78 if (settings.layout == 1) then
79 buttonsWide = numButtons;
80 buttonsHigh = 1;
81 elseif (settings.layout == 2) then
82 row2button:ClearAllPoints();
83 row2button:SetPoint("TOP", row1button, "BOTTOM", 0, -settings.vspacing + DAB_OTHER_BAR[bar][0].offset);
84 buttonsWide = math.ceil(numButtons / 2);
85 buttonsHigh = 2;
86 elseif (settings.layout == 3) then
87 buttonsWide = 1;
88 buttonsHigh = numButtons;
89 elseif (settings.layout == 4) then
90 row2button:ClearAllPoints();
91 row2button:SetPoint("LEFT", row1button, "RIGHT", settings.hspacing, 0);
92 buttonsWide = 2;
93 buttonsHigh = math.ceil(numButtons / 2);
94 end
95 local width = (buttonsWide * buttonW + settings.hspacing * (buttonsWide - 1) + settings.Background.leftpadding + settings.Background.rightpadding) * settings.scale;
96 local height = (buttonsHigh * buttonH + settings.vspacing * (buttonsHigh - 1) + settings.Background.toppadding + settings.Background.bottompadding) * settings.scale;
97 barFrame:SetWidth(width);
98 barFrame:SetHeight(height);
99  
100 if (not settings.mouseover) then
101 barFrame:EnableMouse(1);
102 barFrame:SetAlpha(1);
103 end
104  
105 if (bar == 11) then
106 event = "UPDATE_BONUS_ACTIONBAR";
107 BonusActionBar_OnEvent();
108 end
109  
110 if (bar == 11 and (not UnitExists("pet")) and (not UnitName("pet"))) then
111 barFrame:Hide();
112 return;
113 end
114 if (bar == 12 and GetNumShapeshiftForms() == 0) then
115 barFrame:Hide();
116 return;
117 end
118 if (settings.hide) then
119 barFrame:Hide();
120 else
121 barFrame:Show();
122 barFrame.mouseover = true;
123 end
124 end
125  
126 function DAB_OtherBar_OnDragStart()
127 if (not DAB_DRAGGING_UNLOCKED) and (not DAB_Check_ModifierKey(DAB_Settings[DAB_INDEX].DragLockOverride)) then return; end
128 if (DAB_DRAGGING_UNLOCKED) then
129 DL_Debug("Dragging is unlocked. You will not be able to click these buttons until you lock dragging.");
130 end
131 id = this:GetID();
132 if (not this.moving) then
133 this.moving = true;
134 this:StartMoving();
135 end
136 end
137  
138 function DAB_OtherBar_OnDragStop()
139 id = this:GetID();
140 if (not this.moving) then return; end
141 this.moving = nil;
142 this:StopMovingOrSizing();
143 local settings = DAB_Settings[DAB_INDEX].OtherBar[id].Anchor;
144 local x, y = DL_Get_Offsets(this, getglobal(settings.frame), settings.point, settings.to);
145 settings.x = x;
146 settings.y = y;
147 this:ClearAllPoints();
148 this:SetPoint(settings.point, settings.frame, settings.to, x, y);
149 if (DAB_Options and DAB_OBJECT_SUBINDEX == id) then
150 DL_Init_EditBox(DAB_OtherBarOptions_XOffset, x);
151 DL_Init_EditBox(DAB_OtherBarOptions_YOffset, y);
152 end
153 end
154  
155 function DAB_OtherBar_OnUpdate(elapsed)
156 if (not DAB_INITIALIZED) then return; end
157 local id = this:GetID();
158 if (not DAB_Settings[DAB_INDEX].OtherBar[id].mouseover) then return; end
159 local mouseover = DL_IsMouseOver(this);
160 if (mouseover == this.mouseover) then return; end
161 this.mouseover = mouseover;
162 if (mouseover) then
163 this:EnableMouse(1);
164 this:SetAlpha(1);
165 for i=1, DAB_OTHER_BAR[id][0].numButtons do
166 getglobal(DAB_OTHER_BAR[id][i]):Show();
167 end
168 else
169 this:EnableMouse(false);
170 this:SetAlpha(0);
171 for i=1, DAB_OTHER_BAR[id][0].numButtons do
172 getglobal(DAB_OTHER_BAR[id][i]):Hide();
173 end
174 end
175 end
176  
177 function DAB_OtherBar_Show(bar)
178 DAB_Settings[DAB_INDEX].OtherBar[bar].hide = nil;
179 getglobal("DAB_OtherBar"..DAB_OTHER_BAR[bar][0].tag):Show();
180 end
181  
182 function DAB_OtherBar_Toggle(bar)
183 if (DAB_Settings[DAB_INDEX].OtherBar[bar].hide) then
184 DAB_Settings[DAB_INDEX].OtherBar[bar].hide = nil;
185 getglobal("DAB_OtherBar"..DAB_OTHER_BAR[bar][0].tag):Show();
186 else
187 DAB_Settings[DAB_INDEX].OtherBar[bar].hide = 1;
188 getglobal("DAB_OtherBar"..DAB_OTHER_BAR[bar][0].tag):Hide();
189 end
190 end