Changeset 13614
- Timestamp:
- 02/09/16 10:26:09 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DockForm.Designer.cs
r13458 r13614 66 66 this.contextMenuStrip.Name = "contextMenuStrip"; 67 67 this.contextMenuStrip.Size = new System.Drawing.Size(167, 120); 68 this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Opening); 68 69 // 69 70 // closeToolStripMenuItem -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DockForm.cs
r13458 r13614 116 116 117 117 #region Context Menu Events 118 private void contextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) { 119 var contentView = View as IContentView; 120 var content = contentView != null ? contentView.Content : null; 121 122 cloneToolStripMenuItem.Enabled = contentView != null && !contentView.Locked && content is IDeepCloneable; 123 } 124 118 125 private void closeToolStripMenuItem_Click(object sender, EventArgs e) { 119 126 Close(); 120 127 } 121 128 private void closeAllToolStripMenuItem_Click(object sender, EventArgs e) { 122 foreach (var dockForm in CurrentDockForms .ToList()) {129 foreach (var dockForm in CurrentDockForms) { 123 130 dockForm.Close(); 124 131 } 125 132 } 126 133 private void closeAllButThisToolStripMenuItem_Click(object sender, EventArgs e) { 127 foreach (var dockForm in CurrentDockForms.Except(this.ToEnumerable()) .ToList()) {134 foreach (var dockForm in CurrentDockForms.Except(this.ToEnumerable())) { 128 135 dockForm.Close(); 129 136 } … … 131 138 private IEnumerable<DockForm> CurrentDockForms { 132 139 get { 133 return DockPanel.ActivePane.IsActiveDocumentPane 134 ? DockPanel.Documents.OfType<DockForm>() 135 : DockPanel.ActivePane.Contents.OfType<DockForm>(); 136 // ActivePane.Contents contains all dockforms if ActivePane is the main DocumentPane 140 var dockForms = Pane.Contents.OfType<DockForm>().Where(c => c.Pane == Pane); // Pane.Contents contains DockForms that are not placed on that pane 141 return dockForms.ToList(); // .ToList() necessary because closing a DockForm removes it from the Content collection 137 142 } 138 143 } … … 146 151 147 152 var clone = (IContent)cloneable.Clone(); 148 MainFormManager.MainForm.ShowContent(clone); 153 154 var viewHost = contentView as ViewHost; 155 var newView = viewHost != null ? viewHost.ViewType : contentView.GetType(); 156 MainFormManager.MainForm.ShowContent(clone, newView); 149 157 } 150 158 #endregion
Note: See TracChangeset
for help on using the changeset viewer.