mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-10-29 02:57:29 +01:00
Picking a category picks its first class and lists that class, instead of every vehicle of the category; only categories with something in them are offered, in the old order. The archival switch has its own line, the class box shows the thumbnail of the class picked, and the search sits above the list and looks through every vehicle. The rows are the bare texture names, a set marked faintly; an empty list says what to do; the thumbnail and Add share a line so the list keeps its height.
239 lines
15 KiB
XML
239 lines
15 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">
|
|
<!-- 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. -->
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" MinHeight="150" />
|
|
<RowDefinition Height="1.57*" MinHeight="120" MaxHeight="240" />
|
|
<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" 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"
|
|
SelectionChanged="VehicleListBox_OnSelectionChanged"
|
|
DoubleTapped="VehicleListBox_OnDoubleTapped"
|
|
PointerPressed="VehicleListBox_OnPointerPressed" />
|
|
|
|
<!-- The thumbnail - drag it onto the consist - and Add share a line, so
|
|
the list keeps the height. -->
|
|
<Grid Grid.Row="5" ColumnDefinitions="*,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="addVehicleButton" Grid.Column="1" 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">
|
|
<TabControl>
|
|
<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"
|
|
SelectionChanged="SceneryConsistList_OnSelectionChanged"
|
|
KeyDown="SceneryConsistList_OnKeyDown" />
|
|
</DockPanel>
|
|
</TabItem>
|
|
<TabItem 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}}" />
|
|
<ListBox Name="warehouseList" Classes="Compact"
|
|
DoubleTapped="WarehouseList_OnDoubleTapped" />
|
|
</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>
|
|
<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>
|
|
<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 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 Name="trainStats" Orientation="Horizontal"
|
|
VerticalAlignment="Center" />
|
|
</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"
|
|
Padding="0,0,0,4">
|
|
<Panel>
|
|
<!-- Tab reaches the strip once and lands on the selected
|
|
card; the arrow keys walk it from there. -->
|
|
<StackPanel Name="consistStack" Orientation="Horizontal"
|
|
KeyboardNavigation.TabNavigation="Once"
|
|
VerticalAlignment="Center" Spacing="0" />
|
|
<Canvas Name="consistOverlay" IsHitTestVisible="False" />
|
|
</Panel>
|
|
</ScrollViewer>
|
|
</Panel>
|
|
</DockPanel>
|
|
</HeaderedContentControl>
|
|
</Grid>
|
|
</UserControl>
|