Working folder (phase 1): CSV/raw/step/step_finali all used to live split across two different implicit locations (CSV in the "repo root" found by walking up for CLAUDE.md, raw/step next to the input distinta file) with neither shown to the user. That repo-root lookup also silently breaks once the app runs as a standalone published exe on a machine with no repo/ CLAUDE.md at all. Replaced both with one explicit "cartella di lavoro", auto-suggested (last used, remembered the same way as the DB path) and changeable from phase 1, with no dependency on any repo marker file. Rename: CadSearchGui was the working name from before the app had a product identity; renamed folders, csproj files, namespace and the AppData settings folder to PrepStep throughout, matching the exe name already in use. Product-facing name stays "Cevolani StepPrep". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
73 lines
2.8 KiB
C#
73 lines
2.8 KiB
C#
using System.Drawing.Drawing2D;
|
|
|
|
namespace PrepStep;
|
|
|
|
/// <summary>Stile bottoni condiviso tra la form principale e i dialog secondari: piatto con
|
|
/// bordo sottile e hover, per un aspetto coerente sia per l'azione primaria di ogni fase
|
|
/// (blu pieno) sia per le azioni secondarie, al posto del bottone grigio di default.</summary>
|
|
internal static class UiStile
|
|
{
|
|
// AutoSize+Padding invece di una Size fissa in pixel: il bottone si dimensiona sempre
|
|
// al proprio testo (a qualunque lunghezza/font), niente più testo che va a capo e viene
|
|
// tagliato in verticale quando non ci sta nella larghezza indovinata a mano.
|
|
private static void DimensionamentoAutomatico(Button b)
|
|
{
|
|
b.AutoSize = true;
|
|
b.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
b.Padding = new Padding(18, 4, 18, 4);
|
|
b.MinimumSize = new Size(0, 32);
|
|
}
|
|
|
|
public static void Primario(Button b)
|
|
{
|
|
DimensionamentoAutomatico(b);
|
|
b.FlatStyle = FlatStyle.Flat;
|
|
b.FlatAppearance.BorderSize = 0;
|
|
b.FlatAppearance.MouseOverBackColor = Color.FromArgb(0, 84, 152);
|
|
b.FlatAppearance.MouseDownBackColor = Color.FromArgb(0, 70, 130);
|
|
b.BackColor = Color.FromArgb(0, 99, 177);
|
|
b.ForeColor = Color.White;
|
|
b.Font = new Font(b.Font, FontStyle.Bold);
|
|
b.Cursor = Cursors.Hand;
|
|
}
|
|
|
|
public static void Secondario(Button b)
|
|
{
|
|
DimensionamentoAutomatico(b);
|
|
b.FlatStyle = FlatStyle.Flat;
|
|
b.FlatAppearance.BorderColor = Color.FromArgb(190, 195, 200);
|
|
b.FlatAppearance.BorderSize = 1;
|
|
b.FlatAppearance.MouseOverBackColor = Color.FromArgb(230, 238, 245);
|
|
b.FlatAppearance.MouseDownBackColor = Color.FromArgb(213, 226, 238);
|
|
b.BackColor = Color.White;
|
|
b.Cursor = Cursors.Hand;
|
|
}
|
|
|
|
/// <summary>Arrotonda gli angoli del bottone. Si aggancia a SizeChanged invece di calcolare
|
|
/// la Region una volta sola: con AutoSize la dimensione finale si conosce solo a layout
|
|
/// avvenuto (dopo Text/Padding), non subito dopo la creazione del controllo.</summary>
|
|
public static void Arrotonda(Button b, int raggio = 6)
|
|
{
|
|
b.SizeChanged += (_, _) => AggiornaRegione(b, raggio);
|
|
AggiornaRegione(b, raggio);
|
|
}
|
|
|
|
private static void AggiornaRegione(Button b, int raggio)
|
|
{
|
|
if (b.Width <= 0 || b.Height <= 0)
|
|
return;
|
|
|
|
int d = raggio * 2;
|
|
var rect = new Rectangle(Point.Empty, b.Size);
|
|
using var percorso = new GraphicsPath();
|
|
percorso.AddArc(rect.X, rect.Y, d, d, 180, 90);
|
|
percorso.AddArc(rect.Right - d, rect.Y, d, d, 270, 90);
|
|
percorso.AddArc(rect.Right - d, rect.Bottom - d, d, d, 0, 90);
|
|
percorso.AddArc(rect.X, rect.Bottom - d, d, d, 90, 90);
|
|
percorso.CloseFigure();
|
|
|
|
b.Region?.Dispose();
|
|
b.Region = new Region(percorso);
|
|
}
|
|
}
|