- Timestamp:
- 12/15/21 11:50:57 (3 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/3140_NumberSymbol (added) merged: 18091,18093,18100,18112-18121,18123-18131
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
/branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic.Views (added) merged: 18100,18114-18115,18125
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs
r17180 r18132 21 21 22 22 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 23 partial class ConstantNodeEditDialog {23 partial class NumberNodeEditDialog { 24 24 /// <summary> 25 25 /// Required designer variable. … … 121 121 this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); 122 122 // 123 // ConstantNodeEditDialog123 // NumberNodeEditDialog 124 124 // 125 125 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); … … 138 138 this.MaximizeBox = false; 139 139 this.MinimizeBox = false; 140 this.Name = " ConstantNodeEditDialog";140 this.Name = "NumberNodeEditDialog"; 141 141 this.ShowIcon = false; 142 142 this.ShowInTaskbar = false; 143 143 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 144 this.Text = "Edit constantvalue";145 this.KeyDown += new System.Windows.Forms.KeyEventHandler(this. ConstantNodeEditDialog_KeyDown);144 this.Text = "Edit number value"; 145 this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.NumberNodeEditDialog_KeyDown); 146 146 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 147 147 this.ResumeLayout(false); -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.cs
r17180 r18132 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 30 public partial class ConstantNodeEditDialog : Form {31 private ConstantTreeNode constantTreeNode;32 public ConstantTreeNode NewNode {33 get { return constantTreeNode; }30 public partial class NumberNodeEditDialog : Form { 31 private INumericTreeNode numberTreeNode; 32 public INumericTreeNode NewNode { 33 get { return numberTreeNode; } 34 34 set { 35 35 if (InvokeRequired) 36 Invoke(new Action<SymbolicExpressionTreeNode>(x => constantTreeNode = (ConstantTreeNode)x), value);36 Invoke(new Action<SymbolicExpressionTreeNode>(x => numberTreeNode = (INumericTreeNode)x), value); 37 37 else 38 constantTreeNode = value;38 numberTreeNode = value; 39 39 } 40 40 } 41 41 42 public ConstantNodeEditDialog(ISymbolicExpressionTreeNode node) {42 public NumberNodeEditDialog(ISymbolicExpressionTreeNode node) { 43 43 InitializeComponent(); 44 44 oldValueTextBox.TabStop = false; // cannot receive focus using tab key 45 NewNode = ( ConstantTreeNode)node;45 NewNode = (INumericTreeNode)node; 46 46 InitializeFields(); 47 47 } … … 49 49 private void InitializeFields() { 50 50 if (NewNode == null) 51 throw new ArgumentException("Node is not a constant.");51 throw new ArgumentException("Node is not a number."); 52 52 else { 53 this.Text = "Edit constant";54 newValueTextBox.Text = oldValueTextBox.Text = Math.Round( constantTreeNode.Value, 4).ToString();53 this.Text = "Edit number"; 54 newValueTextBox.Text = oldValueTextBox.Text = Math.Round(numberTreeNode.Value, 4).ToString(); 55 55 } 56 56 } … … 71 71 72 72 private static bool ValidateNewValue(string value, out string errorMessage) { 73 double val; 74 bool valid = double.TryParse(value, out val); 73 bool valid = double.TryParse(value, out _); 75 74 errorMessage = string.Empty; 76 75 if (!valid) { … … 87 86 // proxy handler passing key strokes to the parent control 88 87 private void childControl_KeyDown(object sender, KeyEventArgs e) { 89 ConstantNodeEditDialog_KeyDown(sender, e);88 NumberNodeEditDialog_KeyDown(sender, e); 90 89 } 91 90 92 private void ConstantNodeEditDialog_KeyDown(object sender, KeyEventArgs e) {91 private void NumberNodeEditDialog_KeyDown(object sender, KeyEventArgs e) { 93 92 if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) { 94 93 if (!ValidateChildren()) return; … … 100 99 public event EventHandler DialogValidated; 101 100 private void OnDialogValidated(object sender, EventArgs e) { 102 if ( constantTreeNode == null) return;101 if (numberTreeNode == null) return; 103 102 var value = double.Parse(newValueTextBox.Text); 104 103 // we impose an extra validation condition: that the new value is different from the original value 105 if ( constantTreeNode.Value.Equals(value)) return;104 if (numberTreeNode.Value.Equals(value)) return; 106 105 107 constantTreeNode.Value = value;106 numberTreeNode.Value = value; 108 107 DialogResult = DialogResult.OK; 109 108 var dialogValidated = DialogValidated; -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs
r17180 r18132 52 52 this.variableNamesCombo = new System.Windows.Forms.ComboBox(); 53 53 this.variableWeightTextBox = new System.Windows.Forms.TextBox(); 54 this. constantValueTextBox = new System.Windows.Forms.TextBox();55 this. constantValueLabel = new System.Windows.Forms.Label();54 this.numberValueTextBox = new System.Windows.Forms.TextBox(); 55 this.numberValueLabel = new System.Windows.Forms.Label(); 56 56 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 57 57 this.okButton = new System.Windows.Forms.Button(); … … 121 121 this.variableWeightTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.variableWeightTextBox_Validating); 122 122 // 123 // constantValueTextBox124 // 125 this. constantValueTextBox.Location = new System.Drawing.Point(101, 37);126 this. constantValueTextBox.Name = "constantValueTextBox";127 this. constantValueTextBox.Size = new System.Drawing.Size(127, 20);128 this. constantValueTextBox.TabIndex = 7;129 this. constantValueTextBox.Text = "0.0";130 this. constantValueTextBox.Visible = false;131 this. constantValueTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.constantValueTextBox_Validating);132 // 133 // constantValueLabel134 // 135 this. constantValueLabel.AutoSize = true;136 this. constantValueLabel.Location = new System.Drawing.Point(19, 40);137 this. constantValueLabel.Name = "constantValueLabel";138 this. constantValueLabel.Size = new System.Drawing.Size(34, 13);139 this. constantValueLabel.TabIndex = 8;140 this. constantValueLabel.Text = "Value";141 this. constantValueLabel.Visible = false;123 // numberValueTextBox 124 // 125 this.numberValueTextBox.Location = new System.Drawing.Point(101, 37); 126 this.numberValueTextBox.Name = "numberValueTextBox"; 127 this.numberValueTextBox.Size = new System.Drawing.Size(127, 20); 128 this.numberValueTextBox.TabIndex = 7; 129 this.numberValueTextBox.Text = "0.0"; 130 this.numberValueTextBox.Visible = false; 131 this.numberValueTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.numberValueTextBox_Validating); 132 // 133 // numberValueLabel 134 // 135 this.numberValueLabel.AutoSize = true; 136 this.numberValueLabel.Location = new System.Drawing.Point(19, 40); 137 this.numberValueLabel.Name = "numberValueLabel"; 138 this.numberValueLabel.Size = new System.Drawing.Size(34, 13); 139 this.numberValueLabel.TabIndex = 8; 140 this.numberValueLabel.Text = "Value"; 141 this.numberValueLabel.Visible = false; 142 142 // 143 143 // errorProvider … … 187 187 this.Controls.Add(this.cancelButton); 188 188 this.Controls.Add(this.okButton); 189 this.Controls.Add(this. constantValueLabel);190 this.Controls.Add(this. constantValueTextBox);189 this.Controls.Add(this.numberValueLabel); 190 this.Controls.Add(this.numberValueTextBox); 191 191 this.Controls.Add(this.variableWeightTextBox); 192 192 this.Controls.Add(this.variableNamesCombo); … … 211 211 private System.Windows.Forms.Label variableWeightLabel; 212 212 private System.Windows.Forms.Label variableNameLabel; 213 private System.Windows.Forms.Label constantValueLabel;213 private System.Windows.Forms.Label numberValueLabel; 214 214 private System.Windows.Forms.ErrorProvider errorProvider; 215 internal System.Windows.Forms.TextBox constantValueTextBox;215 internal System.Windows.Forms.TextBox numberValueTextBox; 216 216 internal System.Windows.Forms.TextBox variableWeightTextBox; 217 217 internal System.Windows.Forms.ComboBox variableNamesCombo; -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.cs
r17180 r18132 57 57 var combo = (ComboBox)sender; 58 58 var symbol = combo.Items[combo.SelectedIndex]; 59 if (symbol is Constant) {60 // add controls to the dialog for changing the constantvalue59 if (symbol is Number) { 60 // add controls to the dialog for changing the number value 61 61 variableNameLabel.Visible = false; 62 62 variableNamesCombo.Visible = false; 63 63 variableWeightLabel.Visible = false; 64 64 variableWeightTextBox.Visible = false; 65 constantValueLabel.Visible = true;66 constantValueTextBox.Visible = true;65 numberValueLabel.Visible = true; 66 numberValueTextBox.Visible = true; 67 67 } else if (symbol is VariableBase) { 68 68 var variableSymbol = (VariableBase)symbol; … … 80 80 variableWeightLabel.Visible = true; 81 81 variableWeightTextBox.Visible = true; 82 constantValueLabel.Visible = false;83 constantValueTextBox.Visible = false;82 numberValueLabel.Visible = false; 83 numberValueTextBox.Visible = false; 84 84 // add controls to the dialog for changing the variable name or weight 85 85 } else { … … 88 88 variableWeightLabel.Visible = false; 89 89 variableWeightTextBox.Visible = false; 90 constantValueLabel.Visible = false;91 constantValueTextBox.Visible = false;90 numberValueLabel.Visible = false; 91 numberValueTextBox.Visible = false; 92 92 } 93 93 } … … 102 102 } 103 103 104 private void constantValueTextBox_Validating(object sender, CancelEventArgs e) {104 private void numberValueTextBox_Validating(object sender, CancelEventArgs e) { 105 105 string errorMessage; 106 if (ValidateDoubleValue( constantValueTextBox.Text, out errorMessage)) return;106 if (ValidateDoubleValue(numberValueTextBox.Text, out errorMessage)) return; 107 107 e.Cancel = true; 108 errorProvider.SetError( constantValueTextBox, errorMessage);109 constantValueTextBox.SelectAll();108 errorProvider.SetError(numberValueTextBox, errorMessage); 109 numberValueTextBox.SelectAll(); 110 110 } 111 111 -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.cs
r17180 r18132 60 60 private void InitializeFields() { 61 61 if (NewNode == null) 62 throw new ArgumentException("Node is not a constant.");62 throw new ArgumentException("Node is not a variable node."); 63 63 else { 64 64 this.Text = "Edit variable";
Note: See TracChangeset
for help on using the changeset viewer.