mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 06:55:59 +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.
271 lines
19 KiB
XML
271 lines
19 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:infra="clr-namespace:StarterNG.Infrastructure"
|
|
xmlns:ctl="clr-namespace:StarterNG.Controls"
|
|
xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
|
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
x:Class="StarterNG.Views.Scenarios"
|
|
x:CompileBindings="True">
|
|
<UserControl.Resources>
|
|
<SolidColorBrush x:Key="SyntaxFaultBrush" Color="#E0A030" />
|
|
</UserControl.Resources>
|
|
<Grid Name="scenariosGrid" Margin="0" ColumnSpacing="0" RowSpacing="3">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" MinWidth="200" MaxWidth="460" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="3.2*" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition />
|
|
<!-- Measures itself, so a whole card fits at either thumbnail size; the
|
|
floor follows the thumbnail size, see SyncConsistRowHeight. -->
|
|
<RowDefinition Height="Auto" MaxHeight="200" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<HeaderedContentControl Grid.Column="0" Grid.Row="0" Theme="{StaticResource GroupBox}"
|
|
Classes="Compact"
|
|
Header="{Binding [Sceneries], Source={x:Static starterNg:App.Loc}}">
|
|
<DockPanel LastChildFill="True">
|
|
<CheckBox DockPanel.Dock="Bottom" Name="archivalSwitch"
|
|
Margin="2,4,0,0" FontSize="12"
|
|
IsCheckedChanged="ArchivalSwitch_OnChanged"
|
|
Content="{Binding [HideArchivalSceneries], Source={x:Static starterNg:App.Loc}}" />
|
|
<TreeView Name="sceneryList" Classes="Compact"
|
|
AutomationProperties.Name="{Binding [Sceneries], Source={x:Static starterNg:App.Loc}}"
|
|
SelectionChanged="SceneryList_OnSelectionChanged"
|
|
ContextRequested="SceneryList_OnContextRequested">
|
|
<TreeView.ContextMenu>
|
|
<ContextMenu Opening="SceneryMenu_OnOpening">
|
|
<MenuItem Name="favoriteMenuItem" Click="ToggleFavorite_OnClick" />
|
|
<Separator />
|
|
<MenuItem Click="ReloadSceneries_OnClick"
|
|
Header="{Binding [ReloadSceneries], Source={x:Static starterNg:App.Loc}}" />
|
|
<MenuItem Click="OpenSceneryDir_OnClick"
|
|
Header="{Binding [OpenSceneryFolder], Source={x:Static starterNg:App.Loc}}" />
|
|
</ContextMenu>
|
|
</TreeView.ContextMenu>
|
|
</TreeView>
|
|
</DockPanel>
|
|
</HeaderedContentControl>
|
|
|
|
<GridSplitter IsTabStop="False" AutomationProperties.Name="{Binding [PanelSplitter], Source={x:Static starterNg:App.Loc}}" Grid.Column="1" Grid.Row="0" Width="6"
|
|
Background="Transparent" ResizeDirection="Columns" />
|
|
|
|
<Grid Grid.Column="2" Grid.Row="0">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="2*" MinHeight="90" />
|
|
<RowDefinition Height="4" />
|
|
<RowDefinition Height="3*" MinHeight="140" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<HeaderedContentControl Grid.Row="0" Theme="{StaticResource GroupBox}"
|
|
Header="{Binding [SceneryConsists], Source={x:Static starterNg:App.Loc}}">
|
|
<HeaderedContentControl.Tag>
|
|
<Button Name="randomTexturesButton" Classes="Flat" Cursor="Hand"
|
|
FontSize="12" MinHeight="0" Padding="10,1"
|
|
Click="RandomTexturesButton_OnClick"
|
|
Content="{Binding [RandomizeTextures], Source={x:Static starterNg:App.Loc}}"
|
|
ToolTip.Tip="{Binding [TipRandomizeTextures], Source={x:Static starterNg:App.Loc}}" />
|
|
</HeaderedContentControl.Tag>
|
|
|
|
<ListBox Name="vehicleList" Classes="Compact"
|
|
AutomationProperties.Name="{Binding [SceneryConsists], Source={x:Static starterNg:App.Loc}}"
|
|
SelectionChanged="VehicleList_OnSelectionChanged" />
|
|
</HeaderedContentControl>
|
|
|
|
<GridSplitter IsTabStop="False" AutomationProperties.Name="{Binding [PanelSplitter], Source={x:Static starterNg:App.Loc}}" Grid.Row="1" Height="4" HorizontalAlignment="Stretch"
|
|
Background="Transparent" ResizeDirection="Rows" />
|
|
|
|
<TabControl Grid.Row="2" Name="infoTabs" AutomationProperties.Name="{Binding [ScenarioDetails], Source={x:Static starterNg:App.Loc}}">
|
|
<TabItem Header="{Binding [TabDescription], Source={x:Static starterNg:App.Loc}}">
|
|
<Grid RowDefinitions="2*,6,*" Margin="4">
|
|
<Grid Grid.Row="0" ColumnDefinitions="*,3,225">
|
|
<HeaderedContentControl Grid.Column="0" Theme="{StaticResource GroupBox}"
|
|
Header="{Binding [SceneryDescription], Source={x:Static starterNg:App.Loc}}">
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<TextBlock TextWrapping="Wrap" Name="sceneryDescription" />
|
|
</ScrollViewer>
|
|
</HeaderedContentControl>
|
|
|
|
<Border Grid.Column="2" ClipToBounds="True"
|
|
Background="{StaticResource CarbonPanelBg}"
|
|
BorderBrush="{StaticResource CarbonBorderLight}" BorderThickness="1">
|
|
<Image Name="sceneryImage" Stretch="Uniform" Margin="2" />
|
|
</Border>
|
|
</Grid>
|
|
|
|
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto">
|
|
<TextBlock TextWrapping="Wrap" Name="missionDescription" />
|
|
</ScrollViewer>
|
|
</Grid>
|
|
</TabItem>
|
|
<TabItem Header="{Binding [Weather], Source={x:Static starterNg:App.Loc}}">
|
|
<StackPanel Name="weatherForm" Margin="8,6" Spacing="8" IsEnabled="False">
|
|
<Grid ColumnDefinitions="Auto,12,380,8,70"
|
|
RowDefinitions="Auto,6,Auto,14,Auto,Auto,8,Auto,Auto,10,Auto,10,Auto">
|
|
|
|
<TextBlock Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"
|
|
Foreground="{StaticResource CarbonFgDim}"
|
|
Text="{Binding [Date], Source={x:Static starterNg:App.Loc}}" />
|
|
<Grid Grid.Row="0" Grid.Column="2" ColumnDefinitions="150,10,150,10,*">
|
|
<DatePicker Grid.Column="0" Name="weatherDate" AutomationProperties.Name="{Binding [Date], Source={x:Static starterNg:App.Loc}}"
|
|
YearVisible="False" MinWidth="0"
|
|
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
|
SelectedDateChanged="WeatherDate_OnChanged" />
|
|
<ComboBox Grid.Column="2" Name="weatherSeason" AutomationProperties.Name="{Binding [Season], Source={x:Static starterNg:App.Loc}}" Classes="Localized"
|
|
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
|
SelectionChanged="WeatherSeason_OnChanged">
|
|
<ComboBoxItem Tag="0" Content="{Binding [SeasonNow], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="113" Content="{Binding [SeasonSpring], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="204" Content="{Binding [SeasonSummer], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="297" Content="{Binding [SeasonAutumn], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="15" Content="{Binding [SeasonWinter], Source={x:Static starterNg:App.Loc}}" />
|
|
</ComboBox>
|
|
<TextBlock Grid.Column="4" Name="weatherDayDate"
|
|
VerticalAlignment="Center"
|
|
Foreground="{StaticResource CarbonFgDim}" />
|
|
</Grid>
|
|
|
|
<TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center"
|
|
Foreground="{StaticResource CarbonFgDim}"
|
|
Text="{Binding [Time], Source={x:Static starterNg:App.Loc}}" />
|
|
<Grid Grid.Row="2" Grid.Column="2" ColumnDefinitions="150,8,*">
|
|
<TimePicker Grid.Column="0" Name="weatherTime" AutomationProperties.Name="{Binding [Time], Source={x:Static starterNg:App.Loc}}"
|
|
ClockIdentifier="24HourClock" MinuteIncrement="1"
|
|
MinWidth="0" VerticalAlignment="Center"
|
|
HorizontalAlignment="Stretch"
|
|
SelectedTimeChanged="WeatherTime_OnChanged" />
|
|
<Button Grid.Column="2" Name="weatherTimeNow"
|
|
Classes="Flat" Cursor="Hand" VerticalAlignment="Center"
|
|
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"
|
|
Click="WeatherTimeNow_OnClick"
|
|
Content="{Binding [CurrentTime], Source={x:Static starterNg:App.Loc}}" />
|
|
</Grid>
|
|
|
|
<TextBlock Grid.Row="4" Grid.Column="0" VerticalAlignment="Center"
|
|
Foreground="{StaticResource CarbonFgDim}"
|
|
Text="{Binding [Temperature], Source={x:Static starterNg:App.Loc}}" />
|
|
<ctl:ReadableSlider Grid.Row="4" Grid.Column="2" Name="weatherTemp" AutomationProperties.Name="{Binding [Temperature], Source={x:Static starterNg:App.Loc}}"
|
|
Minimum="-50" Maximum="50"
|
|
TickFrequency="1" IsSnapToTickEnabled="True"
|
|
ValueChanged="Weather_OnSliderChanged" />
|
|
<TextBlock Grid.Row="4" Grid.Column="4" Name="weatherTempLabel"
|
|
VerticalAlignment="Center" TextAlignment="Right"
|
|
FontWeight="SemiBold" />
|
|
<DockPanel Grid.Row="5" Grid.Column="2" Margin="0,-6,0,0">
|
|
<TextBlock DockPanel.Dock="Right" FontSize="12"
|
|
Foreground="{StaticResource CarbonFgDim}" Text="+50 °C" />
|
|
<TextBlock FontSize="12"
|
|
Foreground="{StaticResource CarbonFgDim}" Text="-50 °C" />
|
|
</DockPanel>
|
|
|
|
<TextBlock Grid.Row="7" Grid.Column="0" VerticalAlignment="Center"
|
|
Foreground="{StaticResource CarbonFgDim}"
|
|
Text="{Binding [Visibility], Source={x:Static starterNg:App.Loc}}" />
|
|
<ctl:ReadableSlider Grid.Row="7" Grid.Column="2" Name="weatherFog" AutomationProperties.Name="{Binding [Visibility], Source={x:Static starterNg:App.Loc}}"
|
|
Minimum="0" Maximum="1000" SmallChange="20" LargeChange="100"
|
|
TickFrequency="1" IsSnapToTickEnabled="True"
|
|
ValueChanged="Weather_OnSliderChanged" />
|
|
<TextBlock Grid.Row="7" Grid.Column="4" Name="weatherFogLabel"
|
|
VerticalAlignment="Center" TextAlignment="Right"
|
|
FontWeight="SemiBold" />
|
|
<DockPanel Grid.Row="8" Grid.Column="2" Margin="0,-6,0,0">
|
|
<TextBlock DockPanel.Dock="Right" FontSize="12"
|
|
Foreground="{StaticResource CarbonFgDim}"
|
|
Text="{Binding [VisibilityGood], Source={x:Static starterNg:App.Loc}}" />
|
|
<TextBlock FontSize="12" Foreground="{StaticResource CarbonFgDim}"
|
|
Text="{Binding [VisibilityBad], Source={x:Static starterNg:App.Loc}}" />
|
|
</DockPanel>
|
|
|
|
<TextBlock Grid.Row="10" Grid.Column="0" VerticalAlignment="Center"
|
|
Foreground="{StaticResource CarbonFgDim}"
|
|
Text="{Binding [Overcast], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBox Grid.Row="10" Grid.Column="2" Name="weatherOvercast" AutomationProperties.Name="{Binding [Overcast], Source={x:Static starterNg:App.Loc}}" Classes="Localized"
|
|
HorizontalAlignment="Stretch"
|
|
SelectionChanged="Weather_OnSelectionChanged">
|
|
<ComboBoxItem Tag="random" Content="{Binding [OvercastRandom], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="-1.5" Content="{Binding [OvercastClear], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="0" Content="{Binding [OvercastFair], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="0.3" Content="{Binding [OvercastLight], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="0.7" Content="{Binding [OvercastModerate], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="1" Content="{Binding [OvercastHeavy], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="1.1" Content="{Binding [OvercastCloudy], Source={x:Static starterNg:App.Loc}}" />
|
|
<ComboBoxItem Tag="1.5" Content="{Binding [OvercastStorm], Source={x:Static starterNg:App.Loc}}" />
|
|
</ComboBox>
|
|
|
|
<Border Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="5"
|
|
Height="1" VerticalAlignment="Center"
|
|
Background="{StaticResource CarbonBorderLight}" />
|
|
|
|
<Button Grid.Row="12" Grid.Column="2" Grid.ColumnSpan="3"
|
|
Name="weatherRestore" Classes="Flat" Cursor="Hand"
|
|
HorizontalAlignment="Right" MinWidth="180"
|
|
HorizontalContentAlignment="Center"
|
|
Click="WeatherRestore_OnClick"
|
|
Content="{Binding [RestoreWeather], Source={x:Static starterNg:App.Loc}}" />
|
|
</Grid>
|
|
|
|
</StackPanel>
|
|
</TabItem>
|
|
<TabItem Name="timetableTab" ToolTip.ShowOnDisabled="True"
|
|
Header="{Binding [Timetable], Source={x:Static starterNg:App.Loc}}">
|
|
<DockPanel LastChildFill="True" Margin="4">
|
|
<ScrollViewer DockPanel.Dock="Bottom" HorizontalScrollBarVisibility="Auto"
|
|
VerticalScrollBarVisibility="Disabled" MaxHeight="72">
|
|
<StackPanel Name="attachmentsPanel" Orientation="Horizontal" Spacing="6" />
|
|
</ScrollViewer>
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
|
<TextBlock Name="timetableContent"
|
|
FontFamily="{x:Static infra:MonoFont.Family}"
|
|
FontSize="12" TextWrapping="NoWrap" />
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</TabItem>
|
|
<!-- Only for a scenery whose files hold mistakes - see PopulateFaults. -->
|
|
<TabItem Name="faultsTab" IsVisible="False">
|
|
<TabItem.Header>
|
|
<StackPanel Orientation="Horizontal" Spacing="5">
|
|
<materialIcons:MaterialIcon Kind="AlertOutline" Width="15" Height="15"
|
|
Foreground="{StaticResource SyntaxFaultBrush}" />
|
|
<TextBlock Name="faultsTabHeader" VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
</TabItem.Header>
|
|
<DockPanel LastChildFill="True" Margin="4">
|
|
<TextBlock DockPanel.Dock="Top" TextWrapping="Wrap" Margin="2,0,0,6"
|
|
Foreground="{StaticResource CarbonFgDim}"
|
|
Text="{Binding [SyntaxIntro], Source={x:Static starterNg:App.Loc}}" />
|
|
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
|
<SelectableTextBlock Name="faultsText"
|
|
FontFamily="{x:Static infra:MonoFont.Family}"
|
|
FontSize="12" TextWrapping="NoWrap" />
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</TabItem>
|
|
</TabControl>
|
|
</Grid>
|
|
|
|
<HeaderedContentControl Grid.Row="1" Grid.ColumnSpan="3" Theme="{StaticResource GroupBox}"
|
|
Header="{Binding [Consist], Source={x:Static starterNg:App.Loc}}">
|
|
<!-- Mass, length and the rest ride in the title bar, same as in the
|
|
depot, instead of taking a row of their own above the cards. -->
|
|
<HeaderedContentControl.Tag>
|
|
<StackPanel Name="trainStats" Orientation="Horizontal"
|
|
VerticalAlignment="Center" />
|
|
</HeaderedContentControl.Tag>
|
|
<DockPanel LastChildFill="True">
|
|
<ScrollViewer Name="consistScroll"
|
|
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
|
|
<Panel>
|
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"
|
|
Name="consistStack" />
|
|
<Canvas Name="consistOverlay" IsHitTestVisible="False" />
|
|
</Panel>
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</HeaderedContentControl>
|
|
</Grid>
|
|
</UserControl>
|