Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/+atemschutz-trupp-naming.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Atemschutz names a Trupp by its Funkrufname and Trupp-Art instead of a running number, suggests only the Funkrufnamen of the Kräfte entered for the Einsatz, writes "Si." out as Sicherheitstrupp on screen and in the Bericht, and gives the Trupp column more room.
67 changes: 29 additions & 38 deletions src/LageBuch.App.Shared/Views/ScbaView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -267,21 +267,21 @@
</DataGrid.Styles>
<DataGrid.Columns>
<!-- Ten columns needed ~1460px and overflowed on a normal window, so related values are
stacked into one cell each: Trupp over its call sign, the two clock values together,
and current pressure over the next-check countdown, and the Sicherheitstrupp under
the Trupp it belongs to. The fixed columns total 1025px and MANNSCHAFT adds its
180px floor, so the grid wants 1205px and still fits a 1280px ELW screen — which is
what the layout test pins. Fixed widths mean content growth can no longer squeeze
the crew column, and an eighth column would have to buy its width from the crew or
from the action buttons. -->
<DataGridTemplateColumn Header="TRUPP" Width="190">
stacked into one cell each: the two clock values together, current pressure over
the next-check countdown, and the Sicherheitstrupp under the Trupp it belongs to.
TRUPP is the widest fixed column because its name carries the Funkrufname as well as
the Trupp-Art. The fixed columns total 1075px and MANNSCHAFT adds its 180px floor, so
the grid wants 1255px and still fits a 1280px ELW screen — which is what the layout
test pins. Fixed widths mean content growth can no longer squeeze the crew column,
and an eighth column would have to buy its width from the crew or from the action
buttons. -->
<DataGridTemplateColumn Header="TRUPP" Width="240">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="vm:ScbaTruppRow">
<StackPanel VerticalAlignment="Center" Margin="12,6">
<TextBlock Text="{Binding DisplayName}" TextTrimming="CharacterEllipsis" />
<TextBlock Text="{Binding CallSign}" Classes="mono" FontSize="11.5"
IsVisible="{Binding CallSign, Converter={x:Static ObjectConverters.IsNotNull}}"
TextTrimming="CharacterEllipsis" />
<!-- Funkrufname · Trupp-Art. Wraps rather than ellipsising: the Funkrufname is
what tells two Angriffstrupps apart, and the row has height to spare. -->
<TextBlock Text="{Binding DisplayName}" TextWrapping="Wrap" />
<!-- FwDV 7's Sicherheitstrupp (#399) stacks here rather than taking a column of
its own: eight columns already need every pixel of a 1280px ELW screen, and
the width for a ninth would have to come out of the crew or the action
Expand All @@ -296,32 +296,29 @@
being rebuilt — it crashed with an IndexOutOfRange out of EndBatchUpdate.
A command runs after the flyout has dismissed, with no selection model in
the picture. Same Button.Flyout idiom as ForcesView's Stärke editor. -->
<Grid ColumnDefinitions="Auto,*" Margin="0,4,0,0">
<TextBlock Grid.Column="0" Text="Si." Classes="cellLabel" ToolTip.Tip="Sicherheitstrupp" />
<Button Grid.Column="1" x:Name="SafetyTruppButton"
<StackPanel Margin="0,4,0,0" Spacing="2">
<TextBlock Text="Sicherheitstrupp" Classes="cellLabel" />
<Button x:Name="SafetyTruppButton"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Left"
Padding="8,4" FontSize="12"
Content="{Binding SafetyTruppButtonText}"
ToolTip.Tip="{Binding SafetyTruppButtonText}"
IsEnabled="{Binding CanAssignSafetyTrupp}"
AutomationProperties.Name="Sicherheitstrupp wählen">
<TextBlock Text="{Binding SafetyTruppButtonText}" TextTrimming="CharacterEllipsis" />
<Button.Flyout>
<Flyout Placement="BottomEdgeAlignedLeft">
<ItemsControl ItemsSource="{Binding SafetyTruppChoices}" MinWidth="170">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:SafetyTruppChoice">
<Button Classes="ghost" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left" Padding="8,5"
Command="{Binding SelectCommand}"
ToolTip.Tip="{Binding Detail}">
<Grid ColumnDefinitions="14,Auto,*" ColumnSpacing="6">
Command="{Binding SelectCommand}">
<Grid ColumnDefinitions="14,*" ColumnSpacing="6">
<!-- The entry in force is marked rather than styled, so it
still reads at a glance on the ELW's dimmed screen. -->
<TextBlock Grid.Column="0" Text="✓" FontWeight="Bold"
IsVisible="{Binding IsCurrent}" />
<TextBlock Grid.Column="1" Text="{Binding Display}" />
<TextBlock Grid.Column="2" Text="{Binding Detail}"
Classes="cellLabel" TextTrimming="CharacterEllipsis"
IsVisible="{Binding Detail, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Grid>
</Button>
</DataTemplate>
Expand All @@ -330,7 +327,7 @@
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</StackPanel>
<TextBlock x:Name="SafetyTruppHintText" Text="{Binding SafetyTruppHint}"
FontSize="11" FontWeight="SemiBold" Foreground="{StaticResource AmberBrush}"
TextWrapping="Wrap" IsVisible="{Binding HasSafetyTruppHint}" />
Expand Down Expand Up @@ -472,15 +469,12 @@
<StackPanel Spacing="6">
<Grid ColumnDefinitions="*,Auto">
<TextBlock Grid.Column="0" Text="{Binding DisplayName}" VerticalAlignment="Center"
FontWeight="SemiBold" TextTrimming="CharacterEllipsis"
FontWeight="SemiBold" TextWrapping="Wrap"
Foreground="{StaticResource TextPrimaryBrush}" />
<TextBlock Grid.Column="1" Text="{Binding StatusDisplay}" VerticalAlignment="Center"
FontWeight="SemiBold" Classes="scbaStatus"
Classes.alarm="{Binding IsAlarm}" Classes.control="{Binding IsControlDue}" />
</Grid>
<TextBlock Text="{Binding CallSign}" Classes="mono" FontSize="11.5"
IsVisible="{Binding CallSign, Converter={x:Static ObjectConverters.IsNotNull}}"
TextTrimming="CharacterEllipsis" />

<!-- The one value a Lagebuchführer looks for first. -->
<Grid ColumnDefinitions="Auto,*">
Expand Down Expand Up @@ -527,29 +521,26 @@
<!-- FwDV 7's Sicherheitstrupp. Same command-driven flyout as the grid; no x:Name
here, because the grid's SafetyTruppButton is found by name in tests and a
second control answering to it would make that search ambiguous. -->
<Grid ColumnDefinitions="Auto,*">
<TextBlock Grid.Column="0" Text="Si." Classes="cellLabel" ToolTip.Tip="Sicherheitstrupp" />
<Button Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left"
<StackPanel Spacing="2">
<TextBlock Text="Sicherheitstrupp" Classes="cellLabel" />
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Left"
Padding="8,4" FontSize="12"
Content="{Binding SafetyTruppButtonText}"
ToolTip.Tip="{Binding SafetyTruppButtonText}"
IsEnabled="{Binding CanAssignSafetyTrupp}"
AutomationProperties.Name="Sicherheitstrupp wählen">
<TextBlock Text="{Binding SafetyTruppButtonText}" TextTrimming="CharacterEllipsis" />
<Button.Flyout>
<Flyout Placement="BottomEdgeAlignedLeft">
<ItemsControl ItemsSource="{Binding SafetyTruppChoices}" MinWidth="170">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:SafetyTruppChoice">
<Button Classes="ghost" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left" Padding="8,5"
Command="{Binding SelectCommand}"
ToolTip.Tip="{Binding Detail}">
<Grid ColumnDefinitions="14,Auto,*" ColumnSpacing="6">
Command="{Binding SelectCommand}">
<Grid ColumnDefinitions="14,*" ColumnSpacing="6">
<TextBlock Grid.Column="0" Text="✓" FontWeight="Bold"
IsVisible="{Binding IsCurrent}" />
<TextBlock Grid.Column="1" Text="{Binding Display}" />
<TextBlock Grid.Column="2" Text="{Binding Detail}"
Classes="cellLabel" TextTrimming="CharacterEllipsis"
IsVisible="{Binding Detail, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Grid>
</Button>
</DataTemplate>
Expand All @@ -558,7 +549,7 @@
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</StackPanel>
<TextBlock Text="{Binding SafetyTruppHint}"
FontSize="11" FontWeight="SemiBold" Foreground="{StaticResource AmberBrush}"
TextWrapping="Wrap" IsVisible="{Binding HasSafetyTruppHint}" />
Expand Down
8 changes: 2 additions & 6 deletions src/LageBuch.AppLogic/ViewModels/SafetyTruppChoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,21 @@ public sealed class SafetyTruppChoice
/// <summary>The label for the "no Sicherheitstrupp designated" entry.</summary>
public const string NoneDisplay = "— kein —";

public SafetyTruppChoice(Guid? id, string display, string? detail, bool isCurrent, Action<Guid?> onSelect)
public SafetyTruppChoice(Guid? id, string display, bool isCurrent, Action<Guid?> onSelect)
{
ArgumentNullException.ThrowIfNull(onSelect);
Id = id;
Display = display;
Detail = detail;
IsCurrent = isCurrent;
SelectCommand = new RelayCommand(() => onSelect(id));
}

/// <summary>The Trupp being designated, or null for "kein Sicherheitstrupp".</summary>
public Guid? Id { get; }

/// <summary>The short label, e.g. "Trupp 3" — the full DisplayName does not fit the cell.</summary>
/// <summary>The Trupp's name, e.g. "Florian Musterstadt 44/1 · Sicherheitstrupp".</summary>
public string Display { get; }

/// <summary>The Trupp-Art, shown dimmed beside the label, or null for the "kein" entry.</summary>
public string? Detail { get; }

/// <summary>Whether this entry is the one currently in force, for the check mark.</summary>
public bool IsCurrent { get; }

Expand Down
Loading
Loading