Esempio n. 1
0
 public DMIButton(string displayName, bool upType, DriverMachineInterface dmi, bool showButtonBorder) : base(dmi)
 {
     DisplayName      = displayName;
     Enabled          = false;
     UpType           = upType;
     ShowButtonBorder = showButtonBorder;
 }
Esempio n. 2
0
 public DMITextLabel(string caption, int width, int height, DriverMachineInterface dmi) :
     base(dmi, width, height)
 {
     Caption     = caption.Split('\n');
     CaptionText = new TextPrimitive[Caption.Length];
     SetFont();
     SetText();
 }
Esempio n. 3
0
 public DMISubwindow(string title, bool fullScreen, DriverMachineInterface dmi) : base(dmi, fullScreen ? 640 : 306, 450)
 {
     WindowTitle         = title;
     FullScreen          = fullScreen;
     CloseButton         = new DMIIconButton("NA_11.bmp", "NA_12.bmp", Viewer.Catalog.GetString("Close"), true, () => dmi.ExitWindow(this), 82, 50, dmi);
     CloseButton.Enabled = true;
     BackgroundColor     = DMI.BlackWhiteTheme ? Color.Black : ColorBackground;
     SetFont();
     AddToLayout(CloseButton, new Point(fullScreen ? 334 : 0, 400));
 }
Esempio n. 4
0
 public DriverMachineInterfaceRenderer(Viewer viewer, MSTSLocomotive locomotive, CVCScreen control, CabShader shader)
     : base(viewer, locomotive, control, shader)
 {
     Position.X = (float)Control.PositionX;
     Position.Y = (float)Control.PositionY;
     if ((int)Control.Height == 102 && (int)Control.Width == 136)
     {
         // Hack for ETR400 cab, which was built with a bugged size calculation of digital displays
         Control.Height *= 0.75f;
         Control.Width  *= 0.75f;
     }
     DMI = new DriverMachineInterface((int)Control.Height, (int)Control.Width, locomotive, viewer, control);
 }
Esempio n. 5
0
 public PlanningWindow(DriverMachineInterface dmi) : base(dmi, 246, 300)
 {
     ButtonScaleUp   = new DMIIconButton("NA_03.bmp", "NA_05.bmp", Viewer.Catalog.GetString("Scale Up"), true, ScaleUp, 40, 15, dmi);
     ButtonScaleDown = new DMIIconButton("NA_04.bmp", "NA_06.bmp", Viewer.Catalog.GetString("Scale Down"), true, ScaleDown, 40, 15, dmi)
     {
         ExtendedSensitiveArea = new Rectangle(0, 15, 0, 0)
     };
     ButtonScaleUp.ExtendedSensitiveArea = new Rectangle(0, 0, 0, 15);
     ButtonScaleUp.ShowButtonBorder      = false;
     ButtonScaleDown.ShowButtonBorder    = false;
     ButtonScaleUp.Enabled   = MaxViewingDistanceM > MinZoomDistanceM;
     ButtonScaleDown.Enabled = MaxViewingDistanceM < MaxZoomDistanceM;
     ScaleChanged();
 }
Esempio n. 6
0
 public TargetDistance(DriverMachineInterface dmi) : base(dmi, 54, 221)
 {
     ScaleChanged();
 }
Esempio n. 7
0
 public TTIandLSSMArea(DriverMachineInterface dmi) : base(dmi, 54, 54)
 {
 }
Esempio n. 8
0
 public CircularSpeedGaugeRenderer(Viewer viewer, MSTSLocomotive locomotive, CVCDigital control, CabShader shader)
     : base(viewer, locomotive, control, shader)
 {
     // Height is adjusted to keep compatibility
     DMI = new DriverMachineInterface((int)Control.Width, (int)Control.Height, locomotive, viewer, control);
 }
Esempio n. 9
0
 public DMIIconButton(string enabledSymbol, string disabledSymbol, string displayName, bool upType, Action pressedAction, int width, int height, DriverMachineInterface dmi) :
     base(displayName, upType, pressedAction, width, height, dmi, true)
 {
     DisabledSymbol = disabledSymbol;
     EnabledSymbol  = enabledSymbol;
     SetIcon();
 }
Esempio n. 10
0
 public DMIButton(string displayName, bool upType, Action pressedAction, int width, int height, DriverMachineInterface dmi, bool showButtonBorder = false) : base(dmi, width, height)
 {
     DisplayName      = displayName;
     Enabled          = false;
     UpType           = upType;
     PressedAction    = pressedAction;
     ShowButtonBorder = showButtonBorder;
 }
Esempio n. 11
0
 protected DMIWindow(DriverMachineInterface dmi, int width, int height) : base(dmi, width, height)
 {
 }
Esempio n. 12
0
 public DMIArea(DriverMachineInterface dmi, int width, int height)
 {
     DMI    = dmi;
     Width  = width;
     Height = height;
 }
Esempio n. 13
0
 public DMIArea(DriverMachineInterface dmi)
 {
     DMI = dmi;
 }
Esempio n. 14
0
 public ETCSDefaultWindow(DriverMachineInterface dmi, CabViewControl control) : base(dmi, dmi.Width, dmi.Height)
 {
     if (dmi.CurrentDMIMode == DMIMode.GaugeOnly)
     {
         var dig = control as CVCDigital;
         CircularSpeedGauge = new CircularSpeedGauge(
             (int)dig.MaxValue,
             dig.Units != CABViewControlUnits.MILES_PER_HOUR,
             dig.Units != CABViewControlUnits.NONE,
             dig.MaxValue == 240 || dig.MaxValue == 260,
             (int)dig.MinValue,
             DMI);
         AddToLayout(CircularSpeedGauge, new Point(0, 0));
         return;
     }
     if (dmi.CurrentDMIMode != DMIMode.PlanningArea)
     {
         var param    = (control as CVCScreen).CustomParameters;
         int maxSpeed = 400;
         if (param.ContainsKey("maxspeed"))
         {
             int.TryParse(param["maxspeed"], out maxSpeed);
         }
         int maxVisibleSpeed = maxSpeed;
         if (param.ContainsKey("maxvisiblespeed"))
         {
             int.TryParse(param["maxvisiblespeed"], out maxVisibleSpeed);
         }
         CircularSpeedGauge = new CircularSpeedGauge(
             maxSpeed,
             control.Units != CABViewControlUnits.MILES_PER_HOUR,
             param.ContainsKey("displayunits") && param["displayunits"] == "1",
             maxSpeed == 240 || maxSpeed == 260,
             maxVisibleSpeed,
             dmi
             );
         TTIandLSSMArea           = new TTIandLSSMArea(dmi);
         TargetDistance           = new TargetDistance(dmi);
         MessageArea              = new MessageArea(dmi);
         CircularSpeedGauge.Layer = -1;
         TargetDistance.Layer     = -1;
         TTIandLSSMArea.Layer     = -1;
         MessageArea.Layer        = -1;
         AddToLayout(CircularSpeedGauge, new Point(54, DMI.IsSoftLayout ? 0 : 15));
         AddToLayout(TTIandLSSMArea, new Point(0, DMI.IsSoftLayout ? 0 : 15));
         AddToLayout(TargetDistance, new Point(0, 54 + (DMI.IsSoftLayout ? 0 : 15)));
         AddToLayout(MessageArea, new Point(54, DMI.IsSoftLayout ? 350 : 365));
         AddToLayout(MessageArea.ButtonScrollUp, new Point(54 + 234, DMI.IsSoftLayout ? 350 : 365));
         AddToLayout(MessageArea.ButtonScrollDown, new Point(54 + 234, MessageArea.Height / 2 + (DMI.IsSoftLayout ? 350 : 365)));
     }
     if (dmi.CurrentDMIMode != DMIMode.SpeedArea)
     {
         // Calculate start position of the planning area when a two-screen display is used
         // Real width of the left area in ETCS specs is 306 px, however in order to have
         // both screens with the same size I assumed both have 334 px
         // To be checked
         int startPos = dmi.CurrentDMIMode == DMIMode.FullSize ? 334 : (334 - 306) / 2;
         PlanningWindow = new PlanningWindow(dmi);
         MenuBar        = new MenuBar(dmi);
         AddToLayout(PlanningWindow, new Point(startPos, DMI.IsSoftLayout ? 0 : 15));
         AddToLayout(PlanningWindow.ButtonScaleDown, new Point(startPos, DMI.IsSoftLayout ? 0 : 15));
         AddToLayout(PlanningWindow.ButtonScaleUp, new Point(startPos, 285 + (DMI.IsSoftLayout ? 0 : 15)));
         foreach (int i in Enumerable.Range(0, MenuBar.Buttons.Count))
         {
             AddToLayout(MenuBar.Buttons[i], new Point(580, 15 + 50 * i));
         }
     }
 }
Esempio n. 15
0
        public CircularSpeedGauge(int maxSpeed, bool unitMetric, bool unitVisible, bool dialQuarterLines, int maxVisibleScale, DriverMachineInterface dmi) : base(dmi, 280, 300)
        {
            UnitVisible = unitVisible;
            SetUnit(unitMetric);

            DialQuarterLines = dialQuarterLines;
            MaxSpeed         = maxSpeed;
            MaxVisibleScale  = maxVisibleScale;

            SetRange(MaxSpeed);

            CurrentSpeed = new TextPrimitive[3];
            foreach (int i in Enumerable.Range(0, CurrentSpeed.Length))
            {
                CurrentSpeed[i] = new TextPrimitive(new Point(CurrentSpeedPosition[i], CurrentSpeedPosition[3]), Color.Black, "0", FontCurrentSpeed);
            }

            ReleaseSpeed = new TextPrimitive(ReleaseSpeedPosition, ColorGrey, String.Empty, FontReleaseSpeed);

            if (NeedleTextureData == null)
            {
                NeedleTextureData = new Color[128 * 16];

                // Needle texture is according to ETCS specification
                foreach (int v in Enumerable.Range(0, 128))
                {
                    foreach (int u in Enumerable.Range(0, 16))
                    {
                        NeedleTextureData[u + 16 * v] = (
                            v <= 15 && 5 < u && u < 9 ||
                            15 < v && v <= 23 && 5f - (float)(v - 15) / 8f * 3f < u && u < 9f + (float)(v - 15) / 8f * 3f ||
                            23 < v && v < 82 && 2 < u && u < 12
                            ) ? Color.White : Color.Transparent;
                    }
                }
            }
        }
Esempio n. 16
0
 public DMITextButton(string caption, string displayName, bool upType, Action pressedAction, int width, int height, DriverMachineInterface dmi, int fontHeight = 12) :
     base(displayName, upType, pressedAction, width, height, dmi, true)
 {
     Caption          = caption.Split('\n');
     CaptionText      = new TextPrimitive[Caption.Length];
     ConfirmerCaption = caption;
     FontHeightButton = fontHeight;
     SetFont();
     SetText();
 }
Esempio n. 17
0
 public ETCSDefaultWindow(DriverMachineInterface dmi, CabViewControl control) : base(dmi, 640, 480)
 {
     if (control is CVCDigital)
     {
         var dig = control as CVCDigital;
         CircularSpeedGauge = new CircularSpeedGauge(
             (int)dig.MaxValue,
             dig.Units != CABViewControlUnits.MILES_PER_HOUR,
             dig.Units != CABViewControlUnits.NONE,
             dig.MaxValue == 240 || dig.MaxValue == 260,
             (int)dig.MinValue,
             DMI);
     }
     else
     {
         var param    = (control as CVCScreen).CustomParameters;
         int maxSpeed = 400;
         if (param.ContainsKey("maxspeed"))
         {
             int.TryParse(param["maxspeed"], out maxSpeed);
         }
         int maxVisibleSpeed = maxSpeed;
         if (param.ContainsKey("maxvisiblespeed"))
         {
             int.TryParse(param["maxvisiblespeed"], out maxVisibleSpeed);
         }
         CircularSpeedGauge = new CircularSpeedGauge(
             maxSpeed,
             control.Units != CABViewControlUnits.MILES_PER_HOUR,
             param.ContainsKey("displayunits") && param["displayunits"] == "1",
             maxSpeed == 240 || maxSpeed == 260,
             maxVisibleSpeed,
             dmi
             );
     }
     if (DMI.GaugeOnly)
     {
         AddToLayout(CircularSpeedGauge, new Point(0, 0));
         return;
     }
     PlanningWindow           = new PlanningWindow(dmi);
     TTIandLSSMArea           = new TTIandLSSMArea(dmi);
     TargetDistance           = new TargetDistance(dmi);
     MessageArea              = new MessageArea(dmi);
     MenuBar                  = new MenuBar(dmi);
     CircularSpeedGauge.Layer = -1;
     TargetDistance.Layer     = -1;
     TTIandLSSMArea.Layer     = -1;
     MessageArea.Layer        = -1;
     AddToLayout(CircularSpeedGauge, new Point(54, DMI.IsSoftLayout ? 0 : 15));
     AddToLayout(PlanningWindow, new Point(334, DMI.IsSoftLayout ? 0 : 15));
     AddToLayout(PlanningWindow.ButtonScaleDown, new Point(334, DMI.IsSoftLayout ? 0 : 15));
     AddToLayout(PlanningWindow.ButtonScaleUp, new Point(334, 285 + (DMI.IsSoftLayout ? 0 : 15)));
     AddToLayout(TTIandLSSMArea, new Point(0, DMI.IsSoftLayout ? 0 : 15));
     AddToLayout(TargetDistance, new Point(0, 54 + (DMI.IsSoftLayout ? 0 : 15)));
     AddToLayout(MessageArea, new Point(54, DMI.IsSoftLayout ? 350 : 365));
     AddToLayout(MessageArea.ButtonScrollUp, new Point(54 + 234, DMI.IsSoftLayout ? 350 : 365));
     AddToLayout(MessageArea.ButtonScrollDown, new Point(54 + 234, MessageArea.Height / 2 + (DMI.IsSoftLayout ? 350 : 365)));
     foreach (int i in Enumerable.Range(0, MenuBar.Buttons.Count))
     {
         AddToLayout(MenuBar.Buttons[i], new Point(580, 15 + 50 * i));
     }
 }