Take half the room either side of the text in a log cell
The values sit closer to the line between the columns, and a column that is as wide as its values is fifteen pixels narrower. A header takes much more room besides its text than a cell does — its own padding, and the room the theme keeps for the sort arrow — so the two are now measured with an allowance each. One allowance for both clipped "Mode" and "CQ-Zone" to the column width the values needed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0157i7PiZyqBkquxS9A6FTdQ
This commit is contained in:
@@ -19,8 +19,12 @@ namespace Nonemm.App.Windows;
|
||||
/// lasts as long as the window is open.
|
||||
public sealed partial class LogWindow
|
||||
{
|
||||
/// What a cell takes either side of its text, in device pixels.
|
||||
private const double CellPadding = 30;
|
||||
/// What a cell takes besides its text, in device pixels.
|
||||
private const double CellPadding = 15;
|
||||
|
||||
/// What a header takes besides its text: its own padding and the room the
|
||||
/// theme keeps for the sort arrow, which is much more than a cell takes.
|
||||
private const double HeaderPadding = 45;
|
||||
|
||||
private readonly Dictionary<DataGridColumn, QsoColumn> columnOf = [];
|
||||
private IReadOnlyList<QsoColumn> shown = [];
|
||||
@@ -185,8 +189,8 @@ public sealed partial class LogWindow
|
||||
/// theme's own font — so each is measured in the font it is drawn in.
|
||||
private static double WidthFor(QsoColumn column, DataGrid grid) =>
|
||||
Math.Max(
|
||||
TextWidth(new string('0', column.Width + 1), grid.FontFamily, grid.FontSize),
|
||||
TextWidth(column.Label + "0", FontFamily.Default, grid.FontSize)) + CellPadding;
|
||||
TextWidth(new string('0', column.Width + 1), grid.FontFamily, grid.FontSize) + CellPadding,
|
||||
TextWidth(column.Label + "0", FontFamily.Default, grid.FontSize) + HeaderPadding);
|
||||
|
||||
private static double TextWidth(string text, FontFamily family, double size) =>
|
||||
new FormattedText(
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
<Style Selector="DataGridCell TextBlock">
|
||||
<Setter Property="FontFamily" Value="monospace" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<!-- half of what the theme leaves either side of the text, so more
|
||||
columns fit across the window -->
|
||||
<Setter Property="Margin" Value="6,0" />
|
||||
</Style>
|
||||
<!-- the theme gives a cell 32 pixels of height, which fits about a
|
||||
dozen rows on screen. The row is cut down to the height of its
|
||||
@@ -37,7 +40,7 @@
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="MinHeight" Value="0" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Padding" Value="12,0" />
|
||||
<Setter Property="Padding" Value="6,0" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
Reference in New Issue
Block a user