public TextPrimitive(Point position, Color color, string text, WindowTextFont font)
 {
     Position = position;
     Color    = color;
     Text     = text;
     Font     = font;
 }
示例#2
0
 void SetFont()
 {
     FontTimestamp   = GetFont(FontHeightTimestamp);
     FontMessage     = GetFont(FontHeightMessage);
     FontMessageBold = GetFont(FontHeightMessage, true);
     SetMessages();
 }
示例#3
0
        void SetFont()
        {
            FontDistance    = GetFont(FontHeightDistance);
            FontTargetSpeed = GetFont(FontHeightTargetSpeed);
            FontGradient    = GetFont(FontHeightGradient);

            SetDistanceText();
        }
示例#4
0
 public override void ScaleChanged()
 {
     base.ScaleChanged();
     LabelFont = GetFont(FontHeightLabel);
     foreach (DataEntryField field in Fields)
     {
         field.ScaleChanged();
     }
 }
示例#5
0
        void SetFont()
        {
            FontDialSpeeds   = GetFont(FontHeightDial, true);
            FontReleaseSpeed = GetFont(FontHeightReleaseSpeed);
            FontCurrentSpeed = GetFont(FontHeightCurrentSpeed, true);

            foreach (var text in DialSpeeds)
            {
                text.Font = FontDialSpeeds;
            }
            if (ReleaseSpeed != null)
            {
                ReleaseSpeed.Font = FontReleaseSpeed;
            }
            if (CurrentSpeed != null)
            {
                foreach (var text in CurrentSpeed)
                {
                    text.Font = FontCurrentSpeed;
                }
            }
        }
        /// <summary>
        /// Set new font heights to match the actual scale.
        /// </summary>
        public void SetFont()
        {
            FontDialSpeeds   = Viewer.WindowManager.TextManager.GetExact("Arial", FontHeightDial * Scale, System.Drawing.FontStyle.Bold);
            FontReleaseSpeed = Viewer.WindowManager.TextManager.GetExact("Arial", FontHeightReleaseSpeed * Scale, System.Drawing.FontStyle.Regular);
            FontCurrentSpeed = Viewer.WindowManager.TextManager.GetExact("Arial", FontHeightCurrentSpeed * Scale, System.Drawing.FontStyle.Bold);

            foreach (var text in DialSpeeds)
            {
                text.Font = FontDialSpeeds;
            }
            if (ReleaseSpeed != null)
            {
                ReleaseSpeed.Font = FontReleaseSpeed;
            }
            if (CurrentSpeed != null)
            {
                foreach (var text in CurrentSpeed)
                {
                    text.Font = FontCurrentSpeed;
                }
            }
        }
示例#7
0
        /// <summary>
        /// Request a certain font size. This font size will then be used for drawing when using the expanding font.
        /// If the fontsize is not available, the best possible fontsize is used
        /// </summary>
        /// <param name="requestedFontSize">The font size that is requested</param>
        public void RequestFontSize(int requestedFontSize)
        {
            int selectedFontSize;

            if (fontSizes.Contains(requestedFontSize))
            {
                selectedFontSize = requestedFontSize;
            }
            else
            {   // we need to find a good size, we round up
                selectedFontSize = fontSizes.Max();
                foreach (int fontSize in fontSizes.OrderByDescending(s => s))
                {
                    if (fontSize >= requestedFontSize)
                    {
                        selectedFontSize = fontSize;
                    }
                }
            }

            ExpandingFont = InitFont(selectedFontSize);
        }
示例#8
0
 void SetFont()
 {
     TargetDistanceFont = GetFont(FontHeightTargetDistance);
 }
示例#9
0
        public DataEntryWindow(DMIDataEntryDefinition definition, DriverMachineInterface dmi) : base(definition.WindowTitle, definition.FullScreen || definition.Fields.Count > 1, dmi)
        {
            Definition = definition;
            Title      = definition.WindowTitle;
            int i = 0;

            LabelFont = GetFont(FontHeightLabel);
            foreach (var field in Definition.Fields)
            {
                Fields.Add(new DataEntryField(field, i, this, !FullScreen));
                i++;
            }
            if (FullScreen)
            {
                NextButton = new DMIIconButton("NA_17.bmp", "NA_18.2.bmp", Viewer.Catalog.GetString("Next"), true, () =>
                {
                    if ((ActiveField / 4) < (Fields.Count / 4))
                    {
                        NextButton.Enabled = false;
                        PrevButton.Enabled = true;
                        ActiveField        = 4 * (ActiveField / 4 + 1);
                        PrepareLayout();
                    }
                }, 82, 50, dmi);
                PrevButton = new DMIIconButton("NA_18.bmp", "NA_19.bmp", Viewer.Catalog.GetString("Next"), true, () =>
                {
                    if (ActiveField > 3)
                    {
                        NextButton.Enabled = true;
                        PrevButton.Enabled = false;
                        ActiveField        = 4 * (ActiveField / 4 - 1);
                        PrepareLayout();
                    }
                }, 82, 50, dmi);
                DataEntryCompleteLabel = new DMITextLabel(Title + " data entry complete?", 334, 50, dmi);
                YesButton = new DMIYesButton(dmi);
                YesButton.PressedAction = () =>
                {
                    bool overrideOperational = YesButton.DelayType;
                    YesButton.DelayType = false;
                    Dictionary <string, string> values = new Dictionary <string, string>();
                    foreach (var field in Fields)
                    {
                        values[field.Name] = field.AcceptedValue;
                    }
                    bool checkPassed = true;
                    foreach (var check in Definition.TechnicalCrossChecks)
                    {
                        var conflict = check.GetConflictingVariables(values);
                        foreach (var name in conflict)
                        {
                            foreach (var field in Fields)
                            {
                                if (field.Name == name)
                                {
                                    checkPassed = false;
                                    field.TechnicalCrossCheckInvalid = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (!checkPassed)
                    {
                        return;
                    }
                    if (overrideOperational)
                    {
                        foreach (var check in Definition.OperationalCrossChecks)
                        {
                            var conflict = check.GetConflictingVariables(values);
                            foreach (var name in conflict)
                            {
                                foreach (var field in Fields)
                                {
                                    if (field.Name == name)
                                    {
                                        checkPassed = false;
                                        field.OperationalCrossCheckInvalid = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (!checkPassed)
                    {
                        YesButton.DelayType = true;
                        return;
                    }
                    string result = WindowTitle + "\n";
                    foreach (var field in Fields)
                    {
                        result += field.Name + "=" + field.AcceptedValue + "\n";
                    }
                    //if (DMI.ETCSStatus != null) DMI.ETCSStatus.DriverActionResult = result;
                    DMI.ExitWindow(this);
                };
                YesButton.ExtendedSensitiveArea = new Rectangle(0, 50, 0, 0);
                PrevButton.Enabled = false;
                NextButton.Enabled = false;
            }
            if (Fields.Count > 4)
            {
                NextButton.Enabled = true;
            }
            PrepareLayout();
            Visible = true;
        }
示例#10
0
 void SetFont()
 {
     CaptionFont = GetFont(FontHeightButton);
 }
示例#11
0
 void SetFont()
 {
     WindowTitleFont = GetFont(FontHeightWindowTitle);
     SetTitle(WindowTitle);
 }
示例#12
0
 public override void ScaleChanged()
 {
     base.ScaleChanged();
     LabelFont = GetFont(FontHeightLabel);
     Fields.ForEach(x => x.ScaleChanged());
 }
 void SetFont()
 {
     TableTextFont   = GetFont(FontHeightTableText);
     TableSymbolFont = GetFont(FontHeightTableSymbol);
 }