Skip to content

Commit a90119a

Browse files
committed
delete dead code
1 parent 9f1aa4d commit a90119a

File tree

2 files changed

+2
-223
lines changed

2 files changed

+2
-223
lines changed

Source/RunActivity/Viewer3D/RollingStock/SubSystems/ETCS/DriverMachineInterface.cs

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -828,91 +828,4 @@ public override void Draw(GraphicsDevice graphicsDevice)
828828
ControlView.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.Default, null, Shader);
829829
}
830830
}
831-
/// <summary>
832-
/// Wrapper class for DriverMachineInterface, to display it as UI window control.
833-
/// </summary>
834-
/*public class DriverMachineInterfaceControl : Control
835-
{
836-
public readonly DriverMachineInterface DMI;
837-
838-
public DriverMachineInterfaceControl(int width, int height, WindowManager owner)
839-
: base(0, 0, width, height)
840-
{
841-
DMI = new DriverMachineInterface(width, height, owner.Viewer.PlayerLocomotive as MSTSLocomotive, owner.Viewer);
842-
DMI.DisplayBackground = true;
843-
}
844-
845-
/// <summary>
846-
/// Resize control to fit into a new rectangle, by keeping aspect ratio.
847-
/// </summary>
848-
/// <param name="width">The new width of the control</param>
849-
/// <param name="height">The new height of the control</param>
850-
public void SizeTo(int width, int height)
851-
{
852-
Position.Width = width;
853-
Position.Height = height;
854-
DMI.SizeTo(width, height);
855-
}
856-
857-
public void PrepareFrame(float elapsedSeconds)
858-
{
859-
DMI.PrepareFrame(elapsedSeconds);
860-
}
861-
public bool IsMouseWithin(WindowMouseEvent e)
862-
{
863-
int x = (int)((e.MousePosition.X - Position.X - 8) / DMI.Scale);
864-
int y = (int)((e.MousePosition.Y - Position.Y) / DMI.Scale);
865-
foreach (DMIButton b in DMI.ActiveWindow.SubAreas)
866-
{
867-
if (b.SensitiveArea.Contains(x, y) && b.Enabled) return true;
868-
}
869-
return false;
870-
}
871-
internal override bool HandleUserInput(WindowMouseEvent e)
872-
{
873-
int x = (int)((e.MousePosition.X - Position.X - 8) / DMI.Scale);
874-
int y = (int)((e.MousePosition.Y - Position.Y) / DMI.Scale);
875-
DMI.HandleMouseInput(UserInput.IsMouseLeftButtonDown, x, y);
876-
return IsMouseWithin(e);
877-
}
878-
internal override bool HandleMouseDown(WindowMouseEvent e)
879-
{
880-
return HandleUserInput(e);
881-
}
882-
internal override bool HandleMouseUp(WindowMouseEvent e)
883-
{
884-
return HandleUserInput(e);
885-
}
886-
internal override bool HandleMouseMove(WindowMouseEvent e)
887-
{
888-
return HandleUserInput(e);
889-
}
890-
internal override void Draw(SpriteBatch spriteBatch, Point position)
891-
{
892-
position.X += 8;
893-
position.Y += 25;
894-
DMI.Draw(spriteBatch, position);
895-
spriteBatch.End();
896-
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.Default, null, null);
897-
}
898-
}
899-
public class DriverMachineInterfaceWindow : Window
900-
{
901-
DriverMachineInterfaceControl Control;
902-
public DriverMachineInterfaceWindow(WindowManager owner)
903-
: base(owner, 400, 300, Viewer.Catalog.GetString("ERTMS/ETCS Driver Machine Interface"))
904-
{
905-
}
906-
protected override ControlLayout Layout(ControlLayout layout)
907-
{
908-
var vbox = base.Layout(layout).AddLayoutVertical();
909-
vbox.Add(Control = new DriverMachineInterfaceControl(vbox.RemainingWidth, vbox.RemainingHeight, Owner));
910-
return vbox;
911-
}
912-
public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
913-
{
914-
base.PrepareFrame(elapsedTime, updateFull);
915-
Control?.PrepareFrame(elapsedTime.ClockSeconds);
916-
}
917-
}*/
918831
}

Source/RunActivity/Viewer3D/RollingStock/SubSystems/ETCS/Menus.cs

Lines changed: 2 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -27,133 +27,7 @@ public class MenuBar
2727
public readonly IList<DMIButton> Buttons = new List<DMIButton>();
2828
public MenuBar(DriverMachineInterface dmi)
2929
{
30-
/* Default menus disabled. Interface with TCS to be defined in the future
31-
var main = new DMITextButton("Main", "Main", true, () =>
32-
{
33-
var buts = new List<DMIButton>();
34-
buts.Add(new DMITextButton("Start", "Start", true, null, 153, 50, dmi));
35-
var driverid = new DMITextButton("Driver ID", "Driver ID", true, () =>
36-
{
37-
var fields = new List<DMIDataEntryValue>();
38-
var val = new DMIDataEntryValue();
39-
val.Name = "Level";
40-
val.Keyboard = new DMIKeyboard(DMIKeyboard.KeyboardType.Alphanumeric);
41-
fields.Add(val);
42-
var idwnd = new DataEntryWindow(new DMIDataEntryDefinition("Driver ID", fields, false, null, null), dmi);
43-
dmi.ShowSubwindow(idwnd);
44-
}, 153, 50, dmi);
45-
driverid.Enabled = true;
46-
buts.Add(driverid);
47-
var traindata = new DMITextButton("Train data", "Train data", true, () =>
48-
{
49-
var fields = new List<DMIDataEntryValue>();
50-
var val = new DMIDataEntryValue();
51-
val.Name = "Train category";
52-
List<string> keys = new List<string>();
53-
val.Keyboard = new DMIKeyboard(keys);
54-
keys.Add("PASS 1");
55-
keys.Add("PASS 2");
56-
keys.Add("PASS 3");
57-
keys.Add("TILT 1");
58-
keys.Add("TILT 2");
59-
keys.Add("TILT 3");
60-
keys.Add("TILT 4");
61-
keys.Add("TILT 5");
62-
keys.Add("TILT 6");
63-
keys.Add("TILT 7");
64-
keys.Add("FP 1");
65-
keys.Add("FP 2");
66-
keys.Add("FP 3");
67-
keys.Add("FP 4");
68-
keys.Add("FG 1");
69-
keys.Add("FG 2");
70-
keys.Add("FG 3");
71-
keys.Add("FG 4");
72-
fields.Add(val);
73-
val.Name = "Length (m)";
74-
val.Keyboard = new DMIKeyboard(DMIKeyboard.KeyboardType.Numeric);
75-
fields.Add(val);
76-
val.Name = "Brake percentage";
77-
val.Keyboard = new DMIKeyboard(DMIKeyboard.KeyboardType.Numeric);
78-
fields.Add(val);
79-
val.Name = "Maximum speed (km/h)";
80-
val.Keyboard = new DMIKeyboard(DMIKeyboard.KeyboardType.Numeric);
81-
fields.Add(val);
82-
val.Name = "Airtight";
83-
keys = new List<string>();
84-
keys.Add("Yes");
85-
keys.Add("No");
86-
val.Keyboard = new DMIKeyboard(keys);
87-
fields.Add(val);
88-
val.Name = "Loading gauge";
89-
keys = new List<string>();
90-
keys.Add("G1");
91-
keys.Add("GA");
92-
keys.Add("GB");
93-
keys.Add("GC");
94-
keys.Add("Out of GC");
95-
val.Keyboard = new DMIKeyboard(keys);
96-
fields.Add(val);
97-
var datawnd = new DataEntryWindow(new DMIDataEntryDefinition("Train data", fields, true, null, null), dmi);
98-
dmi.ShowSubwindow(datawnd);
99-
}, 153, 50, dmi);
100-
traindata.Enabled = true;
101-
buts.Add(traindata);
102-
buts.Add(null);
103-
var level = new DMITextButton("Level", "Level", true, () =>
104-
{
105-
var fields = new List<DMIDataEntryValue>();
106-
var val = new DMIDataEntryValue();
107-
val.Name = "Level";
108-
List<string> keys = new List<string>();
109-
keys.Add("Level 0");
110-
keys.Add("Level 1");
111-
keys.Add("Level 2");
112-
keys.Add("Level 3");
113-
keys.Add("SCMT");
114-
keys.Add("LZB");
115-
val.Keyboard = new DMIKeyboard(keys);
116-
fields.Add(val);
117-
var levwnd = new DataEntryWindow(new DMIDataEntryDefinition("Level", fields, false, null, null), dmi);
118-
dmi.ShowSubwindow(levwnd);
119-
}, 153, 50, dmi);
120-
level.Enabled = true;
121-
buts.Add(level);
122-
var trn = new DMITextButton("Train running n.", "Train running number", true, () =>
123-
{
124-
var fields = new List<DMIDataEntryValue>();
125-
var val = new DMIDataEntryValue();
126-
val.Name = "Train running number";
127-
val.Keyboard = new DMIKeyboard(DMIKeyboard.KeyboardType.Numeric);
128-
fields.Add(val);
129-
var trnwnd = new DataEntryWindow(new DMIDataEntryDefinition("Train running number", fields, false, null, null), dmi);
130-
dmi.ShowSubwindow(trnwnd);
131-
}, 153, 50, dmi);
132-
trn.Enabled = true;
133-
buts.Add(trn);
134-
var shunt = new DMITextButton("Shunting", "Shunting", true, null, 153, 50, dmi);
135-
shunt.DelayType = true;
136-
buts.Add(shunt);
137-
buts.Add(new DMITextButton("Non Leading", "Non Leading", true, null, 153, 50, dmi));
138-
buts.Add(new DMITextButton("Maintain Shunt.", "Maintain Shunting", true, null, 153, 50, dmi));
139-
buts.Add(new DMITextButton("Radio data", "Radio data", true, null, 153, 50, dmi));
140-
var wnd = new MenuWindow("Main", buts, dmi);
141-
dmi.ShowSubwindow(wnd);
142-
}, 60, 50, dmi);
143-
main.Enabled = true;
144-
Buttons.Add(main);
145-
var ov = new DMITextButton("Over-\nride", "Override", true, () =>
146-
{
147-
var buts = new List<DMIButtonDefinition>();
148-
buts.Add(new DMIButtonDefinition("EoA", false));
149-
var wnd = new MenuWindow(new DMIMenuWindowDefinition("Override", buts), dmi);
150-
dmi.ShowSubwindow(wnd);
151-
}, 60, 50, dmi);
152-
ov.Enabled = true;
153-
Buttons.Add(ov);
154-
Buttons.Add(new DMITextButton("Data\nview", "Data view", true, null, 60, 50, dmi));
155-
Buttons.Add(new DMITextButton("Spec", "Special", true, null, 60, 50, dmi));
156-
Buttons.Add(new DMIIconButton("SE_04.bmp", "SE_04.bmp", "Settings", true, null, 60, 50, dmi));*/
30+
// Interface with TCS to be defined in the future
15731
}
15832
}
15933
public class MenuWindow : DMISubwindow
@@ -200,15 +74,7 @@ public MenuWindow(string title, List<DMIButton> buttons, DriverMachineInterface
20074
public override void PrepareFrame(ETCSStatus status)
20175
{
20276
base.PrepareFrame(status);
203-
/* TODO: TCS menu interface to be defined
204-
if (status.ActiveSubwindow is DMIMenuWindowDefinition && status.ActiveSubwindow.WindowTitle == WindowTitle)
205-
{
206-
DMIMenuWindowDefinition menu = (DMIMenuWindowDefinition)status.ActiveSubwindow;
207-
for (int i=0; i<menu.Buttons.Count && i<Buttons.Count; i++)
208-
{
209-
Buttons[i].Enabled = menu.Buttons[i].Enabled;
210-
}
211-
}*/
77+
// TODO: TCS menu interface to be defined
21278
}
21379
}
21480
}

0 commit comments

Comments
 (0)