2026-11-21 16:24:58 -06:00
|
|
|
local _, P = ...
|
|
|
|
|
|
|
|
|
|
-- Shared reservations used by placement AND diagnostics. Hidden/empty buttons
|
|
|
|
|
-- still occupy their block, so overlays cannot land in a temporarily blank slot.
|
|
|
|
|
P.layoutPolicy = {
|
|
|
|
|
gap = 12, actionRowGap = 4, utilityRowGap = 6,
|
2026-11-22 13:18:12 -06:00
|
|
|
chat = {maximumWidth = 620, minimumHeight = 190, maximumHeight = 260,
|
|
|
|
|
minimumWidth = 240, fontSize = 14, edgeGap = 16},
|
2026-11-21 16:24:58 -06:00
|
|
|
controls = {
|
|
|
|
|
{name="Center controls", "MainActionBar","MultiBarBottomLeft","MultiBarBottomRight","MultiBar5"},
|
|
|
|
|
{name="Right controls", "MultiBarLeft","MultiBarRight","BagsBar","MicroMenuContainer"},
|
|
|
|
|
{name="Left controls", "MultiBar6","MultiBar7"},
|
|
|
|
|
},
|
|
|
|
|
panels = {"BankFrame","GuildBankFrame","MerchantFrame","QuestFrame","GossipFrame","MailFrame","TradeFrame",
|
|
|
|
|
"ProfessionsFrame","TradeSkillFrame","PlayerSpellsFrame","SpellBookFrame","WorldMapFrame","QuestLogFrame",
|
|
|
|
|
"CharacterFrame","AuctionHouseFrame"},
|
|
|
|
|
}
|
|
|
|
|
P.controlFrameNames, P.controlFrameSet = {}, {}
|
|
|
|
|
for _, group in ipairs(P.layoutPolicy.controls) do
|
|
|
|
|
for _, name in ipairs(group) do
|
|
|
|
|
P.controlFrameNames[#P.controlFrameNames+1] = name
|
|
|
|
|
P.controlFrameSet[name] = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2026-11-22 13:18:12 -06:00
|
|
|
function P.DefaultChatSize()
|
|
|
|
|
-- Use logical UI dimensions: a 4K screen with a larger UI scale may have
|
|
|
|
|
-- the same usable space as 1080p. Unchanged defaults can follow a viewport
|
|
|
|
|
-- resize; ordinary refreshes keep custom sizes. Core separately fits
|
|
|
|
|
-- the width against the actual combat row, including custom positions.
|
|
|
|
|
local chat=P.layoutPolicy.chat
|
|
|
|
|
local width=math.max(chat.minimumWidth,math.min(chat.maximumWidth,UIParent:GetWidth()*.30))
|
|
|
|
|
local height=math.max(chat.minimumHeight,math.min(chat.maximumHeight,UIParent:GetHeight()*.22))
|
|
|
|
|
return math.floor(width/10)*10,math.floor(height/10)*10
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function P.IsDefaultChatSystem(system)
|
|
|
|
|
local saved=RuenUIDB.chatDefaultSize
|
|
|
|
|
local a=system and system.anchorInfo
|
|
|
|
|
if not saved or not a or a.point~="BOTTOMLEFT" or a.relativeTo~="UIParent"
|
|
|
|
|
or a.relativePoint~="BOTTOMLEFT" or a.offsetX~=20 or a.offsetY~=45 then return false end
|
|
|
|
|
local S=Enum.EditModeChatFrameSetting
|
|
|
|
|
local values={}
|
|
|
|
|
for _,v in ipairs(system.settings or {}) do values[v.setting]=v.value end
|
|
|
|
|
return (values[S.WidthHundreds] or 0)*100+(values[S.WidthTensAndOnes] or 0)==saved.width
|
|
|
|
|
and (values[S.HeightHundreds] or 0)*100+(values[S.HeightTensAndOnes] or 0)==saved.height
|
|
|
|
|
end
|
|
|
|
|
|
2026-11-21 16:24:58 -06:00
|
|
|
function P.ApplyChatDefaults()
|
|
|
|
|
-- Fresh installs only. Do not overwrite an existing player's font choice.
|
|
|
|
|
if RuenUICharacter.chatDefaultsVersion or RuenUICharacter.version then return end
|
|
|
|
|
if ChatFrame1 and ChatFrame1.GetFont and FCF_SetChatWindowFontSize then
|
|
|
|
|
local font,size,flags=ChatFrame1:GetFont()
|
|
|
|
|
RuenUICharacter.chatFontOriginal={font=font,size=size,flags=flags}
|
|
|
|
|
FCF_SetChatWindowFontSize(nil,ChatFrame1,P.layoutPolicy.chat.fontSize)
|
|
|
|
|
end
|
|
|
|
|
RuenUICharacter.chatDefaultsVersion=1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function P.RestoreChatDefaults()
|
|
|
|
|
local old=RuenUICharacter.chatFontOriginal
|
|
|
|
|
if not old or not ChatFrame1 or not ChatFrame1.GetFont then return end
|
|
|
|
|
local font,size=ChatFrame1:GetFont()
|
|
|
|
|
if font==old.font and size==P.layoutPolicy.chat.fontSize and FCF_SetChatWindowFontSize then
|
|
|
|
|
FCF_SetChatWindowFontSize(nil,ChatFrame1,old.size)
|
|
|
|
|
end
|
|
|
|
|
end
|