diff --git a/Core/Database.lua b/Core/Database.lua index 758897e..d3148cc 100644 --- a/Core/Database.lua +++ b/Core/Database.lua @@ -149,6 +149,7 @@ function DB:Initialize() Guda_CharDB.settings.theme = "pfui" Guda_CharDB.settings.hideBorders = true Guda_CharDB.settings.bgTransparency = Guda.Constants.PFUI_DEFAULT_BG_TRANSPARENCY + Guda_CharDB.settings.usePfUITransparency = true Guda_CharDB.settings.iconSpacing = 8 end end diff --git a/Core/Theme.lua b/Core/Theme.lua index e9b852b..e514213 100644 --- a/Core/Theme.lua +++ b/Core/Theme.lua @@ -495,11 +495,21 @@ function Theme:ApplyToFrame(frame) -- Background color / alpha local bg = t.bgColor - local transparency = 0.15 + local alpha + local usePfUITransp = false if addon.Modules and addon.Modules.DB then - transparency = addon.Modules.DB:GetSetting("bgTransparency") or 0.15 + usePfUITransp = addon.Modules.DB:GetSetting("usePfUITransparency") + end + if cachedThemeName == "pfui" and usePfUITransp ~= false then + local _, _, _, ba = GetPfUIColor("background") + alpha = ba or 1 + else + local transparency = 0.15 + if addon.Modules and addon.Modules.DB then + transparency = addon.Modules.DB:GetSetting("bgTransparency") or 0.15 + end + alpha = 1.0 - transparency end - local alpha = 1.0 - transparency frame:SetBackdropColor(bg.r, bg.g, bg.b, alpha) ThemeDebug(" SetBackdropColor(%s,%s,%s,%s)", tostring(bg.r), tostring(bg.g), tostring(bg.b), tostring(alpha)) diff --git a/UI/SettingsPopup.lua b/UI/SettingsPopup.lua index 816fa53..206edbb 100644 --- a/UI/SettingsPopup.lua +++ b/UI/SettingsPopup.lua @@ -259,6 +259,20 @@ function Guda_SettingsPopup_OnShow(self) hideBordersCheckbox:SetChecked(hideBorders and 1 or 0) end + -- Refresh pfUI transparency checkbox visibility + local pfuiTranspCB = getglobal("Guda_SettingsPopup_UsePfUITransparencyCheckbox") + if pfuiTranspCB then + local currentTheme = Guda.Modules.DB:GetSetting("theme") or "guda" + if currentTheme == "pfui" then + local val = Guda.Modules.DB:GetSetting("usePfUITransparency") + if val == nil then val = true end + pfuiTranspCB:SetChecked(val and 1 or 0) + pfuiTranspCB:Show() + else + pfuiTranspCB:Hide() + end + end + if qualityBorderEquipmentCheckbox then qualityBorderEquipmentCheckbox:SetChecked(showQualityBorderEquipment and 1 or 0) end @@ -1564,6 +1578,44 @@ local themeOptions = { { text = "pfUI", value = "pfui" }, } +-- pfUI Transparency checkbox +function Guda_SettingsPopup_UsePfUITransparencyCheckbox_OnLoad(self) + local text = getglobal(self:GetName().."Text") + if text then + text:SetText("pfUI Transparency") + local font, _, flags = text:GetFont() + if font then + text:SetFont(font, 13, flags) + end + end + self.tooltipText = "When enabled, uses pfUI's background transparency instead of the slider below." + + local val = true + if Guda and Guda.Modules and Guda.Modules.DB then + local stored = Guda.Modules.DB:GetSetting("usePfUITransparency") + if stored ~= nil then val = stored end + end + self:SetChecked(val and 1 or 0) + + -- Only show when pfUI theme is active + local theme = "guda" + if Guda and Guda.Modules and Guda.Modules.DB then + theme = Guda.Modules.DB:GetSetting("theme") or "guda" + end + if theme == "pfui" then self:Show() else self:Hide() end +end + +function Guda_SettingsPopup_UsePfUITransparencyCheckbox_OnClick(self) + local isChecked = self:GetChecked() == 1 + if Guda and Guda.Modules and Guda.Modules.DB then + Guda.Modules.DB:SetSetting("usePfUITransparency", isChecked) + end + if Guda.Modules and Guda.Modules.Theme then + Guda.Modules.Theme:ClearCache() + Guda.Modules.Theme:ApplyToAllFrames() + end +end + local function Guda_ThemeDropdown_Initialize() local currentTheme = Guda.Modules.DB:GetSetting("theme") or "guda" for _, option in ipairs(themeOptions) do @@ -1623,6 +1675,10 @@ function Guda_SettingsPopup_ApplyTheme(themeId) DB:SetSetting("_prePfui_bgTransparency", DB:GetSetting("bgTransparency")) DB:SetSetting("hideBorders", true) DB:SetSetting("bgTransparency", Guda.Constants.PFUI_DEFAULT_BG_TRANSPARENCY) + -- Default to using pfUI transparency + if DB:GetSetting("usePfUITransparency") == nil then + DB:SetSetting("usePfUITransparency", true) + end end DB:SetSetting("theme", themeId) @@ -1655,6 +1711,19 @@ function Guda_SettingsPopup_ApplyTheme(themeId) if bgTransparencySlider then bgTransparencySlider:SetValue(DB:GetSetting("bgTransparency") or 0.15) end + + -- Show/hide pfUI transparency checkbox based on theme + local pfuiTranspCB = getglobal("Guda_SettingsPopup_UsePfUITransparencyCheckbox") + if pfuiTranspCB then + if themeId == "pfui" then + local val = DB:GetSetting("usePfUITransparency") + if val == nil then val = true end + pfuiTranspCB:SetChecked(val and 1 or 0) + pfuiTranspCB:Show() + else + pfuiTranspCB:Hide() + end + end end -- Bag View Dropdown diff --git a/UI/SettingsPopup.xml b/UI/SettingsPopup.xml index c578893..7b34cd4 100644 --- a/UI/SettingsPopup.xml +++ b/UI/SettingsPopup.xml @@ -223,6 +223,19 @@ + + + + + + + + + Guda_SettingsPopup_UsePfUITransparencyCheckbox_OnLoad(this) + Guda_SettingsPopup_UsePfUITransparencyCheckbox_OnClick(this) + + +