Browse Source
- Collection's properties got private setter. - First draft of Dependency Matrix which uses a tree. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6251 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
13 changed files with 463 additions and 353 deletions
@ -0,0 +1,38 @@ |
|||||||
|
<UserControl x:Class="ICSharpCode.CodeQualityAnalysis.Controls.TreeMatrixControl" |
||||||
|
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"> |
||||||
|
<UserControl.Resources> |
||||||
|
<Style TargetType="{x:Type TreeViewItem}"> |
||||||
|
<Setter Property="BorderBrush" Value="Red" /> |
||||||
|
<Setter Property="Header" Value="test" /> |
||||||
|
</Style> |
||||||
|
</UserControl.Resources> |
||||||
|
<Grid> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto" /> |
||||||
|
<RowDefinition Height="Auto" /> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
|
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="Auto" /> |
||||||
|
<ColumnDefinition Width="Auto" /> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
|
||||||
|
<TreeView Name="leftTree" Grid.Row="1" Grid.Column="0"> |
||||||
|
<TreeView.Resources> |
||||||
|
|
||||||
|
</TreeView.Resources> |
||||||
|
</TreeView> |
||||||
|
|
||||||
|
<TreeView Name="topTree" Grid.Row="0" Grid.Column="1"> |
||||||
|
<TreeView.LayoutTransform> |
||||||
|
<RotateTransform Angle="-90" /> |
||||||
|
</TreeView.LayoutTransform> |
||||||
|
</TreeView> |
||||||
|
|
||||||
|
<WindowsFormsHost Grid.Column="1" Grid.Row="1"> |
||||||
|
<Controls:DependencyMatrixControl x:Name="matrixControl"></Controls:DependencyMatrixControl> |
||||||
|
</WindowsFormsHost> |
||||||
|
</Grid> |
||||||
|
</UserControl> |
||||||
@ -0,0 +1,101 @@ |
|||||||
|
/* |
||||||
|
* 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.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
namespace ICSharpCode.CodeQualityAnalysis.Controls |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for TreeMatrixControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class TreeMatrixControl : System.Windows.Controls.UserControl |
||||||
|
{ |
||||||
|
public Matrix<INode> Matrix |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return matrixControl.Matrix; |
||||||
|
} |
||||||
|
|
||||||
|
set |
||||||
|
{ |
||||||
|
matrixControl.Matrix = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public TreeMatrixControl() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
|
||||||
|
matrixControl.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; |
||||||
|
matrixControl.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; |
||||||
|
matrixControl.BorderStyle = BorderStyle.FixedSingle; |
||||||
|
|
||||||
|
matrixControl.RowHeadersVisible = false; |
||||||
|
matrixControl.ColumnHeadersVisible = false; |
||||||
|
} |
||||||
|
|
||||||
|
public void DrawMatrix() |
||||||
|
{ |
||||||
|
matrixControl.DrawMatrix(); |
||||||
|
} |
||||||
|
|
||||||
|
public void DrawTree(Module module) |
||||||
|
{ |
||||||
|
foreach (var ns in module.Namespaces) |
||||||
|
{ |
||||||
|
var nsType = new TreeViewItem |
||||||
|
{ |
||||||
|
Header = ns.Name |
||||||
|
}; |
||||||
|
|
||||||
|
leftTree.Items.Add(nsType); |
||||||
|
|
||||||
|
foreach (var type in ns.Types) |
||||||
|
{ |
||||||
|
var itemType = new TreeViewItem |
||||||
|
{ |
||||||
|
Header = type.Name |
||||||
|
}; |
||||||
|
|
||||||
|
nsType.Items.Add(itemType); |
||||||
|
|
||||||
|
foreach (var method in type.Methods) |
||||||
|
{ |
||||||
|
var itemMethod = new TreeViewItem |
||||||
|
{ |
||||||
|
Header = method.Name |
||||||
|
}; |
||||||
|
|
||||||
|
itemType.Items.Add(itemMethod); |
||||||
|
} |
||||||
|
|
||||||
|
foreach (var field in type.Fields) |
||||||
|
{ |
||||||
|
var itemField = new TreeViewItem |
||||||
|
{ |
||||||
|
Header = field.Name |
||||||
|
}; |
||||||
|
|
||||||
|
itemType.Items.Add(itemField); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -1,60 +1,97 @@ |
|||||||
<Window x:Class="ICSharpCode.CodeQualityAnalysis.MainWindow" |
<Window x:Class="ICSharpCode.CodeQualityAnalysis.MainWindow" |
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls;assembly=ICSharpCode.WpfDesign.Designer" |
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls;assembly=ICSharpCode.WpfDesign.Designer" |
||||||
xmlns:Graph="clr-namespace:ICSharpCode.CodeQualityAnalysis.Controls" |
xmlns:Graph="clr-namespace:ICSharpCode.CodeQualityAnalysis.Controls" |
||||||
|
xmlns:src="clr-namespace:ICSharpCode.CodeQualityAnalysis" |
||||||
Title="Code Quality Analysis" |
Title="Code Quality Analysis" |
||||||
x:Name="root"> |
x:Name="root"> |
||||||
<Window.Resources> |
<Window.Resources> |
||||||
<ResourceDictionary> |
<ResourceDictionary> |
||||||
<ResourceDictionary.MergedDictionaries> |
<ResourceDictionary.MergedDictionaries> |
||||||
<ResourceDictionary Source="../Resources/GraphTemplate.xaml" /> |
<ResourceDictionary Source="../Resources/GraphTemplate.xaml" /> |
||||||
</ResourceDictionary.MergedDictionaries> |
</ResourceDictionary.MergedDictionaries> |
||||||
</ResourceDictionary> |
|
||||||
</Window.Resources> |
<DataTemplate x:Key="MemberTemplate"> |
||||||
|
<StackPanel Orientation="Horizontal"> |
||||||
<TabControl> |
<Image Source="{Binding Path=Icon}" Margin="0, 0, 0, 3" /> |
||||||
<TabItem Header="Dependency Graph"> |
<TextBlock Text="{Binding Path=Name}" /> |
||||||
<Grid> |
</StackPanel> |
||||||
<Grid.RowDefinitions> |
</DataTemplate> |
||||||
<RowDefinition Height="Auto" /> |
|
||||||
<RowDefinition /> |
<HierarchicalDataTemplate x:Key="TypeTemplate" |
||||||
</Grid.RowDefinitions> |
ItemTemplate="{StaticResource MemberTemplate}" |
||||||
|
ItemsSource="{Binding Members}"> |
||||||
<Grid.ColumnDefinitions> |
<StackPanel Orientation="Horizontal"> |
||||||
<ColumnDefinition Width="250px" /> |
<Image Source="{Binding Path=Icon}" /> |
||||||
<ColumnDefinition /> |
<TextBlock Text="{Binding Path=Name}" /> |
||||||
<ColumnDefinition Width="200px" /> |
</StackPanel> |
||||||
</Grid.ColumnDefinitions> |
</HierarchicalDataTemplate> |
||||||
|
|
||||||
<ToolBarTray Background="White" Grid.Row="0" Grid.ColumnSpan="2"> |
<HierarchicalDataTemplate x:Key="NamespaceTemplate" |
||||||
<ToolBar> |
ItemsSource="{Binding Types}" |
||||||
<Button Name="btnOpenAssembly" Click="btnOpenAssembly_Click" Margin="0 0 5 0">Open Assembly</Button> |
ItemTemplate="{StaticResource TypeTemplate}"> |
||||||
<Button Name="btnRelayout" Click="btnRelayout_Click" Margin="0 0 5 0">Relayout</Button> |
<StackPanel Orientation="Horizontal"> |
||||||
<Button Name="btnContinueLayout" Click="btnContinueLayout_Click" Margin="0 0 5 0">Continue Layout</Button> |
<Image Source="{Binding Path=Icon}" /> |
||||||
<Button Name="btnResetGraph" Click="btnResetGraph_Click" Margin="0 0 5 0">Reset Graph</Button> |
<TextBlock Text="{Binding Path=Name}" /> |
||||||
<Button Name="btnSaveImageGraph" Click="btnSaveImageGraph_Click">Save an Image of Graph</Button> |
</StackPanel> |
||||||
</ToolBar> |
</HierarchicalDataTemplate> |
||||||
</ToolBarTray> |
|
||||||
|
<HierarchicalDataTemplate ItemsSource="{Binding Namespaces}" |
||||||
<TreeView Name="definitionTree" Grid.Row="1" Grid.Column="0" SelectedItemChanged="definitionTree_SelectedItemChanged" /> |
ItemTemplate="{StaticResource NamespaceTemplate}" |
||||||
|
x:Key="ModuleTemplate"> |
||||||
<Controls:ZoomControl Grid.Row="1" Grid.Column="1" Name="zoom" AlwaysShowZoomButtons="True" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"> |
<StackPanel Orientation="Horizontal"> |
||||||
<Graph:DependencyGraphLayout x:Name="graphLayout" |
<Image Source="{Binding Path=Icon}" /> |
||||||
LayoutAlgorithmType="LinLog" |
<TextBlock Text="{Binding Path=Name}" /> |
||||||
OverlapRemovalAlgorithmType="FSA" |
</StackPanel> |
||||||
HighlightAlgorithmType="Simple" |
</HierarchicalDataTemplate> |
||||||
VertexClick="graphLayout_VertexClick" |
</ResourceDictionary> |
||||||
/> |
</Window.Resources> |
||||||
</Controls:ZoomControl> |
|
||||||
|
<TabControl> |
||||||
<TextBlock Name="txbTypeInfo" Grid.Column="3" Grid.Row="1"/> |
<TabItem Header="Dependency Graph"> |
||||||
</Grid> |
<Grid> |
||||||
</TabItem> |
<Grid.RowDefinitions> |
||||||
<TabItem Header="Dependency Matrix"> |
<RowDefinition Height="Auto" /> |
||||||
<WindowsFormsHost> |
<RowDefinition /> |
||||||
<Graph:DependencyMatrixControl x:Name="matrixControl"></Graph:DependencyMatrixControl> |
</Grid.RowDefinitions> |
||||||
</WindowsFormsHost> |
|
||||||
</TabItem> |
<Grid.ColumnDefinitions> |
||||||
</TabControl> |
<ColumnDefinition Width="250px" /> |
||||||
|
<ColumnDefinition /> |
||||||
|
<ColumnDefinition Width="200px" /> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
|
||||||
|
<ToolBarTray Background="White" Grid.Row="0" Grid.ColumnSpan="2"> |
||||||
|
<ToolBar> |
||||||
|
<Button Name="btnOpenAssembly" Click="btnOpenAssembly_Click" Margin="0 0 5 0">Open Assembly</Button> |
||||||
|
<Button Name="btnRelayout" Click="btnRelayout_Click" Margin="0 0 5 0">Relayout</Button> |
||||||
|
<Button Name="btnContinueLayout" Click="btnContinueLayout_Click" Margin="0 0 5 0">Continue Layout</Button> |
||||||
|
<Button Name="btnResetGraph" Click="btnResetGraph_Click" Margin="0 0 5 0">Reset Graph</Button> |
||||||
|
<Button Name="btnSaveImageGraph" Click="btnSaveImageGraph_Click">Save an Image of Graph</Button> |
||||||
|
</ToolBar> |
||||||
|
</ToolBarTray> |
||||||
|
|
||||||
|
<TreeView Name="definitionTree" Grid.Row="1" Grid.Column="0" |
||||||
|
SelectedItemChanged="definitionTree_SelectedItemChanged" |
||||||
|
ItemsSource="{Binding}" |
||||||
|
ItemTemplate="{StaticResource ModuleTemplate}"> |
||||||
|
</TreeView> |
||||||
|
|
||||||
|
<Controls:ZoomControl Grid.Row="1" Grid.Column="1" Name="zoom" AlwaysShowZoomButtons="True" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"> |
||||||
|
<Graph:DependencyGraphLayout x:Name="graphLayout" |
||||||
|
LayoutAlgorithmType="LinLog" |
||||||
|
OverlapRemovalAlgorithmType="FSA" |
||||||
|
HighlightAlgorithmType="Simple" |
||||||
|
VertexClick="graphLayout_VertexClick" |
||||||
|
/> |
||||||
|
</Controls:ZoomControl> |
||||||
|
|
||||||
|
<TextBlock Name="txbTypeInfo" Grid.Column="3" Grid.Row="1"/> |
||||||
|
</Grid> |
||||||
|
</TabItem> |
||||||
|
<TabItem Header="Dependency Matrix"> |
||||||
|
<Graph:TreeMatrixControl x:Name="matrixControl"></Graph:TreeMatrixControl> |
||||||
|
</TabItem> |
||||||
|
</TabControl> |
||||||
</Window> |
</Window> |
||||||
|
|||||||
Loading…
Reference in new issue