vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function GB_Checkbox_Initialize(box, value) |
2 | if (value) then |
||
3 | box:SetChecked(1); |
||
4 | else |
||
5 | box:SetChecked(0); |
||
6 | end |
||
7 | end |
||
8 | |||
9 | function GB_Checkbox_OnClick(index, func) |
||
10 | local value = false; |
||
11 | if (this:GetChecked()) then |
||
12 | value = true; |
||
13 | end |
||
14 | if (GB_BAR) then |
||
15 | GB_Set(GB_BAR, index, value); |
||
16 | if (func) then |
||
17 | func(GB_BAR); |
||
18 | end |
||
19 | else |
||
20 | GB_Set(index, value); |
||
21 | if (string.find(index, "Bindings")) then |
||
22 | GB_Update_Bindings(); |
||
23 | elseif (index == "Disable") then |
||
24 | GB_DisableGB(); |
||
25 | elseif (index == "HideInRaid") then |
||
26 | GB_Initialize_AllBars(); |
||
27 | end |
||
28 | end |
||
29 | end |
||
30 | |||
31 | function GB_Checkbox_OnClick2(index, func, index2) |
||
32 | local value = false; |
||
33 | if (this:GetChecked()) then |
||
34 | value = true; |
||
35 | end |
||
36 | if (this.index2) then |
||
37 | GB_Settings[GB_INDEX][GB_BAR].Button[GB_BUTTON][index][index2] = value; |
||
38 | else |
||
39 | GB_Settings[GB_INDEX][GB_BAR].Button[GB_BUTTON][index] = value; |
||
40 | end |
||
41 | if (func) then |
||
42 | func(GB_BAR, GB_BUTTON); |
||
43 | end |
||
44 | end |
||
45 | |||
46 | function GB_ColorPicker_ColorCancelled() |
||
47 | local color = ColorPickerFrame.previousValues; |
||
48 | GB_Settings[GB_INDEX][ColorPickerFrame.index] = color; |
||
49 | getglobal(ColorPickerFrame.colorBox):SetBackdropColor(color.r, color.g, color.b); |
||
50 | end |
||
51 | |||
52 | function GB_ColorPicker_ColorChanged() |
||
53 | local r, g, b = ColorPickerFrame:GetColorRGB(); |
||
54 | local color = { r=r, g=g, b=b }; |
||
55 | GB_Settings[GB_INDEX][ColorPickerFrame.index] = color; |
||
56 | getglobal(ColorPickerFrame.colorBox):SetBackdropColor(color.r, color.g, color.b); |
||
57 | end |
||
58 | |||
59 | function GB_ColorPicker_Show(index) |
||
60 | local color = GB_Settings[GB_INDEX][index]; |
||
61 | ColorPickerFrame.previousValues = color; |
||
62 | ColorPickerFrame.cancelFunc = GB_ColorPicker_ColorCancelled; |
||
63 | ColorPickerFrame.opacityFunc = GB_ColorPicker_ColorChanged; |
||
64 | ColorPickerFrame.func = GB_ColorPicker_ColorChanged; |
||
65 | ColorPickerFrame.colorBox = this:GetName(); |
||
66 | ColorPickerFrame.index = index; |
||
67 | ColorPickerFrame:SetColorRGB(color.r, color.g, color.b); |
||
68 | ColorPickerFrame:ClearAllPoints(); |
||
69 | ColorPickerFrame:SetPoint("CENTER", "GB_Options", "CENTER", 0, 0); |
||
70 | ColorPickerFrame:Show(); |
||
71 | end |
||
72 | |||
73 | function GB_Copy_BarSettings() |
||
74 | if (GB_BAR == GB_BAR_TO_COPY or (not GB_BAR_TO_COPY)) then return; end |
||
75 | GB_Copy_Table(GB_Settings[GB_INDEX][GB_BAR_TO_COPY], GB_Settings[GB_INDEX][GB_BAR]); |
||
76 | GB_Initialize_BarOptions(GB_BAR); |
||
77 | end |
||
78 | |||
79 | function GB_EditBox_OnTextChanged(index, subindex) |
||
80 | if (not GB_INITIALIZED) then return; end |
||
81 | if (subindex < 6) then |
||
82 | GB_Settings[GB_INDEX].announcements[subindex] = this:GetText(); |
||
83 | elseif (subindex > 100) then |
||
84 | GB_Settings[GB_INDEX][index][subindex - 100] = this:GetText(); |
||
85 | else |
||
86 | GB_Settings[GB_INDEX][index] = this:GetText(); |
||
87 | end |
||
88 | end |
||
89 | |||
90 | function GB_Initialize_BarOptions(frame) |
||
91 | GB_BAR_OPTIONS_INIT = true; |
||
92 | local settings = GB_Get(frame); |
||
93 | for i=1, 20 do |
||
94 | GB_Options_InitAction(frame, i); |
||
95 | end |
||
96 | GB_OptionsTitle_Label:SetText(GB_TEXT[frame.."BarOptions"]); |
||
97 | GB_Checkbox_Initialize(GB_Options_HideBar, settings.hide); |
||
98 | GB_Checkbox_Initialize(GB_Options_Collapse, settings.collapse); |
||
99 | GB_Checkbox_Initialize(GB_Options_Attach, settings.attach); |
||
100 | GB_Checkbox_Initialize(GB_Options_Mouseover, settings.mouseover); |
||
101 | GB_Slider_Initialize(GB_Options_ButtonSize, settings.buttonSize); |
||
102 | GB_Slider_Initialize(GB_Options_ButtonAlpha, settings.alpha * 100); |
||
103 | GB_Slider_Initialize(GB_Options_ButtonSpacing, settings.spacing); |
||
104 | GB_Slider_Initialize(GB_Options_ButtonRows, settings.rows); |
||
105 | GB_Slider_Initialize(GB_Options_XOffset, settings.xoffset); |
||
106 | GB_Slider_Initialize(GB_Options_YOffset, settings.yoffset); |
||
107 | for i,v in GB_ANCHOR_POINTS do |
||
108 | if (v.value == settings.attachTo) then |
||
109 | GB_BarOptions_AnchorTo_Setting:SetText(v.text); |
||
110 | break; |
||
111 | end |
||
112 | end |
||
113 | for i,v in GB_ANCHOR_POINTS do |
||
114 | if (v.value == settings.attachPoint) then |
||
115 | GB_BarOptions_AnchorPoint_Setting:SetText(v.text); |
||
116 | break; |
||
117 | end |
||
118 | end |
||
119 | GB_BarOptions_DefaultLeftClick_Setting:SetText(""); |
||
120 | GB_BarOptions_DefaultRightClick_Setting:SetText(""); |
||
121 | for _,value in GB_CLICK_MENU do |
||
122 | if (value.i == GB_Settings[GB_INDEX][GB_BAR].oldLeftClick) then |
||
123 | GB_BarOptions_DefaultLeftClick_Setting:SetText(value.v); |
||
124 | end |
||
125 | if (value.i == GB_Settings[GB_INDEX][GB_BAR].oldRightClick) then |
||
126 | GB_BarOptions_DefaultRightClick_Setting:SetText(value.v); |
||
127 | end |
||
128 | end |
||
129 | GB_BAR_OPTIONS_INIT = nil; |
||
130 | end |
||
131 | |||
132 | function GB_Menu_Anchors_OnClick(id) |
||
133 | GB_Set(GB_BAR, GB_ANCHORS_INDEX, this.value); |
||
134 | if (GB_ANCHORS_INDEX == "attachTo") then |
||
135 | GB_BarOptions_AnchorTo_Setting:SetText(GB_ANCHOR_POINTS[this:GetID()].text); |
||
136 | else |
||
137 | GB_BarOptions_AnchorPoint_Setting:SetText(GB_ANCHOR_POINTS[this:GetID()].text); |
||
138 | end |
||
139 | GB_Set_Appearance(GB_BAR); |
||
140 | end |
||
141 | |||
142 | function GB_Menu_Announce_OnClick(id) |
||
143 | GB_Set(GB_BAR, GB_BUTTON, "announceText", id); |
||
144 | GB_Action_Options_Cast_AnnounceNum_Setting:SetText(id); |
||
145 | end |
||
146 | |||
147 | function GB_Menu_Clickboxes_OnClick() |
||
148 | GB_CLICKBOX = this.index; |
||
149 | GB_MiscOptions_ChooseClickbox_Setting:SetText(GB_CLICKBOX_MENU[this:GetID()].text); |
||
150 | local offsets = GB_Settings[GB_INDEX][GB_CLICKBOX].Clickbox; |
||
151 | GB_MiscOptions_ClickboxX1:SetValue(offsets.x1); |
||
152 | GB_MiscOptions_ClickboxX2:SetValue(offsets.x2); |
||
153 | GB_MiscOptions_ClickboxY1:SetValue(offsets.y1); |
||
154 | GB_MiscOptions_ClickboxY2:SetValue(offsets.y2); |
||
155 | end |
||
156 | |||
157 | function GB_Menu_ClickCast_OnClick() |
||
158 | local text = getglobal(this:GetName().."_Text"):GetText(); |
||
159 | if (GB_CLICKCAST_BUTTON == -1) then |
||
160 | GB_Settings[GB_INDEX][GB_BAR].oldLeftClick = this.index; |
||
161 | getglobal("GB_BarOptions_DefaultLeftClick_Setting"):SetText(text); |
||
162 | elseif (GB_CLICKCAST_BUTTON == -2) then |
||
163 | GB_Settings[GB_INDEX][GB_BAR].oldRightClick = this.index; |
||
164 | getglobal("GB_BarOptions_DefaultRightClick_Setting"):SetText(text); |
||
165 | else |
||
166 | getglobal("GB_ActionOptions"..GB_CLICKCAST_BUTTON.."_ClickCast_Setting"):SetText(text); |
||
167 | for index, value in GB_Settings[GB_INDEX][GB_BAR].clickCast do |
||
168 | if (value == GB_CLICKCAST_BUTTON) then |
||
169 | GB_Settings[GB_INDEX][GB_BAR].clickCast[index] = nil; |
||
170 | end |
||
171 | end |
||
172 | if (this.index) then |
||
173 | GB_Settings[GB_INDEX][GB_BAR].clickCast[this.index] = GB_CLICKCAST_BUTTON; |
||
174 | end |
||
175 | end |
||
176 | end |
||
177 | |||
178 | function GB_Menu_Contexts_OnClick() |
||
179 | GB_Set(GB_BAR, GB_BUTTON, "context", this.index); |
||
180 | GB_Action_Options_Display_Context_Setting:SetText(getglobal(this:GetName().."_Text"):GetText()); |
||
181 | GB_ActionButton_Initialize(GB_BAR, GB_BUTTON); |
||
182 | end |
||
183 | |||
184 | function GB_Menu_CopyBar_OnClick(id) |
||
185 | GB_BAR_TO_COPY = this.value; |
||
186 | GB_BarOptions_CopyBarControl_Setting:SetText(GB_COPYBAR_MENU[id].text); |
||
187 | end |
||
188 | |||
189 | function GB_Menu_Forms_OnClick(id) |
||
190 | local form = getglobal(this:GetName().."_Text"):GetText(); |
||
191 | if (id == 99) then id = false; end |
||
192 | GB_Set(GB_BAR, GB_BUTTON, "form", id); |
||
193 | GB_Action_Options_Display_Form_Setting:SetText(form); |
||
194 | GB_ActionButton_Initialize(GB_BAR, GB_BUTTON); |
||
195 | end |
||
196 | |||
197 | function GB_Menu_NumParty_OnClick(id) |
||
198 | GB_Set("numPastAEThreshold", id); |
||
199 | GB_ThresholdsOptions_NumPartyToCheck_Setting:SetText(id); |
||
200 | end |
||
201 | |||
202 | function GB_Menu_OutOfContext_OnClick(id) |
||
203 | GB_Set(GB_BAR, GB_BUTTON, "OOCoption", GB_OOC_MENU[id].value); |
||
204 | GB_Action_Options_Display_OutOfContext_Setting:SetText(GB_OOC_MENU[id].text); |
||
205 | end |
||
206 | |||
207 | function GB_Options_CheckAllRaidMembers() |
||
208 | for i=1, GetNumRaidMembers() do |
||
209 | getglobal("GB_RaidMemberSelect"..i):SetChecked(1); |
||
210 | GB_RAID_MEMBERS[UnitName("raid"..i)] = true; |
||
211 | local raidframe = getglobal("GB_RaidBar"..i); |
||
212 | raidframe.noshow = false; |
||
213 | raidframe:Show(); |
||
214 | end |
||
215 | end |
||
216 | |||
217 | function GB_Options_HideAllWindows() |
||
218 | GB_AnnounceOptions:Hide(); |
||
219 | GB_BarOptions:Hide(); |
||
220 | GB_MiscOptions:Hide(); |
||
221 | GB_ThresholdsOptions:Hide(); |
||
222 | GB_RaidMemberSelect:Hide(); |
||
223 | end |
||
224 | |||
225 | function GB_Options_InitAction(bar, button) |
||
226 | local settings = GB_Get(bar, button); |
||
227 | local texture = GB_Get_Texture(bar, button); |
||
228 | local name = ""; |
||
229 | if (settings.name) then |
||
230 | name = settings.name.." "..settings.rank; |
||
231 | end |
||
232 | getglobal("GB_ActionOptions"..button.."_Dropbox_Texture"):SetTexture(texture); |
||
233 | getglobal("GB_ActionOptions"..button.."_ActionName"):SetText(name); |
||
234 | local menucontrol = getglobal("GB_ActionOptions"..button.."_ClickCast_Setting"); |
||
235 | local valueFound; |
||
236 | for index,value in GB_Settings[GB_INDEX][bar].clickCast do |
||
237 | if (value == button) then |
||
238 | local text; |
||
239 | for _,value2 in GB_CLICK_MENU do |
||
240 | if (value2.i == index) then |
||
241 | text = value2.v; |
||
242 | end |
||
243 | end |
||
244 | menucontrol:SetText(text); |
||
245 | valueFound = 1; |
||
246 | end |
||
247 | end |
||
248 | if (not valueFound) then |
||
249 | menucontrol:SetText(""); |
||
250 | end |
||
251 | end |
||
252 | |||
253 | function GB_Options_InitActionOptions(bar, button) |
||
254 | local settings = GB_Get(bar, button); |
||
255 | local spellname = settings.name; |
||
256 | if (settings.rank and settings.rank ~= "") then |
||
257 | spellname = spellname.." ("..settings.rank..")"; |
||
258 | end |
||
259 | GB_Action_Options_Name:SetText(spellname); |
||
260 | GB_Checkbox_Initialize(GB_Action_Options_Cast_Assist, settings.assist); |
||
261 | GB_Checkbox_Initialize(GB_Action_Options_Cast_Announce, settings.announce); |
||
262 | GB_Checkbox_Initialize(GB_Action_Options_Cast_AutoUpdate, settings.autoUpdate); |
||
263 | GB_Checkbox_Initialize(GB_Action_Options_Cast_PreventRebuff, settings.preventRebuff); |
||
264 | GB_Checkbox_Initialize(GB_Action_Options_Cast_ScaleRank, settings.scaleRank); |
||
265 | GB_Checkbox_Initialize(GB_Action_Options_Cast_PreventOverhealing, settings.preventOverhealing); |
||
266 | GB_Checkbox_Initialize(GB_Action_Options_Cast_PreventOverkill, settings.preventOverkill); |
||
267 | GB_Checkbox_Initialize(GB_Action_Options_Cast_MatchSpellName, settings.matchSpellName); |
||
268 | GB_Checkbox_Initialize(GB_Action_Options_Cast_MatchCastingTime, settings.matchCastingTime); |
||
269 | GB_Checkbox_Initialize(GB_Action_Options_Cast_LowManaRank, settings.lowManaRank); |
||
270 | GB_Checkbox_Initialize(GB_Action_Options_Cast_CancelHeal, settings.cancelHeal); |
||
271 | GB_Checkbox_Initialize(GB_Action_Options_Display_InCombat, settings.inCombat); |
||
272 | GB_Checkbox_Initialize(GB_Action_Options_Display_FlashInContext, settings.flashInContext); |
||
273 | GB_Checkbox_Initialize(GB_Action_Options_Display_NotInCombat, settings.notInCombat); |
||
274 | GB_Checkbox_Initialize(GB_Action_Options_Display_ValidTarget, settings.validTarget); |
||
275 | GB_Checkbox_Initialize(GB_Action_Options_Display_Druid, settings.classes[GB_TEXT.Druid]); |
||
276 | GB_Checkbox_Initialize(GB_Action_Options_Display_Priest, settings.classes[GB_TEXT.Priest]); |
||
277 | GB_Checkbox_Initialize(GB_Action_Options_Display_Warrior, settings.classes[GB_TEXT.Warrior]); |
||
278 | GB_Checkbox_Initialize(GB_Action_Options_Display_Warlock, settings.classes[GB_TEXT.Warlock]); |
||
279 | GB_Checkbox_Initialize(GB_Action_Options_Display_Hunter, settings.classes[GB_TEXT.Hunter]); |
||
280 | GB_Checkbox_Initialize(GB_Action_Options_Display_Rogue, settings.classes[GB_TEXT.Rogue]); |
||
281 | GB_Checkbox_Initialize(GB_Action_Options_Display_Mage, settings.classes[GB_TEXT.Mage]); |
||
282 | GB_Checkbox_Initialize(GB_Action_Options_Display_Shaman, settings.classes[GB_TEXT.Shaman]); |
||
283 | GB_Checkbox_Initialize(GB_Action_Options_Display_Paladin, settings.classes[GB_TEXT.Paladin]); |
||
284 | GB_Checkbox_Initialize(GB_Action_Options_Display_HideButton, settings.hide); |
||
285 | GB_Checkbox_Initialize(GB_Action_Options_Display_PlayerOnly, settings.playerOnly); |
||
286 | for i,v in GB_CONTEXTS do |
||
287 | if (v.index == settings.context) then |
||
288 | GB_Action_Options_Display_Context_Setting:SetText(v.text); |
||
289 | end |
||
290 | end |
||
291 | if (settings.form == 0) then |
||
292 | GB_Action_Options_Display_Form_Setting:SetText(GB_TEXT.NoForm); |
||
293 | elseif (settings.form) then |
||
294 | local _, form = GetShapeshiftFormInfo(settings.form); |
||
295 | GB_Action_Options_Display_Form_Setting:SetText(form); |
||
296 | else |
||
297 | GB_Action_Options_Display_Form_Setting:SetText(""); |
||
298 | end |
||
299 | GB_Action_Options_Cast_AnnounceNum_Setting:SetText(settings.announceText); |
||
300 | for i,v in GB_OOC_MENU do |
||
301 | if (v.value == settings.OOCoption) then |
||
302 | GB_Action_Options_Display_OutOfContext_Setting:SetText(v.text); |
||
303 | end |
||
304 | end |
||
305 | end |
||
306 | |||
307 | function GB_Options_ShowClickCastMenu() |
||
308 | if (GB_Menu_ClickCast:IsVisible()) then |
||
309 | GB_Menu_ClickCast:Hide(); |
||
310 | return; |
||
311 | end |
||
312 | |||
313 | GB_CLICKCAST_BUTTON = this:GetParent():GetParent():GetID(); |
||
314 | |||
315 | if (this:GetID() > 0) then |
||
316 | GB_CLICKCAST_BUTTON = -this:GetID(); |
||
317 | end |
||
318 | |||
319 | local count = 1; |
||
320 | GB_Menu_ClickCast_Option1_Text:SetText(GB_TEXT.None); |
||
321 | local width = GB_Menu_ClickCast_Option1_Text:GetWidth(); |
||
322 | for _,menuoption in GB_CLICK_MENU do |
||
323 | local indexFound; |
||
324 | for index in GB_Settings[GB_INDEX][GB_BAR].clickCast do |
||
325 | if (index == menuoption.i) then |
||
326 | indexFound = 1; |
||
327 | end |
||
328 | end |
||
329 | if (GB_Settings[GB_INDEX][GB_BAR].oldLeftClick == menuoption.i) then |
||
330 | indexFound = 1; |
||
331 | end |
||
332 | if (GB_Settings[GB_INDEX][GB_BAR].oldRightClick == menuoption.i) then |
||
333 | indexFound = 1; |
||
334 | end |
||
335 | if (not indexFound) then |
||
336 | count = count + 1 |
||
337 | getglobal("GB_Menu_ClickCast_Option"..count).index = menuoption.i; |
||
338 | local optiontext = getglobal("GB_Menu_ClickCast_Option"..count.."_Text"); |
||
339 | optiontext:SetText(menuoption.v); |
||
340 | if (optiontext:GetWidth() > width) then |
||
341 | width = optiontext:GetWidth(); |
||
342 | end |
||
343 | end |
||
344 | end |
||
345 | for i=1,27 do |
||
346 | getglobal("GB_Menu_ClickCast_Option"..i):SetWidth(width); |
||
347 | if (i > count) then |
||
348 | getglobal("GB_Menu_ClickCast_Option"..i):Hide(); |
||
349 | else |
||
350 | getglobal("GB_Menu_ClickCast_Option"..i):Show(); |
||
351 | end |
||
352 | end |
||
353 | GB_Menu_ClickCast:SetWidth(width + 20); |
||
354 | GB_Menu_ClickCast:SetHeight(count * 15 + 20); |
||
355 | GB_Menu_ClickCast:ClearAllPoints(); |
||
356 | GB_Menu_ClickCast:SetPoint("TOPLEFT", this:GetParent():GetName(), "BOTTOMLEFT", 0, 0); |
||
357 | local bottom = GB_Menu_ClickCast:GetBottom() / UIParent:GetScale(); |
||
358 | if (bottom < UIParent:GetBottom()) then |
||
359 | GB_Menu_ClickCast:ClearAllPoints(); |
||
360 | GB_Menu_ClickCast:SetPoint("BOTTOMLEFT", this:GetParent():GetName(), "TOPLEFT", 0, 0); |
||
361 | end |
||
362 | GB_Menu_ClickCast:Show(); |
||
363 | end |
||
364 | |||
365 | function GB_Options_ShowMenu(menu) |
||
366 | menu = getglobal(menu); |
||
367 | if (menu:IsVisible()) then |
||
368 | menu:Hide(); |
||
369 | else |
||
370 | if (this:GetParent().index == "attachTo" or this:GetParent().index == "attachPoint") then |
||
371 | GB_ANCHORS_INDEX = this:GetParent().index; |
||
372 | end |
||
373 | menu:ClearAllPoints(); |
||
374 | menu:SetPoint("TOPLEFT", this:GetParent():GetName(), "BOTTOMLEFT", 0, 0); |
||
375 | menu:Show(); |
||
376 | end |
||
377 | end |
||
378 | |||
379 | function GB_Options_ShowPopup(bar, button) |
||
380 | if (GB_Action_Options:IsVisible()) then |
||
381 | GB_BUTTON = nil; |
||
382 | GB_Action_Options:Hide(); |
||
383 | else |
||
384 | GB_BUTTON = button; |
||
385 | GB_Options_InitActionOptions(bar, button); |
||
386 | GB_Action_Options:ClearAllPoints(); |
||
387 | GB_Action_Options:SetPoint("TOPLEFT", this:GetName(), "BOTTOMLEFT", 0, 0); |
||
388 | GB_Action_Options:Show(); |
||
389 | local xoffset = UIParent:GetRight() - GB_Action_Options:GetRight() - 110; |
||
390 | local yoffset = GB_Action_Options:GetBottom(); |
||
391 | if (xoffset > 0) then xoffset = 0 end |
||
392 | if (yoffset > 0) then yoffset = 0 end |
||
393 | if ((xoffset + yoffset) < 0) then |
||
394 | GB_Action_Options:ClearAllPoints(); |
||
395 | GB_Action_Options:SetPoint("TOPLEFT", this:GetName(), "BOTTOMLEFT", xoffset, -yoffset); |
||
396 | end |
||
397 | end |
||
398 | end |
||
399 | |||
400 | function GB_PickupAction(id, id2, idtype) |
||
401 | if (idtype == "spell") then |
||
402 | PickupSpell(GB_SPELLS[id][id2].id, "BOOKTYPE_SPELL"); |
||
403 | elseif (idtype == "item") then |
||
404 | PickupContainerItem(GB_ITEMS[id].bag, GB_ITEMS[id].slot); |
||
405 | elseif (idtype == "inv") then |
||
406 | PickupInventoryItem(GB_INVENTORY[id].id); |
||
407 | elseif (idtype == "macro") then |
||
408 | GB_Old_PickupMacro(GB_MACROS[id].id); |
||
409 | end |
||
410 | end |
||
411 | |||
412 | function GB_RaidMemberSelect_OnClick() |
||
413 | local raidframe = getglobal("GB_RaidBar"..this:GetID()); |
||
414 | if (this:GetChecked()) then |
||
415 | GB_RAID_MEMBERS[UnitName("raid"..this:GetID())] = true; |
||
416 | raidframe.noshow = false; |
||
417 | raidframe:Show(); |
||
418 | else |
||
419 | GB_RAID_MEMBERS[UnitName("raid"..this:GetID())] = nil; |
||
420 | GB_SKIP_NAMES[UnitName("raid"..this:GetID())] = 1; |
||
421 | raidframe.noshow = true; |
||
422 | raidframe:Hide(); |
||
423 | end |
||
424 | end |
||
425 | |||
426 | function GB_Set_Anchor(subframe, xoffset, yoffset) |
||
427 | xoffset = getglobal(this:GetName().."_Label"):GetWidth() + xoffset + 5; |
||
428 | this:SetPoint("TOPLEFT", this:GetParent():GetName()..subframe, "BOTTOMLEFT", xoffset, yoffset); |
||
429 | end |
||
430 | |||
431 | function GB_Set_BoxNum() |
||
432 | local fn = this:GetName(); |
||
433 | getglobal(fn.."_BoxNum"):SetText(this:GetID()); |
||
434 | end |
||
435 | |||
436 | function GB_Set_HealingBonus() |
||
437 | local n = GB_MiscOptions_HealingBonus:GetNumber(); |
||
438 | if (not n) then n = 0; end |
||
439 | GB_Settings[GB_INDEX].HealingBonus = n; |
||
440 | GB_Update_Spells(1); |
||
441 | end |
||
442 | |||
443 | function GB_Set_Label(labeltext) |
||
444 | local fn = this:GetName(); |
||
445 | getglobal(fn.."_Label"):SetText(labeltext); |
||
446 | end |
||
447 | |||
448 | function GB_Show_OptionsFrame(frame) |
||
449 | if (frame == "main") then |
||
450 | if (GB_Options:IsVisible()) then |
||
451 | GB_Options:Hide(); |
||
452 | if (not GB_Settings[GB_INDEX].Disable) then |
||
453 | for _,box in GB_CLICKBOXES do |
||
454 | getglobal(box):Hide(); |
||
455 | getglobal(box.."_Texture"):Hide(); |
||
456 | end |
||
457 | if (not GB_Get("hideClickboxes")) then |
||
458 | GB_PlayerClickbox:Show(); |
||
459 | if (UnitName("target")) then |
||
460 | GB_TargetClickbox:Show(); |
||
461 | end |
||
462 | if (UnitName("pet")) then |
||
463 | GB_Pet0Clickbox:Show(); |
||
464 | end |
||
465 | for i=1,GetNumPartyMembers() do |
||
466 | getglobal("GB_Party"..i.."Clickbox"):Show(); |
||
467 | if (UnitName("partypet"..i)) then |
||
468 | getglobal("GB_Pet"..i.."Clickbox"):Show(); |
||
469 | end |
||
470 | end |
||
471 | end |
||
472 | end |
||
473 | else |
||
474 | GB_Options:Show(); |
||
475 | if (not GB_Settings[GB_INDEX].Disable) then |
||
476 | for _,box in GB_CLICKBOXES do |
||
477 | if (not GB_Get("hideClickboxes")) then getglobal(box):Show(); end |
||
478 | getglobal(box.."_Texture"):Show(); |
||
479 | end |
||
480 | end |
||
481 | end |
||
482 | if (not GB_Settings[GB_INDEX].Disable) then |
||
483 | GB_Initialize_AllBars(); |
||
484 | end |
||
485 | elseif (frame == "misc") then |
||
486 | GB_Options_HideAllWindows(); |
||
487 | GB_BAR = nil; |
||
488 | GB_MiscOptions:Show(); |
||
489 | GB_OptionsTitle_Label:SetText(GB_TEXT.MiscellaneousOptions); |
||
490 | elseif (frame == "announce") then |
||
491 | GB_Options_HideAllWindows(); |
||
492 | GB_BAR = nil; |
||
493 | GB_AnnounceOptions:Show(); |
||
494 | GB_OptionsTitle_Label:SetText(GB_TEXT.AnnounceOptions2); |
||
495 | elseif (frame == "thresholds") then |
||
496 | GB_Options_HideAllWindows(); |
||
497 | GB_BAR = nil; |
||
498 | GB_ThresholdsOptions:Show(); |
||
499 | GB_OptionsTitle_Label:SetText(GB_TEXT.SetThresholdValues); |
||
500 | elseif (frame == "raidmembers") then |
||
501 | GB_Options_HideAllWindows(); |
||
502 | GB_RaidMemberSelect:Show(); |
||
503 | GB_OptionsTitle_Label:SetText(GB_TEXT.SelectRaidMembers); |
||
504 | else |
||
505 | GB_Options_HideAllWindows(); |
||
506 | GB_BAR = frame; |
||
507 | if (not GB_Settings[GB_INDEX].Disable) then GB_Initialize_BarOptions(frame); end |
||
508 | GB_BarOptions:Show(); |
||
509 | end |
||
510 | end |
||
511 | |||
512 | function GB_Slider_Initialize(slider, value) |
||
513 | slider:SetValue(value); |
||
514 | getglobal(slider:GetName().."_Display"):SetText(value); |
||
515 | end |
||
516 | |||
517 | function GB_Slider_OnValueChanged(index, func) |
||
518 | if (not GB_INITIALIZED) then return; end |
||
519 | if (GB_BAR_OPTIONS_INIT) then return; end |
||
520 | if (this:GetID() == 555 and (not GB_CLICKBOX)) then return; end |
||
521 | local value = this:GetValue(); |
||
522 | getglobal(this:GetName().."_Display"):SetText(value); |
||
523 | if (this.scale) then |
||
524 | value = value / this.scale; |
||
525 | end |
||
526 | if (this:GetID() == 555) then |
||
527 | GB_Settings[GB_INDEX][GB_CLICKBOX].Clickbox[this.index] = value; |
||
528 | else |
||
529 | GB_Settings[GB_INDEX][GB_BAR][index] = value; |
||
530 | end |
||
531 | func(GB_BAR); |
||
532 | end |
||
533 | |||
534 | function GB_Slider_UpdateFromEditBox(maxlock, index, func) |
||
535 | this:ClearFocus(); |
||
536 | local value = this:GetNumber(); |
||
537 | local min, max = this:GetParent():GetMinMaxValues(); |
||
538 | if (value < min) then |
||
539 | value = min; |
||
540 | elseif (value > max and maxlock) then |
||
541 | value = max; |
||
542 | end |
||
543 | if (value <= max) then |
||
544 | this:SetText(value); |
||
545 | this:GetParent():SetValue(this:GetNumber()); |
||
546 | else |
||
547 | if (this:GetParent():GetID() == 555) then |
||
548 | GB_Settings[GB_INDEX][GB_CLICKBOX].Clickbox[this:GetParent().index] = value; |
||
549 | else |
||
550 | GB_Set(GB_BAR, index, value); |
||
551 | end |
||
552 | func(GB_BAR); |
||
553 | end |
||
554 | end |
||
555 | |||
556 | function GB_Toggle_BarLock() |
||
557 | if (GB_Get("barsLocked")) then |
||
558 | GB_Set("barsLocked", false); |
||
559 | GB_LockBars_Button:SetText(GB_TEXT.LockBars); |
||
560 | else |
||
561 | GB_Set("barsLocked", true); |
||
562 | GB_LockBars_Button:SetText(GB_TEXT.UnlockBars); |
||
563 | end |
||
564 | end |
||
565 | |||
566 | function GB_Toggle_Bars() |
||
567 | local value = true; |
||
568 | if (GB_Settings[GB_INDEX].player.hide) then value = false; end |
||
569 | for bar in GB_UNITS_ARRAY do |
||
570 | GB_Settings[GB_INDEX][bar].hide = value; |
||
571 | GB_Set_Appearance(bar); |
||
572 | end |
||
573 | end |
||
574 | |||
575 | function GB_Toggle_ButtonsLock() |
||
576 | if (GB_Get("buttonsLocked")) then |
||
577 | GB_Set("buttonsLocked", false); |
||
578 | GB_LockButtons_Button:SetText(GB_TEXT.LockButtons); |
||
579 | else |
||
580 | GB_Set("buttonsLocked", true); |
||
581 | GB_LockButtons_Button:SetText(GB_TEXT.UnlockButtons); |
||
582 | end |
||
583 | end |
||
584 | |||
585 | function GB_Toggle_Clickboxes() |
||
586 | if (GB_Get("hideClickboxes") and (not DUF_TargetOfTargetFrame)) then |
||
587 | GB_Set("hideClickboxes", false); |
||
588 | GB_HideClickboxes_Button:SetText(GB_TEXT.HideClickboxes); |
||
589 | GB_PlayerClickbox:Show(); |
||
590 | if (UnitName("pet")) then |
||
591 | GB_Pet0Clickbox:Show(); |
||
592 | end |
||
593 | for i = 1, 4 do |
||
594 | if (i <= GetNumPartyMembers()) then |
||
595 | getglobal("GB_Party"..i.."Clickbox"):Show(); |
||
596 | if (UnitName("partypet"..i)) then |
||
597 | getglobal("GB_Pet"..i.."Clickbox"):Show(); |
||
598 | end |
||
599 | end |
||
600 | end |
||
601 | if (UnitName("target")) then |
||
602 | GB_TargetClickbox:Show(); |
||
603 | end |
||
604 | else |
||
605 | GB_Set("hideClickboxes", true); |
||
606 | GB_HideClickboxes_Button:SetText(GB_TEXT.ShowClickboxes); |
||
607 | GB_PlayerClickbox:Hide(); |
||
608 | GB_Party1Clickbox:Hide(); |
||
609 | GB_Party2Clickbox:Hide(); |
||
610 | GB_Party3Clickbox:Hide(); |
||
611 | GB_Party4Clickbox:Hide(); |
||
612 | GB_Pet0Clickbox:Hide(); |
||
613 | GB_Pet1Clickbox:Hide(); |
||
614 | GB_Pet2Clickbox:Hide(); |
||
615 | GB_Pet3Clickbox:Hide(); |
||
616 | GB_Pet4Clickbox:Hide(); |
||
617 | GB_TargetClickbox:Hide(); |
||
618 | end |
||
619 | end |
||
620 | |||
621 | function GB_Toggle_EmptyButtons() |
||
622 | if (GB_Get("showEmpty")) then |
||
623 | GB_Settings[GB_INDEX].showEmpty = nil; |
||
624 | GB_ShowEmpty_Button:SetText(GB_TEXT.ShowEmpty); |
||
625 | else |
||
626 | GB_Settings[GB_INDEX].showEmpty = true; |
||
627 | GB_ShowEmpty_Button:SetText(GB_TEXT.HideEmpty); |
||
628 | end |
||
629 | end |
||
630 | |||
631 | function GB_Toggle_Labels() |
||
632 | if (GB_Get("showLabels")) then |
||
633 | GB_Labels_Hide(); |
||
634 | GB_Set("showLabels", false); |
||
635 | GB_ShowLabels_Button:SetText(GB_TEXT.ShowLabels); |
||
636 | else |
||
637 | GB_Labels_Show(); |
||
638 | GB_Set("showLabels", true); |
||
639 | GB_ShowLabels_Button:SetText(GB_TEXT.HideLabels); |
||
640 | end |
||
641 | end |
||
642 | |||
643 | function GB_Toggle_MiniSpellbook() |
||
644 | if (GB_MiniSpellbook:IsVisible()) then |
||
645 | GB_MiniSpellbook:Hide(); |
||
646 | else |
||
647 | GB_MiniSpellbook:Show(); |
||
648 | end |
||
649 | end |
||
650 | |||
651 | function GB_Update_Spellbox(button, bar) |
||
652 | if (not bar) then |
||
653 | bar = GB_BAR; |
||
654 | end |
||
655 | local oldSettings = {}; |
||
656 | GB_Copy_Table(GB_Get(bar, button), oldSettings); |
||
657 | if (GB_MOUSE_ACTION.id) then |
||
658 | GB_Copy_Table(GB_MOUSE_ACTION.options, GB_Settings[GB_INDEX][bar].Button[button]); |
||
659 | GB_Set(bar, button, "name", GB_MOUSE_ACTION.id); |
||
660 | GB_Set(bar, button, "rank", GB_MOUSE_ACTION.id2); |
||
661 | GB_Set(bar, button, "idType", GB_MOUSE_ACTION.idtype); |
||
662 | GB_PickupAction(GB_MOUSE_ACTION.id, GB_MOUSE_ACTION.id2, GB_MOUSE_ACTION.idtype); |
||
663 | else |
||
664 | GB_Settings[GB_INDEX][bar].Button[button] = GB_Get_DefaultButtonSettings(); |
||
665 | end |
||
666 | GB_Clear_MouseAction(); |
||
667 | if (oldSettings.name) then |
||
668 | GB_PickupAction(oldSettings.name, oldSettings.rank, oldSettings.idType); |
||
669 | GB_Set_MouseAction(oldSettings.name, oldSettings.rank, oldSettings.idType, oldSettings); |
||
670 | end |
||
671 | GB_Options_InitAction(bar, button); |
||
672 | GB_ActionButton_Initialize(bar, button) |
||
673 | end |