mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-22 07:36:56 +00:00
41b77a5728
* Add pfUI-native macro icon picker Replace Blizzard's MacroPopupFrame (the name + icon dialog) with a custom pfUI picker driven by IconDataProviderMixin, so the full spell + item + loose icon set is available instead of the stock spell-only list. It has a searchable, filterable icon grid and saves through C_Macro.CreateMacro / C_Macro.EditMacro, which take the icon as a texture string -- so arbitrary icons (including index-less INV_* item icons) persist. The macro-frame API is identical on the modern (Turtle/Octo) and stock-vanilla macro UIs, so the picker works on both with no client detection. The new macroicons module takes over the New / Change-Icon buttons and retires the stock popup; the blizzard macro skin now only skins MacroPopupFrame when that module is disabled. * Gate the macro icon hook behind a config flag Run the Blizzard_MacroUI hook only when C.disabled["macroicons"] is "1". * Add search to the icon pickers and fix set editing Equipment manager: - Move the OK button next to Cancel at the bottom-right. - Add an icon search box in the freed bottom-left space. - Shift the popup contents up and shrink the window after the title was removed. - Show the current icon when you edit a set. Keep a full icon path as is instead of adding a second prefix, and match grid icons by name. - Close the name/icon popup when the manager frame closes. Remove the duplicate OnHide hook. Both pickers now use Blizzard global strings for the labels and the icon filters. * Replace the row hover poll with OnLeave handlers The gear button sits inside the set row's rectangle, so MouseIsOver(row) is true for both. Show the gear on row enter. Hide it from a shared OnLeave on the row and the gear when the cursor leaves the row. This removes the per-frame OnUpdate poll. * Handle missing C_Macro.CreateMacro API Add guards to detect if C_Macro.CreateMacro is unavailable. The macroicons module now returns early if the API doesn't exist, and turtle-wow.lua uses the alternative Blizzard_MacroUI fallback path in such cases. * Remove the macro picker title and shrink the window Delete the title font string and its SetText calls. Move every top-anchored element up 14px and shrink the window height from 498 to 484. The OK, Cancel, and search controls are bottom-anchored, so they keep their spacing to the grid. * bump ClassicAPI min version to 1.9.3 * Extract a shared icon picker widget The macro icon picker and the equipment manager's name/icon popup carried near-identical copies of the icon grid, All/Spells/Items filter, name search, and the IconDataProvider state machine. Pull that into a single pfUI.api.CreateIconPicker helper; each module keeps only its own frame shell, buttons, and save flow. Also fix the grid tooltip: pass white to GameTooltip:SetText (it defaults to red) and derive the icon name with the case-insensitive basename key so mixed-case provider paths show a clean name instead of the full path.
95 lines
3.9 KiB
Lua
95 lines
3.9 KiB
Lua
pfUI:RegisterSkin("Macro", function ()
|
|
local rawborder, border = GetBorderSize()
|
|
local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel()
|
|
|
|
HookAddonOrVariable("Blizzard_MacroUI", function()
|
|
StripTextures(MacroFrame)
|
|
CreateBackdrop(MacroFrame, nil, nil, .75)
|
|
CreateBackdropShadow(MacroFrame)
|
|
|
|
MacroFrame.backdrop:SetPoint("TOPLEFT", 10, -10)
|
|
MacroFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 52)
|
|
MacroFrame:SetHitRectInsets(10,32,10,72)
|
|
EnableMovable(MacroFrame)
|
|
|
|
SkinCloseButton(MacroFrameCloseButton, MacroFrame.backdrop, -6, -6)
|
|
|
|
local MacroFrameHeaderText = GetNoNameObject(MacroFrame, "FontString", "BORDER", CREATE_MACROS)
|
|
MacroFrameHeaderText:ClearAllPoints()
|
|
MacroFrameHeaderText:SetPoint("TOP", MacroFrame.backdrop, "TOP", 0, -10)
|
|
|
|
SkinTab(MacroFrameTab1)
|
|
SkinTab(MacroFrameTab2)
|
|
MacroFrameTab2:ClearAllPoints()
|
|
MacroFrameTab2:SetPoint("LEFT", MacroFrameTab1, "RIGHT", border*2 + 1, 0)
|
|
|
|
for i=1, MAX_MACROS do
|
|
local button = _G["MacroButton"..i]
|
|
local icon = _G["MacroButton"..i..'Icon']
|
|
StripTextures(button)
|
|
SkinButton(button, nil, nil, nil, icon)
|
|
end
|
|
StripTextures(MacroFrameSelectedMacroButton)
|
|
SkinButton(MacroFrameSelectedMacroButton, nil, nil, nil, MacroFrameSelectedMacroButtonIcon, true)
|
|
MacroFrameSelectedMacroName:ClearAllPoints()
|
|
MacroFrameSelectedMacroName:SetPoint("TOPLEFT", MacroFrameSelectedMacroButton, "TOPRIGHT", 6, 3)
|
|
|
|
SkinButton(MacroEditButton)
|
|
SkinButton(MacroDeleteButton)
|
|
SkinButton(MacroExitButton)
|
|
SkinButton(MacroNewButton)
|
|
MacroDeleteButton:ClearAllPoints()
|
|
MacroDeleteButton:SetPoint("BOTTOMLEFT", MacroFrame, "BOTTOMLEFT", 17, 57)
|
|
MacroExitButton:ClearAllPoints()
|
|
MacroExitButton:SetPoint("BOTTOMRIGHT", MacroFrame, "BOTTOMRIGHT", -32, 57)
|
|
MacroNewButton:ClearAllPoints()
|
|
MacroNewButton:SetPoint("RIGHT", MacroExitButton, "LEFT", -2*bpad, 0)
|
|
|
|
MacroEditButton:SetSize(150, 22)
|
|
MacroEditButton:ClearAllPoints()
|
|
MacroEditButton:SetPoint("BOTTOMLEFT", MacroFrameSelectedMacroButton, "BOTTOMRIGHT", 6, -2)
|
|
|
|
MacroFrameEnterMacroText:ClearAllPoints()
|
|
MacroFrameEnterMacroText:SetPoint("BOTTOMLEFT", MacroFrameTextBackground, "TOPLEFT", 8, 2)
|
|
|
|
CreateBackdrop(MacroFrameTextBackground, nil, true)
|
|
MacroFrameTextBackground:ClearAllPoints()
|
|
MacroFrameTextBackground:SetPoint("TOPLEFT", MacroFrame, "TOPLEFT", 18, -300)
|
|
StripTextures(MacroFrameScrollFrame)
|
|
SkinScrollbar(MacroFrameScrollFrameScrollBar)
|
|
MacroFrameScrollFrame:ClearAllPoints()
|
|
MacroFrameScrollFrame:SetPoint("TOPLEFT", MacroFrameSelectedMacroBackground, "BOTTOMLEFT", 11, -13)
|
|
|
|
-- The macroicons module replaces MacroPopupFrame with its own picker.
|
|
-- Only skin the stock popup when that module is disabled.
|
|
if pfUI_config["disabled"] and pfUI_config["disabled"]["macroicons"] == "1" then
|
|
StripTextures(MacroPopupFrame)
|
|
CreateBackdrop(MacroPopupFrame, nil, nil, .75)
|
|
MacroPopupFrame:SetFrameStrata("DIALOG")
|
|
MacroPopupFrame:ClearAllPoints()
|
|
MacroPopupFrame:SetPoint("TOPLEFT", MacroFrame.backdrop, "TOPRIGHT", 2*border, 0)
|
|
|
|
StripTextures(MacroPopupScrollFrame)
|
|
SkinScrollbar(MacroPopupScrollFrameScrollBar)
|
|
|
|
MacroPopupEditBox:DisableDrawLayer("BACKGROUND")
|
|
CreateBackdrop(MacroPopupEditBox, nil, true)
|
|
MacroPopupEditBox:SetScript("OnEscapePressed", function()
|
|
MacroPopupFrame:Hide()
|
|
MacroFrame_Update()
|
|
end)
|
|
|
|
for i=1, NUM_MACRO_ICONS_SHOWN do
|
|
local button = _G["MacroPopupButton"..i]
|
|
local icon = _G["MacroPopupButton"..i..'Icon']
|
|
StripTextures(button)
|
|
SkinButton(button, nil, nil, nil, icon)
|
|
end
|
|
SkinButton(MacroPopupCancelButton)
|
|
SkinButton(MacroPopupOkayButton)
|
|
MacroPopupOkayButton:ClearAllPoints()
|
|
MacroPopupOkayButton:SetPoint("RIGHT", MacroPopupCancelButton, "LEFT", -2*bpad, 0)
|
|
end
|
|
end)
|
|
end)
|