-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGUI_Config.lua
More file actions
2296 lines (1977 loc) · 79 KB
/
GUI_Config.lua
File metadata and controls
2296 lines (1977 loc) · 79 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
local Recount = _G.Recount
local SM = LibStub:GetLibrary("LibSharedMedia-3.0")
local Graph = LibStub:GetLibrary("LibGraph-2.0")
local AceLocale = LibStub("AceLocale-3.0")
local L = AceLocale:GetLocale("Recount")
local BC = {} -- = LibStub("LibBabble-Class-3.0"):GetLookupTable()
local revision = tonumber(string.sub("$Revision: 1532 $", 12, -3))
if Recount.Version < revision then
Recount.Version = revision
end
local _G = _G
local ipairs = ipairs
local math = math
local pairs = pairs
local string = string
local table = table
local type = type
local CreateFrame = CreateFrame
local IsInInstance = IsInInstance
local FauxScrollFrame_GetOffset = FauxScrollFrame_GetOffset
local FauxScrollFrame_OnVerticalScroll = FauxScrollFrame_OnVerticalScroll
local FauxScrollFrame_Update = FauxScrollFrame_Update
local UIDropDownMenu_AddButton = UIDropDownMenu_AddButton
local UIDropDownMenu_SetSelectedID = UIDropDownMenu_SetSelectedID
local GameTooltip = GameTooltip
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local WOW_RETAIL = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
local WOW_PANDA_CLASSIC = WOW_PROJECT_ID == WOW_PROJECT_MISTS_CLASSIC or WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC or WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC or WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC
if FillLocalizedClassList then
FillLocalizedClassList(BC, false) -- We are sexist here but not much of a choice, when there is no neutral
elseif LocalizedClassList then
BC = LocalizedClassList(false)
end
-- Elsia: Note, most strings here haven't been localized. Need to grab all button and text labels here and put into localization registration.
-- Just started with the color selection ones to give an example. See Recount.lua.
local UnitClass = UnitClass
local me = {}
local SavedCheckVars = {}
local EditableColors = {
["Window"] = {
"Title",
"Background",
"Title Text",
},
["Other Windows"] = {
"Title",
"Background",
"Title Text",
},
["Bar"] = {
"Bar Text",
"Total Bar",
},
["Class"] = {
(WOW_RETAIL or WOW_PANDA_CLASSIC) and "Deathknight" or nil,
WOW_RETAIL and "Demonhunter" or nil,
"Druid",
WOW_RETAIL and "Evoker" or nil,
"Hunter",
"Mage",
(WOW_RETAIL or WOW_PANDA_CLASSIC) and "Monk" or nil,
"Paladin",
"Priest",
"Rogue",
"Shaman",
"Warlock",
"Warrior",
"Pet",
--"Guardian",
"Mob",
}
}
local ClassStrings = {
["DEATHKNIGHT"] = true,
["DEMONHUNTER"] = true,
["DRUID"] = true,
["EVOKER"] = true,
["HUNTER"] = true,
["MAGE"] = true,
["MONK"] = true,
["PALADIN"] = true,
["PRIEST"] = true,
["ROGUE"] = true,
["SHAMAN"] = true,
["WARLOCK"] = true,
["WARRIOR"] = true,
["PET"] = false, -- Elsia: These two are not supported by RAID_CLASS_COLORS or Babble-Class
--["GUARDIAN"] = false,
["MOB"] = false,
["HOSTILE"] = false,
["UNGROUPED"] = false,
}
function me:LBC(Name) -- Allow localization of unit strings via Babble-Class
local CName = string.upper(Name)
if ClassStrings[CName] then -- Elsia: Only Babble what babble knows
return BC[CName]
else
return L[Name]
end
end
function Recount:FixUnitString(Name) -- This is to handle caps of default unit strings
local CName = string.upper(Name)
if ClassStrings[CName] ~= nil then -- Elsia: Caps all unit strings
return CName
else
return Name
end
end
function Recount:ResetDefaultWindowColors()
Recount.Colors:SetColor("Window", "Title", {r = 1, g = 0, b = 0, a = 1})
Recount.Colors:SetColor("Window", "Background", {r = 24 / 255, g = 24 / 255, b = 24 / 255, a = 1})
Recount.Colors:SetColor("Window", "Title Text", {r = 1, g = 1, b = 1, a = 1})
Recount.Colors:SetColor("Other Windows", "Title", {r = 1, g = 0, b = 0, a = 1})
Recount.Colors:SetColor("Other Windows", "Background", {r = 24 / 255, g = 24 / 255, b = 24 / 255, a = 1})
Recount.Colors:SetColor("Other Windows", "Title Text", {r = 1, g = 1, b = 1, a = 1})
end
function Recount:ResetDefaultClassColors()
for k, v in pairs(EditableColors.Class) do
v = Recount:FixUnitString(v)
if v == "PET" then
Recount.Colors:SetColor("Class", "PET", {r = 0.09, g = 0.61, b = 0.55, a = 1})
--[[elseif v=="GUARDIAN" then
Recount.Colors:SetColor("Class", "GUARDIAN", {r = 0.61, g = 0.09, b = 0.09})]]
elseif v == "MOB" then
Recount.Colors:SetColor("Class", "MOB", {r = 0.58, g = 0.24, b = 0.63, a = 1})
else
local classcols
if CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[v] then
classcols = CUSTOM_CLASS_COLORS[v]
else
classcols = RAID_CLASS_COLORS[v]
end
classcols.a = 1
Recount.Colors:SetColor("Class", v, classcols)
end
end
Recount.Colors:SetColor("Bar", "Bar Text", {r = 1, g = 1, b = 1, a = 1})
Recount.Colors:SetColor("Bar", "Total Bar", {r = 0.75, g = 0.75, b = 0.75, a = 1})
end
function me:SetColorRow(Branch, Name)
self.Branch = Branch
self.Text:SetText(me:LBC(Name))
Name = Recount:FixUnitString(Name)
self.Name = Name
Recount.Colors:UnregisterItem(self.Background)
Recount.Colors:UnregisterItem(self.Key)
Recount.Colors:RegisterTexture(Branch, Name, self.Background)
Recount.Colors:RegisterTexture(Branch, Name, self.Key)
end
function me:CreateColorRow(parent, frame)
local theFrame = CreateFrame("Frame", nil, parent)
theFrame:SetWidth(190)
theFrame:SetHeight(13)
theFrame.Background = theFrame:CreateTexture(nil, "BACKGROUND")
theFrame.Background:SetAllPoints(theFrame)
theFrame.Background:SetColorTexture(1, 1, 1, 0.3)
theFrame.Background:Hide()
theFrame.Key = theFrame:CreateTexture(nil, "OVERLAY")
theFrame.Key:SetHeight(13)
theFrame.Key:SetWidth(13)
theFrame.Key:SetPoint("LEFT", theFrame, "LEFT", 0, 0)
theFrame.Key:SetColorTexture(1, 1, 1)
theFrame.Text = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.Text:SetPoint("LEFT", theFrame, "LEFT", 16, 0)
theFrame:EnableMouse(true)
theFrame:SetScript("OnEnter", function()
theFrame.Background:Show()
end)
theFrame:SetScript("OnLeave", function()
theFrame.Background:Hide()
end)
theFrame:SetScript("OnMouseDown", function(this)
Recount.Colors:EditColor(this.Branch, this.Name, me.ConfigWindow)
end)
theFrame.SetRow = me.SetColorRow
return theFrame
end
function me:CreateWindowColorSelection(parent)
me.WindowColorOptions = CreateFrame("Frame", nil, parent)
local theFrame = me.WindowColorOptions
theFrame:SetHeight(parent:GetHeight() - 34)
theFrame:SetWidth(200)
theFrame:SetPoint("TOPLEFT", parent, "TOPLEFT", 0, -34)
theFrame.Rows = {}
theFrame.Title = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.Title:SetPoint("TOP", theFrame, "TOP", 0, -2)
theFrame.Title:SetText(L["Window Color Selection"])
local i = 1
theFrame.MainWindowTitle = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.MainWindowTitle:SetPoint("TOP", theFrame, "TOP", 0, -4 - i * 14)
theFrame.MainWindowTitle:SetText(L["Main Window"])
i = i + 1
for k, v in pairs(EditableColors.Window) do
theFrame.Rows[i] = me:CreateColorRow(theFrame)
theFrame.Rows[i]:SetRow("Window", v)
theFrame.Rows[i]:SetPoint("TOP", theFrame, "TOP", 4, -2 - i * 14)
i = i + 1
--[[if i > 16 then
return
end]]
end
theFrame.DetailWindowTitle = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.DetailWindowTitle:SetPoint("TOP", theFrame, "TOP", 0, -4 - i * 14)
theFrame.DetailWindowTitle:SetText(L["Other Windows"])
i = i + 1
for k, v in pairs(EditableColors.Window) do
theFrame.Rows[i] = me:CreateColorRow(theFrame)
theFrame.Rows[i]:SetRow("Other Windows", v)
theFrame.Rows[i]:SetPoint("TOP", theFrame, "TOP", 4, -4 - i * 14)
i = i + 1
--[[if i > 16 then
return
end]]
end
theFrame.ResetColButton = CreateFrame("Button", nil, theFrame, "UIPanelButtonTemplate")
theFrame.ResetColButton:SetWidth(120)
theFrame.ResetColButton:SetHeight(18)
--theFrame.ResetColButton:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 40, -210)
theFrame.ResetColButton:SetPoint("BOTTOMLEFT", theFrame, "BOTTOMLEFT", 40, 4)
theFrame.ResetColButton:SetScript("OnClick", function()
Recount:ResetDefaultWindowColors()
end)
theFrame.ResetColButton:SetText(L["Reset Colors"])
end
function me:CreateWindowModuleSelection(parent)
me.ModuleOptions = CreateFrame("Frame", nil, parent)
local theFrame = me.ModuleOptions
theFrame:SetHeight(parent:GetHeight() - 34)
theFrame:SetWidth(200)
theFrame:SetPoint("TOPLEFT", parent, "TOPLEFT", 0, -34)
theFrame.Title = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.Title:SetText("Enabled Modules")
theFrame.Title:SetPoint("TOP", theFrame, "TOP", 0, -2)
theFrame.HealingTaken = me:CreateSavedCheckbox(L["Healing Taken"], theFrame, "Modules", "HealingTaken")
theFrame.HealingTaken:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -20)
theFrame.HealingTaken:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.Modules.HealingTaken = true
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
else
this:SetChecked(false)
Recount.db.profile.Modules.HealingTaken = false
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
end
end)
theFrame.OverhealingDone = me:CreateSavedCheckbox(L["Overhealing Done"], theFrame, "Modules", "OverhealingDone")
theFrame.OverhealingDone:SetPoint("TOPLEFT", theFrame.HealingTaken, "BOTTOMLEFT", 0, 0)
theFrame.OverhealingDone:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.Modules.OverhealingDone = true
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
else
this:SetChecked(false)
Recount.db.profile.Modules.OverhealingDone = false
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
end
end)
theFrame.Deaths = me:CreateSavedCheckbox(L["Deaths"], theFrame, "Modules", "Deaths")
theFrame.Deaths:SetPoint("TOPLEFT", theFrame.OverhealingDone, "BOTTOMLEFT", 0, 0)
theFrame.Deaths:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.Modules.Deaths = true
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
else
this:SetChecked(false)
Recount.db.profile.Modules.Deaths = false
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
end
end)
theFrame.DOTUptime = me:CreateSavedCheckbox(L["DOT Uptime"], theFrame, "Modules", "DOTUptime")
theFrame.DOTUptime:SetPoint("TOPLEFT", theFrame.Deaths, "BOTTOMLEFT", 0, 0)
theFrame.DOTUptime:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.Modules.DOTUptime = true
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
else
this:SetChecked(false)
Recount.db.profile.Modules.DOTUptime = false
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
end
end)
theFrame.HOTUptime = me:CreateSavedCheckbox(L["HOT Uptime"], theFrame, "Modules", "HOTUptime")
theFrame.HOTUptime:SetPoint("TOPLEFT", theFrame.DOTUptime, "BOTTOMLEFT", 0, 0)
theFrame.HOTUptime:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.Modules.HOTUptime = true
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
else
this:SetChecked(false)
Recount.db.profile.Modules.HOTUptime = false
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
end
end)
theFrame.Activity = me:CreateSavedCheckbox(L["Activity"], theFrame, "Modules", "Activity")
theFrame.Activity:SetPoint("TOPLEFT", theFrame.HOTUptime, "BOTTOMLEFT", 0, 0)
theFrame.Activity:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.Modules.Activity = true
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
else
this:SetChecked(false)
Recount.db.profile.Modules.Activity = false
Recount:SetupMainWindow()
Recount:RefreshMainWindow()
end
end)
end
function me:CreateClassColorSelection(parent)
me.ClassColorOptions = CreateFrame("Frame", nil, parent)
local theFrame = me.ClassColorOptions
theFrame:SetHeight(parent:GetHeight() - 34)
theFrame:SetWidth(200)
theFrame:SetPoint("TOPLEFT", parent, "TOPLEFT", 200, -34)
theFrame.Rows = {}
theFrame.Title = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.Title:SetPoint("TOP", theFrame, "TOP", 0, -2)
theFrame.Title:SetText(L["Bar Color Selection"])
local i = 1
for k, v in pairs(EditableColors.Bar) do
theFrame.Rows[i] = me:CreateColorRow(theFrame)
theFrame.Rows[i]:SetRow("Bar", v)
theFrame.Rows[i]:SetPoint("TOP", theFrame, "TOP", 4, -2 - i * 14)
i = i + 1
--[[if i > 16 then
return
end]]
end
--theFrame.ClassTitle = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
--theFrame.ClassTitle:SetPoint("TOP", theFrame, "TOP", 0, -2 - i * 14)
--theFrame.ClassTitle:SetText(L["Class Colors"])
--i = i + 1
for k, v in pairs(EditableColors.Class) do
theFrame.Rows[i] = me:CreateColorRow(theFrame)
theFrame.Rows[i]:SetRow("Class", v)
theFrame.Rows[i]:SetPoint("TOP", theFrame, "TOP", 4, -2 - i * 14)
i = i + 1
--[[if i > 16 then
return
end]]
end
i = i + 1
theFrame.ResetColButton = CreateFrame("Button", nil, theFrame, "UIPanelButtonTemplate")
theFrame.ResetColButton:SetWidth(120)
theFrame.ResetColButton:SetHeight(18)
--theFrame.ResetColButton:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 40, -210)
theFrame.ResetColButton:SetPoint("BOTTOMLEFT", theFrame, "BOTTOMLEFT", 40, 4)
theFrame.ResetColButton:SetScript("OnClick", function()
Recount:ResetDefaultClassColors()
end)
theFrame.ResetColButton:SetText(L["Reset Colors"])
end
function me:CreateIconFrame(parent, texture, title, text)
local theFrame = CreateFrame("Frame", nil, parent)
theFrame:SetWidth(18)
theFrame:SetHeight(18)
theFrame.texture = theFrame:CreateTexture(nil, "OVERLAY")
theFrame.texture:SetAllPoints(theFrame)
theFrame.texture:SetTexture(texture)
theFrame.title = title
theFrame.text = text
theFrame:SetScript("OnEnter",function()
GameTooltip:SetOwner(theFrame, "ANCHOR_TOPRIGHT")
GameTooltip:ClearLines()
GameTooltip:AddLine(theFrame.title)
GameTooltip:AddLine(theFrame.text, 1, 1, 1, true)
GameTooltip:Show()
end)
theFrame:SetScript("OnLeave",function()
GameTooltip:Hide()
end)
theFrame:EnableMouse(true)
theFrame:Show()
return theFrame
end
function me:ConfigureCheckbox(check)
check:SetWidth(20)
check:SetHeight(20)
check:SetScript("OnClick",function(this)
if this:GetChecked() then
this:SetChecked(true)
else
this:SetChecked(false)
end
end)
check:SetNormalTexture("Interface\\Buttons\\UI-CheckBox-Up")
check:SetPushedTexture("Interface\\Buttons\\UI-CheckBox-Down")
check:SetDisabledCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check-Disabled")
check:SetCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check")
check:SetHighlightTexture("Interface\\Buttons\\UI-CheckBox-Highlight")
end
function me:CreateSavedCheckbox(Text, parent, VarTop, VarName)
local Checkbox = CreateFrame("CheckButton", nil, parent)
me:ConfigureCheckbox(Checkbox)
Checkbox.Text = Checkbox:CreateFontString(nil, "OVERLAY", "GameFontNormal")
Checkbox.Text:SetText(Text)
Checkbox.Text:SetPoint("LEFT", Checkbox, "RIGHT", 2, 1)
SavedCheckVars[#SavedCheckVars + 1] = {Checkbox, VarTop, VarName}
return Checkbox
end
function me:CreateFilterRow(parent, label, header)
local theFrame = CreateFrame("Frame", nil, parent)
theFrame:SetWidth(196)
theFrame:SetHeight(16)
theFrame.Label = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
if not header then
theFrame.Label:SetTextColor(1, 1, 1, 1)
end
theFrame.Label:SetText(" "..label)
theFrame.Label:SetPoint("LEFT", theFrame, "LEFT", 0, 0)
theFrame.ShowData = CreateFrame("CheckButton", nil, theFrame)
me:ConfigureCheckbox(theFrame.ShowData)
theFrame.ShowData:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
else
this:SetChecked(false)
end
me:SaveFilterConfig()
Recount:RefreshMainWindow()
end)
theFrame.RecordData = CreateFrame("CheckButton", nil, theFrame)
me:ConfigureCheckbox(theFrame.RecordData)
theFrame.RecordData:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
theFrame.RecordTime:Enable()
theFrame.TrackDeaths:Enable()
theFrame.TrackBuffs:Enable()
else
this:SetChecked(false)
theFrame.RecordTime:Disable()
theFrame.TrackDeaths:Disable()
theFrame.TrackBuffs:Disable()
end
me:SaveFilterConfig()
end)
theFrame.RecordTime = CreateFrame("CheckButton", nil, theFrame)
me:ConfigureCheckbox(theFrame.RecordTime)
theFrame.RecordTime:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
else
this:SetChecked(false)
end
me:SaveFilterConfig()
end)
theFrame.TrackDeaths = CreateFrame("CheckButton", nil, theFrame)
me:ConfigureCheckbox(theFrame.TrackDeaths)
theFrame.TrackDeaths:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
else
this:SetChecked(false)
end
me:SaveFilterConfig()
end)
theFrame.TrackBuffs = CreateFrame("CheckButton", nil, theFrame)
me:ConfigureCheckbox(theFrame.TrackBuffs)
theFrame.TrackBuffs:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
else
this:SetChecked(false)
end
me:SaveFilterConfig()
end)
theFrame.ShowData:SetPoint("RIGHT", theFrame.RecordData, "LEFT", 0, 0)
theFrame.RecordData:SetPoint("RIGHT", theFrame.RecordTime, "LEFT", 0, 0)
theFrame.RecordTime:SetPoint("RIGHT", theFrame.TrackDeaths, "LEFT", 0, 0)
theFrame.TrackDeaths:SetPoint("RIGHT", theFrame.TrackBuffs, "LEFT", 0, 0)
theFrame.TrackBuffs:SetPoint("RIGHT", theFrame, "RIGHT", -1, 0)
theFrame.ShowData:Show()
theFrame.RecordData:Show()
theFrame.RecordTime:Show()
theFrame.TrackDeaths:Show()
theFrame.TrackBuffs:Show()
return theFrame
end
function me:SetupFilterOptions(parent)
me.FilterOptions = CreateFrame("Frame", nil, parent)
local theFrame = me.FilterOptions
theFrame:SetHeight(parent:GetHeight() - 34 - 4)
theFrame:SetWidth(196)
theFrame:SetPoint("TOPLEFT", parent, "TOPLEFT", 2, -34)
theFrame.Title_Show = me:CreateIconFrame(theFrame,"Interface/Icons/INV_Misc_Eye_01", L["Show"], L["Is this shown in the main window?"])
theFrame.Title_Data = me:CreateIconFrame(theFrame,"Interface/Icons/INV_Misc_Note_02", L["Record Data"], L["Whether data is recorded for this type"])
theFrame.Title_Time = me:CreateIconFrame(theFrame,"Interface/Icons/INV_Misc_PocketWatch_02", L["Record Time Data"], L["Whether time data is recorded for this type (used for graphs can be a |cffff2020memory hog|r if you are concerned about memory)"])
theFrame.Title_Deaths = me:CreateIconFrame(theFrame,"Interface/Icons/Ability_Creature_Cursed_02", L["Record Deaths"], L["Records when deaths occur and the past few actions involving this type"])
theFrame.Title_Buffs = me:CreateIconFrame(theFrame,"Interface/Icons/Ability_Warrior_SavageBlow", L["Record Buffs/Debuffs"], L["Records the times and applications of buff/debuffs on this type"])
theFrame.Title_Show:SetPoint("RIGHT", theFrame.Title_Data, "LEFT", -2, 0)
theFrame.Title_Data:SetPoint("RIGHT", theFrame.Title_Time, "LEFT", -2, 0)
theFrame.Title_Time:SetPoint("RIGHT", theFrame.Title_Deaths, "LEFT", -2, 0)
theFrame.Title_Deaths:SetPoint("RIGHT", theFrame.Title_Buffs, "LEFT", -2, 0)
theFrame.Title_Buffs:SetPoint("TOPRIGHT", theFrame, "TOPRIGHT", -2, -2)
theFrame.Title = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.Title:SetText(L["Filters"])
theFrame.Title:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 2, -4)
theFrame.Filters = {}
local Filters = theFrame.Filters
theFrame.TitlePlayers = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.TitlePlayers:SetText(" "..L["Players"])
theFrame.TitlePlayers:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 0, -26)
Filters.Self = me:CreateFilterRow(theFrame, " "..L["Self"])
Filters.Self:SetPoint("TOPLEFT", theFrame.TitlePlayers, "BOTTOMLEFT", 0, -1)
Filters.Grouped = me:CreateFilterRow(theFrame, " "..L["Grouped"])
Filters.Grouped:SetPoint("TOPLEFT", Filters.Self, "BOTTOMLEFT", 0, -1)
Filters.Ungrouped = me:CreateFilterRow(theFrame," "..L["Ungrouped"])
Filters.Ungrouped:SetPoint("TOP", Filters.Grouped, "BOTTOM", 0, -1)
Filters.Hostile = me:CreateFilterRow(theFrame, " "..L["Hostile"])
Filters.Hostile:SetPoint("TOP", Filters.Ungrouped, "BOTTOM", 0, -1)
Filters.Pet = me:CreateFilterRow(theFrame, L["Pets"], true)
Filters.Pet:SetPoint("TOP", Filters.Hostile, "BOTTOM", 0, -1)
theFrame.TitleMobs = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.TitleMobs:SetText(" "..L["Mobs"])
theFrame.TitleMobs:SetPoint("TOPLEFT", Filters.Pet, "BOTTOMLEFT", 0, -1)
Filters.Trivial = me:CreateFilterRow(theFrame," "..L["Trivial"])
Filters.Trivial:SetPoint("TOPLEFT", theFrame.TitleMobs, "BOTTOMLEFT", 0, -1)
Filters.Nontrivial = me:CreateFilterRow(theFrame, " "..L["Non-Trivial"])
Filters.Nontrivial:SetPoint("TOP", Filters.Trivial, "BOTTOM", 0, -1)
Filters.Boss = me:CreateFilterRow(theFrame," "..L["Bosses"])
Filters.Boss:SetPoint("TOP", Filters.Nontrivial, "BOTTOM", 0, -1)
Filters.Unknown = me:CreateFilterRow(theFrame, L["Unknown"], true)
Filters.Unknown:SetPoint("TOP", Filters.Boss, "BOTTOM", 0, -1)
theFrame.MergePets = me:CreateSavedCheckbox(L["Merge Pets w/ Owners"], theFrame, "Data", "MergePets")
theFrame.MergePets:SetPoint("TOPLEFT", Filters.Unknown, "BOTTOMLEFT", 0, -1)
theFrame.MergePets:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.MergePets = true
Recount.db.profile.Filters.Show["Pet"] = false
else
this:SetChecked(false)
Recount.db.profile.MergePets = false
Recount.db.profile.Filters.Show["Pet"] = true
end
me.FilterOptions.Filters.Pet.ShowData:SetChecked(Recount.db.profile.Filters.Show["Pet"])
Recount:FullRefreshMainWindow()
Recount:RefreshMainWindow()
end)
theFrame.MergeAbsorbs = me:CreateSavedCheckbox(L["Merge Absorbs w/ Heals"], theFrame, "Data", "MergeAbsorbs")
theFrame.MergeAbsorbs:SetPoint("TOPLEFT", theFrame.MergePets, "BOTTOMLEFT", 0, 2)
theFrame.MergeAbsorbs:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.MergeAbsorbs = true
else
this:SetChecked(false)
Recount.db.profile.MergeAbsorbs = false
end
Recount:FullRefreshMainWindow()
Recount:RefreshMainWindow()
end)
theFrame.MergeDamageAbsorbs = me:CreateSavedCheckbox(L["Merge Absorbs w/ Damage"], theFrame, "Data", "MergeDamageAbsorbs")
theFrame.MergeDamageAbsorbs:SetPoint("TOPLEFT", theFrame.MergeAbsorbs, "BOTTOMLEFT", 0, 2)
theFrame.MergeDamageAbsorbs:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.MergeDamageAbsorbs = true
else
this:SetChecked(false)
Recount.db.profile.MergeDamageAbsorbs = false
end
Recount:FullRefreshMainWindow()
Recount:RefreshMainWindow()
end)
end
function me.SetBarTexture(this)
local BarTextures = SM:List("statusbar")
Recount:SetBarTextures(BarTextures[this.value])
UIDropDownMenu_SetSelectedID(me.MiscOptions.StatusBarDropDown, this.value)
end
function me:BarTextureDropDown_Initialize()
local BarTextures = SM:List("statusbar")
local LookingFor
if not LookingFor then
LookingFor = Recount.db.profile.BarTexture
end
if not LookingFor then
LookingFor = "BantoBar"
end
for k, v in pairs(BarTextures) do
local info = {}
info.text = v
info.value = k
info.func = me.SetBarTexture
UIDropDownMenu_AddButton(info)
if v == LookingFor then
LookingFor = k
end
end
UIDropDownMenu_SetSelectedID(me.MiscOptions.StatusBarDropDown, LookingFor)
end
function me:SetSelectStatusBar(texture)
if texture == nil then
self:Hide()
return
end
self.Text:SetText(texture)
self.Texture:SetTexture(SM:Fetch("statusbar", texture))
self.SetTo = texture
self:Show()
end
function me:UpdateStatusBars()
for _, v in pairs(me.TextureOptions.Rows) do
if v.SetTo == Recount.db.profile.BarTexture then
v.Texture:SetVertexColor(0.2, 0.9, 0.2)
else
v.Texture:SetVertexColor(0.9, 0.2, 0.2)
end
end
end
function me:CreateSelectStatusBar(parent)
local frame = CreateFrame("Frame", nil, parent)
frame:SetHeight(13)
frame:SetWidth(180)
frame.Text = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
frame.Text:SetText("Temp")
frame.Text:SetPoint("CENTER", frame, "CENTER")
frame.Texture = frame:CreateTexture(nil, "BACKGROUND")
frame.Texture:SetAllPoints(frame)
frame.SetTexture = me.SetSelectStatusBar
frame:EnableMouse(true)
frame:SetScript("OnMouseDown", function(this)
Recount:SetBarTextures(this.SetTo)
me:SetTestBarTexture(this.SetTo)
me:UpdateStatusBars()
end)
return frame
end
function me:RefreshStatusBars()
local BarTextures = SM:List("statusbar")
local size = table.getn(BarTextures)
FauxScrollFrame_Update(me.TextureOptions.ScrollBar, size, 13, 12)
local offset = FauxScrollFrame_GetOffset(me.TextureOptions.ScrollBar)
for i = 1, 13 do
me.TextureOptions.Rows[i]:SetTexture(BarTextures[i + offset])
end
me:UpdateStatusBars()
end
function me:SetTestBarTexture(handle)
local Texture = SM:Fetch(SM.MediaType.STATUSBAR, handle) -- "statusbar"
me.BarOptions.TestBar.StatusBar:SetStatusBarTexture(Texture)
me.BarOptions.TestBar.StatusBar:GetStatusBarTexture():SetHorizTile(false)
me.BarOptions.TestBar.StatusBar:GetStatusBarTexture():SetVertTile(false)
end
function me:SetTestBar(num, left, right, value, color)
local Row = me.BarOptions.TestBar
Row:Show()
Row.StatusBar:SetValue(value)
Row.LeftText:SetText(left)
Row.RightText:SetText(right)
Row.Name = left
if Recount.db.profile.BarTextColorSwap then
if color then
Row.StatusBar:SetStatusBarColor(Recount.db.profile.Colors.Bar["Bar Text"].r, Recount.db.profile.Colors.Bar["Bar Text"].g, Recount.db.profile.Colors.Bar["Bar Text"].b, Recount.db.profile.Colors.Bar["Bar Text"].a)
end
Row.LeftText:SetTextColor(color.r, color.g, color.b, color.a)
Row.RightText:SetTextColor(color.r, color.g, color.b, color.a)
else
if color then
Row.StatusBar:SetStatusBarColor(color.r, color.g, color.b, 1)
end
Row.LeftText:SetTextColor(Recount.db.profile.Colors.Bar["Bar Text"].r, Recount.db.profile.Colors.Bar["Bar Text"].g, Recount.db.profile.Colors.Bar["Bar Text"].b, 1)
Row.RightText:SetTextColor(Recount.db.profile.Colors.Bar["Bar Text"].r, Recount.db.profile.Colors.Bar["Bar Text"].g, Recount.db.profile.Colors.Bar["Bar Text"].b, 1)
end
end
function me:RefreshTestBar()
local lefttext = Recount.db.profile.MainWindow.BarText.RankNum and "1. "..Recount.PlayerName or Recount.PlayerName
local righttext = Recount:FormatLongNums(10537815)
if Recount.db.profile.MainWindow.BarText.PerSec then
righttext = righttext .. string.format(" (%s","397821.2")
if Recount.db.profile.MainWindow.BarText.Percent then
righttext = righttext .. string.format(", %.1f%%)", 100.0)
else
righttext = righttext .. ")"
end
elseif Recount.db.profile.MainWindow.BarText.Percent then
righttext = righttext .. string.format(" (%.1f%%)", 100.0)
end
local _, enClass = UnitClass("player")
me:SetTestBar(0, lefttext, righttext, 100, Recount.db.profile.Colors.Class[enClass] or Recount.Colors:GetColor("Class", enClass))
end
function me:CreateBarSelection(parent)
me.BarOptions = CreateFrame("Frame",nil, parent)
local theFrame = me.BarOptions
theFrame:SetHeight(parent:GetHeight() - 34)
theFrame:SetWidth(200)
theFrame:SetPoint("TOPLEFT", parent, "TOPLEFT", 0, -34)
--[[theFrame.Background = theFrame:CreateTexture(nil, "BACKGROUND")
theFrame.Background:SetAllPoints(theFrame)
theFrame.Background:SetColorTexture(0, 0, 0, 0.3)]]
theFrame.Title = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.Title:SetText(L["Bar Text Options"])
theFrame.Title:SetPoint("TOP", theFrame, "TOP", 0, -2)
local row = CreateFrame("Button", "Recount_ConfigWindow_BarOptions_TestBar", theFrame)
row:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 2, -16)
row:SetHeight(14)
row:SetWidth(196)
Recount:SetupBar(row)
local Font, Height, Flags = row.LeftText:GetFont()
row.LeftText:SetFont(Font, 14 * 0.75, Flags)
local Font, Height, Flags = row.RightText:GetFont()
row.RightText:SetFont(Font, 14 * 0.75, Flags)
Recount.Colors:RegisterFont("Bar", "Bar Text", row.LeftText)
Recount.Colors:RegisterFont("Bar", "Bar Text", row.RightText)
theFrame.TestBar = row
me:RefreshTestBar()
theFrame.RankNum = me:CreateSavedCheckbox(L["Rank Number"], theFrame, "Window", "RankNum")
theFrame.RankNum:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -23 - 14)
theFrame.RankNum:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.MainWindow.BarText.RankNum = true
Recount:RefreshMainWindow()
me:RefreshTestBar()
else
this:SetChecked(false)
Recount.db.profile.MainWindow.BarText.RankNum = false
Recount:RefreshMainWindow()
me:RefreshTestBar()
end
end)
theFrame.ServerName = me:CreateSavedCheckbox(L["Server Name"], theFrame, "Window", "ServerName")
theFrame.ServerName:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -40 - 14)
theFrame.ServerName:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.MainWindow.BarText.ServerName = true
Recount:RefreshMainWindow()
me:RefreshTestBar()
else
this:SetChecked(false)
Recount.db.profile.MainWindow.BarText.ServerName = false
Recount:RefreshMainWindow()
me:RefreshTestBar()
end
end)
theFrame.PerSec = me:CreateSavedCheckbox(L["Per Second"], theFrame, "Window", "PerSec")
theFrame.PerSec:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -57 - 14)
theFrame.PerSec:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.MainWindow.BarText.PerSec = true
Recount:RefreshMainWindow()
me:RefreshTestBar()
else
this:SetChecked(false)
Recount.db.profile.MainWindow.BarText.PerSec = false
Recount:RefreshMainWindow()
me:RefreshTestBar()
end
end)
theFrame.Percent = me:CreateSavedCheckbox(L["Percent"], theFrame, "Window", "Percent")
theFrame.Percent:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -74 - 14)
theFrame.Percent:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
Recount.db.profile.MainWindow.BarText.Percent = true
Recount:RefreshMainWindow()
me:RefreshTestBar()
else
this:SetChecked(false)
Recount.db.profile.MainWindow.BarText.Percent = false
Recount:RefreshMainWindow()
me:RefreshTestBar()
end
end)
theFrame.Title2 = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.Title2:SetText(L["Number Format"])
theFrame.Title2:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -94 - 14)
theFrame.Standard = me:CreateSavedCheckbox(L["Standard"], theFrame, "Window", "Standard")
theFrame.Standard:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -108 - 14)
theFrame.Standard:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
this:GetParent().Commas:SetChecked(false)
this:GetParent().Short:SetChecked(false)
Recount.db.profile.MainWindow.BarText.NumFormat = 1
Recount:RefreshMainWindow()
me:RefreshTestBar()
else
this:SetChecked(true)
end
end)
theFrame.Commas = me:CreateSavedCheckbox(L["Commas"], theFrame, "Window", "Commas")
theFrame.Commas:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -125 - 14)
theFrame.Commas:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
this:GetParent().Standard:SetChecked(false)
this:GetParent().Short:SetChecked(false)
Recount.db.profile.MainWindow.BarText.NumFormat = 2
Recount:RefreshMainWindow()
me:RefreshTestBar()
else
this:SetChecked(true)
end
end)
theFrame.Short = me:CreateSavedCheckbox(L["Short"], theFrame, "Window", "Short")
theFrame.Short:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -142 - 14)
theFrame.Short:SetScript("OnClick", function(this)
if this:GetChecked() then
this:SetChecked(true)
this:GetParent().Standard:SetChecked(false)
this:GetParent().Commas:SetChecked(false)
Recount.db.profile.MainWindow.BarText.NumFormat = 3
Recount:RefreshMainWindow()
me:RefreshTestBar()
else
this:SetChecked(true)
end
end)
theFrame.BarTextColorSwap = me:CreateSavedCheckbox(L["Swap Text and Bar Color"], theFrame, "Window", "BarTextColorSwap")
theFrame.BarTextColorSwap:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 8, -176 - 14)
theFrame.BarTextColorSwap:SetScript("OnClick", function(this)
if not this:GetChecked() then
this:SetChecked(false)
Recount.db.profile.BarTextColorSwap = false
Recount:UpdateBarTextColors()
Recount:RefreshMainWindow()
me:RefreshTestBar()
else
this:SetChecked(true)
Recount.db.profile.BarTextColorSwap = true
Recount:UpdateBarTextColors()
Recount:RefreshMainWindow()
me:RefreshTestBar()
end
end)
end
function me:CreateTextureSelection(parent)
me.TextureOptions = CreateFrame("Frame", nil, parent)
local theFrame = me.TextureOptions
local BarTextures = SM:List("statusbar")
SM:RegisterCallback("LibSharedMedia_Registered", me.RefreshStatusBars)
theFrame:SetHeight(parent:GetHeight() - 34)
theFrame:SetWidth(200)
theFrame:SetPoint("TOPLEFT", parent, "TOPLEFT", 400, -34)
--[[theFrame.Background = theFrame:CreateTexture(nil, "BACKGROUND")
theFrame.Background:SetAllPoints(theFrame)
theFrame.Background:SetColorTexture(0, 0, 0, 0.3)]]
theFrame.Title = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")