Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9056 for trunk


Ignore:
Timestamp:
12/14/12 12:25:37 (12 years ago)
Author:
bburlacu
Message:

#1763: Disabled paste option when attempting to cut/paste a subtree into itself.

File:
1 edited

Legend:

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

    r9055 r9056  
    7373        cutToolStripMenuItem.Visible = true;
    7474        removeToolStripMenuItem.Visible = true;
     75
    7576        pasteToolStripMenuItem.Visible = true;
    76         pasteToolStripMenuItem.Enabled = tempNode != null && insertNodeToolStripMenuItem.Enabled;
     77        pasteToolStripMenuItem.Enabled = tempNode != null && insertNodeToolStripMenuItem.Enabled
     78                                                          && !(lastOp == EditOp.CutSubtree
     79                                                               && tempNode.IterateNodesBreadth().Contains(currSelected.SymbolicExpressionTreeNode));
    7780      }
    7881    }
     
    214217        case EditOp.CutSubtree: {
    215218            if (tempNode.IterateNodesBreadth().Contains(node))
    216               goto case EditOp.CopySubtree; // a subtree cannot be cut/pasted onto itself
    217             ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent
    218             ModifyTree(Tree, node, null, tempNode); //insert it as a child to the new parent
    219             lastOp = EditOp.CopySubtree; //do this so the next paste will actually perform a copy   
     219              throw new ArgumentException();
    220220            break;
    221221          }
Note: See TracChangeset for help on using the changeset viewer.