Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Core_Cata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ function F.IsGroupTypeHidden(layoutGroupType)
return layoutGroupType and Cell.vars.layoutAutoSwitch and Cell.vars.layoutAutoSwitch[layoutGroupType] == "hide"
end

--! The layout a frame group has to be laid out for, from the same mapping: nil when that entry is "hide"
--! (or unknown), so a frame group can lay itself out ahead of time for a group type the player is not in.
function F.GetGroupTypeLayout(layoutGroupType)
local layout = layoutGroupType and Cell.vars.layoutAutoSwitch and Cell.vars.layoutAutoSwitch[layoutGroupType]
if layout and layout ~= "hide" and CellDB["layouts"][layout] then
return layout
end
end

local bgMaxPlayers = {
[2197] = 40, -- 科尔拉克的复仇
}
Expand Down
9 changes: 9 additions & 0 deletions Core_Mists.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ function F.IsGroupTypeHidden(layoutGroupType)
return layoutGroupType and Cell.vars.layoutAutoSwitch and Cell.vars.layoutAutoSwitch[layoutGroupType] == "hide"
end

--! The layout a frame group has to be laid out for, from the same mapping: nil when that entry is "hide"
--! (or unknown), so a frame group can lay itself out ahead of time for a group type the player is not in.
function F.GetGroupTypeLayout(layoutGroupType)
local layout = layoutGroupType and Cell.vars.layoutAutoSwitch and Cell.vars.layoutAutoSwitch[layoutGroupType]
if layout and layout ~= "hide" and CellDB["layouts"][layout] then
return layout
end
end

local bgMaxPlayers = {
[2197] = 40, -- 科尔拉克的复仇
}
Expand Down
9 changes: 9 additions & 0 deletions Core_Vanilla.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ function F.IsGroupTypeHidden(layoutGroupType)
return layoutGroupType and Cell.vars.layoutAutoSwitch and Cell.vars.layoutAutoSwitch[layoutGroupType] == "hide"
end

--! The layout a frame group has to be laid out for, from the same mapping: nil when that entry is "hide"
--! (or unknown), so a frame group can lay itself out ahead of time for a group type the player is not in.
function F.GetGroupTypeLayout(layoutGroupType)
local layout = layoutGroupType and Cell.vars.layoutAutoSwitch and Cell.vars.layoutAutoSwitch[layoutGroupType]
if layout and layout ~= "hide" and CellDB["layouts"][layout] then
return layout
end
end

-- layout auto switch
local instanceType
local function PreUpdateLayout()
Expand Down
9 changes: 9 additions & 0 deletions Core_Wrath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ function F.IsGroupTypeHidden(layoutGroupType)
return layoutGroupType and Cell.vars.layoutAutoSwitch and Cell.vars.layoutAutoSwitch[layoutGroupType] == "hide"
end

--! The layout a frame group has to be laid out for, from the same mapping: nil when that entry is "hide"
--! (or unknown), so a frame group can lay itself out ahead of time for a group type the player is not in.
function F.GetGroupTypeLayout(layoutGroupType)
local layout = layoutGroupType and Cell.vars.layoutAutoSwitch and Cell.vars.layoutAutoSwitch[layoutGroupType]
if layout and layout ~= "hide" and CellDB["layouts"][layout] then
return layout
end
end

local bgMaxPlayers = {
[2197] = 40, -- 科尔拉克的复仇
}
Expand Down
4 changes: 4 additions & 0 deletions Modules/Layouts/Layouts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,10 @@ local function GetDropdownItems(indices, groupType)
-- LoadLayoutDB(Cell.vars.currentLayout)
UpdateButtonStates()
-- UpdateEnabledLayoutText()
elseif Cell.vars.layoutGroupType then
--! frame groups are laid out ahead of time for the group types the player is not in
--! (see F.GetGroupTypeLayout), so let them pick up the new assignment
F.UpdateLayout(Cell.vars.layoutGroupType, true)
end
end,
})
Expand Down
15 changes: 14 additions & 1 deletion RaidFrames/Groups/PartyFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,20 @@ local function PartyFrame_UpdateLayout(layout, which)
RegisterAttributeDriver(partyFrame, "state-visibility", "[@raid1,exists] hide;[@party1,exists] show;[group:party] show;hide")
end

if Cell.vars.groupType ~= "party" then return end
-- Layout: applied for every frame group, not only the active one, so that the first show of a group
-- type since login can happen in combat. F.UpdateLayout defers itself until combat ends, so a party frame
-- that had never been active came up with no sizes, anchors or header attributes when the group changed
-- in combat, and stayed blank until combat ended. See F.GetGroupTypeLayout.
if Cell.vars.groupType ~= "party" then
local ownLayout = F.GetGroupTypeLayout(Cell.vars.partyLayoutGroupType)
if not ownLayout then return end
if which then
-- partial update from the Layouts tab: only relevant when the edited layout is the one used here
if layout ~= ownLayout then return end
else
layout = ownLayout
end
end
end

-- update
Expand Down
22 changes: 18 additions & 4 deletions RaidFrames/Groups/RaidFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ function F.GetRaidFramePoints(layout)
return point, anchorPoint, groupAnchorPoint, P.Scale(unitSpacing), P.Scale(groupSpacing), P.Scale(unitSpacingX), P.Scale(unitSpacingY), verticalSpacing, horizontalSpacing, headerPoint, headerColumnAnchorPoint
end

local function UpdateHeadersShowRaidAttribute()
if Cell.vars.currentLayoutTable["main"]["combineGroups"] then
local function UpdateHeadersShowRaidAttribute(layout)
-- NOTE: layout table passed in, the raid frame can be laid out for a layout that is not the current one
if layout["main"]["combineGroups"] then
combinedHeader:SetAttribute("showRaid", true)
for _, header in ipairs(separatedHeaders) do
header:SetAttribute("showRaid", nil)
Expand Down Expand Up @@ -366,7 +367,20 @@ local function RaidFrame_UpdateLayout(layout, which)
RegisterAttributeDriver(raidFrame, "state-visibility", "[@raid1,exists] show;hide")
end

if Cell.vars.groupType ~= "raid" then return end
-- Layout: applied for every frame group, not only the active one, so that the first show of a group
-- type since login can happen in combat. F.UpdateLayout defers itself until combat ends, so a raid frame
-- that had never been active came up with no sizes, anchors or header attributes when the group changed
-- in combat, and stayed blank until combat ended. See F.GetGroupTypeLayout.
if Cell.vars.groupType ~= "raid" then
local ownLayout = F.GetGroupTypeLayout(Cell.vars.raidLayoutGroupType)
if not ownLayout then return end
if which then
-- partial update from the Layouts tab: only relevant when the edited layout is the one used here
if layout ~= ownLayout then return end
else
layout = ownLayout
end
end
end

-- update
Expand Down Expand Up @@ -414,7 +428,7 @@ local function RaidFrame_UpdateLayout(layout, which)
end

if not which or which == "header" then
UpdateHeadersShowRaidAttribute()
UpdateHeadersShowRaidAttribute(layout)
end

if layout["main"]["combineGroups"] then
Expand Down
15 changes: 14 additions & 1 deletion RaidFrames/Groups/SoloFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,20 @@ local function SoloFrame_UpdateLayout(layout, which)
RegisterAttributeDriver(soloFrame, "state-visibility", "[@raid1,exists] hide;[@party1,exists] hide;[group] hide;show")
end

if Cell.vars.groupType ~= "solo" then return end
-- Layout: applied for every frame group, not only the active one, so that the first show of a group
-- type since login can happen in combat. F.UpdateLayout defers itself until combat ends, so a solo frame
-- that had never been active came up with no sizes, anchors or header attributes when the group changed
-- in combat, and stayed blank until combat ended. See F.GetGroupTypeLayout.
if Cell.vars.groupType ~= "solo" then
local ownLayout = F.GetGroupTypeLayout(Cell.vars.soloLayoutGroupType)
if not ownLayout then return end
if which then
-- partial update from the Layouts tab: only relevant when the edited layout is the one used here
if layout ~= ownLayout then return end
else
layout = ownLayout
end
end
end

-- update
Expand Down