Changeset 4993
- Timestamp:
- 11/29/10 17:15:24 (14 years ago)
- Location:
- branches/HeuristicLab.DebugEngine
- Files:
-
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DebugEngine/DebugEngine.cs
r4947 r4993 60 60 Log = new Log(); 61 61 ExecutionStack = new ExecutionStack(); 62 OperatorTrace = new ItemList<IOperator>();62 OperatorTrace = new OperatorTrace(); 63 63 operatorParents = new Dictionary<IAtomicOperation, IAtomicOperation>(); 64 64 pausePending = stopPending = false; … … 85 85 [Storable] 86 86 public ExecutionStack ExecutionStack { get; protected set; } 87 88 [Storable] 89 public OperatorTrace OperatorTrace { get; private set; } 87 90 88 91 private bool pausePending, stopPending; … … 113 116 } 114 117 115 [Storable]116 public ItemList<IOperator> OperatorTrace { get; private set; }117 118 118 119 [Storable] … … 293 294 } 294 295 trace.Reverse(); 295 OperatorTrace.Clear(); 296 OperatorTrace.AddRange(trace); 296 OperatorTrace.ReplaceAll(trace); 297 297 } 298 298 } -
branches/HeuristicLab.DebugEngine/DebugEngineView.cs
r4947 r4993 57 57 /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks> 58 58 protected override void DeregisterContentEvents() { 59 Content.CurrentOperationChanged -= new EventHandler<OperationChangedEventArgs>(Content_CurrentOperationChanged);60 59 Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged); 61 60 base.DeregisterContentEvents(); … … 69 68 base.RegisterContentEvents(); 70 69 Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged); 71 Content.CurrentOperationChanged += new EventHandler<OperationChangedEventArgs>(Content_CurrentOperationChanged);72 70 } 73 71 … … 106 104 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e); 107 105 } else { 106 SetEnabledStateOfControls(); 108 107 switch (Content.ExecutionState) { 109 108 case ExecutionState.Started: 110 executionStackView.SuspendUpdate(); 111 operatorTraceView.SuspendUpdate(); 109 if (!stepping) { 110 executionStackView.Content = null; 111 operatorTraceView.Content = null; 112 operationContentView.Content = null; 113 } 112 114 break; 113 115 default: 114 executionStackView.ResumeUpdate(); 116 executionStackView.Content = Content.ExecutionStack; 117 operatorTraceView.Content = Content.OperatorTrace; 115 118 operationContentView.Content = new OperationContent(Content.CurrentOperation); 116 operatorTraceView.ResumeUpdate();117 119 break; 118 120 } 119 SetEnabledStateOfControls();120 121 } 121 122 } 122 123 123 void Content_CurrentOperationChanged(object sender, OperationChangedEventArgs e) { 124 if (InvokeRequired) { 125 Invoke(new EventHandler<OperationChangedEventArgs>(Content_CurrentOperationChanged), sender, e); 126 } else { 127 128 } 129 } 130 124 private bool stepping = false; 131 125 private void stepButton_Click(object sender, EventArgs e) { 126 stepping = true; 132 127 Content.Step(skipStackOpsCheckBox.Checked); 128 stepping = false; 133 129 } 134 130 -
branches/HeuristicLab.DebugEngine/ExecutionStack.cs
r4871 r4993 1 using System; 2 using System.Collections.Generic; 1 using System.Collections.Generic; 3 2 using System.Linq; 4 using System.Text;5 3 using HeuristicLab.Collections; 6 4 using HeuristicLab.Common; … … 10 8 namespace HeuristicLab.DebugEngine { 11 9 10 [StorableClass] 12 11 public class ExecutionStack : ObservableList<IOperation>, IContent, IDeepCloneable { 13 12 -
branches/HeuristicLab.DebugEngine/HeuristicLab.DebugEngine.csproj
r4909 r4993 121 121 </ItemGroup> 122 122 <ItemGroup> 123 <Compile Include="OperatorTrace.cs" /> 123 124 <Compile Include="DebugEngine.cs" /> 124 125 <Compile Include="DebugEngineView.cs"> -
branches/HeuristicLab.DebugEngine/OperationContentView.Designer.cs
r4909 r4993 30 30 this.executionContextGroupBox = new System.Windows.Forms.GroupBox(); 31 31 this.executionContextTreeView = new System.Windows.Forms.TreeView(); 32 this.executionContextImageList = new System.Windows.Forms.ImageList(this.components); 32 33 this.parametersGroupBox = new System.Windows.Forms.GroupBox(); 33 34 this.parameterListView = new System.Windows.Forms.ListView(); 35 this.parameterColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 36 this.parametersImageList = new System.Windows.Forms.ImageList(this.components); 34 37 this.scopeGroupBox = new System.Windows.Forms.GroupBox(); 35 38 this.scopeTreeView = new System.Windows.Forms.TreeView(); 39 this.scopeImageList = new System.Windows.Forms.ImageList(this.components); 36 40 this.nameTextBox = new System.Windows.Forms.TextBox(); 37 41 this.contextLabel = new System.Windows.Forms.Label(); 38 42 this.atomicLabel = new System.Windows.Forms.Label(); 39 43 this.collectionLabel = new System.Windows.Forms.Label(); 40 this.timer = new System.Windows.Forms.Timer(this.components);41 this.executionContextImageList = new System.Windows.Forms.ImageList(this.components);42 this.parametersImageList = new System.Windows.Forms.ImageList(this.components);43 this.scopeImageList = new System.Windows.Forms.ImageList(this.components);44 this.parameterColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));45 44 this.groupBox.SuspendLayout(); 46 45 this.splitContainer1.Panel1.SuspendLayout(); … … 131 130 this.executionContextTreeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.executionContextTreeView_NodeMouseClick); 132 131 this.executionContextTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.executionContextTreeView_NodeMouseDoubleClick); 132 // 133 // executionContextImageList 134 // 135 this.executionContextImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; 136 this.executionContextImageList.ImageSize = new System.Drawing.Size(16, 16); 137 this.executionContextImageList.TransparentColor = System.Drawing.Color.Transparent; 133 138 // 134 139 // parametersGroupBox … … 160 165 this.parameterListView.ItemActivate += new System.EventHandler(this.parameterListView_ItemActivate); 161 166 // 167 // parametersImageList 168 // 169 this.parametersImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; 170 this.parametersImageList.ImageSize = new System.Drawing.Size(16, 16); 171 this.parametersImageList.TransparentColor = System.Drawing.Color.Transparent; 172 // 162 173 // scopeGroupBox 163 174 // … … 184 195 this.scopeTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.scopeTreeView_NodeMouseDoubleClick); 185 196 // 197 // scopeImageList 198 // 199 this.scopeImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; 200 this.scopeImageList.ImageSize = new System.Drawing.Size(16, 16); 201 this.scopeImageList.TransparentColor = System.Drawing.Color.Transparent; 202 // 186 203 // nameTextBox 187 204 // … … 228 245 this.collectionLabel.TabIndex = 0; 229 246 this.collectionLabel.Text = "Collection"; 230 //231 // timer232 //233 this.timer.Interval = 500;234 this.timer.Tick += new System.EventHandler(this.timer_Tick);235 //236 // executionContextImageList237 //238 this.executionContextImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;239 this.executionContextImageList.ImageSize = new System.Drawing.Size(16, 16);240 this.executionContextImageList.TransparentColor = System.Drawing.Color.Transparent;241 //242 // parametersImageList243 //244 this.parametersImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;245 this.parametersImageList.ImageSize = new System.Drawing.Size(16, 16);246 this.parametersImageList.TransparentColor = System.Drawing.Color.Transparent;247 //248 // scopeImageList249 //250 this.scopeImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;251 this.scopeImageList.ImageSize = new System.Drawing.Size(16, 16);252 this.scopeImageList.TransparentColor = System.Drawing.Color.Transparent;253 247 // 254 248 // OperationContentView … … 289 283 private System.Windows.Forms.GroupBox parametersGroupBox; 290 284 private System.Windows.Forms.GroupBox scopeGroupBox; 291 private System.Windows.Forms.Timer timer;292 285 private System.Windows.Forms.ImageList executionContextImageList; 293 286 private System.Windows.Forms.ImageList parametersImageList; -
branches/HeuristicLab.DebugEngine/OperationContentView.cs
r4931 r4993 1 1 using System; 2 using System.Collections.Generic;3 2 using System.Drawing; 4 3 using System.Text; … … 90 89 while (scope != null && scope.Parent != null) 91 90 scope = scope.Parent; 92 if (scope != null) {91 if (scope != null) 93 92 AddScope(scopeTreeView.Nodes, scope); 94 95 }96 93 } 97 94 scopeTreeView.EndUpdate(); … … 194 191 } 195 192 193 private TreeNode selectedScopeNode = null; 196 194 private void executionContextTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { 195 if (selectedScopeNode != null) { 196 if (Content.IsAtomic && Content.AtomicOperation.Scope == selectedScopeNode.Tag) { 197 selectedScopeNode.BackColor = Color.Crimson; 198 selectedScopeNode.ForeColor = Color.White; 199 selectedScopeNode.NodeFont = new Font(DefaultFont, FontStyle.Bold); 200 } else { 201 selectedScopeNode.BackColor = Color.White; 202 selectedScopeNode.ForeColor = Color.Black; 203 selectedScopeNode.NodeFont = DefaultFont; 204 } 205 } 197 206 if (e.Node != null) { 198 207 IExecutionContext context = e.Node.Tag as IExecutionContext; … … 200 209 TreeNode scopeNode = FindScopeNode(context.Scope, scopeTreeView.Nodes); 201 210 if (scopeNode != null) { 202 if (timer.Enabled) { 203 timer_Tick(this, EventArgs.Empty); 211 if (Content.IsAtomic && Content.AtomicOperation.Scope == scopeNode.Tag) { 212 scopeNode.BackColor = Color.DarkViolet; 213 scopeNode.ForeColor = Color.White; 214 scopeNode.NodeFont = new Font(DefaultFont, FontStyle.Bold); 215 } else { 216 scopeNode.BackColor = Color.Blue; 217 scopeNode.ForeColor = Color.White; 218 scopeNode.NodeFont = new Font(DefaultFont, FontStyle.Bold); 204 219 } 205 timer.Tag = new KeyValuePair<TreeNode, TreeNode>(scopeNode, new TreeNode() { 206 BackColor = scopeNode.BackColor, 207 ForeColor = scopeNode.ForeColor, 208 NodeFont = scopeNode.NodeFont, 209 }); 210 scopeNode.BackColor = Color.Blue; 211 scopeNode.ForeColor = Color.White; 212 scopeNode.NodeFont = new Font(DefaultFont, FontStyle.Bold); 220 selectedScopeNode = scopeNode; 213 221 scopeTreeView.TopNode = scopeNode; 214 timer.Start();215 222 } 216 223 } 217 }218 }219 220 private void ResetNode(TreeNode node, TreeNode template) {221 if (InvokeRequired)222 Invoke(new Action<TreeNode, TreeNode>(ResetNode), node, template);223 else {224 node.ForeColor = template.ForeColor;225 node.BackColor = template.BackColor;226 node.NodeFont = template.NodeFont;227 224 } 228 225 } … … 241 238 } 242 239 243 private void timer_Tick(object sender, EventArgs e) {244 KeyValuePair<TreeNode, TreeNode> kvp = (KeyValuePair<TreeNode, TreeNode>)timer.Tag;245 ResetNode(kvp.Key, kvp.Value);246 timer.Stop();247 }248 249 240 private void nameTextBox_DoubleClick(object sender, EventArgs e) { 250 241 if (Content != null && Content.IsAtomic && Content.AtomicOperation.Operator != null) -
branches/HeuristicLab.DebugEngine/OperationContentView.resx
r4909 r4993 127 127 <value>461, 17</value> 128 128 </metadata> 129 <metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">130 <value>17, 17</value>131 </metadata>132 129 </root> -
branches/HeuristicLab.DebugEngine/OperatorTrace.cs
r4986 r4993 1 using System; 2 using System.Collections.Generic; 1 using System.Collections.Generic; 3 2 using System.Linq; 4 using System.Text;5 3 using HeuristicLab.Collections; 6 4 using HeuristicLab.Common; … … 10 8 namespace HeuristicLab.DebugEngine { 11 9 12 public class ExecutionStack : ObservableList<IOperation>, IContent, IDeepCloneable { 10 [StorableClass] 11 public class OperatorTrace : ObservableList<IOperator>, IContent, IDeepCloneable { 13 12 14 public ExecutionStack() : base() { } 15 public ExecutionStack(int capacity) : base(capacity) { } 16 public ExecutionStack(IEnumerable<IOperation> collection) : base(collection) { } 13 public OperatorTrace() 14 : base() { 15 } 16 public OperatorTrace(int capacity) 17 : base(capacity) { 18 } 19 public OperatorTrace(IEnumerable<IOperator> collection) 20 : base(collection) { 21 } 17 22 18 23 [StorableConstructor] 19 protected ExecutionStack(bool deserializing) : base(deserializing) { }20 protected ExecutionStack(ExecutionStackoriginal, Cloner cloner) {24 protected OperatorTrace(bool deserializing) : base(deserializing) { } 25 protected OperatorTrace(OperatorTrace original, Cloner cloner) { 21 26 cloner.RegisterClonedObject(original, this); 22 27 AddRange(original.Select(op => cloner.Clone(op))); … … 26 31 } 27 32 public virtual IDeepCloneable Clone(Cloner cloner) { 28 return new ExecutionStack(this, cloner);33 return new OperatorTrace(this, cloner); 29 34 } 35 public virtual void ReplaceAll(IEnumerable<IOperator> operators) { 36 var oldList = list; 37 list = new List<IOperator>(operators); 38 if (oldList.Count != list.Count) 39 OnPropertyChanged("Count"); 40 OnPropertyChanged("Item[]"); 41 OnCollectionReset( 42 list.Select((op, i) => new IndexedItem<IOperator>(i, op)), 43 oldList.Select((op, i) => new IndexedItem<IOperator>(i, op))); 44 } 45 30 46 } 31 47 } -
branches/HeuristicLab.DebugEngine/OperatorTraceView.cs
r4909 r4993 4 4 using HeuristicLab.Common.Resources; 5 5 using HeuristicLab.Core; 6 using HeuristicLab.Core.Views;7 6 using HeuristicLab.MainForm; 7 using HeuristicLab.MainForm.WindowsForms; 8 8 using HeuristicLab.Operators; 9 9 … … 11 11 12 12 [View("Operator Trace View")] 13 [Content(typeof( ItemList<IOperator>), IsDefaultView = true)]14 public sealed partial class OperatorTraceView : ItemView {13 [Content(typeof(OperatorTrace), IsDefaultView = true)] 14 public sealed partial class OperatorTraceView : AsynchronousContentView { 15 15 16 public new ItemList<IOperator>Content {17 get { return ( ItemList<IOperator>)base.Content; }16 public new OperatorTrace Content { 17 get { return (OperatorTrace)base.Content; } 18 18 set { base.Content = value; } 19 19 }
Note: See TracChangeset
for help on using the changeset viewer.