Files
Adrestie 729da261c9 ForeverUI : Customize UI (menu Echap, grille, poignees, aimant, collage, taille), README resserre
- CustomizeUI.lua : bouton Customize UI apres AddOns, grille reglable (pas, origine 3x3),
  voiles de selection camelot, 9 poignees sur l'element selectionne, Snap on Grid et
  Sticky UI par attraction, fenetre de taille 50-200 %, Cancel / Reset / Validate
- Layout : session de travail, echelle par element, Validate ne touche plus aux places
  des fenetres
- griffons detaches de la barre d'action
- art : editmode (camelot) et poignees housing-advancedmode-scale-handle
- banc : textes sans police refuses, fichiers charges sous leur nom, essais de l'editeur
- README reduit a l'essentiel

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 14:17:58 +02:00

109 lines
3.0 KiB
Lua

-- ForeverUI: the Esc menu (GameMenuFrame) in Camelot's style (MainMenuFrameTemplate: column
-- margins 48 top, 34 bottom, 28 sides; a section adds 20 above its first button).
-- The client's buttons stay, in their order: their clicks are secure (Logout, Quit) and a
-- button of ours would not be.
local ForeverUI = ForeverUI or {}
_G.ForeverUI = ForeverUI
local Tpl = ForeverUI.Templates
local M = {}
ForeverUI.GameMenu = M
local N = {
top = 48, down = 34, side = 28,
button = { 200, 36 },
section = 20,
}
-- camelot GameFontNormalMed1: SystemFont_Med2 (FRIZQT 13), shadow (1, -1), yellow
local function headerFont()
local f = CreateFont("ForeverUIGameMenuHeaderFont")
f:SetFontObject(SystemFont_Med2 or GameFontNormal)
f:SetShadowOffset(1, -1)
f:SetShadowColor(0, 0, 0)
f:SetTextColor(1, 0.82, 0)
return f
end
-- buttons, top to bottom; section: a gap above the button
local function entries()
return {
{ GameMenuButtonOptions },
{ GameMenuButtonSoundOptions },
{ GameMenuButtonMacOptions },
{ GameMenuButtonUIOptions },
{ GameMenuButtonKeybindings },
{ GameMenuButtonMacros },
{ GameMenuButtonRatings },
{ _G["GameMenuButtonAddOns"] },
{ _G["ForeverUIGameMenuButtonCustomize"] },
{ _G["ForeverUIGameMenuButtonHelp"], section = true },
{ GameMenuButtonLogout, section = true },
{ GameMenuButtonQuit },
{ GameMenuButtonContinue, section = true },
}
end
local FONTS = { GameFontHighlightLarge, GameFontHighlightLarge, GameFontDisableLarge }
local function skinButton(b)
if b.foreverThreeSlice then return end
b:SetWidth(N.button[1])
b:SetHeight(N.button[2])
Tpl.ThreeSliceButton(b, "128-redbutton", FONTS)
b:HookScript("OnShow", M.Layout)
end
-- Lays out the column: each shown button in place, then the menu size.
-- Runs on every button's OnShow: ACP's AddOns button and Log Out (when Ratings is shown)
-- re-anchor Log Out in their own OnShow, after the menu.
function M.Layout()
local f = GameMenuFrame
local y = N.top
local queued = false
for _, e in ipairs(entries()) do
local b = e[1]
if e.section then
queued = true
end
if b and b:IsShown() then
skinButton(b)
if queued then
y = y + N.section
queued = false
end
b:ClearAllPoints()
b:SetPoint("TOPLEFT", f, "TOPLEFT", N.side, -y)
y = y + N.button[2]
end
end
f:SetWidth(N.side + N.button[1] + N.side)
f:SetHeight(y + N.down)
end
if GameMenuFrame then
local f = GameMenuFrame
f:SetBackdrop(nil)
if GameMenuFrameHeader then
GameMenuFrameHeader:SetAlpha(0)
end
-- the client's title has no name: it is the frame's MAIN_MENU text
for _, r in ipairs({ f:GetRegions() }) do
if r:GetObjectType() == "FontString" and r:GetText() == MAIN_MENU then
r:SetAlpha(0)
end
end
Tpl.DialogFrame(f)
M.header = Tpl.Header(f, MAINMENU_BUTTON, headerFont())
for _, e in ipairs(entries()) do
if e[1] then
skinButton(e[1])
end
end
-- a button added after us (ACP's AddOns) is skinned by the layout on first show
f:HookScript("OnShow", M.Layout)
M.Layout()
end