diff --git a/Modules/Skinning.lua b/Modules/Skinning.lua index 132956c..a31f04a 100644 --- a/Modules/Skinning.lua +++ b/Modules/Skinning.lua @@ -138,31 +138,44 @@ function Skin:HideArt(frame) frame:Hide() end --- The dropdown pills on the vanity and wardrobe frames are the same widget: --- nine anonymous "Silver-Button" slices rather than the named Left/Middle/Right --- fields or the Normal/Pushed/Disabled set S:HandleButton knows how to clear, --- so its own clearing can't reach them -- and a blind StripTextures would take --- the caret and the label with them. +-- Several of these controls draw their art as anonymous regions of one atlas +-- file rather than through the named Left/Middle/Right fields or the Normal/ +-- Pushed/Disabled set S:HandleButton knows how to clear, so its own clearing +-- can't reach them -- and a blind StripTextures would take the caret or the +-- label with it. Those are cleared by file instead. -- --- The native mouse-down handler re-arts one of these regions with a pressed --- variant of the same file on every click, which is why the pill came back --- skinless while held. SetTexture is noop'd per region after clearing. -local DROPDOWN_ART = "Silver%-Button" -local CARET_ART = "ChatFrameExpandArrow" -local CARET_SIZE = 14 +-- SetTexture is noop'd per region rather than just cleared: whatever re-arts +-- the control on a state change (a mouse-down swapping in the pressed variant, +-- a tex coord swap between two variants of the same file) is free to re-set the +-- file as well, and a cleared texture would come straight back. +function Skin:StripArtByFile(frame, pattern) + if not frame then return end -local function StripDropdownArt(dropdown) - for i = 1, dropdown:GetNumRegions() do - local region = select(i, dropdown:GetRegions()) + for i = 1, frame:GetNumRegions() do + local region = select(i, frame:GetRegions()) local texture = region.GetTexture and region:GetTexture() - if texture and tostring(texture):find(DROPDOWN_ART) then + if texture and tostring(texture):find(pattern) then region:SetTexture(nil) region.SetTexture = E.noop end end end +-- The pill behind the talent frame's Activate button and the wardrobe's Apply +-- and Cancel buttons. Two files rather than one: "128GoldRedButton" carries the +-- green and grey variants as tex coords, and Cancel alone is drawn from +-- "128RedButton" (probed) -- including its HIGHLIGHT region, which is what left +-- a red glow under the cursor while only the gold file was being cleared. The +-- shared suffix matches both, and nothing else on these frames uses either. +Skin.RedButtonArt = "RedButton" + +-- The dropdown pills on the vanity and wardrobe frames are the same widget: +-- nine anonymous "Silver-Button" slices. +local DROPDOWN_ART = "Silver%-Button" +local CARET_ART = "ChatFrameExpandArrow" +local CARET_SIZE = 14 + -- The caret is retextured after HandleButton, not before: HandleButton strips -- the pill, and a caret replaced ahead of that gets cleared straight back off. local function SkinDropdownCaret(dropdown) @@ -191,7 +204,7 @@ function Skin:Dropdown(dropdown, menu) if not dropdown or dropdown.CoASkinned then return end dropdown.CoASkinned = true - StripDropdownArt(dropdown) + self:StripArtByFile(dropdown, DROPDOWN_ART) S:HandleButton(dropdown) SkinDropdownCaret(dropdown) diff --git a/Modules/TalentFrame.lua b/Modules/TalentFrame.lua index c651305..6553674 100644 --- a/Modules/TalentFrame.lua +++ b/Modules/TalentFrame.lua @@ -316,24 +316,10 @@ end -- switches between the green and the grey variant by tex coord. There are no -- Normal/Pushed/Disabled textures for HandleButton to clear (probed: both come -- back nil, and every region's vertex colour is white in either state), so the --- art is cleared by file the way the dropdown pills are, and the enabled/ --- disabled distinction the atlas was carrying has to be re-created on the label. -local ACTIVATE_ART = "128GoldRedButton" - --- SetTexture is noop'd per region for the same reason as the dropdown pills: --- whatever swaps the tex coord on a state change is free to re-art the region --- as well, and a cleared texture would come straight back. -local function StripActivateArt(button) - for i = 1, button:GetNumRegions() do - local region = select(i, button:GetRegions()) - local texture = region.GetTexture and region:GetTexture() - - if texture and tostring(texture):find(ACTIVATE_ART) then - region:SetTexture(nil) - region.SetTexture = E.noop - end - end -end +-- art is cleared by file the way the dropdown pills are (Skin:StripArtByFile, +-- which noops SetTexture per region as well -- whatever swaps the tex coord on +-- a state change is free to re-art the region), and the enabled/disabled +-- distinction the atlas was carrying has to be re-created on the label. -- GetFontString covers the templated case; the scan is for a label that was -- added as a plain region rather than set as the button's own font string. @@ -393,7 +379,7 @@ local function SkinActivateButton(button) if not button.CoASkinned then button.CoASkinned = true - StripActivateArt(button) + Skin:StripArtByFile(button, Skin.RedButtonArt) S:HandleButton(button) button:HookScript("OnUpdate", UpdateActivateState) diff --git a/Modules/WardrobeFrame.lua b/Modules/WardrobeFrame.lua index 28591fb..f70fd10 100644 --- a/Modules/WardrobeFrame.lua +++ b/Modules/WardrobeFrame.lua @@ -13,6 +13,54 @@ local function SkinActionButtons() S:HandleButton(_G[FRAME_NAME.."DisableSpellVisualsButton"]) end +-- Apply and Cancel only exist while a transmog change is pending, which is why +-- they were missed for so long -- but they exist from the start rather than +-- being created on the first change (probed: both are Buttons, hidden, with +-- nothing pending), so the normal skin pass reaches them. +-- +-- Same widget as the talent frame's Activate button: the pill is drawn across +-- plain regions, with no Normal/Pushed texture for HandleButton to clear +-- (probed: both come back nil). Apply takes the green variant of the gold +-- atlas, Cancel is drawn from the red file instead -- Skin.RedButtonArt matches +-- both, and Cancel's HIGHLIGHT region goes with the rest of its art. +-- +-- The labels don't carry the atlas's green/red split over: the two buttons sit +-- side by side and read apart by their text, and they take the same yellow +-- every other templated button on these frames uses -- the talent frame's live +-- Activate label included -- so a pending change doesn't get its own colour +-- scheme. +local LABEL_COLOR = {1, 0.82, 0} + +-- The strip runs on every pass rather than once behind the skinned guard: the +-- art is only there to be cleared once a change is pending, and nothing fires +-- the frame's OnShow at that point -- the window is already open. The buttons' +-- own OnShow is what catches it, since that is exactly when they appear. +local function SkinPendingButton(name) + local button = _G[name] + if not button then return end + + Skin:StripArtByFile(button, Skin.RedButtonArt) + + if button.CoASkinned then return end + button.CoASkinned = true + + -- Stripped before templating: HandleButton adds its backdrop as regions of + -- this same button, so a strip afterwards takes the backdrop with the pill. + S:HandleButton(button) + + local text = button.GetFontString and button:GetFontString() + if text then text:SetTextColor(unpack(LABEL_COLOR)) end + + button:HookScript("OnShow", function(self) + Skin:StripArtByFile(self, Skin.RedButtonArt) + end) +end + +local function SkinPendingButtons() + SkinPendingButton(FRAME_NAME.."PlayerModelApplyButton") + SkinPendingButton(FRAME_NAME.."PlayerModelCancelButton") +end + local function SkinSearchBox() S:HandleEditBox(_G[FRAME_NAME.."CollectionSearchBox"]) end @@ -59,6 +107,7 @@ local function SkinContents() Skin:Title(_G[FRAME_NAME.."TitleText"]) Skin:CloseButton(_G[FRAME_NAME.."CloseButton"]) SkinActionButtons() + SkinPendingButtons() SkinSearchBox() SkinCollectionDropdown("Filter") SkinCollectionDropdown("Sorting")