ui: settings optimized
This commit is contained in:
@@ -186,6 +186,11 @@ function Guda_BankFrame_OnShow(self)
|
|||||||
Guda_ApplyBackgroundTransparency()
|
Guda_ApplyBackgroundTransparency()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Apply lock state
|
||||||
|
if BankFrame.UpdateLockState then
|
||||||
|
BankFrame:UpdateLockState()
|
||||||
|
end
|
||||||
|
|
||||||
BankFrame:Update()
|
BankFrame:Update()
|
||||||
|
|
||||||
-- Schedule deferred usability check to fix false positives from uncached item data
|
-- Schedule deferred usability check to fix false positives from uncached item data
|
||||||
@@ -259,6 +264,65 @@ function BankFrame:UpdateLockStates()
|
|||||||
Guda_UpdateLockStates(bankBagParents)
|
Guda_UpdateLockStates(bankBagParents)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Update window lock state (enable/disable dragging)
|
||||||
|
function BankFrame:UpdateLockState()
|
||||||
|
if not addon or not addon.Modules or not addon.Modules.DB then return end
|
||||||
|
|
||||||
|
local frame = getglobal("Guda_BankFrame")
|
||||||
|
if not frame then return end
|
||||||
|
|
||||||
|
local isLocked = addon.Modules.DB:GetSetting("lockBags")
|
||||||
|
if isLocked == nil then isLocked = false end
|
||||||
|
|
||||||
|
local toolbar = getglobal("Guda_BankFrame_Toolbar")
|
||||||
|
|
||||||
|
if isLocked then
|
||||||
|
if frame.SetScript then
|
||||||
|
frame:SetScript("OnMouseDown", function()
|
||||||
|
local searchBox = getglobal("Guda_BankFrame_SearchBar_SearchBox")
|
||||||
|
if searchBox then searchBox:ClearFocus() end
|
||||||
|
end)
|
||||||
|
frame:SetScript("OnMouseUp", nil)
|
||||||
|
end
|
||||||
|
if toolbar and toolbar.SetScript then
|
||||||
|
toolbar:SetScript("OnMouseDown", function()
|
||||||
|
local searchBox = getglobal("Guda_BankFrame_SearchBar_SearchBox")
|
||||||
|
if searchBox then searchBox:ClearFocus() end
|
||||||
|
end)
|
||||||
|
toolbar:SetScript("OnMouseUp", nil)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if frame and frame.SetScript then
|
||||||
|
frame:SetScript("OnMouseDown", function()
|
||||||
|
local searchBox = getglobal("Guda_BankFrame_SearchBar_SearchBox")
|
||||||
|
if searchBox then searchBox:ClearFocus() end
|
||||||
|
local bankFrame = getglobal("Guda_BankFrame")
|
||||||
|
if bankFrame and arg1 == "LeftButton" then
|
||||||
|
bankFrame:StartMoving()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
frame:SetScript("OnMouseUp", function()
|
||||||
|
local bankFrame = getglobal("Guda_BankFrame")
|
||||||
|
if bankFrame then bankFrame:StopMovingOrSizing() end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if toolbar and toolbar.SetScript then
|
||||||
|
toolbar:SetScript("OnMouseDown", function()
|
||||||
|
local searchBox = getglobal("Guda_BankFrame_SearchBar_SearchBox")
|
||||||
|
if searchBox then searchBox:ClearFocus() end
|
||||||
|
local bankFrame = getglobal("Guda_BankFrame")
|
||||||
|
if bankFrame and arg1 == "LeftButton" then
|
||||||
|
bankFrame:StartMoving()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
toolbar:SetScript("OnMouseUp", function()
|
||||||
|
local bankFrame = getglobal("Guda_BankFrame")
|
||||||
|
if bankFrame then bankFrame:StopMovingOrSizing() end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Update a single slot without full frame redraw (used for manual item moves)
|
-- Update a single slot without full frame redraw (used for manual item moves)
|
||||||
function BankFrame:UpdateSingleSlot(bagID, slotID, passedButton)
|
function BankFrame:UpdateSingleSlot(bagID, slotID, passedButton)
|
||||||
if not Guda_BankFrame:IsShown() then
|
if not Guda_BankFrame:IsShown() then
|
||||||
|
|||||||
+176
-31
@@ -6,6 +6,23 @@ local addon = Guda
|
|||||||
local SettingsPopup = {}
|
local SettingsPopup = {}
|
||||||
addon.Modules.SettingsPopup = SettingsPopup
|
addon.Modules.SettingsPopup = SettingsPopup
|
||||||
|
|
||||||
|
-- Section header helper: creates gold-colored section label with separator line
|
||||||
|
local function CreateSectionHeader(parent, text, yOffset)
|
||||||
|
local label = parent:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||||
|
label:SetPoint("TOPLEFT", parent, "TOPLEFT", 5, yOffset)
|
||||||
|
label:SetText(text)
|
||||||
|
label:SetTextColor(1, 0.82, 0, 1)
|
||||||
|
|
||||||
|
-- Separator line extending from label to the right edge
|
||||||
|
local line = parent:CreateTexture(nil, "ARTWORK")
|
||||||
|
line:SetHeight(1)
|
||||||
|
line:SetPoint("LEFT", label, "RIGHT", 8, 0)
|
||||||
|
line:SetPoint("RIGHT", parent, "RIGHT", -5, 0)
|
||||||
|
line:SetTexture(1, 0.82, 0, 0.3)
|
||||||
|
|
||||||
|
return label
|
||||||
|
end
|
||||||
|
|
||||||
-- Global function to open settings (called from XML)
|
-- Global function to open settings (called from XML)
|
||||||
function Guda_OpenSettings()
|
function Guda_OpenSettings()
|
||||||
local frame = getglobal("Guda_SettingsPopup")
|
local frame = getglobal("Guda_SettingsPopup")
|
||||||
@@ -40,47 +57,71 @@ function Guda_SettingsPopup_OnLoad(self)
|
|||||||
instructions:SetText(text)
|
instructions:SetText(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Create section headers for each tab
|
||||||
|
local generalTab = getglobal("Guda_SettingsPopup_GeneralTab")
|
||||||
|
if generalTab then
|
||||||
|
CreateSectionHeader(generalTab, "Appearance", -12)
|
||||||
|
CreateSectionHeader(generalTab, "Options", -120)
|
||||||
|
end
|
||||||
|
|
||||||
|
local layoutTab = getglobal("Guda_SettingsPopup_LayoutTab")
|
||||||
|
if layoutTab then
|
||||||
|
CreateSectionHeader(layoutTab, "View", -12)
|
||||||
|
CreateSectionHeader(layoutTab, "Columns", -72)
|
||||||
|
CreateSectionHeader(layoutTab, "Options", -190)
|
||||||
|
end
|
||||||
|
|
||||||
|
local iconsTab = getglobal("Guda_SettingsPopup_IconsTab")
|
||||||
|
if iconsTab then
|
||||||
|
CreateSectionHeader(iconsTab, "Icon", -12)
|
||||||
|
CreateSectionHeader(iconsTab, "Icon Options", -190)
|
||||||
|
end
|
||||||
|
|
||||||
|
local barTab = getglobal("Guda_SettingsPopup_BarTab")
|
||||||
|
if barTab then
|
||||||
|
CreateSectionHeader(barTab, "Quest Bar", -12)
|
||||||
|
CreateSectionHeader(barTab, "Tracked", -120)
|
||||||
|
end
|
||||||
|
|
||||||
Guda:Debug("Settings popup loaded")
|
Guda:Debug("Settings popup loaded")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Tab switching logic (GudaPlates style)
|
-- Tab switching logic (GudaPlates style)
|
||||||
function Guda_SettingsPopup_SelectTab(tabName)
|
function Guda_SettingsPopup_SelectTab(tabName)
|
||||||
-- Hide all tab content frames
|
-- Hide all tab content frames
|
||||||
local generalTab = getglobal("Guda_SettingsPopup_GeneralTab")
|
local tabs = {
|
||||||
local iconsTab = getglobal("Guda_SettingsPopup_IconsTab")
|
general = getglobal("Guda_SettingsPopup_GeneralTab"),
|
||||||
local categoriesTab = getglobal("Guda_SettingsPopup_CategoriesTab")
|
layout = getglobal("Guda_SettingsPopup_LayoutTab"),
|
||||||
local guideTab = getglobal("Guda_SettingsPopup_GuideTab")
|
icons = getglobal("Guda_SettingsPopup_IconsTab"),
|
||||||
|
bar = getglobal("Guda_SettingsPopup_BarTab"),
|
||||||
|
categories = getglobal("Guda_SettingsPopup_CategoriesTab"),
|
||||||
|
guide = getglobal("Guda_SettingsPopup_GuideTab"),
|
||||||
|
}
|
||||||
|
|
||||||
if generalTab then generalTab:Hide() end
|
local bgs = {
|
||||||
if iconsTab then iconsTab:Hide() end
|
general = getglobal("Guda_SettingsPopup_GeneralTabButton_Bg"),
|
||||||
if categoriesTab then categoriesTab:Hide() end
|
layout = getglobal("Guda_SettingsPopup_LayoutTabButton_Bg"),
|
||||||
if guideTab then guideTab:Hide() end
|
icons = getglobal("Guda_SettingsPopup_IconsTabButton_Bg"),
|
||||||
|
bar = getglobal("Guda_SettingsPopup_BarTabButton_Bg"),
|
||||||
|
categories = getglobal("Guda_SettingsPopup_CategoriesTabButton_Bg"),
|
||||||
|
guide = getglobal("Guda_SettingsPopup_GuideTabButton_Bg"),
|
||||||
|
}
|
||||||
|
|
||||||
-- Reset all tab button backgrounds to inactive (0.1 alpha)
|
-- Hide all tabs and reset backgrounds
|
||||||
local generalBg = getglobal("Guda_SettingsPopup_GeneralTabButton_Bg")
|
for _, tab in pairs(tabs) do
|
||||||
local iconsBg = getglobal("Guda_SettingsPopup_IconsTabButton_Bg")
|
if tab then tab:Hide() end
|
||||||
local categoriesBg = getglobal("Guda_SettingsPopup_CategoriesTabButton_Bg")
|
end
|
||||||
local guideBg = getglobal("Guda_SettingsPopup_GuideTabButton_Bg")
|
for _, bg in pairs(bgs) do
|
||||||
|
if bg then bg:SetTexture(1, 1, 1, 0.1) end
|
||||||
if generalBg then generalBg:SetTexture(1, 1, 1, 0.1) end
|
end
|
||||||
if iconsBg then iconsBg:SetTexture(1, 1, 1, 0.1) end
|
|
||||||
if categoriesBg then categoriesBg:SetTexture(1, 1, 1, 0.1) end
|
|
||||||
if guideBg then guideBg:SetTexture(1, 1, 1, 0.1) end
|
|
||||||
|
|
||||||
-- Show selected tab and highlight its button
|
-- Show selected tab and highlight its button
|
||||||
if tabName == "general" then
|
if tabs[tabName] then tabs[tabName]:Show() end
|
||||||
if generalTab then generalTab:Show() end
|
if bgs[tabName] then bgs[tabName]:SetTexture(1, 1, 1, 0.3) end
|
||||||
if generalBg then generalBg:SetTexture(1, 1, 1, 0.3) end
|
|
||||||
elseif tabName == "icons" then
|
-- Special handling for categories tab
|
||||||
if iconsTab then iconsTab:Show() end
|
if tabName == "categories" then
|
||||||
if iconsBg then iconsBg:SetTexture(1, 1, 1, 0.3) end
|
|
||||||
elseif tabName == "categories" then
|
|
||||||
if categoriesTab then categoriesTab:Show() end
|
|
||||||
if categoriesBg then categoriesBg:SetTexture(1, 1, 1, 0.3) end
|
|
||||||
Guda_SettingsPopup_CategoriesTab_Update()
|
Guda_SettingsPopup_CategoriesTab_Update()
|
||||||
elseif tabName == "guide" then
|
|
||||||
if guideTab then guideTab:Show() end
|
|
||||||
if guideBg then guideBg:SetTexture(1, 1, 1, 0.3) end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -149,6 +190,8 @@ function Guda_SettingsPopup_OnShow(self)
|
|||||||
local hoverBaglineCheckbox = getglobal("Guda_SettingsPopup_HoverBaglineCheckbox")
|
local hoverBaglineCheckbox = getglobal("Guda_SettingsPopup_HoverBaglineCheckbox")
|
||||||
local hideFooterCheckbox = getglobal("Guda_SettingsPopup_HideFooterCheckbox")
|
local hideFooterCheckbox = getglobal("Guda_SettingsPopup_HideFooterCheckbox")
|
||||||
local showTooltipCountsCheckbox = getglobal("Guda_SettingsPopup_ShowTooltipCountsCheckbox")
|
local showTooltipCountsCheckbox = getglobal("Guda_SettingsPopup_ShowTooltipCountsCheckbox")
|
||||||
|
local showEquipSetCategoriesCheckbox = getglobal("Guda_SettingsPopup_ShowEquipSetCategoriesCheckbox")
|
||||||
|
local markEquipmentSetsCheckbox = getglobal("Guda_SettingsPopup_MarkEquipmentSetsCheckbox")
|
||||||
local bagViewButton = getglobal("Guda_SettingsPopup_BagViewTypeButton")
|
local bagViewButton = getglobal("Guda_SettingsPopup_BagViewTypeButton")
|
||||||
local bankViewButton = getglobal("Guda_SettingsPopup_BankViewTypeButton")
|
local bankViewButton = getglobal("Guda_SettingsPopup_BankViewTypeButton")
|
||||||
local themeButton = getglobal("Guda_SettingsPopup_ThemeButton")
|
local themeButton = getglobal("Guda_SettingsPopup_ThemeButton")
|
||||||
@@ -226,6 +269,19 @@ function Guda_SettingsPopup_OnShow(self)
|
|||||||
showTooltipCountsCheckbox:SetChecked(showTooltipCounts and 1 or 0)
|
showTooltipCountsCheckbox:SetChecked(showTooltipCounts and 1 or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- New checkboxes
|
||||||
|
local showEquipSetCategories = Guda.Modules.DB:GetSetting("showEquipSetCategories")
|
||||||
|
if showEquipSetCategories == nil then showEquipSetCategories = true end
|
||||||
|
if showEquipSetCategoriesCheckbox then
|
||||||
|
showEquipSetCategoriesCheckbox:SetChecked(showEquipSetCategories and 1 or 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
local markEquipmentSets = Guda.Modules.DB:GetSetting("markEquipmentSets")
|
||||||
|
if markEquipmentSets == nil then markEquipmentSets = true end
|
||||||
|
if markEquipmentSetsCheckbox then
|
||||||
|
markEquipmentSetsCheckbox:SetChecked(markEquipmentSets and 1 or 0)
|
||||||
|
end
|
||||||
|
|
||||||
if bagViewButton then
|
if bagViewButton then
|
||||||
if bagViewType == "single" then
|
if bagViewType == "single" then
|
||||||
bagViewButton:SetText("Bag View: Single")
|
bagViewButton:SetText("Bag View: Single")
|
||||||
@@ -621,7 +677,7 @@ end
|
|||||||
function Guda_SettingsPopup_LockBagsCheckbox_OnLoad(self)
|
function Guda_SettingsPopup_LockBagsCheckbox_OnLoad(self)
|
||||||
local text = getglobal(self:GetName().."Text")
|
local text = getglobal(self:GetName().."Text")
|
||||||
if text then
|
if text then
|
||||||
text:SetText("Lock Bags")
|
text:SetText("Lock Window")
|
||||||
|
|
||||||
-- Increase font size
|
-- Increase font size
|
||||||
local font, _, flags = text:GetFont()
|
local font, _, flags = text:GetFont()
|
||||||
@@ -657,6 +713,11 @@ function Guda_SettingsPopup_LockBagsCheckbox_OnClick(self)
|
|||||||
if Guda and Guda.Modules and Guda.Modules.BagFrame and Guda.Modules.BagFrame.UpdateLockState then
|
if Guda and Guda.Modules and Guda.Modules.BagFrame and Guda.Modules.BagFrame.UpdateLockState then
|
||||||
Guda.Modules.BagFrame:UpdateLockState()
|
Guda.Modules.BagFrame:UpdateLockState()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Update bank frame draggability
|
||||||
|
if Guda and Guda.Modules and Guda.Modules.BankFrame and Guda.Modules.BankFrame.UpdateLockState then
|
||||||
|
Guda.Modules.BankFrame:UpdateLockState()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hide Borders Checkbox OnLoad
|
-- Hide Borders Checkbox OnLoad
|
||||||
@@ -1148,6 +1209,90 @@ function Guda_SettingsPopup_MarkUnusableCheckbox_OnClick(self)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Show Equipment Set Categories Checkbox OnLoad
|
||||||
|
function Guda_SettingsPopup_ShowEquipSetCategoriesCheckbox_OnLoad(self)
|
||||||
|
local text = getglobal(self:GetName().."Text")
|
||||||
|
if text then
|
||||||
|
text:SetText("Equip Set Categories")
|
||||||
|
|
||||||
|
local font, _, flags = text:GetFont()
|
||||||
|
if font then
|
||||||
|
text:SetFont(font, 13, flags)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.tooltipText = "Show equipment set categories in category view."
|
||||||
|
|
||||||
|
local enabled = true
|
||||||
|
if Guda and Guda.Modules and Guda.Modules.DB then
|
||||||
|
enabled = Guda.Modules.DB:GetSetting("showEquipSetCategories")
|
||||||
|
if enabled == nil then enabled = true end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetChecked(enabled and 1 or 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Show Equipment Set Categories Checkbox OnClick
|
||||||
|
function Guda_SettingsPopup_ShowEquipSetCategoriesCheckbox_OnClick(self)
|
||||||
|
local isChecked = self:GetChecked() == 1
|
||||||
|
|
||||||
|
if Guda and Guda.Modules and Guda.Modules.DB then
|
||||||
|
Guda.Modules.DB:SetSetting("showEquipSetCategories", isChecked)
|
||||||
|
end
|
||||||
|
|
||||||
|
local bagFrame = getglobal("Guda_BagFrame")
|
||||||
|
if bagFrame and bagFrame:IsShown() then
|
||||||
|
Guda.Modules.BagFrame:Update()
|
||||||
|
end
|
||||||
|
|
||||||
|
local bankFrame = getglobal("Guda_BankFrame")
|
||||||
|
if bankFrame and bankFrame:IsShown() then
|
||||||
|
Guda.Modules.BankFrame:Update()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Mark Equipment Sets Checkbox OnLoad
|
||||||
|
function Guda_SettingsPopup_MarkEquipmentSetsCheckbox_OnLoad(self)
|
||||||
|
local text = getglobal(self:GetName().."Text")
|
||||||
|
if text then
|
||||||
|
text:SetText("Mark Equipment Sets")
|
||||||
|
|
||||||
|
local font, _, flags = text:GetFont()
|
||||||
|
if font then
|
||||||
|
text:SetFont(font, 13, flags)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.tooltipText = "Show a special icon on items that belong to an equipment set."
|
||||||
|
|
||||||
|
local enabled = true
|
||||||
|
if Guda and Guda.Modules and Guda.Modules.DB then
|
||||||
|
enabled = Guda.Modules.DB:GetSetting("markEquipmentSets")
|
||||||
|
if enabled == nil then enabled = true end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetChecked(enabled and 1 or 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Mark Equipment Sets Checkbox OnClick
|
||||||
|
function Guda_SettingsPopup_MarkEquipmentSetsCheckbox_OnClick(self)
|
||||||
|
local isChecked = self:GetChecked() == 1
|
||||||
|
|
||||||
|
if Guda and Guda.Modules and Guda.Modules.DB then
|
||||||
|
Guda.Modules.DB:SetSetting("markEquipmentSets", isChecked)
|
||||||
|
end
|
||||||
|
|
||||||
|
local bagFrame = getglobal("Guda_BagFrame")
|
||||||
|
if bagFrame and bagFrame:IsShown() then
|
||||||
|
Guda.Modules.BagFrame:Update()
|
||||||
|
end
|
||||||
|
|
||||||
|
local bankFrame = getglobal("Guda_BankFrame")
|
||||||
|
if bankFrame and bankFrame:IsShown() then
|
||||||
|
Guda.Modules.BankFrame:Update()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Theme Dropdown OnClick
|
-- Theme Dropdown OnClick
|
||||||
function Guda_SettingsPopup_ThemeDropdown_OnClick(button)
|
function Guda_SettingsPopup_ThemeDropdown_OnClick(button)
|
||||||
local themes = {
|
local themes = {
|
||||||
|
|||||||
+347
-430
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user