Changeset 5768
- Timestamp:
- 03/20/11 02:36:00 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Common.Resources/3.3/HeuristicLab.Common.Resources-3.3.csproj
r5432 r5768 431 431 <Content Include="Resources\VS2008ImageLibrary\VS2008ImageLibrary_Actions_Checkout.png" /> 432 432 <Content Include="Resources\VS2008ImageLibrary\VS2008ImageLibrary_Actions_Clone.png" /> 433 <None Include="Resources\VS2008ImageLibrary\VS2008ImageLibrary_Objects_HiddenField.png" /> 433 434 <None Include="Resources\VS2010ImageLibrary\VS2010ImageLibrary_Actions_Filter.png" /> 434 435 <None Include="Resources\VS2008ImageLibrary\VS2008ImageLibrary_Objects_Cab.png" /> -
trunk/sources/HeuristicLab.Common.Resources/3.3/VSImageLibrary.Designer.cs
r5287 r5768 425 425 } 426 426 427 public static System.Drawing.Bitmap HiddenField { 428 get { 429 object obj = ResourceManager.GetObject("HiddenField", resourceCulture); 430 return ((System.Drawing.Bitmap)(obj)); 431 } 432 } 433 427 434 public static System.Drawing.Bitmap HighPriorityLarge { 428 435 get { -
trunk/sources/HeuristicLab.Common.Resources/3.3/VSImageLibrary.resx
r5432 r5768 275 275 <value>Resources\VS2008ImageLibrary\VS2008ImageLibrary_Actions_Graph.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> 276 276 </data> 277 <data name="HiddenField" type="System.Resources.ResXFileRef, System.Windows.Forms"> 278 <value>Resources\VS2008ImageLibrary\VS2008ImageLibrary_Objects_HiddenField.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> 279 </data> 277 280 <data name="HighPriorityLarge" type="System.Resources.ResXFileRef, System.Windows.Forms"> 278 281 <value>Resources\VS2008ImageLibrary\VS2008ImageLibrary_Annotations&Buttons_HighPriority_Large.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> -
trunk/sources/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj
r5163 r5768 12 12 <AssemblyName>HeuristicLab.Core.Views-3.3</AssemblyName> 13 13 <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 14 <TargetFrameworkProfile></TargetFrameworkProfile> 14 <TargetFrameworkProfile> 15 </TargetFrameworkProfile> 15 16 <FileAlignment>512</FileAlignment> 16 17 <SignAssembly>true</SignAssembly> -
trunk/sources/HeuristicLab.Core.Views/3.3/ParameterCollectionView.Designer.cs
r5445 r5768 20 20 #endregion 21 21 22 using System.Windows.Forms; 22 23 namespace HeuristicLab.Core.Views { 23 24 partial class ParameterCollectionView { … … 35 36 private void InitializeComponent() { 36 37 components = new System.ComponentModel.Container(); 38 this.showHiddenParametersCheckBox = new System.Windows.Forms.CheckBox(); 39 this.itemsListViewContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); 40 this.showHideParametersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 41 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 42 this.splitContainer.Panel1.SuspendLayout(); 43 this.splitContainer.Panel2.SuspendLayout(); 44 this.splitContainer.SuspendLayout(); 45 this.detailsGroupBox.SuspendLayout(); 46 this.itemsGroupBox.SuspendLayout(); 47 this.itemsListViewContextMenuStrip.SuspendLayout(); 48 this.SuspendLayout(); 49 // 50 // splitContainer.Panel1 51 // 52 this.splitContainer.Panel1.Controls.Add(this.showHiddenParametersCheckBox); 53 // 54 // itemsListView 55 // 56 this.itemsListView.ContextMenuStrip = this.itemsListViewContextMenuStrip; 57 this.itemsListView.TabIndex = 6; 58 // 59 // showHiddenParametersCheckBox 60 // 61 this.showHiddenParametersCheckBox.Appearance = System.Windows.Forms.Appearance.Button; 62 this.showHiddenParametersCheckBox.Checked = false; 63 this.showHiddenParametersCheckBox.CheckState = System.Windows.Forms.CheckState.Unchecked; 64 this.showHiddenParametersCheckBox.Image = HeuristicLab.Common.Resources.VSImageLibrary.HiddenField; 65 this.showHiddenParametersCheckBox.Location = new System.Drawing.Point(153, 3); 66 this.showHiddenParametersCheckBox.Name = "showHiddenParametersCheckBox"; 67 this.showHiddenParametersCheckBox.Size = new System.Drawing.Size(24, 24); 68 this.showHiddenParametersCheckBox.TabIndex = 5; 69 this.toolTip.SetToolTip(this.showHiddenParametersCheckBox, "Show Hidden Parameters"); 70 this.showHiddenParametersCheckBox.UseVisualStyleBackColor = true; 71 this.showHiddenParametersCheckBox.CheckedChanged += new System.EventHandler(showHiddenParametersCheckBox_CheckedChanged); 72 // 73 // itemsListViewContextMenuStrip 74 // 75 this.itemsListViewContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 76 this.showHideParametersToolStripMenuItem}); 77 this.itemsListViewContextMenuStrip.Name = "itemsListViewContextMenuStrip"; 78 this.itemsListViewContextMenuStrip.Size = new System.Drawing.Size(161, 26); 79 this.itemsListViewContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(itemsListViewContextMenuStrip_Opening); 80 // 81 // showHideParametersToolStripMenuItem 82 // 83 this.showHideParametersToolStripMenuItem.Name = "showHideParametersToolStripMenuItem"; 84 this.showHideParametersToolStripMenuItem.Size = new System.Drawing.Size(160, 22); 85 this.showHideParametersToolStripMenuItem.Text = "Show/Hide Parameters"; 86 this.showHideParametersToolStripMenuItem.Click += new System.EventHandler(showHideParametersToolStripMenuItem_Click); 87 // 88 // ParameterCollectionView 89 // 37 90 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 91 this.Name = "ParameterCollectionView"; 92 this.splitContainer.Panel1.ResumeLayout(false); 93 this.splitContainer.Panel2.ResumeLayout(false); 94 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 95 this.splitContainer.ResumeLayout(false); 96 this.detailsGroupBox.ResumeLayout(false); 97 this.itemsGroupBox.ResumeLayout(false); 98 this.itemsListViewContextMenuStrip.ResumeLayout(false); 99 this.ResumeLayout(false); 38 100 } 39 101 40 102 #endregion 103 104 protected CheckBox showHiddenParametersCheckBox; 105 protected ContextMenuStrip itemsListViewContextMenuStrip; 106 protected ToolStripMenuItem showHideParametersToolStripMenuItem; 41 107 } 42 108 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ParameterCollectionView.cs
r5445 r5768 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Drawing; 25 using System.Linq; 23 26 using System.Windows.Forms; 24 27 using HeuristicLab.MainForm; … … 46 49 } 47 50 51 protected override void DeregisterItemEvents(IParameter item) { 52 item.HiddenChanged -= new EventHandler(Item_HiddenChanged); 53 base.DeregisterItemEvents(item); 54 } 55 protected override void RegisterItemEvents(IParameter item) { 56 base.RegisterItemEvents(item); 57 item.HiddenChanged += new EventHandler(Item_HiddenChanged); 58 } 59 48 60 protected override IParameter CreateItem() { 49 61 if (createParameterDialog == null) createParameterDialog = new CreateParameterDialog(); … … 57 69 return null; 58 70 } 71 72 protected override void AddListViewItem(ListViewItem listViewItem) { 73 IParameter parameter = listViewItem.Tag as IParameter; 74 if ((parameter != null) && (parameter.Hidden) && (!showHiddenParametersCheckBox.Checked)) { 75 return; // skip parameter 76 } 77 if ((parameter != null) && (parameter.Hidden) && (showHiddenParametersCheckBox.Checked)) { 78 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Italic); 79 listViewItem.ForeColor = Color.LightGray; 80 } 81 base.AddListViewItem(listViewItem); 82 } 83 84 protected virtual void UpdateParameterVisibility(IParameter parameter) { 85 if (parameter.Hidden) { 86 if (showHiddenParametersCheckBox.Checked) { 87 foreach (ListViewItem listViewItem in GetListViewItemsForItem(parameter)) { 88 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Italic); 89 listViewItem.ForeColor = Color.LightGray; 90 } 91 } else { 92 foreach (ListViewItem listViewItem in GetListViewItemsForItem(parameter).ToArray()) 93 RemoveListViewItem(listViewItem); 94 RebuildImageList(); 95 } 96 } else { 97 if (showHiddenParametersCheckBox.Checked) { 98 foreach (ListViewItem listViewItem in GetListViewItemsForItem(parameter)) { 99 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular); 100 listViewItem.ForeColor = itemsListView.ForeColor; 101 } 102 } else { 103 for (int i = 0; i < Content.Count(x => x == parameter); i++) 104 AddListViewItem(CreateListViewItem(parameter)); 105 } 106 } 107 AdjustListViewColumnSizes(); 108 } 109 110 #region Control Events 111 protected virtual void showHiddenParametersCheckBox_CheckedChanged(object sender, System.EventArgs e) { 112 if (showHiddenParametersCheckBox.Checked) { 113 foreach (IParameter parameter in Content.Where(x => x.Hidden)) 114 AddListViewItem(CreateListViewItem(parameter)); 115 AdjustListViewColumnSizes(); 116 } else { 117 foreach (IParameter parameter in Content.Where(x => x.Hidden)) { 118 foreach (ListViewItem listViewItem in GetListViewItemsForItem(parameter).ToArray()) 119 RemoveListViewItem(listViewItem); 120 } 121 RebuildImageList(); 122 } 123 } 124 protected virtual void itemsListViewContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) { 125 if ((itemsListView.SelectedItems.Count == 0) || ReadOnly || Locked) { 126 showHideParametersToolStripMenuItem.Enabled = false; 127 } else { 128 List<IParameter> parameters = new List<IParameter>(); 129 foreach (ListViewItem listViewItem in itemsListView.SelectedItems) { 130 IParameter parameter = listViewItem.Tag as IParameter; 131 if (parameter != null) parameters.Add(parameter); 132 } 133 showHideParametersToolStripMenuItem.Enabled = (parameters.Count > 0) && (parameters.All(x => x.Hidden == parameters[0].Hidden)); 134 if (parameters.Count == 1) showHideParametersToolStripMenuItem.Text = parameters[0].Hidden ? "Show Parameter" : "Hide Parameter"; 135 else showHideParametersToolStripMenuItem.Text = parameters[0].Hidden ? "Show Parameters" : "Hide Parameters"; 136 showHideParametersToolStripMenuItem.Tag = parameters; 137 } 138 } 139 protected virtual void showHideParametersToolStripMenuItem_Click(object sender, System.EventArgs e) { 140 foreach (IParameter parameter in (IEnumerable<IParameter>)showHideParametersToolStripMenuItem.Tag) 141 parameter.Hidden = !parameter.Hidden; 142 } 143 #endregion 144 145 #region Item Events 146 protected virtual void Item_HiddenChanged(object sender, EventArgs e) { 147 if (InvokeRequired) 148 Invoke(new EventHandler(Item_HiddenChanged), sender, e); 149 else 150 UpdateParameterVisibility((IParameter)sender); 151 } 152 #endregion 59 153 } 60 154 } -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IParameter.cs
r5445 r5768 25 25 public interface IParameter : INamedItem { 26 26 Type DataType { get; } 27 bool Hidden { get; set; } 27 28 IItem ActualValue { get; set; } 28 29 IExecutionContext ExecutionContext { get; set; } 30 31 event EventHandler HiddenChanged; 29 32 } 30 33 } -
trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs
r5445 r5768 55 55 } 56 56 57 [Storable(DefaultValue = false)] 58 private bool hidden; 59 public bool Hidden { 60 get { return hidden; } 61 set { 62 if (value != hidden) { 63 hidden = value; 64 OnHiddenChanged(); 65 } 66 } 67 } 68 57 69 private Lazy<ThreadLocal<IItem>> cachedActualValues; 58 70 public IItem ActualValue { … … 86 98 : base(original, cloner) { 87 99 dataType = original.dataType; 100 hidden = original.hidden; 88 101 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 89 102 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); … … 92 105 : base("Anonymous") { 93 106 dataType = typeof(IItem); 107 hidden = false; 94 108 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 95 109 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); … … 99 113 if (dataType == null) throw new ArgumentNullException(); 100 114 this.dataType = dataType; 115 hidden = false; 101 116 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 102 117 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); … … 106 121 if (dataType == null) throw new ArgumentNullException(); 107 122 this.dataType = dataType; 123 hidden = false; 108 124 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 109 125 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); … … 116 132 protected abstract IItem GetActualValue(); 117 133 protected abstract void SetActualValue(IItem value); 134 135 public event EventHandler HiddenChanged; 136 protected virtual void OnHiddenChanged() { 137 EventHandler handler = HiddenChanged; 138 if (handler != null) handler(this, EventArgs.Empty); 139 } 118 140 } 119 141 }
Note: See TracChangeset
for help on using the changeset viewer.