diff --git a/MobiFlight/ExecutionManager.cs b/MobiFlight/ExecutionManager.cs index 801ebfd67..7fe5a416d 100644 --- a/MobiFlight/ExecutionManager.cs +++ b/MobiFlight/ExecutionManager.cs @@ -599,6 +599,11 @@ private ConnectorValue ExecuteRead(OutputConfigItem cfg) result = ExecuteReadFloat(cfg); } } + else if (cfg.SourceType == SourceType.VARIABLE) + { + result.type = FSUIPCOffsetType.Float; + result.Float64 = mobiFlightCache.GetMobiFlightVariable(cfg.MobiFlightVariable.Name).Number; + } else { result.type = FSUIPCOffsetType.Float; @@ -1425,6 +1430,12 @@ void mobiFlightCache_OnButtonPressed(object sender, InputEventArgs e) foreach (Tuple tuple in inputCache[inputKey]) { + if ((tuple.Item2.DataBoundItem as DataRowView) == null) + { + Log.Instance.log("mobiFlightCache_OnButtonPressed: tuple.Item2.DataBoundItem is NULL", LogSeverity.Debug); + continue; + } + DataRow row = (tuple.Item2.DataBoundItem as DataRowView).Row; if (!(bool)row["active"]) continue; diff --git a/MobiFlight/InputConfig/VariableInputAction.cs b/MobiFlight/InputConfig/VariableInputAction.cs index 31b58b604..cd8984ba5 100644 --- a/MobiFlight/InputConfig/VariableInputAction.cs +++ b/MobiFlight/InputConfig/VariableInputAction.cs @@ -50,13 +50,20 @@ public override void execute(FSUIPC.FSUIPCCacheInterface fsuipcCache, List> replacements = new List>(); + if (result.Contains("@")) + { + Tuple replacement = new Tuple("@", args.Value.ToString()); + replacements.Add(replacement); + } + if (result.Contains("$")) { - Tuple replacement = new Tuple("$", args.Value.ToString()); + MobiFlightVariable variable = moduleCache.GetMobiFlightVariable(Variable.Name); + Tuple replacement = new Tuple("$", variable.TYPE == "number" ? variable.Number.ToString() : variable.Text); replacements.Add(replacement); } - + foreach (ConfigRefValue item in configRefs) { Tuple replacement = new Tuple(item.ConfigRef.Placeholder, item.Value); diff --git a/MobiFlight/MobiFlightCache.cs b/MobiFlight/MobiFlightCache.cs index 1f4ae0fe9..ab50e208e 100644 --- a/MobiFlight/MobiFlightCache.cs +++ b/MobiFlight/MobiFlightCache.cs @@ -738,5 +738,10 @@ public MobiFlightVariable GetMobiFlightVariable(String name) return variables[name]; } + + public List GetMobiFlightVariableNames() + { + return variables.Keys.ToList(); + } } } diff --git a/MobiFlight/MobiFlightVariable.cs b/MobiFlight/MobiFlightVariable.cs index 1f7827d78..a36b00294 100644 --- a/MobiFlight/MobiFlightVariable.cs +++ b/MobiFlight/MobiFlightVariable.cs @@ -1,4 +1,7 @@ -namespace MobiFlight +using System; +using System.Xml; + +namespace MobiFlight { public class MobiFlightVariable { @@ -19,5 +22,21 @@ public object Clone() return clone; } + + + public void ReadXml(System.Xml.XmlReader reader) + { + TYPE = reader["varType"]; + Name = reader["varName"]; + Expression = reader["varExpression"]; + } + + public void WriteXml(System.Xml.XmlWriter writer) + { + writer.WriteAttributeString("type", "Variable"); + writer.WriteAttributeString("varType", TYPE); + writer.WriteAttributeString("varName", Name); + writer.WriteAttributeString("varExpression", Expression); + } } } \ No newline at end of file diff --git a/MobiFlight/OutputConfigItem.cs b/MobiFlight/OutputConfigItem.cs index cf8ba8e61..c4612ef8b 100644 --- a/MobiFlight/OutputConfigItem.cs +++ b/MobiFlight/OutputConfigItem.cs @@ -27,6 +27,9 @@ public class OutputConfigItem : IBaseConfigItem, IFsuipcConfigItem, IXmlSerializ public SimConnectValue SimConnectValue { get; set; } + public MobiFlightVariable + MobiFlightVariable { get; set; } + public Transformation Transform { get; set; } public string Value { get; set; } @@ -90,6 +93,7 @@ public OutputConfigItem() SourceType = SourceType.FSUIPC; FSUIPC = new FsuipcOffset(); SimConnectValue = new SimConnectValue(); + MobiFlightVariable = new MobiFlightVariable(); Transform = new Transformation(); @@ -138,6 +142,10 @@ public virtual void ReadXml(XmlReader reader) if (reader["type"]=="SimConnect") { SourceType = SourceType.SIMCONNECT; this.SimConnectValue.ReadXml(reader); + } else if (reader["type"] == "Variable") + { + SourceType = SourceType.VARIABLE; + this.MobiFlightVariable.ReadXml(reader); } else { @@ -378,6 +386,8 @@ public virtual void WriteXml(XmlWriter writer) writer.WriteStartElement("source"); if(SourceType==SourceType.FSUIPC) this.FSUIPC.WriteXml(writer); + else if (SourceType == SourceType.VARIABLE) + this.MobiFlightVariable.WriteXml(writer); else this.SimConnectValue.WriteXml(writer); writer.WriteEndElement(); @@ -481,6 +491,7 @@ public object Clone() clone.SourceType = this.SourceType; clone.FSUIPC = this.FSUIPC.Clone() as FsuipcOffset; clone.SimConnectValue = this.SimConnectValue.Clone() as SimConnectValue; + clone.MobiFlightVariable = this.MobiFlightVariable.Clone() as MobiFlightVariable; clone.Transform = this.Transform.Clone() as Transformation; clone.ComparisonActive = this.ComparisonActive; @@ -543,6 +554,7 @@ public object Clone() public enum SourceType { FSUIPC, - SIMCONNECT + SIMCONNECT, + VARIABLE } } diff --git a/MobiFlightConnector.csproj b/MobiFlightConnector.csproj index 74e43694a..77ba771ea 100644 --- a/MobiFlightConnector.csproj +++ b/MobiFlightConnector.csproj @@ -255,6 +255,12 @@ MSFS2020InputPanel.cs + + UserControl + + + VariablePanel.cs + UserControl @@ -779,6 +785,9 @@ TransformOptionsGroup.cs + + VariablePanel.cs + MFAnalogPanel.cs diff --git a/UI/Dialogs/ConfigWizard.Designer.cs b/UI/Dialogs/ConfigWizard.Designer.cs index 580a28d7f..433907ef0 100644 --- a/UI/Dialogs/ConfigWizard.Designer.cs +++ b/UI/Dialogs/ConfigWizard.Designer.cs @@ -34,15 +34,21 @@ private void InitializeComponent() this.tabControlFsuipc = new System.Windows.Forms.TabControl(); this.fsuipcTabPage = new System.Windows.Forms.TabPage(); this.referencesGroupBox = new System.Windows.Forms.GroupBox(); + this.configRefPanel = new MobiFlight.UI.Panels.Config.ConfigRefPanel(); + this.variablePanel1 = new MobiFlight.UI.Panels.Config.VariablePanel(); + this.simConnectPanel1 = new MobiFlight.UI.Panels.Config.SimConnectPanel(); this.FsuipcSettingsPanel = new System.Windows.Forms.Panel(); + this.fsuipcConfigPanel = new MobiFlight.UI.Panels.Config.FsuipcConfigPanel(); this.fsuipcHintTextBox = new System.Windows.Forms.TextBox(); this.OffsetTypePanel = new System.Windows.Forms.Panel(); + this.OffsetTypeVariableRadioButton = new System.Windows.Forms.RadioButton(); this.textBox1 = new System.Windows.Forms.TextBox(); this.OffsetTypeSimConnectRadioButton = new System.Windows.Forms.RadioButton(); this.OffsetTypeFsuipRadioButton = new System.Windows.Forms.RadioButton(); this.compareTabPage = new System.Windows.Forms.TabPage(); this.compareSpacerPanel = new System.Windows.Forms.Panel(); this.interpolationGroupBox = new System.Windows.Forms.GroupBox(); + this.interpolationPanel1 = new MobiFlight.UI.Panels.Config.InterpolationPanel(); this.interpolationCheckBox = new System.Windows.Forms.CheckBox(); this.comparisonSettingsGroupBox = new System.Windows.Forms.GroupBox(); this.comparisonSettingsPanel = new System.Windows.Forms.Panel(); @@ -111,10 +117,6 @@ private void InitializeComponent() this.presetsDataSet = new System.Data.DataSet(); this.presetDataTable = new System.Data.DataTable(); this.description = new System.Data.DataColumn(); - this.configRefPanel = new MobiFlight.UI.Panels.Config.ConfigRefPanel(); - this.simConnectPanel1 = new MobiFlight.UI.Panels.Config.SimConnectPanel(); - this.fsuipcConfigPanel = new MobiFlight.UI.Panels.Config.FsuipcConfigPanel(); - this.interpolationPanel1 = new MobiFlight.UI.Panels.Config.InterpolationPanel(); this.settingsColumn = new System.Data.DataColumn(); this.MainPanel.SuspendLayout(); this.tabControlFsuipc.SuspendLayout(); @@ -163,6 +165,7 @@ private void InitializeComponent() // fsuipcTabPage // this.fsuipcTabPage.Controls.Add(this.referencesGroupBox); + this.fsuipcTabPage.Controls.Add(this.variablePanel1); this.fsuipcTabPage.Controls.Add(this.simConnectPanel1); this.fsuipcTabPage.Controls.Add(this.FsuipcSettingsPanel); this.fsuipcTabPage.Controls.Add(this.OffsetTypePanel); @@ -182,9 +185,15 @@ private void InitializeComponent() resources.ApplyResources(this.configRefPanel, "configRefPanel"); this.configRefPanel.Name = "configRefPanel"; // + // variablePanel1 + // + resources.ApplyResources(this.variablePanel1, "variablePanel1"); + this.variablePanel1.Name = "variablePanel1"; + // // simConnectPanel1 // resources.ApplyResources(this.simConnectPanel1, "simConnectPanel1"); + this.simConnectPanel1.LVars = ((System.Collections.Generic.List)(resources.GetObject("simConnectPanel1.LVars"))); this.simConnectPanel1.Name = "simConnectPanel1"; this.simConnectPanel1.PresetFile = "Presets\\msfs2020_simvars.cip"; this.simConnectPanel1.PresetFileUser = "Presets\\msfs2020_simvars_user.cip"; @@ -196,6 +205,12 @@ private void InitializeComponent() resources.ApplyResources(this.FsuipcSettingsPanel, "FsuipcSettingsPanel"); this.FsuipcSettingsPanel.Name = "FsuipcSettingsPanel"; // + // fsuipcConfigPanel + // + resources.ApplyResources(this.fsuipcConfigPanel, "fsuipcConfigPanel"); + this.fsuipcConfigPanel.Name = "fsuipcConfigPanel"; + this.fsuipcConfigPanel.PresetFile = ""; + // // fsuipcHintTextBox // this.fsuipcHintTextBox.BackColor = System.Drawing.SystemColors.ControlLightLight; @@ -208,12 +223,21 @@ private void InitializeComponent() // // OffsetTypePanel // + this.OffsetTypePanel.Controls.Add(this.OffsetTypeVariableRadioButton); this.OffsetTypePanel.Controls.Add(this.textBox1); this.OffsetTypePanel.Controls.Add(this.OffsetTypeSimConnectRadioButton); this.OffsetTypePanel.Controls.Add(this.OffsetTypeFsuipRadioButton); resources.ApplyResources(this.OffsetTypePanel, "OffsetTypePanel"); this.OffsetTypePanel.Name = "OffsetTypePanel"; // + // OffsetTypeVariableRadioButton + // + resources.ApplyResources(this.OffsetTypeVariableRadioButton, "OffsetTypeVariableRadioButton"); + this.OffsetTypeVariableRadioButton.Name = "OffsetTypeVariableRadioButton"; + this.OffsetTypeVariableRadioButton.TabStop = true; + this.OffsetTypeVariableRadioButton.UseVisualStyleBackColor = true; + this.OffsetTypeVariableRadioButton.CheckedChanged += new System.EventHandler(this.OffsetTypeFsuipRadioButton_CheckedChanged); + // // textBox1 // this.textBox1.BackColor = System.Drawing.SystemColors.ControlLightLight; @@ -263,6 +287,12 @@ private void InitializeComponent() this.interpolationGroupBox.Name = "interpolationGroupBox"; this.interpolationGroupBox.TabStop = false; // + // interpolationPanel1 + // + resources.ApplyResources(this.interpolationPanel1, "interpolationPanel1"); + this.interpolationPanel1.Name = "interpolationPanel1"; + this.interpolationPanel1.Save = false; + // // interpolationCheckBox // resources.ApplyResources(this.interpolationCheckBox, "interpolationCheckBox"); @@ -802,31 +832,6 @@ private void InitializeComponent() // this.description.ColumnName = "description"; // - // configRefPanel - // - resources.ApplyResources(this.configRefPanel, "configRefPanel"); - this.configRefPanel.Name = "configRefPanel"; - // - // simConnectPanel1 - // - resources.ApplyResources(this.simConnectPanel1, "simConnectPanel1"); - this.simConnectPanel1.LVars = ((System.Collections.Generic.List)(resources.GetObject("simConnectPanel1.LVars"))); - this.simConnectPanel1.Name = "simConnectPanel1"; - this.simConnectPanel1.PresetFile = "Presets\\msfs2020_simvars.cip"; - this.simConnectPanel1.PresetFileUser = "Presets\\msfs2020_simvars_user.cip"; - // - // fsuipcConfigPanel - // - resources.ApplyResources(this.fsuipcConfigPanel, "fsuipcConfigPanel"); - this.fsuipcConfigPanel.Name = "fsuipcConfigPanel"; - this.fsuipcConfigPanel.PresetFile = ""; - // - // interpolationPanel1 - // - resources.ApplyResources(this.interpolationPanel1, "interpolationPanel1"); - this.interpolationPanel1.Name = "interpolationPanel1"; - this.interpolationPanel1.Save = false; - // // settingsColumn // this.settingsColumn.Caption = "settings"; @@ -849,6 +854,7 @@ private void InitializeComponent() this.MainPanel.ResumeLayout(false); this.tabControlFsuipc.ResumeLayout(false); this.fsuipcTabPage.ResumeLayout(false); + this.fsuipcTabPage.PerformLayout(); this.referencesGroupBox.ResumeLayout(false); this.FsuipcSettingsPanel.ResumeLayout(false); this.FsuipcSettingsPanel.PerformLayout(); @@ -977,5 +983,7 @@ private void InitializeComponent() private System.Windows.Forms.RadioButton OffsetTypeSimConnectRadioButton; private System.Windows.Forms.RadioButton OffsetTypeFsuipRadioButton; private Panels.Config.SimConnectPanel simConnectPanel1; + private System.Windows.Forms.RadioButton OffsetTypeVariableRadioButton; + private Panels.Config.VariablePanel variablePanel1; } } \ No newline at end of file diff --git a/UI/Dialogs/ConfigWizard.cs b/UI/Dialogs/ConfigWizard.cs index 85f6418ec..a6f3bdec4 100644 --- a/UI/Dialogs/ConfigWizard.cs +++ b/UI/Dialogs/ConfigWizard.cs @@ -433,9 +433,12 @@ private void _syncFsuipcTabFromConfig(OutputConfigItem config) { OffsetTypeFsuipRadioButton.Checked = (config.SourceType == SourceType.FSUIPC); OffsetTypeSimConnectRadioButton.Checked = (config.SourceType == SourceType.SIMCONNECT); + OffsetTypeVariableRadioButton.Checked = (config.SourceType == SourceType.VARIABLE); fsuipcConfigPanel.syncFromConfig(config); + simConnectPanel1.syncFromConfig(config); + variablePanel1.syncFromConfig(config); configRefPanel.syncFromConfig(config); } @@ -458,12 +461,16 @@ private void _addEmptyNodeToTreeView() /// protected bool _syncFormToConfig() { - config.SourceType = OffsetTypeFsuipRadioButton.Checked ? SourceType.FSUIPC : SourceType.SIMCONNECT; + config.SourceType = SourceType.FSUIPC; + if (OffsetTypeSimConnectRadioButton.Checked) config.SourceType = SourceType.SIMCONNECT; + if (OffsetTypeVariableRadioButton.Checked) config.SourceType = SourceType.VARIABLE; - if(config.SourceType==SourceType.FSUIPC) + if (config.SourceType == SourceType.FSUIPC) fsuipcConfigPanel.syncToConfig(config); - else + else if (config.SourceType == SourceType.SIMCONNECT) simConnectPanel1.syncToConfig(config); + else if (config.SourceType == SourceType.VARIABLE) + variablePanel1.syncToConfig(config); configRefPanel.syncToConfig(config); @@ -1362,6 +1369,7 @@ private void OffsetTypeFsuipRadioButton_CheckedChanged(object sender, EventArgs { FsuipcSettingsPanel.Visible = (sender as RadioButton) == OffsetTypeFsuipRadioButton; simConnectPanel1.Visible = (sender as RadioButton) == OffsetTypeSimConnectRadioButton; + variablePanel1.Visible = (sender as RadioButton) == OffsetTypeVariableRadioButton; } private void ConfigWizard_FormClosing(object sender, FormClosingEventArgs e) diff --git a/UI/Dialogs/ConfigWizard.resx b/UI/Dialogs/ConfigWizard.resx index 7dc329c13..2d9d71688 100644 --- a/UI/Dialogs/ConfigWizard.resx +++ b/UI/Dialogs/ConfigWizard.resx @@ -123,16 +123,16 @@ - 4, 24 + 3, 16 - 6, 8, 6, 8 + 4, 5, 4, 5 - 8, 0, 8, 0 + 5, 0, 5, 0 - 634, 0 + 525, 0 @@ -142,7 +142,7 @@ configRefPanel - MobiFlight.UI.Panels.Config.ConfigRefPanel, MFConnector, Version=8.2.0.1, Culture=neutral, PublicKeyToken=null + MobiFlight.UI.Panels.Config.ConfigRefPanel, MFConnector, Version=8.2.0.4, Culture=neutral, PublicKeyToken=null referencesGroupBox @@ -154,16 +154,10 @@ Fill - 9, 845 - - - 4, 5, 4, 5 - - - 4, 5, 4, 5 + 6, 663 - 642, 0 + 531, 0 13 @@ -183,11 +177,38 @@ 0 + + True + + + Top + + + 6, 549 + + + 531, 114 + + + 1 + + + variablePanel1 + + + MobiFlight.UI.Panels.Config.VariablePanel, MFConnector, Version=8.2.0.4, Culture=neutral, PublicKeyToken=null + + + fsuipcTabPage + + + 1 + Top - 9, 448 + 6, 291 @@ -199,10 +220,10 @@ - 6, 8, 6, 8 + 4, 5, 4, 5 - 642, 397 + 531, 258 1 @@ -211,13 +232,13 @@ simConnectPanel1 - MobiFlight.UI.Panels.Config.SimConnectPanel, MFConnector, Version=8.2.0.1, Culture=neutral, PublicKeyToken=null + MobiFlight.UI.Panels.Config.SimConnectPanel, MFConnector, Version=8.2.0.4, Culture=neutral, PublicKeyToken=null fsuipcTabPage - 1 + 2 GrowAndShrink @@ -226,13 +247,13 @@ Top - 0, 49 + 0, 32 - 6, 8, 6, 8 + 4, 5, 4, 5 - 642, 365 + 531, 237 15 @@ -241,7 +262,7 @@ fsuipcConfigPanel - MobiFlight.UI.Panels.Config.FsuipcConfigPanel, MFConnector, Version=8.2.0.1, Culture=neutral, PublicKeyToken=null + MobiFlight.UI.Panels.Config.FsuipcConfigPanel, MFConnector, Version=8.2.0.4, Culture=neutral, PublicKeyToken=null FsuipcSettingsPanel @@ -256,13 +277,13 @@ 0, 0 - 9, 9, 9, 9 + 6, 6, 6, 6 True - 642, 49 + 531, 32 11 @@ -286,13 +307,10 @@ Top - 9, 60 - - - 4, 5, 4, 5 + 6, 39 - 642, 388 + 531, 252 17 @@ -307,19 +325,49 @@ fsuipcTabPage - 2 + 3 + + + True + + + NoControl + + + 366, 5 + + + 114, 17 + + + 13 + + + MobiFlight Variable + + + OffsetTypeVariableRadioButton + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + OffsetTypePanel + + + 0 - 0, 9 + 0, 6 - 9, 9, 9, 9 + 6, 6, 6, 6 True - 160, 31 + 107, 20 12 @@ -340,7 +388,7 @@ OffsetTypePanel - 0 + 1 True @@ -349,13 +397,10 @@ NoControl - 324, 8 - - - 4, 5, 4, 5 + 216, 5 - 216, 24 + 144, 17 1 @@ -373,7 +418,7 @@ OffsetTypePanel - 1 + 2 True @@ -382,13 +427,10 @@ NoControl - 174, 8 - - - 4, 5, 4, 5 + 116, 5 - 141, 24 + 94, 17 0 @@ -406,19 +448,16 @@ OffsetTypePanel - 2 + 3 Top - 9, 9 - - - 4, 5, 4, 5 + 6, 6 - 642, 51 + 531, 33 16 @@ -433,19 +472,16 @@ fsuipcTabPage - 3 + 4 - 4, 29 - - - 4, 5, 4, 5 + 4, 22 - 9, 9, 9, 9 + 6, 6, 6, 6 - 660, 847 + 543, 549 0 @@ -469,13 +505,10 @@ Fill - 9, 575 - - - 4, 5, 4, 5 + 6, 374 - 642, 263 + 531, 426 13 @@ -496,13 +529,13 @@ Fill - 4, 58 + 3, 39 - 2, 2, 2, 2 + 1, 1, 1, 1 - 634, 202 + 525, 130 0 @@ -511,7 +544,7 @@ interpolationPanel1 - MobiFlight.UI.Panels.Config.InterpolationPanel, MFConnector, Version=8.2.0.1, Culture=neutral, PublicKeyToken=null + MobiFlight.UI.Panels.Config.InterpolationPanel, MFConnector, Version=8.2.0.4, Culture=neutral, PublicKeyToken=null interpolationGroupBox @@ -529,16 +562,13 @@ NoControl - 4, 24 - - - 4, 5, 4, 5 + 3, 16 - 4, 5, 4, 5 + 3, 3, 3, 3 - 634, 34 + 525, 23 9 @@ -562,16 +592,10 @@ Top - 9, 310 - - - 4, 5, 4, 5 - - - 4, 5, 4, 5 + 6, 202 - 642, 265 + 531, 172 1 @@ -592,13 +616,10 @@ 1 - 256, 15 - - - 4, 5, 4, 5 + 171, 10 - 148, 26 + 100, 20 16 @@ -616,13 +637,10 @@ 0 - 256, 94 - - - 4, 5, 4, 5 + 171, 61 - 148, 26 + 100, 20 19 @@ -646,13 +664,10 @@ NoControl - 156, 98 - - - 4, 0, 4, 0 + 104, 64 - 94, 20 + 63, 13 18 @@ -673,13 +688,10 @@ 2 - 256, 54 - - - 4, 5, 4, 5 + 171, 35 - 148, 26 + 100, 20 17 @@ -703,13 +715,10 @@ NoControl - 189, 58 - - - 4, 0, 4, 0 + 126, 38 - 61, 20 + 41, 13 15 @@ -751,13 +760,10 @@ - 189, 15 - - - 4, 5, 4, 5 + 126, 10 - 56, 28 + 39, 21 14 @@ -781,13 +787,10 @@ NoControl - 48, 20 - - - 4, 0, 4, 0 + 32, 13 - 129, 20 + 88, 13 13 @@ -811,13 +814,10 @@ Fill - 9, 52 - - - 4, 5, 4, 5 + 6, 36 - 624, 151 + 519, 96 9 @@ -844,13 +844,10 @@ NoControl - 9, 28 - - - 4, 5, 4, 5 + 6, 19 - 624, 24 + 519, 17 8 @@ -874,16 +871,13 @@ Top - 9, 98 - - - 4, 5, 4, 5 + 6, 64 - 9, 9, 9, 9 + 6, 6, 6, 6 - 642, 212 + 531, 138 8 @@ -907,16 +901,16 @@ Top - 9, 9 + 6, 6 - 9, 9, 9, 9 + 6, 6, 6, 6 True - 642, 89 + 531, 58 9 @@ -938,16 +932,13 @@ 3 - 4, 29 - - - 4, 5, 4, 5 + 4, 22 - 9, 9, 9, 9 + 6, 6, 6, 6 - 660, 847 + 543, 806 1 @@ -980,13 +971,10 @@ NoControl - 412, 18 - - - 4, 5, 4, 5 + 378, 12 - 87, 35 + 58, 23 19 @@ -1022,13 +1010,10 @@ NoControl - 316, 18 - - - 4, 5, 4, 5 + 314, 12 - 87, 35 + 58, 23 18 @@ -1058,16 +1043,10 @@ Top - 9, 204 - - - 4, 5, 4, 5 - - - 4, 5, 4, 5 + 6, 119 - 642, 62 + 531, 40 8 @@ -1094,16 +1073,10 @@ Top - 9, 175 - - - 4, 5, 4, 5 - - - 4, 5, 4, 5 + 6, 114 - 642, 29 + 531, 5 14 @@ -1130,13 +1103,10 @@ NoControl - 75, 35 - - - 4, 0, 4, 0 + 50, 23 - 61, 20 + 42, 13 18 @@ -1163,13 +1133,10 @@ Modul B - 147, 31 - - - 4, 5, 4, 5 + 98, 20 - 180, 28 + 121, 21 2 @@ -1193,13 +1160,10 @@ NoControl - 46, 74 - - - 4, 0, 4, 0 + 31, 48 - 90, 20 + 61, 13 14 @@ -1229,13 +1193,10 @@ BCD4056 - 147, 69 - - - 4, 5, 4, 5 + 98, 45 - 180, 28 + 121, 21 3 @@ -1256,16 +1217,10 @@ Top - 9, 60 - - - 4, 5, 4, 5 - - - 4, 5, 4, 5 + 6, 39 - 642, 115 + 531, 75 1 @@ -1289,16 +1244,16 @@ Top - 9, 9 + 6, 6 - 18, 18, 18, 18 + 12, 12, 12, 12 True - 642, 51 + 531, 33 10 @@ -1319,16 +1274,13 @@ 3 - 4, 29 - - - 4, 5, 4, 5 + 4, 22 - 9, 9, 9, 9 + 6, 6, 6, 6 - 660, 847 + 543, 806 2 @@ -1352,13 +1304,10 @@ Fill - 9, 606 - - - 4, 5, 4, 5 + 6, 394 - 642, 232 + 531, 406 13 @@ -1376,13 +1325,10 @@ 0 - 470, 28 - - - 4, 5, 4, 5 + 313, 18 - 70, 26 + 48, 20 1 @@ -1406,13 +1352,10 @@ NoControl - 10, 32 - - - 4, 5, 4, 5 + 7, 21 - 457, 24 + 310, 17 0 @@ -1436,16 +1379,10 @@ Top - 9, 529 - - - 4, 5, 4, 5 - - - 4, 5, 4, 5 + 6, 344 - 642, 77 + 531, 50 0 @@ -1475,13 +1412,10 @@ Off - 154, 108 - - - 4, 5, 4, 5 + 103, 70 - 68, 28 + 47, 21 21 @@ -1505,13 +1439,10 @@ NoControl - 4, 112 - - - 4, 0, 4, 0 + 3, 73 - 128, 20 + 85, 13 20 @@ -1550,13 +1481,10 @@ != - 230, 66 - - - 4, 5, 4, 5 + 153, 43 - 68, 28 + 47, 21 19 @@ -1592,13 +1520,10 @@ != - 154, 66 - - - 4, 5, 4, 5 + 103, 43 - 68, 28 + 47, 21 18 @@ -1622,13 +1547,10 @@ NoControl - 104, 71 - - - 4, 0, 4, 0 + 69, 46 - 31, 20 + 22, 13 17 @@ -1655,13 +1577,10 @@ Arcaze Pin - 154, 25 - - - 4, 5, 4, 5 + 103, 16 - 306, 28 + 205, 21 15 @@ -1685,13 +1604,10 @@ NoControl - 20, 29 - - - 4, 0, 4, 0 + 13, 19 - 115, 20 + 78, 13 16 @@ -1715,13 +1631,10 @@ Fill - 4, 24 - - - 4, 5, 4, 5 + 3, 16 - 634, 171 + 525, 111 2 @@ -1739,13 +1652,10 @@ 0 - 222, 66 - - - 4, 5, 4, 5 + 148, 43 - 92, 26 + 63, 20 19 @@ -1781,13 +1691,10 @@ != - 154, 66 - - - 4, 5, 4, 5 + 103, 43 - 56, 28 + 39, 21 18 @@ -1811,13 +1718,10 @@ NoControl - 14, 71 - - - 4, 0, 4, 0 + 9, 46 - 129, 20 + 88, 13 17 @@ -1844,13 +1748,10 @@ Arcaze Pin - 154, 25 - - - 4, 5, 4, 5 + 103, 16 - 306, 28 + 205, 21 15 @@ -1874,13 +1775,10 @@ NoControl - 33, 29 - - - 4, 0, 4, 0 + 22, 19 - 111, 20 + 75, 13 16 @@ -1904,13 +1802,10 @@ Fill - 4, 24 - - - 4, 5, 4, 5 + 3, 16 - 634, 171 + 525, 111 1 @@ -1934,19 +1829,13 @@ Top - 0, 72 - - - 4, 5, 4, 5 + 0, 47 - 0, 200 - - - 4, 5, 4, 5 + 0, 130 - 642, 200 + 531, 130 14 @@ -1976,13 +1865,10 @@ NoControl - 176, 272 - - - 4, 5, 4, 5 + 117, 177 - 283, 35 + 292, 23 32 @@ -2012,13 +1898,10 @@ Arcaze Pin - 159, 31 - - - 4, 5, 4, 5 + 106, 20 - 180, 28 + 121, 21 2 @@ -2042,13 +1925,10 @@ NoControl - 58, 35 - - - 4, 0, 4, 0 + 39, 23 - 90, 20 + 61, 13 14 @@ -2074,14 +1954,8 @@ 0, 0 - - 4, 5, 4, 5 - - - 4, 5, 4, 5 - - 642, 72 + 531, 47 13 @@ -2105,13 +1979,10 @@ Top - 9, 212 - - - 4, 5, 4, 5 + 6, 138 - 642, 317 + 531, 206 15 @@ -2132,25 +2003,25 @@ 150, 17 - 253, 32 + 188, 22 Add Precondition - 253, 32 + 188, 22 Remove Precondition - 250, 6 + 185, 6 False - 253, 32 + 188, 22 Add group @@ -2159,7 +2030,7 @@ False - 253, 32 + 188, 22 Remove group @@ -2168,28 +2039,28 @@ False - 250, 6 + 185, 6 - 152, 34 + 99, 22 AND - 152, 34 + 99, 22 OR - 253, 32 + 188, 22 Logic operator - 254, 176 + 189, 126 preconditionTreeContextMenuStrip @@ -2211,7 +2082,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM - CgAAAk1TRnQBSQFMAgEBAgEAAfABBAHwAQQBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA + CgAAAk1TRnQBSQFMAgEBAgEAARABBQEQAQUBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABEAMAAQEBAAEgBgABEP8AFwADOwFkAmEBWwHhAmQBXAHnAmQBXAHnAmQBXAHnAmQBXAHnAmQBXAHn AmQBXAHnAmQBXAHnAmQBXAHnAmQBXAHnAmQBXAHnAmEBWwHhAzoBYggAAzsBZAJbAWEB4QJcAWQB5wJc AWQB5wJcAWQB5wJcAWQB5wJcAWQB5wJcAWQB5wJcAWQB5wJcAWQB5wJcAWQB5wJcAWQB5wJbAWEB4QM6 @@ -2260,10 +2131,7 @@ - 4, 24 - - - 4, 5, 4, 5 + 3, 16 @@ -2309,7 +2177,7 @@ 0 - 634, 125 + 525, 81 0 @@ -2330,16 +2198,10 @@ Top - 9, 58 - - - 4, 5, 4, 5 - - - 4, 5, 4, 5 + 6, 38 - 642, 154 + 531, 100 15 @@ -2363,16 +2225,16 @@ Top - 9, 9 + 6, 6 - 18, 18, 18, 18 + 12, 12, 12, 12 True - 642, 49 + 531, 32 12 @@ -2393,16 +2255,13 @@ 4 - 4, 29 - - - 4, 5, 4, 5 + 4, 22 - 9, 9, 9, 9 + 6, 6, 6, 6 - 660, 847 + 543, 806 3 @@ -2428,11 +2287,8 @@ 0, 0 - - 4, 5, 4, 5 - - 668, 880 + 551, 575 13 @@ -2455,11 +2311,8 @@ 0, 0 - - 4, 5, 4, 5 - - 668, 880 + 551, 575 0 @@ -2483,13 +2336,10 @@ NoControl - 444, 0 - - - 4, 5, 4, 5 + 401, 0 - 112, 43 + 75, 28 30 @@ -2516,13 +2366,10 @@ NoControl - 556, 0 - - - 4, 5, 4, 5 + 476, 0 - 112, 43 + 75, 28 31 @@ -2546,13 +2393,10 @@ Bottom - 0, 880 - - - 4, 5, 4, 5 + 0, 575 - 668, 43 + 551, 28 1 @@ -2579,10 +2423,10 @@ 41 - 9, 20 + 6, 13 - 668, 923 + 551, 603 @@ -2728,12 +2572,6 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== - - NoControl - - - 4, 5, 4, 5 - CenterParent diff --git a/UI/Panels/Action/VariableInputPanel.Designer.cs b/UI/Panels/Action/VariableInputPanel.Designer.cs index 2cd9d1c08..bd7fe191e 100644 --- a/UI/Panels/Action/VariableInputPanel.Designer.cs +++ b/UI/Panels/Action/VariableInputPanel.Designer.cs @@ -30,17 +30,19 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VariableInputPanel)); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.ValueTextBox = new System.Windows.Forms.TextBox(); + this.ValueLabel = new System.Windows.Forms.Label(); this.TypeComboBox = new System.Windows.Forms.ComboBox(); this.NameTextBox = new System.Windows.Forms.TextBox(); this.TypeLabel = new System.Windows.Forms.Label(); this.NameLabel = new System.Windows.Forms.Label(); - this.ValueTextBox = new System.Windows.Forms.TextBox(); - this.ValueLabel = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // + this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.ValueTextBox); this.groupBox1.Controls.Add(this.ValueLabel); this.groupBox1.Controls.Add(this.TypeComboBox); @@ -51,6 +53,16 @@ private void InitializeComponent() this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // + // ValueTextBox + // + resources.ApplyResources(this.ValueTextBox, "ValueTextBox"); + this.ValueTextBox.Name = "ValueTextBox"; + // + // ValueLabel + // + resources.ApplyResources(this.ValueLabel, "ValueLabel"); + this.ValueLabel.Name = "ValueLabel"; + // // TypeComboBox // this.TypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -76,15 +88,10 @@ private void InitializeComponent() resources.ApplyResources(this.NameLabel, "NameLabel"); this.NameLabel.Name = "NameLabel"; // - // ValueTextBox + // label1 // - resources.ApplyResources(this.ValueTextBox, "ValueTextBox"); - this.ValueTextBox.Name = "ValueTextBox"; - // - // ValueLabel - // - resources.ApplyResources(this.ValueLabel, "ValueLabel"); - this.ValueLabel.Name = "ValueLabel"; + resources.ApplyResources(this.label1, "label1"); + this.label1.Name = "label1"; // // VariableInputPanel // @@ -105,5 +112,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox TypeComboBox; private System.Windows.Forms.TextBox ValueTextBox; private System.Windows.Forms.Label ValueLabel; + private System.Windows.Forms.Label label1; } } diff --git a/UI/Panels/Action/VariableInputPanel.cs b/UI/Panels/Action/VariableInputPanel.cs index a09bd2cba..092bb6e4c 100644 --- a/UI/Panels/Action/VariableInputPanel.cs +++ b/UI/Panels/Action/VariableInputPanel.cs @@ -16,6 +16,14 @@ public partial class VariableInputPanel : UserControl public VariableInputPanel() { InitializeComponent(); + InitWithVariable(new MobiFlightVariable()); + } + + private void InitWithVariable(MobiFlightVariable Variable) + { + ComboBoxHelper.SetSelectedItem(TypeComboBox, Variable.TYPE); + NameTextBox.Text = Variable.Name; + ValueTextBox.Text = Variable.Expression; } internal void syncFromConfig(InputConfig.VariableInputAction inputAction) diff --git a/UI/Panels/Action/VariableInputPanel.resx b/UI/Panels/Action/VariableInputPanel.resx index ab825da08..defb7e410 100644 --- a/UI/Panels/Action/VariableInputPanel.resx +++ b/UI/Panels/Action/VariableInputPanel.resx @@ -118,10 +118,38 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Top, Left, Right + + 61, 88 + + + 190, 38 + + + + 21 + + + You can reference current value with $ and input value by @ + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + Top, Left, Right + 61, 66 @@ -129,9 +157,8 @@ 2, 2, 2, 2 - 136, 20 + 190, 20 - 20 @@ -145,7 +172,7 @@ groupBox1 - 0 + 1 NoControl @@ -178,7 +205,7 @@ groupBox1 - 1 + 2 Number @@ -205,7 +232,7 @@ groupBox1 - 2 + 3 Top, Left, Right @@ -217,7 +244,7 @@ 2, 2, 2, 2 - 136, 20 + 190, 20 17 @@ -232,7 +259,7 @@ groupBox1 - 3 + 4 NoControl @@ -265,7 +292,7 @@ groupBox1 - 4 + 5 NoControl @@ -298,7 +325,7 @@ groupBox1 - 5 + 6 Fill @@ -313,7 +340,7 @@ 2, 2, 2, 2 - 213, 110 + 267, 128 24 @@ -337,7 +364,7 @@ True - 213, 110 + 267, 128 VariableInputPanel diff --git a/UI/Panels/Config/VariablePanel.Designer.cs b/UI/Panels/Config/VariablePanel.Designer.cs new file mode 100644 index 000000000..81c31eaad --- /dev/null +++ b/UI/Panels/Config/VariablePanel.Designer.cs @@ -0,0 +1,143 @@ + +namespace MobiFlight.UI.Panels.Config +{ + partial class VariablePanel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.TypeComboBox = new System.Windows.Forms.ComboBox(); + this.NameTextBox = new System.Windows.Forms.TextBox(); + this.TypeLabel = new System.Windows.Forms.Label(); + this.NameLabel = new System.Windows.Forms.Label(); + this.transformOptionsGroup1 = new MobiFlight.UI.Panels.Config.TransformOptionsGroup(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.TypeComboBox); + this.groupBox1.Controls.Add(this.NameTextBox); + this.groupBox1.Controls.Add(this.TypeLabel); + this.groupBox1.Controls.Add(this.NameLabel); + this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top; + this.groupBox1.Location = new System.Drawing.Point(0, 0); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(310, 101); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Variable Settings"; + // + // TypeComboBox + // + this.TypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.TypeComboBox.FormattingEnabled = true; + this.TypeComboBox.Items.AddRange(new object[] { + "Number", + "String"}); + this.TypeComboBox.Location = new System.Drawing.Point(63, 37); + this.TypeComboBox.Name = "TypeComboBox"; + this.TypeComboBox.Size = new System.Drawing.Size(89, 21); + this.TypeComboBox.TabIndex = 22; + // + // NameTextBox + // + this.NameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.NameTextBox.Location = new System.Drawing.Point(63, 61); + this.NameTextBox.Margin = new System.Windows.Forms.Padding(2); + this.NameTextBox.Name = "NameTextBox"; + this.NameTextBox.Size = new System.Drawing.Size(235, 20); + this.NameTextBox.TabIndex = 21; + // + // TypeLabel + // + this.TypeLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.TypeLabel.Location = new System.Drawing.Point(10, 40); + this.TypeLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.TypeLabel.Name = "TypeLabel"; + this.TypeLabel.Size = new System.Drawing.Size(47, 13); + this.TypeLabel.TabIndex = 20; + this.TypeLabel.Text = "Type"; + this.TypeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NameLabel + // + this.NameLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.NameLabel.Location = new System.Drawing.Point(13, 64); + this.NameLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.NameLabel.Name = "NameLabel"; + this.NameLabel.Size = new System.Drawing.Size(44, 13); + this.NameLabel.TabIndex = 19; + this.NameLabel.Text = "Name"; + this.NameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // transformOptionsGroup1 + // + this.transformOptionsGroup1.Dock = System.Windows.Forms.DockStyle.Top; + this.transformOptionsGroup1.Location = new System.Drawing.Point(0, 101); + this.transformOptionsGroup1.Name = "transformOptionsGroup1"; + this.transformOptionsGroup1.Size = new System.Drawing.Size(310, 94); + this.transformOptionsGroup1.TabIndex = 1; + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(3, 16); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(304, 19); + this.label1.TabIndex = 23; + this.label1.Text = "Access a local variable by type and name."; + // + // VariablePanel + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.Controls.Add(this.transformOptionsGroup1); + this.Controls.Add(this.groupBox1); + this.Name = "VariablePanel"; + this.Size = new System.Drawing.Size(310, 195); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private TransformOptionsGroup transformOptionsGroup1; + private System.Windows.Forms.ComboBox TypeComboBox; + private System.Windows.Forms.TextBox NameTextBox; + private System.Windows.Forms.Label TypeLabel; + private System.Windows.Forms.Label NameLabel; + private System.Windows.Forms.Label label1; + } +} diff --git a/UI/Panels/Config/VariablePanel.cs b/UI/Panels/Config/VariablePanel.cs new file mode 100644 index 000000000..f5a34d00b --- /dev/null +++ b/UI/Panels/Config/VariablePanel.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace MobiFlight.UI.Panels.Config +{ + public partial class VariablePanel : UserControl + { + public VariablePanel() + { + InitializeComponent(); + + // hide the string options. + transformOptionsGroup1.setMode(true); + transformOptionsGroup1.ShowSubStringPanel(false); + } + + internal void syncToConfig(OutputConfigItem config) + { + config.MobiFlightVariable.TYPE = TypeComboBox.Text; + config.MobiFlightVariable.Name = NameTextBox.Text; + transformOptionsGroup1.syncToConfig(config); + } + + internal void syncFromConfig(OutputConfigItem config) + { + ComboBoxHelper.SetSelectedItem(TypeComboBox, config.MobiFlightVariable.TYPE); + NameTextBox.Text = config.MobiFlightVariable.Name; + transformOptionsGroup1.syncFromConfig(config); + } + } +} diff --git a/UI/Panels/Config/VariablePanel.resx b/UI/Panels/Config/VariablePanel.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/UI/Panels/Config/VariablePanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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