Changeset 3507
- Timestamp:
- 04/23/10 04:13:02 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.Designer.cs
r3351 r3507 63 63 this.itemsGroupBox = new System.Windows.Forms.GroupBox(); 64 64 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 65 this.toolStrip = new System.Windows.Forms.ToolStrip(); 66 this.analyzeRunsToolStripDropDownButton = new System.Windows.Forms.ToolStripDropDownButton(); 65 67 this.splitContainer.Panel1.SuspendLayout(); 66 68 this.splitContainer.Panel2.SuspendLayout(); … … 68 70 this.detailsGroupBox.SuspendLayout(); 69 71 this.itemsGroupBox.SuspendLayout(); 72 this.toolStrip.SuspendLayout(); 70 73 this.SuspendLayout(); 71 74 // … … 79 82 // splitContainer.Panel1 80 83 // 84 this.splitContainer.Panel1.Controls.Add(this.toolStrip); 81 85 this.splitContainer.Panel1.Controls.Add(this.itemsListView); 82 86 this.splitContainer.Panel1.Controls.Add(this.removeButton); … … 153 157 | System.Windows.Forms.AnchorStyles.Left) 154 158 | System.Windows.Forms.AnchorStyles.Right))); 159 this.viewHost.Caption = null; 155 160 this.viewHost.Content = null; 156 161 this.viewHost.Location = new System.Drawing.Point(6, 19); 157 162 this.viewHost.Name = "viewHost"; 163 this.viewHost.ReadOnly = false; 158 164 this.viewHost.Size = new System.Drawing.Size(254, 310); 159 165 this.viewHost.TabIndex = 0; … … 170 176 this.itemsGroupBox.TabStop = false; 171 177 this.itemsGroupBox.Text = "Items"; 178 // 179 // toolStrip 180 // 181 this.toolStrip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 182 | System.Windows.Forms.AnchorStyles.Right))); 183 this.toolStrip.AutoSize = false; 184 this.toolStrip.Dock = System.Windows.Forms.DockStyle.None; 185 this.toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; 186 this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 187 this.analyzeRunsToolStripDropDownButton}); 188 this.toolStrip.Location = new System.Drawing.Point(30, 3); 189 this.toolStrip.Name = "toolStrip"; 190 this.toolStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.ManagerRenderMode; 191 this.toolStrip.Size = new System.Drawing.Size(217, 24); 192 this.toolStrip.TabIndex = 1; 193 this.toolStrip.Text = "toolStrip1"; 194 // 195 // analyzeRunsToolStripDropDownButton 196 // 197 this.analyzeRunsToolStripDropDownButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; 198 this.analyzeRunsToolStripDropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; 199 this.analyzeRunsToolStripDropDownButton.Name = "analyzeRunsToolStripDropDownButton"; 200 this.analyzeRunsToolStripDropDownButton.Size = new System.Drawing.Size(45, 21); 201 this.analyzeRunsToolStripDropDownButton.Text = "&Analyze Runs..."; 202 this.analyzeRunsToolStripDropDownButton.ToolTipText = "Show Run Analysis Views"; 172 203 // 173 204 // RunCollectionView … … 182 213 this.detailsGroupBox.ResumeLayout(false); 183 214 this.itemsGroupBox.ResumeLayout(false); 215 this.toolStrip.ResumeLayout(false); 216 this.toolStrip.PerformLayout(); 184 217 this.ResumeLayout(false); 185 218 … … 197 230 protected ImageList imageList; 198 231 protected HeuristicLab.MainForm.WindowsForms.ViewHost viewHost; 232 protected ToolStrip toolStrip; 233 protected ToolStripDropDownButton analyzeRunsToolStripDropDownButton; 199 234 } 200 235 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs
r3505 r3507 21 21 22 22 using HeuristicLab.Collections; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Core.Views; … … 29 30 using System.Drawing; 30 31 using System.Collections.Generic; 32 using System.Linq; 31 33 32 34 namespace HeuristicLab.Optimization.Views { … … 71 73 protected virtual void RegisterRunEvents(IEnumerable<IRun> runs) { 72 74 foreach (IRun run in runs) 73 run.Changed += new EventHandler( run_Changed);75 run.Changed += new EventHandler(Run_Changed); 74 76 } 75 77 protected virtual void DeregisterRunEvents(IEnumerable<IRun> runs) { 76 78 foreach (IRun run in runs) 77 run.Changed -= new EventHandler(run_Changed); 79 run.Changed -= new EventHandler(Run_Changed); 80 } 81 82 protected override void OnInitialized(EventArgs e) { 83 base.OnInitialized(e); 84 var viewTypes = MainFormManager.GetViewTypes(typeof(RunCollection), true); 85 foreach (Type viewType in viewTypes.OrderBy(x => ViewAttribute.GetViewName(x))) { 86 if ((viewType != typeof(ItemCollectionView<IRun>)) && (viewType != typeof(ViewHost))) { 87 ToolStripMenuItem menuItem = new ToolStripMenuItem(); 88 menuItem.Text = ViewAttribute.GetViewName(viewType); 89 menuItem.Tag = viewType; 90 menuItem.Click += new EventHandler(menuItem_Click); 91 analyzeRunsToolStripDropDownButton.DropDownItems.Add(menuItem); 92 } 93 } 78 94 } 79 95 … … 92 108 } 93 109 94 private void run_Changed(object sender, EventArgs e) {95 IRun run = (IRun)sender;96 foreach (ListViewItem listViewItem in GetListViewItemsForItem(run)) {97 if (run.Visible) {98 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular);99 listViewItem.ForeColor = run.Color;100 } else {101 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Italic);102 listViewItem.ForeColor = Color.LightGray;103 }104 }105 }106 107 110 protected override void OnReadOnlyChanged() { 108 111 base.OnReadOnlyChanged(); … … 111 114 private void SetEnabledStateOfControls() { 112 115 if (Content == null) { 116 analyzeRunsToolStripDropDownButton.Enabled = false; 113 117 itemsListView.Enabled = false; 114 118 detailsGroupBox.Enabled = false; … … 116 120 removeButton.Enabled = false; 117 121 } else { 122 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; 118 123 itemsListView.Enabled = true; 119 124 detailsGroupBox.Enabled = true; … … 235 240 236 241 #region Button Events 242 protected virtual void menuItem_Click(object sender, EventArgs e) { 243 ToolStripMenuItem menuItem = (ToolStripMenuItem)sender; 244 IContentView view = MainFormManager.CreateView((Type)menuItem.Tag, Content); 245 if (view != null) { 246 view.Locked = Locked; 247 view.ReadOnly = ReadOnly; 248 view.Show(); 249 } 250 } 237 251 protected virtual void removeButton_Click(object sender, EventArgs e) { 238 252 if (itemsListView.SelectedItems.Count > 0) { … … 252 266 foreach (IRun item in e.Items) 253 267 AddListViewItem(CreateListViewItem(item)); 268 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; 254 269 } 255 270 } … … 265 280 } 266 281 } 282 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; 267 283 } 268 284 } … … 281 297 foreach (IRun item in e.Items) 282 298 AddListViewItem(CreateListViewItem(item)); 299 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; 283 300 } 284 301 } … … 304 321 } 305 322 } 323 protected virtual void Run_Changed(object sender, EventArgs e) { 324 IRun run = (IRun)sender; 325 foreach (ListViewItem listViewItem in GetListViewItemsForItem(run)) { 326 if (run.Visible) { 327 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular); 328 listViewItem.ForeColor = run.Color; 329 } else { 330 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Italic); 331 listViewItem.ForeColor = Color.LightGray; 332 } 333 } 334 } 306 335 #endregion 307 336 }
Note: See TracChangeset
for help on using the changeset viewer.