feat: pfUI theme
This commit is contained in:
+16
-6
@@ -2867,12 +2867,22 @@ end
|
||||
-- Apply footer button backdrop styling
|
||||
function Guda_BagSlot_ApplyBackdrop(button)
|
||||
local Theme = addon.Modules.Theme
|
||||
button:SetBackdrop({
|
||||
bgFile = "Interface\\Buttons\\WHITE8x8",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
edgeSize = 8,
|
||||
insets = { left = 2, right = 2, top = 2, bottom = 2 },
|
||||
})
|
||||
local qStyle = Theme:GetQualityBorderStyle()
|
||||
if qStyle == "square" then
|
||||
button:SetBackdrop({
|
||||
bgFile = "Interface\\Buttons\\WHITE8x8",
|
||||
edgeFile = "Interface\\Buttons\\WHITE8x8",
|
||||
edgeSize = 1,
|
||||
insets = { left = -1, right = -1, top = -1, bottom = -1 },
|
||||
})
|
||||
else
|
||||
button:SetBackdrop({
|
||||
bgFile = "Interface\\Buttons\\WHITE8x8",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
edgeSize = 8,
|
||||
insets = { left = 2, right = 2, top = 2, bottom = 2 },
|
||||
})
|
||||
end
|
||||
local fbBg = Theme:GetValue("footerButtonBg") or { 0.12, 0.12, 0.12, 1 }
|
||||
local fbBorder = Theme:GetValue("footerButtonBorder") or { 0.30, 0.30, 0.30, 1 }
|
||||
button:SetBackdropColor(fbBg[1], fbBg[2], fbBg[3], fbBg[4])
|
||||
|
||||
+58
-14
@@ -383,17 +383,51 @@ local qualityBorderBackdrop = {
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0 },
|
||||
}
|
||||
|
||||
local qualityBorderBackdropSquare = {
|
||||
edgeFile = "Interface\\Buttons\\WHITE8x8",
|
||||
edgeSize = 2,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0 },
|
||||
}
|
||||
|
||||
-- Get or create the quality border frame for a button
|
||||
local function GetQualityBorderFrame(button)
|
||||
if button._qualityBorder then return button._qualityBorder end
|
||||
local qStyle = "rounded"
|
||||
if addon.Modules and addon.Modules.Theme then
|
||||
qStyle = addon.Modules.Theme:GetQualityBorderStyle()
|
||||
end
|
||||
|
||||
if button._qualityBorder then
|
||||
-- Update backdrop if style changed
|
||||
if button._qualityBorderStyle ~= qStyle then
|
||||
button._qualityBorderStyle = qStyle
|
||||
local pad = QUALITY_BORDER_PADDING
|
||||
button._qualityBorder:ClearAllPoints()
|
||||
if qStyle == "square" then
|
||||
button._qualityBorder:SetBackdrop(qualityBorderBackdropSquare)
|
||||
button._qualityBorder:SetPoint("TOPLEFT", button, "TOPLEFT", -pad, pad)
|
||||
button._qualityBorder:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", pad, -pad)
|
||||
else
|
||||
button._qualityBorder:SetBackdrop(qualityBorderBackdrop)
|
||||
button._qualityBorder:SetPoint("TOPLEFT", button, "TOPLEFT", -pad, pad)
|
||||
button._qualityBorder:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", pad, -pad)
|
||||
end
|
||||
end
|
||||
return button._qualityBorder
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame", nil, button)
|
||||
frame:SetFrameLevel(button:GetFrameLevel() + 3)
|
||||
local pad = QUALITY_BORDER_PADDING
|
||||
frame:SetPoint("TOPLEFT", button, "TOPLEFT", -pad, pad)
|
||||
frame:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", pad, -pad)
|
||||
frame:SetBackdrop(qualityBorderBackdrop)
|
||||
if qStyle == "square" then
|
||||
frame:SetBackdrop(qualityBorderBackdropSquare)
|
||||
else
|
||||
frame:SetBackdrop(qualityBorderBackdrop)
|
||||
end
|
||||
frame:Hide()
|
||||
button._qualityBorder = frame
|
||||
button._qualityBorderStyle = qStyle
|
||||
return frame
|
||||
end
|
||||
|
||||
@@ -1240,15 +1274,30 @@ local function UpdateTrackingCheckmark(self, Utils)
|
||||
end
|
||||
end
|
||||
|
||||
-- Resize empty slot background to match icon size
|
||||
-- Resize empty slot background to match icon size and slot style
|
||||
local function UpdateEmptySlotBackground(self, emptySlotBg, iconSize)
|
||||
if not emptySlotBg then return end
|
||||
|
||||
-- Extend 9px past button edges so the rounded corners of UI-EmptySlot
|
||||
-- cover the square corners of the icon texture (same as GudaBags)
|
||||
local slotStyle = "rounded"
|
||||
if addon.Modules and addon.Modules.Theme then
|
||||
slotStyle = addon.Modules.Theme:GetSlotStyle()
|
||||
end
|
||||
|
||||
emptySlotBg:ClearAllPoints()
|
||||
emptySlotBg:SetPoint("TOPLEFT", self, "TOPLEFT", -9, 9)
|
||||
emptySlotBg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 9, -9)
|
||||
if slotStyle == "square" then
|
||||
-- Flush anchors for pixel-perfect squared slots
|
||||
emptySlotBg:SetTexture("Interface\\Buttons\\WHITE8x8")
|
||||
emptySlotBg:SetVertexColor(0.05, 0.05, 0.05, 1)
|
||||
emptySlotBg:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
|
||||
emptySlotBg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0)
|
||||
else
|
||||
-- Extend 9px past button edges so the rounded corners of UI-EmptySlot
|
||||
-- cover the square corners of the icon texture (same as GudaBags)
|
||||
emptySlotBg:SetTexture("Interface\\Buttons\\UI-EmptySlot")
|
||||
emptySlotBg:SetVertexColor(1, 1, 1, 1)
|
||||
emptySlotBg:SetPoint("TOPLEFT", self, "TOPLEFT", -9, 9)
|
||||
emptySlotBg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 9, -9)
|
||||
end
|
||||
emptySlotBg:SetTexCoord(0, 1, 0, 1)
|
||||
end
|
||||
|
||||
@@ -1552,13 +1601,8 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
||||
-- Update lock icon
|
||||
UpdateLockIcon(self, iconSize)
|
||||
|
||||
-- Extend empty slot bg 9px past button edges for rounded corner coverage
|
||||
if emptySlotBg then
|
||||
emptySlotBg:ClearAllPoints()
|
||||
emptySlotBg:SetPoint("TOPLEFT", self, "TOPLEFT", -9, 9)
|
||||
emptySlotBg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 9, -9)
|
||||
emptySlotBg:SetTexCoord(0, 1, 0, 1)
|
||||
end
|
||||
-- Update empty slot bg anchors/texture based on slot style
|
||||
UpdateEmptySlotBackground(self, emptySlotBg, iconSize)
|
||||
|
||||
-- Also resize the underlying slot textures so the border/background scale with the button.
|
||||
-- On 1.12/Turtle, ItemButtonTemplate uses fixed-size textures, so we explicitly size them
|
||||
|
||||
+43
-3
@@ -1553,6 +1553,7 @@ end
|
||||
local themeOptions = {
|
||||
{ text = "Guda", value = "guda" },
|
||||
{ text = "Blizzard", value = "blizzard" },
|
||||
{ text = "pfUI", value = "pfui" },
|
||||
}
|
||||
|
||||
local function Guda_ThemeDropdown_Initialize()
|
||||
@@ -1575,7 +1576,7 @@ function Guda_SettingsPopup_ThemeDropdown_OnLoad(self)
|
||||
UIDropDownMenu_Initialize(self, Guda_ThemeDropdown_Initialize)
|
||||
UIDropDownMenu_SetWidth(130, self)
|
||||
local currentTheme = Guda.Modules.DB:GetSetting("theme") or "guda"
|
||||
local names = { guda = "Guda", blizzard = "Blizzard" }
|
||||
local names = { guda = "Guda", blizzard = "Blizzard", pfui = "pfUI" }
|
||||
UIDropDownMenu_SetSelectedValue(self, currentTheme)
|
||||
UIDropDownMenu_SetText(names[currentTheme] or currentTheme, self)
|
||||
|
||||
@@ -1588,7 +1589,35 @@ end
|
||||
|
||||
-- Apply selected theme
|
||||
function Guda_SettingsPopup_ApplyTheme(themeId)
|
||||
Guda.Modules.DB:SetSetting("theme", themeId)
|
||||
local DB = Guda.Modules.DB
|
||||
local oldTheme = DB:GetSetting("theme") or "guda"
|
||||
|
||||
-- Save current hideBorders/bgTransparency when leaving pfUI theme
|
||||
if oldTheme == "pfui" and themeId ~= "pfui" then
|
||||
-- Restore previously saved values (from before pfUI was applied)
|
||||
local prevHide = DB:GetSetting("_prePfui_hideBorders")
|
||||
local prevTransp = DB:GetSetting("_prePfui_bgTransparency")
|
||||
if prevHide ~= nil then
|
||||
DB:SetSetting("hideBorders", prevHide)
|
||||
else
|
||||
DB:SetSetting("hideBorders", false)
|
||||
end
|
||||
if prevTransp ~= nil then
|
||||
DB:SetSetting("bgTransparency", prevTransp)
|
||||
else
|
||||
DB:SetSetting("bgTransparency", 0.15)
|
||||
end
|
||||
end
|
||||
|
||||
-- Save current values before switching to pfUI, then apply pfUI defaults
|
||||
if themeId == "pfui" and oldTheme ~= "pfui" then
|
||||
DB:SetSetting("_prePfui_hideBorders", DB:GetSetting("hideBorders"))
|
||||
DB:SetSetting("_prePfui_bgTransparency", DB:GetSetting("bgTransparency"))
|
||||
DB:SetSetting("hideBorders", true)
|
||||
DB:SetSetting("bgTransparency", 0)
|
||||
end
|
||||
|
||||
DB:SetSetting("theme", themeId)
|
||||
|
||||
-- Clear theme cache
|
||||
if Guda.Modules.Theme then
|
||||
@@ -1598,7 +1627,7 @@ function Guda_SettingsPopup_ApplyTheme(themeId)
|
||||
-- Update dropdown text
|
||||
local dropdown = getglobal("Guda_SettingsPopup_ThemeDropdown")
|
||||
if dropdown then
|
||||
local names = { guda = "Guda", blizzard = "Blizzard" }
|
||||
local names = { guda = "Guda", blizzard = "Blizzard", pfui = "pfUI" }
|
||||
UIDropDownMenu_SetSelectedValue(dropdown, themeId)
|
||||
UIDropDownMenu_SetText(names[themeId] or themeId, dropdown)
|
||||
end
|
||||
@@ -1607,6 +1636,17 @@ function Guda_SettingsPopup_ApplyTheme(themeId)
|
||||
if Guda.Modules.Theme then
|
||||
Guda.Modules.Theme:ApplyToAllFrames()
|
||||
end
|
||||
|
||||
-- Refresh settings UI controls to reflect changed hideBorders/bgTransparency
|
||||
local hideBordersCheckbox = getglobal("Guda_SettingsPopup_HideBordersCheckbox")
|
||||
if hideBordersCheckbox then
|
||||
local hb = DB:GetSetting("hideBorders")
|
||||
hideBordersCheckbox:SetChecked(hb and 1 or 0)
|
||||
end
|
||||
local bgTransparencySlider = getglobal("Guda_SettingsPopup_BgTransparencySlider")
|
||||
if bgTransparencySlider then
|
||||
bgTransparencySlider:SetValue(DB:GetSetting("bgTransparency") or 0.15)
|
||||
end
|
||||
end
|
||||
|
||||
-- Bag View Dropdown
|
||||
|
||||
Reference in New Issue
Block a user