From ea4849fc10727b70d07b61336bcdda7e03da3b9b Mon Sep 17 00:00:00 2001 From: Narcasung Date: Tue, 7 Jul 2026 23:23:25 +0200 Subject: [PATCH] Revamp options UI: dropdown-based class picker and per-character override tab Replaces the 21-tab class sidebar with a single Classes tab driven by a dropdown plus Hide All/Show All bulk actions. Reworks the old Profiles tab into "Character Override": a single toggle that lets a character's frame hide/show choices bypass its class settings, backed by a new characterOverrides table alongside the existing profile data. Adds an empty About tab, restyles sidebar tabs gold/white, and drops the unused subtitle line. --- HideCoA.lua | 91 +++++++++- Options.lua | 506 +++++++++++++++++++++------------------------------- 2 files changed, 285 insertions(+), 312 deletions(-) diff --git a/HideCoA.lua b/HideCoA.lua index 54b07b8..106fc50 100644 --- a/HideCoA.lua +++ b/HideCoA.lua @@ -181,6 +181,75 @@ end HideCoA.DeleteProfile = DeleteProfile +local function EnsureCharacterOverride(charKey) + + if not HideCoADB.characterOverrides then + HideCoADB.characterOverrides = {} + end + + local override = HideCoADB.characterOverrides[charKey] + + if not override then + override = { enabled = false, frameSettings = {} } + HideCoADB.characterOverrides[charKey] = override + end + + for _, frameName in ipairs(HideCoA.FRAMES) do + if override.frameSettings[frameName] == nil then + override.frameSettings[frameName] = true + end + end + + return override + +end + +local function GetCharacterOverride() + return EnsureCharacterOverride(GetCharacterKey()) +end + +HideCoA.GetCharacterOverride = GetCharacterOverride + +local function SetCharacterOverrideEnabled(enabled) + GetCharacterOverride().enabled = enabled + HideCoA.ApplySetting() +end + +HideCoA.SetCharacterOverrideEnabled = SetCharacterOverrideEnabled + +local function SetCharacterOverrideFrameHidden(frameName, hide) + GetCharacterOverride().frameSettings[frameName] = hide + HideCoA.ApplySetting() +end + +HideCoA.SetCharacterOverrideFrameHidden = SetCharacterOverrideFrameHidden + +local function SetAllClassesHidden(hide) + + local classSettings = GetActiveClassSettings() + + for _, class in ipairs(HideCoA.CUSTOM_CLASSES) do + for _, frameName in ipairs(HideCoA.FRAMES) do + classSettings[class][frameName] = hide + end + end + +end + +local function HideAllFrames() + SetAllClassesHidden(true) + HideCoA.ApplySetting() +end + +HideCoA.HideAllFrames = HideAllFrames + +local function ShowAllFrames() + SetAllClassesHidden(false) + HideCoA.ApplySetting() +end + +HideCoA.ShowAllFrames = ShowAllFrames + local function ShouldHideForClass(playerClass, frameName) local classSettings = GetActiveClassSettings()[playerClass] @@ -193,13 +262,24 @@ local function ShouldHideForClass(playerClass, frameName) end +local function ShouldHideFrame(frameName) + + local override = GetCharacterOverride() + + if override.enabled then + return override.frameSettings[frameName] + end + + local _, playerClass = UnitClass("player") + return ShouldHideForClass(playerClass, frameName) + +end + local hookedFrames = {} local seenNaturalShow = {} local function ApplySetting() - local _, playerClass = UnitClass("player") - for _, frameName in ipairs(HideCoA.FRAMES) do local frame = _G[frameName] @@ -210,8 +290,7 @@ local function ApplySetting() frame:HookScript("OnShow", function(self) seenNaturalShow[frameName] = true - local _, currentClass = UnitClass("player") - if ShouldHideForClass(currentClass, frameName) then + if ShouldHideFrame(frameName) then self:Hide() end end) @@ -220,7 +299,7 @@ local function ApplySetting() end - local hide = ShouldHideForClass(playerClass, frameName) + local hide = ShouldHideFrame(frameName) if hide then frame:Hide() @@ -304,6 +383,8 @@ f:SetScript("OnEvent", function(self, event, arg1) HideCoADB.charProfile[charKey] = charKey end + EnsureCharacterOverride(charKey) + HideCoADB.selectedProfile = nil elseif event == "PLAYER_LOGIN" then diff --git a/Options.lua b/Options.lua index 92ff84a..5353f3c 100644 --- a/Options.lua +++ b/Options.lua @@ -11,12 +11,8 @@ local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") title:SetPoint("TOPLEFT", 16, -16) title:SetText("HideCoAUI") -local subtitle = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall") -subtitle:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8) -subtitle:SetText("Select a class, then toggle the checkboxes to hide its class resource:") - local sidebar = CreateFrame("Frame", nil, panel) -sidebar:SetPoint("TOPLEFT", subtitle, "BOTTOMLEFT", 0, -12) +sidebar:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -20) sidebar:SetPoint("BOTTOMLEFT", panel, "BOTTOMLEFT", 16, 16) sidebar:SetWidth(150) @@ -24,27 +20,59 @@ local content = CreateFrame("Frame", nil, panel) content:SetPoint("TOPLEFT", sidebar, "TOPRIGHT", 16, 0) content:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -16, 16) -local classContent = CreateFrame("Frame", nil, content) -classContent:SetAllPoints(content) +local classesContent = CreateFrame("Frame", nil, content) +classesContent:SetAllPoints(content) -local profileContent +local characterOverrideContent = CreateFrame("Frame", nil, content) +characterOverrideContent:SetAllPoints(content) +characterOverrideContent:Hide() -local classTitle = classContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") -classTitle:SetPoint("TOPLEFT", classContent, "TOPLEFT", 0, 0) +local aboutContent = CreateFrame("Frame", nil, content) +aboutContent:SetAllPoints(content) +aboutContent:Hide() -local titleFont, titleSize = classTitle:GetFont() -classTitle:SetFont(titleFont, titleSize + 4, "OUTLINE") +-- CLASSES TAB -- + +local classesTitle = classesContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") +classesTitle:SetPoint("TOPLEFT", classesContent, "TOPLEFT", 0, 0) + +local titleFont, titleSize = classesTitle:GetFont() +classesTitle:SetFont(titleFont, titleSize + 4, "OUTLINE") +classesTitle:SetText("Classes") + +local hideAllButton = CreateFrame("Button", "HideCoAHideAllButton", classesContent, "UIPanelButtonTemplate") +hideAllButton:SetPoint("TOPLEFT", classesTitle, "BOTTOMLEFT", 0, -12) +hideAllButton:SetSize(100, 22) +hideAllButton:SetText("Hide All") + +local showAllButton = CreateFrame("Button", "HideCoAShowAllButton", classesContent, "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 classDropDown = CreateFrame("Frame", "HideCoAClassDropDown", classesContent, "UIDropDownMenuTemplate") +classDropDown:SetPoint("TOPLEFT", hideAllButton, "BOTTOMLEFT", -16, -16) + +if ElvSkins then + ElvSkins:HandleDropDownBox(classDropDown, 140) +end local checks = {} local selectedClass = nil -local previousAnchor = classTitle -local previousSpacing = -12 +local previousAnchor = classDropDown +local previousSpacing = -16 +local previousXOffset = 16 for _, frameName in ipairs(HideCoA.FRAMES) do - local check = CreateFrame("CheckButton", "HideCoAClassCheck" .. frameName, classContent, "InterfaceOptionsCheckButtonTemplate") - check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", 0, previousSpacing) + local check = CreateFrame("CheckButton", "HideCoAClassCheck" .. frameName, classesContent, "InterfaceOptionsCheckButtonTemplate") + check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", previousXOffset, previousSpacing) _G[check:GetName() .. "Text"]:SetText("Hide " .. frameName) check.frameName = frameName @@ -67,135 +95,39 @@ for _, frameName in ipairs(HideCoA.FRAMES) do checks[frameName] = check previousAnchor = check previousSpacing = -8 + previousXOffset = 0 end -local TAB_HEIGHT = 18 - -local tabButtons = {} -local profileTabButton - local function SelectClass(class) selectedClass = class - classContent:Show() - profileContent:Hide() - profileTabButton.selectedTexture:Hide() - local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class - classTitle:SetText(displayName) - - local color = RAID_CLASS_COLORS and RAID_CLASS_COLORS[class] - if color then - classTitle:SetTextColor(color.r, color.g, color.b) - else - classTitle: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 + UIDropDownMenu_SetText(classDropDown, displayName) end -for index, class in ipairs(HideCoA.CUSTOM_CLASSES) do - - local button = CreateFrame("Button", "HideCoAClassTab" .. class, sidebar) - button:SetHeight(TAB_HEIGHT) - button:SetPoint("TOPLEFT", sidebar, "TOPLEFT", 0, -(index - 1) * TAB_HEIGHT) - button:SetPoint("RIGHT", sidebar, "RIGHT", 0, 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) - - tabButtons[class] = button - +local function ClassDropDown_OnClick(self) + SelectClass(self.value) end -profileContent = CreateFrame("Frame", nil, content) -profileContent:SetAllPoints(content) -profileContent:Hide() +UIDropDownMenu_Initialize(classDropDown, function(self, level) -local profileTitle = profileContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") -profileTitle:SetPoint("TOPLEFT", profileContent, "TOPLEFT", 0, 0) -profileTitle:SetFont(titleFont, titleSize + 4, "OUTLINE") -profileTitle:SetText("Profiles") + for _, class in ipairs(HideCoA.CUSTOM_CLASSES) do -local function GetProfileNames() - - local names = {} - local hasDefault = false - - if HideCoADB and HideCoADB.profiles then - for name in pairs(HideCoADB.profiles) do - if name == "Default" then - hasDefault = true - else - table.insert(names, name) - end - end - end - - table.sort(names) - - if hasDefault then - table.insert(names, 1, "Default") - end - - return names - -end - -local profileDropDown = CreateFrame("Frame", "HideCoAProfileDropDown", profileContent, "UIDropDownMenuTemplate") -profileDropDown:SetPoint("TOPLEFT", profileTitle, "BOTTOMLEFT", -16, -12) - -if ElvSkins then - ElvSkins:HandleDropDownBox(profileDropDown, 140) -end - -local function ProfileDropDown_OnClick(self) - HideCoA.SetActiveProfileName(self.value) - UIDropDownMenu_SetText(profileDropDown, self.value) - HideCoA.ApplySetting() -end - -UIDropDownMenu_Initialize(profileDropDown, function(self, level) - - for _, name in ipairs(GetProfileNames()) do + local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class local info = UIDropDownMenu_CreateInfo() - info.text = name - info.value = name - info.func = ProfileDropDown_OnClick - info.checked = HideCoADB and HideCoADB.charProfile and (HideCoA.GetActiveProfileName() == name) + info.text = displayName + info.value = class + info.func = ClassDropDown_OnClick + info.checked = (selectedClass == class) UIDropDownMenu_AddButton(info, level) @@ -203,215 +135,175 @@ UIDropDownMenu_Initialize(profileDropDown, function(self, level) end) -UIDropDownMenu_SetWidth(profileDropDown, 140) +UIDropDownMenu_SetWidth(classDropDown, 140) -local resetDesc = profileContent:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") -resetDesc:SetPoint("TOPLEFT", profileDropDown, "BOTTOMLEFT", 16, -20) -resetDesc:SetWidth(260) -resetDesc:SetJustifyH("LEFT") -resetDesc:SetText("Reset the currently active profile's settings back to their defaults.") - -local resetButton = CreateFrame("Button", "HideCoAResetProfileButton", profileContent, "UIPanelButtonTemplate") -resetButton:SetPoint("TOPLEFT", resetDesc, "BOTTOMLEFT", 0, -8) -resetButton:SetSize(140, 22) -resetButton:SetText("Reset Profile") - -if ElvSkins then - ElvSkins:HandleButton(resetButton) -end - -StaticPopupDialogs["HIDECOA_CONFIRM_RESET_PROFILE"] = { - text = "Reset the active profile '%s' to its default settings? This cannot be undone.", - button1 = YES, - button2 = NO, - OnAccept = function() - HideCoA.ResetProfile() - if selectedClass then - SelectClass(selectedClass) - end - end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, -} - -resetButton:SetScript("OnClick", function() - StaticPopup_Show("HIDECOA_CONFIRM_RESET_PROFILE", HideCoA.GetActiveProfileName()) +hideAllButton:SetScript("OnClick", function() + HideCoA.HideAllFrames() + if selectedClass then + SelectClass(selectedClass) + end end) -local copyDesc = profileContent:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") -copyDesc:SetPoint("TOPLEFT", resetButton, "BOTTOMLEFT", 0, -20) -copyDesc:SetWidth(260) -copyDesc:SetJustifyH("LEFT") -copyDesc:SetText("Copy the settings from one existing profile into the currently active profile.") +showAllButton:SetScript("OnClick", function() + HideCoA.ShowAllFrames() + if selectedClass then + SelectClass(selectedClass) + end +end) -local copyLabel = profileContent:CreateFontString(nil, "ARTWORK", "GameFontNormal") -copyLabel:SetPoint("TOPLEFT", copyDesc, "BOTTOMLEFT", 0, -8) -copyLabel:SetTextColor(1, 0.82, 0) -copyLabel:SetText("Copy From") +-- CHARACTER OVERRIDE TAB -- -local copyDropDown = CreateFrame("Frame", "HideCoACopyProfileDropDown", profileContent, "UIDropDownMenuTemplate") -copyDropDown:SetPoint("TOPLEFT", copyLabel, "BOTTOMLEFT", -16, -4) +local characterOverrideTitle = characterOverrideContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") +characterOverrideTitle:SetPoint("TOPLEFT", characterOverrideContent, "TOPLEFT", 0, 0) +characterOverrideTitle:SetFont(titleFont, titleSize + 4, "OUTLINE") +characterOverrideTitle:SetText("Character Override") + +local overrideEnabledCheck = CreateFrame("CheckButton", "HideCoAOverrideEnabledCheck", characterOverrideContent, "InterfaceOptionsCheckButtonTemplate") +overrideEnabledCheck:SetPoint("TOPLEFT", characterOverrideTitle, "BOTTOMLEFT", 0, -12) +_G[overrideEnabledCheck:GetName() .. "Text"]:SetText("Override class options for this character.") if ElvSkins then - ElvSkins:HandleDropDownBox(copyDropDown, 140) + ElvSkins:HandleCheckBox(overrideEnabledCheck) end -StaticPopupDialogs["HIDECOA_CONFIRM_COPY_PROFILE"] = { - text = "Copy settings from '%s' into the active profile '%s'? This will overwrite the active profile's settings.", - button1 = YES, - button2 = NO, - OnAccept = function(self, data) - HideCoA.CopyProfile(data.sourceName, data.activeName) - UIDropDownMenu_SetText(copyDropDown, "") - if selectedClass then - SelectClass(selectedClass) - end - end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, -} +local overrideChecks = {} -local function CopyProfile_OnClick(self) +local overridePreviousAnchor = overrideEnabledCheck +local overridePreviousSpacing = -16 - local sourceName = self.value - local activeName = HideCoA.GetActiveProfileName() +for _, frameName in ipairs(HideCoA.FRAMES) do - StaticPopup_Show("HIDECOA_CONFIRM_COPY_PROFILE", sourceName, activeName, - { sourceName = sourceName, activeName = activeName }) + local check = CreateFrame("CheckButton", "HideCoAOverrideCheck" .. frameName, characterOverrideContent, "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) + HideCoA.SetCharacterOverrideFrameHidden(self.frameName, self:GetChecked() and true or false) + end) + + overrideChecks[frameName] = check + overridePreviousAnchor = check + overridePreviousSpacing = -8 end -UIDropDownMenu_Initialize(copyDropDown, function(self, level) +local function SetOverrideCheckEnabled(check, enabled) - local activeName = HideCoADB and HideCoA.GetActiveProfileName() + 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 - for _, name in ipairs(GetProfileNames()) do - if name ~= activeName then +end - local info = UIDropDownMenu_CreateInfo() - info.text = name - info.value = name - info.func = CopyProfile_OnClick +local function RefreshCharacterOverrideTab() - UIDropDownMenu_AddButton(info, level) + local override = HideCoA.GetCharacterOverride() + overrideEnabledCheck:SetChecked(override.enabled) + + for _, frameName in ipairs(HideCoA.FRAMES) do + overrideChecks[frameName]:SetChecked(override.frameSettings[frameName]) + SetOverrideCheckEnabled(overrideChecks[frameName], override.enabled) + end + +end + +overrideEnabledCheck:SetScript("OnClick", function(self) + HideCoA.SetCharacterOverrideEnabled(self:GetChecked() and true or false) + RefreshCharacterOverrideTab() +end) + +-- ABOUT TAB -- + +local aboutTitle = aboutContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") +aboutTitle:SetPoint("TOPLEFT", aboutContent, "TOPLEFT", 0, 0) +aboutTitle:SetFont(titleFont, titleSize + 4, "OUTLINE") +aboutTitle:SetText("About") + +-- SIDEBAR TABS -- + +local TAB_HEIGHT = 18 + +local function CreateTabButton(name, index) + + local button = CreateFrame("Button", "HideCoATab" .. name, sidebar) + button:SetHeight(TAB_HEIGHT) + button:SetPoint("TOPLEFT", sidebar, "TOPLEFT", 0, -(index - 1) * TAB_HEIGHT) + button:SetPoint("RIGHT", sidebar, "RIGHT", 0, 0) + + local selectedTexture = button:CreateTexture(nil, "BACKGROUND") + selectedTexture:SetAllPoints() + selectedTexture:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") + selectedTexture:SetBlendMode("ADD") + selectedTexture:Hide() + button.selectedTexture = selectedTexture + + button:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD") + + local text = button:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") + text:SetPoint("LEFT", 4, 0) + text:SetText(name) + text:SetTextColor(1, 0.82, 0) + button.text = text + + return button + +end + +local classesTabButton = CreateTabButton("Classes", 1) +local characterOverrideTabButton = CreateTabButton("Character Override", 2) +local aboutTabButton = CreateTabButton("About", 3) + +local sidebarTabButtons = { classesTabButton, characterOverrideTabButton, aboutTabButton } + +local function SelectTab(activeButton, contentFrame) + + classesContent:Hide() + characterOverrideContent:Hide() + aboutContent:Hide() + + contentFrame:Show() + + for _, button in ipairs(sidebarTabButtons) do + if button == activeButton then + button.selectedTexture:Show() + button.text:SetTextColor(1, 1, 1) + else + button.selectedTexture:Hide() + button.text:SetTextColor(1, 0.82, 0) end end -end) - -UIDropDownMenu_SetWidth(copyDropDown, 140) -UIDropDownMenu_SetText(copyDropDown, "") - -local deleteDesc = profileContent:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") -deleteDesc:SetPoint("TOPLEFT", copyDropDown, "BOTTOMLEFT", 16, -20) -deleteDesc:SetWidth(260) -deleteDesc:SetJustifyH("LEFT") -deleteDesc:SetText("Delete existing and unused profiles from the database to save space, and cleanup the SavedVariables file.") - -local deleteLabel = profileContent:CreateFontString(nil, "ARTWORK", "GameFontNormal") -deleteLabel:SetPoint("TOPLEFT", deleteDesc, "BOTTOMLEFT", 0, -8) -deleteLabel:SetTextColor(1, 0.82, 0) -deleteLabel:SetText("Delete a Profile") - -local deleteDropDown = CreateFrame("Frame", "HideCoADeleteProfileDropDown", profileContent, "UIDropDownMenuTemplate") -deleteDropDown:SetPoint("TOPLEFT", deleteLabel, "BOTTOMLEFT", -16, -4) - -if ElvSkins then - ElvSkins:HandleDropDownBox(deleteDropDown, 140) end -StaticPopupDialogs["HIDECOA_CONFIRM_DELETE_PROFILE"] = { - text = "Delete profile '%s'? This cannot be undone.", - button1 = YES, - button2 = NO, - OnAccept = function(self, data) - HideCoA.DeleteProfile(data.targetName) - UIDropDownMenu_SetText(deleteDropDown, "") - UIDropDownMenu_SetText(profileDropDown, HideCoA.GetActiveProfileName()) - HideCoA.ApplySetting() - end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, -} - -local function DeleteProfile_OnClick(self) - - local targetName = self.value - - StaticPopup_Show("HIDECOA_CONFIRM_DELETE_PROFILE", targetName, nil, { targetName = targetName }) - -end - -UIDropDownMenu_Initialize(deleteDropDown, function(self, level) - - for _, name in ipairs(GetProfileNames()) do - if name ~= "Default" then - - local info = UIDropDownMenu_CreateInfo() - info.text = name - info.value = name - info.func = DeleteProfile_OnClick - - UIDropDownMenu_AddButton(info, level) - - end - end - -end) - -UIDropDownMenu_SetWidth(deleteDropDown, 140) -UIDropDownMenu_SetText(deleteDropDown, "") - -local divider = sidebar:CreateTexture(nil, "ARTWORK") -divider:SetHeight(1) -divider:SetTexture(1, 1, 1, 0.3) - -profileTabButton = CreateFrame("Button", "HideCoAProfileTab", sidebar) -profileTabButton:SetHeight(TAB_HEIGHT) -profileTabButton:SetPoint("BOTTOMLEFT", sidebar, "BOTTOMLEFT", 0, 0) -profileTabButton:SetPoint("RIGHT", sidebar, "RIGHT", 0, 0) - -divider:SetPoint("BOTTOMLEFT", profileTabButton, "TOPLEFT", 0, 4) -divider:SetPoint("BOTTOMRIGHT", profileTabButton, "TOPRIGHT", 0, 4) - -local profileSelectedTexture = profileTabButton:CreateTexture(nil, "BACKGROUND") -profileSelectedTexture:SetAllPoints() -profileSelectedTexture:SetTexture(1, 1, 1, 0.2) -profileSelectedTexture:Hide() -profileTabButton.selectedTexture = profileSelectedTexture - -profileTabButton:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD") - -local profileTabText = profileTabButton:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") -profileTabText:SetPoint("LEFT", 4, 0) -profileTabText:SetText("Profiles") - -local function SelectProfileTab() - - classContent:Hide() - profileContent:Show() - - for _, button in pairs(tabButtons) do - button.selectedTexture:Hide() - end - - profileTabButton.selectedTexture:Show() - - UIDropDownMenu_SetText(profileDropDown, HideCoA.GetActiveProfileName()) - -end - -profileTabButton:SetScript("OnClick", SelectProfileTab) - -panel:SetScript("OnShow", function() +local function ShowClassesTab() + SelectTab(classesTabButton, classesContent) SelectClass(selectedClass or HideCoA.CUSTOM_CLASSES[1]) -end) +end + +local function ShowCharacterOverrideTab() + SelectTab(characterOverrideTabButton, characterOverrideContent) + RefreshCharacterOverrideTab() +end + +local function ShowAboutTab() + SelectTab(aboutTabButton, aboutContent) +end + +classesTabButton:SetScript("OnClick", ShowClassesTab) +characterOverrideTabButton:SetScript("OnClick", ShowCharacterOverrideTab) +aboutTabButton:SetScript("OnClick", ShowAboutTab) + +panel:SetScript("OnShow", ShowClassesTab) InterfaceOptions_AddCategory(panel)