vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local L = AceLibrary:GetInstance("AceLocale-2.0"):new("Clique") |
2 | local dewdrop = AceLibrary("Dewdrop-2.0") |
||
3 | |||
4 | local listSelected = 0 -- index of clickCasts selected (0 for none) |
||
5 | local maybeDoubleClick = nil -- listSelected prior to an unselect, in case of a double-click (to edit) |
||
6 | local editSet |
||
7 | local tempButton, tempModifiers, tempTexture |
||
8 | |||
9 | function Clique:SpellBookFrame_OnShow() |
||
10 | self.hooks[SpellBookFrame].OnShow.orig(SpellBookFrame) |
||
11 | |||
12 | -- This darkens the background of the options UI to match the spellbook more closely |
||
13 | CliqueBackdropLeft:SetVertexColor(.7,.7,.7,1) |
||
14 | CliqueBackdropRight:SetVertexColor(.7,.7,.7,1) |
||
15 | CliqueFrame:SetBackdropBorderColor(.5,.5,.5,1) |
||
16 | |||
17 | editSet = self.db.char[L"DEFAULT_FRIENDLY"] |
||
18 | Clique:ListScrollUpdate() |
||
19 | |||
20 | local button |
||
21 | for i=2,8 do |
||
22 | button = getglobal("SpellBookSkillLineTab"..i) |
||
23 | if not button:IsVisible() then |
||
24 | CliquePulloutTab:ClearAllPoints() |
||
25 | CliquePulloutTab:SetPoint("TOPLEFT","SpellBookSkillLineTab"..(i-1),"BOTTOMLEFT",0,-17) |
||
26 | break |
||
27 | end |
||
28 | end |
||
29 | end |
||
30 | |||
31 | function Clique:SpellButton_OnClick() |
||
32 | if not CliqueFrame:IsVisible() then |
||
33 | self.hooks[this].OnClick.orig(this) |
||
34 | elseif CliqueEditFrame:IsVisible() then |
||
35 | -- We're editing a custom spell at the moment |
||
36 | return |
||
37 | else |
||
38 | local id = SpellBook_GetSpellID(this:GetID()); |
||
39 | local texture = GetSpellTexture(id, SpellBookFrame.bookType) |
||
40 | local name, rank = GetSpellName(id, SpellBookFrame.bookType) |
||
41 | local a,c,s = IsAltKeyDown() or 0, IsControlKeyDown() or 0, IsShiftKeyDown() or 0 |
||
42 | this:SetChecked(nil) |
||
43 | |||
44 | if rank and string.find(rank, "Passive") then |
||
45 | StaticPopup_Show("CLIQUE_PASSIVE_SKILL") |
||
46 | return |
||
47 | end |
||
48 | |||
49 | local modifiers = 0 |
||
50 | modifiers = 0 |
||
51 | modifiers = bit.bor(modifiers, a * 1) |
||
52 | modifiers = bit.bor(modifiers, c * 2) |
||
53 | modifiers = bit.bor(modifiers, s * 4) |
||
54 | |||
55 | local t = {} |
||
56 | t.button = arg1 |
||
57 | t.texture = texture |
||
58 | t.modifiers = modifiers |
||
59 | t.name = name |
||
60 | |||
61 | if self:CheckBinding(arg1, t.modifiers) then |
||
62 | return |
||
63 | end |
||
64 | |||
65 | local _,_,numrank = string.find(rank, L"RANK" .. " (%d+)") |
||
66 | t.rank = numrank |
||
67 | |||
68 | table.insert(editSet, t) |
||
69 | Clique:ListScrollUpdate() |
||
70 | Clique:BuildActionTable() |
||
71 | end |
||
72 | end |
||
73 | |||
74 | StaticPopupDialogs["CLIQUE_AUTO_SELF_CAST"] = { |
||
75 | text = "Clique will not work properly with Blizzard's AutoSelfCast. Please disable it.", |
||
76 | button1 = TEXT(OKAY), |
||
77 | OnAccept = function() |
||
78 | end, |
||
79 | timeout = 0, |
||
80 | hideOnEscape = 1 |
||
81 | } |
||
82 | |||
83 | |||
84 | function Clique:CheckBinding(button, modifiers) |
||
85 | for k,v in ipairs(editSet) do |
||
86 | if modifiers == v.modifiers and button == v.button then |
||
87 | self:Debug("Found an existing instance of %s and %d.", button, modifiers) |
||
88 | StaticPopup_Show("CLIQUE_BINDING_PROBLEM") |
||
89 | -- Stop the binding from happening |
||
90 | return true |
||
91 | end |
||
92 | end |
||
93 | -- Allow the new binding |
||
94 | return nil |
||
95 | end |
||
96 | |||
97 | function Clique.ListScrollUpdate() |
||
98 | local idx,button |
||
99 | local offset = FauxScrollFrame_GetOffset(CliqueListScroll) |
||
100 | local clickCasts = editSet |
||
101 | |||
102 | FauxScrollFrame_Update(CliqueListScroll, table.getn(clickCasts), 6, 48 ) |
||
103 | |||
104 | Clique:SortList() |
||
105 | CliqueListFrame:Show() |
||
106 | |||
107 | for i=1,6 do |
||
108 | idx = offset + i |
||
109 | button = getglobal("CliqueList"..i) |
||
110 | if idx<=table.getn(clickCasts) then |
||
111 | Clique:FillListEntry("CliqueList"..i,idx) |
||
112 | button:Show() |
||
113 | if idx == listSelected then |
||
114 | button.lockedHighlight = 1 |
||
115 | getglobal("CliqueList"..i.."Highlight"):Show() |
||
116 | else |
||
117 | button.lockedHighlight = nil |
||
118 | getglobal("CliqueList"..i.."Highlight"):Hide() |
||
119 | end |
||
120 | else |
||
121 | button:Hide() |
||
122 | end |
||
123 | end |
||
124 | Clique:ValidateButtons() |
||
125 | end |
||
126 | |||
127 | function Clique.SortFunc(a,b) |
||
128 | -- Calculate modifier score |
||
129 | -- The more modifiers you have, the higher your score |
||
130 | |||
131 | if a.name == b.name then |
||
132 | if a.rank and b.rank then |
||
133 | return a.rank < b.rank |
||
134 | elseif a.action and b.action then |
||
135 | return a.action < b.action |
||
136 | else |
||
137 | return a.modifiers < b.modifiers |
||
138 | end |
||
139 | else |
||
140 | return a.name < b.name |
||
141 | end |
||
142 | end |
||
143 | |||
144 | function Clique:SortList() |
||
145 | table.sort(editSet, self.SortFunc) |
||
146 | end |
||
147 | |||
148 | -- fills the members of the ClickListTemplate for button (string frame name) and ClickIdx index to clickCasts |
||
149 | function Clique:FillListEntry(button, clickIdx) |
||
150 | local clickCasts = editSet[clickIdx] |
||
151 | getglobal(button.."Icon"):SetTexture(clickCasts.texture or "Interface\\Icons\\INV_Gizmo_02") |
||
152 | getglobal(button.."Name"):SetText(clickCasts.name or L"CUSTOM_SCRIPT") |
||
153 | getglobal(button.."Rank"):SetText(clickCasts.rank and L"RANK" .. " " .. clickCasts.rank or "") |
||
154 | getglobal(button.."Binding"):SetText(Clique:GetBindingText(clickIdx)) |
||
155 | end |
||
156 | |||
157 | -- the tab attached to the spellbook that toggles the window |
||
158 | function Clique:Toggle() |
||
159 | Clique:EditCancel() |
||
160 | if CliqueFrame:IsVisible() then |
||
161 | CliquePulloutTab:SetChecked(0) |
||
162 | CliqueFrame:Hide() |
||
163 | dewdrop:Close() |
||
164 | else |
||
165 | CliquePulloutTab:SetChecked(1) |
||
166 | CliqueFrame:Show() |
||
167 | self:ValidateButtons() |
||
168 | end |
||
169 | end |
||
170 | |||
171 | -- returns "Modifier+Modifier+Click" string for clickCasts index |
||
172 | function Clique:GetBindingText(clickIdx) |
||
173 | local click = editSet[clickIdx] |
||
174 | local alt = (bit.band(click.modifiers, 1) > 0) and "Alt+" or "" |
||
175 | local control = (bit.band(click.modifiers, 2) > 0) and "Ctrl+" or "" |
||
176 | local shift = (bit.band(click.modifiers, 4) > 0) and "Shift+" or "" |
||
177 | return string.format("%s%s%s%s", alt,control,shift,click.button) |
||
178 | end |
||
179 | |||
180 | --[[ Grey button functions ]] |
||
181 | |||
182 | -- for both CliqueListFrame and CliqueEditFrame, turn buttons on and off |
||
183 | function Clique:ValidateButtons() |
||
184 | if CliqueListFrame:IsVisible() then |
||
185 | if listSelected==0 then |
||
186 | CliqueButtonDelete:Disable() |
||
187 | CliqueButtonEdit:Disable() |
||
188 | CliqueButtonMax:Disable() |
||
189 | Clique:SetTutorial("MAIN") |
||
190 | else |
||
191 | Clique:SetTutorial("SELECTED") |
||
192 | CliqueButtonDelete:Enable() |
||
193 | CliqueButtonEdit:Enable() |
||
194 | if editSet[listSelected].rank then |
||
195 | CliqueButtonMax:Enable() |
||
196 | else |
||
197 | CliqueButtonMax:Disable() |
||
198 | end |
||
199 | end |
||
200 | end |
||
201 | end |
||
202 | |||
203 | -- All the grey button clicks go through here |
||
204 | function Clique:ButtonOnClick(override) |
||
205 | local source = override or this -- other parts of mod can call this, or the button itself did if not override |
||
206 | |||
207 | if source==CliqueButtonOk then -- "Ok" : close list window |
||
208 | CliqueFrame:Hide() |
||
209 | CliquePulloutTab:SetChecked(0) |
||
210 | dewdrop:Close() |
||
211 | elseif source==CliqueButtonEdit then -- "Edit" : edit selected entry |
||
212 | --Clique:FillListEntry("CliqueEditEntry",listSelected) |
||
213 | tempButton = editSet[listSelected].button |
||
214 | tempModifiers = editSet[listSelected].modifiers |
||
215 | tempTexture = editSet[listSelected].texture |
||
216 | |||
217 | CliqueEditBindingName:SetText(Clique:GetBindingText(listSelected)) |
||
218 | CliqueEditIconTexture:SetTexture(editSet[listSelected].texture or "Interface\\Icons\\INV_Gizmo_02") |
||
219 | |||
220 | CliqueEditBox:SetText(editSet[listSelected].action) |
||
221 | CliqueNameEditBox:SetText(editSet[listSelected].name) |
||
222 | Clique:SetTutorial("EDIT") |
||
223 | CliqueListFrame:Hide() |
||
224 | CliqueEditFrame:Show() |
||
225 | if editSet[listSelected].action then |
||
226 | CliqueTextEditBox:Show() |
||
227 | --CliqueNameEditBox:Show() |
||
228 | --CliqueNameEditBox:EnableMouse(true) |
||
229 | --CliqueNameEditBox:EnableKeyboard(true) |
||
230 | CliqueNameEditBox.readOnly = false |
||
231 | CliqueFocusGrabber:Show() |
||
232 | else |
||
233 | CliqueTextEditBox:Hide() |
||
234 | --CliqueNameEditBox:Hide() |
||
235 | --CliqueNameEditBox:EnableMouse(nil) |
||
236 | --CliqueNameEditBox:EnableKeyboard(nil) |
||
237 | CliqueNameEditBox.readOnly = true |
||
238 | CliqueFocusGrabber:Hide() |
||
239 | end |
||
240 | elseif source==CliqueButtonDelete then -- "Delete" : remove entry from Clique.clickCasts |
||
241 | table.remove(editSet,listSelected) |
||
242 | listSelected = math.min(listSelected,table.getn(editSet)) |
||
243 | Clique:ListScrollUpdate() |
||
244 | Clique:BuildActionTable() |
||
245 | elseif source==CliqueButtonNew then -- "New" : add a new entry and go edit it |
||
246 | table.insert(editSet,{name="Custom",button=L"BINDING_NOT_DEFINED",modifiers=0,action="",custom=true}) |
||
247 | listSelected = table.getn(editSet) |
||
248 | Clique:ButtonOnClick(CliqueButtonEdit) |
||
249 | elseif source==CliqueButtonSave then -- "Save" : Save editbox to Clique.clickCasts[x].action and go back to list |
||
250 | if CliqueEditBox:IsVisible() then |
||
251 | editSet[listSelected].action = CliqueEditBox:GetText() |
||
252 | end |
||
253 | editSet[listSelected].name = CliqueNameEditBox:GetText() |
||
254 | -- Close the icon select frame either way |
||
255 | |||
256 | Clique:EditCancel() -- go back to CliqueListFrame |
||
257 | Clique:BuildActionTable() |
||
258 | listSelected = 0 |
||
259 | dewdrop:Close() |
||
260 | Clique:SetTutorial("SELECTED") |
||
261 | elseif source==CliqueButtonCancel then -- "Cancel" : Abort changes and go back to list |
||
262 | if CliqueIconSelectFrame:IsVisible() then |
||
263 | CliqueIconSelectFrame:Hide() |
||
264 | return |
||
265 | end |
||
266 | |||
267 | if CliqueEditFrame:IsVisible() then |
||
268 | local entry = editSet[listSelected] |
||
269 | if entry then |
||
270 | if entry.custom and not entry.texture and entry.name == "Custom" and entry.button == L"BINDING_NOT_DEFINED" and entry.action == "" then |
||
271 | table.remove(editSet, listSelected) |
||
272 | listSelected = 0 |
||
273 | end |
||
274 | if tempButton and entry.button ~= tempButton then |
||
275 | entry.button = tempButton |
||
276 | end |
||
277 | if tempModifiers and entry.modifiers ~= tempModifiers then |
||
278 | entry.modifiers = tempModifiers |
||
279 | end |
||
280 | if tempTexture and entry.texture ~= tempTexture then |
||
281 | entry.texture = tempTexture |
||
282 | end |
||
283 | end |
||
284 | end |
||
285 | |||
286 | Clique:EditCancel() |
||
287 | dewdrop:Close() |
||
288 | Clique:SetTutorial("SELECTED") |
||
289 | elseif source==CliqueButtonMax then -- "Max Rank" : Remove rank value from table |
||
290 | local click = editSet[listSelected] |
||
291 | click.rank = nil |
||
292 | --Clique:FillListEntry("CliqueEditEntry",listSelected) |
||
293 | self:ListScrollUpdate() |
||
294 | Clique:BuildActionTable() |
||
295 | elseif source==CliqueButtonHelp then |
||
296 | if CliqueTutorial:IsVisible() then |
||
297 | CliqueTutorial:Hide() |
||
298 | else |
||
299 | CliqueTutorial:Show() |
||
300 | end |
||
301 | end |
||
302 | Clique:ValidateButtons() |
||
303 | end |
||
304 | |||
305 | --[[ CliqueListFrame functions (note most of work done in Clique.ButtonOnClick) ]] |
||
306 | -- the central list update function: shows help if needed, highlights, validates buttons, etc. Call anytime clickCasts changes |
||
307 | -- when a list entry on ClickListFrame is clicked: select or unselect entry |
||
308 | function Clique:ListOnClick() |
||
309 | local idx = FauxScrollFrame_GetOffset(CliqueListScroll) + this:GetID() |
||
310 | maybeDoubleClick = idx |
||
311 | listSelected = (listSelected==idx) and 0 or idx |
||
312 | Clique:ListScrollUpdate() |
||
313 | end |
||
314 | |||
315 | -- when a list entry on ClickListFrame is double clicked: edit entry irregardless of selection |
||
316 | function Clique:ListOnDoubleClick() |
||
317 | if maybeDoubleClick then |
||
318 | listSelected = maybeDoubleClick |
||
319 | Clique:ButtonOnClick(CliqueButtonEdit) |
||
320 | end |
||
321 | end |
||
322 | |||
323 | --[[ CliqueEditFrame functions (note most of work done in Clique.ButtonOnClick) ]] |
||
324 | -- go from ClickEditFrame to ClickListFrame |
||
325 | function Clique:EditCancel() |
||
326 | CliqueEditFrame:Hide() |
||
327 | CliqueListFrame:Show() |
||
328 | listSelected = 0 |
||
329 | Clique:ListScrollUpdate() |
||
330 | CliqueIconSelectFrame:Hide() |
||
331 | end |
||
332 | |||
333 | -- updates key binding from when the user does a click combo on the entry above the edit box |
||
334 | function Clique:EditSelectedBinding() |
||
335 | local click = editSet[listSelected] |
||
336 | a = IsAltKeyDown() or 0 |
||
337 | s = IsShiftKeyDown() or 0 |
||
338 | c = IsControlKeyDown() or 0 |
||
339 | |||
340 | local modifiers = 0 |
||
341 | modifiers = bit.bor(modifiers, a * 1) |
||
342 | modifiers = bit.bor(modifiers, c * 2) |
||
343 | modifiers = bit.bor(modifiers, s * 4) |
||
344 | |||
345 | if self:CheckBinding(arg1, modifiers) then |
||
346 | return |
||
347 | end |
||
348 | |||
349 | click.button = arg1 |
||
350 | click.modifiers = modifiers |
||
351 | |||
352 | CliqueEditBindingName:SetText(Clique:GetBindingText(listSelected)) |
||
353 | Clique:BuildActionTable() |
||
354 | end |
||
355 | |||
356 | function Clique:DropDown_OnShow() |
||
357 | self.work = self:ClearTable(self.work) |
||
358 | for k,v in pairs(self.db.char) do |
||
359 | table.insert(self.work, k) |
||
360 | end |
||
361 | table.sort(self.work) |
||
362 | |||
363 | UIDropDownMenu_Initialize(this, Clique.DropDown_Initialize); |
||
364 | UIDropDownMenu_SetSelectedValue(CliqueDropDown, editSet) |
||
365 | Clique:ListScrollUpdate() |
||
366 | end |
||
367 | |||
368 | function Clique.DropDown_Initialize() |
||
369 | local info = {} |
||
370 | |||
371 | for k,v in ipairs(Clique.work) do |
||
372 | info = {}; |
||
373 | info.text = v; |
||
374 | info.value = Clique.db.char[v]; |
||
375 | info.func = Clique.DropDown_OnClick; |
||
376 | UIDropDownMenu_AddButton(info); |
||
377 | end |
||
378 | end |
||
379 | |||
380 | function Clique.DropDown_OnClick() |
||
381 | UIDropDownMenu_SetSelectedValue(CliqueDropDown, this.value); |
||
382 | editSet = this.value |
||
383 | listSelected = 0 |
||
384 | Clique:ListScrollUpdate() |
||
385 | end |
||
386 | |||
387 | function Clique:EnableTooltips() |
||
388 | -- Set Dropdown selection |
||
389 | self:SetTooltip(CliqueDropDown, L"TT_DROPDOWN") |
||
390 | --[[ |
||
391 | self:SetTooltip(CliqueList1, L"TT_LIST_ENTRY") |
||
392 | self:SetTooltip(CliqueList2, L"TT_LIST_ENTRY") |
||
393 | self:SetTooltip(CliqueList3, L"TT_LIST_ENTRY") |
||
394 | self:SetTooltip(CliqueList4, L"TT_LIST_ENTRY") |
||
395 | self:SetTooltip(CliqueList5, L"TT_LIST_ENTRY") |
||
396 | self:SetTooltip(CliqueList6, L"TT_LIST_ENTRY") |
||
397 | --]] |
||
398 | self:SetTooltip(CliqueButtonDelete, L"TT_DEL_BUTTON") |
||
399 | self:SetTooltip(CliqueButtonMax, L"TT_MAX_BUTTON") |
||
400 | self:SetTooltip(CliqueButtonNew, L"TT_NEW_BUTTON") |
||
401 | self:SetTooltip(CliqueButtonEdit, L"TT_EDIT_BUTTON") |
||
402 | self:SetTooltip(CliqueButtonOk, L"TT_OK_BUTTON") |
||
403 | --self:SetTooltip(CliqueEditEntry, L"TT_EDIT_BINDING") |
||
404 | |||
405 | --self:SetTooltip(CliqueNameEditBox, L"TT_NAME_EDITBOX") |
||
406 | self:SetTooltip(CliqueButtonSave, L"TT_SAVE_BUTTON") |
||
407 | self:SetTooltip(CliqueButtonCancel, L"TT_CANCEL_BUTTON") |
||
408 | self:SetTooltip(CliqueTextEditBox, L"TT_TEXT_EDITBOX") |
||
409 | self:SetTooltip(CliquePulloutTab, L"TT_PULLOUT_TAB") |
||
410 | end |
||
411 | |||
412 | function Clique:SetTutorial(screen) |
||
413 | local message = "" |
||
414 | |||
415 | if screen == "MAIN" then |
||
416 | message = "Using Clique is very simple. Find a spell in the spellbook to the left, and then click on it. When clicking you can hold any number of modifiers (Alt, Control and Shift) and you can use any button on your mouse (Left, Right, Middle, Button4 and Button5.) This will add a spell to the list above.\n\nYou can also use the \"New\" button to add a custom lua script." |
||
417 | elseif screen == "SELECTED" then |
||
418 | message = "You have selected a spell or custom script. If this is a spell (from the spellbook) and you'd like to always cast the highest rank, click the \"Max\" button.\n\nYou can also use the \"Edit\" button to change the binding of a spell, or the name/lua code of a custom script." |
||
419 | elseif screen == "EDIT" then |
||
420 | message = "You are in the edit screen. You can re-bind this cast by clicking the button above. In custom scripts, you can use Clique.unit to refer to the unit we're clicking on.\n\nYou may also right-click in the edit box to pop up a list of custom functions that are available to you. See the documentation for more details." |
||
421 | end |
||
422 | |||
423 | CliqueTutorialText:SetText(message) |
||
424 | end |
||
425 | |||
426 | function Clique:UpdateIconFrame() |
||
427 | local MAX_MACROS = 18; |
||
428 | local NUM_MACRO_ICONS_SHOWN = 20; |
||
429 | local NUM_ICONS_PER_ROW = 5; |
||
430 | local NUM_ICON_ROWS = 4; |
||
431 | local MACRO_ICON_ROW_HEIGHT = 36; |
||
432 | local macroPopupOffset = FauxScrollFrame_GetOffset(CliqueIconScrollFrame); |
||
433 | local numMacroIcons = GetNumMacroIcons(); |
||
434 | |||
435 | -- Icon list |
||
436 | for i=1, NUM_MACRO_ICONS_SHOWN do |
||
437 | macroPopupIcon = getglobal("CliqueIcon"..i.."Icon"); |
||
438 | macroPopupButton = getglobal("CliqueIcon"..i); |
||
439 | |||
440 | if not macroPopupButton.icon then |
||
441 | macroPopupButton.icon = macroPopupIcon |
||
442 | end |
||
443 | |||
444 | index = (macroPopupOffset * NUM_ICONS_PER_ROW) + i; |
||
445 | if ( index <= numMacroIcons ) then |
||
446 | macroPopupIcon:SetTexture(GetMacroIconInfo(index)); |
||
447 | macroPopupButton:Show(); |
||
448 | else |
||
449 | macroPopupIcon:SetTexture(""); |
||
450 | macroPopupButton:Hide(); |
||
451 | end |
||
452 | macroPopupButton:SetChecked(nil); |
||
453 | end |
||
454 | |||
455 | FauxScrollFrame_Update(CliqueIconScrollFrame, ceil(numMacroIcons / NUM_ICONS_PER_ROW) , NUM_ICON_ROWS, MACRO_ICON_ROW_HEIGHT ); |
||
456 | end |
||
457 | |||
458 | function Clique:SetSpellIcon(texture) |
||
459 | editSet[listSelected].texture = texture |
||
460 | CliqueEditIconTexture:SetTexture(texture) |
||
461 | end |
||
462 | |||
463 | function Clique:ClickSpellIcon() |
||
464 | Clique:SetSpellIcon(this.icon:GetTexture()) |
||
465 | CliqueIconSelectFrame:Hide() |
||
466 | if editSet[listSelected].custom then |
||
467 | CliqueTextEditBox:Show() |
||
468 | end |
||
469 | end |
||
470 | |||
471 | --[[--------------------------------------------------------------------------------- |
||
472 | Handle the function dropdown, with registrations |
||
473 | ----------------------------------------------------------------------------------]] |
||
474 | |||
475 | local function InsertEditBox(text) |
||
476 | CliqueEditBox:Insert(text.."\n") |
||
477 | end |
||
478 | |||
479 | function Clique:RegisterCustomFunction(code, display, tooltip) |
||
480 | if not code or type(code) ~= "string" then |
||
481 | error("Bad argument #1 to 'RegisterCustomFunction', (string expected got " .. type(code) .. ")") |
||
482 | end |
||
483 | if not display or type(display) ~= "string" then |
||
484 | error("Bad argument #2 to 'RegisterCustomFunction', (string expected got " .. type(display) .. ")") |
||
485 | end |
||
486 | if not tooltip or type(tooltip) ~= "string" then |
||
487 | error("Bad argument #3 to 'RegisterCustomFunction', (string expected got " .. type(tooltip) .. ")") |
||
488 | end |
||
489 | |||
490 | -- Create the table if it doesn't exist |
||
491 | if not self.CustomFunctions then self.CustomFunctions = {} end |
||
492 | |||
493 | local t = {["code"] = code, ["display"] = display, ["tooltip"] = tooltip} |
||
494 | table.insert(self.CustomFunctions, t) |
||
495 | end |
||
496 | |||
497 | local function DewDropMenu() |
||
498 | dewdrop:AddLine( |
||
499 | 'text', "Custom Functions", |
||
500 | 'isTitle', true) |
||
501 | |||
502 | for k,v in ipairs(Clique.CustomFunctions) do |
||
503 | Clique:LevelDebug(2, "Adding Custom Function %s", v.display) |
||
504 | dewdrop:AddLine( |
||
505 | 'text', v.display, |
||
506 | 'closeWhenClicked', true, |
||
507 | 'arg1', v.code, |
||
508 | 'func', InsertEditBox, |
||
509 | 'tooltipText', v.tooltip) |
||
510 | end |
||
511 | end |
||
512 | |||
513 | function Clique:DropMenu(frame) |
||
514 | dewdrop:Open(frame, 'children', DewDropMenu, 'cursorX', true, 'cursorY', true) |
||
515 | end |
||
516 | |||
517 | StaticPopupDialogs["CLIQUE_PASSIVE_SKILL"] = { |
||
518 | text = "You can't bind a passive skill.", |
||
519 | button1 = TEXT(OKAY), |
||
520 | OnAccept = function() |
||
521 | end, |
||
522 | timeout = 0, |
||
523 | hideOnEscape = 1 |
||
524 | } |
||
525 | |||
526 | StaticPopupDialogs["CLIQUE_BINDING_PROBLEM"] = { |
||
527 | text = "That combination is already bound. Delete the old one before trying to re-bind.", |
||
528 | button1 = TEXT(OKAY), |
||
529 | OnAccept = function() |
||
530 | end, |
||
531 | timeout = 0, |
||
532 | hideOnEscape = 1 |
||
533 | }; |
||
534 | |||
535 | StaticPopupDialogs["CLIQUE_AUTOSELFCAST"] = { |
||
536 | text = "Clique will not work properly if Blizzard's AutoSelfCast is enabled. Please disable it under the Interface Options.", |
||
537 | button1 = TEXT(OKAY), |
||
538 | OnAccept = function() |
||
539 | end, |
||
540 | timeout = 0, |
||
541 | hideOnEscape = 1 |
||
542 | }; |