Files
pfUI/modules/skin.lua
T
Brues 93ab07a662 Show cooldown text through ClassicAPI's native countdown
The cooldown module no longer builds its own text frame with a 10 Hz
OnUpdate per cooldown. The CooldownFrame_SetTimer hook now configures
each Cooldown frame's own countdown instead: SetHideCountdownNumbers
for the per-frame text toggles and omnicc's noCooldownCount,
SetMinimumCountdownDuration for the GCD threshold, and
GetCountdownFontString for the pfUI font and size. The engine ticks
the numbers, gated by the countdownForCooldowns cvar. The cvar gets a
checkbox in the Cooldown settings, and pfUI.SetupCVars turns it on.

The text comes from one shared C_StringUtil numeric rule formatter,
given to each frame with SetCountdownFormatter. Its breakpoints keep
pfUI's format: the number in its unit's cooldown color, a unit (m/h/d)
once the unit below passes 99, and tenths in the low color when
milliseconds are on. Values now round up. GetColoredTimeString formats
through the same formatter, so the buff, buffwatch and tooltip timers
match. A config:changed callback rebuilds the breakpoints, and every
frame picks them up on its next update.

The paper-doll slots swap their indicator Models for Cooldown frames,
as the spellbook and bags already do. They and the spellbook take the
BLIZZARD tag when they are created, replacing the per-update hooks in
the skin module. Models get no numbers. Hide Foreign Cooldown
Animations clears the draw flags instead of setting alpha to 0, so the
numbers stay visible. The buff module's sweep hides its numbers
because buff.timer carries the text.
2026-10-31 18:45:17 -05:00

92 lines
3.2 KiB
Lua

pfUI:RegisterModule("skin", function ()
-- durability frame
pfUI.durability = CreateFrame("Frame", "pfDurability", UIParent)
if pfUI.minimap then
pfUI.durability:SetPoint("TOPLEFT", pfUI.minimap, "BOTTOMLEFT", 0, -35)
else
pfUI.durability:SetPoint("LEFT", UIParent, "RIGHT", -120, 120)
end
UpdateMovable(pfUI.durability)
pfUI.durability:SetWidth(80)
pfUI.durability:SetHeight(70)
pfUI.durability:SetFrameStrata("BACKGROUND")
DurabilityFrame:SetParent(pfUI.durability)
DurabilityFrame:SetAllPoints(pfUI.durability)
DurabilityFrame:SetFrameLevel(1)
DurabilityFrame.SetPoint = function() return end
for i = 1, UIDROPDOWNMENU_MAXLEVELS do
CreateBackdrop(_G["DropDownList"..i.."MenuBackdrop"], nil, true, .8)
CreateBackdropShadow(_G["DropDownList"..i.."MenuBackdrop"])
CreateBackdrop(_G["DropDownList"..i.."Backdrop"], nil, true, .8)
CreateBackdropShadow(_G["DropDownList"..i.."Backdrop"])
end
-- ClassicAPI menus that don't name a style of their own take pfUI's
function MenuVariants.GetDefaultMenuMixin() return pfUIMenuStyleMixin end
function MenuVariants.GetDefaultContextMenuMixin() return pfUIMenuStyleMixin end
-- ClassicAPI menus draw their checkboxes and radios with these. Both get a
-- pfUI box: a checked box holds a check, a selected radio a filled square.
local function CreateSelectionBox(frame, text)
local _, border = GetBorderSize()
local box = frame:AttachTexture()
frame.leftTexture1 = box
box:SetDrawLayer("BORDER")
box:SetPoint("LEFT")
box:SetSize(12, 12)
box:SetColorTexture(GetStringColorObject(C.appearance.border.color):GetRGBA())
local inside = frame:AttachTexture()
inside:SetDrawLayer("ARTWORK")
inside:SetPoint("TOPLEFT", box, "TOPLEFT", border, -border)
inside:SetPoint("BOTTOMRIGHT", box, "BOTTOMRIGHT", -border, border)
local r, g, b = GetStringColorObject(C.appearance.border.background):GetRGB()
inside:SetColorTexture(r, g, b, 1)
local fontString = frame:AttachFontString()
frame.fontString = fontString
fontString:SetPoint("LEFT", box, "RIGHT", 6, 0)
fontString:SetHeight(20)
fontString:SetTextToFit(text)
return box
end
function MenuVariants.CreateCheckbox(text, frame, isSelected, data)
local box = CreateSelectionBox(frame, text)
if isSelected(data) then
local check = frame:AttachTexture()
check:SetDrawLayer("OVERLAY")
check:SetPoint("CENTER", box)
check:SetSize(16, 16)
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
end
return box
end
function MenuVariants.CreateRadio(text, frame, isSelected, data)
local box = CreateSelectionBox(frame, text)
if isSelected(data) then
local dot = frame:AttachTexture()
dot:SetDrawLayer("OVERLAY")
dot:SetPoint("TOPLEFT", box, "TOPLEFT", 3, -3)
dot:SetPoint("BOTTOMRIGHT", box, "BOTTOMRIGHT", -3, 3)
dot:SetColorTexture(.2, 1, .8, 1)
end
return box
end
if C.global.errors_limit == "1" then
UIErrorsFrame:SetHeight(25)
end
if C.global.errors_hide == "1" then
UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
else
UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE")
end
end)