Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4930 for branches


Ignore:
Timestamp:
11/25/10 10:38:08 (14 years ago)
Author:
epitzer
Message:

Better display and highlighting of scopes (#47)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DebugEngine/OperationContentView.cs

    r4909 r4930  
    9090        while (scope != null && scope.Parent != null)
    9191          scope = scope.Parent;
    92         if (scope != null)
     92        if (scope != null) {
    9393          AddScope(scopeTreeView.Nodes, scope);
    94         if (scopeTreeView.Nodes.Count > 0)
    95           scopeTreeView.TopNode = scopeTreeView.Nodes[0];
    96       }
    97       scopeTreeView.ExpandAll();
    98       if (scopeTreeView.Nodes.Count > 0)
    99         scopeTreeView.TopNode = scopeTreeView.Nodes[0];
     94
     95        }
     96      }
    10097      scopeTreeView.EndUpdate();
    10198    }
     
    107104      node.ImageIndex = 0;
    108105      node.SelectedImageIndex = 0;
    109       if (Content.IsAtomic && Content.AtomicOperation.Scope == scope) {
    110         node.ForeColor = Color.Red;
    111         node.BackColor = Color.LightGray;
    112       }
    113106      foreach (var var in scope.Variables) {
    114107        TreeNode varNode = node.Nodes.Add(string.Format("{0}={1}", var.Name, var.Value));
     
    120113        varNode.SelectedImageIndex = 1;
    121114      }
    122       foreach (var subScope in scope.SubScopes) {
     115      foreach (var subScope in scope.SubScopes)
    123116        AddScope(node.Nodes, subScope);
    124       }
    125     }
     117      if (Content.IsAtomic && Content.AtomicOperation.Scope == scope) {
     118        node.NodeFont = new Font(DefaultFont, FontStyle.Bold);
     119        node.ForeColor = Color.White;
     120        node.BackColor = Color.Crimson;
     121        node.Expand();
     122        scopeTreeView.TopNode = node;
     123      }
     124    }
     125
    126126
    127127    private void UpdateExecutionContext() {
     
    202202              timer_Tick(this, EventArgs.Empty);
    203203            }
    204             timer.Tag = new KeyValuePair<TreeNode, Color>(scopeNode, scopeNode.BackColor);
     204            timer.Tag = new KeyValuePair<TreeNode, TreeNode>(scopeNode, new TreeNode() {
     205              BackColor = scopeNode.BackColor,
     206              ForeColor = scopeNode.ForeColor,
     207              NodeFont = scopeNode.NodeFont,
     208            });
    205209            scopeNode.BackColor = Color.Blue;
     210            scopeNode.ForeColor = Color.White;
     211            scopeNode.NodeFont = new Font(DefaultFont, FontStyle.Bold);
    206212            scopeTreeView.TopNode = scopeNode;
    207213            timer.Start();
     
    211217    }
    212218
    213     private void ResetNode(TreeNode node, Color color) {
     219    private void ResetNode(TreeNode node, TreeNode template) {
    214220      if (InvokeRequired)
    215         Invoke(new Action<TreeNode, Color>(ResetNode), node, color);
    216       else
    217         node.BackColor = color;
     221        Invoke(new Action<TreeNode, TreeNode>(ResetNode), node, template);
     222      else {
     223        node.ForeColor = template.ForeColor;
     224        node.BackColor = template.BackColor;
     225        node.NodeFont = template.NodeFont;
     226      }
    218227    }
    219228
     
    232241
    233242    private void timer_Tick(object sender, EventArgs e) {
    234       KeyValuePair<TreeNode, Color> kvp = (KeyValuePair<TreeNode, Color>)timer.Tag;
     243      KeyValuePair<TreeNode, TreeNode> kvp = (KeyValuePair<TreeNode, TreeNode>)timer.Tag;
    235244      ResetNode(kvp.Key, kvp.Value);
    236245      timer.Stop();
     
    243252
    244253    #endregion
    245 
    246 
    247 
    248254  }
    249255}
Note: See TracChangeset for help on using the changeset viewer.