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 @@
@@ -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 @@
@@ -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 @@
@@ -1,60 +1,97 @@
|
||||
<Window x:Class="ICSharpCode.CodeQualityAnalysis.MainWindow" |
||||
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:Graph="clr-namespace:ICSharpCode.CodeQualityAnalysis.Controls" |
||||
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls;assembly=ICSharpCode.WpfDesign.Designer" |
||||
xmlns:Graph="clr-namespace:ICSharpCode.CodeQualityAnalysis.Controls" |
||||
xmlns:src="clr-namespace:ICSharpCode.CodeQualityAnalysis" |
||||
Title="Code Quality Analysis" |
||||
x:Name="root"> |
||||
<Window.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="../Resources/GraphTemplate.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
||||
</Window.Resources> |
||||
|
||||
<TabControl> |
||||
<TabItem Header="Dependency Graph"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition /> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Grid.ColumnDefinitions> |
||||
<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" /> |
||||
|
||||
<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"> |
||||
<WindowsFormsHost> |
||||
<Graph:DependencyMatrixControl x:Name="matrixControl"></Graph:DependencyMatrixControl> |
||||
</WindowsFormsHost> |
||||
</TabItem> |
||||
</TabControl> |
||||
<Window.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="../Resources/GraphTemplate.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
<DataTemplate x:Key="MemberTemplate"> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<Image Source="{Binding Path=Icon}" Margin="0, 0, 0, 3" /> |
||||
<TextBlock Text="{Binding Path=Name}" /> |
||||
</StackPanel> |
||||
</DataTemplate> |
||||
|
||||
<HierarchicalDataTemplate x:Key="TypeTemplate" |
||||
ItemTemplate="{StaticResource MemberTemplate}" |
||||
ItemsSource="{Binding Members}"> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<Image Source="{Binding Path=Icon}" /> |
||||
<TextBlock Text="{Binding Path=Name}" /> |
||||
</StackPanel> |
||||
</HierarchicalDataTemplate> |
||||
|
||||
<HierarchicalDataTemplate x:Key="NamespaceTemplate" |
||||
ItemsSource="{Binding Types}" |
||||
ItemTemplate="{StaticResource TypeTemplate}"> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<Image Source="{Binding Path=Icon}" /> |
||||
<TextBlock Text="{Binding Path=Name}" /> |
||||
</StackPanel> |
||||
</HierarchicalDataTemplate> |
||||
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding Namespaces}" |
||||
ItemTemplate="{StaticResource NamespaceTemplate}" |
||||
x:Key="ModuleTemplate"> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<Image Source="{Binding Path=Icon}" /> |
||||
<TextBlock Text="{Binding Path=Name}" /> |
||||
</StackPanel> |
||||
</HierarchicalDataTemplate> |
||||
</ResourceDictionary> |
||||
</Window.Resources> |
||||
|
||||
<TabControl> |
||||
<TabItem Header="Dependency Graph"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition /> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Grid.ColumnDefinitions> |
||||
<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> |
||||
|
||||
Loading…
Reference in new issue