Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/04/14 13:38:38 (10 years ago)
Author:
bburlacu
Message:

#1763: Introduced tree editing functionality directly into the trunk code, with minor changes: simplified drawing (eg when highlighting subtrees from the clipboard), fixed small bug in MinArity function. The branch can be deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs

    r10561 r11086  
    8383    protected override void OnSymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) {
    8484      currSelected = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; ;
    85       if (currSelected != null) {
    86         currSelected.LineColor = Color.FromArgb(130, currSelected.LineColor);
    87         RepaintNode(currSelected);
    88       }
    8985      base.OnSymbolicExpressionTreeNodeClicked(sender, e);
    90     }
    91 
    92     protected override void SymbolicExpressionTreeChart_MouseClick(object sender, MouseEventArgs e) {
    93       if (currSelected != null) {
    94         currSelected.LineColor = Color.FromArgb(255, currSelected.LineColor);
    95         RepaintNode(currSelected);
    96       }
    97       base.SymbolicExpressionTreeChart_MouseClick(sender, e);
    9886    }
    9987
     
    10896
    10997      using (var dialog = new InsertNodeDialog()) {
    110         dialog.SetAllowedSymbols(parent.Grammar.AllowedSymbols.Where(s => s.Enabled && s.InitialFrequency > 0.0 && !(s is ProgramRootSymbol || s is StartSymbol || s is Defun)));
     98        dialog.SetAllowedSymbols(parent.Grammar.Symbols.Where(s => !(s is ProgramRootSymbol || s is StartSymbol || s is Defun))); // allow everything
    11199        dialog.ShowDialog(this);
    112100        if (dialog.DialogResult != DialogResult.OK) return;
     
    172160        foreach (var subtree in tempNode.IterateNodesPostfix()) {
    173161          var visualNode = GetVisualSymbolicExpressionTreeNode(subtree);
    174           visualNode.LineColor = Color.FromArgb(255, visualNode.LineColor); // reset the alpha value to 255
    175           visualNode.TextColor = Color.FromArgb(255, visualNode.TextColor);
     162          visualNode.LineColor = Color.Black;
     163          visualNode.TextColor = Color.Black;
    176164          if (subtree.Parent != null) {
    177165            var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(subtree.Parent, subtree);
    178             visualLine.LineColor = Color.FromArgb(255, visualLine.LineColor);
     166            visualLine.LineColor = Color.Black;
    179167          }
    180168        }
     
    183171      foreach (var node in tempNode.IterateNodesPostfix()) {
    184172        var visualNode = GetVisualSymbolicExpressionTreeNode(node);
    185         visualNode.LineColor = Color.FromArgb(100, visualNode.LineColor);
    186         visualNode.TextColor = Color.FromArgb(100, visualNode.TextColor);
     173        visualNode.LineColor = Color.LightGray;
     174        visualNode.TextColor = Color.LightGray;
    187175        foreach (var subtree in node.Subtrees) {
    188176          var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(node, subtree);
    189           visualLine.LineColor = Color.FromArgb(100, visualLine.LineColor);
    190         }
    191       }
    192       currSelected = null;
    193       Repaint();
     177          visualLine.LineColor = Color.LightGray;
     178        }
     179      }
     180      currSelected = null;
     181      RepaintNodes(); // no need to redo the layout and repaint everything since this operation does not change the tree
    194182    }
    195183    private void removeNodeToolStripMenuItem_Click(object sender, EventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.