diff --git a/SimaticML/API/SimaticLADSegment.cs b/SimaticML/API/SimaticLADSegment.cs index dac226f..290b7bd 100644 --- a/SimaticML/API/SimaticLADSegment.cs +++ b/SimaticML/API/SimaticLADSegment.cs @@ -108,10 +108,17 @@ private void ParsePart(CompileUnit compileUnit, SegmentPart previousPart) } else { - compileUnit.CreateWire() + var wire = compileUnit.CreateWire() .CreateNameCon(previousPart.Part, previousPart.OutputConName) .CreateNameCon(part.Part, part.InputConName); + foreach (var branchSimaticPart in previousPart.SimaticPart.Branches) + { + var branchPart = this.ComputePart(compileUnit, branchSimaticPart) ?? throw new ArgumentNullException(nameof(branchSimaticPart)); + wire.CreateNameCon(branchPart.Part, branchPart.InputConName); + ParsePart(compileUnit, branchPart); + } + ParsePart(compileUnit, part); } } diff --git a/SimaticML/API/SimaticPart.cs b/SimaticML/API/SimaticPart.cs index b3c9f95..a22a8ed 100644 --- a/SimaticML/API/SimaticPart.cs +++ b/SimaticML/API/SimaticPart.cs @@ -2,28 +2,24 @@ using SimaticML.Blocks.FlagNet; using SimaticML.Blocks.FlagNet.nPart; using SimaticML.Enums; +using System.Collections.Generic; namespace SimaticML.API { - public abstract class SimaticPart + public abstract class SimaticPart(PartType partType) { //all LADDER blocks have input / output connections ("in" and "out" for contact, "en" and "eno" for blocks). //Some, like a call for an FC, have more named connections. public abstract string InputConName { get; } public abstract string OutputConName { get; } - public PartType PartType { get; init; } - public SimaticMultilingualText Comment { get; init; } + public PartType PartType { get; init; } = partType; + public SimaticMultilingualText Comment { get; init; } = new(); //A part can only have 1 previous part but multiple next //(The OR is considered one single part when connection something AFTER. Before the OR, the part will have multiple connections) public SimaticPart? Next { get; set; } - - public SimaticPart(PartType partType) - { - this.PartType = partType; - this.Comment = new(); - } + public List Branches { get; init; } = []; public virtual bool IsCloser() => false; @@ -49,6 +45,12 @@ public virtual SimaticPart AND(SimaticPart nextPart) return this; } + public virtual SimaticPart Branch(SimaticPart branch) + { + this.Branches.Add(branch); + return branch; + } + public SimaticPart FindLast() => this.Next == null ? this : this.Next.FindLast(); public virtual SimaticPart OR(SimaticPart nextPart) @@ -56,7 +58,6 @@ public virtual SimaticPart OR(SimaticPart nextPart) var orPart = new OrPart(); orPart.PartList.Add(this); orPart.PartList.Add(nextPart); - orPart.PreviousPartAndConnections.AddRange(orPart.PartList); return orPart; @@ -177,6 +178,44 @@ public class ResetCoilPart() : OperandPart(PartType.RESET_COIL) public override bool IsCloser() => true; } + public class MovePart() : SimaticPart(PartType.MOVE) + { + public override string InputConName => "en"; + public override string OutputConName => "eno"; + + public SimaticVariable? IN { get; set; } + public List OUT { get; init; } = []; + + public override Part GetPart(CompileUnit compileUnit) + { + var part = base.GetPart(compileUnit); + + part.TemplateValueName = "Card"; + part.TemplateValueType = "Cardinality"; + part.TemplateValue = OUT.Count.ToString(); + + if(IN != default) + { + compileUnit.CreateWire().CreateIdentCon(IN, part, "in"); + } + + if (OUT.Count > 0) + { + for (int x = 0; x < OUT.Count; x++) + { + var outVariable = OUT[x]; + compileUnit.CreateWire().CreateIdentCon(outVariable, part, "out" + (x + 1)); + } + } + + return part; + } + + public override bool IsCloser() => true; + + public override string ToString() => $"{base.ToString()}, IN=[{IN}], OUT=[{string.Join(" ", OUT)}]"; + } + public class TimerPart(PartType partType) : SimaticPart(partType) { public override string InputConName => "IN"; diff --git a/SimaticML/Blocks/FlagNet/nPart/Part.cs b/SimaticML/Blocks/FlagNet/nPart/Part.cs index b7a0ff6..e7f5124 100644 --- a/SimaticML/Blocks/FlagNet/nPart/Part.cs +++ b/SimaticML/Blocks/FlagNet/nPart/Part.cs @@ -14,6 +14,7 @@ public enum PartType [SimaticEnum("Not")] NOT, [SimaticEnum("TON")] TON, [SimaticEnum("TOF")] TOF, + [SimaticEnum("Move")] MOVE, [SimaticEnum("O")] OR, UNKNOWN = 0 //Default value. Do not implement SimaticEnum so an exception is thrown! } diff --git a/TiaUtilities/DebugRendered.cs b/TiaUtilities/DebugRendered.cs new file mode 100644 index 0000000..60605eb --- /dev/null +++ b/TiaUtilities/DebugRendered.cs @@ -0,0 +1,132 @@ +using Svg; +using System; +using System.Collections.Generic; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TiaUtilities +{ + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + class DebugRenderer : ISvgRenderer + { + private readonly Stack _boundables = new Stack(); + + private Region _clip = new Region(); + private Matrix _transform = new Matrix(); + + public void SetBoundable(ISvgBoundable boundable) + { + _boundables.Push(boundable); + } + public ISvgBoundable GetBoundable() + { + return _boundables.Peek(); + } + public ISvgBoundable PopBoundable() + { + return _boundables.Pop(); + } + + public float DpiY + { + get { return 96; } + } + + public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit graphicsUnit) + { + } + + public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit graphicsUnit, float opacity) + { + } + + public void DrawImageUnscaled(Image image, Point location) + { + } + + public void DrawPath(Pen pen, GraphicsPath path) + { + var newPath = (GraphicsPath)path.Clone(); + newPath.Transform(_transform); + } + + public void FillPath(Brush brush, GraphicsPath path) + { + var newPath = (GraphicsPath)path.Clone(); + newPath.Transform(_transform); + } + + public Region GetClip() + { + return _clip; + } + + public void RotateTransform(float fAngle, MatrixOrder order = MatrixOrder.Append) + { + _transform.Rotate(fAngle, order); + } + + public void ScaleTransform(float sx, float sy, MatrixOrder order = MatrixOrder.Append) + { + _transform.Scale(sx, sy, order); + } + + public void SetClip(Region region, CombineMode combineMode = CombineMode.Replace) + { + switch (combineMode) + { + case CombineMode.Intersect: + _clip.Intersect(region); + break; + case CombineMode.Complement: + _clip.Complement(region); + break; + case CombineMode.Exclude: + _clip.Exclude(region); + break; + case CombineMode.Union: + _clip.Union(region); + break; + case CombineMode.Xor: + _clip.Xor(region); + break; + default: + if (_clip != null) + _clip.Dispose(); + _clip = region; + break; + } + } + public void TranslateTransform(float dx, float dy, MatrixOrder order = MatrixOrder.Append) + { + _transform.Translate(dx, dy, order); + } + + public SmoothingMode SmoothingMode + { + get { return SmoothingMode.Default; } + set { /* Do Nothing */ } + } + + public Matrix Transform + { + get { return _transform?.Clone(); } + set + { + if (_transform != null) + _transform.Dispose(); + _transform = value?.Clone(); + } + } + + public void Dispose() + { + if (_clip != null) + _clip.Dispose(); + if (_transform != null) + _transform.Dispose(); + } + } +} diff --git a/TiaUtilities/Generation/Alarms/AlarmData.cs b/TiaUtilities/Generation/Alarms/AlarmData.cs index a9530ee..d769c69 100644 --- a/TiaUtilities/Generation/Alarms/AlarmData.cs +++ b/TiaUtilities/Generation/Alarms/AlarmData.cs @@ -12,6 +12,8 @@ public class AlarmData : IGridData //THESE IS THE ORDER IN WHICH THEY APPEAR! public static readonly GridDataColumn ENABLE; public static readonly GridDataColumn ALARM_VARIABLE; + public static readonly GridDataColumn CUSTOM_VARIABLE_ADDRESS; + public static readonly GridDataColumn CUSTOM_VARIABLE_VALUE; public static readonly GridDataColumn COIL1_ADDRESS; public static readonly GridDataColumn COIL1_TYPE; public static readonly GridDataColumn COIL2_ADDRESS; @@ -26,7 +28,9 @@ static AlarmData() { var type = typeof(AlarmData); ENABLE = GridDataColumn.GetFromReflection(type, COLUMN_COUNT++, nameof(AlarmData.Enable)); - ALARM_VARIABLE = GridDataColumn.GetFromReflection(type, COLUMN_COUNT++, nameof(AlarmData.AlarmVariable), "alarmVariable"); + ALARM_VARIABLE = GridDataColumn.GetFromReflection(type, COLUMN_COUNT++, nameof(AlarmData.AlarmVariable)); + CUSTOM_VARIABLE_ADDRESS = GridDataColumn.GetFromReflection(type, COLUMN_COUNT++, nameof(AlarmData.CustomVariableAddress), "customVarAddress"); + CUSTOM_VARIABLE_VALUE = GridDataColumn.GetFromReflection(type, COLUMN_COUNT++, nameof(AlarmData.CustomVariableValue), "customVarValue"); COIL1_ADDRESS = GridDataColumn.GetFromReflection(type, COLUMN_COUNT++, nameof(AlarmData.Coil1Address), "coil1Address"); COIL1_TYPE = GridDataColumn.GetFromReflection(type, COLUMN_COUNT++, nameof(AlarmData.Coil1Type), "coil1Type"); COIL2_ADDRESS = GridDataColumn.GetFromReflection(type, COLUMN_COUNT++, nameof(AlarmData.Coil2Address), "coil2Address"); @@ -43,6 +47,8 @@ static AlarmData() [JsonProperty][Locale(nameof(Locale.ALARM_DATA_ENABLE))] public bool Enable { get; set; } [JsonProperty][Locale(nameof(Locale.ALARM_DATA_ALM_VARIABLE))] public string? AlarmVariable { get; set; } + [JsonProperty][Locale(nameof(Locale.ALARM_DATA_CUSTOM_VAR_ADDR))] public string? CustomVariableAddress { get; set; } + [JsonProperty][Locale(nameof(Locale.ALARM_DATA_CUSTOM_VAR_VALUE))] public string? CustomVariableValue { get; set; } [JsonProperty][Locale(nameof(Locale.ALARM_DATA_COIL1_ADDRESS))] public string? Coil1Address { get; set; } [JsonProperty][Locale(nameof(Locale.ALARM_DATA_COIL1_TYPE))] public string? Coil1Type { get; set; } [JsonProperty][Locale(nameof(Locale.ALARM_DATA_COIL2_ADDRESS))] public string? Coil2Address { get; set; } @@ -83,13 +89,14 @@ public static bool IsAddressValid(string? str) public void Clear() { this.Enable = false; - this.AlarmVariable = this.Coil1Address = this.Coil1Type = this.Coil2Address = this.Coil2Type = - this.TimerAddress = this.TimerType = this.TimerValue = this.Description = null; + this.AlarmVariable = this.CustomVariableAddress = this.CustomVariableValue = this.Coil1Address = this.Coil1Type + = this.Coil2Address = this.Coil2Type = this.TimerAddress = this.TimerType = this.TimerValue = this.Description = null; } public bool IsEmpty() { return string.IsNullOrEmpty(this.AlarmVariable) && + string.IsNullOrEmpty(this.CustomVariableAddress) && string.IsNullOrEmpty(this.CustomVariableValue) && string.IsNullOrEmpty(this.Coil1Address) && string.IsNullOrEmpty(this.Coil1Type) && string.IsNullOrEmpty(this.Coil2Address) && string.IsNullOrEmpty(this.Coil2Type) && string.IsNullOrEmpty(this.TimerAddress) && string.IsNullOrEmpty(this.TimerType) && string.IsNullOrEmpty(this.TimerValue) && diff --git a/TiaUtilities/Generation/Alarms/AlarmTabConfiguration.cs b/TiaUtilities/Generation/Alarms/AlarmTabConfiguration.cs index 462545e..9b68955 100644 --- a/TiaUtilities/Generation/Alarms/AlarmTabConfiguration.cs +++ b/TiaUtilities/Generation/Alarms/AlarmTabConfiguration.cs @@ -22,6 +22,8 @@ public class AlarmTabConfiguration : ObservableConfiguration [JsonProperty] public string EmptyAlarmTimerType { get => this.GetAs(); set => this.Set(value); } [JsonProperty] public string EmptyAlarmTimerValue { get => this.GetAs(); set => this.Set(value); } + [JsonProperty] public string DefaultCustomVarAddress { get => this.GetAs(); set => this.Set(value); } + [JsonProperty] public string DefaultCustomVarValue { get => this.GetAs(); set => this.Set(value); } [JsonProperty] public string DefaultCoil1Address { get => this.GetAs(); set => this.Set(value); } [JsonProperty] public AlarmCoilType DefaultCoil1Type { get => this.GetAs(); set => this.Set(value); } [JsonProperty] public string DefaultCoil2Address { get => this.GetAs(); set => this.Set(value); } @@ -52,6 +54,8 @@ public AlarmTabConfiguration() this.EmptyAlarmTimerType = "TON"; this.EmptyAlarmTimerValue = "T#0s"; + this.DefaultCustomVarAddress = $"Alm.Level[{GenPlaceholders.Alarms.ALARM_NUM}]"; + this.DefaultCustomVarValue = "0"; this.DefaultCoil1Address = $"Alm.Act.Alm{GenPlaceholders.Alarms.ALARM_NUM}"; this.DefaultCoil1Type = AlarmCoilType.COIL; this.DefaultCoil2Address = $"Alm.Mem.Alm{GenPlaceholders.Alarms.ALARM_NUM}"; diff --git a/TiaUtilities/Generation/Alarms/AlarmXmlGenerator.cs b/TiaUtilities/Generation/Alarms/AlarmXmlGenerator.cs index a63a869..815d6e3 100644 --- a/TiaUtilities/Generation/Alarms/AlarmXmlGenerator.cs +++ b/TiaUtilities/Generation/Alarms/AlarmXmlGenerator.cs @@ -283,6 +283,8 @@ private static AlarmData ReplaceAlarmDataWithDefaultAndPrefix(AlarmTabConfigurat return new AlarmData() { AlarmVariable = tabConfig.AlarmAddressPrefix + alarmData.AlarmVariable, + CustomVariableAddress = string.IsNullOrEmpty(alarmData.CustomVariableAddress) ? tabConfig.DefaultCustomVarAddress : alarmData.CustomVariableAddress, + CustomVariableValue = string.IsNullOrEmpty(alarmData.CustomVariableValue) ? tabConfig.DefaultCustomVarValue : alarmData.CustomVariableValue, Coil1Address = string.IsNullOrEmpty(alarmData.Coil1Address) ? tabConfig.DefaultCoil1Address : (tabConfig.Coil1AddressPrefix + alarmData.Coil1Address), Coil1Type = coil1Type.ToString(), Coil2Address = string.IsNullOrEmpty(alarmData.Coil2Address) ? tabConfig.DefaultCoil2Address : (tabConfig.Coil2AddressPrefix + alarmData.Coil2Address), @@ -304,7 +306,7 @@ private static void FillAlarmSegment(AlarmTabConfiguration tabConfig, SimaticLAD } var parsedContactAddress = placeholders.Parse(alarmData.AlarmVariable); - var contact = new ContactPart() + SimaticPart contact = new ContactPart() { Operand = parsedContactAddress.ToLower() switch { @@ -316,6 +318,33 @@ private static void FillAlarmSegment(AlarmTabConfiguration tabConfig, SimaticLAD } }; + var parsedCustomVarAddress = placeholders.Parse(alarmData.CustomVariableAddress); + var parsedCustomVarValue = placeholders.Parse(alarmData.CustomVariableValue); + if (!string.IsNullOrEmpty(parsedCustomVarAddress) && AlarmData.IsAddressValid(parsedCustomVarAddress) + && !string.IsNullOrEmpty(parsedCustomVarValue) && AlarmData.IsAddressValid(parsedCustomVarValue)) + { + + SimaticVariable inVar; + if (parsedCustomVarValue.Contains('.') && float.TryParse(parsedCustomVarValue, out _)) + { + inVar = new SimaticLiteralConstant(SimaticDataType.REAL, parsedCustomVarValue); + } + else if (long.TryParse(parsedCustomVarValue, out _)) + { + inVar = new SimaticLiteralConstant(SimaticDataType.DINT, parsedCustomVarValue); + } + else + { + inVar = new SimaticTypedConstant(parsedCustomVarValue); + } + + contact.Branch(new MovePart() + { + IN = inVar, + OUT = { new SimaticGlobalVariable(parsedCustomVarAddress) } + }); + } + TimerPart? timer = null; if (!string.IsNullOrEmpty(alarmData.TimerAddress) && !string.IsNullOrEmpty(alarmData.TimerType) diff --git a/TiaUtilities/Generation/Alarms/Module/Tab/AlarmGenTab.cs b/TiaUtilities/Generation/Alarms/Module/Tab/AlarmGenTab.cs index d691fe3..a8d981a 100644 --- a/TiaUtilities/Generation/Alarms/Module/Tab/AlarmGenTab.cs +++ b/TiaUtilities/Generation/Alarms/Module/Tab/AlarmGenTab.cs @@ -67,6 +67,8 @@ public void Init() alarmGridHandler.AddCheckBoxColumn(AlarmData.ENABLE, 40); alarmGridHandler.AddTextBoxColumn(AlarmData.ALARM_VARIABLE, 200); + alarmGridHandler.AddTextBoxColumn(AlarmData.CUSTOM_VARIABLE_ADDRESS, 145); + alarmGridHandler.AddTextBoxColumn(AlarmData.CUSTOM_VARIABLE_VALUE, 50); alarmGridHandler.AddTextBoxColumn(AlarmData.COIL1_ADDRESS, 145); alarmGridHandler.AddComboBoxColumn(AlarmData.COIL1_TYPE, 55, ALARM_COIL_TYPE_ITEMS); alarmGridHandler.AddTextBoxColumn(AlarmData.COIL2_ADDRESS, 145); @@ -95,6 +97,14 @@ public void Init() { return new() { Prefix = TabConfig.AlarmAddressPrefix, Value = alarmData.AlarmVariable }; } + else if(column == AlarmData.CUSTOM_VARIABLE_ADDRESS) + { + return new() { DefaultValue = TabConfig.DefaultCustomVarAddress, Value = alarmData.CustomVariableAddress }; + } + else if (column == AlarmData.CUSTOM_VARIABLE_VALUE) + { + return new() { DefaultValue = TabConfig.DefaultCustomVarValue, Value = alarmData.CustomVariableValue }; + } else if (column == AlarmData.COIL1_ADDRESS) { return new() { Prefix = TabConfig.Coil1AddressPrefix, DefaultValue = TabConfig.DefaultCoil1Address, Value = alarmData.Coil1Address }; diff --git a/TiaUtilities/Generation/Alarms/Module/Tab/AlarmGenTabControl.cs b/TiaUtilities/Generation/Alarms/Module/Tab/AlarmGenTabControl.cs index 21219d4..0c985e0 100644 --- a/TiaUtilities/Generation/Alarms/Module/Tab/AlarmGenTabControl.cs +++ b/TiaUtilities/Generation/Alarms/Module/Tab/AlarmGenTabControl.cs @@ -119,7 +119,12 @@ public void BindConfig(AlarmTabConfiguration tabConfig) configForm.SetConfiguration(tabConfig, MainForm.Settings.PresetAlarmTabConfiguration); var mainGroup = configForm.Init(); - + + var customVarGroup = mainGroup.AddGroup().ControlWidth(225).NoAdapt(); + customVarGroup.AddLabel().Label(Locale.ALARM_CONFIG_DEFAULTS_CUSTOM_VAR); + customVarGroup.AddTextBox().Label(Locale.GENERICS_ADDRESS).BindText(() => tabConfig.DefaultCustomVarAddress); + customVarGroup.AddTextBox().Label(Locale.GENERICS_VALUE).BindText(() => tabConfig.DefaultCustomVarValue); + var coil1Group = mainGroup.AddGroup().ControlWidth(225).NoAdapt(); coil1Group.AddLabel().Label(Locale.ALARM_CONFIG_DEFAULTS_COIL1); coil1Group.AddTextBox().Label(Locale.GENERICS_ADDRESS).BindText(() => tabConfig.DefaultCoil1Address); @@ -139,8 +144,7 @@ public void BindConfig(AlarmTabConfiguration tabConfig) var timerGroup = mainGroup.AddGroup().ControlWidth(225).NoAdapt(); timerGroup.AddLabel().Label(Locale.ALARM_CONFIG_DEFAULTS_TIMER); timerGroup.AddTextBox().Label(Locale.GENERICS_ADDRESS).BindText(() => tabConfig.DefaultTimerAddress); - timerGroup.AddComboBox().Label(Locale.GENERICS_TYPE).BindText(() => tabConfig.DefaultTimerType) - .Items(["TON", "TOF"]).DisableEdit(); + timerGroup.AddComboBox().Label(Locale.GENERICS_TYPE).BindText(() => tabConfig.DefaultTimerType).Items(["TON", "TOF"]).DisableEdit(); timerGroup.AddTextBox().Label(Locale.GENERICS_VALUE).BindText(() => tabConfig.DefaultTimerValue); SetupConfigForm(button, configForm); diff --git a/TiaUtilities/Generation/Configuration/ConfigGroup.cs b/TiaUtilities/Generation/Configuration/ConfigGroup.cs index 9a59b1b..4793a4b 100644 --- a/TiaUtilities/Generation/Configuration/ConfigGroup.cs +++ b/TiaUtilities/Generation/Configuration/ConfigGroup.cs @@ -1,8 +1,9 @@ using TiaUtilities.Generation.Configuration; +using TiaUtilities.Generation.Configuration.Lines; namespace TiaXmlReader.Generation.Configuration { - public class ConfigGroup(ConfigForm? configForm) : IConfigGroup + public class ConfigGroup(ConfigForm configForm) : IConfigGroup { private readonly List configObjectList = []; @@ -11,13 +12,6 @@ public class ConfigGroup(ConfigForm? configForm) : IConfigGroup public bool IsSubGroup { get; set; } = false; - /* - public Font LabelFont { get; set; } = ConfigStyle.LABEL_FONT; - public Font ControlFont { get; set; } = ConfigStyle.CONTROL_FONT; - public int ControlWidth { get; set; } = 300; - public int ControlHeight { get; set; } = 30; - */ - public ConfigForm GetConfigForm() { return configForm; @@ -125,17 +119,21 @@ private void BuildLineTableLayout(IConfigLine line, TableLayoutPanel panel, ref Text = labelText, Padding = Padding.Empty, Margin = Padding.Empty, + AutoEllipsis = true, Font = line.GetLabelFont() ?? configForm?.LabelFont ?? ConfigStyle.LABEL_FONT }; panel.Controls.Add(label); line.GetLabelText().Changed += (sender, args) => label.Text = args.NewValue; - var size = TextRenderer.MeasureText(labelText, label.Font); - size.Width += 4; //Padding - if (size.Width > biggestTitleLength) - { - biggestTitleLength = size.Width; + if(line is not ConfigLabelLine) + {//For the biggest title, you need to consider only the lines that have A ACTIVE CONTROL! Lines that only contains the label are not counted! + var size = TextRenderer.MeasureText(labelText, label.Font); + size.Width += 4; //Padding + if (size.Width > biggestTitleLength) + { + biggestTitleLength = size.Width; + } } } @@ -167,6 +165,7 @@ private void BuildLineTableLayout(IConfigLine line, TableLayoutPanel panel, ref control.Width = this.controlWidth == 0 ? (configForm?.ControlWidth ?? 300) : this.controlWidth; control.Height = line.GetHeight() == 0 ? (configForm?.ControlHeight ?? 30) : line.GetHeight(); + control.Dock = line.IsControlNoAdapt() ? DockStyle.None : DockStyle.Fill; control.Font = configForm?.ControlFont ?? ConfigStyle.CONTROL_FONT; panel.Controls.Add(control); diff --git a/TiaUtilities/Languages/Locale.Designer.cs b/TiaUtilities/Languages/Locale.Designer.cs index 79fe805..6da2047 100644 --- a/TiaUtilities/Languages/Locale.Designer.cs +++ b/TiaUtilities/Languages/Locale.Designer.cs @@ -150,6 +150,15 @@ internal static string ALARM_CONFIG_DEFAULTS_COIL2 { } } + /// + /// Cerca una stringa localizzata simile a Custom numeric variable. + /// + internal static string ALARM_CONFIG_DEFAULTS_CUSTOM_VAR { + get { + return ResourceManager.GetString("ALARM_CONFIG_DEFAULTS_CUSTOM_VAR", resourceCulture); + } + } + /// /// Cerca una stringa localizzata simile a Timer. /// @@ -519,6 +528,24 @@ internal static string ALARM_DATA_COIL2_TYPE { } } + /// + /// Cerca una stringa localizzata simile a Custom Var.. + /// + internal static string ALARM_DATA_CUSTOM_VAR_ADDR { + get { + return ResourceManager.GetString("ALARM_DATA_CUSTOM_VAR_ADDR", resourceCulture); + } + } + + /// + /// Cerca una stringa localizzata simile a Value. + /// + internal static string ALARM_DATA_CUSTOM_VAR_VALUE { + get { + return ResourceManager.GetString("ALARM_DATA_CUSTOM_VAR_VALUE", resourceCulture); + } + } + /// /// Cerca una stringa localizzata simile a Description. /// diff --git a/TiaUtilities/Languages/Locale.it.resx b/TiaUtilities/Languages/Locale.it.resx index f66ef4f..646f99f 100644 --- a/TiaUtilities/Languages/Locale.it.resx +++ b/TiaUtilities/Languages/Locale.it.resx @@ -276,6 +276,9 @@ Variabile allarme + + Var. custom + Indirizzo bobina1 @@ -535,4 +538,10 @@ validità riga N-Coil + + Value + + + Variabile numerica custom + \ No newline at end of file diff --git a/TiaUtilities/Languages/Locale.resx b/TiaUtilities/Languages/Locale.resx index 1bfbdbc..5cad398 100644 --- a/TiaUtilities/Languages/Locale.resx +++ b/TiaUtilities/Languages/Locale.resx @@ -307,6 +307,12 @@ for row validation Alarm Variable + + Custom Var. + + + Value + Coil1 Address @@ -535,4 +541,7 @@ for row validation N-Coil + + Custom numeric variable + \ No newline at end of file diff --git a/TiaUtilities/MainForm.Designer.cs b/TiaUtilities/MainForm.Designer.cs index 4bf0f90..ddeedaf 100644 --- a/TiaUtilities/MainForm.Designer.cs +++ b/TiaUtilities/MainForm.Designer.cs @@ -46,6 +46,7 @@ private void InitializeComponent() jSToolStripMenuItem = new ToolStripMenuItem(); sampleXMLMenuItem = new ToolStripMenuItem(); testProjectMenuItem = new ToolStripMenuItem(); + svgToolStripMenuItem = new ToolStripMenuItem(); languageLabel = new Label(); languageComboBox = new ComboBox(); LogWorker = new System.ComponentModel.BackgroundWorker(); @@ -164,7 +165,7 @@ private void InitializeComponent() // // testToolStripMenuItem // - testToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { importXMLToolStripMenuItem, jSToolStripMenuItem, sampleXMLMenuItem, testProjectMenuItem }); + testToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { importXMLToolStripMenuItem, jSToolStripMenuItem, sampleXMLMenuItem, testProjectMenuItem, svgToolStripMenuItem }); testToolStripMenuItem.Font = new Font("Segoe UI", 12F); testToolStripMenuItem.Name = "testToolStripMenuItem"; testToolStripMenuItem.Size = new Size(48, 25); @@ -173,30 +174,37 @@ private void InitializeComponent() // importXMLToolStripMenuItem // importXMLToolStripMenuItem.Name = "importXMLToolStripMenuItem"; - importXMLToolStripMenuItem.Size = new Size(167, 26); + importXMLToolStripMenuItem.Size = new Size(180, 26); importXMLToolStripMenuItem.Text = "Import XML"; importXMLToolStripMenuItem.Click += ImportXMLToolStripMenuItem_Click; // // jSToolStripMenuItem // jSToolStripMenuItem.Name = "jSToolStripMenuItem"; - jSToolStripMenuItem.Size = new Size(167, 26); + jSToolStripMenuItem.Size = new Size(180, 26); jSToolStripMenuItem.Text = "JS"; jSToolStripMenuItem.Click += JSToolStripMenuItem_Click; // // sampleXMLMenuItem // sampleXMLMenuItem.Name = "sampleXMLMenuItem"; - sampleXMLMenuItem.Size = new Size(167, 26); + sampleXMLMenuItem.Size = new Size(180, 26); sampleXMLMenuItem.Text = "Sample XML"; sampleXMLMenuItem.Click += SampleXMLMenuItem_Click; // // testProjectMenuItem // testProjectMenuItem.Name = "testProjectMenuItem"; - testProjectMenuItem.Size = new Size(167, 26); + testProjectMenuItem.Size = new Size(180, 26); testProjectMenuItem.Text = "Project"; // + // svgToolStripMenuItem + // + svgToolStripMenuItem.Name = "svgToolStripMenuItem"; + svgToolStripMenuItem.Size = new Size(180, 26); + svgToolStripMenuItem.Text = "Svg"; + svgToolStripMenuItem.Click += SvgToolStripMenuItem_Click; + // // languageLabel // languageLabel.AutoSize = true; @@ -305,6 +313,7 @@ private void InitializeComponent() private ToolStripMenuItem sampleXMLMenuItem; private ToolStripMenuItem testProjectMenuItem; private ToolStripMenuItem loadToolStripMenuItem; + private ToolStripMenuItem svgToolStripMenuItem; } } diff --git a/TiaUtilities/MainForm.cs b/TiaUtilities/MainForm.cs index 31602e9..176b156 100644 --- a/TiaUtilities/MainForm.cs +++ b/TiaUtilities/MainForm.cs @@ -176,7 +176,7 @@ private void LoadToolStripMenuItem_Click(object sender, EventArgs e) { genForm = OpenIOGenModuleForm(); } - else if(saveObject is AlarmGenSave) + else if (saveObject is AlarmGenSave) { genForm = OpenAlarmGenModuleForm(); } @@ -377,6 +377,12 @@ private void SampleXMLMenuItem_Click(object sender, EventArgs e) //Save the file. //xmlDocument.Save(Directory.GetCurrentDirectory() + "/fc.xml"); } + + private void SvgToolStripMenuItem_Click(object sender, EventArgs e) + { + SvgTestForm svgTestForm = new(); + svgTestForm.Show(this); + } } } diff --git a/TiaUtilities/MainForm.resx b/TiaUtilities/MainForm.resx index 085f418..a4b74c1 100644 --- a/TiaUtilities/MainForm.resx +++ b/TiaUtilities/MainForm.resx @@ -1,7 +1,7 @@  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TiaUtilities/TiaUtilities.csproj b/TiaUtilities/TiaUtilities.csproj index 3f70d16..ece464b 100644 --- a/TiaUtilities/TiaUtilities.csproj +++ b/TiaUtilities/TiaUtilities.csproj @@ -28,6 +28,7 @@ +