-
Notifications
You must be signed in to change notification settings - Fork 18
/
SuperDuperMacro_Frames.lua
774 lines (671 loc) · 27.9 KB
/
SuperDuperMacro_Frames.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
local f, fs, t
-----------------------------------------
--[[ Creation of the main SDM window ]]--
-----------------------------------------
f = CreateFrame("Frame", "sdm_mainFrame", nil, UIParent)
f:Hide()
f:SetMovable(true)
f:SetSize(768,447)
f:ClearAllPoints()
f:SetPoint("TOPLEFT", 0, -104)
sdm_MakeDraggable(f)
f:SetScript("OnShow", function(self)
--PlaySound "igCharacterInfoOpen"
sdm_UpdateList()
end)
f:SetScript("OnHide", function(self)
--PlaySound "igCharacterInfoClose"
sdm_currentlyPlacing=nil
sdm_StopMove()
self:ClearAllPoints()
self:SetPoint("TOPLEFT", 0, -104)
end)
-- The following few lines are a bit weird, but they ensure that:
-- (1) when the user presses escape, the SDM frame will hide,
-- (2) when that happens, SDM will get a chance to show a dialog box, and
-- (3) the game menu doesn't show unless there were no windows open when escape was pressed.
tinsert(UISpecialFrames, "sdm_mainFrame")
hooksecurefunc("CloseSpecialWindows", function()
sdm_mainFrame:Show()
sdm_Quit()
end)
-- Artwork and text:
t = f:CreateTexture("sdm_mainFramePortrait", "BACKGROUND")
t:SetTexture("Interface\\AddOns\\SuperDuperMacro\\SDM-Icon.tga")
t:SetWidth(60)
t:SetHeight(60)
t:SetPoint("TOPLEFT", 7,-6)
t = f:CreateTexture("sdm_mainFrameLeft", "ARTWORK")
t:SetTexture("Interface\\AddOns\\SuperDuperMacro\\SDM-MainFrame-Left.tga")
t:SetWidth(256)
t:SetHeight(512)
t:SetPoint("TOPLEFT")
t = f:CreateTexture("sdm_mainFrameMiddle", "ARTWORK")
t:SetTexture("Interface\\AddOns\\SuperDuperMacro\\SDM-MainFrame-Middle.tga")
t:SetWidth(256) -- The original Auction House frame uses 320 for this value.
t:SetHeight(512)
t:SetPoint("TOPLEFT", sdm_mainFrameLeft, "TOPRIGHT")
t = f:CreateTexture("sdm_mainFrameRight", "ARTWORK")
t:SetTexture("Interface\\AddOns\\SuperDuperMacro\\SDM-MainFrame-Right.tga")
t:SetWidth(256)
t:SetHeight(512)
t:SetPoint("TOPLEFT", sdm_mainFrameMiddle, "TOPRIGHT")
fs = f:CreateFontString("sdm_mainFrameTitle", "OVERLAY", "GameFontNormal")
fs:SetText("Super Duper Macro") -- this text will be reset when the version number is loaded
fs:SetPoint("TOP", 0,-18)
-- Red buttons:
f = CreateFrame("Button", "sdm_quitButton", sdm_mainFrame, "UIPanelCloseButton")
f:SetPoint("TOPRIGHT", 3, -8)
f:SetScript("OnClick", function() sdm_Quit() end)
local linkButtonXOffs = 296
local linkButtonYOffs = -29
local linkButtonSize = 50
f = CreateFrame("Button", "sdm_linkToMacroFrame", sdm_mainFrame, "UIPanelCloseButton")
f:SetWidth(linkButtonSize)
f:SetHeight(linkButtonSize)
f:SetPoint("TOPLEFT", linkButtonXOffs, linkButtonYOffs)
f:SetScript("OnClick", function() sdm_Quit(" ShowMacroFrame()") end)
t = f:CreateTexture()
t:SetDrawLayer("OVERLAY", 7)
t:SetPoint("CENTER", -1,0)
t:SetWidth(20)
t:SetHeight(20)
t:SetTexture("Interface\\MacroFrame\\MacroFrame-Icon")
sdm_SetTooltip(f, "Show the default macro interface")
f = CreateFrame("Button", "sdm_newButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetText("New")
f:SetWidth(50)
f:SetHeight(22)
-- position will be set later
f:SetScript("OnClick", sdm_NewButtonClicked)
sdm_AddToExclusiveGroup(f, "centerwindows", true)
sdm_SetTooltip(f, "Create a new macro, script, or folder")
f = CreateFrame("Button", "sdm_sendReceiveButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetText("Share >>")
f:SetWidth(75)
f:SetHeight(22)
f:SetPoint("BOTTOMRIGHT", -6, 27)
f:SetScript("OnClick", function()
if sdm_sendReceiveFrame:IsShown() then
sdm_sendReceiveFrame:Hide()
else
sdm_sendReceiveFrame:Show()
end
end)
sdm_SetTooltip(f, "Share macros with your friends")
f = CreateFrame("Button", "sdm_saveButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetText("Save")
f:SetWidth(60)
f:SetHeight(22)
f:SetPoint("BOTTOM", 0,38)
f:SetPoint("RIGHT", sdm_sendReceiveButton, "LEFT", -46,0)
f:SetScript("OnClick", function()
sdm_Edit(sdm_macros[sdm_currentEdit], sdm_bodyBox:GetText())
sdm_UpdateList()
end)
f = CreateFrame("Button", "sdm_usageButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetText("Usage...")
f:SetWidth(75)
f:SetHeight(22)
f:SetPoint("RIGHT", sdm_saveButton, "LEFT")
f:SetScript("OnClick", function() sdm_ShowUsage(sdm_macros[sdm_currentEdit]) end)
sdm_SetTooltip(f, "Click for instructions on how to use the selected item.")
f = CreateFrame("Button", "sdm_changeIconButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetText("Change Name/Icon")
f:SetWidth(140)
f:SetHeight(22)
f:SetPoint("RIGHT", sdm_usageButton, "LEFT")
f:SetScript("OnClick", function()
if MacroPopupFrame ~= nil and MacroPopupFrame:IsShown() then
print(sdm_printPrefix.."The change macro name/icon frame is already open.")
else
sdm_changeIconFrame:Show()
end
end)
sdm_AddToExclusiveGroup(f, "centerwindows", true)
f = CreateFrame("Button", "sdm_saveAsButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetSize(80,22)
f:SetPoint("TOP", sdm_saveButton, "BOTTOM")
f:SetPoint("RIGHT", sdm_sendReceiveButton, "LEFT", -30,0)
f:SetText("Save As...")
f:SetScript("OnClick", sdm_SaveAsButtonClicked)
sdm_SetTooltip(f, "Saves a copy of the current item. You may change the type, or make it global or character-specific.")
f = CreateFrame("Button", "sdm_deleteButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetText("Delete")
f:SetWidth(70)
f:SetHeight(22)
f:SetPoint("RIGHT", sdm_saveAsButton, "LEFT")
f:SetScript("OnClick", sdm_DeleteButtonClicked)
f = CreateFrame("Button", "sdm_downgradeButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetPoint("RIGHT", sdm_deleteButton, "LEFT")
f:SetSize(90,22)
f:SetHeight(sdm_deleteButton:GetHeight())
f:SetText("Downgrade")
f:SetScript("OnClick", sdm_DowngradeButtonClicked)
sdm_SetTooltip(f, "Turns this macro into a default macro. Anything over 255 characters will be lost.")
f = CreateFrame("Button", "sdm_claimButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetPoint("RIGHT", sdm_downgradeButton, "LEFT")
f:SetSize(65,22)
f:SetHeight(sdm_usageButton:GetHeight())
f:SetText("Claim")
f:SetScript("OnClick", sdm_ClaimButtonClicked)
sdm_SetTooltip(f, "Did you know that character-specific items can belong to multiple characters? Click this button to claim this item for your current character.")
f = CreateFrame("Button", "sdm_disownButton", sdm_mainFrame, "UIPanelButtonTemplate")
f:SetAllPoints(sdm_claimButton)
f:SetText("Disown")
f:SetScript("OnClick", sdm_DisownButtonClicked)
sdm_SetTooltip(f, "Removes this item from your current character's list. Other characters will still be able to use it.")
-- Edit box for macro body:
f = CreateFrame("ScrollFrame", "sdm_bodyScroller", sdm_mainFrame, "UIPanelScrollFrameTemplate")
f:SetSize(417,304)
f:SetPoint("BOTTOMRIGHT", -32,64)
f = CreateFrame("EditBox", "sdm_bodyBox")
f:SetMultiLine(true)
f:SetAutoFocus(false)
f:SetWidth(sdm_bodyScroller:GetWidth())
f:SetHeight(20) -- automatically resizes if there based on the amount of text
f:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
f:SetScript("OnTabPressed", function(self) self:Insert(" ") end)
f:SetScript("OnTextSet", function()
sdm_saveButton:Disable()
sdm_textChanged=-2
end)
f:SetScript("OnTextChanged", function()
if sdm_textChanged then
sdm_textChanged=sdm_textChanged+1
if sdm_textChanged>0 then
sdm_saveButton:Enable()
end
end
end)
f:SetFontObject("GameFontHighlightSmall")
sdm_bodyScroller:SetScrollChild(f)
f = CreateFrame("Button", "sdm_bodyBackground", sdm_mainFrame)
f:SetPoint("BOTTOMLEFT", sdm_bodyScroller, -5,-5)
f:SetPoint("TOPRIGHT", sdm_bodyScroller, 27,5)
f:SetBackdrop({
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 16,
edgeSize = 16
})
f:SetScript("OnClick", function()
local e = sdm_bodyBox
local l = e:GetNumLetters()
e:SetCursorPosition(l)
e:SetFocus()
end)
fs = f:CreateFontString("sdm_currentTitle", "OVERLAY", "SystemFont_Huge1") -- make this a layer of sdm_bodyBackground so that they show and hide together
fs:SetText("")
fs:SetWordWrap(true)
fs:SetPoint("BOTTOM", sdm_bodyBackground, "TOP")
fs:SetSize(403,40)
fs:SetJustifyH("CENTER")
fs:SetJustifyV("CENTER")
fs = f:CreateFontString("sdm_containerInstructions", "OVERLAY", "GameFontNormal")
fs:SetText(sdm_containerInstructionsString)
fs:SetPoint("BOTTOMLEFT", 10,10)
fs:SetPoint("TOPRIGHT", -10,-10)
-- Macro list:
f = CreateFrame("ScrollFrame", "sdm_listScroller", sdm_mainFrame, "UIPanelScrollFrameTemplate")
f:SetWidth(268)
f:SetPoint("TOP", sdm_newButton, "BOTTOM", 0, -5)
f:SetPoint("BOTTOMLEFT", 20,50)
f = CreateFrame("Frame", "sdm_macroList")
f:SetWidth(sdm_listScroller:GetWidth())
f:SetHeight(50) -- automatically resizes based on the number of items in the list
sdm_listScroller:SetScrollChild(f)
f = CreateFrame("Frame", "sdm_listBackground", sdm_mainFrame)
f:SetPoint("BOTTOMLEFT", sdm_listScroller, -5,-5)
f:SetPoint("TOPRIGHT", sdm_listScroller, 27,5)
f:SetBackdrop({
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 16,
edgeSize = 16
})
fs = f:CreateFontString("sdm_macroLimitText", "OVERLAY", "GameFontNormal")
fs:SetPoint("TOP", f, "BOTTOM")
fs:SetHeight(30)
fs:SetText("")
f = CreateFrame("Frame", "sdm_macroLimitFrame", sdm_mainFrame)
f:SetAllPoints(sdm_macroLimitText)
sdm_SetTooltip(f, "This limit only applies to standard macros and Super Duper button macros. If you're running out of room, try storing some infrequently used Button Macros as Floating Macros using the 'Save As...' button. To do this with standard macros, you will have to upgrade them first.")
-- List filters:
fs = sdm_mainFrame:CreateFontString("sdm_filterText", "ARTWORK", "GameFontNormal")
fs:SetText("Filters:")
fs:SetPoint("TOPLEFT", 75, -44)
f = CreateFrame("Frame", "sdm_typeFilterDropdown", sdm_mainFrame, "UIDropDownMenuTemplate")
f:EnableMouse(true)
f:SetPoint("LEFT", sdm_filterText, "RIGHT", -15,-3)
f:SetScript("OnShow", sdm_TypeDropdownLoaded)
sdm_SetTooltip(f, "Filter the list below")
f = CreateFrame("Frame", "sdm_charFilterDropdown", sdm_mainFrame, "UIDropDownMenuTemplate")
f:EnableMouse(true)
f:SetPoint("LEFT", sdm_typeFilterDropdown, "RIGHT", -28,0)
f:SetScript("OnShow", sdm_CharDropdownLoaded)
sdm_SetTooltip(f, "Filter the list below")
-- Button to expand/collapse all folders:
f = CreateFrame("CheckButton", "sdm_collapseAllButton", sdm_mainFrame)
f:SetWidth(16)
f:SetHeight(16)
f:SetPoint("TOPLEFT", 23,-70)
f:SetPoint("TOP", sdm_typeFilterDropdown, "BOTTOM", 0,3)
f:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-UP")
f:SetCheckedTexture("Interface\\Buttons\\UI-PlusButton-UP")
f:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight", "ADD")
f:SetNormalFontObject("GameFontNormal")
f:SetHighlightFontObject("GameFontHighlight")
f:SetText("All")
f:SetHitRectInsets(0, -20, 0, 0) -- this line extends the clickable area so that it covers the "All" text
f:SetScript("OnClick", sdm_CollapseAllButtonClicked)
sdm_SetTooltip(f, "Expand/collapse all folders")
fs = select(4, f:GetRegions())
fs:SetPoint("LEFT", f, "RIGHT")
-- List size slider:
f = CreateFrame("Slider", "sdm_iconSizeSlider", sdm_mainFrame)
f:SetOrientation("HORIZONTAL")
f:EnableMouse(true)
f:SetMinMaxValues(11,64)
f:SetHeight(17)
f:SetWidth(141)
f:SetPoint("LEFT", sdm_collapseAllButton, "RIGHT", 35,0)
f:SetHitRectInsets(0,0,-10,-10)
f:SetBackdrop({
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
tile = true,
tileSize = 8,
edgeSize = 8,
insets = {
left = 3,
right = 3,
top = 6,
bottom = 6
}
})
f:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal")
sdm_SetTooltip(f, "Change the display size of the macros in the list above.")
sdm_newButton:SetPoint("LEFT", sdm_iconSizeSlider, "RIGHT", 20,0)
--------------------------------------------------
--[[ Creation of the Change Name/Icon" window ]]--
--------------------------------------------------
f = CreateFrame("Frame", "sdm_changeIconFrame", sdm_mainFrame, UIParent)
f:Hide()
f:SetToplevel(true)
f:SetSize(293,60)
f:SetPoint("TOP", 70,-100)
f:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileSize = 32,
edgeSize = 32,
insets = {
left = 11,
right = 12,
top = 12,
bottom = 11
}
})
f:SetScript("OnShow", function(self)
sdm_OnShow_changeIconFrame(self)
end)
f:SetScript("OnHide", function(self)
sdm_OnHide_changeIconFrame(self)
end)
sdm_AddToExclusiveGroup(f, "centerwindows")
sdm_MakeDraggable(f)
f = CreateFrame("EditBox", "sdm_changeNameInput", sdm_changeIconFrame, "InputBoxTemplate")
f:SetAutoFocus(false)
f:SetSize(200,26)
f:SetPoint("TOPLEFT", 70,-21)
f:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
f:SetScript("OnEnterPressed", sdm_ChangeIconOkayed)
fs = f:CreateFontString("sdm_changeNameInput_Text", "ARTWORK", "GameFontNormal")
fs:SetText("Name: ")
fs:SetPoint("RIGHT", f, "LEFT", -5,0)
--------------------------------------------
--[[ Creation of the "New Macro" window ]]--
--------------------------------------------
f = CreateFrame("Frame", "sdm_newFrame", sdm_mainFrame, UIParent)
f:SetFrameStrata("HIGH")
f:Hide()
f:SetWidth(280)
f:SetHeight(145)
f:SetPoint("CENTER", 70,0)
f:SetBackdrop({
-- path to the background texture
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
-- path to the border texture
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
-- true to repeat the background texture to fill the frame, false to scale it
tile = true,
-- size (width or height) of the square repeating background tiles (in pixels)
tileSize = 32,
-- thickness of edge segments and square size of edge corners (in pixels)
edgeSize = 32,
-- distance from the edges of the frame to those of the background texture (in pixels)
insets = {
left = 11,
right = 12,
top = 12,
bottom = 11
}
})
sdm_MakeDraggable(f)
f:SetScript("OnHide", function() UIFrameFlashStop(sdm_createMacroButton_flash) end)
sdm_AddToExclusiveGroup(f, "centerwindows")
-- Radio buttons:
function sdm_FancifyNewRadioButton(button, text, colorCode)
fs = button:CreateFontString(button:GetName().."Text", "ARTWORK", "GameFontNormal")
fs:SetPoint("LEFT", button, "RIGHT")
fs:SetText(text)
if colorCode then
local _,outline,_,fill,text = button:GetRegions()
local r,g,b = sdm_GetColor(colorCode)
outline:SetVertexColor(r,g,b)
fill:SetVertexColor(r,g,b)
text:SetTextColor(r,g,b)
end
end
function sdm_CreateRadioButton(name, groupName, parent, below, text, colorCode)
local button = CreateFrame("CheckButton", name, parent, "SendMailRadioButtonTemplate")
sdm_AddToRadioGroup(button, groupName)
sdm_FancifyNewRadioButton(button, text, colorCode)
if below then
button:SetPoint("TOPLEFT", below, "BOTTOMLEFT")
end
return button
end
f = sdm_CreateRadioButton("sdm_buttonRadio", "NewType", sdm_newFrame, nil, "Button Macro", "b")
f:SetPoint("TOPLEFT", 15,-15)
f:SetChecked(1)
sdm_SetTooltip(f, "Button macros can be placed on your action bars. However, you can only have a limited number of these. They can also be called with a slash command.")
f = sdm_CreateRadioButton("sdm_floatingRadio", "NewType", sdm_newFrame, sdm_buttonRadio, "Floating Macro", "f")
sdm_SetTooltip(f, "You can make as many floating macros as you like, but they cannot be placed on your action bars. They can called in other macros via a slash command.")
f = sdm_CreateRadioButton("sdm_scriptRadio", "NewType", sdm_newFrame, sdm_floatingRadio, "Script", "s")
sdm_SetTooltip(f, "Scripts are blocks of lua code. You can call these with a slash command or a function call.")
f = sdm_CreateRadioButton("sdm_folderRadio", "NewType", sdm_newFrame, sdm_scriptRadio, "Folder")
sdm_SetTooltip(f, "Folders can contain macros, scripts, or other folders. Alt-click on a folder for options and instructions.")
f = sdm_CreateRadioButton("sdm_globalRadio", "NewChar", sdm_newFrame, nil, "Global")
f:SetPoint("LEFT", sdm_buttonRadio, "RIGHT", 103,0)
f:SetChecked(1)
sdm_SetTooltip(f, "Selecting 'Global' will make this available to all characters.")
f = sdm_CreateRadioButton("sdm_charspecRadio", "NewChar", sdm_newFrame, sdm_globalRadio, "Character-specific")
sdm_SetTooltip(f, "Selecting 'Character-specific' will make this available only to select characters. Use the 'Claim' and 'Disown' buttons to enable or disable it for individual characters.")
-- Text input box:
f = CreateFrame("EditBox", "sdm_newMacroNameInput", sdm_newFrame, "InputBoxTemplate")
f:SetAutoFocus(false)
f:SetWidth(200)
f:SetHeight(26)
f:SetPoint("TOPLEFT", sdm_folderRadio, "BOTTOMLEFT", 50,0)
f:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
f:SetScript("OnEnterPressed", function() sdm_createMacroButton:Click() end)
fs = f:CreateFontString(sdm_newMacroNameText, "ARTWORK", "GameFontNormal")
fs:SetPoint("RIGHT", f, "LEFT", -5,0)
fs:SetText("Name: ")
sdm_SetTooltip(f, "Some characters (such as spaces) are not allowed in Super Duper macro names. If you would like spaces (or nothing) to show on the button text, use the 'Change Name/Icon' button after you have created the macro and select the 'Different name on button' option.")
-- Red buttons:
f = CreateFrame("Button", "sdm_createMacroButton", sdm_newFrame, "UIPanelButtonTemplate")
f:SetText("Create")
f:SetWidth(80)
f:SetHeight(22)
f:SetPoint("TOPLEFT", sdm_newMacroNameInput, "BOTTOMLEFT")
f:SetScript("OnClick", sdm_CreateMacroButtonClicked)
local flash = f:CreateTexture("sdm_createMacroButton_flash", "OVERLAY")
flash:SetTexture("Interface\\Buttons\\UI-Panel-Button-Glow")
flash:SetBlendMode("ADD")
flash:SetTexCoord(0, .75, 0, .609375)
flash:SetPoint("BOTTOMLEFT", -7,-7)
flash:SetPoint("TOPRIGHT", 7,7)
flash:Hide()
f = CreateFrame("Button", "sdm_cancelNewMacroButton", sdm_newFrame, "UIPanelButtonTemplate")
f:SetText("Cancel")
f:SetWidth(80)
f:SetHeight(22)
f:SetPoint("LEFT", sdm_createMacroButton, "RIGHT")
f:SetScript("OnClick", sdm_CancelNewMacroButtonPressed)
-----------------------------------------------
--[[ Creation of the "Send/Receive" window ]]--
-----------------------------------------------
f = CreateFrame("Frame", "sdm_sendReceiveFrame", sdm_mainFrame)
f:Hide()
f:SetWidth(256)
f:SetHeight(394)
f:SetPoint("LEFT", sdm_mainFrame, "RIGHT", -10,0)
f:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileSize = 32,
edgeSize = 32,
insets = {
left = 11,
right = 12,
top = 12,
bottom = 11
}
})
f:SetScript("OnShow", function()
sdm_sendReceiveButton:SetText("Share <<")
end)
f:SetScript("OnHide", function()
sdm_sendReceiveButton:SetText("Share >>")
if (not sdm_sending) then
sdm_sendStatusBar:SetValue(0)
sdm_sendStatusBar_text:SetText("")
end
if (not sdm_receiving) then
sdm_receiveStatusBar:SetValue(0)
sdm_receiveStatusBar_text:SetText("")
end
end)
sdm_MakeDraggable(f)
-- Frame text:
fs = f:CreateFontString("sdm_sendInstructionText", "ARTWORK", "GameFontNormal")
fs:SetText("Send currently selected macro to:")
fs:SetPoint("LEFT", f, "TOPLEFT", 15,-20)
fs = f:CreateFontString("sdm_receiveInstructionText", "ARTWORK", "GameFontNormal")
fs:SetText("Await a macro from:")
fs:SetPoint("TOPLEFT", sdm_sendInstructionText, "BOTTOMLEFT", 0,-206)
-- Status bars:
f = CreateFrame("Frame", "sdm_sendBarParent", sdm_sendReceiveFrame)
f:SetWidth(200)
f:SetHeight(30)
f:SetPoint("TOP", 0,-181)
f:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 32,
edgeSize = 8,
insets = {
left = 2,
right = 2,
top = 2,
bottom = 2
}
})
f:SetBackdropColor(0, 0, 0, 0.7)
f = CreateFrame("StatusBar", "sdm_sendStatusBar", sdm_sendBarParent)
f:SetMinMaxValues(0,100)
f:SetValue(0)
f:SetPoint("BOTTOMLEFT", 5,5)
f:SetPoint("TOPRIGHT", -5,-5)
f:SetStatusBarTexture("Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar", "BACKGROUND")
f:SetStatusBarColor(0, 0.5, 1)
fs = f:CreateFontString("sdm_sendStatusBar_text", "ARTWORK", "GameFontNormal")
fs:SetText("")
fs:SetTextColor(1, 0.5, 0)
fs:SetPoint("CENTER")
f = CreateFrame("Frame", "sdm_receiveBarParent", sdm_sendReceiveFrame)
f:SetWidth(200)
f:SetHeight(30)
f:SetPoint("TOP", 0,-351)
f:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 32,
edgeSize = 8,
insets = {
left = 2,
right = 2,
top = 2,
bottom = 2
}
})
f:SetBackdropColor(0, 0, 0, 0.7)
f = CreateFrame("StatusBar", "sdm_receiveStatusBar", sdm_receiveBarParent)
f:SetMinMaxValues(0,100)
f:SetValue(0)
f:SetPoint("BOTTOMLEFT", 5,5)
f:SetPoint("TOPRIGHT", -5,-5)
f:SetStatusBarTexture("Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar", "BACKGROUND")
f:SetStatusBarColor(0, 0.5, 1)
fs = f:CreateFontString("sdm_receiveStatusBar_text", "ARTWORK", "GameFontNormal")
fs:SetText("")
fs:SetTextColor(1, 0.5, 0)
fs:SetPoint("CENTER")
-- Radio buttons:
f = sdm_CreateRadioButton("sdm_sendPartyRadio", "SendTo", sdm_sendReceiveFrame, nil, "Party")
f:SetPoint("TOPLEFT", sdm_sendInstructionText, "BOTTOMLEFT", 0,-4)
f:SetChecked(1)
f = sdm_CreateRadioButton("sdm_sendRaidRadio", "SendTo", sdm_sendReceiveFrame, sdm_sendPartyRadio, "Raid")
f = sdm_CreateRadioButton("sdm_sendBattlegroundRadio", "SendTo", sdm_sendReceiveFrame, sdm_sendRaidRadio, "Battleground")
f = sdm_CreateRadioButton("sdm_sendGuildRadio", "SendTo", sdm_sendReceiveFrame, sdm_sendBattlegroundRadio, "Guild")
f = sdm_CreateRadioButton("sdm_sendArbitraryRadio", "SendTo", sdm_sendReceiveFrame, sdm_sendGuildRadio, "A specific character:")
f = sdm_CreateRadioButton("sdm_sendTargetRadio", "SendTo", sdm_sendReceiveFrame, nil, "Your current target")
f:SetPoint("TOPLEFT", sdm_sendArbitraryRadio, "BOTTOMLEFT", 0,-25)
f = sdm_CreateRadioButton("sdm_receiveArbitraryRadio", "ReceiveFrom", sdm_sendReceiveFrame, nil, "A specific character:")
f:SetPoint("TOPLEFT", sdm_receiveInstructionText, "BOTTOMLEFT", 0,-4)
f:SetChecked(1)
f = sdm_CreateRadioButton("sdm_receiveTargetRadio", "ReceiveFrom", sdm_sendReceiveFrame, nil, "Your current target")
f:SetPoint("TOPLEFT", sdm_receiveArbitraryRadio, "BOTTOMLEFT", 0,-25)
f = sdm_CreateRadioButton("sdm_receiveAnyoneRadio", "ReceiveFrom", sdm_sendReceiveFrame, sdm_receiveTargetRadio, "Anyone")
-- Input boxes:
local boxWidth = 180
local boxHeight = 26
local boxOffset = 32
f = CreateFrame("EditBox", "sdm_sendInput", sdm_sendReceiveFrame, "InputBoxTemplate")
f:SetAutoFocus(false)
f:SetWidth(boxWidth)
f:SetHeight(boxHeight)
f:SetPoint("TOPLEFT", sdm_sendArbitraryRadio, "BOTTOMLEFT", boxOffset,0)
f:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
f:SetScript("OnEnterPressed", function() sdm_sendButton:Click() end)
f:SetScript("OnEditFocusGained", function()
if not sdm_sendArbitraryRadio:GetChecked() then
sdm_sendArbitraryRadio:Click()
end
end)
f = CreateFrame("EditBox", "sdm_receiveInput", sdm_sendReceiveFrame, "InputBoxTemplate")
f:SetAutoFocus(false)
f:SetWidth(boxWidth)
f:SetHeight(boxHeight)
f:SetPoint("TOPLEFT", sdm_receiveArbitraryRadio, "BOTTOMLEFT", boxOffset,0)
f:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
f:SetScript("OnEnterPressed", function() sdm_sendButton:Click() end)
f:SetScript("OnEditFocusGained", function()
if not sdm_receiveArbitraryRadio:GetChecked() then
sdm_receiveArbitraryRadio:Click()
end
end)
-- Red buttons:
f = CreateFrame("Button", "sdm_quitSendReceiveButton", sdm_sendReceiveFrame, "UIPanelCloseButton")
f:SetPoint("TOPRIGHT", -3,-3)
f:SetScript("OnClick", function() sdm_sendReceiveFrame:Hide() end)
local buttonOver = 38
local buttonUp = 30
local buttonWidth = 60
local buttonHeight = 24
f = CreateFrame("Button", "sdm_sendButton", sdm_sendReceiveFrame, "UIPanelButtonTemplate")
f:SetText("Send")
f:SetWidth(buttonWidth)
f:SetHeight(buttonHeight)
f:SetPoint("CENTER", sdm_sendBarParent, "CENTER", -buttonOver, buttonUp)
f:SetScript("OnClick", sdm_SendButtonClicked)
sdm_SetTooltip(f, "Make sure that your recipient clicks 'Receive' before you click 'Send'.")
f = CreateFrame("Button", "sdm_cancelSendButton", sdm_sendReceiveFrame, "UIPanelButtonTemplate")
f:SetText("Cancel")
f:SetWidth(buttonWidth)
f:SetHeight(buttonHeight)
f:SetPoint("CENTER", sdm_sendBarParent, "CENTER", buttonOver, buttonUp)
f:SetScript("OnClick", sdm_CancelSend)
f:Disable()
f = CreateFrame("Button", "sdm_receiveButton", sdm_sendReceiveFrame, "UIPanelButtonTemplate")
f:SetText("Receive")
f:SetWidth(buttonWidth)
f:SetHeight(buttonHeight)
f:SetPoint("CENTER", sdm_receiveBarParent, "CENTER", -buttonOver, buttonUp)
f:SetScript("OnClick", sdm_ReceiveButtonClicked)
sdm_SetTooltip(f, "Once you have received the macro, click the glowing 'Create' button to save it.")
sdm_AddToExclusiveGroup(f, "centerwindows", true)
f = CreateFrame("Button", "sdm_cancelReceiveButton", sdm_sendReceiveFrame, "UIPanelButtonTemplate")
f:SetText("Cancel")
f:SetWidth(buttonWidth)
f:SetHeight(buttonHeight)
f:SetPoint("CENTER", sdm_receiveBarParent, "CENTER", buttonOver, buttonUp)
f:SetScript("OnClick", sdm_CancelReceive)
f:Disable()
---------------------------------------------------------
--[[ Buttons that we add to the default macro window ]]--
---------------------------------------------------------
function sdm_CreateDefaultMacroFrameButtons()
--Create the button that links from the default macro frame to the SDM frame
f = CreateFrame("Button", "$parent_linkToSDM", MacroFrame, "UIPanelCloseButton")
f:SetWidth(linkButtonSize)
f:SetHeight(linkButtonSize) f:SetPoint("TOPLEFT", linkButtonXOffs, linkButtonYOffs)
f:SetScript("OnClick", function()
HideUIPanel(MacroFrame)
sdm_mainFrame:Show()
end)
t = f:CreateTexture()
t:SetDrawLayer("OVERLAY", 7)
t:SetPoint("CENTER", -1,0)
t:SetWidth(20)
t:SetHeight(20)
t:SetTexture("Interface\\AddOns\\SuperDuperMacro\\SDM-Icon.tga")
sdm_SetTooltip(f, "Open Super Duper Macro, an advanced macro interface that lets you create longer macros")
--Create the button that turns a regular macro into a Super Duper macro
f = CreateFrame("Button", "$parent_convertToSuper", MacroFrame, "UIPanelButtonTemplate")
f:SetPoint("TOPLEFT", MacroDeleteButton, "TOPRIGHT")
f:SetPoint("BOTTOMRIGHT", MacroNewButton, "BOTTOMLEFT")
f:SetText("Upgrade! ")
t = f:CreateTexture()
t:SetDrawLayer("OVERLAY", 7)
margin = 0.25 * f:GetHeight()
t:SetPoint("TOPRIGHT", f, "TOPRIGHT", -margin, -margin)
t:SetPoint("BOTTOM", f, "BOTTOM", 0, margin)
t:SetWidth(t:GetHeight())
t:SetTexture("Interface\\AddOns\\SuperDuperMacro\\SDM-Icon.tga")
f:SetScript("OnClick", sdm_UpgradeButtonClicked)
sdm_SetTooltip(f, "Turn the selected macro into a Super Duper Macro, allowing you to make it longer")
-- The following three frames are only showed when SDM's "Change Name/Icon" button is clicked. Clicking this button hijacks the default MacroPopupFrame and modifies it to our needs.
-- Create the "Different name on button" checkbox
f = CreateFrame("CheckButton", "$parent_buttonTextCheckBox", MacroPopupFrame, "UICheckButtonTemplate")
f:SetWidth(20)
f:SetHeight(20)
f:SetPoint("TOPLEFT", 25, -18)
f:SetScript("OnClick", function()
sdm_buttonTextCheckBoxClicked(MacroPopupFrame_buttonTextCheckBox:GetChecked())
end)
f:Hide()
-- Create the "Cancel" button
f = CreateFrame("Button", "$parent_sdmCancelButton", MacroPopupFrame, "UIPanelButtonTemplate")
f:SetWidth(78)
f:SetHeight(22)
f:SetPoint("BOTTOMRIGHT", -11, 13)
f:SetText(CANCEL)
f:SetScript("OnClick", function()
sdm_changeIconFrame:Hide()
end)
-- Create the "Okay" button
f = CreateFrame("Button", "$parent_sdmOkayButton", MacroPopupFrame, "UIPanelButtonTemplate")
f:SetWidth(78)
f:SetHeight(22)
f:SetPoint("RIGHT", MacroPopupCancelButton, "LEFT", -2, 0)
f:SetText(OKAY)
f:SetScript("OnClick", sdm_ChangeIconOkayed)
end