Browse Source

Tried member icons in object graph. Didn't look so useful, left it commented out for possible future use.

pull/15/head
mkonicek 15 years ago
parent
commit
1abd1f920e
  1. 10
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml
  2. 15
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml.cs
  3. 11
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/TreeModel/ContentNode.cs
  4. 28
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/TreeModel/ContentPropertyNode.cs
  5. 2
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphBuilder.cs
  6. 36
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphProperty.cs

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

@ -78,6 +78,16 @@ @@ -78,6 +78,16 @@
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<!-- Icon - didn't add much value -->
<!--
<GridViewColumn Header="Icon" Width="10">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image Width="10" Height="10" Source="{Binding MemberIcon}"></Image>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
-->
<!-- Name -->
<GridViewColumn Header="Name" Width="60">
<GridViewColumn.CellTemplate>

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

@ -94,18 +94,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing @@ -94,18 +94,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing
this.listView.ItemsSource = null;
}
void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
{
/*var clickedText = (TextBlock)e.Source;
var clickedNode = (ContentNode)(clickedText).DataContext;
var propNode = clickedNode as ContentPropertyNode;
if (propNode != null && propNode.Property != null && propNode.Property.Edge != null && propNode.Property.Edge.Spline != null)
{
propNode.Property.Edge.Spline.StrokeThickness = propNode.Property.Edge.Spline.StrokeThickness + 1;
}*/
}
private void PropertyExpandButton_Click(object sender, RoutedEventArgs e)
void PropertyExpandButton_Click(object sender, RoutedEventArgs e)
{
var clickedButton = (ToggleButton)e.Source;
ContentPropertyNode clickedNode = null;
@ -131,7 +120,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing @@ -131,7 +120,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing
}
}
private void NestedExpandButton_Click(object sender, RoutedEventArgs e)
void NestedExpandButton_Click(object sender, RoutedEventArgs e)
{
var clickedButton = (ToggleButton)e.Source;
var clickedNode = (ContentNode)(clickedButton).DataContext;

11
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/TreeModel/ContentNode.cs

@ -1,12 +1,14 @@ @@ -1,12 +1,14 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Ast;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media;
using Debugger.AddIn.Visualizers.Utils;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Ast;
namespace Debugger.AddIn.Visualizers.Graph.Layout
{
@ -24,6 +26,9 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -24,6 +26,9 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
this.parent = parent;
}
// Icon next to the name - didn't add much value
//public ImageSource MemberIcon { get; set; }
/// <summary>
/// Path to this content node in the whole <see cref="PositionedGraph"></see>.
/// </summary>
@ -137,7 +142,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -137,7 +142,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
public IEnumerable<PositionedNodeProperty> FlattenProperties()
{
return Utils.TreeFlattener.Flatten(this).Where(node => node is ContentPropertyNode).
Select( propertyNode => ((ContentPropertyNode)propertyNode).Property);
Select(propertyNode => ((ContentPropertyNode)propertyNode).Property);
}
#region Utils.ITreeNode implementation

28
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/TreeModel/ContentPropertyNode.cs

@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
using System;
using System.ComponentModel;
using Debugger.AddIn.TreeModel;
using Debugger.MetaData;
namespace Debugger.AddIn.Visualizers.Graph.Layout
{
@ -11,8 +13,6 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -11,8 +13,6 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// </summary>
public class ContentPropertyNode : ContentNode, IEvaluate
{
PositionedNodeProperty positionedProperty;
public ContentPropertyNode(PositionedNode containingNode, ContentNode parent)
: base(containingNode, parent)
{
@ -21,26 +21,23 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -21,26 +21,23 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// <summary>
/// The PositionedNodeProperty this node contains.
/// </summary>
public PositionedNodeProperty Property
{
get { return this.positionedProperty; }
}
public PositionedNodeProperty Property { get; private set; }
public bool IsEvaluated
{
get { return this.positionedProperty.IsEvaluated; }
get { return this.Property.IsEvaluated; }
}
public override bool IsPropertyExpanded
{
get { return this.positionedProperty.IsPropertyExpanded; }
set { this.positionedProperty.IsPropertyExpanded = value; }
get { return this.Property.IsPropertyExpanded; }
set { this.Property.IsPropertyExpanded = value; }
}
public void Evaluate()
{
this.positionedProperty.Evaluate();
this.Text = this.positionedProperty.Value;
this.Property.Evaluate();
this.Text = this.Property.Value;
}
public override bool ShowExpandPropertyButton
@ -48,7 +45,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -48,7 +45,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
get
{
// show expand button for non-null non-atomic objects
return (!this.positionedProperty.IsAtomic && !this.positionedProperty.IsNull);
return (!this.Property.IsAtomic && !this.Property.IsNull);
}
}
@ -65,9 +62,14 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -65,9 +62,14 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
this.Text = sourcePropertyNode.Property.Value;
this.IsNested = false;
this.IsExpanded = false; // always false, Property nodes are never expanded (they have IsPropertyExpanded)
this.positionedProperty = new PositionedNodeProperty(
this.Property = new PositionedNodeProperty(
sourcePropertyNode.Property, this.ContainingNode,
expanded.Expressions.IsExpanded(sourcePropertyNode.Property.Expression));
// Icon next to the name - didn't add much value
/*string imageName;
var image = ExpressionNode.GetImageForMember((IDebugMemberInfo)sourcePropertyNode.Property.PropInfo, out imageName);
this.MemberIcon = image.ImageSource;*/
}
}
}

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

@ -242,7 +242,7 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -242,7 +242,7 @@ namespace Debugger.AddIn.Visualizers.Graph
propertyList.Add(new ObjectGraphProperty
{ Name = memberProp.Name,
Expression = propExpression, Value = "",
/*PropInfo = memberProp,*/ IsAtomic = true, TargetNode = null });
PropInfo = memberProp, IsAtomic = true, TargetNode = null });
}
return propertyList.Sorted(ObjectPropertyComparer.Instance);

36
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphProperty.cs

@ -14,7 +14,8 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -14,7 +14,8 @@ namespace Debugger.AddIn.Visualizers.Graph
{
/// <summary>
/// ObjectProperty used in ObjectGraph. Has TargetNode.
/// Support on-demand evaluation of Value property.
/// Holds an Expression which is evaluated on demand.
/// Evaluating fills properties like Value and IsAtomic, which are empty until evaluation.
/// </summary>
public class ObjectGraphProperty : ObjectProperty, IEvaluate
{
@ -23,46 +24,27 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -23,46 +24,27 @@ namespace Debugger.AddIn.Visualizers.Graph
/// </summary>
public ObjectGraphNode TargetNode { get; set; }
//private Expressions.Expression containingObjectExpression;
/*public ObjectGraphProperty(Expressions.Expression containingObjectExpression)
{
if (containingObjectExpression == null)
throw new ArgumentNullException("containingObjectExpression");
this.containingObjectExpression = containingObjectExpression;
}*/
/// <summary>
/// MemberInfo used for obtaining value of this property
/// </summary>
public MemberInfo PropInfo { get; set; }
public MemberInfo MemberInfo { get; set; }
bool evaluateCalled = false;
public bool IsEvaluated
{
get { return this.evaluateCalled; }
}
/// <summary>
/// Has this property been evaluated? (Has Evaluate been called?)
/// </summary>
public bool IsEvaluated { get; private set; }
public void Evaluate()
{
/*if (this.PropInfo == null)
{
throw new DebuggerVisualizerException("Cannot evaluate property with missing MemberInfo");
}
Value debuggerVal = this.containingObjectExpression.Evaluate(WindowsDebugger.CurrentProcess).GetMemberValue(this.PropInfo);*/
if (this.Expression == null) throw new DebuggerVisualizerException("Cannot evaluate property with missing Expression");
if (this.Expression == null)
{
throw new DebuggerVisualizerException("Cannot evaluate property with missing Expression");
}
Value debuggerVal = this.Expression.Evaluate(WindowsDebugger.CurrentProcess);
this.IsAtomic = debuggerVal.Type.IsAtomic();
this.IsNull = debuggerVal.IsNull;
// null and complex properties will show empty string
this.Value = debuggerVal.IsNull || (!this.IsAtomic) ? string.Empty : debuggerVal.InvokeToString();
this.evaluateCalled = true;
this.IsEvaluated = true;
}
}
}

Loading…
Cancel
Save