Changeset 16692 for branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms
- Timestamp:
- 03/18/19 17:24:30 (6 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DockForm.Designer.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 34 34 /// </summary> 35 35 private void InitializeComponent() { 36 this.components = new System.ComponentModel.Container(); 36 37 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DockForm)); 37 38 this.viewPanel = new System.Windows.Forms.Panel(); 39 this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); 40 this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 41 this.closeAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 42 this.closeAllButThisToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 43 this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 44 this.cloneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 45 this.contextMenuStrip.SuspendLayout(); 38 46 this.SuspendLayout(); 39 47 // 40 48 // viewPanel 41 49 // 42 this.viewPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 43 | System.Windows.Forms.AnchorStyles.Left)44 50 this.viewPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 51 | System.Windows.Forms.AnchorStyles.Left) 52 | System.Windows.Forms.AnchorStyles.Right))); 45 53 this.viewPanel.Location = new System.Drawing.Point(12, 12); 46 54 this.viewPanel.Name = "viewPanel"; … … 48 56 this.viewPanel.TabIndex = 0; 49 57 // 58 // contextMenuStrip 59 // 60 this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 61 this.closeToolStripMenuItem, 62 this.closeAllToolStripMenuItem, 63 this.closeAllButThisToolStripMenuItem, 64 this.toolStripSeparator1, 65 this.cloneToolStripMenuItem}); 66 this.contextMenuStrip.Name = "contextMenuStrip"; 67 this.contextMenuStrip.Size = new System.Drawing.Size(167, 120); 68 this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Opening); 69 // 70 // closeToolStripMenuItem 71 // 72 this.closeToolStripMenuItem.Name = "closeToolStripMenuItem"; 73 this.closeToolStripMenuItem.Size = new System.Drawing.Size(166, 22); 74 this.closeToolStripMenuItem.Text = "Close"; 75 this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click); 76 // 77 // closeAllToolStripMenuItem 78 // 79 this.closeAllToolStripMenuItem.Name = "closeAllToolStripMenuItem"; 80 this.closeAllToolStripMenuItem.Size = new System.Drawing.Size(166, 22); 81 this.closeAllToolStripMenuItem.Text = "Close All"; 82 this.closeAllToolStripMenuItem.Click += new System.EventHandler(this.closeAllToolStripMenuItem_Click); 83 // 84 // closeAllButThisToolStripMenuItem 85 // 86 this.closeAllButThisToolStripMenuItem.Name = "closeAllButThisToolStripMenuItem"; 87 this.closeAllButThisToolStripMenuItem.Size = new System.Drawing.Size(166, 22); 88 this.closeAllButThisToolStripMenuItem.Text = "Close All But This"; 89 this.closeAllButThisToolStripMenuItem.Click += new System.EventHandler(this.closeAllButThisToolStripMenuItem_Click); 90 // 91 // toolStripSeparator1 92 // 93 this.toolStripSeparator1.Name = "toolStripSeparator1"; 94 this.toolStripSeparator1.Size = new System.Drawing.Size(163, 6); 95 // 96 // cloneToolStripMenuItem 97 // 98 this.cloneToolStripMenuItem.Name = "cloneToolStripMenuItem"; 99 this.cloneToolStripMenuItem.Size = new System.Drawing.Size(166, 22); 100 this.cloneToolStripMenuItem.Text = "Create Copy"; 101 this.cloneToolStripMenuItem.Click += new System.EventHandler(this.cloneToolStripMenuItem_Click); 102 // 50 103 // DockForm 51 104 // 52 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);53 105 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 54 106 this.ClientSize = new System.Drawing.Size(632, 446); … … 59 111 this.ShowInTaskbar = false; 60 112 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 113 this.TabPageContextMenuStrip = this.contextMenuStrip; 114 this.contextMenuStrip.ResumeLayout(false); 61 115 this.ResumeLayout(false); 116 62 117 } 63 118 … … 65 120 66 121 private System.Windows.Forms.Panel viewPanel; 122 private System.Windows.Forms.ContextMenuStrip contextMenuStrip; 123 private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem; 124 private System.Windows.Forms.ToolStripMenuItem closeAllToolStripMenuItem; 125 private System.Windows.Forms.ToolStripMenuItem closeAllButThisToolStripMenuItem; 126 private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 127 private System.Windows.Forms.ToolStripMenuItem cloneToolStripMenuItem; 67 128 } 68 129 } -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DockForm.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using System.Windows.Forms; 26 using HeuristicLab.Common; 24 27 using WeifenLuo.WinFormsUI.Docking; 25 28 … … 29 32 /// </summary> 30 33 internal partial class DockForm : DockContent { 31 public DockForm(IView view ) {34 public DockForm(IView view, bool allowContextMenu) { 32 35 InitializeComponent(); 33 36 this.view = view; 37 this.allowContextMenu = allowContextMenu; 38 34 39 if (view != null) { 35 40 if (view is UserControl) { … … 87 92 get { return this.view; } 88 93 } 94 private readonly bool allowContextMenu; 89 95 90 96 private void UpdateText() { … … 111 117 } 112 118 #endregion 119 120 #region Context Menu Events 121 private void contextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) { 122 if (!allowContextMenu) { 123 e.Cancel = true; 124 return; 125 } 126 127 var contentView = View as IContentView; 128 var content = contentView != null ? contentView.Content : null; 129 130 cloneToolStripMenuItem.Enabled = contentView != null && !contentView.Locked && content is IDeepCloneable; 131 } 132 133 private void closeToolStripMenuItem_Click(object sender, EventArgs e) { 134 Close(); 135 } 136 private void closeAllToolStripMenuItem_Click(object sender, EventArgs e) { 137 foreach (var dockForm in CurrentDockForms) { 138 dockForm.Close(); 139 } 140 } 141 private void closeAllButThisToolStripMenuItem_Click(object sender, EventArgs e) { 142 foreach (var dockForm in CurrentDockForms.Except(this.ToEnumerable())) { 143 dockForm.Close(); 144 } 145 } 146 private IEnumerable<DockForm> CurrentDockForms { 147 get { 148 var dockForms = Pane.Contents.OfType<DockForm>().Where(c => c.Pane == Pane); // Pane.Contents contains DockForms that are not placed on that pane 149 return dockForms.ToList(); // .ToList() necessary because closing a DockForm removes it from the Content collection 150 } 151 } 152 153 private void cloneToolStripMenuItem_Click(object sender, EventArgs e) { 154 var contentView = View as IContentView; 155 if (contentView == null) return; 156 157 var cloneable = contentView.Content as IDeepCloneable; 158 if (cloneable == null) return; 159 160 var clone = (IContent)cloneable.Clone(); 161 162 var viewHost = contentView as ViewHost; 163 var newView = viewHost != null ? viewHost.ViewType : contentView.GetType(); 164 MainFormManager.MainForm.ShowContent(clone, newView); 165 } 166 #endregion 113 167 } 114 168 } -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DockingMainForm.Designer.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DockingMainForm.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 namespace HeuristicLab.MainForm.WindowsForms { 26 26 public partial class DockingMainForm : MainForm { 27 28 public bool AllowContexMenu { get; set; } 29 27 30 public DockingMainForm() 28 31 : base() { 29 32 InitializeComponent(); 33 AllowContexMenu = true; 30 34 } 31 35 public DockingMainForm(Type userInterfaceItemType) 32 36 : base(userInterfaceItemType) { 33 37 InitializeComponent(); 38 AllowContexMenu = true; 34 39 } 35 40 public DockingMainForm(Type userInterfaceItemType, bool showContentInViewHost) … … 60 65 61 66 protected override Form CreateForm(IView view) { 62 return new DockForm(view );67 return new DockForm(view, AllowContexMenu); 63 68 } 64 69 -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DocumentForm.Designer.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DocumentForm.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.Designer.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 214 214 } 215 215 216 internal Form GetForm(IView view) {216 protected internal Form GetForm(IView view) { 217 217 if (views.ContainsKey(view)) 218 218 return views[view]; … … 456 456 #region create menu and toolbar 457 457 private void CreateGUI() { 458 IEnumerable<object> allUserInterfaceItems = ApplicationManager.Manager.GetInstances(userInterfaceItemType); 459 460 IEnumerable<IPositionableUserInterfaceItem> toolStripMenuItems = 461 from mi in allUserInterfaceItems 462 where (mi is IPositionableUserInterfaceItem) && 463 (mi is IMenuItem || mi is IMenuSeparatorItem) 464 orderby ((IPositionableUserInterfaceItem)mi).Position 465 select (IPositionableUserInterfaceItem)mi; 466 467 foreach (IPositionableUserInterfaceItem menuItem in toolStripMenuItems) { 468 if (menuItem is IMenuItem) 469 AddToolStripMenuItem((IMenuItem)menuItem); 470 else if (menuItem is IMenuSeparatorItem) 471 AddToolStripMenuItem((IMenuSeparatorItem)menuItem); 472 } 473 474 IEnumerable<IPositionableUserInterfaceItem> toolStripButtonItems = 475 from bi in allUserInterfaceItems 476 where (bi is IPositionableUserInterfaceItem) && 477 (bi is IToolBarItem || bi is IToolBarSeparatorItem) 478 orderby ((IPositionableUserInterfaceItem)bi).Position 479 select (IPositionableUserInterfaceItem)bi; 480 481 foreach (IPositionableUserInterfaceItem toolStripButtonItem in toolStripButtonItems) { 482 if (toolStripButtonItem is IToolBarItem) 483 AddToolStripButtonItem((IToolBarItem)toolStripButtonItem); 484 else if (toolStripButtonItem is IToolBarSeparatorItem) 485 AddToolStripButtonItem((IToolBarSeparatorItem)toolStripButtonItem); 486 } 487 458 if (userInterfaceItemType != null) { 459 IEnumerable<object> allUserInterfaceItems = ApplicationManager.Manager.GetInstances(userInterfaceItemType); 460 461 IEnumerable<IPositionableUserInterfaceItem> toolStripMenuItems = 462 from mi in allUserInterfaceItems 463 where (mi is IPositionableUserInterfaceItem) && 464 (mi is IMenuItem || mi is IMenuSeparatorItem) 465 orderby ((IPositionableUserInterfaceItem)mi).Position 466 select (IPositionableUserInterfaceItem)mi; 467 468 foreach (IPositionableUserInterfaceItem menuItem in toolStripMenuItems) { 469 if (menuItem is IMenuItem) 470 AddToolStripMenuItem((IMenuItem)menuItem); 471 else if (menuItem is IMenuSeparatorItem) 472 AddToolStripMenuItem((IMenuSeparatorItem)menuItem); 473 } 474 475 IEnumerable<IPositionableUserInterfaceItem> toolStripButtonItems = 476 from bi in allUserInterfaceItems 477 where (bi is IPositionableUserInterfaceItem) && 478 (bi is IToolBarItem || bi is IToolBarSeparatorItem) 479 orderby ((IPositionableUserInterfaceItem)bi).Position 480 select (IPositionableUserInterfaceItem)bi; 481 482 foreach (IPositionableUserInterfaceItem toolStripButtonItem in toolStripButtonItems) { 483 if (toolStripButtonItem is IToolBarItem) 484 AddToolStripButtonItem((IToolBarItem)toolStripButtonItem); 485 else if (toolStripButtonItem is IToolBarSeparatorItem) 486 AddToolStripButtonItem((IToolBarSeparatorItem)toolStripButtonItem); 487 } 488 489 } 488 490 this.AdditionalCreationOfGuiElements(); 491 492 if (menuStrip.Items.Count == 0) menuStrip.Visible = false; 493 if (toolStrip.Items.Count == 0) toolStrip.Visible = false; 489 494 } 490 495 … … 555 560 try { 556 561 ((IActionUserInterfaceItem)item.Tag).Execute(); 557 } catch (Exception ex) { 562 } 563 catch (Exception ex) { 558 564 ErrorHandling.ShowErrorDialog((Control)MainFormManager.MainForm, ex); 559 565 } -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MultipleDocumentMainForm.Designer.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MultipleDocumentMainForm.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/SingleDocumentMainForm.Designer.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2521_ProblemRefactoring/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/SingleDocumentMainForm.cs
r12012 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.