Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/15/21 11:50:57 (3 years ago)
Author:
gkronber
Message:

#3140: merged r18091:18131 from branch to trunk

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs

    r17180 r18132  
    2121
    2222namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    23   partial class ConstantNodeEditDialog {
     23  partial class NumberNodeEditDialog {
    2424    /// <summary>
    2525    /// Required designer variable.
     
    121121      this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
    122122      //
    123       // ConstantNodeEditDialog
     123      // NumberNodeEditDialog
    124124      //
    125125      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     
    138138      this.MaximizeBox = false;
    139139      this.MinimizeBox = false;
    140       this.Name = "ConstantNodeEditDialog";
     140      this.Name = "NumberNodeEditDialog";
    141141      this.ShowIcon = false;
    142142      this.ShowInTaskbar = false;
    143143      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    144       this.Text = "Edit constant value";
    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);
    146146      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    147147      this.ResumeLayout(false);
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.cs

    r17180 r18132  
    2828
    2929namespace 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; }
    3434      set {
    3535        if (InvokeRequired)
    36           Invoke(new Action<SymbolicExpressionTreeNode>(x => constantTreeNode = (ConstantTreeNode)x), value);
     36          Invoke(new Action<SymbolicExpressionTreeNode>(x => numberTreeNode = (INumericTreeNode)x), value);
    3737        else
    38           constantTreeNode = value;
     38          numberTreeNode = value;
    3939      }
    4040    }
    4141
    42     public ConstantNodeEditDialog(ISymbolicExpressionTreeNode node) {
     42    public NumberNodeEditDialog(ISymbolicExpressionTreeNode node) {
    4343      InitializeComponent();
    4444      oldValueTextBox.TabStop = false; // cannot receive focus using tab key
    45       NewNode = (ConstantTreeNode)node;
     45      NewNode = (INumericTreeNode)node;
    4646      InitializeFields();
    4747    }
     
    4949    private void InitializeFields() {
    5050      if (NewNode == null)
    51         throw new ArgumentException("Node is not a constant.");
     51        throw new ArgumentException("Node is not a number.");
    5252      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();
    5555      }
    5656    }
     
    7171
    7272    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 _);
    7574      errorMessage = string.Empty;
    7675      if (!valid) {
     
    8786    // proxy handler passing key strokes to the parent control
    8887    private void childControl_KeyDown(object sender, KeyEventArgs e) {
    89       ConstantNodeEditDialog_KeyDown(sender, e);
     88      NumberNodeEditDialog_KeyDown(sender, e);
    9089    }
    9190
    92     private void ConstantNodeEditDialog_KeyDown(object sender, KeyEventArgs e) {
     91    private void NumberNodeEditDialog_KeyDown(object sender, KeyEventArgs e) {
    9392      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    9493        if (!ValidateChildren()) return;
     
    10099    public event EventHandler DialogValidated;
    101100    private void OnDialogValidated(object sender, EventArgs e) {
    102       if (constantTreeNode == null) return;
     101      if (numberTreeNode == null) return;
    103102      var value = double.Parse(newValueTextBox.Text);
    104103      // 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;
    106105
    107       constantTreeNode.Value = value;
     106      numberTreeNode.Value = value;
    108107      DialogResult = DialogResult.OK;
    109108      var dialogValidated = DialogValidated;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs

    r17180 r18132  
    5252      this.variableNamesCombo = new System.Windows.Forms.ComboBox();
    5353      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();
    5656      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    5757      this.okButton = new System.Windows.Forms.Button();
     
    121121      this.variableWeightTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.variableWeightTextBox_Validating);
    122122      //
    123       // constantValueTextBox
    124       //
    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       // constantValueLabel
    134       //
    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;
    142142      //
    143143      // errorProvider
     
    187187      this.Controls.Add(this.cancelButton);
    188188      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);
    191191      this.Controls.Add(this.variableWeightTextBox);
    192192      this.Controls.Add(this.variableNamesCombo);
     
    211211    private System.Windows.Forms.Label variableWeightLabel;
    212212    private System.Windows.Forms.Label variableNameLabel;
    213     private System.Windows.Forms.Label constantValueLabel;
     213    private System.Windows.Forms.Label numberValueLabel;
    214214    private System.Windows.Forms.ErrorProvider errorProvider;
    215     internal System.Windows.Forms.TextBox constantValueTextBox;
     215    internal System.Windows.Forms.TextBox numberValueTextBox;
    216216    internal System.Windows.Forms.TextBox variableWeightTextBox;
    217217    internal System.Windows.Forms.ComboBox variableNamesCombo;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.cs

    r17180 r18132  
    5757      var combo = (ComboBox)sender;
    5858      var symbol = combo.Items[combo.SelectedIndex];
    59       if (symbol is Constant) {
    60         // add controls to the dialog for changing the constant value
     59      if (symbol is Number) {
     60        // add controls to the dialog for changing the number value
    6161        variableNameLabel.Visible = false;
    6262        variableNamesCombo.Visible = false;
    6363        variableWeightLabel.Visible = false;
    6464        variableWeightTextBox.Visible = false;
    65         constantValueLabel.Visible = true;
    66         constantValueTextBox.Visible = true;
     65        numberValueLabel.Visible = true;
     66        numberValueTextBox.Visible = true;
    6767      } else if (symbol is VariableBase) {
    6868        var variableSymbol = (VariableBase)symbol;
     
    8080        variableWeightLabel.Visible = true;
    8181        variableWeightTextBox.Visible = true;
    82         constantValueLabel.Visible = false;
    83         constantValueTextBox.Visible = false;
     82        numberValueLabel.Visible = false;
     83        numberValueTextBox.Visible = false;
    8484        // add controls to the dialog for changing the variable name or weight
    8585      } else {
     
    8888        variableWeightLabel.Visible = false;
    8989        variableWeightTextBox.Visible = false;
    90         constantValueLabel.Visible = false;
    91         constantValueTextBox.Visible = false;
     90        numberValueLabel.Visible = false;
     91        numberValueTextBox.Visible = false;
    9292      }
    9393    }
     
    102102    }
    103103
    104     private void constantValueTextBox_Validating(object sender, CancelEventArgs e) {
     104    private void numberValueTextBox_Validating(object sender, CancelEventArgs e) {
    105105      string errorMessage;
    106       if (ValidateDoubleValue(constantValueTextBox.Text, out errorMessage)) return;
     106      if (ValidateDoubleValue(numberValueTextBox.Text, out errorMessage)) return;
    107107      e.Cancel = true;
    108       errorProvider.SetError(constantValueTextBox, errorMessage);
    109       constantValueTextBox.SelectAll();
     108      errorProvider.SetError(numberValueTextBox, errorMessage);
     109      numberValueTextBox.SelectAll();
    110110    }
    111111
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.cs

    r17180 r18132  
    6060    private void InitializeFields() {
    6161      if (NewNode == null)
    62         throw new ArgumentException("Node is not a constant.");
     62        throw new ArgumentException("Node is not a variable node.");
    6363      else {
    6464        this.Text = "Edit variable";
Note: See TracChangeset for help on using the changeset viewer.