Changeset 3528
- Timestamp:
- 04/26/10 04:14:27 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ScopeView.Designer.cs
r3248 r3528 34 34 if (disposing) { 35 35 if (scopesTreeView.Nodes.Count > 0) { 36 RemoveTreeNode(scopesTreeView.Nodes[0]);36 ClearTreeNode(scopesTreeView.Nodes[0]); 37 37 } 38 38 if (components != null) components.Dispose(); … … 71 71 this.scopesTreeView.AfterCollapse += new System.Windows.Forms.TreeViewEventHandler(this.scopesTreeView_AfterCollapse); 72 72 this.scopesTreeView.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.scopesTreeView_BeforeExpand); 73 this.scopesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.scopesTreeView_AfterSelect); 73 74 this.scopesTreeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.scopesTreeView_MouseDown); 74 75 this.scopesTreeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.scopesTreeView_ItemDrag); … … 111 112 | System.Windows.Forms.AnchorStyles.Right))); 112 113 this.variableCollectionView.Caption = "VariableCollection"; 114 this.variableCollectionView.Content = null; 113 115 this.variableCollectionView.Location = new System.Drawing.Point(3, 3); 114 116 this.variableCollectionView.Name = "variableCollectionView"; 117 this.variableCollectionView.ReadOnly = false; 115 118 this.variableCollectionView.Size = new System.Drawing.Size(394, 190); 116 119 this.variableCollectionView.TabIndex = 0; -
trunk/sources/HeuristicLab.Core.Views/3.3/ScopeView.cs
r3455 r3528 74 74 protected override void OnContentChanged() { 75 75 base.OnContentChanged(); 76 if (scopesTreeView.Nodes.Count > 0) { 77 RemoveTreeNode(scopesTreeView.Nodes[0]); 78 scopesTreeView.Nodes.Clear(); 79 } 76 if (scopesTreeView.Nodes.Count > 0) 77 ClearTreeNode(scopesTreeView.Nodes[0]); 78 scopesTreeView.Nodes.Clear(); 80 79 variableCollectionView.Content = null; 81 80 Caption = "Scope"; 82 81 if (Content != null) { 83 Caption = Content.Name + " (" + Content. GetType().Name + ")";82 Caption = Content.Name + " (" + Content.ItemName + ")"; 84 83 scopesTreeView.Nodes.Add(CreateTreeNode(Content)); 85 84 } … … 97 96 } 98 97 98 #region TreeNode Management 99 99 private TreeNode CreateTreeNode(IScope scope) { 100 100 TreeNode node = new TreeNode(); … … 104 104 scopeNodeTable.Add(scope, node); 105 105 scope.NameChanged += new EventHandler(Scope_NameChanged); 106 subScopesScopeTable.Add(scope.SubScopes, scope); 106 107 scope.SubScopes.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsAdded); 107 108 scope.SubScopes.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsRemoved); … … 109 110 scope.SubScopes.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsMoved); 110 111 scope.SubScopes.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_CollectionReset); 111 subScopesScopeTable.Add(scope.SubScopes, scope);112 112 if (scope.SubScopes.Count > 0) 113 113 node.Nodes.Add(new TreeNode()); … … 115 115 } 116 116 117 private void RemoveTreeNode(TreeNode node) { 117 private void ClearTreeNode(TreeNode node) { 118 if (scopesTreeView.SelectedNode == node) { 119 scopesTreeView.SelectedNode = null; 120 UpdateVariables(); 121 } 122 118 123 foreach (TreeNode child in node.Nodes) 119 RemoveTreeNode(child);124 ClearTreeNode(child); 120 125 121 126 IScope scope = node.Tag as IScope; 122 127 if (scope != null) { 128 scope.NameChanged -= new EventHandler(Scope_NameChanged); 123 129 scopeNodeTable.Remove(scope); 124 scope.NameChanged -= new EventHandler(Scope_NameChanged);125 130 scope.SubScopes.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsAdded); 126 131 scope.SubScopes.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsRemoved); … … 131 136 } 132 137 } 138 #endregion 133 139 134 140 #region TreeView Events 141 private void scopesTreeView_AfterSelect(object sender, TreeViewEventArgs e) { 142 UpdateVariables(); 143 } 135 144 private void scopesTreeView_MouseDown(object sender, MouseEventArgs e) { 136 145 TreeNode node = scopesTreeView.GetNodeAt(e.X, e.Y); 137 if ((node != null) && (node.Tag is IScope)) { 138 variableCollectionView.Content = ((IScope)node.Tag).Variables; 139 variableCollectionView.Enabled = true; 140 } else { 141 variableCollectionView.Content = null; 142 variableCollectionView.Enabled = false; 143 if (node == null) scopesTreeView.SelectedNode = null; 144 } 146 scopesTreeView.SelectedNode = node; 147 UpdateVariables(); 145 148 } 146 149 private void scopesTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e) { … … 158 161 if (node.Nodes.Count > 0) { 159 162 for (int i = 0; i < node.Nodes.Count; i++) 160 RemoveTreeNode(node.Nodes[i]);163 ClearTreeNode(node.Nodes[i]); 161 164 node.Nodes.Clear(); 162 165 node.Nodes.Add(new TreeNode()); … … 177 180 #endregion 178 181 179 #region ScopeEvents182 #region Content Events 180 183 private void Scope_NameChanged(object sender, EventArgs e) { 181 184 if (InvokeRequired) … … 186 189 } 187 190 } 188 #endregion189 190 #region SubScopes Events191 191 private void SubScopes_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) { 192 192 if (InvokeRequired) … … 195 195 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 196 196 TreeNode parentNode = scopeNodeTable[parentScope]; 197 scopesTreeView.BeginUpdate(); 197 198 if (parentNode.IsExpanded) { 198 199 foreach (IndexedItem<IScope> item in e.Items) { … … 203 204 parentNode.Nodes.Add(new TreeNode()); 204 205 } 206 scopesTreeView.EndUpdate(); 205 207 } 206 208 } … … 211 213 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 212 214 TreeNode parentNode = scopeNodeTable[parentScope]; 215 scopesTreeView.BeginUpdate(); 213 216 if (parentNode.IsExpanded) { 214 217 foreach (IndexedItem<IScope> item in e.Items) { 215 218 TreeNode node = scopeNodeTable[item.Value]; 216 RemoveTreeNode(node);219 ClearTreeNode(node); 217 220 node.Remove(); 218 221 } … … 220 223 parentNode.Nodes.Clear(); 221 224 } 225 scopesTreeView.EndUpdate(); 222 226 } 223 227 } … … 228 232 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 229 233 TreeNode parentNode = scopeNodeTable[parentScope]; 234 scopesTreeView.BeginUpdate(); 230 235 if (parentNode.IsExpanded) { 231 236 foreach (IndexedItem<IScope> item in e.Items) { 232 237 TreeNode node = parentNode.Nodes[item.Index]; 233 RemoveTreeNode(node);238 ClearTreeNode(node); 234 239 node.Remove(); 235 240 node = CreateTreeNode(item.Value); 236 241 parentNode.Nodes.Insert(item.Index, node); 237 242 } 243 scopesTreeView.EndUpdate(); 238 244 } 239 245 } … … 245 251 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 246 252 TreeNode parentNode = scopeNodeTable[parentScope]; 253 scopesTreeView.BeginUpdate(); 247 254 if (parentNode.IsExpanded) { 248 255 parentNode.Nodes.Clear(); … … 250 257 parentNode.Nodes.Insert(item.Index, scopeNodeTable[item.Value]); 251 258 } 259 scopesTreeView.EndUpdate(); 252 260 } 253 261 } … … 258 266 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 259 267 TreeNode parentNode = scopeNodeTable[parentScope]; 268 scopesTreeView.BeginUpdate(); 260 269 if (parentNode.IsExpanded) { 261 270 foreach (TreeNode node in parentNode.Nodes) 262 RemoveTreeNode(node);271 ClearTreeNode(node); 263 272 parentNode.Nodes.Clear(); 264 273 foreach (IndexedItem<IScope> item in e.Items) { … … 271 280 parentNode.Nodes.Add(new TreeNode()); 272 281 } 282 scopesTreeView.EndUpdate(); 283 } 284 } 285 #endregion 286 287 #region Helpers 288 private void UpdateVariables() { 289 if (scopesTreeView.SelectedNode == null) { 290 variableCollectionView.Content = null; 291 variableCollectionView.Enabled = false; 292 } else { 293 variableCollectionView.Enabled = true; 294 variableCollectionView.Content = ((IScope)scopesTreeView.SelectedNode.Tag).Variables; 273 295 } 274 296 } -
trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs
r3516 r3528 91 91 imageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.Namespace); // plugins 92 92 imageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.Interface); // interfaces 93 imageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.OrgChart); // abstract types94 93 imageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.Template); // generic types 95 94 … … 119 118 typeNode.ImageIndex = 0; 120 119 if (type.IsInterface) typeNode.ImageIndex = 2; 121 else if (type.IsAbstract) typeNode.ImageIndex = 3; 122 else if (type.ContainsGenericParameters) typeNode.ImageIndex = 4; 120 else if (type.ContainsGenericParameters) typeNode.ImageIndex = 3; 123 121 else if (imageList.Images.ContainsKey(type.FullName)) typeNode.ImageIndex = imageList.Images.IndexOfKey(type.FullName); 124 122 else if (typeof(IItem).IsAssignableFrom(type)) { -
trunk/sources/HeuristicLab.Core/3.3/Scope.cs
r3431 r3528 20 20 #endregion 21 21 22 using System.Drawing; 22 23 using HeuristicLab.Collections; 23 24 using HeuristicLab.Common; … … 31 32 [StorableClass] 32 33 public sealed class Scope : NamedItem, IScope { 34 public override Image ItemImage { 35 get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.OrgChart; } 36 } 37 33 38 [Storable] 34 39 private IScope parent; -
trunk/sources/HeuristicLab.Optimization/3.3/UserDefinedAlgorithm.cs
r3393 r3528 30 30 /// An algorithm which can be defined by the user. 31 31 /// </summary> 32 [Item("User DefinedAlgorithm", "An algorithm which can be defined by the user.")]32 [Item("User-Defined Algorithm", "An algorithm which can be defined by the user.")] 33 33 [Creatable("Algorithms")] 34 34 [StorableClass] -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs
r3462 r3528 38 38 39 39 namespace HeuristicLab.Problems.ArtificialAnt { 40 [Item("Artificial AntProblem", "Represents the Artificial Ant problem.")]40 [Item("Artificial Ant Problem", "Represents the Artificial Ant problem.")] 41 41 [Creatable("Problems")] 42 42 [StorableClass] -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs
r3513 r3528 40 40 41 41 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic { 42 [Item("Symbolic RegressionProblem", "Represents a symbolic regression problem.")]42 [Item("Symbolic Regression Problem", "Represents a symbolic regression problem.")] 43 43 [Creatable("Problems")] 44 44 [StorableClass] -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblem.cs
r3376 r3528 33 33 34 34 namespace HeuristicLab.Problems.DataAnalysis { 35 [Item("Data AnalysisProblem", "Represents a data analysis problem.")]35 [Item("Data Analysis Problem", "Represents a data analysis problem.")] 36 36 [Creatable("Problems")] 37 37 [StorableClass] -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs
r3467 r3528 35 35 36 36 namespace HeuristicLab.Problems.Knapsack { 37 [Item("Knapsack Problem", "Represents a Knapsack Problem.")]37 [Item("Knapsack Problem", "Represents a Knapsack Problem.")] 38 38 [Creatable("Problems")] 39 39 [StorableClass] -
trunk/sources/HeuristicLab.Problems.OneMax/3.3/OnemaxProblem.cs
r3303 r3528 34 34 35 35 namespace HeuristicLab.Problems.OneMax { 36 [Item("OneMax Problem", "Represents a OneMax Problem.")]36 [Item("OneMax Problem", "Represents a OneMax Problem.")] 37 37 [Creatable("Problems")] 38 38 [StorableClass]
Note: See TracChangeset
for help on using the changeset viewer.