Browse Source

Object graph - added node headers with type name.

pull/15/head
mkonicek 15 years ago
parent
commit
1e30f4dd2a
  1. 17
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml
  2. 21
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml.cs
  3. 22
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/PositionedNode.cs
  4. 3
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/TreeLayout.cs
  5. 1
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphBuilder.cs
  6. 15
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphNode.cs

17
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml

@ -14,10 +14,11 @@ @@ -14,10 +14,11 @@
<aero:SystemDropShadowChrome>
<StackPanel Orientation="Vertical">
<!--
<Border Background="#ddeeff" BorderThickness="1,1,1,0" BorderBrush="DarkGray" HorizontalAlignment="Stretch" Padding="1">
<TextBlock>Hello</TextBlock>
</Border> -->
<Border x:Name="typeNameHeaderBorder" Background="#ddeeff" Height="20" Margin="1,0" BorderThickness="1,1,1,0" BorderBrush="DarkGray" HorizontalAlignment="Stretch" Padding="1">
<TextBlock Text="{Binding TypeName}"></TextBlock>
</Border>
<ListView Name="listView" ScrollViewer.VerticalScrollBarVisibility="Auto" Width="200" Height="300">
<ListView.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
@ -33,14 +34,6 @@ @@ -33,14 +34,6 @@
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Focusable" Value="false" />
<Style.Triggers>
<!--
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="Transparent"></Setter>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="Transparent"></Setter>
</Trigger>
-->
<DataTrigger Binding="{Binding IsNested}" Value="True">
<Setter Property="Foreground" Value="#666666"></Setter>
<Setter Property="FontStyle" Value="Italic"></Setter>

21
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml.cs

@ -48,20 +48,23 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing @@ -48,20 +48,23 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing
// shown in the ListView
private ObservableCollection<ContentNode> items = new ObservableCollection<ContentNode>();
private ContentNode root;
/// <summary>
/// The tree to be displayed in this Control.
/// </summary>
public ContentNode Root
public ContentNode Root { get; set; }
/// <summary>
/// Sets the node to be displayed by this control.
/// </summary>
/// <param name="node"></param>
public void SetDataContext(PositionedNode node)
{
get { return this.root; }
set {
this.root = value;
this.items = GetInitialItems(this.root);
this.DataContext = node;
this.Root = node.Content;
this.items = GetInitialItems(this.Root);
// data virtualization, ContentPropertyNode implements IEvaluate
this.listView.ItemsSource = new VirtualizingObservableCollection<ContentNode>(this.items);
}
}
public void CalculateWidthHeight()
{
@ -72,13 +75,13 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing @@ -72,13 +75,13 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing
listView.Width = gv.Columns[0].Width + gv.Columns[1].Width + gv.Columns[2].Width + 10;
int maxItems = 10;
listView.Height = Math.Min(this.items.Count, maxItems) * 20;
listView.Height = 4 + Math.Min(this.items.Count, maxItems) * 20;
if (this.items.Count > maxItems) {
listView.Width += 30; // for scrollbar
}
this.Width = listView.Width + 2;
this.Height = listView.Height + 2;
this.Height = listView.Height + this.typeNameHeaderBorder.Height + 2;
}
public PositionedGraphNodeControl()

22
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/PositionedNode.cs

@ -19,10 +19,11 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -19,10 +19,11 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// Creates new PositionedNode.
/// </summary>
/// <param name="objectNode">Underlying ObjectNode.</param>
public PositionedNode(ObjectGraphNode objectNode)
public PositionedNode(ObjectGraphNode objectNode, Expanded expanded)
{
this.objectNode = objectNode;
this.ObjectNode = objectNode;
InitVisualControl();
InitContentFromObjectNode(expanded);
}
public event EventHandler<PositionedPropertyEventArgs> PropertyExpanded;
@ -30,20 +31,21 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -30,20 +31,21 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
public event EventHandler<ContentNodeEventArgs> ContentNodeExpanded;
public event EventHandler<ContentNodeEventArgs> ContentNodeCollapsed;
private ObjectGraphNode objectNode;
/// <summary>
/// Underlying ObjectNode.
/// </summary>
public ObjectGraphNode ObjectNode
{
get { return objectNode; }
}
public ObjectGraphNode ObjectNode { get; private set; }
/// <summary>
/// Tree-of-properties content of this node.
/// </summary>
public ContentNode Content { get; set; }
/// <summary>
/// Name of the Type in the debuggee.
/// </summary>
public string TypeName { get { return this.ObjectNode.TypeName; } }
/// <summary>
/// The size of the subtree of this node in the layout.
/// </summary>
@ -54,14 +56,14 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -54,14 +56,14 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// </summary>
public PositionedGraphNodeControl NodeVisualControl { get; private set; }
public void InitContentFromObjectNode(Expanded expanded)
void InitContentFromObjectNode(Expanded expanded)
{
this.Content = new ContentNode(this, null);
this.Content.InitOverride(this.ObjectNode.Content, expanded);
this.NodeVisualControl.Root = this.Content;
this.NodeVisualControl.SetDataContext(this);
}
private void InitVisualControl()
void InitVisualControl()
{
this.NodeVisualControl = NodeControlCache.Instance.GetNodeControl();
// propagate events from nodeVisualControl

3
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/TreeLayout.cs

@ -53,8 +53,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -53,8 +53,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
// create empty PositionedNodes
foreach (ObjectGraphNode objectNode in objectGraph.ReachableNodes) {
var posNode = new PositionedNode(objectNode);
posNode.InitContentFromObjectNode(expanded);
var posNode = new PositionedNode(objectNode, expanded);
posNode.MeasureVisualControl();
positionedGraph.AddNode(posNode);
positionedNodeFor[objectNode] = posNode;

1
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphBuilder.cs

@ -303,6 +303,7 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -303,6 +303,7 @@ namespace Debugger.AddIn.Visualizers.Graph
private ObjectGraphNode createNewNode(Value permanentReference, Expression expression)
{
ObjectGraphNode newNode = new ObjectGraphNode();
newNode.TypeName = permanentReference.Type.Name;
newNode.HashCode = permanentReference.InvokeDefaultGetHashCode();
resultGraph.AddNode(newNode);

15
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphNode.cs

@ -32,17 +32,16 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -32,17 +32,16 @@ namespace Debugger.AddIn.Visualizers.Graph
/// <summary>
/// Property tree of this node.
/// </summary>
public ThisNode Content
{
get; set;
}
public ThisNode Content { get; set; }
/// <summary>
/// Name of the Type in the debuggee.
/// </summary>
public string TypeName { get; set; }
public IEnumerable<ObjectGraphProperty> Properties
{
get
{
return this.Content.FlattenPropertyNodes().Select(node => {return node.Property; });
}
get { return this.Content.FlattenPropertyNodes().Select(node => {return node.Property; }); }
}
}
}

Loading…
Cancel
Save