diff --git a/Core/Database.lua b/Core/Database.lua index 67f2752..b1d2f9b 100644 --- a/Core/Database.lua +++ b/Core/Database.lua @@ -44,11 +44,20 @@ function DB:Initialize() showSearchBar = true, hoverBagline = false, hideFooter = false, + bgTransparency = 0.15, }, } end -- Ensure new settings exist for existing installations + if Guda_CharDB.settings.bgTransparency == nil then + if Guda_CharDB.settings.frameOpacity ~= nil then + Guda_CharDB.settings.bgTransparency = 1.0 - Guda_CharDB.settings.frameOpacity + Guda_CharDB.settings.frameOpacity = nil -- Clean up old setting + else + Guda_CharDB.settings.bgTransparency = 0.15 + end + end if Guda_CharDB.settings.hideFooter == nil then Guda_CharDB.settings.hideFooter = false end diff --git a/Core/Init.lua b/Core/Init.lua index 7453306..da08e48 100644 --- a/Core/Init.lua +++ b/Core/Init.lua @@ -57,27 +57,27 @@ addon.Constants = { Backdrops = { -- Standard frame backdrop (used for main windows) DEFAULT_FRAME = { - bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", + bgFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, - tileSize = 32, + tileSize = 16, edgeSize = 32, insets = { left = 11, right = 12, top = 12, bottom = 11 } }, -- Minimalist border (used when "hide borders" setting is enabled) MINIMALIST_BORDER = { - bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", + bgFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, - tileSize = 32, + tileSize = 16, edgeSize = 2, insets = { left = 0, right = 0, top = 0, bottom = 0 } }, -- Dropdown/popup backdrop (used for character selection dropdowns) DROPDOWN = { - bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", + bgFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, @@ -88,7 +88,7 @@ addon.Constants = { -- Backdrop colors (common configurations) BackdropColors = { - DEFAULT = {r = 0, g = 0, b = 0, a = 0.9}, + DEFAULT = {r = 0, g = 0, b = 0, a = 0.85}, DROPDOWN = {r = 0, g = 0, b = 0, a = 0.95}, }, } @@ -196,7 +196,18 @@ function addon:ApplyBackdrop(frame, backdropType, colorType) end frame:SetBackdrop(backdrop) - frame:SetBackdropColor(color.r, color.g, color.b, color.a) + + -- If it's a main frame, we should respect the transparency setting + local frameName = frame:GetName() + if frameName == "Guda_BagFrame" or frameName == "Guda_BankFrame" or frameName == "Guda_SettingsPopup" or frameName == "Guda_QuestItemBar" then + if Guda_ApplyBackgroundTransparency then + Guda_ApplyBackgroundTransparency() + else + frame:SetBackdropColor(color.r, color.g, color.b, color.a) + end + else + frame:SetBackdropColor(color.r, color.g, color.b, color.a) + end -- Set border color to white for minimalist borders if backdropType == "MINIMALIST_BORDER" then diff --git a/Core/Main.lua b/Core/Main.lua index 04c72a6..5ac2448 100644 --- a/Core/Main.lua +++ b/Core/Main.lua @@ -43,6 +43,11 @@ function Main:Initialize() addon.Modules.SettingsPopup:Initialize() + -- Apply initial transparency settings + if Guda_ApplyBackgroundTransparency then + Guda_ApplyBackgroundTransparency() + end + -- Initialize tooltip if addon.Modules.Tooltip then addon.Modules.Tooltip:Initialize() diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index a97b827..331f018 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -38,6 +38,9 @@ end -- OnLoad function Guda_BagFrame_OnLoad(self) + -- Set up initial backdrop + addon:ApplyBackdrop(self, "DEFAULT_FRAME") + -- Set up search box placeholder local searchBox = getglobal(self:GetName().."_SearchBar_SearchBox") if searchBox then @@ -96,6 +99,11 @@ function Guda_BagFrame_OnShow(self) BagFrame:UpdateFooterVisibility() end + -- Apply frame transparency + if Guda_ApplyBackgroundTransparency then + Guda_ApplyBackgroundTransparency() + end + BagFrame:Update() end diff --git a/UI/BagFrame.xml b/UI/BagFrame.xml index 6399a22..6bf843a 100644 --- a/UI/BagFrame.xml +++ b/UI/BagFrame.xml @@ -15,7 +15,7 @@ - + @@ -25,7 +25,6 @@ - diff --git a/UI/BankFrame.lua b/UI/BankFrame.lua index 59afa96..a08c5ca 100644 --- a/UI/BankFrame.lua +++ b/UI/BankFrame.lua @@ -16,6 +16,9 @@ local bankClickCatcher = nil -- OnLoad function Guda_BankFrame_OnLoad(self) + -- Set up initial backdrop + addon:ApplyBackdrop(self, "DEFAULT_FRAME") + -- Set up search box placeholder local searchBox = getglobal(self:GetName().."_SearchBar_SearchBox") if searchBox then @@ -67,6 +70,11 @@ function Guda_BankFrame_OnShow(self) BankFrame:UpdateFooterVisibility() end + -- Apply frame transparency + if Guda_ApplyBackgroundTransparency then + Guda_ApplyBackgroundTransparency() + end + BankFrame:Update() end diff --git a/UI/BankFrame.xml b/UI/BankFrame.xml index 2bf3685..0d22445 100644 --- a/UI/BankFrame.xml +++ b/UI/BankFrame.xml @@ -15,7 +15,7 @@ - + @@ -25,7 +25,6 @@ - diff --git a/UI/SettingsPopup.lua b/UI/SettingsPopup.lua index 86531fb..c361d89 100644 --- a/UI/SettingsPopup.lua +++ b/UI/SettingsPopup.lua @@ -16,6 +16,9 @@ end -- OnLoad function Guda_SettingsPopup_OnLoad(self) + -- Set up initial backdrop + Guda:ApplyBackdrop(self, "DEFAULT_FRAME") + local title = getglobal(self:GetName().."_Title") title:SetText("Guda Settings") -- Increase title font size @@ -62,6 +65,7 @@ function Guda_SettingsPopup_OnShow(self) if hoverBagline == nil then hoverBagline = false end + local bgTransparency = Guda.Modules.DB:GetSetting("bgTransparency") or 0.15 -- Update sliders and checkboxes local bagSlider = getglobal("Guda_SettingsPopup_BagColumnsSlider") @@ -69,6 +73,7 @@ function Guda_SettingsPopup_OnShow(self) local iconSizeSlider = getglobal("Guda_SettingsPopup_IconSizeSlider") local iconFontSizeSlider = getglobal("Guda_SettingsPopup_IconFontSizeSlider") local iconSpacingSlider = getglobal("Guda_SettingsPopup_IconSpacingSlider") + local bgTransparencySlider = getglobal("Guda_SettingsPopup_BgTransparencySlider") local lockCheckbox = getglobal("Guda_SettingsPopup_LockBagsCheckbox") local hideBordersCheckbox = getglobal("Guda_SettingsPopup_HideBordersCheckbox") local qualityBorderEquipmentCheckbox = getglobal("Guda_SettingsPopup_QualityBorderEquipmentCheckbox") @@ -97,6 +102,10 @@ function Guda_SettingsPopup_OnShow(self) iconSpacingSlider:SetValue(iconSpacing) end + if bgTransparencySlider then + bgTransparencySlider:SetValue(bgTransparency) + end + if lockCheckbox then lockCheckbox:SetChecked(lockBags and 1 or 0) end @@ -220,6 +229,60 @@ function Guda_SettingsPopup_BankColumnsSlider_OnValueChanged(self) end end +-- Background Transparency Slider OnLoad +function Guda_SettingsPopup_BgTransparencySlider_OnLoad(self) + getglobal(self:GetName().."Low"):SetText("0%") + getglobal(self:GetName().."High"):SetText("100%") + + local text = getglobal(self:GetName().."Text") + text:SetText("Background Transparency") + + -- Increase font size + local font, _, flags = text:GetFont() + if font then + text:SetFont(font, 12, flags) + end + + self:SetMinMaxValues(0.0, 1.0) + self:SetValueStep(0.05) + + local currentValue = Guda.Modules.DB:GetSetting("bgTransparency") or 0.15 + self:SetValue(currentValue) +end + +-- Background Transparency Slider OnValueChanged +function Guda_SettingsPopup_BgTransparencySlider_OnValueChanged(self) + local value = self:GetValue() + -- Round to 2 decimal places + value = math.floor(value * 100 + 0.5) / 100 + + -- Update display text + getglobal(self:GetName().."Text"):SetText("Background Transparency: " .. math.floor(value * 100) .. "%") + + -- Save setting + Guda.Modules.DB:SetSetting("bgTransparency", value) + + -- Apply transparency + Guda_ApplyBackgroundTransparency() +end + +-- Apply background transparency to bag and bank frames +function Guda_ApplyBackgroundTransparency() + local transparency = Guda.Modules.DB:GetSetting("bgTransparency") or 0.15 + local alpha = 1.0 - transparency + + local frames = { "Guda_BagFrame", "Guda_BankFrame", "Guda_SettingsPopup", "Guda_QuestItemBar" } + for _, frameName in ipairs(frames) do + local frame = getglobal(frameName) + if frame then + -- Reset frame alpha to 1.0 (previous version might have set it) + frame:SetAlpha(1.0) + -- Set backdrop color (background only) + frame:SetBackdropColor(0, 0, 0, alpha) + end + end +end + -- Icon Size Slider OnLoad function Guda_SettingsPopup_IconSizeSlider_OnLoad(self) getglobal(self:GetName().."Low"):SetText("30px") diff --git a/UI/SettingsPopup.xml b/UI/SettingsPopup.xml index af7688f..602f1fd 100644 --- a/UI/SettingsPopup.xml +++ b/UI/SettingsPopup.xml @@ -3,7 +3,7 @@ - + @@ -14,7 +14,7 @@ - + @@ -24,7 +24,6 @@ - @@ -170,10 +169,32 @@ + + + + + + + + + + + + + + + Guda_SettingsPopup_BgTransparencySlider_OnLoad(this) + + + Guda_SettingsPopup_BgTransparencySlider_OnValueChanged(this) + + + + - +