Browse Source

Added an icon to nodes in Dependency Graph.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6261 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Tomáš Linhart 16 years ago
parent
commit
e0b462ce3a
  1. 1
      src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
  2. 143
      src/AddIns/Analysis/CodeQuality/Resources/GraphTemplate.xaml
  3. 28
      src/AddIns/Analysis/CodeQuality/Src/Controls/DependencyIconVertexConverter.cs
  4. 10
      src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml.cs
  5. 9
      src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml

1
src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj

@ -113,6 +113,7 @@ @@ -113,6 +113,7 @@
<Compile Include="Src\Controls\DependencyMatrixControl.cs" />
<Compile Include="Src\Controls\DependencyMatrix.cs" />
<Compile Include="Src\Controls\DependencyVertex.cs" />
<Compile Include="Src\Controls\DependencyIconVertexConverter.cs" />
<Compile Include="Src\Controls\Matrix.cs" />
<Compile Include="Src\Controls\MatrixControl.cs" />
<Compile Include="Src\Controls\TreeMatrixControl.xaml.cs">

143
src/AddIns/Analysis/CodeQuality/Resources/GraphTemplate.xaml

@ -1,11 +1,12 @@ @@ -1,11 +1,12 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.CodeQualityAnalysis.Controls"
xmlns:GraphSharp_Controls="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls"
xmlns:Converters="clr-namespace:GraphSharp.Converters;assembly=GraphSharp.Controls"
xmlns:WPFExtensions_AttachedBehaviours="clr-namespace:WPFExtensions.AttachedBehaviours;assembly=WPFExtensions">
xmlns:WPFExtensions_AttachedBehaviours="clr-namespace:WPFExtensions.AttachedBehaviours;assembly=WPFExtensions"
>
<Converters:EdgeRouteToPathConverter x:Key="routeToPathConverter" />
<Controls:DependencyIconVertexConverter x:Key="IconConverter"/>
<SolidColorBrush x:Key="HighlightedVertexBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="HighlightedVertexBackgroundBrush" Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" />
@ -28,7 +29,10 @@ @@ -28,7 +29,10 @@
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="10,10,10,10"
Padding="{TemplateBinding Padding}">
<StackPanel Orientation="Horizontal">
<Image Margin="0, 1, 5, 0" Source="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type GraphSharp_Controls:VertexControl}}, Path=Vertex, Converter={StaticResource IconConverter}}" />
<ContentPresenter Content="{TemplateBinding Vertex}"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
@ -156,135 +160,4 @@ @@ -156,135 +160,4 @@
</MultiTrigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type GraphSharp_Controls:CompoundVertexControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GraphSharp_Controls:CompoundVertexControl}">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="10">
<GroupBox>
<GroupBox.Header>
adfajkdsfklad
</GroupBox.Header>
<ItemsControl x:Name="PART_InnerCanvas"
ItemsSource="{TemplateBinding Vertices}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</GroupBox>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="GraphSharp_Controls:GraphElementBehaviour.HighlightTrigger"
Value="{Binding RelativeSource={RelativeSource Self},Path=IsMouseOver}" />
<Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.IsDragEnabled"
Value="True" />
<Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.X"
Value="{Binding RelativeSource={RelativeSource Self},Path=(GraphSharp_Controls:GraphCanvas.X),Mode=TwoWay}" />
<Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.Y"
Value="{Binding RelativeSource={RelativeSource Self},Path=(GraphSharp_Controls:GraphCanvas.Y),Mode=TwoWay}" />
<Setter Property="BorderThickness"
Value="22" />
<Setter Property="BorderBrush"
Value="Silver" />
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0"
EndPoint="1,1">
<GradientStop Color="White"
Offset="0" />
<GradientStop Color="BurlyWood"
Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="LayoutMode"
Value="Automatic">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GraphSharp_Controls:CompoundVertexControl}">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="10">
<GroupBox>
<GroupBox.Header>
wdawew
</GroupBox.Header>
<ItemsControl x:Name="PART_InnerCanvas"
ItemsSource="{TemplateBinding Vertices}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<GraphSharp_Controls:GraphCanvas Background="White"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</GroupBox>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0"
EndPoint="1,1">
<GradientStop Color="White"
Offset="0" />
<GradientStop Color="Silver"
Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsHighlighted"
Value="True">
<Setter Property="BorderBrush"
Value="Orange" />
<Setter Property="BorderThickness"
Value="2" />
</Trigger>
<Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
Value="True">
<Setter Property="BorderBrush"
Value="Yellow" />
<Setter Property="BorderThickness"
Value="2" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
Value="True" />
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
Value="Source" />
</MultiTrigger.Conditions>
<Setter Property="BorderBrush"
Value="Red" />
<Setter Property="BorderThickness"
Value="2" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
Value="True" />
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
Value="Target" />
</MultiTrigger.Conditions>
<Setter Property="BorderBrush"
Value="Blue" />
<Setter Property="BorderThickness"
Value="2" />
</MultiTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

28
src/AddIns/Analysis/CodeQuality/Src/Controls/DependencyIconVertexConverter.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
using System;
using System.Windows.Data;
using System.Globalization;
using System.Windows.Media.Imaging;
namespace ICSharpCode.CodeQualityAnalysis.Controls
{
/// <summary>
/// Description of DependencyVertexConverter.
/// </summary>
[ValueConversion(typeof(object), typeof(BitmapSource))]
public class DependencyIconVertexConverter : IValueConverter
{
public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture)
{
var vertex = value as DependencyVertex;
if (value != null)
return vertex.Node.Icon;
else
return null;
}
public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}

10
src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml.cs

@ -1,12 +1,4 @@ @@ -1,12 +1,4 @@
/*
* Created by SharpDevelop.
* User: Tomas
* Date: 26.7.2010
* Time: 10:08
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;

9
src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls;assembly=ICSharpCode.WpfDesign.Designer"
xmlns:GraphSharp="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls"
xmlns:Graph="clr-namespace:ICSharpCode.CodeQualityAnalysis.Controls"
xmlns:src="clr-namespace:ICSharpCode.CodeQualityAnalysis"
Title="Code Quality Analysis"
@ -14,7 +15,7 @@ @@ -14,7 +15,7 @@
<DataTemplate x:Key="MemberTemplate">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Icon}" Margin="0, 0, 0, 3" />
<Image Source="{Binding Path=Icon}" Margin="0, 0, 5, 0" />
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</DataTemplate>
@ -23,7 +24,7 @@ @@ -23,7 +24,7 @@
ItemTemplate="{StaticResource MemberTemplate}"
ItemsSource="{Binding Members}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Icon}" />
<Image Source="{Binding Path=Icon}" Margin="0, 0, 5, 0" />
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</HierarchicalDataTemplate>
@ -32,7 +33,7 @@ @@ -32,7 +33,7 @@
ItemsSource="{Binding Types}"
ItemTemplate="{StaticResource TypeTemplate}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Icon}" />
<Image Source="{Binding Path=Icon}" Margin="0, 0, 5, 0" />
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</HierarchicalDataTemplate>
@ -41,7 +42,7 @@ @@ -41,7 +42,7 @@
ItemTemplate="{StaticResource NamespaceTemplate}"
x:Key="ModuleTemplate">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Icon}" />
<Image Source="{Binding Path=Icon}" Margin="0, 0, 5, 0" />
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</HierarchicalDataTemplate>

Loading…
Cancel
Save