Browse Source

ToolTip Style in DependencyMatrix

pull/18/head
PeterForstmeier 14 years ago
parent
commit
f02b774342
  1. 4
      src/AddIns/Analysis/CodeQuality/CodeQuality.csproj
  2. 1
      src/AddIns/Analysis/CodeQuality/Gui/Controls/MatrixControl.cs
  3. 40
      src/AddIns/Analysis/CodeQuality/Gui/DependencyMatrixView.xaml
  4. 8
      src/AddIns/Analysis/CodeQuality/Gui/DependencyMatrixView.xaml.cs
  5. 35
      src/AddIns/Analysis/CodeQuality/Gui/MainView.xaml.cs
  6. 5
      src/AddIns/Analysis/CodeQuality/Gui/NodeDescriptionViewModel.cs

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

@ -43,7 +43,11 @@ @@ -43,7 +43,11 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>

1
src/AddIns/Analysis/CodeQuality/Gui/Controls/MatrixControl.cs

@ -123,6 +123,7 @@ namespace ICSharpCode.CodeQuality.Gui @@ -123,6 +123,7 @@ namespace ICSharpCode.CodeQuality.Gui
base.OnMouseMove(e);
var point = e.GetPosition(this);
Console.WriteLine ("posiion{0}",point);
if (point.X < matrixWidth * CellWidth
&& point.Y < matrixHeight * CellHeight)
currentCell = new Coords(

40
src/AddIns/Analysis/CodeQuality/Gui/DependencyMatrixView.xaml

@ -3,6 +3,25 @@ @@ -3,6 +3,25 @@
xmlns:tv="http://icsharpcode.net/sharpdevelop/treeview"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<Style TargetType="{x:Type ToolTip}">
<!-- http://www.mycsharp.de/wbb2/thread.php?postid=318921-->
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="VerticalOffset" Value="-50" />
<Setter Property="HorizontalOffset" Value="20" />
<Setter Property="Placement" Value="MousePoint" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToolTip}">
<Grid Name="Border" Background="Transparent" Width="{TemplateBinding Width}" Height="Auto">
<Border BorderBrush ="Black" CornerRadius="5" BorderThickness="2" Background="WhiteSmoke"></Border>
<ContentPresenter Margin="10,10,10,10" HorizontalAlignment="Center" VerticalAlignment="Center" TextBlock.Foreground="Black" TextBlock.FontSize="12" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
@ -26,7 +45,7 @@ @@ -26,7 +45,7 @@
ScrollViewer.VerticalScrollBarVisibility="Hidden"
MouseMove="TopTreeMouseMove"
ScrollViewer.ScrollChanged="ViewScrollChanged">
<tv:SharpTreeView.LayoutTransform>
<RotateTransform Angle="-90"/>
</tv:SharpTreeView.LayoutTransform>
@ -61,7 +80,24 @@ @@ -61,7 +80,24 @@
Grid.Row="2" Grid.Column="2"
CanContentScroll="True"
ScrollChanged="ViewScrollChanged">
<gui:DependencyMatrixControl x:Name="matrix" HoveredCellChanged="MatrixHoveredCellChanged" />
<gui:DependencyMatrixControl x:Name="matrix"
HoveredCellChanged="MatrixHoveredCellChanged">
<!--
<gui:DependencyMatrixControl.ToolTip >
<Border Margin="-4,0,-4,-3" Padding="10" Background="Red"
ToolTipService.ShowOnDisabled="True"
ToolTipService.Placement="MousePoint"
ToolTipService.HorizontalOffset="10"
>
<Border.BitmapEffect>
<OuterGlowBitmapEffect></OuterGlowBitmapEffect>
</Border.BitmapEffect>
</Border>
</gui:DependencyMatrixControl.ToolTip>
-->
</gui:DependencyMatrixControl>
</ScrollViewer>
</Grid>
</UserControl>

8
src/AddIns/Analysis/CodeQuality/Gui/DependencyMatrixView.xaml.cs

@ -175,6 +175,7 @@ namespace ICSharpCode.CodeQuality.Gui @@ -175,6 +175,7 @@ namespace ICSharpCode.CodeQuality.Gui
return null;
}
void MatrixHoveredCellChanged(object sender, HoveredCellEventArgs<Tuple<int, int>> e)
{
// need to add 1 to index, because first item in treeview is invisible root node
@ -185,16 +186,21 @@ namespace ICSharpCode.CodeQuality.Gui @@ -185,16 +186,21 @@ namespace ICSharpCode.CodeQuality.Gui
topTree.SelectedItem = topTree.Items[e.HoveredCell.ColumnIndex + 1];
}
UpdateInfoText();
matrix.ToolTip = nodeDescriptionViewModel.InfoText;
}
void UpdateInfoText()
{
var left = leftTree.SelectedItem as MatrixTreeNode;
var top = topTree.SelectedItem as MatrixTreeNode;
if (left != null && top != null)
{
nodeDescriptionViewModel.InfoText = left.Node.GetInfoText(top.Node);
matrix.ToolTip = nodeDescriptionViewModel.InfoText;
}
}
#endregion
}
}

35
src/AddIns/Analysis/CodeQuality/Gui/MainView.xaml.cs

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -10,7 +11,9 @@ using System.Windows.Data; @@ -10,7 +11,9 @@ using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.CodeQuality.Engine;
using ICSharpCode.CodeQuality.Engine.Dom;
using ICSharpCode.SharpDevelop.Gui;
using Microsoft.Win32;
@ -45,7 +48,19 @@ namespace ICSharpCode.CodeQuality.Gui @@ -45,7 +48,19 @@ namespace ICSharpCode.CodeQuality.Gui
RefreshClick(null, null);
}
ReadOnlyCollection <AssemblyNode> list;
void RefreshClick(object sender, RoutedEventArgs e)
{
introBlock.Visibility = Visibility.Collapsed;
using (context.progressMonitor = AsynchronousWaitDialog.ShowWaitDialog("Analysis"))
list = context.Analyze();
Report(list);
matrix.Update(list);
matrix.Visibility = Visibility.Visible;
}
/*
void RefreshClick(object sender, RoutedEventArgs e)
{
introBlock.Visibility = Visibility.Collapsed;
@ -53,5 +68,23 @@ namespace ICSharpCode.CodeQuality.Gui @@ -53,5 +68,23 @@ namespace ICSharpCode.CodeQuality.Gui
matrix.Update(context.Analyze());
matrix.Visibility = Visibility.Visible;
}
*/
void Report (ReadOnlyCollection<AssemblyNode> list)
{
foreach (var ass in list)
{
Console.WriteLine("{0} - {1}",ass.Name,ass.namespaces);
foreach (var child in ass.Children)
{
Console.WriteLine("\t {0}",child.Name);
foreach (var subchild in child.Children) {
Console.WriteLine("\t\t {0}",subchild.Name);
}
}
}
}
}
}

5
src/AddIns/Analysis/CodeQuality/Gui/NodeDescriptionViewModel.cs

@ -38,14 +38,10 @@ namespace ICSharpCode.CodeQuality.Gui @@ -38,14 +38,10 @@ namespace ICSharpCode.CodeQuality.Gui
}
}
// public int Uses {get {return Node.Uses.Count();}}
//
// public int UsesBy {get {return Node.UsedBy.Count();}}
public string ClassType {
get {
var n = node.GetType().Name;
// Console.WriteLine(n.Substring(0,n.Length -4));
return (n.Substring(0,n.Length -4));
}
}
@ -59,5 +55,6 @@ namespace ICSharpCode.CodeQuality.Gui @@ -59,5 +55,6 @@ namespace ICSharpCode.CodeQuality.Gui
base.RaisePropertyChanged(()=>InfoText);
}
}
}
}

Loading…
Cancel
Save