diff --git a/StarterNG/Views/Depot.axaml b/StarterNG/Views/Depot.axaml index 9c9c923..2990ac0 100644 --- a/StarterNG/Views/Depot.axaml +++ b/StarterNG/Views/Depot.axaml @@ -10,7 +10,7 @@ x:Class="StarterNG.Views.Depot"> - + @@ -23,7 +23,7 @@ cap fits the seven lines of the texture tab. --> - + @@ -127,7 +127,8 @@ + the consist. No tab strip: it was a single tab naming the only thing + the column could hold. --> - - - - - - - + + + diff --git a/StarterNG/Views/Depot.axaml.cs b/StarterNG/Views/Depot.axaml.cs index f703b78..ffce1a8 100644 --- a/StarterNG/Views/Depot.axaml.cs +++ b/StarterNG/Views/Depot.axaml.cs @@ -147,6 +147,19 @@ public partial class Depot : UserControl private void VehicleListBox_OnPointerPressed(object? sender, PointerPressedEventArgs e) => _drag.VehicleListPressed(sender, e); + /// + /// Floor of the consist row with the small thumbnails, one thumbnail height + /// below the roomy one. + /// + private const double SmallConsistRowHeight = 106; + + private const double LargeConsistRowHeight = 140; + + private void SyncConsistRowHeight() => + depotGrid.RowDefinitions[2].MinHeight = AppServices.Current.Settings.LargeThumbnails + ? LargeConsistRowHeight + : SmallConsistRowHeight; + private Dynamic NewVehicle(VehicleTexture texture) => _consist.MakeDynamic(texture, _listScenery ?? AppServices.Current.State.CurrentScenery); @@ -177,6 +190,7 @@ public partial class Depot : UserControl private void RebuildConsist() { + SyncConsistRowHeight(); consistStack.Children.Clear(); _cards.Forget(); _drag.Reset(); @@ -192,6 +206,13 @@ public partial class Depot : UserControl } emptyHint.IsVisible = _consist.Count == 0; + + // A selection the consist moved on its own - after a removal, say - is only + // highlighted; activating it runs what a click would have run. + if (_consist.Selected is { } moved && + (_consist.SelectedCar is null || !moved.Cars.Contains(_consist.SelectedCar))) + _cards.Activate(moved); + _details.Refresh(); UpdateTrainStats(); WriteBackToScenery(); diff --git a/StarterNG/Views/Depot/VehicleBrowser.cs b/StarterNG/Views/Depot/VehicleBrowser.cs index 1fc4c2a..bcecf32 100644 --- a/StarterNG/Views/Depot/VehicleBrowser.cs +++ b/StarterNG/Views/Depot/VehicleBrowser.cs @@ -445,6 +445,7 @@ public sealed class VehicleBrowser } Reading(App.Loc["TextureInfo"], Consist.Base(texture.Skinfile)); + Reading(App.Loc["Model"], texture.Directory + texture.Model); if (texture.Meta is { } meta) { diff --git a/StarterNG/Views/Depot/VehicleCards.cs b/StarterNG/Views/Depot/VehicleCards.cs index 231c59c..00a2701 100644 --- a/StarterNG/Views/Depot/VehicleCards.cs +++ b/StarterNG/Views/Depot/VehicleCards.cs @@ -234,6 +234,13 @@ public sealed class VehicleCards /// Selects an item without going through a redraw. picks the /// active member of a multi-vehicle unit; null keeps the current one when possible. /// + /// + /// Gives an item the selection a click would give it. Removing a vehicle only + /// moves the highlight, which left the starting vehicle, the detail panels and + /// the browser pointing at what was deleted. + /// + public void Activate(ConsistItem item) => Select(item, null); + private void Select(ConsistItem item, Dynamic? car) { var target = car ?? (ReferenceEquals(_consist.Selected, item) diff --git a/StarterNG/Views/Depot/VehicleDetails.cs b/StarterNG/Views/Depot/VehicleDetails.cs index 5b8f0c9..97d5c03 100644 --- a/StarterNG/Views/Depot/VehicleDetails.cs +++ b/StarterNG/Views/Depot/VehicleDetails.cs @@ -304,19 +304,21 @@ public sealed class VehicleDetails if (IsPassengerVehicle(item)) { - var lead = item.Cars[0]; + // The number rides in each vehicle's own name, so it belongs to the + // member the user picked inside the unit, not to its first car. + var numbered = _consist.ActiveCar(item); var numBox = new NumericUpDown { FontSize = 12, Minimum = 0, Maximum = 99999, Increment = 1, - Value = Consist.GetWagonNumber(lead), + Value = Consist.GetWagonNumber(numbered), FormatString = "0" }; numBox.ValueChanged += (_, _) => { - _consist.SetWagonNumber(lead, (int)(numBox.Value ?? 0)); + _consist.SetWagonNumber(numbered, (int)(numBox.Value ?? 0)); _redraw(); }; rows.Children.Add(Row(App.Loc["WagonNumber"], numBox));