Browse Source

Merge

pull/19/head
Tomas Linhart 15 years ago
parent
commit
4de6520ca6
  1. 4
      src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
  2. 2
      src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.sln
  3. 4
      src/AddIns/Analysis/CodeQuality/Src/Controls/MatrixControl.cs
  4. 10
      src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml
  5. 50
      src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml.cs
  6. 28
      src/AddIns/Analysis/CodeQuality/Src/Utility/Helper.cs

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

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{76DD1CC0-0D86-44A1-9BD6-D91F79807BC3}</ProjectGuid>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ICSharpCode.CodeQualityAnalysis</RootNamespace>
<AssemblyName>CodeQualityAnalysis</AssemblyName>
@ -130,7 +130,6 @@ @@ -130,7 +130,6 @@
<Compile Include="Src\DependencyTreeNode.cs" />
<Compile Include="Src\Event.cs" />
<Compile Include="Src\Field.cs" />
<Compile Include="Src\Helper.cs" />
<Compile Include="Src\INode.cs" />
<Compile Include="Src\Instruction.cs" />
<Compile Include="Src\IValue.cs" />
@ -145,6 +144,7 @@ @@ -145,6 +144,7 @@
<Compile Include="Src\Type.cs" />
<Compile Include="Src\Utility\DoubleKeyDictionary.cs" />
<Compile Include="Src\Utility\IColorizer.cs" />
<Compile Include="Src\Utility\Helper.cs" />
<Compile Include="Src\Utility\Matrix.cs" />
<Compile Include="Src\Utility\RelayCommand.cs" />
<Compile Include="Src\Utility\ViewModelBase.cs" />

2
src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.sln

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.2.0.7899-alpha
# SharpDevelop 4.2.0.7909-alpha
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeQualityAnalysis", "CodeQualityAnalysis.csproj", "{76DD1CC0-0D86-44A1-9BD6-D91F79807BC3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\..\..\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}"

4
src/AddIns/Analysis/CodeQuality/Src/Controls/MatrixControl.cs

@ -89,8 +89,8 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls @@ -89,8 +89,8 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls
{
InvalidateVisual();
HoveredCell.RowIndex = currentCell.X;
HoveredCell.ColumnIndex = currentCell.Y;
HoveredCell.RowIndex = currentCell.Y;
HoveredCell.ColumnIndex = currentCell.X;
HoveredCell.Value = matrix[HoveredCell.RowIndex, HoveredCell.ColumnIndex];
if (HoveredCellChanged != null)
HoveredCellChanged(this, new HoveredCellEventArgs<TValue>(HoveredCell));

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

@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
<tree:SharpTreeView
Name="leftTree"
Grid.Row="2"
ScrollViewer.ScrollChanged="LeftTree_ScrollChanged"
Grid.Column="0">
</tree:SharpTreeView>
@ -45,7 +46,9 @@ @@ -45,7 +46,9 @@
<tree:SharpTreeView
Name="topTree"
Grid.Row="0"
Grid.Column="2">
Grid.Column="2"
Loaded="Trees_Loaded"
ScrollViewer.ScrollChanged="TopTree_ScrollChanged">
<tree:SharpTreeView.LayoutTransform>
<RotateTransform
Angle="-90" />
@ -57,12 +60,13 @@ @@ -57,12 +60,13 @@
ResizeDirection="Rows"
HorizontalAlignment="Stretch"
Background="LightGray"></GridSplitter>
<ScrollViewer
<ScrollViewer Name="scrollViewer"
Grid.Column="2"
Grid.Row="2"
CanContentScroll="True"
VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Visible">
HorizontalScrollBarVisibility="Visible"
ScrollChanged="ScrollViewer_ScrollChanged">
<Controls:DependencyMatrixControl
x:Name="matrixControl" />
</ScrollViewer>

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

@ -15,6 +15,7 @@ using System.Windows.Forms; @@ -15,6 +15,7 @@ using System.Windows.Forms;
using System.Linq;
using ICSharpCode.CodeQualityAnalysis.Utility;
namespace ICSharpCode.CodeQualityAnalysis.Controls
{
/// <summary>
@ -22,6 +23,10 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls @@ -22,6 +23,10 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls
/// </summary>
public partial class TreeMatrixControl : System.Windows.Controls.UserControl
{
private ScrollViewer leftScrollViewer;
private ScrollViewer topScrollViewer;
public Matrix<INode, Relationship> Matrix
{
get
@ -35,11 +40,13 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls @@ -35,11 +40,13 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls
}
}
public TreeMatrixControl()
{
InitializeComponent();
matrixControl.Colorizer = new DependencyColorizer();
matrixControl.HoveredCellChanged += OnHoverChanged;
}
public void DrawTree(Module module)
@ -47,5 +54,48 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls @@ -47,5 +54,48 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls
Helper.FillTree(leftTree,module);
Helper.FillTree(topTree,module);
}
void Trees_Loaded (object sender, EventArgs e)
{
leftTree.ApplyTemplate();
topTree.ApplyTemplate();
leftScrollViewer = Helper.FindVisualChild<ScrollViewer>(leftTree);
topScrollViewer = Helper.FindVisualChild<ScrollViewer>(topTree);
}
void OnHoverChanged (object sender ,HoveredCellEventArgs <Relationship> e)
{
var leftNode = leftTree.Items[e.HoveredCell.RowIndex] as DependecyTreeNode;
leftTree.SelectedItem = leftNode;
leftTree.FocusNode(leftNode);
var topNode = topTree.Items[e.HoveredCell.ColumnIndex] as DependecyTreeNode;
topTree.SelectedItem = topNode;
topTree.FocusNode(topNode);
}
void LeftTree_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
// Console.WriteLine("Left TreeScroll");
scrollViewer.ScrollToVerticalOffset(e.VerticalOffset * matrixControl.CellHeight);
Console.WriteLine("--");
}
void TopTree_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
// Console.WriteLine("Top TreeScroll ");
scrollViewer.ScrollToHorizontalOffset(e.VerticalChange * matrixControl.CellHeight);
Console.WriteLine("--");
}
void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
// Console.WriteLine("ScrollViewer_ScrollChanged {0} _ {1}",e.VerticalChange,scrollViewer != null);
//leftScrollViewer.ScrollToVerticalOffset (e.VerticalChange * matrixControl.CellHeight);
}
}
}

28
src/AddIns/Analysis/CodeQuality/Src/Helper.cs → src/AddIns/Analysis/CodeQuality/Src/Utility/Helper.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Windows;
using System.Windows.Media;
namespace ICSharpCode.CodeQualityAnalysis
@ -61,5 +62,32 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -61,5 +62,32 @@ namespace ICSharpCode.CodeQualityAnalysis
B = Convert.ToByte(b)
};
}
public static T FindVisualChild<T>( DependencyObject obj )
where T : DependencyObject
{
// Search immediate children first (breadth-first)
for( int i = 0; i < VisualTreeHelper.GetChildrenCount( obj ); i++ )
{
DependencyObject child = VisualTreeHelper.GetChild( obj, i );
if( child != null && child is T )
{
return ( T )child;
}
else
{
T childOfChild = FindVisualChild<T>( child );
if( childOfChild != null )
{
return childOfChild;
}
}
}
return null;
}
}
}
Loading…
Cancel
Save