Changeset 15281 for branches/Async/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs
- Timestamp:
- 07/23/17 11:17:18 (7 years ago)
- Location:
- branches/Async
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Async
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/Async/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
-
branches/Async/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 57 57 this.okButton = new System.Windows.Forms.Button(); 58 58 this.cancelButton = new System.Windows.Forms.Button(); 59 this.variableNameTextBox = new System.Windows.Forms.TextBox(); 59 60 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 60 61 this.SuspendLayout(); … … 168 169 this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); 169 170 // 171 // variableNameTextBox 172 // 173 this.variableNameTextBox.Location = new System.Drawing.Point(101, 63); 174 this.variableNameTextBox.Name = "variableNameTextBox"; 175 this.variableNameTextBox.Size = new System.Drawing.Size(127, 20); 176 this.variableNameTextBox.TabIndex = 11; 177 this.variableNameTextBox.Visible = false; 178 // 170 179 // InsertNodeDialog 171 180 // … … 175 184 this.ClientSize = new System.Drawing.Size(241, 133); 176 185 this.ControlBox = false; 186 this.Controls.Add(this.variableNameTextBox); 177 187 this.Controls.Add(this.cancelButton); 178 188 this.Controls.Add(this.okButton); … … 208 218 private System.Windows.Forms.Button cancelButton; 209 219 private System.Windows.Forms.Button okButton; 220 private System.Windows.Forms.TextBox variableNameTextBox; 210 221 } 211 222 } -
branches/Async/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using System.Collections.Generic; 24 24 using System.ComponentModel; 25 using System.Linq; 25 26 using System.Text; 26 27 using System.Windows.Forms; … … 30 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 31 32 public partial class InsertNodeDialog : Form { 33 public string SelectedVariableName { 34 get { 35 var variable = SelectedSymbol as Variable; 36 if (variable == null) 37 return string.Empty; 38 return variable.VariableNames.Any() ? variableNamesCombo.Text : variableNameTextBox.Text; 39 } 40 } 41 32 42 public InsertNodeDialog() { 33 43 InitializeComponent(); … … 40 50 } 41 51 42 public ISymbol SelectedSymbol (){43 return (ISymbol)allowedSymbolsCombo.SelectedItem;52 public ISymbol SelectedSymbol { 53 get { return (ISymbol)allowedSymbolsCombo.SelectedItem; } 44 54 } 45 55 … … 55 65 constantValueLabel.Visible = true; 56 66 constantValueTextBox.Visible = true; 57 } else if (symbol is Variable) { 58 var variable = (Variable)symbol; 59 foreach (var name in variable.VariableNames) variableNamesCombo.Items.Add(name); 60 variableNamesCombo.SelectedIndex = 0; 67 } else if (symbol is VariableBase) { 68 var variableSymbol = (VariableBase)symbol; 69 if (variableSymbol.VariableNames.Any()) { 70 foreach (var name in variableSymbol.VariableNames) 71 variableNamesCombo.Items.Add(name); 72 variableNamesCombo.SelectedIndex = 0; 73 variableNamesCombo.Visible = true; 74 variableNameTextBox.Visible = false; 75 } else { 76 variableNamesCombo.Visible = false; 77 variableNameTextBox.Visible = true; 78 } 61 79 variableNameLabel.Visible = true; 62 variableNamesCombo.Visible = true;63 80 variableWeightLabel.Visible = true; 64 81 variableWeightTextBox.Visible = true; -
branches/Async/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 55 55 this.okButton = new System.Windows.Forms.Button(); 56 56 this.cancelButton = new System.Windows.Forms.Button(); 57 this.variableNameTextBox = new System.Windows.Forms.TextBox(); 57 58 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 58 59 this.SuspendLayout(); … … 146 147 this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); 147 148 // 149 // variableNameTextBox 150 // 151 this.variableNameTextBox.Location = new System.Drawing.Point(101, 12); 152 this.variableNameTextBox.Name = "variableNameTextBox"; 153 this.variableNameTextBox.Size = new System.Drawing.Size(131, 20); 154 this.variableNameTextBox.TabIndex = 12; 155 this.variableNameTextBox.Visible = false; 156 // 148 157 // VariableNodeEditDialog 149 158 // … … 154 163 this.ClientSize = new System.Drawing.Size(244, 134); 155 164 this.ControlBox = false; 165 this.Controls.Add(this.variableNameTextBox); 156 166 this.Controls.Add(this.cancelButton); 157 167 this.Controls.Add(this.okButton); … … 188 198 public System.Windows.Forms.TextBox newValueTextBox; 189 199 public System.Windows.Forms.ComboBox variableNamesCombo; 200 private System.Windows.Forms.TextBox variableNameTextBox; 190 201 } 191 202 } -
branches/Async/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.ComponentModel; 24 using System.Linq; 24 25 using System.Text; 25 26 using System.Windows.Forms; … … 33 34 get { return variableTreeNode; } 34 35 set { 35 if (InvokeRequired) 36 Invoke(new Action<SymbolicExpressionTreeNode>(x => variableTreeNode = (VariableTreeNode)x), value); 37 else 36 if (InvokeRequired) { 37 Invoke(new Action<SymbolicExpressionTreeNode>(x => 38 { 39 variableTreeNode = (VariableTreeNode) x; 40 variableNameTextBox.Text = variableTreeNode.VariableName; 41 }), value); 42 } else { 38 43 variableTreeNode = value; 44 variableNameTextBox.Text = variableTreeNode.VariableName; 45 } 39 46 } 47 } 48 49 public string SelectedVariableName { 50 get { return variableNamesCombo.Visible ? variableNamesCombo.Text : variableNameTextBox.Text; } 40 51 } 41 52 … … 43 54 InitializeComponent(); 44 55 oldValueTextBox.TabStop = false; // cannot receive focus using tab key 45 46 56 NewNode = (VariableTreeNode)node; // will throw an invalid cast exception if node is not of the correct type 47 57 InitializeFields(); … … 57 67 variableNameLabel.Visible = true; 58 68 variableNamesCombo.Visible = true; 59 foreach (var name in variableTreeNode.Symbol.VariableNames) variableNamesCombo.Items.Add(name); 60 variableNamesCombo.SelectedIndex = variableNamesCombo.Items.IndexOf(variableTreeNode.VariableName); 69 if (variableTreeNode.Symbol.VariableNames.Any()) { 70 foreach (var name in variableTreeNode.Symbol.VariableNames) 71 variableNamesCombo.Items.Add(name); 72 variableNamesCombo.SelectedIndex = variableNamesCombo.Items.IndexOf(variableTreeNode.VariableName); 73 variableNamesCombo.Visible = true; 74 variableNameTextBox.Visible = false; 75 } else { 76 variableNamesCombo.Visible = false; 77 variableNameTextBox.Visible = true; 78 } 61 79 } 62 80 } … … 93 111 #region combo box validation and events 94 112 private void variableNamesCombo_Validating(object sender, CancelEventArgs e) { 113 if (variableNamesCombo.Items.Count == 0) return; 95 114 if (variableNamesCombo.Items.Contains(variableNamesCombo.SelectedItem)) return; 96 115 e.Cancel = true; … … 119 138 private void OnDialogValidated(object sender, EventArgs e) { 120 139 double weight = double.Parse(newValueTextBox.Text); 121 var variableName = (string)variableNamesCombo.SelectedItem;122 140 // we impose an extra validation condition: that the weight/value be different than the original ones 141 var variableName = SelectedVariableName; 123 142 if (variableTreeNode.Weight.Equals(weight) && variableTreeNode.VariableName.Equals(variableName)) return; 124 143 variableTreeNode.Weight = weight;
Note: See TracChangeset
for help on using the changeset viewer.