Changeset 7274
- Timestamp:
- 01/05/12 03:03:50 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentTreeView.Designer.cs
r7259 r7274 48 48 this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); 49 49 this.ExpandToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 this.ExpandAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 51 this.CollapseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 52 this.CollapseAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 51 53 this.EditNodeLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 52 54 this.toolTip = new System.Windows.Forms.ToolTip(this.components); … … 222 224 this.EditNodeLabelToolStripMenuItem, 223 225 this.ExpandToolStripMenuItem, 224 this.CollapseToolStripMenuItem}); 226 this.ExpandAllToolStripMenuItem, 227 this.CollapseToolStripMenuItem, 228 this.CollapseAllToolStripMenuItem}); 225 229 this.contextMenuStrip.Name = "contextMenuStrip"; 226 230 this.contextMenuStrip.Size = new System.Drawing.Size(120, 48); … … 233 237 this.ExpandToolStripMenuItem.Click += new System.EventHandler(this.ExpandToolStripMenuItem_Click); 234 238 // 239 // ExpandAllToolStripMenuItem 240 // 241 this.ExpandAllToolStripMenuItem.Name = "ExpandAllToolStripMenuItem"; 242 this.ExpandAllToolStripMenuItem.Size = new System.Drawing.Size(119, 22); 243 this.ExpandAllToolStripMenuItem.Text = "Expand All"; 244 this.ExpandAllToolStripMenuItem.Click += new System.EventHandler(this.ExpandAllToolStripMenuItem_Click); 245 // 235 246 // CollapseToolStripMenuItem 236 247 // … … 239 250 this.CollapseToolStripMenuItem.Text = "Collapse"; 240 251 this.CollapseToolStripMenuItem.Click += new System.EventHandler(this.CollapseToolStripMenuItem_Click); 252 // 253 // CollapseAllToolStripMenuItem 254 // 255 this.CollapseAllToolStripMenuItem.Name = "CollapseAllToolStripMenuItem"; 256 this.CollapseAllToolStripMenuItem.Size = new System.Drawing.Size(119, 22); 257 this.CollapseAllToolStripMenuItem.Text = "Collapse All"; 258 this.CollapseAllToolStripMenuItem.Click += new System.EventHandler(this.CollapseAllToolStripMenuItem_Click); 241 259 // 242 260 // EditNodeLabelToolStripMenuItem … … 281 299 private System.Windows.Forms.ContextMenuStrip contextMenuStrip; 282 300 private System.Windows.Forms.ToolStripMenuItem ExpandToolStripMenuItem; 301 private System.Windows.Forms.ToolStripMenuItem ExpandAllToolStripMenuItem; 283 302 private System.Windows.Forms.ToolStripMenuItem CollapseToolStripMenuItem; 303 private System.Windows.Forms.ToolStripMenuItem CollapseAllToolStripMenuItem; 284 304 private System.Windows.Forms.ToolStripMenuItem EditNodeLabelToolStripMenuItem; 285 305 -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentTreeView.cs
r7259 r7274 652 652 SetEnabledStateOfControls(); 653 653 654 ExpandToolStripMenuItem.Enabled = !toolStripMenuNode.IsExpanded && toolStripMenuNode.Nodes.Count > 0; 655 ExpandToolStripMenuItem.Visible = !toolStripMenuNode.IsExpanded && toolStripMenuNode.Nodes.Count > 0; 656 CollapseToolStripMenuItem.Enabled = toolStripMenuNode.IsExpanded; 657 CollapseToolStripMenuItem.Visible = toolStripMenuNode.IsExpanded; 658 EditNodeLabelToolStripMenuItem.Enabled = !Locked && !ReadOnly && toolStripMenuNode.Tag != null && toolStripMenuNode.Tag is INamedItem && ((INamedItem)toolStripMenuNode.Tag).CanChangeName; 659 EditNodeLabelToolStripMenuItem.Visible = !Locked && !ReadOnly && toolStripMenuNode.Tag != null && toolStripMenuNode.Tag is INamedItem && ((INamedItem)toolStripMenuNode.Tag).CanChangeName; 660 if (contextMenuStrip.Items.Cast<ToolStripMenuItem>().Any(item => item.Enabled)) 661 contextMenuStrip.Show(Cursor.Position); 662 } 654 ExpandToolStripMenuItem.Enabled = ExpandToolStripMenuItem.Visible = !toolStripMenuNode.IsExpanded && toolStripMenuNode.Nodes.Count > 0; 655 CollapseToolStripMenuItem.Enabled = CollapseToolStripMenuItem.Visible = toolStripMenuNode.IsExpanded; 656 EditNodeLabelToolStripMenuItem.Enabled = EditNodeLabelToolStripMenuItem.Visible = !Locked && !ReadOnly && toolStripMenuNode.Tag != null && toolStripMenuNode.Tag is INamedItem && ((INamedItem)toolStripMenuNode.Tag).CanChangeName; 657 } else { 658 ExpandToolStripMenuItem.Enabled = ExpandToolStripMenuItem.Visible = false; 659 CollapseToolStripMenuItem.Enabled = CollapseToolStripMenuItem.Visible = false; 660 EditNodeLabelToolStripMenuItem.Enabled = EditNodeLabelToolStripMenuItem.Visible = false; 661 } 662 ExpandAllToolStripMenuItem.Enabled = ExpandAllToolStripMenuItem.Visible = !treeView.Nodes.OfType<TreeNode>().All(x => TreeNodeIsFullyExpanded(x)); 663 CollapseAllToolStripMenuItem.Enabled = CollapseAllToolStripMenuItem.Visible = treeView.Nodes.OfType<TreeNode>().Any(x => x.IsExpanded); 664 if (contextMenuStrip.Items.Cast<ToolStripMenuItem>().Any(item => item.Enabled)) 665 contextMenuStrip.Show(Cursor.Position); 663 666 } 664 667 … … 681 684 if (toolStripMenuNode != null) toolStripMenuNode.ExpandAll(); 682 685 } 686 private void ExpandAllToolStripMenuItem_Click(object sender, EventArgs e) { 687 treeView.ExpandAll(); 688 } 683 689 private void CollapseToolStripMenuItem_Click(object sender, EventArgs e) { 684 690 if (toolStripMenuNode != null) toolStripMenuNode.Collapse(); 691 } 692 private void CollapseAllToolStripMenuItem_Click(object sender, EventArgs e) { 693 treeView.CollapseAll(); 685 694 } 686 695 private void EditNodeLabelToolStripMenuItem_Click(object sender, EventArgs e) { … … 723 732 algorithm.Problem = problem; 724 733 } 725 } catch (Exception ex) { 734 } 735 catch (Exception ex) { 726 736 ErrorHandling.ShowErrorDialog(this, ex); 727 737 } … … 871 881 } 872 882 883 private bool TreeNodeIsFullyExpanded(TreeNode node) { 884 return (node.Nodes.Count == 0) || (node.IsExpanded && node.Nodes.OfType<TreeNode>().All(x => TreeNodeIsFullyExpanded(x))); 885 } 886 873 887 private void RebuildImageList() { 874 888 if (InvokeRequired) {
Note: See TracChangeset
for help on using the changeset viewer.