Changeset 8991
- Timestamp:
- 12/03/12 16:07:28 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.Designer.cs
r8980 r8991 48 48 private void InitializeComponent() { 49 49 this.insertNodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 this.editNodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 51 this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 52 this.copyNodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 this.copySubtreeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 this.changeNodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 51 this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 55 this.cutNodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 56 this.cutSubtreeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 57 this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 58 this.deleteNodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 59 this.deleteSubtreeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 52 this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 this.removeNodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 this.removeSubtreeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 60 55 this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 61 56 this.treeStatusLabel = new System.Windows.Forms.Label(); 62 57 this.treeStatusValue = new System.Windows.Forms.Label(); 58 this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); 59 this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 63 60 this.SuspendLayout(); 64 61 // … … 66 63 // 67 64 this.insertNodeToolStripMenuItem.Name = "insertNodeToolStripMenuItem"; 68 this.insertNodeToolStripMenuItem.Size = new System.Drawing.Size(1 35, 22);65 this.insertNodeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 69 66 this.insertNodeToolStripMenuItem.Text = "Insert Node"; 70 67 this.insertNodeToolStripMenuItem.Click += new System.EventHandler(this.insertNodeToolStripMenuItem_Click); 71 68 // 72 // editNodeToolStripMenuItem69 // changeNodeToolStripMenuItem 73 70 // 74 this. editNodeToolStripMenuItem.Name = "editNodeToolStripMenuItem";75 this. editNodeToolStripMenuItem.Size = new System.Drawing.Size(135, 22);76 this. editNodeToolStripMenuItem.Text = "Edit";77 this. editNodeToolStripMenuItem.Click += new System.EventHandler(this.editNodeToolStripMenuItem_Click);71 this.changeNodeToolStripMenuItem.Name = "editNodeToolStripMenuItem"; 72 this.changeNodeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 73 this.changeNodeToolStripMenuItem.Text = "Change Node"; 74 this.changeNodeToolStripMenuItem.Click += new System.EventHandler(this.changeNodeToolStripMenuItem_Click); 78 75 // 79 76 // copyToolStripMenuItem 80 77 // 81 this.copyToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {82 this.copyNodeToolStripMenuItem,83 this.copySubtreeToolStripMenuItem});84 78 this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; 85 this.copyToolStripMenuItem.Size = new System.Drawing.Size(1 35, 22);79 this.copyToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 86 80 this.copyToolStripMenuItem.Text = "Copy"; 87 // 88 // copyNodeToolStripMenuItem 89 // 90 this.copyNodeToolStripMenuItem.Name = "copyNodeToolStripMenuItem"; 91 this.copyNodeToolStripMenuItem.Size = new System.Drawing.Size(114, 22); 92 this.copyNodeToolStripMenuItem.Text = "Node"; 93 this.copyNodeToolStripMenuItem.Click += new System.EventHandler(this.copyNodeToolStripMenuItem_Click); 94 // 95 // copySubtreeToolStripMenuItem 96 // 97 this.copySubtreeToolStripMenuItem.Name = "copySubtreeToolStripMenuItem"; 98 this.copySubtreeToolStripMenuItem.Size = new System.Drawing.Size(114, 22); 99 this.copySubtreeToolStripMenuItem.Text = "Subtree"; 100 this.copySubtreeToolStripMenuItem.Click += new System.EventHandler(this.copySubtreeToolStripMenuItem_Click); 81 this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click); 101 82 // 102 83 // cutToolStripMenuItem 103 84 // 104 this.cutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {105 this.cutNodeToolStripMenuItem,106 this.cutSubtreeToolStripMenuItem});107 85 this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; 108 this.cutToolStripMenuItem.Size = new System.Drawing.Size(1 35, 22);86 this.cutToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 109 87 this.cutToolStripMenuItem.Text = "Cut"; 88 this.cutToolStripMenuItem.Click += new System.EventHandler(this.cutToolStripMenuItem_Click); 110 89 // 111 // cutNodeToolStripMenuItem90 // removeToolStripMenuItem 112 91 // 113 this.cutNodeToolStripMenuItem.Name = "cutNodeToolStripMenuItem"; 114 this.cutNodeToolStripMenuItem.Size = new System.Drawing.Size(114, 22); 115 this.cutNodeToolStripMenuItem.Text = "Node"; 116 this.cutNodeToolStripMenuItem.Click += new System.EventHandler(this.cutNodeToolStripMenuItem_Click); 92 this.removeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 93 this.removeNodeToolStripMenuItem, 94 this.removeSubtreeToolStripMenuItem}); 95 this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; 96 this.removeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 97 this.removeToolStripMenuItem.Text = "Remove"; 98 this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeSubtreeToolStripMenuItem_Click); 117 99 // 118 // cutSubtreeToolStripMenuItem100 // removeNodeToolStripMenuItem 119 101 // 120 this. cutSubtreeToolStripMenuItem.Name = "cutSubtreeToolStripMenuItem";121 this. cutSubtreeToolStripMenuItem.Size = new System.Drawing.Size(114, 22);122 this. cutSubtreeToolStripMenuItem.Text = "Subtree";123 this. cutSubtreeToolStripMenuItem.Click += new System.EventHandler(this.cutSubtreeToolStripMenuItem_Click);102 this.removeNodeToolStripMenuItem.Name = "removeNodeToolStripMenuItem"; 103 this.removeNodeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 104 this.removeNodeToolStripMenuItem.Text = "Node"; 105 this.removeNodeToolStripMenuItem.Click += new System.EventHandler(this.removeNodeToolStripMenuItem_Click); 124 106 // 125 // deleteToolStripMenuItem107 // removeSubtreeToolStripMenuItem 126 108 // 127 this.deleteToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 128 this.deleteNodeToolStripMenuItem, 129 this.deleteSubtreeToolStripMenuItem}); 130 this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; 131 this.deleteToolStripMenuItem.Size = new System.Drawing.Size(135, 22); 132 this.deleteToolStripMenuItem.Text = "Delete"; 133 // 134 // deleteNodeToolStripMenuItem 135 // 136 this.deleteNodeToolStripMenuItem.Name = "deleteNodeToolStripMenuItem"; 137 this.deleteNodeToolStripMenuItem.Size = new System.Drawing.Size(114, 22); 138 this.deleteNodeToolStripMenuItem.Text = "Node"; 139 this.deleteNodeToolStripMenuItem.Click += new System.EventHandler(this.deleteNodeToolStripMenuItem_Click); 140 // 141 // deleteSubtreeToolStripMenuItem 142 // 143 this.deleteSubtreeToolStripMenuItem.Name = "deleteSubtreeToolStripMenuItem"; 144 this.deleteSubtreeToolStripMenuItem.Size = new System.Drawing.Size(114, 22); 145 this.deleteSubtreeToolStripMenuItem.Text = "Subtree"; 146 this.deleteSubtreeToolStripMenuItem.Click += new System.EventHandler(this.deleteSubtreeToolStripMenuItem_Click); 109 this.removeSubtreeToolStripMenuItem.Name = "removeSubtreeToolStripMenuItem"; 110 this.removeSubtreeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 111 this.removeSubtreeToolStripMenuItem.Text = "Subtree"; 112 this.removeSubtreeToolStripMenuItem.Click += new System.EventHandler(this.removeSubtreeToolStripMenuItem_Click); 147 113 // 148 114 // pasteToolStripMenuItem 149 115 // 150 116 this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; 151 this.pasteToolStripMenuItem.Size = new System.Drawing.Size(1 35, 22);117 this.pasteToolStripMenuItem.Size = new System.Drawing.Size(152, 22); 152 118 this.pasteToolStripMenuItem.Text = "Paste"; 153 119 this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Clicked); 154 // 155 // contextMenuStrip 156 // 120 // 121 // contextMenuStrip 122 // 157 123 this.contextMenuStrip.Opened += this.contextMenuStrip_Opened; 158 124 this.contextMenuStrip.Items.AddRange(new ToolStripItem[] { insertNodeToolStripMenuItem, 159 editNodeToolStripMenuItem,160 copyToolStripMenuItem,161 cutToolStripMenuItem,162 deleteToolStripMenuItem,163 125 changeNodeToolStripMenuItem, 126 copyToolStripMenuItem, 127 cutToolStripMenuItem, 128 removeToolStripMenuItem, 129 pasteToolStripMenuItem }); 164 130 // 165 131 // treeStatusLabel … … 184 150 this.treeStatusValue.Text = "Valid"; 185 151 // 152 // toolStripSeparator 153 // 154 this.toolStripSeparator.Name = "toolStripSeparator"; 155 this.toolStripSeparator.Size = new System.Drawing.Size(149, 6); 156 // 186 157 // InteractiveSymbolicExpressionTreeChart 187 158 // … … 199 170 200 171 private ToolStripMenuItem insertNodeToolStripMenuItem; 201 private ToolStripMenuItem editNodeToolStripMenuItem; 202 private ToolStripMenuItem copyToolStripMenuItem; 203 private ToolStripMenuItem copyNodeToolStripMenuItem; 204 private ToolStripMenuItem copySubtreeToolStripMenuItem; 172 private ToolStripMenuItem changeNodeToolStripMenuItem; 205 173 private ToolStripMenuItem cutToolStripMenuItem; 206 private ToolStripMenuItem cutNodeToolStripMenuItem;207 private ToolStripMenuItem cutSubtreeToolStripMenuItem;208 174 private ToolStripMenuItem pasteToolStripMenuItem; 209 private ToolStripMenuItem deleteToolStripMenuItem;210 private ToolStripMenuItem deleteNodeToolStripMenuItem;211 private ToolStripMenuItem deleteSubtreeToolStripMenuItem;175 private ToolStripMenuItem removeToolStripMenuItem; 176 private ToolStripMenuItem removeNodeToolStripMenuItem; 177 private ToolStripMenuItem removeSubtreeToolStripMenuItem; 212 178 213 179 #endregion 214 180 private Label treeStatusLabel; 215 181 private Label treeStatusValue; 182 private ToolStripSeparator toolStripSeparator; 183 private ToolStripMenuItem copyToolStripMenuItem; 216 184 } 217 185 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs
r8981 r8991 32 32 private ISymbolicExpressionTreeNode tempNode; // node in clipboard (to be cut/copy/pasted etc) 33 33 private VisualSymbolicExpressionTreeNode currSelected; // currently selected node 34 private enum EditOp { NoOp, CopyNode, CopySubtree, CutNode, CutSubtree, DeleteNode, DeleteSubtree }34 private enum EditOp { NoOp, CopyNode, CopySubtree, CutNode, CutSubtree, RemoveNode, RemoveSubtree } 35 35 private enum TreeState { Valid, Invalid } 36 36 private EditOp lastOp = EditOp.NoOp; … … 63 63 treeStatusValue.ForeColor = Color.Red; 64 64 treeState = TreeState.Invalid; 65 Repaint();65 Tree = Tree; // reinitialize the dictionaries and repaint 66 66 } 67 67 foreach (var node in originalNodes.Keys) { … … 81 81 if (currSelected == null) { 82 82 insertNodeToolStripMenuItem.Visible = false; 83 editNodeToolStripMenuItem.Visible = false;83 changeNodeToolStripMenuItem.Visible = false; 84 84 copyToolStripMenuItem.Visible = false; 85 85 cutToolStripMenuItem.Visible = false; 86 deleteToolStripMenuItem.Visible = false;86 removeToolStripMenuItem.Visible = false; 87 87 pasteToolStripMenuItem.Visible = false; 88 88 } else { 89 89 var node = currSelected.SymbolicExpressionTreeNode; 90 editNodeToolStripMenuItem.Visible = (node is SymbolicExpressionTreeTerminalNode); 91 insertNodeToolStripMenuItem.Visible = !editNodeToolStripMenuItem.Visible; 90 insertNodeToolStripMenuItem.Visible = true; 91 changeNodeToolStripMenuItem.Visible = true; 92 changeNodeToolStripMenuItem.Enabled = (node is SymbolicExpressionTreeTerminalNode); 93 insertNodeToolStripMenuItem.Enabled = !changeNodeToolStripMenuItem.Enabled; 92 94 copyToolStripMenuItem.Visible = true; 93 95 cutToolStripMenuItem.Visible = true; 94 deleteToolStripMenuItem.Visible = true; 95 pasteToolStripMenuItem.Visible = tempNode != null && insertNodeToolStripMenuItem.Visible; 96 removeToolStripMenuItem.Visible = true; 97 pasteToolStripMenuItem.Visible = true; 98 pasteToolStripMenuItem.Enabled = tempNode != null && insertNodeToolStripMenuItem.Enabled; 96 99 } 97 100 } … … 175 178 } 176 179 177 private void editNodeToolStripMenuItem_Click(object sender, EventArgs e) {180 private void changeNodeToolStripMenuItem_Click(object sender, EventArgs e) { 178 181 if (currSelected == null) return; 179 182 … … 212 215 } 213 216 214 private void cutNodeToolStripMenuItem_Click(object sender, EventArgs e) { 215 lastOp = EditOp.CutNode; 216 tempNode = currSelected.SymbolicExpressionTreeNode; 217 var visualNode = GetVisualSymbolicExpressionTreeNode(tempNode); 218 visualNode.LineColor = Color.LightGray; 219 visualNode.TextColor = Color.LightGray; 220 Repaint(); 221 } 222 223 private void cutSubtreeToolStripMenuItem_Click(object sender, EventArgs e) { 217 private void cutToolStripMenuItem_Click(object sender, EventArgs e) { 224 218 lastOp = EditOp.CutSubtree; 225 219 tempNode = currSelected.SymbolicExpressionTreeNode; … … 238 232 } 239 233 240 private void copyNodeToolStripMenuItem_Click(object sender, EventArgs e) { 241 lastOp = EditOp.CopyNode; 242 tempNode = currSelected.SymbolicExpressionTreeNode; 243 currSelected.LineColor = Color.LightGray; 244 currSelected.TextColor = Color.LightGray; 245 Repaint(); 246 } 247 248 private void copySubtreeToolStripMenuItem_Click(object sender, EventArgs e) { 234 private void copyToolStripMenuItem_Click(object sender, EventArgs e) { 249 235 lastOp = EditOp.CopySubtree; 250 236 tempNode = currSelected.SymbolicExpressionTreeNode; … … 262 248 } 263 249 264 private void deleteNodeToolStripMenuItem_Click(object sender, EventArgs e) {265 lastOp = EditOp. DeleteNode;250 private void removeNodeToolStripMenuItem_Click(object sender, EventArgs e) { 251 lastOp = EditOp.RemoveNode; 266 252 var node = currSelected.SymbolicExpressionTreeNode; 267 253 var parent = node.Parent; … … 276 262 } 277 263 } 264 OnSymbolicExpressionTreeChanged(sender, e); 278 265 currSelected = null; // because the currently selected node was just deleted 279 OnSymbolicExpressionTreeChanged(sender, e); 280 } 281 282 private void deleteSubtreeToolStripMenuItem_Click(object sender, EventArgs e) { 283 lastOp = EditOp.DeleteSubtree; 266 } 267 268 private void removeSubtreeToolStripMenuItem_Click(object sender, EventArgs e) { 269 lastOp = EditOp.RemoveSubtree; 284 270 var node = currSelected.SymbolicExpressionTreeNode; 285 271 var parent = node.Parent; … … 287 273 return; // the operation makes no sense as it would result in the deletion of the entire tree 288 274 parent.RemoveSubtree(parent.IndexOfSubtree(node)); 275 OnSymbolicExpressionTreeChanged(sender, e); 289 276 currSelected = null; // because the currently selected node was just deleted 290 OnSymbolicExpressionTreeChanged(sender, e);291 277 } 292 278
Note: See TracChangeset
for help on using the changeset viewer.