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. 9
      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 @@
</DataTemplate> </DataTemplate>
</GridViewColumn.CellTemplate> </GridViewColumn.CellTemplate>
</GridViewColumn> </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 --> <!-- Name -->
<GridViewColumn Header="Name" Width="60"> <GridViewColumn Header="Name" Width="60">
<GridViewColumn.CellTemplate> <GridViewColumn.CellTemplate>

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

@ -94,18 +94,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing
this.listView.ItemsSource = null; this.listView.ItemsSource = null;
} }
void TextBlock_MouseDown(object sender, MouseButtonEventArgs e) void PropertyExpandButton_Click(object sender, RoutedEventArgs 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)
{ {
var clickedButton = (ToggleButton)e.Source; var clickedButton = (ToggleButton)e.Source;
ContentPropertyNode clickedNode = null; ContentPropertyNode clickedNode = null;
@ -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 clickedButton = (ToggleButton)e.Source;
var clickedNode = (ContentNode)(clickedButton).DataContext; var clickedNode = (ContentNode)(clickedButton).DataContext;

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

@ -1,12 +1,14 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Media;
using Debugger.AddIn.Visualizers.Utils; using Debugger.AddIn.Visualizers.Utils;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Ast;
namespace Debugger.AddIn.Visualizers.Graph.Layout namespace Debugger.AddIn.Visualizers.Graph.Layout
{ {
@ -24,6 +26,9 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
this.parent = parent; this.parent = parent;
} }
// Icon next to the name - didn't add much value
//public ImageSource MemberIcon { get; set; }
/// <summary> /// <summary>
/// Path to this content node in the whole <see cref="PositionedGraph"></see>. /// Path to this content node in the whole <see cref="PositionedGraph"></see>.
/// </summary> /// </summary>

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

@ -3,6 +3,8 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using Debugger.AddIn.TreeModel;
using Debugger.MetaData;
namespace Debugger.AddIn.Visualizers.Graph.Layout namespace Debugger.AddIn.Visualizers.Graph.Layout
{ {
@ -11,8 +13,6 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// </summary> /// </summary>
public class ContentPropertyNode : ContentNode, IEvaluate public class ContentPropertyNode : ContentNode, IEvaluate
{ {
PositionedNodeProperty positionedProperty;
public ContentPropertyNode(PositionedNode containingNode, ContentNode parent) public ContentPropertyNode(PositionedNode containingNode, ContentNode parent)
: base(containingNode, parent) : base(containingNode, parent)
{ {
@ -21,26 +21,23 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// <summary> /// <summary>
/// The PositionedNodeProperty this node contains. /// The PositionedNodeProperty this node contains.
/// </summary> /// </summary>
public PositionedNodeProperty Property public PositionedNodeProperty Property { get; private set; }
{
get { return this.positionedProperty; }
}
public bool IsEvaluated public bool IsEvaluated
{ {
get { return this.positionedProperty.IsEvaluated; } get { return this.Property.IsEvaluated; }
} }
public override bool IsPropertyExpanded public override bool IsPropertyExpanded
{ {
get { return this.positionedProperty.IsPropertyExpanded; } get { return this.Property.IsPropertyExpanded; }
set { this.positionedProperty.IsPropertyExpanded = value; } set { this.Property.IsPropertyExpanded = value; }
} }
public void Evaluate() public void Evaluate()
{ {
this.positionedProperty.Evaluate(); this.Property.Evaluate();
this.Text = this.positionedProperty.Value; this.Text = this.Property.Value;
} }
public override bool ShowExpandPropertyButton public override bool ShowExpandPropertyButton
@ -48,7 +45,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
get get
{ {
// show expand button for non-null non-atomic objects // 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
this.Text = sourcePropertyNode.Property.Value; this.Text = sourcePropertyNode.Property.Value;
this.IsNested = false; this.IsNested = false;
this.IsExpanded = false; // always false, Property nodes are never expanded (they have IsPropertyExpanded) 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, sourcePropertyNode.Property, this.ContainingNode,
expanded.Expressions.IsExpanded(sourcePropertyNode.Property.Expression)); 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
propertyList.Add(new ObjectGraphProperty propertyList.Add(new ObjectGraphProperty
{ Name = memberProp.Name, { Name = memberProp.Name,
Expression = propExpression, Value = "", Expression = propExpression, Value = "",
/*PropInfo = memberProp,*/ IsAtomic = true, TargetNode = null }); PropInfo = memberProp, IsAtomic = true, TargetNode = null });
} }
return propertyList.Sorted(ObjectPropertyComparer.Instance); 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
{ {
/// <summary> /// <summary>
/// ObjectProperty used in ObjectGraph. Has TargetNode. /// 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> /// </summary>
public class ObjectGraphProperty : ObjectProperty, IEvaluate public class ObjectGraphProperty : ObjectProperty, IEvaluate
{ {
@ -23,46 +24,27 @@ namespace Debugger.AddIn.Visualizers.Graph
/// </summary> /// </summary>
public ObjectGraphNode TargetNode { get; set; } 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> /// <summary>
/// MemberInfo used for obtaining value of this property /// MemberInfo used for obtaining value of this property
/// </summary> /// </summary>
public MemberInfo PropInfo { get; set; } public MemberInfo MemberInfo { get; set; }
/// <summary>
bool evaluateCalled = false; /// Has this property been evaluated? (Has Evaluate been called?)
public bool IsEvaluated /// </summary>
{ public bool IsEvaluated { get; private set; }
get { return this.evaluateCalled; }
}
public void Evaluate() public void Evaluate()
{ {
/*if (this.PropInfo == null) if (this.Expression == null) throw new DebuggerVisualizerException("Cannot evaluate property with missing Expression");
{
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");
}
Value debuggerVal = this.Expression.Evaluate(WindowsDebugger.CurrentProcess); Value debuggerVal = this.Expression.Evaluate(WindowsDebugger.CurrentProcess);
this.IsAtomic = debuggerVal.Type.IsAtomic(); this.IsAtomic = debuggerVal.Type.IsAtomic();
this.IsNull = debuggerVal.IsNull; this.IsNull = debuggerVal.IsNull;
// null and complex properties will show empty string // null and complex properties will show empty string
this.Value = debuggerVal.IsNull || (!this.IsAtomic) ? string.Empty : debuggerVal.InvokeToString(); this.Value = debuggerVal.IsNull || (!this.IsAtomic) ? string.Empty : debuggerVal.InvokeToString();
this.evaluateCalled = true; this.IsEvaluated = true;
} }
} }
} }

Loading…
Cancel
Save