Windows 0.2.22 clean UI-maintenance source delta; no private history or other platform changes

This commit is contained in:
2026-10-13 04:32:04 +00:00
parent 901f27baf5
commit 3ccaea3d52
19 changed files with 393 additions and 74 deletions
+14 -10
View File
@@ -37,7 +37,7 @@ internal sealed partial class MainForm : Form
private readonly bool _preview;
private readonly Func<CancellationToken, Task>? _startupRecovery;
private readonly ScenicPanel _content = new() { ComposeChildren = true, LoginArtwork = true };
private readonly ScenicPanel _content = new() { ComposeChildren = false, LoginArtwork = true };
private readonly BrandHeaderPanel _brandHeader = new();
private readonly Label _headerPoem = new();
private readonly RoundedCardPanel _loginView = new();
@@ -98,6 +98,7 @@ internal sealed partial class MainForm : Form
AutoScaleMode = AutoScaleMode.Dpi;
Font = Brand.Font(9.5f);
DoubleBuffered = true;
ResizeRedraw = true;
Icon = LoadIcon();
SuspendLayout();
@@ -1185,6 +1186,7 @@ internal sealed partial class MainForm : Form
// Windows can deliver a queued tray event while the form is already
// shutting down. Ignore it instead of touching disposed WinForms state.
if (_exiting || IsDisposed || Disposing || !IsHandleCreated) return;
RestoreFromTrayPresentation();
Show();
WindowState = FormWindowState.Normal;
if (!Screen.AllScreens.Any(screen => screen.WorkingArea.IntersectsWith(Bounds))) CenterToScreen();
@@ -1391,19 +1393,21 @@ internal sealed partial class MainForm : Form
internal class CardPanel : Panel
{
internal const int SurfaceAlpha = 128;
internal bool Embedded { get; set; }
internal bool ScenicStatus { get; set; }
internal bool AccentBar { get; set; }
internal bool MetricBand { get; set; }
internal CardPanel()
{
SetStyle(ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw
| ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Opaque, false);
BackColor = Color.Transparent;
}
protected override void OnPaintBackground(PaintEventArgs eventArgs)
{
if (Embedded) { eventArgs.Graphics.Clear(Color.White); return; }
if (Width < 16 || Height < 16) return;
var g = eventArgs.Graphics;
if (Parent is not null)
{
@@ -1413,22 +1417,22 @@ internal class CardPanel : Panel
g.Restore(state);
}
else g.Clear(Brand.Surface);
// Metrics inherit the freshly painted card; never retain the previous
// number, or add another white tint on every child repaint.
if (Embedded || Width < 16 || Height < 16) return;
g.SmoothingMode = SmoothingMode.AntiAlias;
var s = DeviceDpi / 96f;
var radius = Math.Max(6, (int)(11 * s));
using var shadow = UiGeometry.RoundedRectangle(new Rectangle(1, 3, Width - 3, Height - 4), radius);
using var shadowBrush = new SolidBrush(Color.FromArgb(215, 237, 249));
g.FillPath(shadowBrush, shadow);
using var shadowPen = new Pen(Color.FromArgb(32, 110, 169, 199), Math.Max(1, 2 * s));
g.DrawPath(shadowPen, shadow);
using var path = UiGeometry.RoundedRectangle(new Rectangle(1, 1, Width - 3, Height - 5), radius);
using var fill = new SolidBrush(Color.White);
using var fill = new SolidBrush(Color.FromArgb(SurfaceAlpha, Color.White));
using var border = new Pen(ScenicStatus ? Color.White : Color.FromArgb(201, 227, 249), Math.Max(1, s * (ScenicStatus ? 1.7f : .75f)));
g.FillPath(fill, path);
if (ScenicStatus)
{
var state = g.Save(); g.SetClip(path);
ScenicTheme.Art(g, ClientRectangle, .19f);
using var mist = new LinearGradientBrush(ClientRectangle, Color.FromArgb(200, 243, 255, 252), Color.FromArgb(100, 228, 250, 253), 0f);
g.FillRectangle(mist, ClientRectangle);
ScenicTheme.Clouds(g, new Rectangle(Width - (int)(260*s), (int)(14*s), (int)(120*s), (int)(50*s)), .6f);
g.Restore(state);
}