Browse Source

UI update on pin control

pull/11/head
eusebiu 15 years ago
parent
commit
afea20fac0
  1. BIN
      data/resources/image/BitmapResources/BitmapResources-data/Icons.16x16.Refresh.png
  2. 53
      src/AddIns/Debugger/Debugger.AddIn/TreeModel/ExpressionNode.cs
  3. 6
      src/Main/Base/Project/Src/Bookmarks/BookmarkConverter.cs
  4. 14
      src/Main/Base/Project/Src/Editor/AvalonEdit/PinLayer.cs
  5. 4
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerPopup.cs
  6. 132
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml
  7. 63
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml.cs
  8. 2
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/ITreeNode.cs
  9. 131
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinControlsDictionary.xaml
  10. 206
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinDebuggerControl.xaml
  11. 76
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinDebuggerControl.xaml.cs
  12. 4
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinningBinding.cs
  13. 5
      src/Main/Base/Project/Src/Services/Debugger/TreeNode.cs
  14. BIN
      src/Main/StartUp/Project/Resources/BitmapResources.resources

BIN
data/resources/image/BitmapResources/BitmapResources-data/Icons.16x16.Refresh.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 858 B

53
src/AddIns/Debugger/Debugger.AddIn/TreeModel/ExpressionNode.cs

@ -7,8 +7,8 @@ using System.ComponentModel; @@ -7,8 +7,8 @@ using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using Debugger.AddIn.Visualizers;
using Debugger.MetaData;
using ICSharpCode.Core;
@ -74,6 +74,55 @@ namespace Debugger.AddIn.TreeModel @@ -74,6 +74,55 @@ namespace Debugger.AddIn.TreeModel
}
}
public override string FullName {
get {
if (!evaluated) EvaluateExpression();
if (expression is MemberReferenceExpression) {
var memberExpression = (MemberReferenceExpression)expression;
Expression currentExpression = memberExpression;
Stack<string> stack = new Stack<string>();
while (currentExpression is MemberReferenceExpression)
{
var exp = (MemberReferenceExpression)currentExpression;
stack.Push(exp.MemberName);
stack.Push(".");
currentExpression = exp.TargetObject;
}
if (currentExpression is CastExpression) {
var castExpression = (CastExpression)currentExpression;
currentExpression = castExpression.Expression;
if (currentExpression is IdentifierExpression) {
var identifierExpression = (IdentifierExpression)castExpression.Expression;
stack.Push(identifierExpression.Identifier);
}
while (currentExpression is MemberReferenceExpression)
{
var exp = (MemberReferenceExpression)currentExpression;
stack.Push(exp.MemberName);
stack.Push(".");
currentExpression = exp.TargetObject;
}
}
// create fullname
StringBuilder sb = new StringBuilder();
while(stack.Count > 0)
sb.Append(stack.Pop());
return sb.ToString();
}
return Name.Trim();
}
}
public override string Type {
get {
if (!evaluated) EvaluateExpression();
@ -284,6 +333,8 @@ namespace Debugger.AddIn.TreeModel @@ -284,6 +333,8 @@ namespace Debugger.AddIn.TreeModel
public override bool SetText(string newText)
{
string fullName = FullName;
Value val = null;
try {
val = this.Expression.Evaluate(WindowsDebugger.DebuggedProcess);

6
src/Main/Base/Project/Src/Bookmarks/BookmarkConverter.cs

@ -124,13 +124,13 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -124,13 +124,13 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
b.Append(pin.PopupPosition.X);
b.Append('|');
b.Append(pin.PopupPosition.Y);
b.Append('|');
//popup nodes
foreach(var node in pin.Nodes) {
b.Append('|');
b.Append(""); // image
b.Append('|');
b.Append(node.Name);
b.Append(node.FullName);
b.Append('|');
b.Append(node.Text);
}

14
src/Main/Base/Project/Src/Editor/AvalonEdit/PinLayer.cs

@ -111,13 +111,6 @@ namespace Editor.AvalonEdit @@ -111,13 +111,6 @@ namespace Editor.AvalonEdit
Canvas.SetLeft(currnetThumb, left);
Canvas.SetTop(currnetThumb, top);
var pinControl = TryFindChild<PinDebuggerControl>(currnetThumb);
if (pinControl != null) {
pinControl.Location = new Point { X = left, Y = top };
pinControl.Mark.PopupPosition = pinControl.Location;
pinControl.Opacity = 1d;
}
}
void currentThumb_DragCompleted(object sender, DragCompletedEventArgs e)
@ -126,8 +119,13 @@ namespace Editor.AvalonEdit @@ -126,8 +119,13 @@ namespace Editor.AvalonEdit
currnetThumb.Cursor = Cursors.Arrow;
var pinControl = TryFindChild<PinDebuggerControl>(currnetThumb);
if (pinControl != null)
if (pinControl != null) {
double left = Canvas.GetLeft(currnetThumb);
double top = Canvas.GetTop(currnetThumb);
pinControl.Opacity = 1d;
pinControl.Location = new Point { X = left, Y = top };
pinControl.Mark.PopupPosition = pinControl.Location;
}
}
void currentThumb_DragStarted(object sender, DragStartedEventArgs e)

4
src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerPopup.cs

@ -19,9 +19,9 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -19,9 +19,9 @@ namespace ICSharpCode.SharpDevelop.Debugging
{
internal DebuggerTooltipControl contentControl;
public DebuggerPopup(DebuggerTooltipControl parentControl)
public DebuggerPopup(DebuggerTooltipControl parentControl, bool showPins = true)
{
this.contentControl = new DebuggerTooltipControl(parentControl);
this.contentControl = new DebuggerTooltipControl(parentControl, showPins);
this.contentControl.containingPopup = this;
this.Child = this.contentControl;
this.IsLeaf = false;

132
src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml

@ -10,137 +10,6 @@ @@ -10,137 +10,6 @@
<ResourceDictionary
Source="PinControlsDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- TODO move styles to ResourceDictionary -->
<Style
x:Key="ExpandCollapseToggleStyle"
TargetType="{x:Type ToggleButton}">
<Setter
Property="Focusable"
Value="False" />
<Setter
Property="Width"
Value="19" />
<Setter
Property="Height"
Value="13" />
<Setter
Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type ToggleButton}">
<Border
Width="19"
Height="13"
Background="Transparent">
<Border
Width="9"
Height="9"
BorderThickness="1"
BorderBrush="#FF7898B5"
CornerRadius="1"
SnapsToDevicePixels="true">
<Border.Background>
<LinearGradientBrush
StartPoint="0,0"
EndPoint="1,1">
<LinearGradientBrush.GradientStops>
<GradientStop
Color="White"
Offset=".2" />
<GradientStop
Color="#FFC0B7A6"
Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<Path
x:Name="ExpandPath"
Margin="1,1,1,1"
Fill="Black"
Data="M 0 2 L 0 3 L 2 3 L 2 5 L 3 5 L 3 3 L 5 3 L 5 2 L 3 2 L 3 0 L 2 0 L 2 2 Z" />
</Border>
</Border>
<ControlTemplate.Triggers>
<Trigger
Property="IsChecked"
Value="True">
<Setter
Property="Data"
TargetName="ExpandPath"
Value="M 0 2 L 0 3 L 5 3 L 5 2 Z" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="upDownBorderStyle"
TargetType="{x:Type Border}">
<Setter
Property="BorderBrush"
Value="Gray" />
<Setter
Property="HorizontalAlignment"
Value="Stretch" />
<Setter
Property="Margin"
Value="0" />
<Setter
Property="Padding"
Value="0" />
<Setter
Property="Background"
Value="#FFECF7FC" />
<Setter
Property="Height"
Value="14" />
<Style.Triggers>
<DataTrigger
Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled}"
Value="False">
<Setter
Property="Background"
Value="#FFE0E0E0"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
<Style
x:Key="upButtonStyle"
TargetType="{x:Type RepeatButton}">
<Setter
Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type RepeatButton}">
<Border
Style="{StaticResource upDownBorderStyle}"
BorderThickness="1 1 1 0">
<ContentPresenter
HorizontalAlignment="Center"></ContentPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="downButtonStyle"
TargetType="{x:Type RepeatButton}">
<Setter
Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type RepeatButton}">
<Border
Style="{StaticResource upDownBorderStyle}"
BorderThickness="1 0 1 1">
<ContentPresenter
HorizontalAlignment="Center"></ContentPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel
@ -314,7 +183,6 @@ @@ -314,7 +183,6 @@
Style="{StaticResource TextStyle}"
IsEnabled="{Binding CanSetText}"
KeyUp="TextBox_KeyUp"
LostFocus="TextBox_LostFocus"
Margin="4 0"
Text="{Binding Path=Text}" />
</DataTemplate>

63
src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml.cs

@ -29,20 +29,26 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -29,20 +29,26 @@ namespace ICSharpCode.SharpDevelop.Debugging
/// </summary>
public partial class DebuggerTooltipControl : UserControl, ITooltip
{
private readonly double ChildPopupOpenXOffet = 16;
private readonly double ChildPopupOpenYOffet = 15;
private readonly int InitialItemsCount = 12;
private readonly int VisibleItemsCount = 11;
private const double ChildPopupOpenXOffet = 16;
private const double ChildPopupOpenYOffet = 15;
private const int InitialItemsCount = 12;
private const int VisibleItemsCount = 11;
private bool showPins = true;
private LazyItemsControl<ITreeNode> lazyGrid;
private IEnumerable<ITreeNode> itemsSource;
public DebuggerTooltipControl()
{
InitializeComponent();
Loaded += new RoutedEventHandler(OnLoaded);
}
public DebuggerTooltipControl(ITreeNode node)
: this(new ITreeNode[] { node })
{
Loaded += new RoutedEventHandler(OnLoaded);
}
public DebuggerTooltipControl(IEnumerable<ITreeNode> nodes)
@ -51,31 +57,36 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -51,31 +57,36 @@ namespace ICSharpCode.SharpDevelop.Debugging
this.itemsSource = nodes;
}
public DebuggerTooltipControl(DebuggerTooltipControl parentControl)
public DebuggerTooltipControl(DebuggerTooltipControl parentControl, bool showPins = true)
: this()
{
this.parentControl = parentControl;
this.showPins = showPins;
}
private void OnLoaded(object sender, RoutedEventArgs e)
{
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;
var editor = provider.TextEditor;
if (editor == null) return;
// verify if at the line of the root there's a pin bookmark
var pin = BookmarkManager.Bookmarks.Find(
b => b is PinBookmark &&
b.Location.Line == LogicalPosition.Line &&
b.FileName == editor.FileName) as PinBookmark;
if (pin != null) {
foreach (var node in this.itemsSource) {
if (pin.ContainsNode(node))
node.IsChecked = true;
if (showPins) {
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;
var editor = provider.TextEditor;
if (editor == null) return;
// verify if at the line of the root there's a pin bookmark
var pin = BookmarkManager.Bookmarks.Find(
b => b is PinBookmark &&
b.Location.Line == LogicalPosition.Line &&
b.FileName == editor.FileName) as PinBookmark;
if (pin != null) {
foreach (var node in this.itemsSource) {
if (pin.ContainsNode(node))
node.IsChecked = true;
}
}
}
else {
dataGrid.Columns[5].Visibility = Visibility.Collapsed;
}
SetItemsSource(this.itemsSource);
}
@ -86,10 +97,6 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -86,10 +97,6 @@ namespace ICSharpCode.SharpDevelop.Debugging
this.Closed(this, new RoutedEventArgs());
}
}
private LazyItemsControl<ITreeNode> lazyGrid;
IEnumerable<ITreeNode> itemsSource;
public IEnumerable<ITreeNode> ItemsSource {
get { return this.itemsSource; }
@ -131,8 +138,8 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -131,8 +138,8 @@ namespace ICSharpCode.SharpDevelop.Debugging
}
}
DebuggerPopup childPopup { get; set; }
DebuggerTooltipControl parentControl { get; set; }
private DebuggerPopup childPopup { get; set; }
private DebuggerTooltipControl parentControl { get; set; }
internal DebuggerPopup containingPopup { get; set; }
bool isChildExpanded

2
src/Main/Base/Project/Src/Services/Debugger/Tooltips/ITreeNode.cs

@ -14,6 +14,8 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -14,6 +14,8 @@ namespace ICSharpCode.SharpDevelop.Debugging
{
string Name { get; }
string FullName { get; }
string Text { get; }
bool CanSetText { get; }

131
src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinControlsDictionary.xaml

@ -193,4 +193,135 @@ @@ -193,4 +193,135 @@
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="ExpandCollapseToggleStyle"
TargetType="{x:Type ToggleButton}">
<Setter
Property="Focusable"
Value="False" />
<Setter
Property="Width"
Value="19" />
<Setter
Property="Height"
Value="13" />
<Setter
Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type ToggleButton}">
<Border
Width="19"
Height="13"
Background="Transparent">
<Border
Width="9"
Height="9"
BorderThickness="1"
BorderBrush="#FF7898B5"
CornerRadius="1"
SnapsToDevicePixels="true">
<Border.Background>
<LinearGradientBrush
StartPoint="0,0"
EndPoint="1,1">
<LinearGradientBrush.GradientStops>
<GradientStop
Color="White"
Offset=".2" />
<GradientStop
Color="#FFC0B7A6"
Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<Path
x:Name="ExpandPath"
Margin="1,1,1,1"
Fill="Black"
Data="M 0 2 L 0 3 L 2 3 L 2 5 L 3 5 L 3 3 L 5 3 L 5 2 L 3 2 L 3 0 L 2 0 L 2 2 Z" />
</Border>
</Border>
<ControlTemplate.Triggers>
<Trigger
Property="IsChecked"
Value="True">
<Setter
Property="Data"
TargetName="ExpandPath"
Value="M 0 2 L 0 3 L 5 3 L 5 2 Z" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="upDownBorderStyle"
TargetType="{x:Type Border}">
<Setter
Property="BorderBrush"
Value="Gray" />
<Setter
Property="HorizontalAlignment"
Value="Stretch" />
<Setter
Property="Margin"
Value="0" />
<Setter
Property="Padding"
Value="0" />
<Setter
Property="Background"
Value="#FFECF7FC" />
<Setter
Property="Height"
Value="14" />
<Style.Triggers>
<DataTrigger
Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled}"
Value="False">
<Setter
Property="Background"
Value="#FFE0E0E0"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
<Style
x:Key="upButtonStyle"
TargetType="{x:Type RepeatButton}">
<Setter
Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type RepeatButton}">
<Border
Style="{StaticResource upDownBorderStyle}"
BorderThickness="1 1 1 0">
<ContentPresenter
HorizontalAlignment="Center"></ContentPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="downButtonStyle"
TargetType="{x:Type RepeatButton}">
<Setter
Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type RepeatButton}">
<Border
Style="{StaticResource upDownBorderStyle}"
BorderThickness="1 0 1 1">
<ContentPresenter
HorizontalAlignment="Center"></ContentPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

206
src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinDebuggerControl.xaml

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="clr-namespace:Services.Debugger.Tooltips"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
>
<UserControl.Resources>
<ResourceDictionary>
@ -14,6 +14,22 @@ @@ -14,6 +14,22 @@
</UserControl.Resources>
<Grid>
<Grid.Resources>
<LinearGradientBrush x:Key="DataGridBackground"
StartPoint="0,-0.03"
EndPoint="0,1">
<GradientStop
Color="White" />
<GradientStop
Color="#FFFAFCFE"
Offset="0.983" />
<GradientStop
Color="#FFECF7FC"
Offset="0.07" />
<GradientStop
Color="#FFEEF7FA"
Offset="0.436" />
</LinearGradientBrush>
<Style x:Key="CellStyle"
TargetType="{x:Type DataGridCell}">
<Setter
@ -43,26 +59,14 @@ @@ -43,26 +59,14 @@
<Setter
Property="Background"
Value="Transparent"></Setter>
<Style.Triggers>
<Trigger
Property="IsMouseOver"
Value="True">
<Setter
Property="Background"
Value="#FFE2F6FE" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="DataGridStyle" TargetType="DataGrid">
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="VerticalScrollBarVisibility" Value="Disabled"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="GridLinesVisibility" Value="None"/>
<Setter Property="RowHeight" Value="18"/>
<Setter Property="MaxHeight" Value="202"/>
<Setter Property="MinWidth" Value="100"/>
<Setter Property="MinHeight" Value="20" />
<Setter Property="SelectionMode" Value="Single"/>
<Setter Property="SelectionUnit" Value="FullRow"/>
@ -70,14 +74,10 @@ @@ -70,14 +74,10 @@
<Setter Property="CanUserAddRows" Value="False"/>
<Setter Property="HeadersVisibility" Value="None"/>
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Background" Value="{StaticResource DataGridBackground}"/>
<Setter Property="CellStyle" Value="{StaticResource CellStyle}"/>
<Setter Property="RowStyle" Value="{StaticResource RowStyle}"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="#FFE2F6FE"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
@ -89,55 +89,125 @@ @@ -89,55 +89,125 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel>
<DataGrid
Style="{StaticResource DataGridStyle}"
ItemsSource="{Binding}"
Name="dataGrid"
>
<DataGrid.Columns>
<!-- Icon -->
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image
Source="{Binding ImageSource}"></Image>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn
MinWidth="20"
Header="Name">
<!-- Name -->
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border
BorderBrush="#FFDDDDDD"
BorderThickness="0 0 1 0">
<TextBlock
Margin="6 0"
Text="{Binding Path=Name, Mode=OneWay}"
VerticalAlignment="Top"></TextBlock>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn
MinWidth="20"
Header="Text">
<!-- Text (value) -->
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox
Style="{StaticResource TextStyle}"
IsEnabled="false"
Margin="4 0"
Text="{Binding Path=Text}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<DataGrid
Width="21"
BorderThickness="1,1,0,1"
Background="White"
x:Name="ExpandersGrid"
Style="{StaticResource DataGridStyle}"
ItemsSource="{Binding}">
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid
Background="White">
<StackPanel
VerticalAlignment="Center">
<ToggleButton
x:Name="btnExpander"
Style="{StaticResource ExpandCollapseToggleStyle}"
Click="btnExpander_Click"
Padding="0"
Margin="0" />
</StackPanel>
</Grid>
<DataTemplate.Triggers>
<DataTrigger
Binding="{Binding Path=HasChildNodes}"
Value="False">
<Setter
TargetName="btnExpander"
Property="Visibility"
Value="Collapsed" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<DataGrid
BorderThickness="0,1,0,1"
Grid.Column="1"
IsEnabled="False"
Style="{StaticResource DataGridStyle}"
ItemsSource="{Binding}"
Name="dataGrid">
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image
Source="{Binding ImageSource}"></Image>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn
MinWidth="20"
Header="Name">
<!-- Name -->
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border IsEnabled="False"
BorderBrush="#FFDDDDDD"
BorderThickness="0 0 1 0">
<TextBlock
FontFamily="Arial"
Margin="6 0"
Text="{Binding Path=FullName, Mode=OneWay}"
VerticalAlignment="Top"></TextBlock>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn IsReadOnly="True"
MinWidth="20"
Header="Text">
<!-- Text (value) -->
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox
Style="{StaticResource TextStyle}"
IsEnabled="false"
Margin="4 0"
Text="{Binding Path=Text}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<DataGrid
MaxWidth="20"
BorderThickness="1"
Grid.Column="2"
x:Name="ImagesGrid"
Style="{StaticResource DataGridStyle}"
ItemsSource="{Binding}">
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Width="12" Height="12"
VerticalAlignment="Center"
x:Name="RefreshContentImage"
MouseDown="RefreshContentImage_MouseDown"
Tag="{Binding}"
Source="{core:GetBitmap Icons.16x16.Refresh}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
<!-- comment textbox -->
<Border
Name="BorderComment"
@ -154,7 +224,6 @@ @@ -154,7 +224,6 @@
</StackPanel>
<local:PinCloseControl
VerticalAlignment="Center"
Background="Transparent"
Grid.Column="1"
@ -168,6 +237,5 @@ @@ -168,6 +237,5 @@
Opacity="0.5"/>
</local:PinCloseControl.Effect>
</local:PinCloseControl>
</Grid>
</UserControl>

76
src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinDebuggerControl.xaml.cs

@ -7,9 +7,11 @@ using System.Security.Cryptography; @@ -7,9 +7,11 @@ using System.Security.Cryptography;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media.Animation;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Editor;
@ -19,9 +21,13 @@ namespace Services.Debugger.Tooltips @@ -19,9 +21,13 @@ namespace Services.Debugger.Tooltips
{
public partial class PinDebuggerControl : UserControl
{
private const double ChildPopupOpenXOffet = 16;
private const double ChildPopupOpenYOffet = 15;
private const int InitialItemsCount = 12;
private const double MINIMUM_OPACITY = .3d;
private DebuggerPopup childPopup;
public PinDebuggerControl()
{
InitializeComponent();
@ -40,17 +46,25 @@ namespace Services.Debugger.Tooltips @@ -40,17 +46,25 @@ namespace Services.Debugger.Tooltips
public PinBookmark Mark { get; set; }
private LazyItemsControl<ITreeNode> lazyExpandersGrid;
private LazyItemsControl<ITreeNode> lazyGrid;
private LazyItemsControl<ITreeNode> lazyImagesGrid;
private IEnumerable<ITreeNode> itemsSource;
public IEnumerable<ITreeNode> ItemsSource
{
get { return this.itemsSource; }
set
{
this.itemsSource = value;
this.lazyGrid = new LazyItemsControl<ITreeNode>(this.dataGrid, InitialItemsCount);
lazyGrid.ItemsSource = new VirtualizingIEnumerable<ITreeNode>(value);
itemsSource = value;
var items = new VirtualizingIEnumerable<ITreeNode>(value);
lazyExpandersGrid = new LazyItemsControl<ITreeNode>(this.ExpandersGrid, InitialItemsCount);
lazyExpandersGrid.ItemsSource = items;
lazyGrid = new LazyItemsControl<ITreeNode>(this.dataGrid, InitialItemsCount);
lazyGrid.ItemsSource = items;
lazyImagesGrid = new LazyItemsControl<ITreeNode>(this.ImagesGrid, InitialItemsCount);
lazyImagesGrid.ItemsSource = items;
}
}
@ -68,6 +82,49 @@ namespace Services.Debugger.Tooltips @@ -68,6 +82,49 @@ namespace Services.Debugger.Tooltips
Unpin();
}
private ToggleButton expandedButton;
/// <summary>
/// Closes the child popup of this control, if it exists.
/// </summary>
void CloseChildPopups()
{
if (this.expandedButton != null) {
this.expandedButton.IsChecked = false;
this.expandedButton = null;
// nice simple example of indirect recursion
this.childPopup.CloseSelfAndChildren();
}
}
void btnExpander_Click(object sender, RoutedEventArgs e)
{
var clickedButton = (ToggleButton)e.OriginalSource;
var clickedNode = (ITreeNode)clickedButton.DataContext;
// use device independent units, because child popup Left/Top are in independent units
Point buttonPos = clickedButton.PointToScreen(new Point(0, 0)).TransformFromDevice(clickedButton);
if (clickedButton.IsChecked.GetValueOrDefault(false)) {
CloseChildPopups();
this.expandedButton = clickedButton;
// open child Popup
if (this.childPopup == null) {
this.childPopup = new DebuggerPopup(null, false);
this.childPopup.PlacementTarget = this;
this.childPopup.Placement = PlacementMode.Absolute;
}
this.childPopup.IsLeaf = true;
this.childPopup.HorizontalOffset = buttonPos.X + ChildPopupOpenXOffet;
this.childPopup.VerticalOffset = buttonPos.Y + ChildPopupOpenYOffet;
this.childPopup.ItemsSource = clickedNode.ChildNodes;
this.childPopup.Open();
} else {
CloseChildPopups();
}
}
void PinCloseControl_Closed(object sender, EventArgs e)
{
BookmarkManager.RemoveMark(Mark);
@ -170,5 +227,16 @@ namespace Services.Debugger.Tooltips @@ -170,5 +227,16 @@ namespace Services.Debugger.Tooltips
Cursor = Cursors.IBeam;
base.OnMouseLeave(e);
}
void RefreshContentImage_MouseDown(object sender, MouseButtonEventArgs e)
{
// refresh content
ITreeNode node = ((Image)sender).DataContext as ITreeNode;
if (!DebuggerService.IsDebuggerLoaded)
return;
}
}
}

4
src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinningBinding.cs

@ -66,7 +66,7 @@ namespace Services.Debugger.Tooltips @@ -66,7 +66,7 @@ namespace Services.Debugger.Tooltips
node.IconImage =
new ResourceServiceImage(
!string.IsNullOrEmpty(tuple.Item1) ? tuple.Item1 : "Icons.16x16.Field");
node.Name = tuple.Item2;
node.FullName = tuple.Item2;
node.Text = tuple.Item3;
nodes.Add(node);
}
@ -98,7 +98,7 @@ namespace Services.Debugger.Tooltips @@ -98,7 +98,7 @@ namespace Services.Debugger.Tooltips
pin.SavedNodes.Add(
new Tuple<string, string, string>(
"Icons.16x16.Field",
node.Name,
node.FullName,
node.Text));
}

5
src/Main/Base/Project/Src/Services/Debugger/TreeNode.cs

@ -56,6 +56,11 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -56,6 +56,11 @@ namespace ICSharpCode.SharpDevelop.Debugging
set { name = value; }
}
public virtual string FullName {
get { return name; }
set { name = value; }
}
public virtual string Text
{
get { return text; }

BIN
src/Main/StartUp/Project/Resources/BitmapResources.resources

Binary file not shown.
Loading…
Cancel
Save