Skip to content

Commit 24deb3c

Browse files
committed
Text Designer: settings migration, test mode, single status text, and live-refresh fixes
Add legacy->TD settings migration (auto on login + Import button), integrate TD into test mode with a per-unit test source + toggle, keep status as a single combined element, and refresh TD name/status on roster, connection, and vehicle changes by mirroring the legacy update paths.
1 parent 61c8431 commit 24deb3c

12 files changed

Lines changed: 555 additions & 58 deletions

File tree

Config.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,6 +1963,7 @@ DF.PartyDefaults = {
19631963
testShowTargetedSpell = false,
19641964
testShowClassPower = true,
19651965
testShowAuraDesigner = false,
1966+
testShowTextDesigner = true,
19661967

19671968
-- Tooltip settings
19681969
tooltipAuraAnchor = "DEFAULT",
@@ -3204,6 +3205,7 @@ DF.RaidDefaults = {
32043205
testShowTargetedSpell = false,
32053206
testShowClassPower = true,
32063207
testShowAuraDesigner = false,
3208+
testShowTextDesigner = true,
32073209

32083210
-- Tooltip settings
32093211
tooltipAuraAnchor = "DEFAULT",

Core.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4567,6 +4567,15 @@ DF._MainEventDispatcher = function(self, event, arg1)
45674567
-- Post-initialization updates (frames already created at ADDON_LOADED)
45684568
-- These need a delay to let Blizzard addons settle and world to be ready
45694569
C_Timer.After(0.5, function()
4570+
-- One-time migration of legacy name/health/status text settings into
4571+
-- Text Designer elements. Naturally idempotent (per-mode guard +
4572+
-- migratedFromLegacy flag), so re-running on every login is a no-op
4573+
-- once it has run. Alpha-only — the function only exists when the
4574+
-- Text Designer files are loaded.
4575+
if DF.MigrateTextDesignerFromLegacy then
4576+
DF:MigrateTextDesignerFromLegacy()
4577+
end
4578+
45704579
-- CRITICAL: Update power bars now that unit data is available
45714580
-- At ADDON_LOADED, UnitPower() etc may return 0 before player is loaded
45724581
-- Power bar updates don't require combat protection

DandersFrames.toc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ TextDesigner\MidnightSafe.lua
135135
TextDesigner\DataSource.lua
136136
TextDesigner\Resolver.lua
137137
TextDesigner\Render.lua
138+
TextDesigner\Migration.lua
138139
TextDesigner\Preview.lua
139140
TextDesigner\Options.lua
140141
#@end-alpha@

Frames/Headers.lua

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8264,6 +8264,10 @@ function DF:ProcessRosterUpdate()
82648264
local function refreshName(frame)
82658265
if frame.unit then
82668266
DF:UpdateName(frame)
8267+
-- TD mirrors this legacy safety net: refresh identity text on
8268+
-- every roster change so TD names don't go stale/duplicate when
8269+
-- the secure header reshuffles frames (the per-frame path misses some).
8270+
if DF.UpdateTextDesigner then DF:UpdateTextDesigner(frame, "name") end
82678271
end
82688272
end
82698273
DF:IteratePartyFrames(refreshName)
@@ -8573,6 +8577,7 @@ local headerChildEventFrame = CreateFrame("Frame")
85738577
headerChildEventFrame:RegisterEvent("UNIT_HEALTH")
85748578
headerChildEventFrame:RegisterEvent("UNIT_MAXHEALTH")
85758579
headerChildEventFrame:RegisterEvent("UNIT_NAME_UPDATE")
8580+
headerChildEventFrame:RegisterEvent("UNIT_LEVEL")
85768581
headerChildEventFrame:RegisterEvent("UNIT_POWER_UPDATE")
85778582
headerChildEventFrame:RegisterEvent("UNIT_MAXPOWER")
85788583
headerChildEventFrame:RegisterEvent("UNIT_DISPLAYPOWER")
@@ -8772,6 +8777,17 @@ headerChildEventFrame:SetScript("OnEvent", function(self, event, arg1)
87728777
end
87738778
return
87748779
end
8780+
8781+
-- UNIT_LEVEL: refresh TextDesigner identity text (the "level" element).
8782+
-- TD-only — the legacy frames don't show a live level, so there's no
8783+
-- existing update function to call here. No-op without the TD module.
8784+
if event == "UNIT_LEVEL" then
8785+
local unit = arg1
8786+
if unit and DF.UpdateTextDesigner then
8787+
tdRefresh(unitFrameMap[unit], FindPinnedFrameForUnit(unit), "name")
8788+
end
8789+
return
8790+
end
87758791

87768792
-- UNIT_CONNECTION: Full frame update (handles offline state)
87778793
if event == "UNIT_CONNECTION" then
@@ -8803,6 +8819,11 @@ headerChildEventFrame:SetScript("OnEvent", function(self, event, arg1)
88038819
end
88048820
end
88058821

8822+
-- TD: UpdateUnitFrame early-returns on the offline branch before the
8823+
-- TD "all" hook, so refresh TD directly here. "all" because a
8824+
-- connection change flips status text + health/power value hiding.
8825+
tdRefresh(frame, pinnedFrame, "all")
8826+
88068827
-- Delayed re-check: UnitIsConnected may not return the updated
88078828
-- state immediately, and the map rebuild throttle (1s) can cause
88088829
-- the reconnect event to miss. Schedule a follow-up that bypasses
@@ -8826,6 +8847,7 @@ headerChildEventFrame:SetScript("OnEvent", function(self, event, arg1)
88268847
local stale = (frameThinks == nil) or (isConnected ~= frameThinks)
88278848
if stale and DF.UpdateUnitFrame then
88288849
DF:UpdateUnitFrame(recheckFrame)
8850+
if DF.UpdateTextDesigner then DF:UpdateTextDesigner(recheckFrame, "all") end
88298851
end
88308852
end
88318853
-- Also re-check pinned frame
@@ -8835,6 +8857,7 @@ headerChildEventFrame:SetScript("OnEvent", function(self, event, arg1)
88358857
local stale = (frameThinks == nil) or (isConnected ~= frameThinks)
88368858
if stale and DF.UpdateUnitFrame then
88378859
DF:UpdateUnitFrame(recheckPinned)
8860+
if DF.UpdateTextDesigner then DF:UpdateTextDesigner(recheckPinned, "all") end
88388861
end
88398862
end
88408863
end)
@@ -9094,13 +9117,15 @@ headerChildEventFrame:SetScript("OnEvent", function(self, event, arg1)
90949117
-- NOTE: If more frame elements get stuck after vehicle swaps
90959118
-- (role icon, power bar type, etc.), consider a broader refresh here.
90969119
if DF.UpdateName then DF:UpdateName(frame) end
9120+
if DF.UpdateTextDesigner then DF:UpdateTextDesigner(frame, "name") end
90979121
end
90989122
local pinnedFrame = FindPinnedFrameForUnit(unit)
90999123
if pinnedFrame then
91009124
DF:UpdateVehicleIcon(pinnedFrame)
91019125
if DF.UpdateAuras_Enhanced then DF:UpdateAuras_Enhanced(pinnedFrame) end
91029126
if DF.UpdateDefensiveBar then DF:UpdateDefensiveBar(pinnedFrame) end
91039127
if DF.UpdateName then DF:UpdateName(pinnedFrame) end
9128+
if DF.UpdateTextDesigner then DF:UpdateTextDesigner(pinnedFrame, "name") end
91049129
end
91059130
end
91069131
end

Locales/enUS.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ L["Export Settings"] = true
688688
L["External"] = true
689689
L["External Defensives"] = true
690690
L["FD"] = true
691+
L["Faction"] = true
691692
L["Fade Out Duration"] = true
692693
L["Fade frames or elements when a unit's health is above the set threshold (e.g. 100% or 80%)."] = true
693694
L["Fading"] = true
@@ -871,6 +872,7 @@ L["Icons Alpha"] = true
871872
L["Icons Per Row"] = true
872873
L["Identity & Roster"] = true
873874
L["Ignore Full Health Fade"] = true
875+
L["Import Current Text Settings"] = true
874876
L["Import failed"] = true
875877
L["Import Selected"] = true
876878
L["Import Settings"] = true
@@ -917,6 +919,7 @@ L["Layout Mode"] = true
917919
L["Layout Name"] = true
918920
L["Layout:"] = true
919921
L["Leader Icon"] = true
922+
L["Level"] = true
920923
L["Left"] = true
921924
L["Left Click"] = true
922925
L["Left Edge"] = true
@@ -1078,7 +1081,6 @@ L["Overridden by Auto Layout"] = true
10781081
L["Overridden in this layout"] = true
10791082
L["Override Details"] = true
10801083
L["Override the addon's display language. Auto follows your WoW client language. Translations are community-contributed and may be incomplete."] = true
1081-
L["Overshield Amount"] = true
10821084
L["Owner's Class Color"] = true
10831085
L["Paladin"] = true
10841086
L["Parse String"] = true
@@ -1143,6 +1145,7 @@ L["Quick Switch Profile"] = true
11431145
L["Pulsate Border"] = true
11441146
L["Pulse"] = true
11451147
L["Pulse Animation"] = true
1148+
L["Race"] = true
11461149
L["Race / Level / Faction"] = true
11471150
L["Rage"] = true
11481151
L["Raid"] = true
@@ -1172,6 +1175,7 @@ L["Range Check Spell"] = true
11721175
L["Ready Check"] = true
11731176
L["Ready Check Icon"] = true
11741177
L["Ready to copy"] = true
1178+
L["Rebuild the element list from your current built-in name, health, and status text. This replaces all existing Text Designer elements for this mode."] = true
11751179
L["Recommended: enable 'All Debuffs' to see all relevant debuffs, especially for healers."] = true
11761180
L["Recovered %d raid settings from interrupted auto layout editing session."] = true
11771181
L["Reduced Max Health"] = true

TestMode/TestMode.lua

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,10 @@ function DF:UpdateTestFrameHealthOnly(frame, index)
539539
frame.dfDispelOverlay.gradient:SetMinMaxValues(0, 1)
540540
frame.dfDispelOverlay.gradient:SetValue(health)
541541
end
542+
543+
-- Text Designer: re-render health-category text so TD follows the animated
544+
-- health value (TestSource reads frame.testAnimatedHealth while animating).
545+
if DF.UpdateTextDesigner then DF:UpdateTextDesigner(frame, "health") end
542546
end
543547

544548
-- Stop test mode animation
@@ -1099,7 +1103,23 @@ function DF:UpdateTestFrame(frame, index, applyLayout)
10991103
frame.dfTestOutOfRange = false
11001104
end
11011105
end
1102-
1106+
1107+
-- Text Designer: render TD text on this test frame using its simulated
1108+
-- per-unit data. Gated inside DF:UpdateTextDesigner via frame.dfIsTestFrame
1109+
-- + db.testShowTextDesigner; no-op when the TD module isn't loaded.
1110+
if DF.UpdateTextDesigner then
1111+
DF:UpdateTextDesigner(frame, "all")
1112+
-- Mirror live frames: hide the built-in name/health/status text whenever
1113+
-- "Hide Legacy Text" is on — independent of the TD test toggle, so
1114+
-- disabling TD in test doesn't bring the old text (e.g. "Dead") back.
1115+
-- Runs after the text was set/shown above.
1116+
if DF.IsLegacyTextHidden and DF:IsLegacyTextHidden(frame) then
1117+
if frame.nameText then frame.nameText:Hide() end
1118+
if frame.healthText then frame.healthText:Hide() end
1119+
if frame.statusText then frame.statusText:Hide() end
1120+
end
1121+
end
1122+
11031123
-- Update test icons (role, leader, raid target)
11041124
if db.testShowIcons ~= false then
11051125
DF:UpdateTestIcons(frame, testData)
@@ -6628,6 +6648,26 @@ function DF:CreateTestPanel()
66286648
end, "bars_classpower")
66296649
panel.showOutOfRangeCheck = secBars:AddCheckbox("Out of Range", "testShowOutOfRange", nil, "display_fading")
66306650
panel.showReducedMaxCheck = secBars:AddCheckbox("Reduced Max Health", "testShowReducedMaxHealth", nil, "bars_health")
6651+
-- Text Designer is alpha-gated; only offer the toggle when the module loaded.
6652+
if DF.UpdateTextDesigner then
6653+
-- Default ON: seed any profile that predates the Config default so the
6654+
-- checkbox shows checked (migration timing can otherwise leave it nil).
6655+
local pdb, rdb = DF:GetDB(), DF:GetRaidDB()
6656+
if pdb and pdb.testShowTextDesigner == nil then pdb.testShowTextDesigner = true end
6657+
if rdb and rdb.testShowTextDesigner == nil then rdb.testShowTextDesigner = true end
6658+
panel.showTextDesignerCheck = secBars:AddCheckbox("Text Designer", "testShowTextDesigner", function()
6659+
if DF.UpdateTextDesigner then
6660+
for i = 0, 4 do
6661+
local f = DF.testPartyFrames and DF.testPartyFrames[i]
6662+
if f then DF:UpdateTextDesigner(f, "all") end
6663+
end
6664+
for i = 1, 40 do
6665+
local f = DF.testRaidFrames and DF.testRaidFrames[i]
6666+
if f then DF:UpdateTextDesigner(f, "all") end
6667+
end
6668+
end
6669+
end, "text_designer") -- pageId → makes the label a quick link to the TD tab
6670+
end
66316671

66326672
-- --- AURAS ---
66336673
local secAuras = CreateSection(panel, "Auras", "auras")
@@ -6907,6 +6947,9 @@ function DF:CreateTestPanel()
69076947
self.showClassPowerCheck:SetChecked(db.testShowClassPower ~= false)
69086948
self.showOutOfRangeCheck:SetChecked(db.testShowOutOfRange)
69096949
self.showReducedMaxCheck:SetChecked(db.testShowReducedMaxHealth ~= false)
6950+
if self.showTextDesignerCheck then
6951+
self.showTextDesignerCheck:SetChecked(db.testShowTextDesigner ~= false)
6952+
end
69106953
self.showAurasCheck:SetChecked(db.testShowAuras)
69116954
self.showBossDebuffsCheck:SetChecked(db.testShowBossDebuffs)
69126955
self.showDispelGlowCheck:SetChecked(db.testShowDispelGlow)

0 commit comments

Comments
 (0)