mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 15:02:15 +01:00
Merge main into feat/tapes-from-blackbox
Conflicts: - CabPanel.cs: main (#50) tells the screen reader what the panel draws, this branch keeps the km/h label for the speed of the wheels beside it and shows the doors as the cab sees them. Both kept, and the speed of the wheels, new on this branch, is told to the screen reader too, as all the rest. - Records.cs: main (#55) adds the buzzers and the protection braking, this branch AsTheCabSees. Both kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,10 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
||||
["LiveTip"] = "Reads what the simulator adds to the file every 2 seconds",
|
||||
["Play"] = "Play",
|
||||
["Pause"] = "Pause",
|
||||
["PlaySpeed"] = "Playback speed",
|
||||
["TimelineHelp"] = "The arrows go 10 seconds back or on, with Ctrl a minute, Page Up and Page Down ten minutes, Home and End to the start and the end.",
|
||||
["TimetableHelp"] = "The up and down arrows go through the stations, Enter goes to the moment the train was there.",
|
||||
["MapHelp"] = "The map of the run. What it shows is also in the events and the timetable, and on the run below it.",
|
||||
["Follow"] = "Follow the train",
|
||||
["Fit"] = "Whole map",
|
||||
["NoFile"] = "Open a black box: physicslog/*.blackbox, written with the black box or the physics logs on.",
|
||||
@@ -181,6 +185,9 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
||||
["EventHornMissed"] = "W6: NO HORN",
|
||||
["EventCab"] = "Cab {0} of {1}",
|
||||
["EventSecurityBraking"] = "BRAKING BY {0}",
|
||||
["EventSecurityAlarm"] = "{0} buzzer",
|
||||
["EventSecurityAlarmAcknowledged"] = "{0} buzzer, acknowledged after {1:0.0} s",
|
||||
["EventSecurityAlarmMissed"] = "{0} buzzer, not acknowledged",
|
||||
["EventTimetable"] = "Timetable {0}, {1}",
|
||||
["CabSpeed"] = "Speed",
|
||||
["CabWheels"] = "wheels {0:0}",
|
||||
@@ -296,6 +303,10 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
||||
["LiveTip"] = "Co 2 sekundy doczytuje to, co symulator dopisał do pliku",
|
||||
["Play"] = "Odtwarzaj",
|
||||
["Pause"] = "Pauza",
|
||||
["PlaySpeed"] = "Prędkość odtwarzania",
|
||||
["TimelineHelp"] = "Strzałki przesuwają o 10 sekund, z Ctrl o minutę, Page Up i Page Down o dziesięć minut, Home i End na początek i koniec.",
|
||||
["TimetableHelp"] = "Strzałki w górę i w dół przechodzą po stacjach, Enter przenosi do chwili, gdy pociąg tam był.",
|
||||
["MapHelp"] = "Mapa przejazdu. To, co pokazuje, jest też w zdarzeniach, w rozkładzie i na przebiegu jazdy pod nią.",
|
||||
["Follow"] = "Śledź pociąg",
|
||||
["Fit"] = "Cała mapa",
|
||||
["NoFile"] = "Otwórz czarną skrzynkę: physicslog/*.blackbox, zapisywaną przy włączonej czarnej skrzynce albo logach fizyki.",
|
||||
@@ -453,6 +464,9 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
||||
["EventHornMissed"] = "W6: BEZ TRĄBIENIA",
|
||||
["EventCab"] = "Kabina {0} w {1}",
|
||||
["EventSecurityBraking"] = "HAMOWANIE PRZEZ {0}",
|
||||
["EventSecurityAlarm"] = "Brzęczyk {0}",
|
||||
["EventSecurityAlarmAcknowledged"] = "Brzęczyk {0}, potwierdzony po {1:0.0} s",
|
||||
["EventSecurityAlarmMissed"] = "Brzęczyk {0}, bez potwierdzenia",
|
||||
["EventTimetable"] = "Rozkład {0}, {1}",
|
||||
["CabSpeed"] = "Prędkość",
|
||||
["CabWheels"] = "koła {0:0}",
|
||||
@@ -558,7 +572,11 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
||||
["FileFilter"] = "Czarna skrzynka"
|
||||
};
|
||||
|
||||
/// <summary>The key of the text of a simulator's command: <see cref="CommandPrefix"/> and its name.</summary>
|
||||
public const string CommandPrefix = "Cmd.";
|
||||
|
||||
private readonly Dictionary<string, string> _texts;
|
||||
private readonly string _languageCode;
|
||||
|
||||
public DefaultBlackBoxStrings() : this(CultureInfo.CurrentUICulture)
|
||||
{
|
||||
@@ -571,11 +589,15 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
|
||||
/// <summary>Polish for "pl", English for any other language.</summary>
|
||||
public DefaultBlackBoxStrings(string languageCode)
|
||||
{
|
||||
_languageCode = languageCode;
|
||||
_texts = languageCode == "pl" ? Polish : English;
|
||||
}
|
||||
|
||||
/// <summary>The keys there are texts for, for a translation to give them all.</summary>
|
||||
public static IEnumerable<string> Keys => English.Keys;
|
||||
|
||||
public string this[string key] => _texts.TryGetValue(key, out var text) ? text : English.GetValueOrDefault(key, key);
|
||||
/// <summary>A key of <see cref="CommandPrefix"/> gives what the command does (<see cref="CommandTexts"/>).</summary>
|
||||
public string this[string key] =>
|
||||
key.StartsWith(CommandPrefix, System.StringComparison.Ordinal) ? CommandTexts.Of(key[CommandPrefix.Length..], _languageCode)
|
||||
: _texts.TryGetValue(key, out var text) ? text : English.GetValueOrDefault(key, key);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Automation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
@@ -106,6 +107,13 @@ public sealed class BlackBoxWindow : Window
|
||||
_play.Click += (_, _) => Playing = !Playing;
|
||||
_speed.ItemsSource = Speeds.Select(s => $"×{s.ToString(CultureInfo.InvariantCulture)}").ToArray();
|
||||
_speed.SelectedIndex = 3;
|
||||
// What a screen reader calls the parts that have no label of their own on the screen.
|
||||
AutomationProperties.SetName(_speed, _strings["PlaySpeed"]);
|
||||
AutomationProperties.SetName(_timeline, _strings["PanelTimeline"]);
|
||||
AutomationProperties.SetName(_timetable, _strings["TabTimetable"]);
|
||||
AutomationProperties.SetName(_cab, _strings["Cab"]);
|
||||
AutomationProperties.SetName(_map, _strings["PanelMap"]);
|
||||
AutomationProperties.SetHelpText(_map, _strings["MapHelp"]);
|
||||
|
||||
var titles = new StackPanel { VerticalAlignment = VerticalAlignment.Center, Children = { _title, _subtitle } };
|
||||
var transport = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, VerticalAlignment = VerticalAlignment.Center, Children = { _play, _clock, _speed, _delayText } };
|
||||
@@ -455,6 +463,7 @@ public sealed class BlackBoxWindow : Window
|
||||
_clock.Text = recording.ClockAt(_time).ToString(@"hh\:mm\:ss", CultureInfo.InvariantCulture);
|
||||
_events.ShowTime(_time);
|
||||
ShowReadout(null);
|
||||
_timeline.Spoken = _readout.Text;
|
||||
ShowDelay(recording);
|
||||
TimeChanged?.Invoke(_time);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Automation.Peers;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Eu07.BlackBox.Views;
|
||||
@@ -37,6 +39,36 @@ public sealed class CabPanel : Control
|
||||
{
|
||||
ClipToBounds = true;
|
||||
Height = 696;
|
||||
// Reached with Tab, where a screen reader reads what the panel shows.
|
||||
Focusable = true;
|
||||
}
|
||||
|
||||
// What the panel showed when last drawn, a line a figure, as a screen reader is told it.
|
||||
private List<string>? _saying;
|
||||
private string? _said;
|
||||
|
||||
/// <summary>What the panel shows, said in words: the figures and the lamps that are lit.</summary>
|
||||
public string? Said => _said;
|
||||
|
||||
private void Say(string text)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
_saying?.Add(text.Trim());
|
||||
}
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() =>
|
||||
new SpokenPeer(this, AutomationControlType.Pane, () => null, () => _said);
|
||||
|
||||
protected override void OnGotFocus(FocusChangedEventArgs e)
|
||||
{
|
||||
base.OnGotFocus(e);
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
protected override void OnLostFocus(FocusChangedEventArgs e)
|
||||
{
|
||||
base.OnLostFocus(e);
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
public IBlackBoxStrings Strings { get; set; } = new DefaultBlackBoxStrings();
|
||||
@@ -63,6 +95,22 @@ public sealed class CabPanel : Control
|
||||
}
|
||||
|
||||
public override void Render(DrawingContext context)
|
||||
{
|
||||
_saying = new List<string>();
|
||||
try
|
||||
{
|
||||
DrawPanel(context);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_said = string.Join(". ", _saying);
|
||||
_saying = null;
|
||||
}
|
||||
if (IsFocused)
|
||||
context.DrawRectangle(null, Palette.FocusPen, new Rect(Bounds.Size).Deflate(1));
|
||||
}
|
||||
|
||||
private void DrawPanel(DrawingContext context)
|
||||
{
|
||||
var size = Bounds.Size;
|
||||
double width = size.Width - 2 * Pad, right = size.Width - Pad;
|
||||
@@ -71,28 +119,62 @@ public sealed class CabPanel : Control
|
||||
if (_recording is not { } recording || recording.CabAt(_time) is not { } s || _time - s.Time > 1.5)
|
||||
{
|
||||
context.DrawText(MapView.Text(Strings["CabNoData"], Palette.DimText, 12), new Point(Pad, 40));
|
||||
Say(Strings["CabNoData"]);
|
||||
return;
|
||||
}
|
||||
Measure(recording);
|
||||
var culture = CultureInfo.CurrentCulture;
|
||||
var extra = s.Extra;
|
||||
|
||||
// The vehicle at the left; who drives, from which cab, at the right.
|
||||
DrawHeader(context, recording.Vehicle(s.Vehicle)?.Name ?? "", s, right);
|
||||
DrawSpeed(context, s, width, right, culture);
|
||||
DrawControls(context, s, width, right, culture);
|
||||
double y = DrawBrakes(context, s, width, right, culture);
|
||||
|
||||
// The traction at the left, as fits what drives the vehicle; the lights of both ends of the train at the right.
|
||||
double half = Pad + width / 2;
|
||||
double driveTop = y + BrakeRow + 4;
|
||||
double top = Section(context, Strings["CabSectionDrive"], Pad, driveTop, half - 10);
|
||||
Section(context, Strings["CabLights"], half + 4, driveTop, right);
|
||||
DrawDrive(context, s, top, half - 10 - Pad, culture);
|
||||
DrawLights(context, s, new Rect(half, top, right - half, 0), culture);
|
||||
|
||||
top = DrawDevices(context, s, new Rect(Pad, top + 3 * DriveRow + 6, width, size.Height), culture);
|
||||
DrawDoors(context, s, top, width, size.Height);
|
||||
}
|
||||
|
||||
private const double BrakeRow = 17;
|
||||
|
||||
/// <summary>The vehicle at the left; who drives, from which cab, at the right.</summary>
|
||||
private void DrawHeader(DrawingContext context, string name, CabSample s, double right)
|
||||
{
|
||||
string? end = s.CabEnd == 0 ? null : Strings[s.CabEnd > 0 ? "CabEndFront" : "CabEndRear"];
|
||||
double chipX = right;
|
||||
if (s.CabEnd != 0)
|
||||
chipX -= ChipLeft(context, Strings[s.CabEnd > 0 ? "CabEndFront" : "CabEndRear"], Palette.Text, chipX, 4) + 5;
|
||||
var (driverText, driverBrush) = !s.InCab ? (Strings["CabOutside"], Palette.DimText)
|
||||
: s.Driving == Driver.Ai ? (Strings["CabDriverAi"], Palette.Autopilot)
|
||||
: (Strings["CabDriverUser"], Palette.UserTrain);
|
||||
if (end is not null)
|
||||
chipX -= ChipLeft(context, end, Palette.Text, chipX, 4) + 5;
|
||||
var (driverText, driverBrush) = DriverChip(s);
|
||||
chipX -= ChipLeft(context, driverText, driverBrush, chipX, 4) + 10;
|
||||
Say(name);
|
||||
Say(driverText);
|
||||
if (end is not null)
|
||||
Say(end);
|
||||
using (context.PushClip(new Rect(Pad, 0, Math.Max(0, chipX - Pad), 28)))
|
||||
context.DrawText(MapView.Text(recording.Vehicle(s.Vehicle)?.Name ?? "", Palette.Text, 12, FontWeight.SemiBold), new Point(Pad, 6));
|
||||
context.DrawText(MapView.Text(name, Palette.Text, 12, FontWeight.SemiBold), new Point(Pad, 6));
|
||||
}
|
||||
|
||||
// The speed, large, what the AI would do under it, the accelerations at the right.
|
||||
var judgement = DrivingSummary.Judge(s);
|
||||
var speed = MapView.Text(s.AbsSpeedKmh.ToString("0", culture), judgement is SpeedJudgement.Over ? Palette.Bad
|
||||
: judgement is SpeedJudgement.Slightly ? Palette.Warn : Palette.Text, 36, FontWeight.SemiBold);
|
||||
private (string Text, IBrush Brush) DriverChip(CabSample s)
|
||||
{
|
||||
if (!s.InCab)
|
||||
return (Strings["CabOutside"], Palette.DimText);
|
||||
return s.Driving == Driver.Ai ? (Strings["CabDriverAi"], Palette.Autopilot) : (Strings["CabDriverUser"], Palette.UserTrain);
|
||||
}
|
||||
|
||||
/// <summary>The speed, large, what the AI would do under it, the accelerations at the right.</summary>
|
||||
private void DrawSpeed(DrawingContext context, CabSample s, double width, double right, CultureInfo culture)
|
||||
{
|
||||
string kmh = s.AbsSpeedKmh.ToString("0", culture);
|
||||
var speed = MapView.Text(kmh, SpeedBrush(DrivingSummary.Judge(s)), 36, FontWeight.SemiBold);
|
||||
context.DrawText(speed, new Point(Pad, 24));
|
||||
Say($"{kmh} km/h");
|
||||
var unit = MapView.Text("km/h", Palette.DimText, 12);
|
||||
context.DrawText(unit, new Point(Pad + speed.Width + 4, 24 + speed.Height - 21));
|
||||
double gaugeX = Pad + Math.Max(150, width * 0.42);
|
||||
@@ -101,75 +183,97 @@ public sealed class CabPanel : Control
|
||||
if (s.WheelSpeedKmh is { } wheels && Math.Abs(wheels - s.SpeedKmh) >= WheelsApartKmh)
|
||||
{
|
||||
double wheelsX = Pad + speed.Width + 4 + unit.Width + 8;
|
||||
string wheelsText = string.Format(culture, Strings["CabWheels"], Math.Abs(wheels));
|
||||
using (context.PushClip(new Rect(wheelsX, 24, Math.Max(0, gaugeX - 8 - wheelsX), 40)))
|
||||
context.DrawText(MapView.Text(string.Format(culture, Strings["CabWheels"], Math.Abs(wheels)), Palette.Warn, 12),
|
||||
new Point(wheelsX, 24 + speed.Height - 21));
|
||||
context.DrawText(MapView.Text(wheelsText, Palette.Warn, 12), new Point(wheelsX, 24 + speed.Height - 21));
|
||||
Say(wheelsText);
|
||||
}
|
||||
if (s.AiValid)
|
||||
{
|
||||
using (context.PushClip(new Rect(Pad, 76, gaugeX - Pad - 8, 40)))
|
||||
{
|
||||
context.DrawText(MapView.Text(string.Format(culture, Strings["CabAiTarget"], s.Ai.TargetKmh), Palette.Target, 12), new Point(Pad, 76));
|
||||
string target = string.Format(culture, Strings["CabAiTarget"], s.Ai.TargetKmh);
|
||||
context.DrawText(MapView.Text(target, Palette.Target, 12), new Point(Pad, 76));
|
||||
Say(target);
|
||||
if (s.Ai.HasNextLimit)
|
||||
context.DrawText(MapView.Text(string.Format(culture, Strings["LimitAt"], s.Ai.NextLimitKmh, s.Ai.NextLimitDistance), Palette.Limit, 11),
|
||||
new Point(Pad, 93));
|
||||
{
|
||||
string limit = string.Format(culture, Strings["LimitAt"], s.Ai.NextLimitKmh, s.Ai.NextLimitDistance);
|
||||
Say(limit);
|
||||
context.DrawText(MapView.Text(limit, Palette.Limit, 11), new Point(Pad, 93));
|
||||
}
|
||||
}
|
||||
}
|
||||
double gaugeWidth = right - gaugeX;
|
||||
Balance(context, Strings["CabAcceleration"], s.Acceleration, 1.5, gaugeX, 34, gaugeWidth);
|
||||
Balance(context, Strings["CabLateral"], s.LateralAcceleration, 1.5, gaugeX, 70, gaugeWidth);
|
||||
}
|
||||
|
||||
// The controllers.
|
||||
private static IBrush SpeedBrush(SpeedJudgement judgement) => judgement switch
|
||||
{
|
||||
SpeedJudgement.Over => Palette.Bad,
|
||||
SpeedJudgement.Slightly => Palette.Warn,
|
||||
_ => Palette.Text
|
||||
};
|
||||
|
||||
/// <summary>The controllers.</summary>
|
||||
private void DrawControls(DrawingContext context, CabSample s, double width, double right, CultureInfo culture)
|
||||
{
|
||||
double top = Section(context, Strings["CabSectionControls"], Pad, 118, right);
|
||||
double column = width / 4;
|
||||
Value(context, Strings["CabController"], s.MainController.ToString(culture), Pad, top);
|
||||
Steps(context, s.MainController, _controllerTop, Pad, top + 34, column - 14);
|
||||
if (extra is { } handle && _integrated.Contains(s.Vehicle))
|
||||
if (s.Extra is { } handle && _integrated.Contains(s.Vehicle))
|
||||
Value(context, Strings["CabIntegrated"], (handle.IntegratedController * 100).ToString("+0;−0;0", culture) + " %", Pad + column, top);
|
||||
else
|
||||
Value(context, Strings["CabShunt"], s.ScndController.ToString(culture), Pad + column, top);
|
||||
Value(context, Strings["CabReverser"], Strings[s.Reverser > 0 ? "CabForward" : s.Reverser < 0 ? "CabBackward" : "CabNeutral"], Pad + 2 * column, top);
|
||||
string reverser = s.Reverser switch { > 0 => "CabForward", < 0 => "CabBackward", _ => "CabNeutral" };
|
||||
Value(context, Strings["CabReverser"], Strings[reverser], Pad + 2 * column, top);
|
||||
Value(context, Strings["CabTrainBrake"], s.TrainBrake.ToString("0.0", culture), Pad + 3 * column, top);
|
||||
}
|
||||
|
||||
// The brakes, as gauges, the setting (G, P, R) at the right of the title.
|
||||
/// <summary>The brakes, as gauges, the setting (G, P, R) at the right of the title.</summary>
|
||||
/// <returns>Where the last gauge stands.</returns>
|
||||
private double DrawBrakes(DrawingContext context, CabSample s, double width, double right, CultureInfo culture)
|
||||
{
|
||||
var extra = s.Extra;
|
||||
string? setting = extra is { } e && (e.BrakeDelay | e.BrakeMode) != 0
|
||||
? string.Format(culture, Strings["CabBrakeSetting"], string.Join(" · ", new[] { BrakeSetting(e.BrakeDelay), BrakeMode(e.BrakeMode) }.Where(t => t.Length > 0)))
|
||||
: null;
|
||||
top = Section(context, Strings["CabSectionBrakes"], Pad, 180, right, setting);
|
||||
const double gauge = 17;
|
||||
Gauge(context, Strings["CabPipe"], s.BrakePipe, 6, 5, $"{s.BrakePipe:0.00} bar", Palette.Station, Pad, top, width);
|
||||
double y = top + gauge;
|
||||
if (extra is { } x1)
|
||||
double y = Section(context, Strings["CabSectionBrakes"], Pad, 180, right, setting);
|
||||
var gauges = new List<GaugeReading>
|
||||
{
|
||||
// what the driver's brake valve shows: its equalizing reservoir, the FV4a's time reservoir
|
||||
Gauge(context, Strings["CabDriverValve"], x1.DriverValve, 6, null, $"{x1.DriverValve:0.00} bar", Palette.Target, Pad, y, width);
|
||||
y += gauge;
|
||||
}
|
||||
Gauge(context, Strings["CabCylinder"], s.BrakeCylinder, 6, null, $"{s.BrakeCylinder:0.0} bar", Palette.Brakes, Pad, y, width);
|
||||
y += gauge;
|
||||
if (extra is { } x3)
|
||||
{
|
||||
// the most braked vehicle of the train
|
||||
Gauge(context, Strings["CabConsistCylinder"], x3.ConsistBrakeCylinder, 6, null, $"{x3.ConsistBrakeCylinder:0.0} bar", Palette.Brakes, Pad, y, width);
|
||||
y += gauge;
|
||||
}
|
||||
Gauge(context, Strings["CabReservoir"], s.MainReservoir, 10, null, $"{s.MainReservoir:0.0} bar", Palette.Controller, Pad, y, width);
|
||||
y += gauge;
|
||||
if (extra is { } x2)
|
||||
{
|
||||
bool has = _feedPipe.Contains(s.Vehicle);
|
||||
Gauge(context, Strings["CabFeedPipe"], has ? x2.FeedPipe : 0, 10, null, has ? $"{x2.FeedPipe:0.0} bar" : "—", Palette.Controller, Pad, y, width);
|
||||
y += gauge;
|
||||
}
|
||||
Gauge(context, Strings["CabLocalBrake"], s.LocalBrake, 1, null, $"{s.LocalBrake * 100:0} %", Palette.Brakes, Pad, y, width);
|
||||
new(Strings["CabPipe"], s.BrakePipe, 6, 5, $"{s.BrakePipe:0.00} bar", Palette.Station)
|
||||
};
|
||||
// what the driver's brake valve shows: its equalizing reservoir, the FV4a's time reservoir
|
||||
if (extra is { } valve)
|
||||
gauges.Add(new(Strings["CabDriverValve"], valve.DriverValve, 6, null, $"{valve.DriverValve:0.00} bar", Palette.Target));
|
||||
gauges.Add(new(Strings["CabCylinder"], s.BrakeCylinder, 6, null, $"{s.BrakeCylinder:0.0} bar", Palette.Brakes));
|
||||
// the most braked vehicle of the train
|
||||
if (extra is { } most)
|
||||
gauges.Add(new(Strings["CabConsistCylinder"], most.ConsistBrakeCylinder, 6, null, $"{most.ConsistBrakeCylinder:0.0} bar", Palette.Brakes));
|
||||
gauges.Add(new(Strings["CabReservoir"], s.MainReservoir, 10, null, $"{s.MainReservoir:0.0} bar", Palette.Controller));
|
||||
if (extra is { } feed)
|
||||
gauges.Add(FeedPipe(s, feed));
|
||||
gauges.Add(new(Strings["CabLocalBrake"], s.LocalBrake, 1, null, $"{s.LocalBrake * 100:0} %", Palette.Brakes));
|
||||
|
||||
// The traction at the left, as fits what drives the vehicle; the lights of both ends of the train at the right.
|
||||
double half = Pad + width / 2;
|
||||
double driveTop = y + gauge + 4;
|
||||
top = Section(context, Strings["CabSectionDrive"], Pad, driveTop, half - 10);
|
||||
Section(context, Strings["CabLights"], half + 4, driveTop, right);
|
||||
DrawDrive(context, s, top, half - 10 - Pad, culture);
|
||||
double row = top;
|
||||
for (int i = 0; i < gauges.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
y += BrakeRow;
|
||||
Gauge(context, gauges[i], Pad, y, width);
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
private GaugeReading FeedPipe(CabSample s, CabExtra feed) => _feedPipe.Contains(s.Vehicle)
|
||||
? new(Strings["CabFeedPipe"], feed.FeedPipe, 10, null, $"{feed.FeedPipe:0.0} bar", Palette.Controller)
|
||||
: new(Strings["CabFeedPipe"], 0, 10, null, "—", Palette.Controller);
|
||||
|
||||
/// <summary>The lights of both ends: the signal shown, green as it is to be, red otherwise with the one it is to show.</summary>
|
||||
/// <param name="area">Left edge, top and width of the column; its height is not used.</param>
|
||||
private void DrawLights(DrawingContext context, CabSample s, Rect area, CultureInfo culture)
|
||||
{
|
||||
double half = area.X, right = area.Right, row = area.Y;
|
||||
foreach (var (key, lights, equipped, required, isRight) in new[]
|
||||
{
|
||||
("CabLightsHead", s.LightsHead, s.EquippedHead, HeadCodes.RequiredHead(s), HeadCodes.HeadRight(s)),
|
||||
@@ -177,14 +281,9 @@ public sealed class CabPanel : Control
|
||||
})
|
||||
{
|
||||
DrawFace(context, lights, new Point(half + 4 + 17, row + 15));
|
||||
// the end, and under it the signal it shows: green as it is to be (with the lamps the vehicle has),
|
||||
// red otherwise with the one it is to show
|
||||
var shown = HeadCodes.Of(lights);
|
||||
var text = HeadCodes.NoLamps(equipped) ? Strings["CabLightsNone"]
|
||||
: isRight == false && required is { } want
|
||||
? string.Format(culture, Strings["CabLightsWant"], HeadCodes.Name(shown), HeadCodes.Name(want))
|
||||
: isRight == true && required is { } met ? HeadCodes.Name(met) : HeadCodes.Name(shown);
|
||||
var brush = isRight is null ? Palette.DimText : isRight.Value ? Palette.Good : Palette.Bad;
|
||||
string text = LightsText(HeadCodes.Of(lights), HeadCodes.NoLamps(equipped), required, isRight, culture);
|
||||
IBrush brush = isRight switch { null => Palette.DimText, true => Palette.Good, false => Palette.Bad };
|
||||
Say($"{Strings[key]}: {text}");
|
||||
using (context.PushClip(new Rect(half + 44, row, right - half - 44, 28)))
|
||||
{
|
||||
context.DrawText(MapView.Text(Strings[key], Palette.DimText, 10), new Point(half + 46, row));
|
||||
@@ -192,9 +291,24 @@ public sealed class CabPanel : Control
|
||||
}
|
||||
row += 27;
|
||||
}
|
||||
}
|
||||
|
||||
// The devices, in three groups side by side: lit as their lamps are in the cab, the ones off faint.
|
||||
top = Section(context, Strings["CabSectionDevices"], Pad, top + 3 * DriveRow + 6, right);
|
||||
private string LightsText(HeadCode shown, bool noLamps, HeadCode? required, bool? isRight, CultureInfo culture)
|
||||
{
|
||||
if (noLamps)
|
||||
return Strings["CabLightsNone"];
|
||||
if (isRight == false && required is { } want)
|
||||
return string.Format(culture, Strings["CabLightsWant"], HeadCodes.Name(shown), HeadCodes.Name(want));
|
||||
return isRight == true && required is { } met ? HeadCodes.Name(met) : HeadCodes.Name(shown);
|
||||
}
|
||||
|
||||
/// <summary>The devices, in three groups side by side: lit as their lamps are in the cab, the ones off faint.</summary>
|
||||
/// <param name="area">Left edge, top, width and the height of the whole panel.</param>
|
||||
/// <returns>Where the doors go, under them.</returns>
|
||||
private double DrawDevices(DrawingContext context, CabSample s, Rect area, CultureInfo culture)
|
||||
{
|
||||
double width = area.Width, height = area.Height;
|
||||
double top = Section(context, Strings["CabSectionDevices"], area.X, area.Y, area.X + width);
|
||||
var groups = Devices(s, culture);
|
||||
var widths = new double[groups.Length];
|
||||
for (int g = 0; g < groups.Length; g++)
|
||||
@@ -205,33 +319,42 @@ public sealed class CabPanel : Control
|
||||
}
|
||||
// each group as wide as its longest name, what is left shared between them
|
||||
double spare = (width - widths.Sum()) / groups.Length;
|
||||
double x = Pad, bottom = top;
|
||||
double x = area.X, bottom = top;
|
||||
for (int g = 0; g < groups.Length; g++)
|
||||
{
|
||||
double groupWidth = Math.Max(20, widths[g] + spare);
|
||||
using (context.PushClip(new Rect(x, top, groupWidth, size.Height - top)))
|
||||
{
|
||||
context.DrawText(MapView.Text(Strings[groups[g].Title], Palette.DimText, 10, FontWeight.SemiBold), new Point(x, top));
|
||||
double lampY = top + 16;
|
||||
foreach (var (text, brush) in groups[g].Lamps)
|
||||
{
|
||||
Lamp(context, text, brush, x, lampY);
|
||||
lampY += LampRow;
|
||||
}
|
||||
bottom = Math.Max(bottom, lampY);
|
||||
}
|
||||
using (context.PushClip(new Rect(x, top, groupWidth, height - top)))
|
||||
bottom = Math.Max(bottom, DrawGroup(context, groups[g], x, top));
|
||||
x += groupWidth;
|
||||
}
|
||||
return Math.Max(bottom, top + 16 + 9 * LampRow) + 6;
|
||||
}
|
||||
|
||||
// The doors under them, in two columns: open, permitted, the departure signal, the steps and the lock.
|
||||
top = Math.Max(bottom, top + 16 + 9 * LampRow) + 6;
|
||||
/// <returns>Where the group ends.</returns>
|
||||
private double DrawGroup(DrawingContext context, (string Title, (string Text, IBrush? Lit)[] Lamps) group, double x, double top)
|
||||
{
|
||||
context.DrawText(MapView.Text(Strings[group.Title], Palette.DimText, 10, FontWeight.SemiBold), new Point(x, top));
|
||||
Say(Strings[group.Title]);
|
||||
double lampY = top + 16;
|
||||
foreach (var (text, brush) in group.Lamps)
|
||||
{
|
||||
Lamp(context, text, brush, x, lampY);
|
||||
lampY += LampRow;
|
||||
}
|
||||
return lampY;
|
||||
}
|
||||
|
||||
/// <summary>The doors, in two columns: open, permitted, the departure signal, the steps and the lock.</summary>
|
||||
private void DrawDoors(DrawingContext context, CabSample s, double top, double width, double height)
|
||||
{
|
||||
context.DrawText(MapView.Text(Strings["CabGroupDoors"], Palette.DimText, 10, FontWeight.SemiBold), new Point(Pad, top));
|
||||
Say(Strings["CabGroupDoors"]);
|
||||
var doors = Doors(s.AsTheCabSees);
|
||||
double doorColumn = width / DoorColumns;
|
||||
for (int i = 0; i < doors.Length; i++)
|
||||
{
|
||||
double doorX = Pad + i % DoorColumns * doorColumn;
|
||||
using (context.PushClip(new Rect(doorX, top, doorColumn, size.Height - top)))
|
||||
using (context.PushClip(new Rect(doorX, top, doorColumn, height - top)))
|
||||
Lamp(context, doors[i].Text, doors[i].Lit, doorX, top + 16 + i / DoorColumns * LampRow);
|
||||
}
|
||||
}
|
||||
@@ -290,6 +413,7 @@ public sealed class CabPanel : Control
|
||||
break;
|
||||
default:
|
||||
context.DrawText(MapView.Text(Strings["CabNoDrive"], Palette.DimText, 11), new Point(Pad, top + 2));
|
||||
Say(Strings["CabNoDrive"]);
|
||||
return;
|
||||
}
|
||||
double column = width / 2;
|
||||
@@ -332,8 +456,9 @@ public sealed class CabPanel : Control
|
||||
}
|
||||
|
||||
/// <summary>The title of a part of the panel, with a line from it to the right (and a note at its end); the top of the part returned.</summary>
|
||||
private static double Section(DrawingContext context, string title, double x, double y, double right, string? note = null)
|
||||
private double Section(DrawingContext context, string title, double x, double y, double right, string? note = null)
|
||||
{
|
||||
Say(note is null ? title : $"{title}, {note}");
|
||||
var text = MapView.Text(title.ToUpper(CultureInfo.CurrentCulture), Palette.DimText, 9, FontWeight.SemiBold);
|
||||
context.DrawText(text, new Point(x, y));
|
||||
double end = right;
|
||||
@@ -381,8 +506,9 @@ public sealed class CabPanel : Control
|
||||
_measured = recording.Revision;
|
||||
}
|
||||
|
||||
private static void Value(DrawingContext context, string label, string value, double x, double y, IBrush? brush = null)
|
||||
private void Value(DrawingContext context, string label, string value, double x, double y, IBrush? brush = null)
|
||||
{
|
||||
Say($"{label}: {value}");
|
||||
context.DrawText(MapView.Text(label, Palette.DimText, 10), new Point(x, y));
|
||||
context.DrawText(MapView.Text(value, brush ?? Palette.Text, 14, FontWeight.SemiBold), new Point(x, y + 13));
|
||||
}
|
||||
@@ -398,9 +524,10 @@ public sealed class CabPanel : Control
|
||||
}
|
||||
|
||||
/// <summary>A gauge: its name, a bar up to the value against the scale, a mark where it should stand, the value.</summary>
|
||||
private static void Gauge(DrawingContext context, string label, float value, double scale, double? mark, string text,
|
||||
IBrush brush, double x, double y, double width)
|
||||
private void Gauge(DrawingContext context, GaugeReading reading, double x, double y, double width)
|
||||
{
|
||||
var (label, value, scale, mark, text, brush) = reading;
|
||||
Say($"{label}: {text}");
|
||||
const double labelWidth = 118, valueWidth = 64;
|
||||
context.DrawText(MapView.Text(label, Palette.DimText, 11), new Point(x, y));
|
||||
double barX = x + labelWidth, barWidth = width - labelWidth - valueWidth;
|
||||
@@ -419,9 +546,10 @@ public sealed class CabPanel : Control
|
||||
}
|
||||
|
||||
/// <summary>A value either way of nought: a bar from the middle, to the right above it.</summary>
|
||||
private static void Balance(DrawingContext context, string label, float value, double scale, double x, double y, double width)
|
||||
private void Balance(DrawingContext context, string label, float value, double scale, double x, double y, double width)
|
||||
{
|
||||
var culture = CultureInfo.CurrentCulture;
|
||||
Say($"{label}: {value.ToString("+0.00;−0.00;0.00", culture)} m/s²");
|
||||
context.DrawText(MapView.Text(label, Palette.DimText, 10), new Point(x, y));
|
||||
var v = MapView.Text($"{value.ToString("+0.00;−0.00;0.00", culture)} m/s²", Palette.Text, 11, FontWeight.SemiBold);
|
||||
context.DrawText(v, new Point(x + width - v.Width, y));
|
||||
@@ -466,8 +594,11 @@ public sealed class CabPanel : Control
|
||||
}
|
||||
|
||||
/// <summary>A device's lamp and its name: lit in its colour, the name bright; off, both faint.</summary>
|
||||
private static void Lamp(DrawingContext context, string text, IBrush? lit, double x, double y)
|
||||
private void Lamp(DrawingContext context, string text, IBrush? lit, double x, double y)
|
||||
{
|
||||
// Only the lamps that are lit are told: the dark ones are the panel, not the moment.
|
||||
if (lit is not null)
|
||||
Say(text);
|
||||
var center = new Point(x + 4, y + 7);
|
||||
if (lit is not null)
|
||||
context.DrawEllipse(Palette.Faded(lit, 0.3), null, center, 6, 6);
|
||||
@@ -541,12 +672,12 @@ public sealed class CabPanel : Control
|
||||
if (s.Security != SecurityFlags.None || s.CabEnd != 0)
|
||||
{
|
||||
// A recording which tells them apart.
|
||||
safety.Add((Strings["DevVigilance"], Security(SecurityFlags.VigilanceBeeping, Palette.LampAlarm) ?? Security(SecurityFlags.Vigilance, Palette.Vigilance)));
|
||||
safety.Add((Strings["DevCabSignal"], Security(SecurityFlags.CabSignalBeeping, Palette.LampAlarm) ?? Security(SecurityFlags.CabSignal, Palette.CabSignal)));
|
||||
safety.Add((Strings["DevSecurityBraking"], Security(SecurityFlags.Braking, Palette.LampAlarm)));
|
||||
safety.Add((Strings["DevVigilance"], s.VigilanceBuzzer ? Palette.Buzzer : Security(SecurityFlags.Vigilance, Palette.Vigilance)));
|
||||
safety.Add((Strings["DevCabSignal"], s.CabSignalBuzzer ? Palette.Buzzer : Security(SecurityFlags.CabSignal, Palette.CabSignal)));
|
||||
safety.Add((Strings["DevSecurityBraking"], s.ProtectionBraking ? Palette.LampAlarm : null));
|
||||
}
|
||||
else
|
||||
safety.Add((Strings["DevAlerter"], (s.Flags & CabFlags.AlerterBeeping) != 0 ? Palette.LampAlarm
|
||||
safety.Add((Strings["DevAlerter"], (s.Flags & CabFlags.AlerterBeeping) != 0 ? Palette.Buzzer
|
||||
: (s.Flags & CabFlags.AlerterBlinking) != 0 ? Palette.LampWarning : null));
|
||||
safety.Add(Flag("DevWheelSlip", CabFlags.WheelSlip, Palette.LampAlarm));
|
||||
safety.Add(On("DevOverloadRelay", CabDevices.OverloadRelay, Palette.LampAlarm));
|
||||
@@ -575,4 +706,7 @@ public sealed class CabPanel : Control
|
||||
doors.Add(On("DevDepartureSignal", CabDevices.DepartureSignal, Palette.LampWarning));
|
||||
return doors.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>What one gauge shows: its name, the value against the scale, the mark, the value written out.</summary>
|
||||
private readonly record struct GaugeReading(string Label, float Value, double Scale, double? Mark, string Text, IBrush Brush);
|
||||
}
|
||||
|
||||
378
Eu07.BlackBox.Views/CommandTexts.cs
Normal file
378
Eu07.BlackBox.Views/CommandTexts.cs
Normal file
@@ -0,0 +1,378 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Eu07.BlackBox.Views;
|
||||
|
||||
/// <summary>
|
||||
/// What the simulator's commands of a vehicle do, as the black box names them (input/command.cpp): Polish
|
||||
/// and English. Those with a key carry the texts of the key file (eu07_input-keyboard.ini) and of the starter's
|
||||
/// English; the rest, worked by the mouse in the cab or by scripts, are written here.
|
||||
/// </summary>
|
||||
public static class CommandTexts
|
||||
{
|
||||
private static readonly Dictionary<string, (string Polish, string English)> Texts = new()
|
||||
{
|
||||
["aidriverenable"] = ("Aktywacja automechanika", "Engage the AI driver"),
|
||||
["aidriverdisable"] = ("Dezaktywacja automechanika", "Disengage the AI driver"),
|
||||
["jointcontrollerset"] = ("Ustawienie nastawnika zespolonego", "Set the combined controller"),
|
||||
["mastercontrollerincrease"] = ("Zwiększenie nastawnika głównego", "Master controller up"),
|
||||
["mastercontrollerincreasefast"] = ("Szybkie zwiększenie nastawnika głównego", "Master controller up, fast"),
|
||||
["mastercontrollerdecrease"] = ("Zmniejszenie nastawnika głównego", "Master controller down"),
|
||||
["mastercontrollerdecreasefast"] = ("Szybkie zmniejszenie nastawnika głównego", "Master controller down, fast"),
|
||||
["mastercontrollerset"] = ("Ustawienie nastawnika głównego", "Set the master controller"),
|
||||
["dynamicbrakecontrollerincrease"] = ("Zwiększenie nastawy hamulca elektrodynamicznego", "Increase the dynamic brake"),
|
||||
["dynamicbrakecontrollerdecrease"] = ("Zmniejszenie nastawy hamulca elektrodynamicznego", "Decrease the dynamic brake"),
|
||||
["dynamicbrakecontrollerset"] = ("Ustawienie hamulca elektrodynamicznego", "Set the dynamic brake"),
|
||||
["dynamicbrakecontrollerincreasefast"] = ("Szybkie zwiększenie nastawy hamulca elektrodynamicznego", "Increase the dynamic brake fast"),
|
||||
["dynamicbrakecontrollerdecreasefast"] = ("Szybkie zmniejszenie nastawy hamulca elektrodynamicznego", "Decrease the dynamic brake fast"),
|
||||
["secondcontrollerincrease"] = ("Zwiększenie nastawnika boczników", "Shunt controller up"),
|
||||
["secondcontrollerincreasefast"] = ("Szybkie zwiększenie nastawnika boczników", "Shunt controller up, fast"),
|
||||
["secondcontrollerdecrease"] = ("Zmniejszenie nastawnika boczników", "Shunt controller down"),
|
||||
["secondcontrollerdecreasefast"] = ("Szybkie zmniejszenie nastawnika boczników", "Shunt controller down, fast"),
|
||||
["secondcontrollerset"] = ("Ustawienie nastawnika boczników", "Set the shunt controller"),
|
||||
["mucurrentindicatorothersourceactivate"] = ("Zmiana członu dla wskaźnika prądu", "Switch the current gauge to the other unit"),
|
||||
["independentbrakeincrease"] = ("Zwiększenie nastawy hamulca lokomotywy", "Apply more locomotive brake"),
|
||||
["independentbrakeincreasefast"] = ("Szybkie zwiększenie nastawy hamulca lokomotywy", "Apply more locomotive brake, fast"),
|
||||
["independentbrakedecrease"] = ("Zmniejszenie nastawy hamulca lokomotywy", "Release locomotive brake"),
|
||||
["independentbrakedecreasefast"] = ("Szybkie zmniejszenie nastawy hamulca lokomotywy", "Release locomotive brake, fast"),
|
||||
["independentbrakeset"] = ("Ustawienie hamulca lokomotywy", "Set the locomotive brake"),
|
||||
["independentbrakebailoff"] = ("Odluźniacz", "Bail off the locomotive brake"),
|
||||
["universalbrakebutton1"] = ("Aktywacja zdefiniowanych elementów hamulca zespolonego nr 1", "Universal brake button 1"),
|
||||
["universalbrakebutton2"] = ("Aktywacja zdefiniowanych elementów hamulca zespolonego nr 2", "Universal brake button 2"),
|
||||
["universalbrakebutton3"] = ("Aktywacja zdefiniowanych elementów hamulca zespolonego nr 3", "Universal brake button 3"),
|
||||
["trainbrakeincrease"] = ("Zwiększenie stopnia hamowania zaworu maszynisty", "Train brake valve: more braking"),
|
||||
["trainbrakedecrease"] = ("Zmniejszenie stopnia hamowania zaworu maszynisty", "Train brake valve: less braking"),
|
||||
["trainbrakeset"] = ("Ustawienie hamulca zespolonego", "Set the train brake"),
|
||||
["trainbrakecharging"] = ("Napełnianie uderzeniowe przewodu głównego", "Train brake valve: overcharge the brake pipe"),
|
||||
["trainbrakerelease"] = ("Ustawienie zaworu maszynisty w pozycji jazdy", "Train brake valve: running position"),
|
||||
["trainbrakefirstservice"] = ("Pozycja pierwszego stopnia hamowania", "Train brake valve: first braking step"),
|
||||
["trainbrakeservice"] = ("Pozycja hamowania służbowego", "Train brake valve: service braking"),
|
||||
["trainbrakefullservice"] = ("Pozycja hamowania pełnego", "Train brake valve: full service"),
|
||||
["trainbrakehandleoff"] = ("Pozycja odcięcia", "Train brake valve: lap position"),
|
||||
["trainbrakeemergency"] = ("Hamowanie nagłe", "Emergency braking"),
|
||||
["trainbrakebasepressureincrease"] = ("Zwiększenie poziomu ciśnienia w przewodzie głównym", "Raise the brake pipe pressure level"),
|
||||
["trainbrakebasepressuredecrease"] = ("Zmniejszenie poziomu ciśnienia w przewodzie głównym", "Lower the brake pipe pressure level"),
|
||||
["trainbrakebasepressurereset"] = ("Domyślny poziom ciśnienia w przewodzie głównym", "Default brake pipe pressure level"),
|
||||
["trainbrakeoperationtoggle"] = ("Przełączenie stanu hamulca pojazdu", "Toggle the vehicle's brake"),
|
||||
["manualbrakeincrease"] = ("Zwiększenie nastawy hamulca ręcznego", "Apply more hand brake"),
|
||||
["manualbrakedecrease"] = ("Zmniejszenie nastawy hamulca ręcznego", "Release hand brake"),
|
||||
["alarmchaintoggle"] = ("Przełączenie stanu hamulca bezpieczeństwa", "Toggle the emergency brake"),
|
||||
["alarmchainenable"] = ("Pociągnięcie hamulca bezpieczeństwa", "Pull the alarm chain"),
|
||||
["alarmchaindisable"] = ("Zwolnienie hamulca bezpieczeństwa", "Release the alarm chain"),
|
||||
["wheelspinbrakeactivate"] = ("Aktywacja podhamowania przeciwpoślizgowego", "Anti-slip brake"),
|
||||
["sandboxactivate"] = ("Aktywacja piasecznicy", "Sander"),
|
||||
["autosandboxtoggle"] = ("Przełączenie automatycznej piasecznicy", "Toggle the automatic sander"),
|
||||
["autosandboxactivate"] = ("Włączenie automatycznej piasecznicy", "Turn the automatic sander on"),
|
||||
["autosandboxdeactivate"] = ("Wyłączenie automatycznej piasecznicy", "Turn the automatic sander off"),
|
||||
["reverserincrease"] = ("Zwiększenie pozycji nastawnika kierunku", "Reverser up"),
|
||||
["reverserdecrease"] = ("Zmniejszenie pozycji nastawnika kierunku", "Reverser down"),
|
||||
["reverserforwardhigh"] = ("Pozycja jazdy do przodu II nastawnika kierunku", "Reverser: forward II"),
|
||||
["reverserforward"] = ("Pozycja jazdy do przodu nastawnika kierunku", "Reverser: forward"),
|
||||
["reverserneutral"] = ("Pozycja neutralna nastawnika kierunku", "Reverser: neutral"),
|
||||
["reverserbackward"] = ("Pozycja jazdy do tyłu nastawnika kierunku", "Reverser: backward"),
|
||||
["waterpumpbreakertoggle"] = ("Przełączenie stanu wyłącznika samoczynnego pompy wody", "Toggle the water pump circuit breaker"),
|
||||
["waterpumpbreakerclose"] = ("Załączenie wyłącznika pompy wody", "Close the water pump breaker"),
|
||||
["waterpumpbreakeropen"] = ("Wyłączenie wyłącznika pompy wody", "Open the water pump breaker"),
|
||||
["waterpumptoggle"] = ("Przełączenie stanu pompy wody", "Toggle the water pump"),
|
||||
["waterpumpenable"] = ("Włączenie pompy wody", "Turn the water pump on"),
|
||||
["waterpumpdisable"] = ("Wyłączenie pompy wody", "Turn the water pump off"),
|
||||
["waterheaterbreakertoggle"] = ("Przełączenie stanu wyłącznika samoczynnego podgrzewacza wody", "Toggle the water heater circuit breaker"),
|
||||
["waterheaterbreakerclose"] = ("Załączenie wyłącznika podgrzewacza wody", "Close the water heater breaker"),
|
||||
["waterheaterbreakeropen"] = ("Wyłączenie wyłącznika podgrzewacza wody", "Open the water heater breaker"),
|
||||
["waterheatertoggle"] = ("Przełączenie stanu podgrzewacza wody", "Toggle the water heater"),
|
||||
["waterheaterenable"] = ("Włączenie podgrzewacza wody", "Turn the water heater on"),
|
||||
["waterheaterdisable"] = ("Wyłączenie podgrzewacza wody", "Turn the water heater off"),
|
||||
["watercircuitslinktoggle"] = ("Przełączenie stanu połączenia obiegów wody", "Toggle the link between the water circuits"),
|
||||
["watercircuitslinkenable"] = ("Połączenie obiegów wody", "Link the water circuits"),
|
||||
["watercircuitslinkdisable"] = ("Rozłączenie obiegów wody", "Unlink the water circuits"),
|
||||
["fuelpumptoggle"] = ("Przełączenie stanu pompy paliwa", "Toggle the fuel pump"),
|
||||
["fuelpumpenable"] = ("Włączenie pompy paliwa", "Turn the fuel pump on"),
|
||||
["fuelpumpdisable"] = ("Wyłączenie pompy paliwa", "Turn the fuel pump off"),
|
||||
["oilpumptoggle"] = ("Przełączenie stanu pompy oleju", "Toggle the oil pump"),
|
||||
["oilpumpenable"] = ("Włączenie pompy oleju", "Turn the oil pump on"),
|
||||
["oilpumpdisable"] = ("Wyłączenie pompy oleju", "Turn the oil pump off"),
|
||||
["linebreakertoggle"] = ("Przełączenie stanu wyłącznika szybkiego", "Toggle the line breaker"),
|
||||
["linebreakeropen"] = ("Wyłączenie wyłącznika szybkiego", "Open the line breaker"),
|
||||
["linebreakerclose"] = ("Załączenie wyłącznika szybkiego", "Close the line breaker"),
|
||||
["convertertoggle"] = ("Przełączenie stanu przetwornicy", "Toggle the converter"),
|
||||
["converterenable"] = ("Włączenie przetwornicy", "Turn the converter on"),
|
||||
["converterdisable"] = ("Wyłączenie przetwornicy", "Turn the converter off"),
|
||||
["convertertogglelocal"] = ("Przełączenie stanu przetwornicy w obsadzonym członie", "Toggle the converter in the occupied unit"),
|
||||
["converteroverloadrelayreset"] = ("Odblokowanie przekaźnika nadmiarowego przetwornicy", "Reset the converter overload relay"),
|
||||
["compressortoggle"] = ("Przełączenie stanu sprężarki", "Toggle the compressor"),
|
||||
["compressorenable"] = ("Włączenie sprężarki", "Turn the compressor on"),
|
||||
["compressordisable"] = ("Wyłączenie sprężarki", "Turn the compressor off"),
|
||||
["compressortogglelocal"] = ("Przełączenie stanu sprężarki w obsadzonym członie", "Toggle the compressor in the occupied unit"),
|
||||
["compressorpresetactivatenext"] = ("Następny tryb pracy sprężarek", "Next compressor mode"),
|
||||
["compressorpresetactivateprevious"] = ("Poprzedni tryb pracy sprężarek", "Previous compressor mode"),
|
||||
["compressorpresetactivatedefault"] = ("Domyślny tryb pracy sprężarek", "Default compressor mode"),
|
||||
["motoroverloadrelaythresholdtoggle"] = ("Przełączenie rozruchu niskiego/wysokiego", "Switch between low and high starting current"),
|
||||
["motoroverloadrelaythresholdsetlow"] = ("Niski próg przekaźnika nadmiarowego silników", "Motor overload relay threshold low"),
|
||||
["motoroverloadrelaythresholdsethigh"] = ("Wysoki próg przekaźnika nadmiarowego silników", "Motor overload relay threshold high"),
|
||||
["motoroverloadrelayreset"] = ("Odblokowanie przekaźnika nadmiarowego silników", "Reset the traction motor overload relay"),
|
||||
["universalrelayreset1"] = ("Odblokowanie zdefiniowanych przekaźników nr 1", "Reset the defined relays, set 1"),
|
||||
["universalrelayreset2"] = ("Odblokowanie zdefiniowanych przekaźników nr 2", "Reset the defined relays, set 2"),
|
||||
["universalrelayreset3"] = ("Odblokowanie zdefiniowanych przekaźników nr 3", "Reset the defined relays, set 3"),
|
||||
["notchingrelaytoggle"] = ("Przełączenie stanu przekaźnika samoczynnego rozruchu", "Toggle the automatic notching relay"),
|
||||
["epbrakecontroltoggle"] = ("Przełączenie stanu hamulca elektropneumatycznego", "Toggle the electro-pneumatic brake"),
|
||||
["epbrakecontrolenable"] = ("Włączenie hamulca elektropneumatycznego", "Turn the electro-pneumatic brake on"),
|
||||
["epbrakecontroldisable"] = ("Wyłączenie hamulca elektropneumatycznego", "Turn the electro-pneumatic brake off"),
|
||||
["trainbrakeoperationmodeincrease"] = ("Zmiana trybu pracy hamulca na bardziej efektywny", "Brake operation mode: more effective"),
|
||||
["trainbrakeoperationmodedecrease"] = ("Zmiana trybu pracy hamulca na prostszy", "Brake operation mode: simpler"),
|
||||
["brakeactingspeedincrease"] = ("Wybór szybszego trybu działania hamulca pociągu", "Faster train brake acting speed"),
|
||||
["brakeactingspeeddecrease"] = ("Wybór wolniejszego trybu działania hamulca pociągu", "Slower train brake acting speed"),
|
||||
["brakeactingspeedsetcargo"] = ("Wybór trybu hamulca dla pociągu towarowego", "Brake acting speed for a freight train"),
|
||||
["brakeactingspeedsetpassenger"] = ("Wybór trybu hamulca dla pociągu osobowego", "Brake acting speed for a passenger train"),
|
||||
["brakeactingspeedsetrapid"] = ("Wybór trybu hamulca dla pociągu pospiesznego", "Brake acting speed for an express train"),
|
||||
["brakeloadcompensationincrease"] = ("Wybór wyższego przełożenia hamulca", "Higher brake load setting"),
|
||||
["brakeloadcompensationdecrease"] = ("Wybór niższego przełożenia hamulca", "Lower brake load setting"),
|
||||
["mubrakingindicatortoggle"] = ("Przełączenie stanu wskaźnika hamowania członów EZT", "Toggle the EMU unit braking indicator"),
|
||||
["alerteracknowledge"] = ("Wygaszenie czuwaka i SHP", "Acknowledge the vigilance device and cab signalling"),
|
||||
["cabsignalacknowledge"] = ("Wygaszenie SHP", "Acknowledge the cab signalling"),
|
||||
["hornlowactivate"] = ("Aktywacja syreny niskotonowej", "Low-tone horn"),
|
||||
["hornhighactivate"] = ("Aktywacja syreny wysokotonowej", "High-tone horn"),
|
||||
["whistleactivate"] = ("Aktywacja gwizdka", "Whistle"),
|
||||
["radiotoggle"] = ("Przełączenie stanu radiotelefonu", "Toggle the radio"),
|
||||
["radioenable"] = ("Włączenie radiotelefonu", "Turn the radio on"),
|
||||
["radiodisable"] = ("Wyłączenie radiotelefonu", "Turn the radio off"),
|
||||
["radiochannelincrease"] = ("Wybór kolejnego kanału radia", "Next radio channel"),
|
||||
["radiochanneldecrease"] = ("Wybór poprzedniego kanału radia", "Previous radio channel"),
|
||||
["radiochannelset"] = ("Ustawienie kanału radiotelefonu", "Set the radio channel"),
|
||||
["radiostopsend"] = ("Emisja radiostopu", "Send radio-stop"),
|
||||
["radiostopenable"] = ("Włączenie sygnału Radio-Stop", "Send Radio-Stop"),
|
||||
["radiostopdisable"] = ("Wyłączenie sygnału Radio-Stop", "Stop sending Radio-Stop"),
|
||||
["radiostoptest"] = ("Lokalny test radiostopu", "Local radio-stop test"),
|
||||
["radiocall1send"] = ("Wywołanie radiowe 1", "Radio call 1"),
|
||||
["radiocall3send"] = ("Emisja sygnału zew3", "Send the call-3 signal"),
|
||||
["radiovolumeincrease"] = ("Zwiększenie głośności radia", "Radio volume up"),
|
||||
["radiovolumedecrease"] = ("Zmniejszenie głośności radia", "Radio volume down"),
|
||||
["radiovolumeset"] = ("Ustawienie głośności radiotelefonu", "Set the radio volume"),
|
||||
["radiofusetoggle"] = ("Przełączenie bezpiecznika radiotelefonu", "Toggle the radio fuse"),
|
||||
["radiofuseenable"] = ("Załączenie bezpiecznika radiotelefonu", "Close the radio fuse"),
|
||||
["radiofusedisable"] = ("Wyłączenie bezpiecznika radiotelefonu", "Open the radio fuse"),
|
||||
["cabchangeforward"] = ("Przejście do sąsiedniego pomieszczenia w kierunku czoła pociągu", "Move to the next compartment towards the front"),
|
||||
["cabchangebackward"] = ("Przejście do sąsiedniego pomieszczenia w kierunku tyłu pociągu", "Move to the next compartment towards the rear"),
|
||||
["modernlightdimmerdecrease"] = ("Przyciemnienie oświetlenia", "Dim the lights"),
|
||||
["modernlightdimmerincrease"] = ("Rozjaśnienie oświetlenia", "Brighten the lights"),
|
||||
["nearestcarcouplingincrease"] = ("Łączenie sprzęgów", "Couple"),
|
||||
["nearestcarcouplingdisconnect"] = ("Rozłączenie sprzęgów", "Uncouple"),
|
||||
["nearestcarcoupleradapterattach"] = ("Nałożenie półsprzęgu", "Attach the coupler adapter"),
|
||||
["nearestcarcoupleradapterremove"] = ("Demontaż półsprzęgu", "Remove the coupler adapter"),
|
||||
["occupiedcarcouplingdisconnect"] = ("Rozłączenie sprzęgów po stronie obsadzonej kabiny", "Uncouple at the occupied cab's end"),
|
||||
["occupiedcarcouplingdisconnectback"] = ("Rozłączenie sprzęgu z tyłu zajmowanego pojazdu", "Uncouple at the back of the occupied car"),
|
||||
["doortoggleleft"] = ("Przełączenie stanu drzwi lewych", "Toggle the left doors"),
|
||||
["doortoggleright"] = ("Przełączenie stanu drzwi prawych", "Toggle the right doors"),
|
||||
["doorpermitleft"] = ("Zezwolenie na otwarcie drzwi lewych", "Permit opening the left doors"),
|
||||
["doorpermitright"] = ("Zezwolenie na otwarcie drzwi prawych", "Permit opening the right doors"),
|
||||
["doorpermitpresetactivatenext"] = ("Aktywacja kolejnej konfiguracji zezwolenia na otwarcie drzwi", "Next door permit preset"),
|
||||
["doorpermitpresetactivateprevious"] = ("Aktywacja poprzedniej konfiguracji zezwolenia na otwarcie drzwi", "Previous door permit preset"),
|
||||
["dooropenleft"] = ("Otwarcie drzwi z lewej", "Open the left doors"),
|
||||
["dooropenright"] = ("Otwarcie drzwi z prawej", "Open the right doors"),
|
||||
["dooropenall"] = ("Otwarcie drzwi z zezwoleniem", "Open the permitted doors"),
|
||||
["doorcloseleft"] = ("Zamknięcie drzwi lewych", "Close the left doors"),
|
||||
["doorcloseright"] = ("Zamknięcie drzwi prawych", "Close the right doors"),
|
||||
["doorcloseall"] = ("Zamknięcie wszystkich drzwi", "Close all doors"),
|
||||
["doorsteptoggle"] = ("Przełączenie stanu stopnia drzwi", "Toggle the door steps"),
|
||||
["doormodetoggle"] = ("Przełączenie trybu działania drzwi", "Toggle the door operation mode"),
|
||||
["mirrorstoggle"] = ("Złożenie lub rozłożenie lusterek", "Fold or unfold the mirrors"),
|
||||
["departureannounce"] = ("Sygnał odjazdu", "Departure signal"),
|
||||
["doorlocktoggle"] = ("Przełączenie stanu blokady drzwi", "Toggle the door lock"),
|
||||
["pantographcompressorvalvetoggle"] = ("Przełączenie stanu kurka trójdrogowego", "Toggle the three-way pantograph valve"),
|
||||
["pantographcompressorvalveenable"] = ("Otwarcie zaworu sprężarki pantografów", "Open the pantograph compressor valve"),
|
||||
["pantographcompressorvalvedisable"] = ("Zamknięcie zaworu sprężarki pantografów", "Close the pantograph compressor valve"),
|
||||
["pantographcompressoractivate"] = ("Aktywacja sprężarki pomocniczej", "Auxiliary pantograph compressor"),
|
||||
["pantographtogglefront"] = ("Przełączenie stanu pantografu przedniego", "Toggle the front pantograph"),
|
||||
["pantographtogglerear"] = ("Przełączenie stanu pantografu tylnego", "Toggle the rear pantograph"),
|
||||
["pantographraisefront"] = ("Podniesienie przedniego pantografu", "Raise the front pantograph"),
|
||||
["pantographraiserear"] = ("Podniesienie tylnego pantografu", "Raise the rear pantograph"),
|
||||
["pantographlowerfront"] = ("Opuszczenie przedniego pantografu", "Lower the front pantograph"),
|
||||
["pantographlowerrear"] = ("Opuszczenie tylnego pantografu", "Lower the rear pantograph"),
|
||||
["pantographlowerall"] = ("Opuszczenie wszystkich pantografów", "Lower all pantographs"),
|
||||
["pantographselectnext"] = ("Aktywacja kolejnej konfiguracji wyboru pantografów", "Next pantograph selection preset"),
|
||||
["pantographselectprevious"] = ("Aktywacja poprzedniej konfiguracji wyboru pantografów", "Previous pantograph selection preset"),
|
||||
["pantographtoggleselected"] = ("Przełączenie stanu wybranych pantografów", "Toggle the selected pantographs"),
|
||||
["pantographraiseselected"] = ("Podniesienie wybranych pantografów", "Raise the selected pantographs"),
|
||||
["pantographlowerselected"] = ("Opuszczenie wybranych pantografów", "Lower the selected pantographs"),
|
||||
["pantographvalvesupdate"] = ("Ustawienie zaworów pantografów", "Set the pantograph valves"),
|
||||
["pantographvalvesoff"] = ("Zamknięcie zaworów pantografów", "Close the pantograph valves"),
|
||||
["heatingtoggle"] = ("Przełączenie stanu ogrzewania pociągu", "Toggle train heating"),
|
||||
["heatingenable"] = ("Włączenie ogrzewania pociągu", "Turn the train heating on"),
|
||||
["heatingdisable"] = ("Wyłączenie ogrzewania pociągu", "Turn the train heating off"),
|
||||
["lightspresetactivatenext"] = ("Aktywacja kolejnej konfiguracji reflektorów", "Next headlight preset"),
|
||||
["lightspresetactivateprevious"] = ("Aktywacja poprzedniej konfiguracji reflektorów", "Previous headlight preset"),
|
||||
["headlighttoggleleft"] = ("Przełączenie stanu lewego reflektora", "Toggle the left headlight"),
|
||||
["headlightenableleft"] = ("Włączenie lewego reflektora z przodu", "Turn the front left headlight on"),
|
||||
["headlightdisableleft"] = ("Wyłączenie lewego reflektora z przodu", "Turn the front left headlight off"),
|
||||
["headlighttoggleright"] = ("Przełączenie stanu prawego reflektora", "Toggle the right headlight"),
|
||||
["headlightenableright"] = ("Włączenie prawego reflektora z przodu", "Turn the front right headlight on"),
|
||||
["headlightdisableright"] = ("Wyłączenie prawego reflektora z przodu", "Turn the front right headlight off"),
|
||||
["headlighttoggleupper"] = ("Przełączenie stanu górnego reflektora", "Toggle the upper headlight"),
|
||||
["headlightenableupper"] = ("Włączenie górnego reflektora z przodu", "Turn the front upper headlight on"),
|
||||
["headlightdisableupper"] = ("Wyłączenie górnego reflektora z przodu", "Turn the front upper headlight off"),
|
||||
["redmarkertoggleleft"] = ("Przełączenie lewego światła czerwonego", "Toggle the left red marker"),
|
||||
["redmarkerenableleft"] = ("Włączenie lewego sygnału końcowego z przodu", "Turn the front left red marker on"),
|
||||
["redmarkerdisableleft"] = ("Wyłączenie lewego sygnału końcowego z przodu", "Turn the front left red marker off"),
|
||||
["redmarkertoggleright"] = ("Przełączenie prawego światła czerwonego", "Toggle the right red marker"),
|
||||
["redmarkerenableright"] = ("Włączenie prawego sygnału końcowego z przodu", "Turn the front right red marker on"),
|
||||
["redmarkerdisableright"] = ("Wyłączenie prawego sygnału końcowego z przodu", "Turn the front right red marker off"),
|
||||
["headlighttogglerearleft"] = ("Przełączenie stanu lewego tylnego reflektora", "Toggle the rear left headlight"),
|
||||
["headlightenablerearleft"] = ("Włączenie lewego reflektora z tyłu", "Turn the rear left headlight on"),
|
||||
["headlightdisablerearleft"] = ("Wyłączenie lewego reflektora z tyłu", "Turn the rear left headlight off"),
|
||||
["headlighttogglerearright"] = ("Przełączenie stanu prawego tylnego reflektora", "Toggle the rear right headlight"),
|
||||
["headlightenablerearright"] = ("Włączenie prawego reflektora z tyłu", "Turn the rear right headlight on"),
|
||||
["headlightdisablerearright"] = ("Wyłączenie prawego reflektora z tyłu", "Turn the rear right headlight off"),
|
||||
["headlighttogglerearupper"] = ("Przełączenie stanu górnego tylnego reflektora", "Toggle the rear upper headlight"),
|
||||
["headlightenablerearupper"] = ("Włączenie górnego reflektora z tyłu", "Turn the rear upper headlight on"),
|
||||
["headlightdisablerearupper"] = ("Wyłączenie górnego reflektora z tyłu", "Turn the rear upper headlight off"),
|
||||
["redmarkertogglerearleft"] = ("Przełączenie lewego tylnego światła czerwonego", "Toggle the rear left red marker"),
|
||||
["redmarkerenablerearleft"] = ("Włączenie lewego sygnału końcowego z tyłu", "Turn the rear left red marker on"),
|
||||
["redmarkerdisablerearleft"] = ("Wyłączenie lewego sygnału końcowego z tyłu", "Turn the rear left red marker off"),
|
||||
["redmarkertogglerearright"] = ("Przełączenie prawego tylnego światła czerwonego", "Toggle the rear right red marker"),
|
||||
["redmarkerenablerearright"] = ("Włączenie prawego sygnału końcowego z tyłu", "Turn the rear right red marker on"),
|
||||
["redmarkerdisablerearright"] = ("Wyłączenie prawego sygnału końcowego z tyłu", "Turn the rear right red marker off"),
|
||||
["redmarkerstoggle"] = ("Przełączenie świateł końca pociągu", "Toggle the end-of-train lights"),
|
||||
["endsignalstoggle"] = ("Przełączenie tabliczek końca pociągu", "Toggle the end-of-train plates"),
|
||||
["headlightsdimtoggle"] = ("Przełączenie przyciemnienia reflektorów", "Toggle headlight dimming"),
|
||||
["headlightsdimenable"] = ("Przyciemnienie reflektorów", "Dim the headlights"),
|
||||
["headlightsdimdisable"] = ("Pełne światło reflektorów", "Headlights at full"),
|
||||
["motorconnectorsopen"] = ("Rozłączenie styczników liniowych", "Open the line contactors"),
|
||||
["motorconnectorsclose"] = ("Załączenie styczników liniowych", "Close the line contactors"),
|
||||
["motordisconnect"] = ("Odłączenie uszkodzonych silników", "Cut out the damaged motors"),
|
||||
["interiorlighttoggle"] = ("Przełączenie stanu oświetlenia kabiny", "Toggle the cab light"),
|
||||
["interiorlightenable"] = ("Włączenie oświetlenia kabiny", "Turn the cab light on"),
|
||||
["interiorlightdisable"] = ("Wyłączenie oświetlenia kabiny", "Turn the cab light off"),
|
||||
["interiorlightdimtoggle"] = ("Przełączenie przyciemnienia oświetlenia kabiny", "Toggle cab light dimming"),
|
||||
["interiorlightdimenable"] = ("Przyciemnienie oświetlenia kabiny", "Dim the cab light"),
|
||||
["interiorlightdimdisable"] = ("Pełne oświetlenie kabiny", "Cab light at full"),
|
||||
["compartmentlightstoggle"] = ("Przełączenie stanu oświetlenia przedziałów", "Toggle the compartment lights"),
|
||||
["compartmentlightsenable"] = ("Włączenie oświetlenia przedziałów", "Turn the compartment lights on"),
|
||||
["compartmentlightsdisable"] = ("Wyłączenie oświetlenia przedziałów", "Turn the compartment lights off"),
|
||||
["instrumentlighttoggle"] = ("Przełączenie stanu oświetlenia przyrządów", "Toggle the instrument lights"),
|
||||
["instrumentlightenable"] = ("Włączenie oświetlenia przyrządów", "Turn the instrument lights on"),
|
||||
["instrumentlightdisable"] = ("Wyłączenie oświetlenia przyrządów", "Turn the instrument lights off"),
|
||||
["dashboardlighttoggle"] = ("Przełączenie stanu oświetlenia pulpitu", "Toggle the dashboard light"),
|
||||
["dashboardlightenable"] = ("Włączenie oświetlenia pulpitu", "Turn the dashboard light on"),
|
||||
["dashboardlightdisable"] = ("Wyłączenie oświetlenia pulpitu", "Turn the dashboard light off"),
|
||||
["timetablelighttoggle"] = ("Przełączenie stanu oświetlenia rozkładu jazdy", "Toggle the timetable light"),
|
||||
["timetablelightenable"] = ("Włączenie oświetlenia rozkładu jazdy", "Turn the timetable light on"),
|
||||
["timetablelightdisable"] = ("Wyłączenie oświetlenia rozkładu jazdy", "Turn the timetable light off"),
|
||||
["generictoggle0"] = ("Przełączenie elementu uniwersalnego nr 0", "Generic switch 0"),
|
||||
["generictoggle1"] = ("Przełączenie elementu uniwersalnego nr 1", "Generic switch 1"),
|
||||
["generictoggle2"] = ("Przełączenie elementu uniwersalnego nr 2", "Generic switch 2"),
|
||||
["generictoggle3"] = ("Przełączenie elementu uniwersalnego nr 3", "Generic switch 3"),
|
||||
["generictoggle4"] = ("Przełączenie elementu uniwersalnego nr 4", "Generic switch 4"),
|
||||
["generictoggle5"] = ("Przełączenie elementu uniwersalnego nr 5", "Generic switch 5"),
|
||||
["generictoggle6"] = ("Przełączenie elementu uniwersalnego nr 6", "Generic switch 6"),
|
||||
["generictoggle7"] = ("Przełączenie elementu uniwersalnego nr 7", "Generic switch 7"),
|
||||
["generictoggle8"] = ("Przełączenie elementu uniwersalnego nr 8", "Generic switch 8"),
|
||||
["generictoggle9"] = ("Przełączenie elementu uniwersalnego nr 9", "Generic switch 9"),
|
||||
["generictoggle10"] = ("Przełączenie elementu uniwersalnego nr 10", "Generic switch 10"),
|
||||
["generictoggle11"] = ("Przełączenie elementu uniwersalnego nr 11", "Generic switch 11"),
|
||||
["generictoggle12"] = ("Przełączenie elementu uniwersalnego nr 12", "Generic switch 12"),
|
||||
["generictoggle13"] = ("Przełączenie elementu uniwersalnego nr 13", "Generic switch 13"),
|
||||
["generictoggle14"] = ("Przełączenie elementu uniwersalnego nr 14", "Generic switch 14"),
|
||||
["generictoggle15"] = ("Przełączenie elementu uniwersalnego nr 15", "Generic switch 15"),
|
||||
["generictoggle16"] = ("Przełączenie elementu uniwersalnego nr 16", "Generic switch 16"),
|
||||
["generictoggle17"] = ("Przełączenie elementu uniwersalnego nr 17", "Generic switch 17"),
|
||||
["generictoggle18"] = ("Przełączenie elementu uniwersalnego nr 18", "Generic switch 18"),
|
||||
["generictoggle19"] = ("Przełączenie elementu uniwersalnego nr 19", "Generic switch 19"),
|
||||
["generictoggle20"] = ("Przełączenie elementu uniwersalnego nr 20", "Generic switch 20"),
|
||||
["generictoggle21"] = ("Przełączenie elementu uniwersalnego nr 21", "Generic switch 21"),
|
||||
["generictoggle22"] = ("Przełączenie elementu uniwersalnego nr 22", "Generic switch 22"),
|
||||
["generictoggle23"] = ("Przełączenie elementu uniwersalnego nr 23", "Generic switch 23"),
|
||||
["generictoggle24"] = ("Przełączenie elementu uniwersalnego nr 24", "Generic switch 24"),
|
||||
["generictoggle25"] = ("Przełączenie elementu uniwersalnego nr 25", "Generic switch 25"),
|
||||
["generictoggle26"] = ("Przełączenie elementu uniwersalnego nr 26", "Generic switch 26"),
|
||||
["generictoggle27"] = ("Przełączenie elementu uniwersalnego nr 27", "Generic switch 27"),
|
||||
["generictoggle28"] = ("Przełączenie elementu uniwersalnego nr 28", "Generic switch 28"),
|
||||
["generictoggle29"] = ("Przełączenie elementu uniwersalnego nr 29", "Generic switch 29"),
|
||||
["batterytoggle"] = ("Przełączenie stanu akumulatorów", "Toggle the batteries"),
|
||||
["batteryenable"] = ("Włączenie baterii", "Turn the battery on"),
|
||||
["batterydisable"] = ("Wyłączenie baterii", "Turn the battery off"),
|
||||
["cabactivationtoggle"] = ("Przełączenie stanu aktywacji kabiny", "Toggle cab activation"),
|
||||
["cabactivationenable"] = ("Aktywacja kabiny", "Activate the cab"),
|
||||
["cabactivationdisable"] = ("Dezaktywacja kabiny", "Deactivate the cab"),
|
||||
["motorblowerstogglefront"] = ("Przełączenie stanu wentylatorów przednich silników trakcyjnych", "Toggle the front traction motor blowers"),
|
||||
["motorblowerstogglerear"] = ("Przełączenie stanu wentylatorów tylnych silników trakcyjnych", "Toggle the rear traction motor blowers"),
|
||||
["motorblowersdisableall"] = ("Wyłączenie wszystkich wentylatorów silników trakcyjnych", "Switch off all traction motor blowers"),
|
||||
["coolingfanstoggle"] = ("Przełączenie stanu wentylatorów oporów rozruchowych", "Toggle the starting resistor fans"),
|
||||
["tempomattoggle"] = ("Przełączenie stanu tempomatu", "Toggle the cruise control"),
|
||||
["springbraketoggle"] = ("Przełączenie stanu hamulca sprężynowego", "Toggle the spring brake"),
|
||||
["springbrakeenable"] = ("Załączenie hamulca sprężynowego", "Apply the spring brake"),
|
||||
["springbrakedisable"] = ("Zwolnienie hamulca sprężynowego", "Release the spring brake"),
|
||||
["springbrakeshutofftoggle"] = ("Przełączenie stanu kurka odcinającego hamulca sprężynowego", "Toggle the spring brake shut-off cock"),
|
||||
["springbrakeshutoffenable"] = ("Odcięcie hamulca sprężynowego", "Cut the spring brake off"),
|
||||
["springbrakeshutoffdisable"] = ("Przywrócenie hamulca sprężynowego", "Cut the spring brake back in"),
|
||||
["springbrakerelease"] = ("Luzowanie hamulca sprężynowego", "Release the spring brake"),
|
||||
["distancecounteractivate"] = ("Załączenie miernika przejechanego dystansu", "Start the distance counter"),
|
||||
["speedcontrolincrease"] = ("Zwiększenie prędkości utrzymywanej przez tempomat", "Cruise control speed up"),
|
||||
["speedcontroldecrease"] = ("Zmniejszenie prędkości utrzymywanej przez tempomat", "Cruise control speed down"),
|
||||
["speedcontrolpowerincrease"] = ("Zwiększenie maksymalnego poziomu mocy dostępnej dla tempomatu", "More power for the cruise control"),
|
||||
["speedcontrolpowerdecrease"] = ("Zmniejszenie maksymalnego poziomu mocy dostępnej dla tempomatu", "Less power for the cruise control"),
|
||||
["speedcontrolbutton0"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 0", "Cruise control preset speed 0"),
|
||||
["speedcontrolbutton1"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 1", "Cruise control preset speed 1"),
|
||||
["speedcontrolbutton2"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 2", "Cruise control preset speed 2"),
|
||||
["speedcontrolbutton3"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 3", "Cruise control preset speed 3"),
|
||||
["speedcontrolbutton4"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 4", "Cruise control preset speed 4"),
|
||||
["speedcontrolbutton5"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 5", "Cruise control preset speed 5"),
|
||||
["speedcontrolbutton6"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 6", "Cruise control preset speed 6"),
|
||||
["speedcontrolbutton7"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 7", "Cruise control preset speed 7"),
|
||||
["speedcontrolbutton8"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 8", "Cruise control preset speed 8"),
|
||||
["speedcontrolbutton9"] = ("Ustalenie dla tempomatu zdefiniowanej prędkości nr 9", "Cruise control preset speed 9"),
|
||||
["inverterenable1"] = ("Włączenie falownika 1", "Turn inverter 1 on"),
|
||||
["inverterenable2"] = ("Włączenie falownika 2", "Turn inverter 2 on"),
|
||||
["inverterenable3"] = ("Włączenie falownika 3", "Turn inverter 3 on"),
|
||||
["inverterenable4"] = ("Włączenie falownika 4", "Turn inverter 4 on"),
|
||||
["inverterenable5"] = ("Włączenie falownika 5", "Turn inverter 5 on"),
|
||||
["inverterenable6"] = ("Włączenie falownika 6", "Turn inverter 6 on"),
|
||||
["inverterenable7"] = ("Włączenie falownika 7", "Turn inverter 7 on"),
|
||||
["inverterenable8"] = ("Włączenie falownika 8", "Turn inverter 8 on"),
|
||||
["inverterenable9"] = ("Włączenie falownika 9", "Turn inverter 9 on"),
|
||||
["inverterenable10"] = ("Włączenie falownika 10", "Turn inverter 10 on"),
|
||||
["inverterenable11"] = ("Włączenie falownika 11", "Turn inverter 11 on"),
|
||||
["inverterenable12"] = ("Włączenie falownika 12", "Turn inverter 12 on"),
|
||||
["inverterdisable1"] = ("Wyłączenie falownika 1", "Turn inverter 1 off"),
|
||||
["inverterdisable2"] = ("Wyłączenie falownika 2", "Turn inverter 2 off"),
|
||||
["inverterdisable3"] = ("Wyłączenie falownika 3", "Turn inverter 3 off"),
|
||||
["inverterdisable4"] = ("Wyłączenie falownika 4", "Turn inverter 4 off"),
|
||||
["inverterdisable5"] = ("Wyłączenie falownika 5", "Turn inverter 5 off"),
|
||||
["inverterdisable6"] = ("Wyłączenie falownika 6", "Turn inverter 6 off"),
|
||||
["inverterdisable7"] = ("Wyłączenie falownika 7", "Turn inverter 7 off"),
|
||||
["inverterdisable8"] = ("Wyłączenie falownika 8", "Turn inverter 8 off"),
|
||||
["inverterdisable9"] = ("Wyłączenie falownika 9", "Turn inverter 9 off"),
|
||||
["inverterdisable10"] = ("Wyłączenie falownika 10", "Turn inverter 10 off"),
|
||||
["inverterdisable11"] = ("Wyłączenie falownika 11", "Turn inverter 11 off"),
|
||||
["inverterdisable12"] = ("Wyłączenie falownika 12", "Turn inverter 12 off"),
|
||||
["invertertoggle1"] = ("Przełączenie falownika 1", "Toggle inverter 1"),
|
||||
["invertertoggle2"] = ("Przełączenie falownika 2", "Toggle inverter 2"),
|
||||
["invertertoggle3"] = ("Przełączenie falownika 3", "Toggle inverter 3"),
|
||||
["invertertoggle4"] = ("Przełączenie falownika 4", "Toggle inverter 4"),
|
||||
["invertertoggle5"] = ("Przełączenie falownika 5", "Toggle inverter 5"),
|
||||
["invertertoggle6"] = ("Przełączenie falownika 6", "Toggle inverter 6"),
|
||||
["invertertoggle7"] = ("Przełączenie falownika 7", "Toggle inverter 7"),
|
||||
["invertertoggle8"] = ("Przełączenie falownika 8", "Toggle inverter 8"),
|
||||
["invertertoggle9"] = ("Przełączenie falownika 9", "Toggle inverter 9"),
|
||||
["invertertoggle10"] = ("Przełączenie falownika 10", "Toggle inverter 10"),
|
||||
["invertertoggle11"] = ("Przełączenie falownika 11", "Toggle inverter 11"),
|
||||
["invertertoggle12"] = ("Przełączenie falownika 12", "Toggle inverter 12"),
|
||||
["vehiclemoveforwards"] = ("Przesunięcie pojazdu do przodu", "Move the vehicle forwards"),
|
||||
["vehiclemovebackwards"] = ("Przesunięcie pojazdu do tyłu", "Move the vehicle backwards"),
|
||||
["vehicleboost"] = ("Przyspieszenie pojazdu", "Boost the vehicle"),
|
||||
["wiperswitchincrease"] = ("Szybsza praca wycieraczek", "Wipers faster"),
|
||||
["wiperswitchdecrease"] = ("Wolniejsza praca wycieraczek", "Wipers slower"),
|
||||
["lightsset"] = ("Ustawienie świateł", "Set the lights"),
|
||||
["oilfuelpumptoggle"] = ("Przełączenie pomp oleju i paliwa", "Toggle the oil and fuel pumps"),
|
||||
["linebreakertoggleb"] = ("Przełączenie wyłącznika szybkiego B", "Toggle line breaker B"),
|
||||
["linebreakeropenb"] = ("Wyłączenie wyłącznika szybkiego B", "Open line breaker B"),
|
||||
["linebreakercloseb"] = ("Załączenie wyłącznika szybkiego B", "Close line breaker B"),
|
||||
["linebreakertogglec"] = ("Przełączenie wyłącznika szybkiego C", "Toggle line breaker C"),
|
||||
["linebreakeropenc"] = ("Wyłączenie wyłącznika szybkiego C", "Open line breaker C"),
|
||||
["linebreakerclosec"] = ("Załączenie wyłącznika szybkiego C", "Close line breaker C"),
|
||||
};
|
||||
|
||||
/// <summary>The text of <paramref name="command"/>, Polish for "pl", else English; its name when unknown.</summary>
|
||||
public static string Of(string command, string languageCode) =>
|
||||
Texts.TryGetValue(command, out var text) ? languageCode == "pl" ? text.Polish : text.English : command;
|
||||
|
||||
/// <summary>The commands there are texts for.</summary>
|
||||
public static IEnumerable<string> Commands => Texts.Keys;
|
||||
}
|
||||
@@ -14,6 +14,10 @@
|
||||
<PackageReference Include="Avalonia" Version="12.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="StarterNG.Tests" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Eu07.BlackBox\Eu07.BlackBox.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -155,7 +155,9 @@ public sealed class EventList : ListBox
|
||||
var culture = CultureInfo.CurrentCulture;
|
||||
var events = new List<BlackBoxEvent>();
|
||||
foreach (var c in recording.UserCommands())
|
||||
events.Add(new BlackBoxEvent(c.Time, string.Format(culture, strings["EventCommand"], c.Name), Palette.Command, false));
|
||||
events.Add(new BlackBoxEvent(c.Time, string.Format(culture, strings["EventCommand"],
|
||||
strings[DefaultBlackBoxStrings.CommandPrefix + c.Name]),
|
||||
Palette.Command, false));
|
||||
foreach (var d in recording.DriverChanges)
|
||||
{
|
||||
if (recording.CabAt(d.Time + 0.5) is not { } s || s.Vehicle != d.Vehicle)
|
||||
@@ -176,14 +178,7 @@ public sealed class EventList : ListBox
|
||||
foreach (var horn in recording.UserHornChecks())
|
||||
events.Add(new BlackBoxEvent(horn.Request.Time, strings[horn.Sounded ? "EventHornSounded" : "EventHornMissed"],
|
||||
horn.Sounded ? Palette.HornPoint : Palette.Bad, !horn.Sounded));
|
||||
foreach (var span in recording.SecurityBrakings())
|
||||
{
|
||||
// Which of them was not acknowledged: the lamps blinking when it braked.
|
||||
string who = recording.CabAt(span.Start) is { } s
|
||||
? s.Has(SecurityFlags.CabSignal) && s.Has(SecurityFlags.Vigilance) ? "CA/SHP" : s.Has(SecurityFlags.CabSignal) ? "SHP" : "CA"
|
||||
: "CA";
|
||||
events.Add(new BlackBoxEvent(span.Start, string.Format(culture, strings["EventSecurityBraking"], who), Palette.Bad, true));
|
||||
}
|
||||
AddSecurity(recording, strings, events, culture);
|
||||
AddCameras(recording, strings, events, culture);
|
||||
AddCouplings(recording, strings, events, culture);
|
||||
AddCabChanges(recording, strings, events, culture);
|
||||
@@ -196,6 +191,45 @@ public sealed class EventList : ListBox
|
||||
return events.OrderBy(e => e.Time).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The train protection: its buzzer, acknowledged or not, and the braking apart. A lamp acknowledged before the
|
||||
/// buzzer is the driving as usual, not told.
|
||||
/// </summary>
|
||||
private static void AddSecurity(Recording recording, IBlackBoxStrings strings, List<BlackBoxEvent> events, CultureInfo culture)
|
||||
{
|
||||
var brakings = recording.SecurityBrakings();
|
||||
foreach (var span in recording.SecurityAlarms())
|
||||
{
|
||||
// The lamps of all its buzzing samples: one buzzer for both, the other may join it before it's acknowledged.
|
||||
var lamps = recording.Cab.Where(c => c.Time >= span.Start && c.Time <= span.End && (c.VigilanceBuzzer || c.CabSignalBuzzer))
|
||||
.Aggregate(SecurityFlags.None, (all, c) => all | c.Security);
|
||||
string who = ProtectionName(lamps);
|
||||
var before = recording.CabAt(span.Start);
|
||||
string text = brakings.Any(b => b.Start >= span.Start && b.Start <= span.End)
|
||||
? string.Format(culture, strings["EventSecurityAlarmMissed"], who)
|
||||
// Acknowledged when the sample it ended at buzzes no more and doesn't brake, in the same vehicle: not
|
||||
// the end of the recording or a gap in it, nor the power cut or the protection switched off.
|
||||
: recording.CabAt(span.End) is { } after && !after.VigilanceBuzzer && !after.CabSignalBuzzer
|
||||
&& !after.Has(SecurityFlags.Braking) && after.Vehicle == before?.Vehicle
|
||||
? string.Format(culture, strings["EventSecurityAlarmAcknowledged"], who, span.End - span.Start)
|
||||
: string.Format(culture, strings["EventSecurityAlarm"], who);
|
||||
events.Add(new BlackBoxEvent(span.Start, text, Palette.Buzzer, false));
|
||||
}
|
||||
foreach (var span in brakings)
|
||||
events.Add(new BlackBoxEvent(span.Start, string.Format(culture, strings["EventSecurityBraking"],
|
||||
ProtectionName(recording.CabAt(span.Start)?.Security ?? SecurityFlags.None)),
|
||||
Palette.Bad, true));
|
||||
}
|
||||
|
||||
/// <summary>Which of them it was: the lamps blinking.</summary>
|
||||
private static string ProtectionName(SecurityFlags lamps) =>
|
||||
(lamps & (SecurityFlags.CabSignal | SecurityFlags.Vigilance)) switch
|
||||
{
|
||||
SecurityFlags.CabSignal | SecurityFlags.Vigilance => "CA/SHP",
|
||||
SecurityFlags.CabSignal => "SHP",
|
||||
_ => "CA"
|
||||
};
|
||||
|
||||
private static void AddUserVehicles(Recording recording, IBlackBoxStrings strings, List<BlackBoxEvent> events, CultureInfo culture)
|
||||
{
|
||||
UserVehicleChange? before = null;
|
||||
|
||||
@@ -26,6 +26,8 @@ public static class Palette
|
||||
public static readonly IBrush AccentFill = Brush("#177F00");
|
||||
public static readonly IBrush AccentFillHover = Brush("#1E9000");
|
||||
public static readonly IBrush AccentText = Brush("#FFFFFF");
|
||||
/// <summary>The ring round a drawn control that has the keyboard, in the green of the starter's own.</summary>
|
||||
public static readonly IPen FocusPen = new Pen(Accent, 2);
|
||||
public static readonly IBrush Good = Brush("#4cc46e");
|
||||
|
||||
/// <summary>A delay: green on time, yellow a little late, red late, blue early.</summary>
|
||||
@@ -79,6 +81,8 @@ public static class Palette
|
||||
public static readonly IBrush LampOn = Brush("#4cc46e");
|
||||
public static readonly IBrush LampWarning = Brush("#e8c547");
|
||||
public static readonly IBrush LampAlarm = Brush("#f0584a");
|
||||
/// <summary>The train protection's buzzer: still to be acknowledged, not braking yet.</summary>
|
||||
public static readonly IBrush Buzzer = Brush("#c77dff");
|
||||
public static readonly IBrush LightWhite = Brush("#fff6d8");
|
||||
public static readonly IBrush LightRed = Brush("#ff3b30");
|
||||
public static readonly IBrush Command = Brush("#8b96a3");
|
||||
|
||||
47
Eu07.BlackBox.Views/SpokenPeer.cs
Normal file
47
Eu07.BlackBox.Views/SpokenPeer.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Avalonia.Automation;
|
||||
using Avalonia.Automation.Peers;
|
||||
using Avalonia.Automation.Provider;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Eu07.BlackBox.Views;
|
||||
|
||||
/// <summary>
|
||||
/// What a screen reader is told of a control that draws itself: a name, the moment or
|
||||
/// the row it stands at as its value - read again whenever it changes under the focus,
|
||||
/// as a slider's is - and a description of what it shows or how to work it.
|
||||
/// </summary>
|
||||
internal sealed class SpokenPeer : ControlAutomationPeer, IValueProvider
|
||||
{
|
||||
private readonly AutomationControlType _type;
|
||||
private readonly Func<string?> _value;
|
||||
private readonly Func<string?> _help;
|
||||
|
||||
public SpokenPeer(Control owner, AutomationControlType type, Func<string?> value, Func<string?> help) : base(owner)
|
||||
{
|
||||
_type = type;
|
||||
_value = value;
|
||||
_help = help;
|
||||
}
|
||||
|
||||
/// <summary>Tells the reader the value changed, so it reads the new one.</summary>
|
||||
public void Told(string? before, string? now)
|
||||
{
|
||||
if (before != now)
|
||||
RaisePropertyChangedEvent(ValuePatternIdentifiers.ValueProperty, before, now);
|
||||
}
|
||||
|
||||
protected override AutomationControlType GetAutomationControlTypeCore() => _type;
|
||||
|
||||
protected override string? GetHelpTextCore() => base.GetHelpTextCore() is { Length: > 0 } own ? own : _help();
|
||||
|
||||
protected override bool IsContentElementCore() => true;
|
||||
|
||||
protected override bool IsControlElementCore() => true;
|
||||
|
||||
string? IValueProvider.Value => _value();
|
||||
|
||||
bool IValueProvider.IsReadOnly => true;
|
||||
|
||||
void IValueProvider.SetValue(string? value) => throw new InvalidOperationException("The value is read only.");
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Avalonia;
|
||||
using Avalonia.Automation.Peers;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Media;
|
||||
@@ -51,6 +52,67 @@ public sealed class TimelineView : Control
|
||||
{
|
||||
ClipToBounds = true;
|
||||
MinHeight = 160;
|
||||
// Walked from the keyboard too: the arrows step through the time.
|
||||
Focusable = true;
|
||||
}
|
||||
|
||||
private string? _spoken;
|
||||
|
||||
/// <summary>
|
||||
/// What the moment played is said as - the clock, the speed, what the AI held - the
|
||||
/// value a screen reader reads, again whenever it changes.
|
||||
/// </summary>
|
||||
public string? Spoken
|
||||
{
|
||||
get => _spoken;
|
||||
set
|
||||
{
|
||||
string? before = _spoken;
|
||||
_spoken = value;
|
||||
(ControlAutomationPeer.FromElement(this) as SpokenPeer)?.Told(before, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() =>
|
||||
new SpokenPeer(this, AutomationControlType.Slider, () => _spoken, () => Strings["TimelineHelp"]);
|
||||
|
||||
/// <summary>How far one press of an arrow goes, in seconds: Ctrl a minute, Page Up and Down ten.</summary>
|
||||
public const double Step = 10, CtrlStep = 60, PageStep = 600;
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
if (_recording is not { } recording || recording.Duration <= 0)
|
||||
return;
|
||||
|
||||
bool ctrl = e.KeyModifiers.HasFlag(KeyModifiers.Control);
|
||||
double? to = e.Key switch
|
||||
{
|
||||
Key.Left => _time - (ctrl ? CtrlStep : Step),
|
||||
Key.Right => _time + (ctrl ? CtrlStep : Step),
|
||||
Key.PageUp => _time - PageStep,
|
||||
Key.PageDown => _time + PageStep,
|
||||
Key.Home => 0,
|
||||
Key.End => recording.Duration,
|
||||
_ => null
|
||||
};
|
||||
if (to is not { } t)
|
||||
return;
|
||||
|
||||
Seek?.Invoke(Math.Clamp(t, 0, recording.Duration));
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnGotFocus(FocusChangedEventArgs e)
|
||||
{
|
||||
base.OnGotFocus(e);
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
protected override void OnLostFocus(FocusChangedEventArgs e)
|
||||
{
|
||||
base.OnLostFocus(e);
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
public IBlackBoxStrings Strings { get; set; } = new DefaultBlackBoxStrings();
|
||||
@@ -100,6 +162,8 @@ public sealed class TimelineView : Control
|
||||
public override void Render(DrawingContext context)
|
||||
{
|
||||
var size = Bounds.Size;
|
||||
if (IsFocused)
|
||||
context.DrawRectangle(null, Palette.FocusPen, new Rect(size).Deflate(1));
|
||||
var recording = _recording;
|
||||
if (recording is null || recording.Duration <= 0)
|
||||
return;
|
||||
@@ -245,16 +309,16 @@ public sealed class TimelineView : Control
|
||||
rows[2].Add(x0, x1, s.BrakeCylinder > 0.2f ? BrakeShade(s.BrakeCylinder) : null, BandHeight);
|
||||
if (s.Security != SecurityFlags.None || s.CabEnd != 0)
|
||||
{
|
||||
// The alerter and the cab signalling apart, red when not acknowledged in time.
|
||||
rows[3].Add(x0, x1, s.Has(SecurityFlags.VigilanceBeeping) ? Palette.LampAlarm
|
||||
// The alerter and the cab signalling apart: the lamp, then its buzzer, red when it braked.
|
||||
rows[3].Add(x0, x1, s.VigilanceBuzzer ? Palette.Buzzer
|
||||
: s.Has(SecurityFlags.Vigilance) ? Palette.Vigilance : null, BandHeight);
|
||||
rows[4].Add(x0, x1, s.Has(SecurityFlags.CabSignalBeeping) ? Palette.LampAlarm
|
||||
rows[4].Add(x0, x1, s.CabSignalBuzzer ? Palette.Buzzer
|
||||
: s.Has(SecurityFlags.CabSignal) ? Palette.CabSignal : null, BandHeight);
|
||||
if (s.Has(SecurityFlags.Braking))
|
||||
if (s.ProtectionBraking)
|
||||
rows[s.Has(SecurityFlags.CabSignal) && !s.Has(SecurityFlags.Vigilance) ? 4 : 3].Add(x0, x1, Palette.Bad, BandHeight);
|
||||
}
|
||||
else
|
||||
rows[3].Add(x0, x1, (s.Flags & CabFlags.AlerterBeeping) != 0 ? Palette.LampAlarm
|
||||
rows[3].Add(x0, x1, (s.Flags & CabFlags.AlerterBeeping) != 0 ? Palette.Buzzer
|
||||
: (s.Flags & CabFlags.AlerterBlinking) != 0 ? Palette.Vigilance : null, BandHeight);
|
||||
// Where the user looked from: the samples go on in time, and so does the camera.
|
||||
while (camera + 1 < cameras.Count && cameras[camera + 1].Time <= s.Time)
|
||||
@@ -526,7 +590,8 @@ public sealed class TimelineView : Control
|
||||
foreach (var d in recording.DriverChanges)
|
||||
Consider(d.Time, () => Strings[d.Driving == Driver.Ai ? "TlAutopilotOn" : "TlAutopilotOff"]);
|
||||
foreach (var c in recording.UserCommands())
|
||||
Consider(c.Time, () => string.Format(culture, Strings["TlCommand"], c.Name));
|
||||
Consider(c.Time, () => string.Format(culture, Strings["TlCommand"],
|
||||
Strings[DefaultBlackBoxStrings.CommandPrefix + c.Name]));
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Automation.Peers;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Media;
|
||||
@@ -36,6 +38,84 @@ public sealed class TimetablePanel : Control
|
||||
{
|
||||
ClipToBounds = true;
|
||||
Cursor = new Cursor(StandardCursorType.Hand);
|
||||
// The stations walked from the keyboard as well: the arrows go up and down the rows,
|
||||
// Enter goes to the moment as a click does.
|
||||
Focusable = true;
|
||||
}
|
||||
|
||||
// The row the keyboard stands at; -1 until it is moved, when the station played is meant.
|
||||
private int _keyRow = -1;
|
||||
private string? _spoken;
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() =>
|
||||
new SpokenPeer(this, AutomationControlType.List, () => _spoken ?? RowText(KeyRow), () => Strings["TimetableHelp"]);
|
||||
|
||||
private int KeyRow => _keyRow >= 0 && _keyRow < _rows.Count ? _keyRow : Current();
|
||||
|
||||
/// <summary>A row as it is read: the station, the times of the timetable, the kilometre and what happened there.</summary>
|
||||
private string? RowText(int i)
|
||||
{
|
||||
if (_timetable is null)
|
||||
return Strings["TimetableNone"];
|
||||
if (i < 0 || i >= _rows.Count)
|
||||
return null;
|
||||
var row = _rows[i];
|
||||
var culture = CultureInfo.CurrentCulture;
|
||||
string planned = row.Row.IsStop
|
||||
? $"{Minutes(row.Row.Arrival)} – {Minutes(row.Row.Departure)}"
|
||||
: Minutes(row.Row.Departure);
|
||||
var parts = new List<string> { StationNames.Display(row.Row.Station), planned };
|
||||
if (row.Row.Km > 0 || i > 0)
|
||||
parts.Add($"km {row.Row.Km.ToString("0.0", culture)}");
|
||||
parts.AddRange(Chips(row, culture).Select(c => c.Text));
|
||||
return $"{i + 1}/{_rows.Count}. {string.Join(", ", parts)}";
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
if (_rows.Count == 0)
|
||||
return;
|
||||
|
||||
int at = KeyRow;
|
||||
int? to = e.Key switch
|
||||
{
|
||||
Key.Up => at - 1,
|
||||
Key.Down => at + 1,
|
||||
Key.Home => 0,
|
||||
Key.End => _rows.Count - 1,
|
||||
_ => null
|
||||
};
|
||||
if (e.Key == Key.Enter && at >= 0 && (_rows[at].ArrivedAt ?? _rows[at].DepartedAt) is { } t)
|
||||
{
|
||||
Seek?.Invoke(Math.Max(0, t - 5));
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
if (to is not { } row)
|
||||
return;
|
||||
|
||||
_keyRow = Math.Clamp(row, 0, _rows.Count - 1);
|
||||
string? before = _spoken;
|
||||
_spoken = RowText(_keyRow);
|
||||
(ControlAutomationPeer.FromElement(this) as SpokenPeer)?.Told(before, _spoken);
|
||||
this.BringIntoView(new Rect(0, HeaderHeight + _keyRow * RowHeight, Bounds.Width, RowHeight));
|
||||
InvalidateVisual();
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnGotFocus(FocusChangedEventArgs e)
|
||||
{
|
||||
base.OnGotFocus(e);
|
||||
_spoken = null;
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
protected override void OnLostFocus(FocusChangedEventArgs e)
|
||||
{
|
||||
base.OnLostFocus(e);
|
||||
_keyRow = -1;
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
public Recording? Recording
|
||||
@@ -103,6 +183,8 @@ public sealed class TimetablePanel : Control
|
||||
{
|
||||
var size = Bounds.Size;
|
||||
var culture = CultureInfo.CurrentCulture;
|
||||
if (IsFocused)
|
||||
context.DrawRectangle(null, Palette.FocusPen, new Rect(size).Deflate(1));
|
||||
if (_timetable is not { } timetable)
|
||||
{
|
||||
context.DrawText(MapView.Text(Strings["TimetableNone"], Palette.DimText, 12), new Point(Pad, Pad));
|
||||
@@ -130,6 +212,8 @@ public sealed class TimetablePanel : Control
|
||||
}
|
||||
else if (i == _hover)
|
||||
context.DrawRectangle(Palette.Faded(Palette.CardHover, 0.6), null, new Rect(0, top, size.Width, RowHeight - 1));
|
||||
if (IsFocused && i == KeyRow)
|
||||
context.DrawRectangle(null, Palette.FocusPen, new Rect(1, top + 1, size.Width - 2, RowHeight - 3));
|
||||
|
||||
// The line of the route through the stations, a dot each: hollow ahead, filled when done.
|
||||
var outcome = row.Outcome;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Automation;
|
||||
using Avalonia.Automation.Peers;
|
||||
using Avalonia.Automation.Provider;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Layout;
|
||||
@@ -235,10 +238,13 @@ internal static class UiKit
|
||||
BorderBrush = Palette.CardBorder;
|
||||
BorderThickness = new Thickness(0, 0, 0, 1);
|
||||
Child = _row;
|
||||
// Read as the tabs they are, which of them is picked.
|
||||
AutomationProperties.SetControlTypeOverride(_row, AutomationControlType.Tab);
|
||||
AutomationProperties.SetAccessibilityView(_row, AccessibilityView.Content);
|
||||
for (int i = 0; i < choices.Length; i++)
|
||||
{
|
||||
int index = i;
|
||||
var button = new Button
|
||||
var button = new SegmentButton
|
||||
{
|
||||
Content = choices[i],
|
||||
Padding = new Thickness(14, 3),
|
||||
@@ -267,8 +273,9 @@ internal static class UiKit
|
||||
_selected = value;
|
||||
for (int i = 0; i < _row.Children.Count; i++)
|
||||
{
|
||||
var button = (Button)_row.Children[i];
|
||||
var button = (SegmentButton)_row.Children[i];
|
||||
bool on = i == value;
|
||||
button.IsOn = on;
|
||||
var line = on ? Palette.Accent : Brushes.Transparent;
|
||||
button.Background = on ? Palette.Panel : Brushes.Transparent;
|
||||
button.BorderBrush = line;
|
||||
@@ -280,4 +287,51 @@ internal static class UiKit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A choice of <see cref="Segmented"/>: a button to look at, a tab to a screen reader,
|
||||
/// which says whether it is the one picked.
|
||||
/// </summary>
|
||||
private sealed class SegmentButton : Button
|
||||
{
|
||||
private bool _on;
|
||||
|
||||
protected override Type StyleKeyOverride => typeof(Button);
|
||||
|
||||
public bool IsOn
|
||||
{
|
||||
get => _on;
|
||||
set
|
||||
{
|
||||
if (_on == value)
|
||||
return;
|
||||
_on = value;
|
||||
(ControlAutomationPeer.FromElement(this) as Peer)?.Told(!value, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void Pick() => OnClick();
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new Peer(this);
|
||||
|
||||
private sealed class Peer(SegmentButton owner) : ButtonAutomationPeer(owner), ISelectionItemProvider
|
||||
{
|
||||
public void Told(bool before, bool now) =>
|
||||
RaisePropertyChangedEvent(SelectionItemPatternIdentifiers.IsSelectedProperty, before, now);
|
||||
|
||||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.TabItem;
|
||||
|
||||
public bool IsSelected => owner.IsOn;
|
||||
|
||||
public ISelectionProvider? SelectionContainer => null;
|
||||
|
||||
public void Select() => owner.Pick();
|
||||
|
||||
public void AddToSelection() => owner.Pick();
|
||||
|
||||
public void RemoveFromSelection()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user