Repository navigation
Expand file tree
/
Copy pathOptions.lua
More file actions
1898 lines (1782 loc) · 86.9 KB
/
Copy pathOptions.lua
File metadata and controls
1898 lines (1782 loc) · 86.9 KB
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
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- Copyright (c) 2026 AqueGen. All rights reserved. See LICENSE.
CastAheadOptions = {}
CastAheadOptions.TABS = { "General", "Sounds", "Features", "Development", "Report" }
local panels = {}
local T = CastAheadWindow.THEME
local UI = CastAheadWindow.UI
local COL_W, COL_GAP, COL_X = 250, 8, 8
local SLIDER_W = COL_W - 40
local ZONE_MIN, ZONE_MAX, BOX_PAD = 260, 380, 10
local function Layout(panel)
local contentW = panel:GetWidth() - 2 * COL_X
local layout = UI.PreviewLayout(contentW, COL_W, ZONE_MIN, ZONE_MAX)
layout.split = panel.pictures and layout.mode == "side" or false
if not layout.split then layout.columnW = contentW end
return layout
end
local function ColumnW(panel) return panel.columnW or COL_W end
local function Column(panel, fn)
panel.columnFns = panel.columnFns or {}
table.insert(panel.columnFns, fn)
fn(ColumnW(panel))
end
local function PlaceGroup(panel, g, y, layout)
g:ClearAllPoints()
g:SetPoint("TOPLEFT", panel, "TOPLEFT", COL_X, -y)
if layout.split then g:SetWidth(layout.columnW) else g:SetPoint("TOPRIGHT", panel, "TOPRIGHT", -COL_X, -y) end
if g.preview then
g.preview:SetShown(layout.split)
if layout.split then g.preview:SetWidth(layout.zoneW) end
end
end
-- Shown groups stack in one column; a hidden one leaves no gap.
function CastAheadOptions.RelayoutGroups(panel)
local top = panel.flowTop or 6
if type(top) == "function" then top = top() end
local y, layout = 0, Layout(panel)
for _, g in ipairs(panel.groups) do
if g:IsShown() then
local pad = g.flowPad or 0
PlaceGroup(panel, g, top + y + pad, layout)
y = y + pad + g:GetHeight() + COL_GAP
end
end
local total = math.max(y - COL_GAP, 0)
panel:SetHeight(top + total + (panel.flowBottom and panel.flowBottom(top + total) or 0) + 12)
end
-- Forward declarations: Build calls these, and Lua resolves a local by
-- what it holds at call time, so they must exist as upvalues before it runs.
local BuildGeneral, BuildSounds, BuildFeatures, BuildDevelopment, BuildReport
-- Widgets are painted once, when a panel is first built, but storage can
-- change behind their back: the /ca anchor|grow|offset|center slash commands
-- and the setup mode all write it. Every widget that displays stored state
-- registers a closure here that re-reads it; showing a panel runs the lot.
local refreshers = {}
-- Every stored number is edited the same way - a caption that reads back the
-- value, a slider under it, and a refresher so a slash command changing the
-- same setting is reflected here. `spec` carries min/max/step, the caption
-- text and what to do after a change.
local function BuildSlider(panel, spec)
local label = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
label:SetPoint(unpack(spec.point))
local slider = UI.Slider(panel, spec.width or SLIDER_W)
slider:SetPoint("TOPLEFT", label, "BOTTOMLEFT", 6, -8)
for point, text in pairs({ LEFT = spec.low or tostring(spec.min), RIGHT = spec.high or tostring(spec.max) }) do
local edge = slider:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
edge:SetPoint("TOP", slider.track, "BOTTOM" .. point, 0, -6)
edge:SetTextColor(unpack(T.muted))
edge:SetText(text)
end
local function read()
return spec.read and spec.read()
or CastAheadConfig.Number(spec.key, spec.default, spec.min, spec.max)
end
local function paint(value)
label:SetText(spec.caption(value))
end
local function show(value)
slider:SetValue(value, true)
paint(slider:GetValue())
end
slider:Setup(spec.min, spec.max, spec.step or 1)
show(read())
slider.onChange = function(value)
if spec.write then spec.write(value) else CastAheadConfig.Set(spec.key, value) end
paint(value)
if spec.after then spec.after(value) end
end
table.insert(refreshers, function() show(read()) end)
slider.Repaint = function() show(read()) end
return slider, label
end
CastAheadOptions.BuildSlider = BuildSlider
local function Refresh()
for _, refresh in ipairs(refreshers) do refresh() end
end
CastAheadOptions.Refresh = Refresh
local function Redraw()
if CastAheadCore and CastAheadCore.Reapply then CastAheadCore.Reapply() end
end
local function OutputChanged()
Redraw()
if CastAheadSetup and CastAheadSetup.OutputsChanged then CastAheadSetup.OutputsChanged() end
end
local function SaveRefresh()
if CastAheadSaves then CastAheadSaves.Refresh() end
end
local function RedrawAndSaves()
Redraw()
SaveRefresh()
end
function CastAheadOptions.SavesSwitchChanged()
if CastAheadCore and CastAheadCore.ForgetSamples then CastAheadCore.ForgetSamples() end
SaveRefresh()
CastAheadOptions.RefreshDefensives()
if CastAheadUI and CastAheadUI.RefreshTabs then CastAheadUI.RefreshTabs() end
if CastAheadUI and CastAheadUI.RefreshSaves then CastAheadUI.RefreshSaves() end
Refresh()
end
function CastAheadOptions.RaidSavesChanged()
CastAheadOptions.SavesSwitchChanged()
local inRaid = GetInstanceInfo and select(2, GetInstanceInfo()) == "raid"
if not CastAheadConfig.RaidSaves() and inRaid and CastAheadSaves then
CastAheadSaves.CancelPrefix("dbm:")
CastAheadSaves.CancelPrefix("bw:")
end
Redraw()
end
-- Every switch the General page offers, with the group it belongs to. The
-- page used to be one flat column of checkboxes plus a pile of sliders on the
-- right, and nothing said which slider went with which switch - the centre
-- call's size sat next to the nameplate anchor.
--
-- `defaultOff` marks the ones that are off until asked for; everything else
-- follows the storage convention, where nil means on.
local SWITCHES = {
importantOnly = { label = "Important casts only",
tip = "Show, speak and time only the casts marked Important on the Casts page - the hand-picked set that needs a reaction." },
roleFilter = { label = "My role only",
tip = "Hide calls this character cannot act on: dispels you do not have, tank busters for tanks and healers." },
nameplates = { label = "Show icons on nameplates",
tip = "Countdown icons next to enemy nameplates." },
centerText = { label = "Show the centre call",
tip = "The response in words, big, near the middle of the screen while an important cast goes out." },
timeline = { label = "Feed the Blizzard timeline",
tip = "Feed confident predictions to the game's own encounter timeline." },
bigwigsBars = { label = "Show in BigWigs bars",
tip = "When BigWigs hides the game's timeline, show the predictions as BigWigs bars. A BigWigs update may break this." },
sound = { label = "Sound",
tip = "Master switch for everything the addon plays." },
voice = { label = "Voice",
tip = "Speak the response out loud: \"tank buster\", \"dodge\", \"kick\"." },
kickFocusOnly = { label = "Kick calls only for my focus", defaultOff = true },
fixedSpacing = { label = "Fixed spacing", defaultOff = true,
tip = "Space icons evenly, whatever the word length. Two long words side by side may overlap." },
fullLabels = { label = "Full labels", defaultOff = true,
tip = "Write long calls in full under the icon: TANKBUSTER, not BUSTER." },
auraClearance = { label = "Make room for nameplate auras",
tip = "Move the icons out by one aura icon when Platynator, EllesmereUI Nameplates or Plater draws auras on the same side." },
devMode = { label = "Development mode", defaultOff = true,
tip = "Starts recording data that helps improve the addon (Record everything, on by default)." },
recordAll = { label = "Record everything",
tip = "Records dungeon logs and a journal of up to 12 keys. Asks you to reload when full. No player names." },
saveCalls = { label = "Defensive calls in dungeons", defaultOff = true,
tip = "In dungeons and the open world, call a defensive ahead of damage that needs one, and show your button for it in the centre. Raids have their own switch." },
bossAdapter = { label = "Boss calls from DBM / BigWigs",
tip = "Also call defensives for boss abilities announced by DBM or BigWigs." },
raidMode = { label = "Raid (experimental)", defaultOff = true,
tip = "Off, no raid feature runs and the Raid section leaves the menu. Each feature keeps its own setting." },
raidSaves = { label = "Defensive calls in raids", defaultOff = true,
tip = "In raids, call a defensive for a dangerous boss debuff on you, timed to when its damage hits in top-player fights. Does not need the dungeon switch." },
burstCalls = { label = "Burst windows", defaultOff = true,
tip = "Says \"burst now\" when a boss phase worth bursting starts. Silent on other bosses." },
showMarkPanel = { label = "Mark panel", defaultOff = true,
tip = "Also opens the report. Only while recording. The key bindings and /ca mark work without it." },
}
CastAheadOptions.Switches = SWITCHES
local function SwitchOn(key)
if SWITCHES[key].defaultOff then return CastAheadConfig.Get(key) == true end
return CastAheadConfig.Enabled(key)
end
local function SetSwitch(key, on)
if SWITCHES[key].defaultOff then
CastAheadConfig.Set(key, on and true or false)
else
CastAheadConfig.SetEnabled(key, on)
end
end
CastAheadOptions.SetSwitch = SetSwitch
-- `free` keeps the group out of the column flow, for one the caller places itself.
-- No `title` leaves the heading to the caller, who puts a switch there.
local function BuildGroup(panel, title, height, free)
local box = CreateFrame("Frame", nil, panel, "BackdropTemplate")
box:SetFrameLevel(panel:GetFrameLevel())
box:SetSize(COL_W, height)
if not free then table.insert(panel.groups, box) end
if title then
box.title = box:CreateFontString(nil, "OVERLAY", "GameFontNormal")
box.title:SetPoint("TOPLEFT", box, "TOPLEFT", 10, -8)
box.title:SetText(title)
end
UI.PaintGroup(box, box.title)
return box
end
CastAheadOptions.BuildGroup = BuildGroup
-- Greys every texture under a frame, keeping in `saved` what each one had,
-- so a picture that greys an icon on purpose gets it back when turned on.
local function Grey(frame, saved)
for _, region in ipairs({ frame:GetRegions() }) do
if region.SetDesaturated then
if saved[region] == nil then
saved[region] = region.IsDesaturated and region:IsDesaturated() or false
end
region:SetDesaturated(true)
end
end
for _, child in ipairs({ frame:GetChildren() }) do Grey(child, saved) end
end
local function Ungrey(saved)
for region, was in pairs(saved) do region:SetDesaturated(was) end
wipe(saved)
end
-- A picture box right of the group, as tall as it: a live picture beside
-- each control it shows, top to bottom in the order they are added. The
-- group grows when they need more height
-- than its controls; the stage is the only code that sets a staged group's
-- height, and a group that sizes its controls at runtime hands that height
-- to `stage.Fit`.
local function BuildStage(panel, group)
local stage, items = {}, {}
local controlsHeight = group:GetHeight()
group.stage = stage
local function Box()
if group.preview then return group.preview end
local box = CreateFrame("Frame", nil, group, "BackdropTemplate")
box:SetPoint("TOPLEFT", group, "TOPRIGHT", UI.GAP, 0)
box:SetPoint("BOTTOMLEFT", group, "BOTTOMRIGHT", UI.GAP, 0)
UI.PaintGroup(box)
box:SetScript("OnSizeChanged", stage.Paint)
group.preview, panel.pictures = box, true
return box
end
local function Muted(text)
local fs = Box():CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
fs:SetJustifyH("LEFT")
fs:SetTextColor(unpack(T.muted))
fs:SetText(text)
return fs
end
-- `spec.build(canvas)` makes the frames once, `spec.paint(canvas, on)`
-- draws the current settings and returns the drawn size, `spec.on()` says
-- whether the feature is on, `spec.off` (text, or a function returning it)
-- names what is off, `spec.scale(canvas)` caps the picture's scale. While off the
-- stage dims the canvas, or only the frames `spec.dimmed(canvas)` lists, and
-- desaturates their textures; colour fills are
-- not greyed by that, so paint greys those itself when `on` is false.
function stage.Picture(control, spec)
local canvas = CreateFrame("Frame", nil, Box())
spec.build(canvas)
items[#items + 1] = { control = control, canvas = canvas, spec = spec, off = Muted(""), saved = {} }
end
-- Offsets are measured from the group's top edge, as SetPoint takes them.
function stage.Paint()
local layout = Layout(panel)
local width, wide = layout.zoneW, layout.split
local top = group:GetTop()
local floor, need = -8, 0
for _, item in ipairs(items) do
local ctop, cbottom = item.control:GetTop(), item.control:GetBottom()
local known = top and ctop and cbottom
if not wide then
item.canvas:Hide()
item.off:SetShown(false)
else
local canvas, on = item.canvas, item.spec.on()
if on then Ungrey(item.saved) end
local w, h = item.spec.paint(canvas, on)
canvas:SetAlpha(1)
for _, f in ipairs(item.spec.dimmed and item.spec.dimmed(canvas) or { canvas }) do
if not on then Grey(f, item.saved) end
f:SetAlpha(on and 1 or 0.35)
end
local most = item.spec.scale and item.spec.scale(canvas) or 1
local scale = w > 0 and math.min(most, (width - 2 * BOX_PAD) / w) or most
local tall = h * scale
local mid = known and (ctop + cbottom) / 2 - top or -36
local y = math.min(mid + tall / 2, floor)
canvas:SetScale(scale)
canvas:ClearAllPoints()
canvas:SetPoint("TOPLEFT", group.preview, "TOPLEFT", BOX_PAD / scale, y / scale)
canvas:Show()
-- The line's room is kept while on, so the group keeps its shape.
local off = item.spec.off
item.off:SetText(type(off) == "function" and off() or off)
item.off:ClearAllPoints()
item.off:SetPoint("TOPLEFT", group.preview, "TOPLEFT", BOX_PAD, y - tall - 4)
item.off:SetShown(not on)
floor = y - tall - 4 - item.off:GetStringHeight() - 6
need = math.max(need, 4 - floor)
end
end
local height = math.max(controlsHeight, need)
if math.abs(group:GetHeight() - height) > 0.5 then
group:SetHeight(height)
panel:Relayout()
end
return need
end
function stage.Fit(height)
controlsHeight = height
return stage.Paint()
end
group:HookScript("OnSizeChanged", stage.Paint)
table.insert(refreshers, stage.Paint)
return stage
end
CastAheadOptions.BuildStage = BuildStage
-- A sentence under `control` in the control column. The next control of the
-- group anchors under the note, and a group that fits its controls counts it.
local function Note(panel, control, text)
local note = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
note:SetJustifyH("LEFT")
note:SetTextColor(unpack(T.muted))
note:SetWordWrap(true)
Column(panel, function(w) note:SetWidth(w - 20) end)
note:SetPoint("TOPLEFT", control, "BOTTOMLEFT", 0, -2)
note:SetText(text)
return note
end
CastAheadOptions.Note = Note
local OFF_GREY = { 0.5, 0.5, 0.5 }
-- Paints one sample call on `bar` and returns the room it takes with its
-- label: width, height.
local function PaintSample(bar, key, row)
local size = CastAheadCore.PaintPreviewBar(bar, key, row)
return math.max(size, bar.label:GetStringWidth() or 0), size + 1 + math.max(bar.label:GetStringHeight() or 0, 10)
end
-- Greys a sample bar a filter removes; the next paint brings its colours back.
local function DimSample(bar, dim)
bar:SetAlpha(dim and 0.35 or 1)
bar.icon:SetDesaturated(dim)
if dim then
bar.label:SetTextColor(unpack(OFF_GREY))
bar.border:SetColorTexture(unpack(OFF_GREY))
end
end
-- The centre call picture: a block of its own painted by the real centre
-- code, and an optional caption under it while `caption()` returns one.
local function CenterPicture(key, on, off, caption)
return {
build = function(canvas)
canvas.block = CastAheadCore.BuildCenterBlock(canvas)
if caption then canvas.caption = canvas:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") end
end,
paint = function(canvas, isOn)
local w, h = CastAheadCore.PaintCenterPreview(canvas.block, { key })
if not isOn then canvas.block.lines[1].text:SetTextColor(unpack(OFF_GREY)) end
local text = caption and caption()
if canvas.caption then
canvas.caption:SetText(text or "")
canvas.caption:SetShown(text ~= nil)
if text then w = math.max(w, canvas.caption:GetStringWidth()) end
canvas.caption:ClearAllPoints()
canvas.caption:SetPoint("TOP", canvas, "TOPLEFT", w / 2, -h - 2)
if text then h = h + 2 + canvas.caption:GetStringHeight() end
end
canvas.block:ClearAllPoints()
canvas.block:SetPoint("TOP", canvas, "TOPLEFT", w / 2, 0)
canvas:SetSize(w, h)
return w, h
end,
on = on,
off = off,
}
end
-- A feature's call picture: the centre call drawn small, one call line 30 tall.
local function SmallCenterPicture(...)
local spec = CenterPicture(...)
spec.scale = function(canvas) return 30 / canvas.block.lines[1]:GetHeight() end
return spec
end
local STRIP_W, STRIP_SCALE = 160, 15
-- An early warning as a strip: the cast at the right end, the warning
-- `read()` seconds before it on a 15 s scale. Off at 0, or while `on()` is
-- false, which the off line names with `blocked`.
local function WarningStrip(read, on, blocked)
return {
build = function(canvas)
canvas.line = canvas:CreateTexture(nil, "ARTWORK")
canvas.line:SetSize(STRIP_W, 2)
canvas.line:SetPoint("TOPLEFT", canvas, "TOPLEFT", 0, -8)
canvas.cast = canvas:CreateTexture(nil, "OVERLAY")
canvas.cast:SetSize(6, 14)
canvas.cast:SetPoint("TOPRIGHT", canvas, "TOPLEFT", STRIP_W, -2)
canvas.tick = canvas:CreateTexture(nil, "OVERLAY")
canvas.tick:SetSize(2, 12)
canvas.caption = canvas:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
canvas.caption:SetPoint("TOPLEFT", canvas, "TOPLEFT", 0, -20)
end,
paint = function(canvas, isOn)
local value = math.min(read(), STRIP_SCALE)
canvas.line:SetColorTexture(unpack(T.muted))
if isOn then
canvas.cast:SetColorTexture(1, 0.2, 0.2)
canvas.tick:SetColorTexture(unpack(T.gold))
else
canvas.cast:SetColorTexture(unpack(OFF_GREY))
canvas.tick:SetColorTexture(unpack(OFF_GREY))
end
canvas.tick:ClearAllPoints()
canvas.tick:SetPoint("TOP", canvas, "TOPLEFT", STRIP_W * (1 - value / STRIP_SCALE), -3)
canvas.tick:SetShown(value > 0)
canvas.caption:SetText(value > 0 and string.format("warning %ds before", value) or "")
canvas:SetSize(STRIP_W, 34)
return STRIP_W, 34
end,
on = function() return read() > 0 and (not on or on()) end,
off = function()
if read() > 0 and on and not on() then return blocked end
return "Off - no early warning"
end,
}
end
-- One switch, placed against whatever the caller anchors it to.
local function BuildSwitch(panel, key, point, onClick, label)
local option = SWITCHES[key]
label = label or option.label
local box = UI.Checkbox(panel)
box:SetPoint(unpack(point))
box.text = box:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
box.text:SetPoint("LEFT", box, "RIGHT", 2, 0)
box.text:SetText(label)
box:SetHitRectInsets(0, -(box.text:GetStringWidth() + 6), 0, 0)
box:SetChecked(SwitchOn(key))
box:SetScript("OnClick", function(self)
local on = self:GetChecked() and true or false
SetSwitch(key, on)
if onClick then onClick(on) else Redraw() end
end)
box:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText(label, 1, 1, 1)
if option.tip then GameTooltip:AddLine(option.tip, nil, nil, nil, true) end
GameTooltip:Show()
end)
box:SetScript("OnLeave", GameTooltip_Hide)
table.insert(refreshers, function() box:SetChecked(SwitchOn(key)) end)
return box
end
CastAheadOptions.BuildSwitch = BuildSwitch
local function BuildPlacement(panel, point)
local anchorLabel = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
anchorLabel:SetPoint(unpack(point))
anchorLabel:SetText("Side")
local square = CreateFrame("Frame", nil, panel, "BackdropTemplate")
square:SetSize(58, 58)
square:SetPoint("TOPLEFT", anchorLabel, "BOTTOMLEFT", 4, -6)
square:SetBackdrop(UI.FLAT)
square:SetBackdropColor(unpack(T.bg))
square:SetBackdropBorderColor(unpack(T.border))
local grid = {
{ "topleft", "top", "topright" },
{ "left", "center", "right" },
{ "bottomleft", "bottom", "bottomright" },
}
local current = CastAheadConfig.Get("anchor") or "left"
local dots = {}
for row = 1, 3 do
for column = 1, 3 do
local side = grid[row][column]
local dot = CreateFrame("CheckButton", nil, square, "UIRadioButtonTemplate")
dot:SetPoint("TOPLEFT", square, "TOPLEFT", 4 + (column - 1) * 18, -(4 + (row - 1) * 18))
dot:SetChecked(side == current)
dot:SetScript("OnClick", function()
CastAheadUI.SetAnchor(side)
for _, other in ipairs({ square:GetChildren() }) do other:SetChecked(false) end
dot:SetChecked(true)
end)
dots[side] = dot
end
end
table.insert(refreshers, function()
local side = CastAheadConfig.Get("anchor") or "left"
for dotSide, dot in pairs(dots) do dot:SetChecked(dotSide == side) end
end)
local growLabel = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
growLabel:SetPoint("TOPLEFT", square, "TOPRIGHT", 16, -2)
growLabel:SetText("Grow")
local growDropdown = CreateFrame("DropdownButton", nil, panel, "WowStyle1DropdownTemplate")
growDropdown:SetSize(110, 24)
growDropdown:SetPoint("TOPLEFT", growLabel, "BOTTOMLEFT", 0, -4)
growDropdown:SetupMenu(function(_, root)
for _, direction in ipairs({ "auto", "left", "down", "right", "up" }) do
root:CreateRadio(direction,
function() return (CastAheadConfig.Get("grow") or "auto") == direction end,
function() CastAheadUI.SetGrowth(direction) end)
end
end)
table.insert(refreshers, function() growDropdown:GenerateMenu() end)
return square, growDropdown
end
CastAheadOptions.BuildPlacement = BuildPlacement
local function BuildStrata(panel, point)
local strataDropdown = CreateFrame("DropdownButton", nil, panel, "WowStyle1DropdownTemplate")
strataDropdown:SetSize(150, 24)
strataDropdown:SetPoint(unpack(point))
strataDropdown:SetupMenu(function(_, root)
for _, name in ipairs(CastAheadConfig.STRATA) do
root:CreateRadio(name,
function() return CastAheadConfig.Strata() == name end,
function()
CastAheadConfig.Set("strata", name ~= CastAheadConfig.STRATA_DEFAULT and name or nil)
Redraw()
end)
end
end)
table.insert(refreshers, function() strataDropdown:GenerateMenu() end)
strataDropdown:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText("Layer", 1, 1, 1)
GameTooltip:AddLine("Which layer the icons draw on. BACKGROUND sits above nameplates and under the rest of the UI, like a plate. Pick a higher layer to draw over your bars and frames, DIALOG or higher if your nameplate addon raises its plates.", nil, nil, nil, true)
GameTooltip:Show()
end)
strataDropdown:SetScript("OnLeave", GameTooltip_Hide)
return strataDropdown
end
CastAheadOptions.BuildStrata = BuildStrata
local BUILDERS
-- Each page is built once, inside the host the main window hands over for
-- it, and stays there. Moving one panel between hosts on every show left it
-- without a rect after its host had been hidden and shown again.
local function Build(host, name)
local panel = CreateFrame("Frame", nil, host)
panel:SetPoint("TOPLEFT", host, "TOPLEFT")
panel:SetPoint("TOPRIGHT", host, "TOPRIGHT")
panel.groups = {}
panel.Relayout = function(self)
local w = Layout(self).columnW
if w > 0 and w ~= self.columnW then
self.columnW = w
for _, fn in ipairs(self.columnFns or {}) do fn(w) end
Refresh()
end
CastAheadOptions.RelayoutGroups(self)
if self:IsVisible() then self:GetParent():SetHeight(self:GetHeight()) end
end
-- Width comes from the anchors and reads 0 until the next layout, so
-- the flow has to run again once the panel has its real size.
panel:SetScript("OnSizeChanged", function(self, width)
if width > 0 then self:Relayout() end
end)
panels[name] = panel
BUILDERS[name](panel)
return panel
end
-- Every stateful widget is repainted first: the slash commands write the same
-- storage from outside, so what was drawn last time may be stale.
function CastAheadOptions.ShowPanel(host, name)
local panel = panels[name] or Build(host, name)
Refresh()
panel:Relayout()
end
if StaticPopupDialogs then
StaticPopupDialogs.CASTAHEAD_RESET_ALL = {
text = "Reset every CastAhead setting, list and window position to a new install, then reload the UI? Recorded data stays.",
button1 = YES or "Yes",
button2 = NO or "No",
OnAccept = function()
CastAheadConfig.ResetAll()
ReloadUI()
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
end
local function OnOff(on) return on and "on" or "off" end
-- Groups in reading order: what is announced at all first, then the places
-- it is drawn. Each group carries its own on/off switch, so nothing has to be
-- traced across the page.
function BuildGeneral(panel)
local setup = CastAheadWindow.Button(panel, "Size and position", 160)
setup:SetPoint("TOPLEFT", panel, "TOPLEFT", COL_X, -8)
setup:SetScript("OnClick", function() CastAheadSetup.Enter() end)
local hint = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
hint:SetPoint("LEFT", setup, "RIGHT", 12, 0)
hint:SetTextColor(0.67, 0.67, 0.67)
hint:SetText("Best done near training dummies, so the icons show on real nameplates.")
local function PaintSetup(_, event)
local fighting = event == "PLAYER_REGEN_DISABLED" or (event ~= "PLAYER_REGEN_ENABLED" and InCombatLockdown())
setup:SetEnabled(not fighting)
end
setup:RegisterEvent("PLAYER_REGEN_DISABLED")
setup:RegisterEvent("PLAYER_REGEN_ENABLED")
setup:SetScript("OnEvent", PaintSetup)
PaintSetup()
table.insert(refreshers, PaintSetup)
panel.flowTop = 40
local how = BuildGroup(panel, "Limits", 60)
local howText = how:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
howText:SetJustifyH("LEFT")
howText:SetTextColor(0.8, 0.8, 0.8)
howText:SetSpacing(3)
howText:SetPoint("TOPLEFT", how, "TOPLEFT", 10, -26)
howText:SetPoint("RIGHT", how, "RIGHT", -10, 0)
howText:SetText("- The addon is often silent on the first cast of a mob. It starts with the second cast.\n"
.. "- If you always interrupt a mob, the addon may say nothing for that mob.\n"
.. "- Some calls are wrong: about 5 to 8 calls in 100.")
how:SetScript("OnSizeChanged", function(self)
local height = 26 + howText:GetStringHeight() + 10
if math.abs(self:GetHeight() - height) > 0.5 then
self:SetHeight(height)
panel:Relayout()
end
end)
local what = BuildGroup(panel, "What to call out", 262)
local whatStage = BuildStage(panel, what)
local function Filtered()
Redraw()
whatStage.Paint()
end
local important = BuildSwitch(panel, "importantOnly",
{ "TOPLEFT", what, "TOPLEFT", 10, -26 }, Filtered)
local role = BuildSwitch(panel, "roleFilter",
{ "TOPLEFT", important, "BOTTOMLEFT", 0, -4 }, Filtered)
local timeline = BuildSwitch(panel, "timeline",
{ "TOPLEFT", role, "BOTTOMLEFT", 0, -4 }, OutputChanged)
local timelineNote = Note(panel, timeline, "Puts the predictions on the game's encounter timeline.")
local PaintTimelineOff
local bigwigs = BuildSwitch(panel, "bigwigsBars",
{ "TOPLEFT", timelineNote, "BOTTOMLEFT", 0, -4 }, function()
OutputChanged()
PaintTimelineOff()
end)
-- BigWigs turns the game's timeline off by default and leaves our entries
-- out of its bars (DBM shows them as its own bars). A line appears only
-- while the entries cannot be seen, and says what to do; the BigWigs
-- switch only with BigWigs installed.
local timelineOff = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
timelineOff:SetJustifyH("LEFT")
timelineOff:SetTextColor(1, 0.5, 0.2)
local lead, leadLabel = BuildSlider(panel, {
key = "leadSeconds",
default = CastAheadConfig.LEAD_DEFAULT,
min = 0, max = CastAheadConfig.LEAD_MAX,
low = "off", high = CastAheadConfig.LEAD_MAX .. "s",
point = { "TOPLEFT", timelineOff, "BOTTOMLEFT", 2, -10 },
caption = function(value)
return value > 0
and string.format("Early warning: %ds", value)
or "Early warning: off"
end,
after = function() whatStage.Paint() end,
})
whatStage.Picture(important, {
build = function(canvas)
canvas.bars = {}
for _, key in ipairs({ "KICK", "OTHER", "TANK" }) do canvas.bars[key] = CastAheadCore.NewBar(canvas) end
end,
paint = function(canvas)
local x, h = 0, 0
-- An important kick and a cast the filter drops, so Important casts only has something to remove.
local rows = { KICK = CastAheadCore.SampleRowWhere("KICK", true) or { prio = "KICK" },
OTHER = CastAheadCore.SampleRowWhere(nil, false),
TANK = CastAheadCore.SampleRowWhere("TANK", true) or CastAheadCore.SampleDataRow("TANK")
or { prio = "TANK" } }
canvas.bars.OTHER:SetShown(rows.OTHER ~= nil)
for _, key in ipairs({ "KICK", "OTHER", "TANK" }) do
local bar, row = canvas.bars[key], rows[key]
if row then
local w, tall = PaintSample(bar, key, row)
bar:ClearAllPoints()
bar:SetPoint("TOPLEFT", canvas, "TOPLEFT", x + (w - bar._size) / 2, 0)
DimSample(bar, not CastAheadMatch.Shown(row))
x, h = x + w + 8, math.max(h, tall)
end
end
canvas:SetSize(x - 8, h)
return x - 8, h
end,
on = function() return true end,
off = "",
})
whatStage.Picture(lead, WarningStrip(CastAheadConfig.Lead))
-- The box is as tall as what it holds: the warning line takes room only while it
-- has something to say, and the slider moves up under the switches when it does not
function PaintTimelineOff()
local off = C_EncounterTimeline and C_EncounterTimeline.IsFeatureEnabled
and not C_EncounterTimeline.IsFeatureEnabled()
local bigWigs = type(BigWigsLoader) == "table"
bigwigs:SetShown(bigWigs)
local last = bigWigs and bigwigs or timelineNote
local text
if off and bigWigs and not CastAheadConfig.Enabled("bigwigsBars") then
text = "BigWigs has the game's timeline off: tick Show in BigWigs bars, or turn on its Blizzard timeline."
elseif off and not bigWigs then
text = "The game's timeline is switched off."
end
timelineOff:ClearAllPoints()
timelineOff:SetPoint("TOPLEFT", last, "BOTTOMLEFT", 4, -2)
timelineOff:SetWidth(ColumnW(panel) - 24)
timelineOff:SetText(text or "")
timelineOff:SetShown(text ~= nil)
leadLabel:ClearAllPoints()
leadLabel:SetPoint("TOPLEFT", text and timelineOff or last, "BOTTOMLEFT", text and 2 or 6, -10)
local switches = bigWigs and 4 or 3
whatStage.Fit(26 + switches * 26 + timelineNote:GetStringHeight() + 2
+ (text and timelineOff:GetStringHeight() + 2 or 0) + 92)
end
PaintTimelineOff()
table.insert(refreshers, PaintTimelineOff)
local audio = BuildGroup(panel, "Sound", 126)
local audioStage = BuildStage(panel, audio)
local sound = BuildSwitch(panel, "sound", { "TOPLEFT", audio, "TOPLEFT", 10, -26 }, RedrawAndSaves)
local soundNote = Note(panel, sound, "Plays the call sound. Off silences the addon.")
local voice = BuildSwitch(panel, "voice", { "TOPLEFT", soundNote, "BOTTOMLEFT", 0, -4 }, RedrawAndSaves)
local voiceNote = Note(panel, voice, "Speaks the call out loud.")
local focusOnly = BuildSwitch(panel, "kickFocusOnly", { "TOPLEFT", voiceNote, "BOTTOMLEFT", 0, -4 }, function()
Redraw()
audioStage.Paint()
end)
local kickNote = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
kickNote:SetJustifyH("LEFT")
kickNote:SetTextColor(0.7, 0.7, 0.7)
kickNote:SetSpacing(3)
kickNote:SetPoint("TOPLEFT", focusOnly, "BOTTOMLEFT", 4, -2)
Column(panel, function(w) kickNote:SetWidth(w - 24) end)
kickNote:SetText("On: only your enemy focus gets kick calls. No focus, or a friendly or dead one: every mob gets them.\n"
.. "Off: every mob gets kick calls.")
local function FitAudio()
audioStage.Fit(26 + 3 * focusOnly:GetHeight() + 2 * 4 + soundNote:GetStringHeight() + voiceNote:GetStringHeight()
+ 3 * 2 + kickNote:GetStringHeight() + 12)
end
table.insert(refreshers, FitAudio)
local KICK = CastAheadMatch.ADVICE.KICK
local soundPlay = CastAheadWindow.Button(panel, "Play", 44)
Column(panel, function(w) soundPlay:SetPoint("LEFT", sound, "LEFT", w - 10 - 52, 0) end)
soundPlay:SetScript("OnClick", function() CastAheadCore.PreviewSound(KICK, nil, CastAheadConfig.Enabled("voice")) end)
local voicePlay = CastAheadWindow.Button(panel, "Play", 44)
Column(panel, function(w) voicePlay:SetPoint("LEFT", voice, "LEFT", w - 10 - 52, 0) end)
voicePlay:SetScript("OnClick", function() CastAheadCore.PreviewMedia(nil, KICK) end)
audioStage.Picture(focusOnly, {
build = function(canvas)
canvas.kicks, canvas.plates, canvas.speakers = {}, {}, {}
for i, name in ipairs({ "Focus", "Other mob" }) do
local plate = CreateFrame("Frame", nil, canvas)
plate:SetSize(70, 8)
plate.health = plate:CreateTexture(nil, "ARTWORK")
plate.health:SetAllPoints()
plate.health:SetColorTexture(0.75, 0.12, 0.1)
local label = plate:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
label:SetPoint("BOTTOMLEFT", plate, "TOPLEFT", 0, 2)
label:SetText(name)
local speaker = canvas:CreateTexture(nil, "ARTWORK")
speaker:SetSize(14, 14)
speaker:SetAtlas("chatframe-button-icon-speaker-on")
speaker:SetPoint("LEFT", plate, "RIGHT", 4, 0)
canvas.kicks[i], canvas.plates[i], canvas.speakers[i] = CastAheadCore.NewBar(canvas), plate, speaker
end
canvas.focus = canvas:CreateTexture(nil, "BACKGROUND")
canvas.focus:SetPoint("TOPLEFT", canvas.plates[1], "TOPLEFT", -2, 2)
canvas.focus:SetPoint("BOTTOMRIGHT", canvas.plates[1], "BOTTOMRIGHT", 2, -2)
canvas.focus:SetColorTexture(unpack(T.gold))
end,
paint = function(canvas)
local x, h = 0, 0
for i = 1, 2 do
local bar = canvas.kicks[i]
local w, tall = PaintSample(bar, "KICK")
bar:ClearAllPoints()
bar:SetPoint("TOPLEFT", canvas, "TOPLEFT", x + (w - bar._size) / 2, 0)
canvas.plates[i]:ClearAllPoints()
canvas.plates[i]:SetPoint("LEFT", canvas, "TOPLEFT", x + w + 4, -bar._size / 2)
x, h = x + w + 4 + 70 + 4 + 14 + 16, math.max(h, tall)
end
canvas.speakers[1]:Show()
canvas.speakers[2]:SetShown(not SwitchOn("kickFocusOnly"))
canvas:SetSize(x - 16, h)
return x - 16, h
end,
on = function() return true end,
off = "",
})
FitAudio()
local plates = BuildGroup(panel, "Nameplate icons", 124)
local platesStage = BuildStage(panel, plates)
local platesOn = BuildSwitch(panel, "nameplates", { "TOPLEFT", plates, "TOPLEFT", 10, -26 }, function()
OutputChanged()
platesStage.Paint()
end)
local fullLabels = BuildSwitch(panel, "fullLabels", { "TOPLEFT", platesOn, "BOTTOMLEFT", 0, -4 }, function()
Redraw()
platesStage.Paint()
end)
BuildSwitch(panel, "auraClearance", { "TOPLEFT", fullLabels, "BOTTOMLEFT", 0, -4 }, function()
CastAheadClearance.Invalidate()
Redraw()
platesStage.Paint()
end)
-- One aura icon of the nameplate addon's, beside the plate on our side.
local AURA = 20
local auraAt = {
left = { "RIGHT", "LEFT", -2, 0 }, right = { "LEFT", "RIGHT", 2, 0 },
top = { "BOTTOM", "TOP", 0, 2 }, bottom = { "TOP", "BOTTOM", 0, -2 },
}
platesStage.Picture(platesOn, {
build = function(canvas)
local plate = CreateFrame("Frame", nil, canvas)
plate:SetSize(120, 10)
canvas.health = plate:CreateTexture(nil, "ARTWORK")
canvas.health:SetAllPoints()
local name = plate:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
name:SetPoint("BOTTOM", plate, "TOP", 0, 2)
name:SetText("Training Dummy")
canvas.aura = plate:CreateTexture(nil, "ARTWORK")
canvas.aura:SetSize(AURA, AURA)
canvas.plate = plate
end,
paint = function(canvas)
canvas.health:SetColorTexture(0.75, 0.12, 0.1)
local side = CastAheadConfig.Get("anchor") or "left"
local at = auraAt[side]
local aura = at and CastAheadClearance.Hint(side, SWITCHES.auraClearance.label) ~= nil
canvas.aura:ClearAllPoints()
if aura then canvas.aura:SetPoint(at[1], canvas.plate, at[2], at[3], at[4]) end
canvas.aura:SetColorTexture(1, 0.5, 0)
canvas.aura:SetShown(aura)
local clear = aura and CastAheadConfig.Enabled("auraClearance") and AURA + 2 or 0
local w, h, x, y = CastAheadCore.PreviewRow(canvas, canvas.plate, clear)
canvas.plate:ClearAllPoints()
canvas.plate:SetPoint("BOTTOMLEFT", canvas, "BOTTOMLEFT", x, y)
-- The name sits above the plate and may reach past the icons.
h = math.max(h, y + 10 + 16)
canvas:SetSize(w, h)
return w, h
end,
on = function() return CastAheadConfig.Enabled("nameplates") end,
dimmed = function(canvas) return canvas.previewBars end,
off = "Off - no icons on nameplates",
})
local centre = BuildGroup(panel, "Centre call", 70)
local centreStage = BuildStage(panel, centre)
local centreOn = BuildSwitch(panel, "centerText", { "TOPLEFT", centre, "TOPLEFT", 10, -26 }, function()
OutputChanged()
centreStage.Paint()
end)
centreStage.Picture(centreOn, CenterPicture("KICK", CastAheadConfig.CenterText,
"Off - no call in the middle of the screen"))
local features = BuildGroup(panel, "Features", 78)
for i, read in ipairs({
function() return "Defensive calls: " .. (CastAheadConfig.DungeonSaves() and "On" or "Off") end,
function()
if not SwitchOn("raidMode") then return "Raid (experimental): Off" end
return "Raid: defensive " .. OnOff(CastAheadConfig.RaidSaves()) .. ", burst " .. OnOff(CastAheadConfig.BurstCalls())
end,
}) do
local text = features:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
text:SetPoint("TOPLEFT", features, "TOPLEFT", 10, -30 - (i - 1) * 24)
local open = CastAheadWindow.Button(panel, "Open", 60)
open:SetPoint("TOPRIGHT", features, "TOPRIGHT", -10, -26 - (i - 1) * 24)
open:SetScript("OnClick", function() CastAheadOptions.ShowFeatures() end)
table.insert(refreshers, function() text:SetText(read()) end)
end
local extra = BuildGroup(panel, "Advanced", 97)
local extraStage = BuildStage(panel, extra)
local dev = BuildSwitch(panel, "devMode", { "TOPLEFT", extra, "TOPLEFT", 10, -26 }, function()
if CastAheadCore and CastAheadCore.ApplyDevMode then CastAheadCore.ApplyDevMode() end
end)
local devNote = Note(panel, dev, "Adds the Development page. Changes no calls.")
local resetAll = CastAheadWindow.Button(panel, "Reset all settings", 130)
resetAll:SetPoint("TOPLEFT", devNote, "BOTTOMLEFT", 0, -26)
local resetNote = Note(panel, resetAll, "Puts every setting back to a new install. Recorded data stays.")
resetAll:SetScript("OnClick", function()
if StaticPopup_Show then StaticPopup_Show("CASTAHEAD_RESET_ALL") end
end)
local function FitExtra()
extraStage.Fit(26 + dev:GetHeight() + devNote:GetStringHeight() + 2 + 26 + resetAll:GetHeight()
+ resetNote:GetStringHeight() + 2 + 10)
end
table.insert(refreshers, FitExtra)
FitExtra()
end
local function DevButton(panel, label, width, point, command, tip)
local button = CastAheadWindow.Button(panel, label, width)
button:SetPoint(unpack(point))
button:SetScript("OnClick", function()
SlashCmdList.CASTAHEAD(type(command) == "function" and command() or command)
end)
button:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText(label, 1, 1, 1)
GameTooltip:AddLine(tip, nil, nil, nil, true)
GameTooltip:Show()
end)
button:SetScript("OnLeave", GameTooltip_Hide)
return button
end
-- One switch records everything; the rest of the page only looks at it.
function BuildDevelopment(panel)
local intro = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
intro:SetPoint("TOPLEFT", panel, "TOPLEFT", COL_X, -6)
intro:SetJustifyH("LEFT")
intro:SetWordWrap(true)
intro:SetText("|cffaaaaaaRecord everything: combat log in dungeons, key journal, enemy casts. Nothing on this page changes what the addon calls out.|r")
panel:HookScript("OnSizeChanged", function(self, width)
intro:SetWidth(math.max(width - 2 * COL_X, 1))
if self:IsShown() then self:Relayout() end
end)
panel.flowTop = function() return 6 + intro:GetStringHeight() + 12 end
local recording = BuildGroup(panel, "Recording", 100)
local recordAll = BuildSwitch(panel, "recordAll", { "TOPLEFT", recording, "TOPLEFT", 10, -26 }, function()
if CastAheadCore and CastAheadCore.ApplyDevMode then CastAheadCore.ApplyDevMode() end
end)
local recordNote = Note(panel, recordAll, "Copy the files off and clear the journal here when it asks.")
local markPanel = BuildSwitch(panel, "showMarkPanel", { "TOPLEFT", recordNote, "BOTTOMLEFT", 0, -4 }, function()
if CastAheadReport then CastAheadReport.Refresh() end
end)
local markNote = Note(panel, markPanel, "A panel to mark a wrong call while recording.")
local recordingStage = BuildStage(panel, recording)
local function FitRecording()
recordingStage.Fit(26 + 2 * recordAll:GetHeight() + 4 + recordNote:GetStringHeight() + markNote:GetStringHeight()
+ 2 * 2 + 12)
end
table.insert(refreshers, FitRecording)
FitRecording()
local group = BuildGroup(panel, "Recorded enemy data", 62)
local show = DevButton(panel, "Show", 70, { "TOPLEFT", group, "TOPLEFT", 16, -28 },
"probe show", "Print which facts each unit API returned readable, secret or empty. /ca probe show")
local sweep = DevButton(panel, "Sweep", 70, { "LEFT", show, "RIGHT", 4, 0 },
"probe sweep", "Print every Unit* function that returned something readable. /ca probe sweep")
DevButton(panel, "Clear", 60, { "LEFT", sweep, "RIGHT", 4, 0 },
"probe clear", "Forget the collected probe results. /ca probe clear")
local journal = BuildGroup(panel, "Key journal", 62)
local count = DevButton(panel, "Count", 70, { "TOPLEFT", journal, "TOPLEFT", 16, -28 },
"journal", "Print how many keys the journal holds. /ca journal")
DevButton(panel, "Clear journal", 110, { "LEFT", count, "RIGHT", 4, 0 },
"journal clear", "Empty the journal after you copied it off the disk; asks first. /ca journal clear")
end
local function IconLabel(icon, name)