Move frame-override storage from per-character to per-profile
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.
This commit is contained in:
+55
-9
@@ -243,12 +243,17 @@ characterOverrideTitle:SetPoint("TOPLEFT", 16, -16)
|
||||
characterOverrideTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
||||
characterOverrideTitle:SetText("Character Override")
|
||||
|
||||
local characterNameText = characterOverridePanel:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
|
||||
characterNameText:SetPoint("TOPLEFT", characterOverrideTitle, "BOTTOMLEFT", 0, -12)
|
||||
characterNameText:SetText(HideCoA.GetCharacterKey())
|
||||
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", characterNameText, "BOTTOMLEFT", 0, -12)
|
||||
overrideEnabledCheck:SetPoint("TOPLEFT", overrideProfileDropdown, "BOTTOMLEFT", 16, -8)
|
||||
_G[overrideEnabledCheck:GetName() .. "Text"]:SetText("Override class options for this character")
|
||||
|
||||
if ElvSkins then
|
||||
@@ -256,6 +261,7 @@ if ElvSkins then
|
||||
end
|
||||
|
||||
local overrideChecks = {}
|
||||
local selectedOverrideProfile = nil
|
||||
|
||||
local overridePreviousAnchor = overrideEnabledCheck
|
||||
local overridePreviousSpacing = -16
|
||||
@@ -273,7 +279,9 @@ for _, frameName in ipairs(HideCoA.FRAMES) do
|
||||
end
|
||||
|
||||
check:SetScript("OnClick", function(self)
|
||||
HideCoA.SetCharacterOverrideFrameHidden(self.frameName, self:GetChecked() and true or false)
|
||||
if selectedOverrideProfile then
|
||||
HideCoA.SetProfileOverrideFrameHidden(selectedOverrideProfile, self.frameName, self:GetChecked() and true or false)
|
||||
end
|
||||
end)
|
||||
|
||||
AddCheckboxFeedback(check)
|
||||
@@ -298,7 +306,11 @@ end
|
||||
|
||||
local function RefreshCharacterOverrideTab()
|
||||
|
||||
local override = HideCoA.GetCharacterOverride()
|
||||
if not selectedOverrideProfile then
|
||||
return
|
||||
end
|
||||
|
||||
local override = HideCoA.GetProfileOverride(selectedOverrideProfile)
|
||||
|
||||
overrideEnabledCheck:SetChecked(override.enabled)
|
||||
|
||||
@@ -309,14 +321,48 @@ local function RefreshCharacterOverrideTab()
|
||||
|
||||
end
|
||||
|
||||
overrideEnabledCheck:SetScript("OnClick", function(self)
|
||||
HideCoA.SetCharacterOverrideEnabled(self:GetChecked() and true or false)
|
||||
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", RefreshCharacterOverrideTab)
|
||||
characterOverridePanel:SetScript("OnShow", function()
|
||||
SelectOverrideProfile(selectedOverrideProfile or HideCoA.GetActiveProfileName())
|
||||
end)
|
||||
|
||||
InterfaceOptions_AddCategory(characterOverridePanel)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user