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.
This commit is contained in:
+86
-5
@@ -181,6 +181,75 @@ end
|
|||||||
|
|
||||||
HideCoA.DeleteProfile = DeleteProfile
|
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 function ShouldHideForClass(playerClass, frameName)
|
||||||
|
|
||||||
local classSettings = GetActiveClassSettings()[playerClass]
|
local classSettings = GetActiveClassSettings()[playerClass]
|
||||||
@@ -193,13 +262,24 @@ local function ShouldHideForClass(playerClass, frameName)
|
|||||||
|
|
||||||
end
|
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 hookedFrames = {}
|
||||||
local seenNaturalShow = {}
|
local seenNaturalShow = {}
|
||||||
|
|
||||||
local function ApplySetting()
|
local function ApplySetting()
|
||||||
|
|
||||||
local _, playerClass = UnitClass("player")
|
|
||||||
|
|
||||||
for _, frameName in ipairs(HideCoA.FRAMES) do
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
||||||
|
|
||||||
local frame = _G[frameName]
|
local frame = _G[frameName]
|
||||||
@@ -210,8 +290,7 @@ local function ApplySetting()
|
|||||||
|
|
||||||
frame:HookScript("OnShow", function(self)
|
frame:HookScript("OnShow", function(self)
|
||||||
seenNaturalShow[frameName] = true
|
seenNaturalShow[frameName] = true
|
||||||
local _, currentClass = UnitClass("player")
|
if ShouldHideFrame(frameName) then
|
||||||
if ShouldHideForClass(currentClass, frameName) then
|
|
||||||
self:Hide()
|
self:Hide()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -220,7 +299,7 @@ local function ApplySetting()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local hide = ShouldHideForClass(playerClass, frameName)
|
local hide = ShouldHideFrame(frameName)
|
||||||
|
|
||||||
if hide then
|
if hide then
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
@@ -304,6 +383,8 @@ f:SetScript("OnEvent", function(self, event, arg1)
|
|||||||
HideCoADB.charProfile[charKey] = charKey
|
HideCoADB.charProfile[charKey] = charKey
|
||||||
end
|
end
|
||||||
|
|
||||||
|
EnsureCharacterOverride(charKey)
|
||||||
|
|
||||||
HideCoADB.selectedProfile = nil
|
HideCoADB.selectedProfile = nil
|
||||||
|
|
||||||
elseif event == "PLAYER_LOGIN" then
|
elseif event == "PLAYER_LOGIN" then
|
||||||
|
|||||||
+199
-307
@@ -11,12 +11,8 @@ local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|||||||
title:SetPoint("TOPLEFT", 16, -16)
|
title:SetPoint("TOPLEFT", 16, -16)
|
||||||
title:SetText("HideCoAUI")
|
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)
|
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:SetPoint("BOTTOMLEFT", panel, "BOTTOMLEFT", 16, 16)
|
||||||
sidebar:SetWidth(150)
|
sidebar:SetWidth(150)
|
||||||
|
|
||||||
@@ -24,27 +20,59 @@ local content = CreateFrame("Frame", nil, panel)
|
|||||||
content:SetPoint("TOPLEFT", sidebar, "TOPRIGHT", 16, 0)
|
content:SetPoint("TOPLEFT", sidebar, "TOPRIGHT", 16, 0)
|
||||||
content:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -16, 16)
|
content:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -16, 16)
|
||||||
|
|
||||||
local classContent = CreateFrame("Frame", nil, content)
|
local classesContent = CreateFrame("Frame", nil, content)
|
||||||
classContent:SetAllPoints(content)
|
classesContent:SetAllPoints(content)
|
||||||
|
|
||||||
local profileContent
|
local characterOverrideContent = CreateFrame("Frame", nil, content)
|
||||||
|
characterOverrideContent:SetAllPoints(content)
|
||||||
|
characterOverrideContent:Hide()
|
||||||
|
|
||||||
local classTitle = classContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
local aboutContent = CreateFrame("Frame", nil, content)
|
||||||
classTitle:SetPoint("TOPLEFT", classContent, "TOPLEFT", 0, 0)
|
aboutContent:SetAllPoints(content)
|
||||||
|
aboutContent:Hide()
|
||||||
|
|
||||||
local titleFont, titleSize = classTitle:GetFont()
|
-- CLASSES TAB --
|
||||||
classTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
||||||
|
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 checks = {}
|
||||||
local selectedClass = nil
|
local selectedClass = nil
|
||||||
|
|
||||||
local previousAnchor = classTitle
|
local previousAnchor = classDropDown
|
||||||
local previousSpacing = -12
|
local previousSpacing = -16
|
||||||
|
local previousXOffset = 16
|
||||||
|
|
||||||
for _, frameName in ipairs(HideCoA.FRAMES) do
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
||||||
|
|
||||||
local check = CreateFrame("CheckButton", "HideCoAClassCheck" .. frameName, classContent, "InterfaceOptionsCheckButtonTemplate")
|
local check = CreateFrame("CheckButton", "HideCoAClassCheck" .. frameName, classesContent, "InterfaceOptionsCheckButtonTemplate")
|
||||||
check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", 0, previousSpacing)
|
check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", previousXOffset, previousSpacing)
|
||||||
_G[check:GetName() .. "Text"]:SetText("Hide " .. frameName)
|
_G[check:GetName() .. "Text"]:SetText("Hide " .. frameName)
|
||||||
|
|
||||||
check.frameName = frameName
|
check.frameName = frameName
|
||||||
@@ -67,135 +95,39 @@ for _, frameName in ipairs(HideCoA.FRAMES) do
|
|||||||
checks[frameName] = check
|
checks[frameName] = check
|
||||||
previousAnchor = check
|
previousAnchor = check
|
||||||
previousSpacing = -8
|
previousSpacing = -8
|
||||||
|
previousXOffset = 0
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local TAB_HEIGHT = 18
|
|
||||||
|
|
||||||
local tabButtons = {}
|
|
||||||
local profileTabButton
|
|
||||||
|
|
||||||
local function SelectClass(class)
|
local function SelectClass(class)
|
||||||
|
|
||||||
selectedClass = class
|
selectedClass = class
|
||||||
|
|
||||||
classContent:Show()
|
|
||||||
profileContent:Hide()
|
|
||||||
profileTabButton.selectedTexture:Hide()
|
|
||||||
|
|
||||||
local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class
|
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
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
||||||
checks[frameName]:SetChecked(HideCoA.GetActiveClassSettings()[class][frameName])
|
checks[frameName]:SetChecked(HideCoA.GetActiveClassSettings()[class][frameName])
|
||||||
end
|
end
|
||||||
|
|
||||||
for tabClass, button in pairs(tabButtons) do
|
UIDropDownMenu_SetText(classDropDown, displayName)
|
||||||
if tabClass == class then
|
|
||||||
button.selectedTexture:Show()
|
|
||||||
else
|
|
||||||
button.selectedTexture:Hide()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for index, class in ipairs(HideCoA.CUSTOM_CLASSES) do
|
local function ClassDropDown_OnClick(self)
|
||||||
|
SelectClass(self.value)
|
||||||
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
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
profileContent = CreateFrame("Frame", nil, content)
|
UIDropDownMenu_Initialize(classDropDown, function(self, level)
|
||||||
profileContent:SetAllPoints(content)
|
|
||||||
profileContent:Hide()
|
|
||||||
|
|
||||||
local profileTitle = profileContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
for _, class in ipairs(HideCoA.CUSTOM_CLASSES) do
|
||||||
profileTitle:SetPoint("TOPLEFT", profileContent, "TOPLEFT", 0, 0)
|
|
||||||
profileTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
||||||
profileTitle:SetText("Profiles")
|
|
||||||
|
|
||||||
local function GetProfileNames()
|
local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class
|
||||||
|
|
||||||
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 info = UIDropDownMenu_CreateInfo()
|
local info = UIDropDownMenu_CreateInfo()
|
||||||
info.text = name
|
info.text = displayName
|
||||||
info.value = name
|
info.value = class
|
||||||
info.func = ProfileDropDown_OnClick
|
info.func = ClassDropDown_OnClick
|
||||||
info.checked = HideCoADB and HideCoADB.charProfile and (HideCoA.GetActiveProfileName() == name)
|
info.checked = (selectedClass == class)
|
||||||
|
|
||||||
UIDropDownMenu_AddButton(info, level)
|
UIDropDownMenu_AddButton(info, level)
|
||||||
|
|
||||||
@@ -203,215 +135,175 @@ UIDropDownMenu_Initialize(profileDropDown, function(self, level)
|
|||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
UIDropDownMenu_SetWidth(profileDropDown, 140)
|
UIDropDownMenu_SetWidth(classDropDown, 140)
|
||||||
|
|
||||||
local resetDesc = profileContent:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
hideAllButton:SetScript("OnClick", function()
|
||||||
resetDesc:SetPoint("TOPLEFT", profileDropDown, "BOTTOMLEFT", 16, -20)
|
HideCoA.HideAllFrames()
|
||||||
resetDesc:SetWidth(260)
|
if selectedClass then
|
||||||
resetDesc:SetJustifyH("LEFT")
|
SelectClass(selectedClass)
|
||||||
resetDesc:SetText("Reset the currently active profile's settings back to their defaults.")
|
end
|
||||||
|
|
||||||
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())
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local copyDesc = profileContent:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
showAllButton:SetScript("OnClick", function()
|
||||||
copyDesc:SetPoint("TOPLEFT", resetButton, "BOTTOMLEFT", 0, -20)
|
HideCoA.ShowAllFrames()
|
||||||
copyDesc:SetWidth(260)
|
if selectedClass then
|
||||||
copyDesc:SetJustifyH("LEFT")
|
SelectClass(selectedClass)
|
||||||
copyDesc:SetText("Copy the settings from one existing profile into the currently active profile.")
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
local copyLabel = profileContent:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
-- CHARACTER OVERRIDE TAB --
|
||||||
copyLabel:SetPoint("TOPLEFT", copyDesc, "BOTTOMLEFT", 0, -8)
|
|
||||||
copyLabel:SetTextColor(1, 0.82, 0)
|
|
||||||
copyLabel:SetText("Copy From")
|
|
||||||
|
|
||||||
local copyDropDown = CreateFrame("Frame", "HideCoACopyProfileDropDown", profileContent, "UIDropDownMenuTemplate")
|
local characterOverrideTitle = characterOverrideContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||||
copyDropDown:SetPoint("TOPLEFT", copyLabel, "BOTTOMLEFT", -16, -4)
|
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
|
if ElvSkins then
|
||||||
ElvSkins:HandleDropDownBox(copyDropDown, 140)
|
ElvSkins:HandleCheckBox(overrideEnabledCheck)
|
||||||
end
|
end
|
||||||
|
|
||||||
StaticPopupDialogs["HIDECOA_CONFIRM_COPY_PROFILE"] = {
|
local overrideChecks = {}
|
||||||
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 function CopyProfile_OnClick(self)
|
local overridePreviousAnchor = overrideEnabledCheck
|
||||||
|
local overridePreviousSpacing = -16
|
||||||
|
|
||||||
local sourceName = self.value
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
||||||
local activeName = HideCoA.GetActiveProfileName()
|
|
||||||
|
|
||||||
StaticPopup_Show("HIDECOA_CONFIRM_COPY_PROFILE", sourceName, activeName,
|
local check = CreateFrame("CheckButton", "HideCoAOverrideCheck" .. frameName, characterOverrideContent, "InterfaceOptionsCheckButtonTemplate")
|
||||||
{ sourceName = sourceName, activeName = activeName })
|
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
|
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
|
end
|
||||||
if name ~= activeName then
|
|
||||||
|
|
||||||
local info = UIDropDownMenu_CreateInfo()
|
local function RefreshCharacterOverrideTab()
|
||||||
info.text = name
|
|
||||||
info.value = name
|
|
||||||
info.func = CopyProfile_OnClick
|
|
||||||
|
|
||||||
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
|
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
|
end
|
||||||
|
|
||||||
StaticPopupDialogs["HIDECOA_CONFIRM_DELETE_PROFILE"] = {
|
local function ShowClassesTab()
|
||||||
text = "Delete profile '%s'? This cannot be undone.",
|
SelectTab(classesTabButton, classesContent)
|
||||||
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()
|
|
||||||
SelectClass(selectedClass or HideCoA.CUSTOM_CLASSES[1])
|
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)
|
InterfaceOptions_AddCategory(panel)
|
||||||
|
|||||||
Reference in New Issue
Block a user