mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-23 00:24:41 +01:00
A review against WCAG 2.2 AA left places a screen reader user could not work: - Key bindings: a key's button says the command and the key, the clear button which command it clears; a new key is said aloud and focus comes back to its row. The on-screen keyboard is reached with Tab and walked with the arrows. - Number fields read their label; the spin buttons are named and left out of Tab. - Dialogs: Enter presses the main button, Esc closes, focus starts on the first button and the message is read with it. - Consist: every change is said - added, removed, turned, moved, replaced, undone - and the strip is a named list; a turned card says so. - Searches say how many entries are left once typing pauses. - Hasler tapes, the black box timeline, timetable and cab panel take focus, work from the keyboard, read their value as it changes and draw a focus frame. - Section reset and level controls, the crew button and the tabs carry names; English names from Avalonia's templates are read in the starter's language; sort and crew menus are radio items. - Input borders reach 3:1 against the panels; Tab starts at the top bar; the splash screen has a title and its progress reads the loading step.
341 lines
23 KiB
XML
341 lines
23 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:starterNg="clr-namespace:StarterNG"
|
|
xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
|
|
xmlns:views="clr-namespace:StarterNG.Views"
|
|
x:CompileBindings="True"
|
|
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="700"
|
|
x:Class="StarterNG.Views.Depot">
|
|
<UserControl.Styles>
|
|
<Style Selector="Button.ConsistTool">
|
|
<Setter Property="Width" Value="26" />
|
|
<Setter Property="Height" Value="22" />
|
|
<Setter Property="MinWidth" Value="0" />
|
|
<Setter Property="MinHeight" Value="0" />
|
|
<Setter Property="Padding" Value="0" />
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
</Style>
|
|
<Style Selector="Button.ConsistTool:disabled">
|
|
<Setter Property="Opacity" Value="0.35" />
|
|
</Style>
|
|
<Style Selector="Button.ConsistTool materialIcons|MaterialIcon">
|
|
<Setter Property="Width" Value="16" />
|
|
<Setter Property="Height" Value="16" />
|
|
</Style>
|
|
</UserControl.Styles>
|
|
<!-- TabIndex follows the workflow - pick a consist, browse, build the train,
|
|
then the editors - not the column order the grid happens to have. -->
|
|
<Grid Name="depotGrid" Margin="0" ColumnSpacing="3" RowSpacing="3">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="270" MinWidth="220" />
|
|
<ColumnDefinition />
|
|
<ColumnDefinition Width="340" MinWidth="300" />
|
|
</Grid.ColumnDefinitions>
|
|
<!-- The vehicle panel keeps its old height on a roomy window (MaxHeight)
|
|
but shrinks with everything else towards the 666 px floor instead of
|
|
being clipped. The consist row measures itself, so a whole card fits
|
|
whether the thumbnails are the small ones or the large ones. Row 1's
|
|
cap fits the seven lines of the texture tab and the coupling tab with
|
|
its buttons, and no more: what it leaves goes to the vehicle list.
|
|
Row 0's floor is what the left column needs with a usable list; below
|
|
it the list ran over the search box. Row 1's tabs scroll instead. -->
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" MinHeight="264" />
|
|
<RowDefinition Height="1.57*" MinHeight="120" MaxHeight="172" />
|
|
<RowDefinition Height="Auto" MinHeight="140" MaxHeight="230" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Border Grid.Column="0" Grid.Row="0" TabIndex="2" Background="{StaticResource CarbonPanelBg}"
|
|
BorderBrush="{StaticResource CarbonBorderLight}" BorderThickness="1"
|
|
CornerRadius="2" Padding="6">
|
|
<!-- The old starter's column, top to bottom: the archival switch, the category
|
|
with the catalogue beside it, the class with its thumbnail, then the
|
|
vehicles. The search, which it kept in a window of its own, sits above
|
|
the list it fills. -->
|
|
<Grid RowDefinitions="Auto,Auto,Auto,Auto,*,Auto">
|
|
<CheckBox Name="hideArchivalCheck" Grid.Row="0" Margin="0,0,0,6" FontSize="12"
|
|
Content="{Binding [HideArchivalVehicles], Source={x:Static starterNg:App.Loc}}"
|
|
IsCheckedChanged="HideArchivalCheck_OnChanged" />
|
|
|
|
<DockPanel Grid.Row="1" Margin="0,0,0,6" LastChildFill="True">
|
|
<Button Name="textureBaseButton" DockPanel.Dock="Right" Classes="Flat"
|
|
Width="30" Margin="4,0,0,0" Cursor="Hand"
|
|
HorizontalContentAlignment="Center"
|
|
Click="TextureBaseButton_OnClick"
|
|
ToolTip.Tip="{Binding [OpenTextureBase], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="Magnify" Width="15" Height="15" />
|
|
</Button>
|
|
<ComboBox Name="categoryCombo" HorizontalAlignment="Stretch"
|
|
PlaceholderText="{Binding [Category], Source={x:Static starterNg:App.Loc}}"
|
|
PointerWheelChanged="Combo_OnPointerWheel"
|
|
SelectionChanged="CategoryCombo_OnSelectionChanged" />
|
|
</DockPanel>
|
|
|
|
<ComboBox Name="classCombo" Grid.Row="2" Margin="0,0,0,6" HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
PlaceholderText="{Binding [Class], Source={x:Static starterNg:App.Loc}}"
|
|
PointerWheelChanged="Combo_OnPointerWheel"
|
|
SelectionChanged="ClassCombo_OnSelectionChanged" />
|
|
|
|
<TextBox Name="searchBox" AutomationProperties.LandmarkType="Search" Grid.Row="3" Margin="0,0,0,6"
|
|
PlaceholderText="{Binding [SearchAllVehicles], Source={x:Static starterNg:App.Loc}}"
|
|
TextChanged="SearchBox_OnTextChanged" />
|
|
|
|
<ListBox Name="vehicleListBox" Grid.Row="4" Classes="Compact" MinHeight="60"
|
|
AutomationProperties.Name="{Binding [Vehicles], Source={x:Static starterNg:App.Loc}}"
|
|
SelectionChanged="VehicleListBox_OnSelectionChanged"
|
|
DoubleTapped="VehicleListBox_OnDoubleTapped"
|
|
PointerPressed="VehicleListBox_OnPointerPressed" />
|
|
|
|
<!-- The thumbnail - drag it onto the consist - Replace and Add share a
|
|
line, so the list keeps the height. Replace is what a double-click
|
|
on the list does, as in the old starter, put where it is seen. -->
|
|
<Grid Grid.Row="5" ColumnDefinitions="*,Auto,Auto" ColumnSpacing="6" Margin="0,6,0,0">
|
|
<Border Name="miniPreviewPanel" Height="34"
|
|
Background="{StaticResource CarbonInputBg}"
|
|
BorderBrush="{StaticResource CarbonBorderLight}" BorderThickness="1"
|
|
CornerRadius="2" Cursor="Hand"
|
|
PointerPressed="MiniPreview_OnPointerPressed">
|
|
<Image Name="miniPreview" Stretch="Uniform" Margin="3" />
|
|
</Border>
|
|
<Button Name="replaceVehicleButton" Grid.Column="1" Classes="Flat"
|
|
Cursor="Hand" IsEnabled="{Binding #addVehicleButton.IsEnabled}"
|
|
VerticalAlignment="Stretch" HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
Click="ReplaceVehicleButton_OnClick"
|
|
ToolTip.Tip="{Binding [TipReplaceVehicle], Source={x:Static starterNg:App.Loc}}"
|
|
Content="{Binding [ReplaceVehicle], Source={x:Static starterNg:App.Loc}}" />
|
|
<Button Name="addVehicleButton" Grid.Column="2" Classes="Flat Accent"
|
|
MinWidth="80" Cursor="Hand" IsEnabled="False"
|
|
VerticalAlignment="Stretch" HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
Click="AddVehicleButton_OnClick"
|
|
Content="{Binding [AddVehicle], Source={x:Static starterNg:App.Loc}}" />
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- No group header here: the tab strip already names the list, and the
|
|
scenery it belongs to is written into the tab itself. -->
|
|
<Border Grid.Column="1" Grid.Row="0" TabIndex="1"
|
|
Background="{StaticResource CarbonPanelBg}"
|
|
BorderBrush="{StaticResource CarbonBorderLight}"
|
|
BorderThickness="1" CornerRadius="2" Padding="6">
|
|
<!-- The tab picks what the consist strip edits: a consist of the scenery,
|
|
or a consist kept in the warehouse. -->
|
|
<TabControl Name="consistSourceTabs" AutomationProperties.Name="{Binding [DepotConsistSources], Source={x:Static starterNg:App.Loc}}"
|
|
SelectionChanged="ConsistSourceTabs_OnSelectionChanged">
|
|
<TabItem Name="sceneryConsistsTab"
|
|
Header="{Binding [SceneryConsists], Source={x:Static starterNg:App.Loc}}">
|
|
<DockPanel LastChildFill="True">
|
|
<Button Name="addToWarehouseButton" DockPanel.Dock="Bottom" Classes="Flat"
|
|
Margin="0,6,0,0" HorizontalAlignment="Stretch" Cursor="Hand"
|
|
HorizontalContentAlignment="Center"
|
|
Click="AddToWarehouseButton_OnClick"
|
|
Content="{Binding [AddToWarehouse], Source={x:Static starterNg:App.Loc}}" />
|
|
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Spacing="16"
|
|
Margin="2,6,0,0">
|
|
<CheckBox Name="depotDrivableOnlyCheck" FontSize="12"
|
|
IsCheckedChanged="ConsistFilter_OnChanged"
|
|
Content="{Binding [ShowDrivableOnly], Source={x:Static starterNg:App.Loc}}" />
|
|
<CheckBox Name="depotShowAiCheck" FontSize="12"
|
|
IsCheckedChanged="ConsistFilter_OnChanged"
|
|
Content="{Binding [ShowAiVehicles], Source={x:Static starterNg:App.Loc}}" />
|
|
</StackPanel>
|
|
<ListBox Name="sceneryConsistList" Classes="Compact"
|
|
AutomationProperties.Name="{Binding [SceneryConsists], Source={x:Static starterNg:App.Loc}}"
|
|
SelectionChanged="SceneryConsistList_OnSelectionChanged"
|
|
KeyDown="SceneryConsistList_OnKeyDown" />
|
|
</DockPanel>
|
|
</TabItem>
|
|
<TabItem Name="warehouseTab"
|
|
Header="{Binding [WarehouseConsists], Source={x:Static starterNg:App.Loc}}">
|
|
<DockPanel LastChildFill="True">
|
|
<Button Name="removeFromWarehouseButton" DockPanel.Dock="Bottom" Classes="Flat"
|
|
Margin="0,6,0,0" HorizontalAlignment="Stretch" Cursor="Hand"
|
|
HorizontalContentAlignment="Center"
|
|
Click="RemoveFromWarehouseButton_OnClick"
|
|
Content="{Binding [RemoveFromWarehouse], Source={x:Static starterNg:App.Loc}}" />
|
|
<TextBlock DockPanel.Dock="Bottom" Margin="2,6,0,0" FontSize="12" Opacity="0.6"
|
|
TextWrapping="Wrap"
|
|
Text="{Binding [WarehouseEditHint], Source={x:Static starterNg:App.Loc}}" />
|
|
<ListBox Name="warehouseList" Classes="Compact"
|
|
AutomationProperties.Name="{Binding [WarehouseConsists], Source={x:Static starterNg:App.Loc}}" />
|
|
</DockPanel>
|
|
</TabItem>
|
|
</TabControl>
|
|
</Border>
|
|
|
|
<!-- The configuration is the one panel here that is actually edited, so it
|
|
gets a column of its own spanning both rows - from the top edge down to
|
|
the consist. No tab strip: it was a single tab naming the only thing
|
|
the column could hold. -->
|
|
<Border Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" TabIndex="6"
|
|
Background="{StaticResource CarbonPanelBg}"
|
|
BorderBrush="{StaticResource CarbonBorderLight}"
|
|
BorderThickness="1" CornerRadius="2" Padding="6">
|
|
<DockPanel LastChildFill="True">
|
|
<Button Name="removeVehicleButton" DockPanel.Dock="Bottom" Classes="Flat"
|
|
Margin="0,6,0,0" HorizontalAlignment="Stretch" Cursor="Hand"
|
|
HorizontalContentAlignment="Center"
|
|
Click="RemoveVehicleButton_OnClick"
|
|
Content="{Binding [RemoveVehicle], Source={x:Static starterNg:App.Loc}}" />
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<StackPanel Name="loadsPanel" Margin="4" Grid.IsSharedSizeScope="True" />
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</Border>
|
|
|
|
<!-- No title band either: the tab strips start straight away, and the
|
|
vehicle being edited is the highlighted card in the consist below.
|
|
Two cards, not one: the read-only pair (general info / texture) is
|
|
visually separate from the editors (coupling / damage / brakes), and
|
|
each lines up with the panel above it. -->
|
|
<Border Grid.Row="1" Grid.Column="0" TabIndex="4"
|
|
Background="{StaticResource CarbonPanelBg}"
|
|
BorderBrush="{StaticResource CarbonBorderLight}"
|
|
BorderThickness="1" CornerRadius="2" Padding="6">
|
|
<TabControl AutomationProperties.Name="{Binding [DepotVehicleInfo], Source={x:Static starterNg:App.Loc}}">
|
|
<TabItem Header="{Binding [GeneralInfo], Source={x:Static starterNg:App.Loc}}">
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<StackPanel Name="generalPanel" Margin="4" Grid.IsSharedSizeScope="True" />
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
<TabItem Header="{Binding [AboutTexture], Source={x:Static starterNg:App.Loc}}">
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<StackPanel Name="consistTexturePanel" Margin="4" Grid.IsSharedSizeScope="True" />
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
</TabControl>
|
|
</Border>
|
|
|
|
<Border Grid.Row="1" Grid.Column="1" TabIndex="5"
|
|
Background="{StaticResource CarbonPanelBg}"
|
|
BorderBrush="{StaticResource CarbonBorderLight}"
|
|
BorderThickness="1" CornerRadius="2" Padding="6">
|
|
<TabControl AutomationProperties.Name="{Binding [DepotVehicleEdit], Source={x:Static starterNg:App.Loc}}">
|
|
<TabItem Header="{Binding [Coupling], Source={x:Static starterNg:App.Loc}}">
|
|
<!-- The coupling grid now uses the full tab width. The two
|
|
actions sit underneath, so they do not steal horizontal
|
|
space from the checkbox columns. -->
|
|
<DockPanel LastChildFill="True" Margin="4">
|
|
<Panel Name="couplerActions" DockPanel.Dock="Bottom" />
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<StackPanel Name="couplerPanel" />
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</TabItem>
|
|
<TabItem Header="{Binding [Damage], Source={x:Static starterNg:App.Loc}}">
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<StackPanel Name="damagePanel" Margin="4" Grid.IsSharedSizeScope="True" />
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
<TabItem Header="{Binding [Brakes], Source={x:Static starterNg:App.Loc}}">
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<!-- The scope is what makes every row's label column in this
|
|
panel settle on one width. -->
|
|
<StackPanel Name="brakesPanel" Margin="4"
|
|
Grid.IsSharedSizeScope="True" />
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
</TabControl>
|
|
</Border>
|
|
|
|
<HeaderedContentControl Name="consistGroup" Grid.Row="2" Grid.ColumnSpan="3" TabIndex="3"
|
|
Theme="{StaticResource GroupBox}"
|
|
Header="{Binding [Consist], Source={x:Static starterNg:App.Loc}}">
|
|
<!-- Mass, length and the rest ride in the title bar instead of taking
|
|
a row of their own above the cards. -->
|
|
<HeaderedContentControl.Tag>
|
|
<StackPanel Orientation="Horizontal" Spacing="16" VerticalAlignment="Center">
|
|
<!-- What acts on the whole consist, where the consist is: undo first,
|
|
then the random tools that were only in the list's menu. -->
|
|
<StackPanel Name="consistTools" Orientation="Horizontal" Spacing="2"
|
|
VerticalAlignment="Center">
|
|
<Button Name="undoButton" Classes="Basic ConsistTool" IsEnabled="False"
|
|
Click="UndoButton_OnClick"
|
|
ToolTip.Tip="{Binding [ConsistUndo], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="Undo" />
|
|
</Button>
|
|
<Button Name="redoButton" Classes="Basic ConsistTool" IsEnabled="False"
|
|
Click="RedoButton_OnClick"
|
|
ToolTip.Tip="{Binding [ConsistRedo], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="Redo" />
|
|
</Button>
|
|
<Border Width="1" Margin="6,3" Background="{StaticResource CarbonBorderLight}" />
|
|
<Button Classes="Basic ConsistTool" Click="RandomOrderButton_OnClick"
|
|
ToolTip.Tip="{Binding [TipRandomizeOrder], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="ShuffleVariant" />
|
|
</Button>
|
|
<Button Classes="Basic ConsistTool" Click="RandomOrientButton_OnClick"
|
|
ToolTip.Tip="{Binding [TipRandomizeOrientation], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="SwapHorizontalVariant" />
|
|
</Button>
|
|
<Button Classes="Basic ConsistTool" Click="RandomTexturesButton_OnClick"
|
|
ToolTip.Tip="{Binding [TipRandomizeTextures], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="Palette" />
|
|
</Button>
|
|
<Border Width="1" Margin="6,3" Background="{StaticResource CarbonBorderLight}" />
|
|
<!-- A scenery consist only: saved into the scenery file, or put
|
|
back as the file has it; a warehouse consist saves itself. -->
|
|
<Button Name="saveToSceneryButton" Classes="Basic ConsistTool" IsEnabled="False"
|
|
Click="SaveToSceneryButton_OnClick"
|
|
ToolTip.Tip="{Binding [SaveToScenery], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="ContentSaveOutline" />
|
|
</Button>
|
|
<Button Name="revertSceneryButton" Classes="Basic ConsistTool" IsEnabled="False"
|
|
Click="RevertSceneryButton_OnClick"
|
|
ToolTip.Tip="{Binding [RevertFromScenery], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="FileRestoreOutline" />
|
|
</Button>
|
|
<Button Name="addToWarehouseToolButton" Classes="Basic ConsistTool"
|
|
Click="AddToWarehouseButton_OnClick"
|
|
ToolTip.Tip="{Binding [AddToWarehouse], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="ArchiveArrowDownOutline" />
|
|
</Button>
|
|
<Button Classes="Basic ConsistTool" Click="ClearConsistButton_OnClick"
|
|
ToolTip.Tip="{Binding [ConsistRemoveAll], Source={x:Static starterNg:App.Loc}}">
|
|
<materialIcons:MaterialIcon Kind="DeleteSweepOutline" />
|
|
</Button>
|
|
</StackPanel>
|
|
<!-- Read only: the scenery's author turns a trainset round, and
|
|
the starter keeps it that way. -->
|
|
<TextBlock Name="reversedBadge" IsVisible="False" VerticalAlignment="Center"
|
|
FontSize="12" Foreground="#E0A030"
|
|
Text="{Binding [ConsistReversed], Source={x:Static starterNg:App.Loc}}"
|
|
ToolTip.Tip="{Binding [ConsistReversedTip], Source={x:Static starterNg:App.Loc}}" />
|
|
<StackPanel Name="trainStats" Orientation="Horizontal"
|
|
VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
</HeaderedContentControl.Tag>
|
|
<DockPanel LastChildFill="True">
|
|
<Panel Name="consistDropTarget">
|
|
<TextBlock Name="emptyHint" VerticalAlignment="Center" HorizontalAlignment="Center"
|
|
TextWrapping="Wrap" MaxWidth="520" Opacity="0.6" TextAlignment="Center"
|
|
Text="{Binding [ConsistEmpty], Source={x:Static starterNg:App.Loc}}" />
|
|
<ScrollViewer Name="consistScroll"
|
|
HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled">
|
|
<Panel>
|
|
<!-- Tab reaches the strip once and lands on the selected
|
|
card; the arrow keys walk it from there. -->
|
|
<!-- Read as the list of cards it is, so a reader hears where it is
|
|
and how many cards it holds. -->
|
|
<StackPanel Name="consistStack" Orientation="Horizontal"
|
|
AutomationProperties.Name="{Binding [Consist], Source={x:Static starterNg:App.Loc}}"
|
|
AutomationProperties.ControlTypeOverride="List"
|
|
AutomationProperties.AccessibilityView="Content"
|
|
KeyboardNavigation.TabNavigation="Once"
|
|
VerticalAlignment="Center" Spacing="0" />
|
|
<Canvas Name="consistOverlay" IsHitTestVisible="False" />
|
|
</Panel>
|
|
</ScrollViewer>
|
|
</Panel>
|
|
</DockPanel>
|
|
</HeaderedContentControl>
|
|
</Grid>
|
|
</UserControl>
|