forked from EllesmereGaming/EllesmereUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEllesmereUI.lua
More file actions
10300 lines (9413 loc) · 451 KB
/
Copy pathEllesmereUI.lua
File metadata and controls
10300 lines (9413 loc) · 451 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
-------------------------------------------------------------------------------
-- EllesmereUI.lua - Custom Options Panel for EllesmereUI
-- Design-first scaffold: background, sidebar, header, content area, controls
-- Meant to be shared across the entire EllesmereUI addon suite.
-------------------------------------------------------------------------------
local EUI_HOST_ADDON = ...
-- IS_STANDALONE: true only when this core is running inside a standalone build.
-- The build renames "EllesmereUI" -> "EUICoreStandalone<Module>" but NEVER the
-- word "Standalone", so the host addon name contains "Standalone" iff standalone.
-- In the full suite EUI_HOST_ADDON == "EllesmereUI" (no match) -> always false,
-- so every IS_STANDALONE-gated branch below is inert in the suite.
local IS_STANDALONE = type(EUI_HOST_ADDON) == "string" and EUI_HOST_ADDON:find("Standalone") ~= nil
-------------------------------------------------------------------------------
-- Constants & Colours (BURNE STAY AWAY FROM THIS SECTION)
-------------------------------------------------------------------------------
-- Visual Settings (edit these to adjust the look -- values only, no tables)
-------------------------------------------------------------------------------
-- Accent colour (#0CD29D teal) -- canonical default
local DEFAULT_ACCENT_R, DEFAULT_ACCENT_G, DEFAULT_ACCENT_B = 12/255, 210/255, 157/255
-- Theme presets: { accentR, accentG, accentB, bgFile }
-- bgFile is relative to MEDIA_PATH (resolved later after MEDIA_PATH is defined)
local THEME_PRESETS = {
["EllesmereUI"] = { r = 12/255, g = 210/255, b = 157/255 }, -- #0CD29D
["Horde"] = { r = 255/255, g = 90/255, b = 31/255 }, -- #FF5A1F
["Alliance"] = { r = 63/255, g = 167/255, b = 255/255 }, -- #3FA7FF
["Faction (Auto)"] = nil, -- resolved at runtime to Horde or Alliance
["Midnight"] = { r = 120/255, g = 65/255, b = 200/255 }, -- #7841C8 deep purple void
["Dark"] = { r = 1, g = 1, b = 1 }, -- white accent
["Class Colored"] = nil, -- resolved at runtime from player class
["Custom Color"] = nil, -- user-chosen via color picker
}
local THEME_ORDER = { "EllesmereUI", "Horde", "Alliance", "Faction (Auto)", "Midnight", "Dark", "Class Colored", "Custom Color" }
-- Background file paths per theme (relative to MEDIA_PATH, in backgrounds/ subfolder)
local THEME_BG_FILES = {
["EllesmereUI"] = "backgrounds\\eui-bg-all-compressed.png",
["Horde"] = "backgrounds\\eui-bg-horde-compressed.png",
["Alliance"] = "backgrounds\\eui-bg-alliance-compressed.png",
["Midnight"] = "backgrounds\\eui-bg-midnight-compressed.png",
["Dark"] = "backgrounds\\eui-bg-dark-compressed.png",
["Class Colored"] = "backgrounds\\eui-bg-all-compressed.png",
["Custom Color"] = "backgrounds\\eui-bg-all-compressed.png",
}
--- Resolve "Faction (Auto)" to "Horde" or "Alliance" based on the player's faction.
--- For all other themes, returns the theme unchanged.
local function ResolveFactionTheme(theme)
if theme == "Faction (Auto)" then
local faction = UnitFactionGroup("player")
return (faction == "Horde") and "Horde" or "Alliance"
end
return theme
end
-- Preload background textures into GPU cache so the panel background
-- renders instantly on first open (avoids 1-frame content-before-bg flash).
-- Uses a hidden 1x1 frame; the textures stay in VRAM once loaded.
do
local mp = "Interface\\AddOns\\EllesmereUI\\media\\"
local preload = CreateFrame("Frame")
preload:SetSize(1, 1)
preload:SetPoint("TOPLEFT", UIParent, "TOPLEFT", -10000, 10000)
preload:Show()
for _, file in pairs(THEME_BG_FILES) do
local tex = preload:CreateTexture()
tex:SetTexture(mp .. file)
tex:SetAllPoints()
end
local baseTex = preload:CreateTexture()
baseTex:SetTexture(mp .. "backgrounds\\eui-bg.png")
baseTex:SetAllPoints()
end
-- EllesmereUIDB is initialized from SavedVariables at ADDON_LOADED time.
-- Do NOT create it here -- that would overwrite saved data. (Protection
-- against stale child SV copies lives in EllesmereUI_Lite.lua.)
-- Panel background
local PANEL_BG_R, PANEL_BG_G, PANEL_BG_B = 0.05, 0.07, 0.09
-- Global border (white + alpha -- adapts to any background tint)
local BORDER_R, BORDER_G, BORDER_B = 1, 1, 1
local BORDER_A = 0.05
-- Text (white + alpha -- adapts to any background tint)
local TEXT_WHITE_R, TEXT_WHITE_G, TEXT_WHITE_B = 1, 1, 1
local TEXT_DIM_R, TEXT_DIM_G, TEXT_DIM_B = 1, 1, 1
local TEXT_DIM_A = 0.53
local TEXT_SECTION_R, TEXT_SECTION_G, TEXT_SECTION_B = 1, 1, 1
local TEXT_SECTION_A = 0.41
-- Row alternating background alpha (black overlay on option rows)
local ROW_BG_ODD = 0.1
local ROW_BG_EVEN = 0.2
-- Slider (white + alpha for track -- adapts to any background tint)
local SL_TRACK_R, SL_TRACK_G, SL_TRACK_B = 1, 1, 1 -- track bg (white + alpha)
local SL_TRACK_A = 0.16 -- track bg alpha
local SL_FILL_A = 0.75 -- filled portion alpha (colour = accent)
local SL_INPUT_R, SL_INPUT_G, SL_INPUT_B = 0.02, 0.03, 0.04 -- input box background (darker than bg, stays as-is)
local SL_INPUT_A = 0.25 -- input box alpha (all sliders)
local SL_INPUT_BRD_A = 0.02 -- input box border alpha (white)
-- Multi-widget slider overrides (applied additively in BuildSliderCore)
local MW_INPUT_ALPHA_BOOST = 0.15 -- additive alpha boost for multi-widget input fields
local MW_TRACK_ALPHA_BOOST = 0.06 -- additive alpha boost for multi-widget slider track
-- Toggle (white + alpha for off states -- adapts to any background tint)
local TG_OFF_R, TG_OFF_G, TG_OFF_B = 0.267, 0.267, 0.267 -- track when OFF (#444)
local TG_OFF_A = 0.65 -- track OFF alpha
local TG_ON_A = 0.75 -- track alpha at full ON (colour = accent)
local TG_KNOB_OFF_R, TG_KNOB_OFF_G, TG_KNOB_OFF_B = 1, 1, 1 -- knob when OFF (white + alpha)
local TG_KNOB_OFF_A = 0.5 -- knob OFF alpha
local TG_KNOB_ON_R, TG_KNOB_ON_G, TG_KNOB_ON_B = 1, 1, 1 -- knob when ON
local TG_KNOB_ON_A = 1 -- knob ON alpha
-- Checkbox
local CB_BOX_R, CB_BOX_G, CB_BOX_B = 0.10, 0.12, 0.16 -- box background
local CB_BRD_A, CB_ACT_BRD_A = 0.05, 0.15 -- box border alpha / checked border alpha
-- Button / WideButton
local BTN_BG_R, BTN_BG_G, BTN_BG_B = 0.061, 0.095, 0.120 -- background
local BTN_BG_A = 0.6
local BTN_BG_HA = 0.65 -- background alpha hovered
local BTN_BRD_A = 0.3 -- border alpha (colour = white)
local BTN_BRD_HA = 0.45 -- border alpha hovered
local BTN_TXT_A = 0.55 -- text alpha (colour = white)
local BTN_TXT_HA = 0.70 -- text alpha hovered
-- Dropdown
local DD_BG_R, DD_BG_G, DD_BG_B = 0.075, 0.113, 0.141 -- background
local DD_BG_A = 0.9
local DD_BG_HA = 0.98 -- background alpha hovered
local DD_BRD_A = 0.20 -- border alpha (colour = white)
local DD_BRD_HA = 0.30 -- border alpha hovered
local DD_TXT_A = 0.50 -- selected value text alpha (colour = white)
local DD_TXT_HA = 0.60 -- selected value text alpha hovered
local DD_ITEM_HL_A = 0.08 -- menu item highlight alpha (hover)
local DD_ITEM_SEL_A = 0.04 -- menu item highlight alpha (active selection)
-- Sidebar nav (white + alpha -- adapts to any background tint)
-- NAV values inlined directly into NAV_* locals below to avoid an extra file-scope local
-- Multi-widget layout (dual = 2-up, triple = 3-up -- shared by all widget types)
local DUAL_ITEM_W = 350 -- width of each item in a 2-up row
local DUAL_GAP = 42 -- gap between 2-up items
local TRIPLE_ITEM_W = 180 -- width of each item in a 3-up row
local TRIPLE_GAP = 50 -- gap between 3-up items
-- Color swatch border (packed into table)
local CS = {
BRD_THICK = 1, SAT_THRESH = 0.25, CHROMA_MIN = 0.15,
SOLID_R = 1, SOLID_G = 1, SOLID_B = 1, SOLID_A = 1,
}
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Derived / Internal (built from visual settings -- no need to edit below)
-------------------------------------------------------------------------------
local ELLESMERE_GREEN
do
-- NOTE: CLASS_COLOR_MAP is defined below, so at file-parse time we can only
-- resolve preset themes. Class/Custom themes are fully resolved in PLAYER_LOGIN.
local db = EllesmereUIDB or {}
local theme = ResolveFactionTheme(db.activeTheme or "EllesmereUI")
local r, g, b
if theme == "Custom Color" then
local sa = db.accentColor
r, g, b = sa and sa.r or DEFAULT_ACCENT_R, sa and sa.g or DEFAULT_ACCENT_G, sa and sa.b or DEFAULT_ACCENT_B
else
local preset = THEME_PRESETS[theme]
if preset then
r, g, b = preset.r, preset.g, preset.b
else
r, g, b = DEFAULT_ACCENT_R, DEFAULT_ACCENT_G, DEFAULT_ACCENT_B
end
end
ELLESMERE_GREEN = { r = r, g = g, b = b, _themeEnabled = true }
end
-- Registry for one-time accent-colored elements (sidebar indicators, glows,
-- tab underlines, footer buttons, popup confirm button, etc.)
-- Each entry is { type="solid"|"gradient"|"font"|"callback", obj=..., ... }
local _accentElements = { _idx = {} } -- _idx: obj -> index, prevents duplicates
local function RegAccent(entry)
local key = entry.obj or entry.fn
if key and _accentElements._idx[key] then
_accentElements[_accentElements._idx[key]] = entry
else
_accentElements[#_accentElements + 1] = entry
if key then _accentElements._idx[key] = #_accentElements end
end
end
local DARK_BG = { r = PANEL_BG_R, g = PANEL_BG_G, b = PANEL_BG_B }
local BORDER_COLOR = { r = BORDER_R, g = BORDER_G, b = BORDER_B, a = BORDER_A }
local TEXT_WHITE = { r = TEXT_WHITE_R, g = TEXT_WHITE_G, b = TEXT_WHITE_B }
local TEXT_DIM = { r = TEXT_DIM_R, g = TEXT_DIM_G, b = TEXT_DIM_B, a = TEXT_DIM_A }
local TEXT_SECTION = { r = TEXT_SECTION_R, g = TEXT_SECTION_G, b = TEXT_SECTION_B, a = TEXT_SECTION_A }
-- Sidebar nav states
local NAV_SELECTED_TEXT = { r = TEXT_WHITE_R, g = TEXT_WHITE_G, b = TEXT_WHITE_B, a = 1 }
local NAV_SELECTED_ICON_A = 1
local NAV_ENABLED_TEXT = { r = TEXT_WHITE_R, g = TEXT_WHITE_G, b = TEXT_WHITE_B, a = 0.6 }
local NAV_ENABLED_ICON_A = 0.60
local NAV_DISABLED_TEXT = { r = 1, g = 1, b = 1, a = 0.11 }
local NAV_DISABLED_ICON_A = 0.20
local NAV_HOVER_ENABLED_TEXT = { r = 1, g = 1, b = 1, a = 0.86 }
local NAV_HOVER_DISABLED_TEXT = { r = 1, g = 1, b = 1, a = 0.39 }
-- Dropdown widget colours: widgets reference DD_BG_*, DD_BRD_*, DD_TXT_* directly
local BG_WIDTH, BG_HEIGHT = 1500, 1154
local CLICK_W, CLICK_H = 1300, 946
local SIDEBAR_W = 295
local HEADER_H = 138 -- title + desc + banner glow + dark band for tabs
local TAB_BAR_H = 40
local FOOTER_H = 82
local CONTENT_PAD = 45
local CONTENT_HEADER_TOP_PAD = 10 -- extra top padding on scroll content when header is present
-- Paths (media lives in EllesmereUI/media inside the parent addon folder)
local ADDON_PATH = "Interface\\AddOns\\" .. EUI_HOST_ADDON .. "\\"
local MEDIA_PATH = "Interface\\AddOns\\EllesmereUI\\media\\"
local _, playerClass = UnitClass("player")
local CLASS_ART_MAP = {
DEATHKNIGHT = "dk.png",
DEMONHUNTER = "dh.png",
DRUID = "druid.png",
EVOKER = "evoker.png",
HUNTER = "hunter.png",
MAGE = "mage.png",
MONK = "monk.png",
PALADIN = "paladin.png",
PRIEST = "priest.png",
ROGUE = "rogue.png",
SHAMAN = "shaman.png",
WARLOCK = "warlock.png",
WARRIOR = "warrior.png",
}
-- Official WoW class colors (from RAID_CLASS_COLORS)
local CLASS_COLOR_MAP = {
DEATHKNIGHT = { r = 0.77, g = 0.12, b = 0.23 }, -- #C41E3A
DEMONHUNTER = { r = 0.64, g = 0.19, b = 0.79 }, -- #A330C9
DRUID = { r = 1.00, g = 0.49, b = 0.04 }, -- #FF7C0A
EVOKER = { r = 0.20, g = 0.58, b = 0.50 }, -- #33937F
HUNTER = { r = 0.67, g = 0.83, b = 0.45 }, -- #AAD372
MAGE = { r = 0.25, g = 0.78, b = 0.92 }, -- #3FC7EB
MONK = { r = 0.00, g = 1.00, b = 0.60 }, -- #00FF98
PALADIN = { r = 0.96, g = 0.55, b = 0.73 }, -- #F48CBA
PRIEST = { r = 1.00, g = 1.00, b = 1.00 }, -- #FFFFFF
ROGUE = { r = 1.00, g = 0.96, b = 0.41 }, -- #FFF468
SHAMAN = { r = 0.00, g = 0.44, b = 0.87 }, -- #0070DD
WARLOCK = { r = 0.53, g = 0.53, b = 0.93 }, -- #8788EE
WARRIOR = { r = 0.78, g = 0.61, b = 0.43 }, -- #C69B6D
}
-- Font (Expressway lives in EllesmereUI/media)
local EXPRESSWAY = MEDIA_PATH .. "fonts\\Expressway.ttf"
-- Locale-specific system font fallback for clients whose language requires
-- glyphs not present in our custom fonts (CJK, Cyrillic, etc.). Resolved by
-- EllesmereUI_Locale.lua from the effective display locale (the client locale,
-- or the user's manual language override) so the override drives glyph fonts
-- too. nil on Western Latin locales -> callers keep the bundled Expressway.
local LOCALE_FONT_FALLBACK = _G.EllesmereUI and _G.EllesmereUI._localeFont or nil
-------------------------------------------------------------------------------
-- Addon Roster -- per-addon icon on/off from EllesmereUI/media
-------------------------------------------------------------------------------
local ICONS_PATH = MEDIA_PATH .. "icons\\"
local ADDON_ROSTER = {
{ folder = "EllesmereUIActionBars", display = "Action Bars", search_name = "EllesmereUI Action Bars", icon_on = ICONS_PATH .. "sidebar\\actionbars-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\actionbars-ig.png" },
{ folder = "EllesmereUINameplates", display = "Nameplates", search_name = "EllesmereUI Nameplates", icon_on = ICONS_PATH .. "sidebar\\nameplates-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\nameplates-ig.png" },
{ folder = "EllesmereUIUnitFrames", display = "Unit Frames", search_name = "EllesmereUI Unit Frames", icon_on = ICONS_PATH .. "sidebar\\unitframes-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\unitframes-ig.png" },
{ folder = "EllesmereUIRaidFrames", display = "Raid Frames", search_name = "EllesmereUI Raid Frames", icon_on = ICONS_PATH .. "sidebar\\raidframes-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\raidframes-ig.png" },
{ folder = "EllesmereUICooldownManager", display = "Cooldown Manager", search_name = "EllesmereUI Cooldown Manager", icon_on = ICONS_PATH .. "sidebar\\cdmeffects-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\cdmeffects-ig.png" },
{ folder = "EllesmereUIResourceBars", display = "Resource & Cast Bars", search_name = "EllesmereUI Resource Bars Cast Bars", icon_on = ICONS_PATH .. "sidebar\\resourcebars-ig-on-2.png", icon_off = ICONS_PATH .. "sidebar\\resourcebars-ig-2.png" },
{ folder = "EllesmereUIAuraBuffReminders", display = "AuraBuff Reminders", search_name = "EllesmereUI AuraBuff Reminders", icon_on = ICONS_PATH .. "sidebar\\beacons-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\beacons-ig.png" },
-- Basics is intentionally NOT in the roster: its code has been split into
-- the per-module addons below. The Basics folder still exists as a shim
-- addon purely so the v6.6 split-migration can read its enable state.
{ folder = "EllesmereUIQoL", display = "Quality of Life", search_name = "EllesmereUI Quality of Life", icon_on = ICONS_PATH .. "sidebar\\basics-ig-on-2.png", icon_off = ICONS_PATH .. "sidebar\\basics-ig-2.png" },
{ folder = "EllesmereUIBlizzardSkin", display = "Blizz UI Enhanced", search_name = "EllesmereUI Blizz UI Enhanced", icon_on = ICONS_PATH .. "sidebar\\blizzard-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\blizzard-ig.png" },
{ folder = "EllesmereUIFriends", display = "Friends List", search_name = "EllesmereUI Friends List", icon_on = ICONS_PATH .. "sidebar\\friends-ig-on-2.png", icon_off = ICONS_PATH .. "sidebar\\friends-ig-2.png" },
{ folder = "EllesmereUIMythicTimer", display = "Mythic+ Timer", search_name = "EllesmereUI Mythic+ Timer", icon_on = ICONS_PATH .. "sidebar\\mplus-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\mplus-ig.png" },
{ folder = "EllesmereUIQuestTracker", display = "Quest Tracker", search_name = "EllesmereUI Quest Tracker", icon_on = ICONS_PATH .. "sidebar\\quests-ig-on-2.png", icon_off = ICONS_PATH .. "sidebar\\quests-ig-2.png" },
{ folder = "EllesmereUIMinimap", display = "Minimap", search_name = "EllesmereUI Minimap", icon_on = ICONS_PATH .. "sidebar\\map-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\map-ig.png" },
{ folder = "EllesmereUIChat", display = "Chat", search_name = "EllesmereUI Chat", icon_on = ICONS_PATH .. "sidebar\\basics-ig-on-2.png", icon_off = ICONS_PATH .. "sidebar\\basics-ig-2.png" },
{ folder = "EllesmereUIDamageMeters", display = "Damage Meters", search_name = "EllesmereUI Damage Meters", icon_on = ICONS_PATH .. "sidebar\\basics-ig-on-2.png", icon_off = ICONS_PATH .. "sidebar\\basics-ig-2.png" },
{ folder = "EllesmereUIBags", display = "Bags", search_name = "EllesmereUI Bags", icon_on = ICONS_PATH .. "sidebar\\basics-ig-on-2.png", icon_off = ICONS_PATH .. "sidebar\\basics-ig-2.png" },
{ folder = "EllesmereUIPartyMode", display = "Party Mode", search_name = "EllesmereUI Party Mode", icon_on = ICONS_PATH .. "sidebar\\partymode-ig-on.png", icon_off = ICONS_PATH .. "sidebar\\partymode-ig.png", alwaysLoaded = true },
}
-------------------------------------------------------------------------------
-- Addon Groups -- ordered categories that drive the sidebar layout.
-- Each group has its own parent header (icon + label, no power toggle); the
-- listed members render as child rows beneath it (label + power only, no
-- left icon). Member order is authoritative -- coming-soon entries are
-- placed at the end of their group.
-------------------------------------------------------------------------------
-- Stored on EllesmereUI (no file-level local) to stay under Lua 5.1's main-chunk
-- 200-locals and CreateMainFrame's 60-upvalue limits -- EllesmereUI is already
-- captured elsewhere, so every reference here adds no new local or upvalue.
EllesmereUI.ADDON_GROUPS = {
{
key = "core",
label = "Core Addons",
icon_on = ICONS_PATH .. "sidebar\\actionbars-ig-on.png",
icon_off = ICONS_PATH .. "sidebar\\actionbars-ig.png",
members = {
"EllesmereUIActionBars",
"EllesmereUINameplates",
"EllesmereUIUnitFrames",
"EllesmereUICooldownManager",
"EllesmereUIResourceBars",
"EllesmereUIRaidFrames",
},
},
{
key = "qol",
label = "QoL Addons",
icon_on = ICONS_PATH .. "sidebar\\basics-ig-on-2.png",
icon_off = ICONS_PATH .. "sidebar\\basics-ig-2.png",
members = {
"EllesmereUIQoL",
"EllesmereUIAuraBuffReminders",
"EllesmereUIPartyMode",
},
},
{
key = "reskin",
label = "UI Reskin Addons",
icon_on = ICONS_PATH .. "sidebar\\friends-ig-on-2.png",
icon_off = ICONS_PATH .. "sidebar\\friends-ig-2.png",
members = {
"EllesmereUIBlizzardSkin",
"EllesmereUIDamageMeters",
"EllesmereUIMythicTimer",
"EllesmereUIQuestTracker",
"EllesmereUIFriends",
"EllesmereUIMinimap",
"EllesmereUIChat",
"EllesmereUIBags",
},
},
}
-- STANDALONE override: a standalone build bundles exactly one module, and its
-- folder is the only roster entry whose name contains "Standalone" (the build's
-- EllesmereUI->EUICoreStandalone<X> rename turns every roster/group reference
-- into that token, but the actual installed module folder is "EUIStandalone<X>").
-- We KEEP the full sidebar (so users still see everything the suite offers) but
-- PREPEND a "Standalone" category above Core Addons containing this build's
-- module, and REMOVE that module from its normal category so it isn't listed
-- twice. Inert in the suite (IS_STANDALONE false).
if IS_STANDALONE then
local selfFolder
for _, info in ipairs(ADDON_ROSTER) do
-- The module's own folder keeps the "Standalone" word; the renamed core
-- token is "EUICoreStandalone<X>", so exclude "Core" to find the module.
if info.folder:find("Standalone") and not info.folder:find("Core") then
selfFolder = info.folder
break
end
end
if selfFolder then
-- Drop the module from whatever group currently lists it.
for _, group in ipairs(EllesmereUI.ADDON_GROUPS) do
for mi = #group.members, 1, -1 do
if group.members[mi] == selfFolder then
table.remove(group.members, mi)
end
end
end
-- Prepend the Standalone group above the rest.
table.insert(EllesmereUI.ADDON_GROUPS, 1, {
key = "standalone",
label = "Standalone",
icon_on = ICONS_PATH .. "sidebar\\basics-ig-on-2.png",
icon_off = ICONS_PATH .. "sidebar\\basics-ig-2.png",
members = { selfFolder },
})
end
end
-- Flat folder -> roster-info lookup used by the grouped sidebar builder.
-- Stored on EllesmereUI (not a file-level local) to avoid adding a new
-- upvalue to CreateMainFrame, which is up against Lua 5.1's 60-upvalue limit.
EllesmereUI._addonInfoByFolder = {}
for _, info in ipairs(ADDON_ROSTER) do
EllesmereUI._addonInfoByFolder[info.folder] = info
end
local function IsAddonLoaded(name)
if C_AddOns and C_AddOns.IsAddOnLoaded then return C_AddOns.IsAddOnLoaded(name)
elseif IsAddOnLoaded then return IsAddOnLoaded(name) end
return false
end
-------------------------------------------------------------------------------
-- Profile Sync System (mirror groups)
-- Per-module sync groups. A module's sync set is a MEMBERSHIP group: the
-- popup writes the configuring profile into the group alongside the
-- selected ones. Sync is two-way: whichever member is active pushes a
-- selective copy of its data to the other members on sync click, on
-- logout, and on a settings-changed profile switch. Profiles outside the
-- group never push into it.
--
-- Storage: EllesmereUIDB.syncedModules = { [folder] = { [profileName] = true } }
-- Exclusions: EllesmereUI._syncExclusions[folder] = { key = true, ... }
-- Nested exclusions use dot notation: "bars.*.growDirection" means skip
-- growDirection inside any sub-table of bars.
-------------------------------------------------------------------------------
do
-- Modules that should NOT get a sync icon (no per-profile settings)
local SYNC_EXEMPT = { EllesmereUIPartyMode = true }
EllesmereUI._syncExempt = SYNC_EXEMPT
-- Modules that show a sync icon but have no per-profile data (always "synced")
local SYNC_GLOBAL_ONLY = { EllesmereUIBlizzardSkin = true }
EllesmereUI._syncGlobalOnly = SYNC_GLOBAL_ONLY
-- Exclusion registry: keys that should NOT be copied during sync
-- Flat keys: "barPositions" = skip top-level key
-- Wildcard nested: "bars.*.growDirection" = skip growDirection in any bars sub-table
local syncExclusions = {}
EllesmereUI._syncExclusions = syncExclusions
function EllesmereUI.RegisterSyncExclusions(folder, keys)
if not syncExclusions[folder] then syncExclusions[folder] = {} end
local ex = syncExclusions[folder]
for _, k in ipairs(keys) do
ex[k] = true
end
end
-- Selective deep-copy: copies src but skips excluded keys.
-- exclusions is a set of strings. Flat keys ("barPositions") skip that key.
-- Wildcard keys ("bars.*.growDirection") skip growDirection inside any
-- sub-table of the "bars" key.
local function SelectiveCopy(src, exclusions, parentPath)
if type(src) ~= "table" then return src end
local copy = {}
for k, v in pairs(src) do
local keyStr = tostring(k)
local fullKey = parentPath and (parentPath .. "." .. keyStr) or keyStr
-- Check flat exclusion
if not exclusions[fullKey] then
if type(v) == "table" then
-- Check if this is a wildcard parent (e.g. "bars" in "bars.*.X")
local isWildcardParent = false
local childExclusions = nil
for exKey in pairs(exclusions) do
local prefix, childKey = exKey:match("^(.-)%.%*%.(.+)$")
-- Full-path match only: a nested table that merely
-- shares the prefix's bare name must not be treated
-- as a wildcard parent
if prefix and fullKey == prefix then
isWildcardParent = true
if not childExclusions then childExclusions = {} end
childExclusions[childKey] = true
end
end
if isWildcardParent and childExclusions then
-- Copy the container but apply child exclusions to each sub-table
local containerCopy = {}
for ck, cv in pairs(v) do
if type(cv) == "table" then
local subCopy = {}
for sk, sv in pairs(cv) do
if not childExclusions[tostring(sk)] then
if type(sv) == "table" then
subCopy[sk] = SelectiveCopy(sv, {})
else
subCopy[sk] = sv
end
end
end
containerCopy[ck] = subCopy
else
containerCopy[ck] = cv
end
end
copy[k] = containerCopy
else
copy[k] = SelectiveCopy(v, exclusions, fullKey)
end
else
copy[k] = v
end
end
end
return copy
end
EllesmereUI._SelectiveCopy = SelectiveCopy
-- Exclusion-aware deep overlay used when the destination already has data.
-- Writes src into dst leaf-by-leaf wherever an exclusion path touches the
-- subtree, so excluded keys (flat, dotted, or wildcard) keep the
-- destination's values. Subtrees that no exclusion touches are replaced
-- wholesale. Replacing a parent table whole when only a child key is
-- excluded would delete the destination's excluded value with it.
function EllesmereUI._SelectiveOverlay(src, dst, exclusions, deepCopy, parentPath)
for k, v in pairs(src) do
local keyStr = tostring(k)
local fullKey = parentPath and (parentPath .. "." .. keyStr) or keyStr
if not exclusions[fullKey] then
if type(v) == "table" then
-- Wildcard parent (e.g. "bars" in "bars.*.growDirection")
-- and/or dotted exclusions deeper in this subtree
local childExclusions = nil
local hasNested = false
for exKey in pairs(exclusions) do
local prefix, childKey = exKey:match("^(.-)%.%*%.(.+)$")
-- Full-path match only (same rule as SelectiveCopy)
if prefix and fullKey == prefix then
if not childExclusions then childExclusions = {} end
childExclusions[childKey] = true
elseif exKey:sub(1, #fullKey + 1) == (fullKey .. ".") then
hasNested = true
end
end
if childExclusions then
-- Merge each sub-table, preserving excluded child keys
if type(dst[k]) ~= "table" then dst[k] = {} end
local dstContainer = dst[k]
for ck, cv in pairs(v) do
if type(cv) == "table" then
if type(dstContainer[ck]) ~= "table" then dstContainer[ck] = {} end
local dstSub = dstContainer[ck]
for sk, sv in pairs(cv) do
if not childExclusions[tostring(sk)] then
dstSub[sk] = type(sv) == "table" and deepCopy(sv) or sv
end
end
else
dstContainer[ck] = cv
end
end
elseif hasNested then
if type(dst[k]) ~= "table" then dst[k] = {} end
EllesmereUI._SelectiveOverlay(v, dst[k], exclusions, deepCopy, fullKey)
else
dst[k] = deepCopy(v)
end
else
dst[k] = v
end
end
end
end
-- Check if a specific profile is synced for a module
function EllesmereUI.IsProfileSynced(folder, profileName)
if not EllesmereUIDB then return false end
local sm = EllesmereUIDB.syncedModules
if not sm or not sm[folder] then return false end
local targets = sm[folder]
return type(targets) == "table" and targets[profileName] == true
end
-- Get the set of synced profiles for a module
function EllesmereUI.GetSyncedProfiles(folder)
if not EllesmereUIDB or not EllesmereUIDB.syncedModules then return {} end
local targets = EllesmereUIDB.syncedModules[folder]
if type(targets) == "table" then return targets end
return {}
end
-- Check if a module is fully synced across all profiles.
-- Sync sets are mirror groups: the popup writes the configuring profile
-- into the group alongside the selected ones, so fully synced means
-- EVERY profile is a member. Computed active-INDEPENDENTLY (never keyed
-- off EllesmereUIDB.activeProfile, which resolves per character/spec)
-- so the icon reads the same on every character.
function EllesmereUI.IsModuleFullySynced(folder)
if not EllesmereUIDB or not EllesmereUIDB.syncedModules or not EllesmereUIDB.profiles then return false end
local targets = EllesmereUIDB.syncedModules[folder]
if type(targets) ~= "table" then return false end
local total = 0
for name in pairs(EllesmereUIDB.profiles) do
total = total + 1
if not targets[name] then return false end
end
return total > 1
end
-- Check if ANY profile is synced for a module (for icon state)
function EllesmereUI.IsModuleSynced(folder)
if not EllesmereUIDB or not EllesmereUIDB.syncedModules then return false end
local targets = EllesmereUIDB.syncedModules[folder]
if type(targets) ~= "table" then return false end
for _, v in pairs(targets) do if v then return true end end
return false
end
-- Sync one module from active profile to specific target profiles
function EllesmereUI.SyncModuleToProfiles(folder, targetProfiles)
if not EllesmereUIDB or not EllesmereUIDB.profiles then return end
local active = EllesmereUIDB.activeProfile or "Default"
local src = EllesmereUIDB.profiles[active]
if not src or not src.addons or not src.addons[folder] then return end
local DeepCopy = EllesmereUI.Lite and EllesmereUI.Lite.DeepCopy
if not DeepCopy then return end
local exclusions = syncExclusions[folder]
for profName in pairs(targetProfiles) do
if profName ~= active then
local prof = EllesmereUIDB.profiles[profName]
if prof then
if not prof.addons then prof.addons = {} end
if exclusions and next(exclusions) then
local dst = prof.addons[folder]
if not dst then
-- First sync to this profile: no dest values to preserve
prof.addons[folder] = SelectiveCopy(src.addons[folder], exclusions)
else
-- Overlay leaf-by-leaf so excluded keys (including
-- nested and wildcard paths) keep the dest's values
EllesmereUI._SelectiveOverlay(src.addons[folder], dst, exclusions, DeepCopy)
end
else
-- Full blob copy (no exclusions)
prof.addons[folder] = DeepCopy(src.addons[folder])
end
end
end
end
end
-- Set the sync group for a module and execute an initial push
function EllesmereUI.SetModuleSyncTargets(folder, targetProfiles)
if not EllesmereUIDB then return end
if not EllesmereUIDB.syncedModules then EllesmereUIDB.syncedModules = {} end
EllesmereUIDB.syncedModules[folder] = targetProfiles
EllesmereUI.SyncModuleToProfiles(folder, targetProfiles)
end
-- Equalize a module across group members from an explicit source
-- profile (the "seed"). Non-active destinations get the standard
-- selective copy. The ACTIVE profile, when it is a destination, is
-- written IN PLACE so live db.profile references stay valid, then
-- defaults are re-merged (stored blobs are sparse) and the UI is
-- refreshed. Excluded (layout) keys keep each destination's values.
function EllesmereUI.SyncModuleFromProfile(folder, srcName, targets)
if not EllesmereUIDB or not EllesmereUIDB.profiles then return end
local active = EllesmereUIDB.activeProfile or "Default"
if srcName == active then
EllesmereUI.SyncModuleToProfiles(folder, targets)
return
end
local DeepCopy = EllesmereUI.Lite and EllesmereUI.Lite.DeepCopy
if not DeepCopy then return end
local srcProf = EllesmereUIDB.profiles[srcName]
local srcData = srcProf and srcProf.addons and srcProf.addons[folder]
if not srcData then return end
local exclusions = syncExclusions[folder]
for profName in pairs(targets) do
if profName ~= srcName then
local prof = EllesmereUIDB.profiles[profName]
if prof then
if not prof.addons then prof.addons = {} end
local dst = prof.addons[folder]
if profName == active then
-- Live profile: adopt in place, never replace the table
if type(dst) ~= "table" then
dst = {}
prof.addons[folder] = dst
end
if exclusions and next(exclusions) then
EllesmereUI._SelectiveOverlay(srcData, dst, exclusions, DeepCopy)
else
wipe(dst)
for k, v in pairs(srcData) do
dst[k] = type(v) == "table" and DeepCopy(v) or v
end
end
elseif not (exclusions and next(exclusions)) then
prof.addons[folder] = DeepCopy(srcData)
elseif type(dst) == "table" then
EllesmereUI._SelectiveOverlay(srcData, dst, exclusions, DeepCopy)
else
prof.addons[folder] = SelectiveCopy(srcData, exclusions)
end
end
end
end
if targets[active] then
-- Re-merge defaults into the adopted live table, then refresh
-- the addons and any open options page
local reg = EllesmereUI.Lite._dbRegistry
if reg then
for _, rdb in ipairs(reg) do
if rdb.folder == folder then
if rdb._profileDefaults and rdb.profile then
EllesmereUI.Lite.DeepMergeDefaults(rdb.profile, rdb._profileDefaults)
end
break
end
end
end
if EllesmereUI.RefreshAllAddons then
EllesmereUI.RefreshAllAddons()
end
if EllesmereUI.RefreshPage then
EllesmereUI:RefreshPage()
end
end
end
-- Pre-logout: push synced module data to the other group members.
-- Mirror-group rule: only a profile that is a MEMBER of a module's sync
-- group pushes. A profile outside the group must never overwrite the
-- members' data, no matter what is active at logout.
local initFrame = CreateFrame("Frame")
initFrame:RegisterEvent("PLAYER_LOGIN")
initFrame:SetScript("OnEvent", function(self)
self:UnregisterAllEvents()
if EllesmereUI.Lite and EllesmereUI.Lite.RegisterPreLogout then
EllesmereUI.Lite.RegisterPreLogout(function()
if not EllesmereUIDB or not EllesmereUIDB.syncedModules then return end
local active = EllesmereUIDB.activeProfile or "Default"
for folder, targets in pairs(EllesmereUIDB.syncedModules) do
if type(targets) == "table" and targets[active] then
EllesmereUI.SyncModuleToProfiles(folder, targets)
end
end
end)
end
end)
end
-------------------------------------------------------------------------------
-- Sync Exclusions per Module
-- Keys listed here are NOT copied when syncing a module between profiles.
-- Wildcard "parent.*.key" skips that key inside every sub-table of parent.
-------------------------------------------------------------------------------
EllesmereUI.RegisterSyncExclusions("EllesmereUIActionBars", {
"barPositions",
"bars.*.growDirection",
"bars.*.orientation",
"bars.*.buttonWidth",
"bars.*.buttonHeight",
"bars.*.targetWidth",
"bars.*.targetHeight",
"bars.*.width",
"bars.*.height",
"bars.*.overrideNumIcons",
"bars.*.overrideNumRows",
"bars.*.numIcons",
"bars.*.numRows",
})
EllesmereUI.RegisterSyncExclusions("EllesmereUIUnitFrames", {
"positions",
"player.frameWidth", "player.healthHeight",
"target.frameWidth", "target.healthHeight",
"playerTarget.frameWidth", "playerTarget.healthHeight",
"targettarget.frameWidth", "targettarget.healthHeight",
"focustarget.frameWidth", "focustarget.healthHeight",
"pet.frameWidth", "pet.healthHeight",
"focus.frameWidth", "focus.healthHeight",
"boss.frameWidth", "boss.healthHeight",
})
EllesmereUI.RegisterSyncExclusions("EllesmereUICooldownManager", {
"cdmBarPositions",
"cdmBars.bars.*.iconSize",
"cdmBars.bars.*.numRows",
"cdmBars.bars.*.spacing",
"cdmBars.bars.*.verticalOrientation",
"cdmBars.bars.*.anchorTo",
"cdmBars.bars.*.anchorPosition",
"cdmBars.bars.*.anchorOffsetX",
"cdmBars.bars.*.anchorOffsetY",
"cdmBars.bars.*.keybindOffsetX",
"cdmBars.bars.*.keybindOffsetY",
})
EllesmereUI.RegisterSyncExclusions("EllesmereUIResourceBars", {
"health.width", "health.height", "health.offsetX", "health.offsetY", "health.orientation",
"primary.width", "primary.height", "primary.offsetX", "primary.offsetY", "primary.orientation",
"secondary.pipWidth", "secondary.pipHeight", "secondary.pipSpacing", "secondary.pipOrientation",
"secondary.offsetX", "secondary.offsetY",
"castBar.width", "castBar.height", "castBar.anchorX", "castBar.anchorY", "castBar.unlockPos",
"totemBar.iconSize", "totemBar.spacing", "totemBar.unlockPos",
"general.anchorX", "general.anchorY", "general.orientation",
})
EllesmereUI.RegisterSyncExclusions("EllesmereUIAuraBuffReminders", {
"unlockPos",
"display.xOffset", "display.yOffset",
})
EllesmereUI.RegisterSyncExclusions("EllesmereUIRaidFrames", {
"unlockPos",
})
EllesmereUI.RegisterSyncExclusions("EllesmereUIMythicTimer", {
"standalonePos",
"scale",
"frameWidth",
})
-------------------------------------------------------------------------------
-- Sync Popup
-- Anchored flush to the right edge of the sidebar, centered vertically on
-- the sync icon that was clicked, clamped to the EUI window bottom.
-------------------------------------------------------------------------------
do
local _syncPopup = nil
function EllesmereUI.CloseSyncPopup()
if _syncPopup then _syncPopup:Hide() end
if EllesmereUI._syncConfirmFrame then EllesmereUI._syncConfirmFrame:Hide() end
end
-- Seed-picker confirmation for creating/updating a sync group: the user
-- chooses which member profile's settings the group starts from. After
-- that first equalization the group is a mirror -- any member that is
-- active pushes its changes to the others.
function EllesmereUI._ShowSyncSeedConfirm(opts)
local fontPath = (EllesmereUI.GetFontPath and EllesmereUI.GetFontPath()) or "Fonts\\FRIZQT__.TTF"
local PP = EllesmereUI.PanelPP or EllesmereUI.PP
local W, PAD = 360, 18
if not EllesmereUI._syncConfirmFrame then
local nf = CreateFrame("Frame", nil, UIParent)
nf:SetFrameStrata("FULLSCREEN_DIALOG")
-- Below 200: the shared dropdown menu frame is hardcoded at
-- level 200 and must render above this popup
nf:SetFrameLevel(150)
nf:EnableMouse(true)
local bg = nf:CreateTexture(nil, "BACKGROUND")
bg:SetAllPoints(); bg:SetColorTexture(15/255, 17/255, 22/255, 1)
nf._bg = bg
-- Fullscreen dimmer: darkens and click-blocks everything behind
local dim = CreateFrame("Frame", nil, UIParent)
dim:SetFrameStrata("FULLSCREEN_DIALOG")
dim:SetFrameLevel(140)
dim:SetAllPoints(UIParent)
dim:EnableMouse(true)
dim:Hide()
local dimTex = dim:CreateTexture(nil, "BACKGROUND")
dimTex:SetAllPoints(); dimTex:SetColorTexture(0, 0, 0, 0.55)
nf._dimmer = dim
nf:SetScript("OnHide", function(self) self._dimmer:Hide() end)
EllesmereUI._syncConfirmFrame = nf
end
local f = EllesmereUI._syncConfirmFrame
-- Clean old children/regions (recycled frame)
for _, c in ipairs({f:GetChildren()}) do c:Hide(); c:SetParent(nil) end
for _, r in ipairs({f:GetRegions()}) do
if r ~= f._bg then r:Hide(); r:SetParent(nil) end
end
local function MakeFont(parent, size, r, g, b, a)
local fs = parent:CreateFontString(nil, "OVERLAY")
if EllesmereUI and EllesmereUI.PrimeFontShadow then EllesmereUI.PrimeFontShadow(fs, true) end
fs:SetFont(fontPath, size, "")
fs:SetTextColor(r or 1, g or 1, b or 1, a or 1)
return fs
end
if PP then EllesmereUI.MakeBorder(f, 1, 1, 1, 0.15, PP) end
f:ClearAllPoints()
f:SetPoint("CENTER", UIParent, "CENTER", 0, 60)
local cy = -PAD
local title = MakeFont(f, 14, 1, 1, 1, 0.9)
title:SetPoint("TOP", f, "TOP", 0, cy)
title:SetText(EllesmereUI.L(opts.hadGroup and "Update Sync Group" or "Create Sync Group"))
cy = cy - 22 - 8
local msg = MakeFont(f, 11, 1, 1, 1, 0.6)
msg:SetPoint("TOP", f, "TOP", 0, cy)
msg:SetWidth(W - PAD * 2)
msg:SetJustifyH("CENTER")
msg:SetText(EllesmereUI.Lf("All selected profiles will keep their %1$s settings in sync: changes made on any of them carry over to the others. Choose which profile's settings the group starts from.", EllesmereUI.L(opts.displayName)))
cy = cy - (msg:GetStringHeight() or 42) - 14
local ddLabel = MakeFont(f, 11, 1, 1, 1, 0.5)
ddLabel:SetPoint("TOP", f, "TOP", 0, cy)
ddLabel:SetText(EllesmereUI.L("Sync settings from:"))
cy = cy - 16 - 6
local seedChoice = opts.defaultSeed
local ddValues = { _noLoc = true } -- profile names: never translate
for _, name in ipairs(opts.memberOrder) do ddValues[name] = name end
local DD_W = 190
local DD_SCALE = 0.85
local ddVisW = math.floor(DD_W * DD_SCALE + 0.5)
local ddVisH = math.floor(30 * DD_SCALE + 0.5)
local ddHolder = CreateFrame("Frame", nil, f)
ddHolder:SetSize(ddVisW, ddVisH)
ddHolder:SetPoint("TOP", f, "TOP", 0, cy)
ddHolder:SetFrameLevel(f:GetFrameLevel() + 1)
local ddBtn = EllesmereUI.BuildDropdownControl(ddHolder, DD_W, ddHolder:GetFrameLevel() + 1,
ddValues, opts.memberOrder,
function() return seedChoice end,
function(v) seedChoice = v end)
ddBtn:SetScale(DD_SCALE)
ddBtn:SetPoint("TOPLEFT", ddHolder, "TOPLEFT", 0, 0)
-- The menu is created lazily at UIParent scale; match it to the
-- scaled button once it exists
ddBtn:HookScript("OnClick", function(self)
if self._ddMenu and self._ddMenu:GetScale() ~= DD_SCALE then
self._ddMenu:SetScale(DD_SCALE)
end
end)
cy = cy - ddVisH - 14
if opts.hasWarning then
local warn = MakeFont(f, 10, 0.92, 0.3, 0.3, 1)
warn:SetPoint("TOP", f, "TOP", 0, cy)
warn:SetWidth(W - PAD * 2)
warn:SetJustifyH("CENTER")
warn:SetText(EllesmereUI.L("Position and size settings are not synced and keep each profile's own values."))
cy = cy - (warn:GetStringHeight() or 26) - 14
end
local function MakeBtn(label, r, g, b, a, hr, hg, hb)
local btn = CreateFrame("Button", nil, f)
btn:SetSize(120, 26)
btn:SetFrameLevel(f:GetFrameLevel() + 1)
local bgT = btn:CreateTexture(nil, "BACKGROUND")
bgT:SetAllPoints(); bgT:SetColorTexture(r, g, b, a)
local lbl = btn:CreateFontString(nil, "OVERLAY")
if EllesmereUI and EllesmereUI.PrimeFontShadow then EllesmereUI.PrimeFontShadow(lbl, false) end
lbl:SetFont(fontPath, 10, "")
lbl:SetTextColor(1, 1, 1, 1); lbl:SetPoint("CENTER"); lbl:SetText(label)
btn:SetScript("OnEnter", function() bgT:SetColorTexture(hr, hg, hb, 1) end)
btn:SetScript("OnLeave", function() bgT:SetColorTexture(r, g, b, a) end)
return btn
end
local cancelBtn = MakeBtn(EllesmereUI.L("Cancel"), 0.18, 0.19, 0.22, 0.9, 0.25, 0.26, 0.3)
cancelBtn:SetPoint("TOPRIGHT", f, "TOP", -6, cy)
local confirmBtn = MakeBtn(EllesmereUI.L("Sync"), 0.05, 0.52, 0.39, 0.8, 0.07, 0.62, 0.49)
confirmBtn:SetPoint("TOPLEFT", f, "TOP", 6, cy)
cy = cy - 26
f:SetSize(W, -cy + PAD)
confirmBtn:SetScript("OnClick", function()
f:Hide()
if not EllesmereUIDB.syncedModules then EllesmereUIDB.syncedModules = {} end
EllesmereUIDB.syncedModules[opts.folder] = opts.targets
if seedChoice then
EllesmereUI.SyncModuleFromProfile(opts.folder, seedChoice, opts.targets)
end
if opts.onDone then opts.onDone() end
end)
cancelBtn:SetScript("OnClick", function()
f:Hide()
if opts.onCancel then opts.onCancel() end
end)
f._dimmer:Show()
f:Show()
end
function EllesmereUI.OpenSyncPopup(folder, displayName, anchorBtn)
if EllesmereUI._syncConfirmFrame then EllesmereUI._syncConfirmFrame:Hide() end
-- Toggle off if already open for this module
if _syncPopup and _syncPopup:IsShown() and _syncPopup._folder == folder then
_syncPopup:Hide()
return
end
if not EllesmereUIDB or not EllesmereUIDB.profiles then return end
local active = EllesmereUIDB.activeProfile or "Default"
local profileOrder = EllesmereUIDB.profileOrder or {}
-- Build the full profile list (active included -- groups are
-- explicit membership lists): profileOrder first, stragglers after
local allProfiles = {}
for _, name in ipairs(profileOrder) do
if EllesmereUIDB.profiles[name] then
allProfiles[#allProfiles + 1] = name
end
end
for name in pairs(EllesmereUIDB.profiles) do
local found = false
for _, n in ipairs(allProfiles) do if n == name then found = true; break end end
if not found then allProfiles[#allProfiles + 1] = name end
end
if #allProfiles <= 1 then
if EllesmereUI.ShowWidgetTooltip then
EllesmereUI.ShowWidgetTooltip(anchorBtn, "No other profiles to sync to")
C_Timer.After(1.5, function() EllesmereUI.HideWidgetTooltip() end)
end