83a1cda15c
The Character Override tab's enabled toggle and frame checkboxes now live on each named profile (profiles[name].override) instead of being keyed by character. This lets the tab's new profile-list dropdown pick which profile's override to view/edit without touching which profile is actually assigned/active for the character - selecting an entry only changes what you're editing. Existing per-character override data is migrated into the character's currently active profile on load. Also style the profile dropdown with ElvUI when available, matching the rest of the options panel.
387 lines
11 KiB
Lua
387 lines
11 KiB
Lua
local ElvSkins
|
|
if ElvUI then
|
|
local E = unpack(ElvUI)
|
|
ElvSkins = E:GetModule("Skins")
|
|
end
|
|
|
|
local function AddClickSound(button)
|
|
button:HookScript("OnClick", function()
|
|
PlaySound("igMainMenuOptionCheckBoxOn")
|
|
end)
|
|
end
|
|
|
|
local function AddCheckboxFeedback(check)
|
|
|
|
check:HookScript("OnClick", function()
|
|
PlaySound("igMainMenuOptionCheckBoxOn")
|
|
end)
|
|
|
|
local text = _G[check:GetName() .. "Text"]
|
|
|
|
if text then
|
|
|
|
local point, relativeTo, relativePoint, xOfs, yOfs = text:GetPoint()
|
|
|
|
check:HookScript("OnMouseDown", function()
|
|
text:SetPoint(point, relativeTo, relativePoint, xOfs + 1, yOfs - 2)
|
|
end)
|
|
|
|
check:HookScript("OnMouseUp", function()
|
|
text:SetPoint(point, relativeTo, relativePoint, xOfs, yOfs)
|
|
end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local panel = CreateFrame("Frame")
|
|
panel.name = "HideCoAUI"
|
|
|
|
local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
title:SetPoint("TOPLEFT", 16, -16)
|
|
title:SetText("HideCoAUI")
|
|
|
|
local titleFont, titleSize = title:GetFont()
|
|
|
|
InterfaceOptions_AddCategory(panel)
|
|
|
|
-- CLASSES SUBCATEGORY --
|
|
|
|
local classesPanel = CreateFrame("Frame")
|
|
classesPanel.name = "Classes"
|
|
classesPanel.parent = panel.name
|
|
|
|
local classesTitle = classesPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
classesTitle:SetPoint("TOPLEFT", 16, -16)
|
|
classesTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
classesTitle:SetText("Classes")
|
|
|
|
local hideAllButton = CreateFrame("Button", "HideCoAHideAllButton", classesPanel, "UIPanelButtonTemplate")
|
|
hideAllButton:SetPoint("TOPLEFT", classesTitle, "BOTTOMLEFT", 0, -12)
|
|
hideAllButton:SetSize(100, 22)
|
|
hideAllButton:SetText("Hide All")
|
|
|
|
local showAllButton = CreateFrame("Button", "HideCoAShowAllButton", classesPanel, "UIPanelButtonTemplate")
|
|
showAllButton:SetPoint("LEFT", hideAllButton, "RIGHT", 8, 0)
|
|
showAllButton:SetSize(100, 22)
|
|
showAllButton:SetText("Show All")
|
|
|
|
if ElvSkins then
|
|
ElvSkins:HandleButton(hideAllButton)
|
|
ElvSkins:HandleButton(showAllButton)
|
|
end
|
|
|
|
local BOX_BACKDROP = {
|
|
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
|
tile = true,
|
|
tileSize = 16,
|
|
insets = { left = 0, right = 0, top = 0, bottom = 0 },
|
|
}
|
|
|
|
local sidebarBox = CreateFrame("Frame", nil, classesPanel)
|
|
sidebarBox:SetPoint("TOPLEFT", hideAllButton, "BOTTOMLEFT", 0, -12)
|
|
sidebarBox:SetPoint("BOTTOMLEFT", classesPanel, "BOTTOMLEFT", 0, 8)
|
|
sidebarBox:SetWidth(158)
|
|
|
|
sidebarBox:SetBackdrop(BOX_BACKDROP)
|
|
sidebarBox:SetBackdropColor(0.08, 0.10, 0.14, 0.5)
|
|
|
|
local contentBox = CreateFrame("Frame", nil, classesPanel)
|
|
contentBox:SetPoint("TOPLEFT", sidebarBox, "TOPRIGHT", 3, 0)
|
|
contentBox:SetPoint("BOTTOMRIGHT", classesPanel, "BOTTOMRIGHT", -8, 8)
|
|
|
|
contentBox:SetBackdrop(BOX_BACKDROP)
|
|
contentBox:SetBackdropColor(0.08, 0.10, 0.14, 0.5)
|
|
|
|
local classSidebar = CreateFrame("Frame", nil, sidebarBox)
|
|
classSidebar:SetPoint("TOPLEFT", sidebarBox, "TOPLEFT", 4, -4)
|
|
classSidebar:SetPoint("BOTTOMRIGHT", sidebarBox, "BOTTOMRIGHT", -4, 4)
|
|
|
|
local classContent = CreateFrame("Frame", nil, contentBox)
|
|
classContent:SetPoint("TOPLEFT", contentBox, "TOPLEFT", 12, -4)
|
|
classContent:SetPoint("BOTTOMRIGHT", contentBox, "BOTTOMRIGHT", -12, 4)
|
|
|
|
local classLabel = classContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
classLabel:SetPoint("TOPLEFT", classContent, "TOPLEFT", 16, -12)
|
|
|
|
local checks = {}
|
|
local selectedClass = nil
|
|
|
|
local previousAnchor = classLabel
|
|
local previousSpacing = -20
|
|
|
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
|
|
|
local check = CreateFrame("CheckButton", "HideCoAClassCheck" .. frameName, classContent, "InterfaceOptionsCheckButtonTemplate")
|
|
check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", 0, previousSpacing)
|
|
|
|
_G[check:GetName() .. "Text"]:SetText("Hide " .. frameName)
|
|
|
|
check.frameName = frameName
|
|
|
|
if ElvSkins then
|
|
ElvSkins:HandleCheckBox(check)
|
|
end
|
|
|
|
check:SetScript("OnClick", function(self)
|
|
|
|
if not selectedClass then
|
|
return
|
|
end
|
|
|
|
HideCoA.GetActiveClassSettings()[selectedClass][self.frameName] = self:GetChecked() and true or false
|
|
HideCoA.ApplySetting()
|
|
|
|
end)
|
|
|
|
AddCheckboxFeedback(check)
|
|
|
|
checks[frameName] = check
|
|
previousAnchor = check
|
|
previousSpacing = -8
|
|
|
|
end
|
|
|
|
local tabButtons = {}
|
|
local TAB_HEIGHT = 18
|
|
|
|
local function SelectClass(class)
|
|
|
|
selectedClass = class
|
|
|
|
local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class
|
|
classLabel:SetText(displayName)
|
|
|
|
local color = RAID_CLASS_COLORS and RAID_CLASS_COLORS[class]
|
|
if color then
|
|
classLabel:SetTextColor(color.r, color.g, color.b)
|
|
else
|
|
classLabel:SetTextColor(1, 1, 1)
|
|
end
|
|
|
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
|
checks[frameName]:SetChecked(HideCoA.GetActiveClassSettings()[class][frameName])
|
|
end
|
|
|
|
for tabClass, button in pairs(tabButtons) do
|
|
if tabClass == class then
|
|
button.selectedTexture:Show()
|
|
else
|
|
button.selectedTexture:Hide()
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
for index, class in ipairs(HideCoA.CUSTOM_CLASSES) do
|
|
|
|
local button = CreateFrame("Button", "HideCoAClassTab" .. class, classSidebar)
|
|
button:SetHeight(TAB_HEIGHT)
|
|
button:SetPoint("TOPLEFT", classSidebar, "TOPLEFT", 4, -4 - (index - 1) * TAB_HEIGHT)
|
|
button:SetPoint("RIGHT", classSidebar, "RIGHT", -4, 0)
|
|
|
|
local selectedTexture = button:CreateTexture(nil, "BACKGROUND")
|
|
selectedTexture:SetAllPoints()
|
|
selectedTexture:SetTexture(1, 1, 1, 0.2)
|
|
selectedTexture:Hide()
|
|
button.selectedTexture = selectedTexture
|
|
|
|
button:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD")
|
|
|
|
local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class
|
|
local text = button:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
text:SetPoint("LEFT", 4, 0)
|
|
text:SetText(displayName)
|
|
|
|
local color = RAID_CLASS_COLORS and RAID_CLASS_COLORS[class]
|
|
if color then
|
|
text:SetTextColor(color.r, color.g, color.b)
|
|
end
|
|
|
|
button:SetScript("OnClick", function()
|
|
SelectClass(class)
|
|
end)
|
|
|
|
AddClickSound(button)
|
|
|
|
tabButtons[class] = button
|
|
|
|
end
|
|
|
|
hideAllButton:SetScript("OnClick", function()
|
|
HideCoA.HideAllFrames()
|
|
if selectedClass then
|
|
SelectClass(selectedClass)
|
|
end
|
|
end)
|
|
|
|
AddClickSound(hideAllButton)
|
|
|
|
showAllButton:SetScript("OnClick", function()
|
|
HideCoA.ShowAllFrames()
|
|
if selectedClass then
|
|
SelectClass(selectedClass)
|
|
end
|
|
end)
|
|
|
|
AddClickSound(showAllButton)
|
|
|
|
classesPanel:SetScript("OnShow", function()
|
|
SelectClass(selectedClass or HideCoA.CUSTOM_CLASSES[1])
|
|
end)
|
|
|
|
InterfaceOptions_AddCategory(classesPanel)
|
|
|
|
-- CHARACTER OVERRIDE SUBCATEGORY --
|
|
|
|
local characterOverridePanel = CreateFrame("Frame")
|
|
characterOverridePanel.name = "Character Override"
|
|
characterOverridePanel.parent = panel.name
|
|
|
|
local characterOverrideTitle = characterOverridePanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
characterOverrideTitle:SetPoint("TOPLEFT", 16, -16)
|
|
characterOverrideTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
characterOverrideTitle:SetText("Character Override")
|
|
|
|
local overrideProfileDropdown = CreateFrame("Frame", "HideCoAOverrideProfileDropDown", characterOverridePanel, "UIDropDownMenuTemplate")
|
|
overrideProfileDropdown:SetPoint("TOPLEFT", characterOverrideTitle, "BOTTOMLEFT", -16, -12)
|
|
|
|
if ElvSkins then
|
|
ElvSkins:HandleDropDownBox(overrideProfileDropdown, 180)
|
|
end
|
|
|
|
UIDropDownMenu_SetWidth(overrideProfileDropdown, 180)
|
|
|
|
local overrideEnabledCheck = CreateFrame("CheckButton", "HideCoAOverrideEnabledCheck", characterOverridePanel, "InterfaceOptionsCheckButtonTemplate")
|
|
overrideEnabledCheck:SetPoint("TOPLEFT", overrideProfileDropdown, "BOTTOMLEFT", 16, -8)
|
|
_G[overrideEnabledCheck:GetName() .. "Text"]:SetText("Override class options for this character")
|
|
|
|
if ElvSkins then
|
|
ElvSkins:HandleCheckBox(overrideEnabledCheck)
|
|
end
|
|
|
|
local overrideChecks = {}
|
|
local selectedOverrideProfile = nil
|
|
|
|
local overridePreviousAnchor = overrideEnabledCheck
|
|
local overridePreviousSpacing = -16
|
|
|
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
|
|
|
local check = CreateFrame("CheckButton", "HideCoAOverrideCheck" .. frameName, characterOverridePanel, "InterfaceOptionsCheckButtonTemplate")
|
|
check:SetPoint("TOPLEFT", overridePreviousAnchor, "BOTTOMLEFT", 0, overridePreviousSpacing)
|
|
_G[check:GetName() .. "Text"]:SetText("Hide " .. frameName)
|
|
|
|
check.frameName = frameName
|
|
|
|
if ElvSkins then
|
|
ElvSkins:HandleCheckBox(check)
|
|
end
|
|
|
|
check:SetScript("OnClick", function(self)
|
|
if selectedOverrideProfile then
|
|
HideCoA.SetProfileOverrideFrameHidden(selectedOverrideProfile, self.frameName, self:GetChecked() and true or false)
|
|
end
|
|
end)
|
|
|
|
AddCheckboxFeedback(check)
|
|
|
|
overrideChecks[frameName] = check
|
|
overridePreviousAnchor = check
|
|
overridePreviousSpacing = -8
|
|
|
|
end
|
|
|
|
local function SetOverrideCheckEnabled(check, enabled)
|
|
|
|
if enabled then
|
|
check:Enable()
|
|
_G[check:GetName() .. "Text"]:SetTextColor(1, 1, 1)
|
|
else
|
|
check:Disable()
|
|
_G[check:GetName() .. "Text"]:SetTextColor(0.5, 0.5, 0.5)
|
|
end
|
|
|
|
end
|
|
|
|
local function RefreshCharacterOverrideTab()
|
|
|
|
if not selectedOverrideProfile then
|
|
return
|
|
end
|
|
|
|
local override = HideCoA.GetProfileOverride(selectedOverrideProfile)
|
|
|
|
overrideEnabledCheck:SetChecked(override.enabled)
|
|
|
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
|
overrideChecks[frameName]:SetChecked(override.frameSettings[frameName])
|
|
SetOverrideCheckEnabled(overrideChecks[frameName], override.enabled)
|
|
end
|
|
|
|
end
|
|
|
|
local function SelectOverrideProfile(name)
|
|
selectedOverrideProfile = name
|
|
UIDropDownMenu_SetText(overrideProfileDropdown, name)
|
|
RefreshCharacterOverrideTab()
|
|
end
|
|
|
|
local function OverrideProfileDropDown_OnClick(self)
|
|
SelectOverrideProfile(self.value)
|
|
end
|
|
|
|
UIDropDownMenu_Initialize(overrideProfileDropdown, function(self, level)
|
|
|
|
if not (HideCoADB and HideCoADB.profiles) then
|
|
return
|
|
end
|
|
|
|
for _, name in ipairs(HideCoA.GetProfileNames()) do
|
|
|
|
local info = UIDropDownMenu_CreateInfo()
|
|
info.text = name
|
|
info.value = name
|
|
info.func = OverrideProfileDropDown_OnClick
|
|
info.checked = (selectedOverrideProfile == name)
|
|
|
|
UIDropDownMenu_AddButton(info, level)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
overrideEnabledCheck:SetScript("OnClick", function(self)
|
|
if selectedOverrideProfile then
|
|
HideCoA.SetProfileOverrideEnabled(selectedOverrideProfile, self:GetChecked() and true or false)
|
|
RefreshCharacterOverrideTab()
|
|
end
|
|
end)
|
|
|
|
AddCheckboxFeedback(overrideEnabledCheck)
|
|
|
|
characterOverridePanel:SetScript("OnShow", function()
|
|
SelectOverrideProfile(selectedOverrideProfile or HideCoA.GetActiveProfileName())
|
|
end)
|
|
|
|
InterfaceOptions_AddCategory(characterOverridePanel)
|
|
|
|
-- ABOUT SUBCATEGORY --
|
|
|
|
local aboutPanel = CreateFrame("Frame")
|
|
aboutPanel.name = "About"
|
|
aboutPanel.parent = panel.name
|
|
|
|
local aboutTitle = aboutPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
aboutTitle:SetPoint("TOPLEFT", 16, -16)
|
|
aboutTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
aboutTitle:SetText("About")
|
|
|
|
InterfaceOptions_AddCategory(aboutPanel)
|
|
|
|
-- Jump straight to the Classes subcategory when the HideCoAUI parent node itself is opened.
|
|
panel:SetScript("OnShow", function(self)
|
|
InterfaceOptionsFrame_OpenToCategory(classesPanel)
|
|
self:Hide()
|
|
end)
|