-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathNSUI.lua
More file actions
553 lines (499 loc) · 26.6 KB
/
Copy pathNSUI.lua
File metadata and controls
553 lines (499 loc) · 26.6 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
local addonId, NSI = ...
local DF = _G["DetailsFramework"]
local function GetLocalizedText(key)
return NSI:Loc(key)
end
-- Get references from Core module
local Core = NSI.UI.Core
local NSUI = Core.NSUI
local window_width = Core.window_width
local window_height = Core.window_height
local content_width = Core.content_width
local content_height = Core.content_height
local TAB_HEADER_HEIGHT = Core.TAB_HEADER_HEIGHT
local tab_content_height = Core.tab_content_height
local authorsString = Core.authorsString
local options_text_template = Core.options_text_template
local options_dropdown_template = Core.options_dropdown_template
local options_switch_template = Core.options_switch_template
local options_slider_template = Core.options_slider_template
local options_button_template = Core.options_button_template
-- Get UI builder functions from modules
local BuildEncounterAlertsUI = NSI.UI.EncounterAlerts.BuildEncounterAlertsUI
local BuildVersionCheckUI = NSI.UI.VersionCheck.BuildVersionCheckUI
local BuildNicknameEditUI = NSI.UI.Nicknames.BuildNicknameEditUI
local BuildRemindersEditUI = NSI.UI.Reminders.BuildRemindersEditUI
local BuildPersonalRemindersEditUI = NSI.UI.Reminders.BuildPersonalRemindersEditUI
local BuildCooldownsEditUI = NSI.UI.Cooldowns.BuildCooldownsEditUI
local BuildPASoundEditUI = NSI.UI.PrivateAuras.BuildPASoundEditUI
local BuildExportStringUI = NSI.UI.General.BuildExportStringUI
local BuildImportStringUI = NSI.UI.General.BuildImportStringUI
local BuildGroupExportUI = NSI.UI.General.BuildGroupExportUI
-- Get options builders from modules
local BuildGeneralOptions = NSI.UI.Options.General.BuildOptions
local BuildGeneralCallback = NSI.UI.Options.General.BuildCallback
local BuildLanguageSelector = NSI.UI.Options.General.BuildLanguageSelector
local BuildNicknamesOptions = NSI.UI.Options.Nicknames.BuildOptions
local BuildNicknamesCallback = NSI.UI.Options.Nicknames.BuildCallback
local BuildReminderOptions = NSI.UI.Options.Reminders.BuildOptions
local BuildReminderNoteOptions = NSI.UI.Options.Reminders.BuildNoteOptions
local BuildReminderCallback = NSI.UI.Options.Reminders.BuildCallback
local BuildReminderNoteCallback = NSI.UI.Options.Reminders.BuildNoteCallback
local BuildAssignmentsOptions = NSI.UI.Options.Assignments.BuildOptions
local BuildAssignmentsCallback = NSI.UI.Options.Assignments.BuildCallback
local BuildEncounterAlertsOptions = NSI.UI.Options.EncounterAlerts.BuildOptions
local BuildEncounterAlertsCallback = NSI.UI.Options.EncounterAlerts.BuildCallback
local BuildInterruptDisplayOptions = NSI.UI.Options.InterruptDisplay.BuildOptions
local BuildInterruptDisplayCallback= NSI.UI.Options.InterruptDisplay.BuildCallback
local BuildReadyCheckOptions = NSI.UI.Options.ReadyCheck.BuildOptions
local BuildRaidBuffMenu = NSI.UI.Options.ReadyCheck.BuildRaidBuffMenu
local BuildReadyCheckCallback = NSI.UI.Options.ReadyCheck.BuildCallback
local BuildPrivateAurasOptions = NSI.UI.Options.PrivateAuras.BuildOptions
local BuildPrivateAurasCallback = NSI.UI.Options.PrivateAuras.BuildCallback
local BuildQoLOptions = NSI.UI.Options.QoL.BuildOptions
local BuildQoLCallback = NSI.UI.Options.QoL.BuildCallback
local BuildWAImportsOptions = NSI.UI.Options.WAImports.BuildOptions
local BuildWACallback = NSI.UI.Options.WAImports.BuildCallback
-- ============================================================
-- Vertical tab sidebar layout
-- ============================================================
-- Tab groups – blank strings become visual spacers between groups
local TABS_GROUPS = {
{
{ name = "General", textKey = "General" },
{ name = "QoL", textKey = "Quality of Life" },
{ name = "ReadyCheck", textKey = "Ready Check" },
},
{
{ name = "Reminders", textKey = "Reminders" },
{ name = "Reminders-Note", textKey = "Note-Display" },
{ name = "EncounterAlerts", textKey = "Encounter Alerts" },
{ name = "InterruptDisplay", textKey = "Interrupt Display" },
{ name = "Assignments", textKey = "Assignments" },
},
{
{ name = "PrivateAura", textKey = "Private Auras" },
{ name = "WAImports", textKey = "WA Imports" },
},
{
{ name = "Nicknames", textKey = "Nicknames" },
{ name = "Versions", textKey = "Version Check" },
},
}
-- Sidebar visual constants
local SIDEBAR_BTN_WIDTH = 148
local SIDEBAR_BTN_HEIGHT = 22
local SIDEBAR_BTN_GAP = 0 -- px between consecutive buttons
local SIDEBAR_GROUP_GAP = 14 -- extra px between groups
-- Derived from Core: tab frames start below the shared header strip
local tab_content_y = -25 - TAB_HEADER_HEIGHT -- -80
local CreateButton = NSI.UI.Components.CreateButton
function NSUI:Init()
NSI.IsBuilding = true
-- Scale bar
local scale = NSRT.NSUI.scale
NSRT.NSUI.scale = scale
DF:CreateScaleBar(NSUI, NSRT.NSUI, true)
NSUI:SetScale(scale)
-- Forward declaration – buttons below need to call SelectTab before it is defined
local SelectTab
-- --------------------------------------------------------
-- Build the tab system object
-- (mimics the df_tabcontainer interface for backward compat)
-- --------------------------------------------------------
local tabSystem = {
AllFrames = {},
AllButtons = {},
AllFramesByName = {},
AllButtonsByName = {},
CurrentName = nil,
}
function tabSystem:GetTabFrameByName(name)
return self.AllFramesByName[name]
end
function tabSystem:SelectTabByName(name)
SelectTab(name)
end
function tabSystem:RefreshTabLabels()
for _, btn in ipairs(self.AllButtons) do
if btn._textKey then
btn:SetText(GetLocalizedText(btn._textKey))
NSI:SetUIFont(btn, nil, NSRT.Settings.GlobalFontFlags)
end
end
end
-- --------------------------------------------------------
-- Sidebar background
-- --------------------------------------------------------
local sidebarBg = CreateFrame("frame", "NSUISidebar", NSUI, "BackdropTemplate")
sidebarBg:SetPoint("TOPLEFT", NSUI, "TOPLEFT", 2, -25)
sidebarBg:SetSize(158, content_height)
sidebarBg:SetBackdrop({ bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 64 })
sidebarBg:SetBackdropColor(0, 0, 0, 0.18)
-- Thin cyan vertical separator between sidebar and content area
local sidebarSep = NSUI:CreateTexture(nil, "artwork")
sidebarSep:SetColorTexture(0, 1, 1, 0.25)
sidebarSep:SetWidth(1)
sidebarSep:SetPoint("TOPLEFT", NSUI, "TOPLEFT", 160, -25)
sidebarSep:SetPoint("BOTTOMLEFT", NSUI, "BOTTOMLEFT", 160, 22)
-- --------------------------------------------------------
-- Create one content frame + one sidebar button per tab
-- --------------------------------------------------------
local btnY = -5 -- running y cursor inside sidebarBg
for gIdx, group in ipairs(TABS_GROUPS) do
-- Draw a subtle horizontal rule between groups
if gIdx > 1 then
local rule = sidebarBg:CreateTexture(nil, "artwork")
rule:SetColorTexture(0, 1, 1, 0.12)
rule:SetHeight(1)
rule:SetPoint("TOPLEFT", sidebarBg, "TOPLEFT", 8, btnY + math.floor(SIDEBAR_GROUP_GAP / 2))
rule:SetPoint("TOPRIGHT", sidebarBg, "TOPRIGHT", -8, btnY + math.floor(SIDEBAR_GROUP_GAP / 2))
end
for _, tab in ipairs(group) do
-- Content frame – occupies the right portion below the shared header, hidden by default
local contentFrame = CreateFrame("frame", "NSUI_TabFrame_" .. tab.name, NSUI, "BackdropTemplate")
contentFrame:SetPoint("TOPLEFT", NSUI, "TOPLEFT", 162, tab_content_y)
contentFrame:SetSize(content_width, tab_content_height)
contentFrame:Hide()
contentFrame:EnableMouse(false)
-- Register by name; textKey is resolved lazily so locale switches are picked up
tabSystem.AllFramesByName[tab.name] = contentFrame
table.insert(tabSystem.AllFrames, contentFrame)
-- Sidebar button
local btn = CreateButton(
sidebarBg,
GetLocalizedText(tab.textKey),
function() SelectTab(tab.name) end,
SIDEBAR_BTN_WIDTH, SIDEBAR_BTN_HEIGHT,
"NSUITabBtn_" .. tab.name
)
btn:SetPoint("TOPLEFT", sidebarBg, "TOPLEFT", 5, btnY)
btn._textKey = tab.textKey
tabSystem.AllButtonsByName[tab.name] = btn
table.insert(tabSystem.AllButtons, btn)
btnY = btnY - SIDEBAR_BTN_HEIGHT - SIDEBAR_BTN_GAP
end
-- Extra gap between groups (but not after the last group)
if gIdx < #TABS_GROUPS then
btnY = btnY - SIDEBAR_GROUP_GAP
end
end
-- --------------------------------------------------------
-- Notes tabs – content frames registered in tabSystem but
-- opened exclusively via the persistent header buttons below,
-- so no sidebar button is created for them.
-- --------------------------------------------------------
local NOTES_HEADER_BTN_W = 190
local NOTES_HEADER_BTN_H = 26
-- Vertically centred in the 55 px header strip (NSUI y=-25 to y=-80)
local NOTES_HEADER_BTN_Y = -38
local notesTabs = {
{ name = "SharedNotes", textKey = "Shared Notes", icon = "users_icon" },
{ name = "PersonalNotes", textKey = "Personal Notes", icon = "user_icon" },
}
for i, nt in ipairs(notesTabs) do
-- Content frame (same geometry as every other tab)
local notesFrame = CreateFrame("frame", "NSUI_TabFrame_" .. nt.name, NSUI, "BackdropTemplate")
notesFrame:SetPoint("TOPLEFT", NSUI, "TOPLEFT", 162, tab_content_y)
notesFrame:SetSize(content_width, tab_content_height)
notesFrame:Hide()
notesFrame:EnableMouse(false)
tabSystem.AllFramesByName[nt.name] = notesFrame
table.insert(tabSystem.AllFrames, notesFrame)
-- Persistent header button (lives on NSUI, always visible)
local hdrBtn = CreateButton(
NSUI,
GetLocalizedText(nt.textKey),
function() SelectTab(nt.name) end,
NOTES_HEADER_BTN_W, NOTES_HEADER_BTN_H,
"NSUIHeaderBtn_" .. nt.name,
nt.icon,
18
)
hdrBtn:SetPoint(
"TOPLEFT", NSUI, "TOPLEFT",
162 + 10 + (i - 1) * (NOTES_HEADER_BTN_W + 6),
NOTES_HEADER_BTN_Y
)
hdrBtn._textKey = nt.textKey
tabSystem.AllButtonsByName[nt.name] = hdrBtn
table.insert(tabSystem.AllButtons, hdrBtn)
end
-- --------------------------------------------------------
-- Anchor/Preview button (icon-only, far right of header)
-- --------------------------------------------------------
local ANCHOR_BTN_SIZE = 26
local anchorBtn = CreateButton(
NSUI,
"", -- icon-only, no text
function() NSI:TogglePreviewMode() end,
ANCHOR_BTN_SIZE, ANCHOR_BTN_SIZE,
"NSUIAnchorBtn",
[[Interface\AddOns\NorthernSkyRaidTools\Media\Icons\anchor.png]],
nil, -- textSize
{ title = GetLocalizedText("Preview Alerts"), desc = GetLocalizedText("Preview Reminders and unlock their anchors to move them around") }
)
anchorBtn:SetPoint("TOPRIGHT", NSUI, "TOPRIGHT", -10, NOTES_HEADER_BTN_Y)
-- Export Group button (icon-only, immediately left of anchor button)
local exportGroupBtn = CreateButton(
NSUI,
"", -- icon-only, no text
function()
if NSUI.group_export_popup then
NSUI.group_export_popup:Show()
end
end,
ANCHOR_BTN_SIZE, ANCHOR_BTN_SIZE,
"NSUIExportGroupBtn",
[[Interface\AddOns\NorthernSkyRaidTools\Media\Icons\external-link.png]],
nil, -- textSize
{ title = GetLocalizedText("Export Group"), desc = GetLocalizedText("Export your current raid composition to use with wowutils.com") },
function() return not InCombatLockdown() and IsInGroup() end
)
exportGroupBtn:SetPoint("TOPRIGHT", NSUI, "TOPRIGHT", -(10 + ANCHOR_BTN_SIZE + 6), NOTES_HEADER_BTN_Y)
-- --------------------------------------------------------
-- Tab selection logic (matches Details' SelectOptionsSection)
-- --------------------------------------------------------
SelectTab = function(name)
-- Deselect all
for _, f in ipairs(tabSystem.AllFrames) do
f:Hide()
end
for _, b in ipairs(tabSystem.AllButtons) do
b:Deselect()
end
-- Activate target
local frame = tabSystem.AllFramesByName[name]
if frame then
frame:Show()
if frame.RefreshOptions then
frame:RefreshOptions()
end
end
local btn = tabSystem.AllButtonsByName[name]
if btn then
btn:Select()
end
tabSystem.CurrentName = name
end
-- Re-activate the remembered tab when the panel is reshown
NSUI:HookScript("OnShow", function()
if tabSystem.CurrentName then
SelectTab(tabSystem.CurrentName)
end
end)
NSUI.MenuFrame = tabSystem
-- --------------------------------------------------------
-- Convenience locals for the tab frames
-- --------------------------------------------------------
local general_tab = tabSystem:GetTabFrameByName("General")
local nicknames_tab = tabSystem:GetTabFrameByName("Nicknames")
local versions_tab = tabSystem:GetTabFrameByName("Versions")
local reminder_tab = tabSystem:GetTabFrameByName("Reminders")
local reminder_note_tab = tabSystem:GetTabFrameByName("Reminders-Note")
local assignments_tab = tabSystem:GetTabFrameByName("Assignments")
local encounteralerts_tab = tabSystem:GetTabFrameByName("EncounterAlerts")
local interruptdisplay_tab = tabSystem:GetTabFrameByName("InterruptDisplay")
local readycheck_tab = tabSystem:GetTabFrameByName("ReadyCheck")
local privateaura_tab = tabSystem:GetTabFrameByName("PrivateAura")
local QoL_tab = tabSystem:GetTabFrameByName("QoL")
local WAImports_tab = tabSystem:GetTabFrameByName("WAImports")
-- --------------------------------------------------------
-- Generic text display frames (unchanged)
-- --------------------------------------------------------
NSI.NSRTFrame.generic_display = CreateFrame("Frame", nil, NSI.NSRTFrame, "BackdropTemplate")
NSI.NSRTFrame.generic_display:Hide()
NSI.NSRTFrame.generic_display:SetPoint(NSRT.Settings.GenericDisplay.Anchor, NSI.NSRTFrame, NSRT.Settings.GenericDisplay.relativeTo, NSRT.Settings.GenericDisplay.xOffset, NSRT.Settings.GenericDisplay.yOffset)
NSI.NSRTFrame.generic_display.Text = NSI.NSRTFrame.generic_display:CreateFontString(nil, "OVERLAY")
NSI.NSRTFrame.generic_display.Text:SetFont(NSI:GetGlobalFontPath(), NSRT.Settings.GlobalFontSize, "OUTLINE")
NSI.NSRTFrame.generic_display.Text:SetPoint("TOPLEFT", NSI.NSRTFrame.generic_display, "TOPLEFT", 0, 0)
NSI.NSRTFrame.generic_display.Text:SetJustifyH("LEFT")
NSI.NSRTFrame.generic_display.Text:SetText("Things that might be displayed here:\nReady Check Module\nAssignments on Pull\n")
NSI.NSRTFrame.generic_display:SetSize(NSI.NSRTFrame.generic_display.Text:GetStringWidth(), NSI.NSRTFrame.generic_display.Text:GetStringHeight())
NSI.NSRTFrame.SecretDisplay = CreateFrame("Frame", nil, NSI.NSRTFrame, "BackdropTemplate")
NSI.NSRTFrame.SecretDisplay:Hide()
NSI.NSRTFrame.SecretDisplay:SetPoint(NSRT.Settings.GenericDisplay.Anchor, NSI.NSRTFrame, NSRT.Settings.GenericDisplay.relativeTo, NSRT.Settings.GenericDisplay.xOffset, NSRT.Settings.GenericDisplay.yOffset)
NSI.NSRTFrame.SecretDisplay.Text = NSI.NSRTFrame.SecretDisplay:CreateFontString(nil, "OVERLAY")
NSI.NSRTFrame.SecretDisplay.Text:SetFont(NSI:GetGlobalFontPath(), NSRT.Settings.GlobalEncounterFontSize, "OUTLINE")
NSI.NSRTFrame.SecretDisplay.Text:SetPoint("TOPLEFT", NSI.NSRTFrame.generic_display, "TOPLEFT", 0, 0)
NSI.NSRTFrame.SecretDisplay.Text:SetJustifyH("LEFT")
NSI.NSRTFrame.SecretDisplay.Text:SetText("")
NSI.NSRTFrame.SecretDisplay:SetSize(2000, 2000)
-- --------------------------------------------------------
-- Build options tables
-- --------------------------------------------------------
local general_options1_table = BuildGeneralOptions()
local nicknames_options1_table = BuildNicknamesOptions()
local reminder_options1_table = BuildReminderOptions()
local reminder_note_options1_table = BuildReminderNoteOptions()
local assignments_options1_table = BuildAssignmentsOptions()
local encounteralerts_options1_table = BuildEncounterAlertsOptions()
local interruptdisplay_options1_table= BuildInterruptDisplayOptions()
local readycheck_options1_table = BuildReadyCheckOptions()
local RaidBuffMenu = BuildRaidBuffMenu()
local privateaura_options1_table = BuildPrivateAurasOptions()
local QoL_options1_table = BuildQoLOptions()
local WAImports_options1_table = BuildWAImportsOptions()
local option_tables = {
general_options1_table,
nicknames_options1_table,
reminder_options1_table,
reminder_note_options1_table,
assignments_options1_table,
encounteralerts_options1_table,
interruptdisplay_options1_table,
readycheck_options1_table,
RaidBuffMenu,
privateaura_options1_table,
QoL_options1_table,
WAImports_options1_table,
}
for _, options in ipairs(option_tables) do
options.language_addonId = addonId
end
-- --------------------------------------------------------
-- Build callbacks
-- --------------------------------------------------------
local general_callback = BuildGeneralCallback()
local nicknames_callback = BuildNicknamesCallback()
local reminder_callback = BuildReminderCallback()
local reminder_note_callback = BuildReminderNoteCallback()
local assignments_callback = BuildAssignmentsCallback()
local encounteralerts_callback = BuildEncounterAlertsCallback()
local interruptdisplay_callback = BuildInterruptDisplayCallback()
local readycheck_callback = BuildReadyCheckCallback()
local privateaura_callback = BuildPrivateAurasCallback()
local QoL_callback = BuildQoLCallback()
local WAImports_callback = BuildWACallback()
-- --------------------------------------------------------
-- Build options menus into each content frame
-- startX=10 : left margin within the content frame
-- startY=-10 : just below the top of the content frame (no tab bar to skip)
-- --------------------------------------------------------
DF:BuildMenu(general_tab, general_options1_table, 10, -10, tab_content_height, false, options_text_template,
options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template,
general_callback)
if general_tab.widgetids and general_tab.widgetids.current_profile_label then
NSI:SetUIFont(general_tab.widgetids.current_profile_label.widget, 10)
end
BuildLanguageSelector(general_tab)
DF:BuildMenu(nicknames_tab, nicknames_options1_table, 10, -10, tab_content_height, false, options_text_template,
options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template,
nicknames_callback)
DF:BuildMenu(reminder_tab, reminder_options1_table, 10, -10, tab_content_height, false, options_text_template,
options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template,
reminder_callback)
DF:BuildMenu(reminder_note_tab, reminder_note_options1_table, 10, -10, tab_content_height, false, options_text_template,
options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template,
reminder_note_callback)
DF:BuildMenu(assignments_tab, assignments_options1_table, 10, -10, tab_content_height, false, options_text_template,
options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template,
assignments_callback)
DF:BuildMenu(encounteralerts_tab, encounteralerts_options1_table, 10, -10, tab_content_height, false,
options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template,
options_button_template, encounteralerts_callback)
DF:BuildMenu(interruptdisplay_tab, interruptdisplay_options1_table, 10, -10, tab_content_height, false,
options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template,
options_button_template, interruptdisplay_callback)
DF:BuildMenu(readycheck_tab, readycheck_options1_table, 10, -10, tab_content_height, false, options_text_template,
options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template,
readycheck_callback)
DF:BuildMenu(NSI.RaidBuffCheck, RaidBuffMenu, 2, -30, 40, false, options_text_template, options_dropdown_template,
options_switch_template, true, options_slider_template, options_button_template, nil)
DF:BuildMenu(privateaura_tab, privateaura_options1_table, 10, -10, tab_content_height, false, options_text_template,
options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template,
privateaura_callback)
DF:BuildMenu(QoL_tab, QoL_options1_table, 10, -10, tab_content_height, false, options_text_template,
options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template,
QoL_callback)
DF:BuildMenu(WAImports_tab, WAImports_options1_table, 10, -10, tab_content_height, false, options_text_template,
options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template,
WAImports_callback)
C_Timer.After(0.1, function()
NSI:ApplySelectedLanguage()
end)
NSI.RaidBuffCheck:SetMovable(false)
NSI.RaidBuffCheck:EnableMouse(false)
-- --------------------------------------------------------
-- Build custom UI components
-- --------------------------------------------------------
NSUI.encounters_frame = BuildEncounterAlertsUI(encounteralerts_tab)
NSUI.version_scrollbox = BuildVersionCheckUI(versions_tab)
NSUI.nickname_frame = BuildNicknameEditUI()
NSUI.cooldowns_frame = BuildCooldownsEditUI()
NSUI.reminders_frame = BuildRemindersEditUI(tabSystem:GetTabFrameByName("SharedNotes"))
NSUI.pasound_frame = BuildPASoundEditUI()
NSUI.personal_reminders_frame = BuildPersonalRemindersEditUI(tabSystem:GetTabFrameByName("PersonalNotes"))
NSUI.export_string_popup = BuildExportStringUI()
NSUI.import_string_popup = BuildImportStringUI()
NSUI.group_export_popup = BuildGroupExportUI()
-- --------------------------------------------------------
-- Status bar text
-- --------------------------------------------------------
local versionNumber = " v" .. C_AddOns.GetAddOnMetadata("NorthernSkyRaidTools", "Version")
--@debug@
if versionNumber == " v@project-version@" then
versionNumber = " Dev Build"
end
--@end-debug@
local versionTitle = C_AddOns.GetAddOnMetadata("NorthernSkyRaidTools", "Title")
local statusBarText = versionTitle .. versionNumber .. " | |cFFFFFFFF" .. (authorsString) .. "|r"
NSUI.StatusBar.authorName:SetText(statusBarText)
-- --------------------------------------------------------
-- Select the default tab
-- --------------------------------------------------------
SelectTab("General")
NSI.IsBuilding = false
end
function NSUI:ToggleOptions()
if NSUI:IsShown() then
NSUI:Hide()
else
NSUI:Show()
end
end
function NSI:NickNamesSyncPopup(unit, nicknametable)
local popup = DF:CreateSimplePanel(UIParent, 300, 120, GetLocalizedText("Sync Nicknames"), "SyncNicknamesPopup", {
DontRightClickClose = true
})
popup:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
local label = DF:CreateLabel(popup, format(GetLocalizedText("%s is attempting to sync their nicknames with you."), NSAPI:Shorten(unit)), 11)
label:SetPoint("TOPLEFT", popup, "TOPLEFT", 10, -30)
label:SetPoint("BOTTOMRIGHT", popup, "BOTTOMRIGHT", -10, 40)
label:SetJustifyH("CENTER")
local cancel_button = DF:CreateButton(popup, function() popup:Hide() end, 130, 20, GetLocalizedText("Cancel"))
cancel_button:SetPoint("BOTTOMLEFT", popup, "BOTTOMLEFT", 10, 10)
cancel_button:SetTemplate(options_button_template)
local accept_button = DF:CreateButton(popup, function()
NSI:SyncNickNamesAccept(nicknametable)
popup:Hide()
end, 130, 20, GetLocalizedText("Accept"))
accept_button:SetPoint("BOTTOMRIGHT", popup, "BOTTOMRIGHT", -10, 10)
accept_button:SetTemplate(options_button_template)
return popup
end
function NSI:DisplayText(text, duration)
if self:Restricted() then return end
if self.NSRTFrame and self.NSRTFrame.generic_display then
self.NSRTFrame.generic_display.Text:SetText(text)
self.NSRTFrame.generic_display:Show()
self.NSRTFrame.generic_display.Text:Show()
if self.TextHideTimer then
self.TextHideTimer:Cancel()
self.TextHideTimer = nil
end
self.TextHideTimer = C_Timer.NewTimer(duration or 10, function() self.NSRTFrame.generic_display:Hide() end)
end
end
function NSI:DisplaySecretText(format, Hide, args)
if self.NSRTFrame and self.NSRTFrame.SecretDisplay then
if Hide then
self.NSRTFrame.SecretDisplay:Hide()
self.NSRTFrame.SecretDisplay.Text:Hide()
return
end
self.NSRTFrame.SecretDisplay.Text:SetFormattedText(format or "%s", unpack(args or {}))
self.NSRTFrame.SecretDisplay:Show()
self.NSRTFrame.SecretDisplay.Text:Show()
end
end