diff --git a/Core/Database.lua b/Core/Database.lua index 7809f42..67f2752 100644 --- a/Core/Database.lua +++ b/Core/Database.lua @@ -42,13 +42,16 @@ function DB:Initialize() showQualityBorderEquipment = true, showQualityBorderOther = true, showSearchBar = true, - showQuestBar = true, hoverBagline = false, + hideFooter = false, }, } end -- Ensure new settings exist for existing installations + if Guda_CharDB.settings.hideFooter == nil then + Guda_CharDB.settings.hideFooter = false + end if Guda_CharDB.settings.hoverBagline == nil then Guda_CharDB.settings.hoverBagline = false end diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index 3be077d..a97b827 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -91,6 +91,11 @@ function Guda_BagFrame_OnShow(self) BagFrame:UpdateSearchBarVisibility() end + -- Apply footer visibility setting + if BagFrame.UpdateFooterVisibility then + BagFrame:UpdateFooterVisibility() + end + BagFrame:Update() end @@ -152,10 +157,17 @@ end -- Update bagline layout (hover option) function BagFrame:UpdateBaglineLayout() - local hoverBagline = addon.Modules.DB:GetSetting("hoverBagline") + local hideFooter = addon.Modules.DB:GetSetting("hideFooter") local toolbar = getglobal("Guda_BagFrame_Toolbar") if not toolbar then return end + if hideFooter then + toolbar:Hide() + return + end + + local hoverBagline = addon.Modules.DB:GetSetting("hoverBagline") + local bag0 = getglobal("Guda_BagFrame_Toolbar_BagSlot0") local bag1 = getglobal("Guda_BagFrame_Toolbar_BagSlot1") local bag2 = getglobal("Guda_BagFrame_Toolbar_BagSlot2") @@ -528,7 +540,13 @@ function BagFrame:ResizeFrame(currentRow, currentCol, columns) local searchBarHeight = 30 local footerHeight local frameHeight - if showSearchBar then + + local hideFooter = addon.Modules.DB:GetSetting("hideFooter") + + if hideFooter then + footerHeight = 10 -- Small padding at bottom + frameHeight = containerHeight + titleHeight + (showSearchBar and searchBarHeight or 0) + footerHeight + elseif showSearchBar then footerHeight = 55 -- Increased footer height when search bar is visible (toolbar 40px + spacing 15px) frameHeight = containerHeight + titleHeight + searchBarHeight + footerHeight -- 125 total else @@ -681,8 +699,14 @@ function BagFrame:PassesSearchFilter(itemData) end function BagFrame:UpdateMoney() + local hideFooter = addon.Modules.DB:GetSetting("hideFooter") local moneyFrame = getglobal("Guda_BagFrame_MoneyFrame") + if hideFooter then + if moneyFrame then moneyFrame:Hide() end + return + end + if not moneyFrame then addon:Debug("Guda_BagFrame exists: " .. tostring(getglobal("Guda_BagFrame") ~= nil)) @@ -1676,6 +1700,25 @@ function BagFrame:UpdateSearchBarVisibility() end end +-- Update footer visibility based on settings +function BagFrame:UpdateFooterVisibility() + local hideFooter = addon.Modules.DB:GetSetting("hideFooter") + local toolbar = getglobal("Guda_BagFrame_Toolbar") + local moneyFrame = getglobal("Guda_BagFrame_MoneyFrame") + + if hideFooter then + if toolbar then toolbar:Hide() end + if moneyFrame then moneyFrame:Hide() end + else + if toolbar then toolbar:Show() end + if moneyFrame then moneyFrame:Show() end + + -- Trigger layout updates to ensure they are correctly positioned + self:UpdateBaglineLayout() + self:UpdateMoney() + end +end + -- Bag Slot Button Handlers -- OnLoad handler for bag slot buttons diff --git a/UI/BankFrame.lua b/UI/BankFrame.lua index fa4cc8c..59afa96 100644 --- a/UI/BankFrame.lua +++ b/UI/BankFrame.lua @@ -57,13 +57,18 @@ function Guda_BankFrame_OnShow(self) BankFrame:UpdateBorderVisibility() end - -- Apply search bar visibility setting - if BankFrame.UpdateSearchBarVisibility then - BankFrame:UpdateSearchBarVisibility() - end + -- Apply search bar visibility setting + if BankFrame.UpdateSearchBarVisibility then + BankFrame:UpdateSearchBarVisibility() + end - BankFrame:Update() -end + -- Apply footer visibility setting + if BankFrame.UpdateFooterVisibility then + BankFrame:UpdateFooterVisibility() + end + + BankFrame:Update() + end -- Toggle visibility function BankFrame:Toggle() @@ -360,7 +365,13 @@ function BankFrame:ResizeFrame(currentRow, currentCol, columns) local searchBarHeight = 30 local footerHeight = 40 local frameHeight - if showSearchBar then + + local hideFooter = addon.Modules.DB:GetSetting("hideFooter") + + if hideFooter then + footerHeight = 10 -- Small padding at bottom + frameHeight = containerHeight + titleHeight + (showSearchBar and searchBarHeight or 0) + footerHeight + elseif showSearchBar then frameHeight = containerHeight + titleHeight + searchBarHeight + footerHeight -- 125 total else frameHeight = containerHeight + titleHeight + footerHeight -- 80 total @@ -451,8 +462,14 @@ end -- Update money display function BankFrame:UpdateMoney() + local hideFooter = addon.Modules.DB:GetSetting("hideFooter") local moneyFrame = getglobal("Guda_BankFrame_MoneyFrame") + if hideFooter then + if moneyFrame then moneyFrame:Hide() end + return + end + if not moneyFrame then addon:Debug("Bank MoneyFrame not found! Checking parent...") addon:Debug("Guda_BankFrame exists: " .. tostring(getglobal("Guda_BankFrame") ~= nil)) @@ -945,6 +962,24 @@ function BankFrame:UpdateSearchBarVisibility() end end +-- Update footer visibility based on settings +function BankFrame:UpdateFooterVisibility() + local hideFooter = addon.Modules.DB:GetSetting("hideFooter") + local toolbar = getglobal("Guda_BankFrame_Toolbar") + local moneyFrame = getglobal("Guda_BankFrame_MoneyFrame") + + if hideFooter then + if toolbar then toolbar:Hide() end + if moneyFrame then moneyFrame:Hide() end + else + if toolbar then toolbar:Show() end + if moneyFrame then moneyFrame:Show() end + + -- Trigger layout updates to ensure they are correctly positioned + self:UpdateMoney() + end +end + -- Initialize function BankFrame:Initialize() -- Hide Blizzard bank frame on load (pfUI style) diff --git a/UI/SettingsPopup.lua b/UI/SettingsPopup.lua index 497e8de..86531fb 100644 --- a/UI/SettingsPopup.lua +++ b/UI/SettingsPopup.lua @@ -339,6 +339,9 @@ function Guda_SettingsPopup_IconSpacingSlider_OnValueChanged(self) -- Update bank frame local bankFrame = getglobal("Guda_BankFrame") if bankFrame and bankFrame:IsShown() then + if Guda.Modules.BankFrame.UpdateFooterVisibility then + Guda.Modules.BankFrame:UpdateFooterVisibility() + end Guda.Modules.BankFrame:Update() end end @@ -658,6 +661,58 @@ function Guda_SettingsPopup_HoverBaglineCheckbox_OnClick(self) end end +-- Hide Footer Checkbox OnLoad +function Guda_SettingsPopup_HideFooterCheckbox_OnLoad(self) + local text = getglobal(self:GetName().."Text") + if text then + text:SetText("Hide Footer") + + -- Increase font size + local font, _, flags = text:GetFont() + if font then + text:SetFont(font, 13, flags) + end + end + + local hideFooter = false + if Guda and Guda.Modules and Guda.Modules.DB then + hideFooter = Guda.Modules.DB:GetSetting("hideFooter") + if hideFooter == nil then + hideFooter = false + end + end + + self:SetChecked(hideFooter and 1 or 0) +end + +-- Hide Footer Checkbox OnClick +function Guda_SettingsPopup_HideFooterCheckbox_OnClick(self) + local isChecked = self:GetChecked() == 1 + + -- Save setting + if Guda and Guda.Modules and Guda.Modules.DB then + Guda.Modules.DB:SetSetting("hideFooter", isChecked) + end + + -- Update bag frame + local bagFrame = getglobal("Guda_BagFrame") + if bagFrame and bagFrame:IsShown() then + if Guda.Modules.BagFrame.UpdateFooterVisibility then + Guda.Modules.BagFrame:UpdateFooterVisibility() + end + Guda.Modules.BagFrame:Update() + end + + -- Update bank frame + local bankFrame = getglobal("Guda_BankFrame") + if bankFrame and bankFrame:IsShown() then + if Guda.Modules.BankFrame.UpdateFooterVisibility then + Guda.Modules.BankFrame:UpdateFooterVisibility() + end + Guda.Modules.BankFrame:Update() + end +end + -- Initialize function SettingsPopup:Initialize() Guda:Debug("Settings popup initialized") diff --git a/UI/SettingsPopup.xml b/UI/SettingsPopup.xml index 405462b..af7688f 100644 --- a/UI/SettingsPopup.xml +++ b/UI/SettingsPopup.xml @@ -302,6 +302,25 @@ + + + + + + + + + + + + + Guda_SettingsPopup_HideFooterCheckbox_OnLoad(this) + + + Guda_SettingsPopup_HideFooterCheckbox_OnClick(this) + + +