29 changed files with 1125 additions and 535 deletions
@ -0,0 +1,75 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Media; |
||||||
|
|
||||||
|
using ICSharpCode.AvalonEdit.Rendering; |
||||||
|
|
||||||
|
namespace ICSharpCode.AvalonEdit.Editing |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Pin layer class. This class handles the pinning and unpinning operations.
|
||||||
|
/// </summary>
|
||||||
|
public class PinLayer : Layer, IWeakEventListener |
||||||
|
{ |
||||||
|
private Canvas pinningSurface; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PinLayer constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textArea">Text area for this layer.</param>
|
||||||
|
public PinLayer(TextArea textArea) : base(textArea.TextView, KnownLayer.Pins) |
||||||
|
{ |
||||||
|
pinningSurface = new Canvas(); |
||||||
|
pinningSurface.Background = Brushes.Red; |
||||||
|
|
||||||
|
pinningSurface.HorizontalAlignment = HorizontalAlignment.Stretch; |
||||||
|
pinningSurface.VerticalAlignment = VerticalAlignment.Stretch; |
||||||
|
|
||||||
|
TextViewWeakEventManager.VisualLinesChanged.AddListener(textArea.TextView, this); |
||||||
|
} |
||||||
|
|
||||||
|
bool IWeakEventListener.ReceiveWeakEvent(Type managerType, object sender, EventArgs e) |
||||||
|
{ |
||||||
|
if (managerType == typeof(TextViewWeakEventManager.VisualLinesChanged)) |
||||||
|
{ |
||||||
|
pinningSurface.InvalidateVisual(); |
||||||
|
InvalidateVisual(); |
||||||
|
return true; |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pins an element;
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="element">Element to pin.</param>
|
||||||
|
public void Pin(Popup element) |
||||||
|
{ |
||||||
|
if (element == null) |
||||||
|
throw new NullReferenceException("Element is null!"); |
||||||
|
|
||||||
|
element.Placement = PlacementMode.Absolute; |
||||||
|
|
||||||
|
pinningSurface.SetValue(Canvas.TopProperty, element.VerticalOffset); |
||||||
|
pinningSurface.SetValue(Canvas.LeftProperty, element.HorizontalOffset); |
||||||
|
pinningSurface.Children.Add(element); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unpins an element.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="element">Element to unpin.</param>
|
||||||
|
public void Unpin(Popup element) |
||||||
|
{ |
||||||
|
if (element == null) |
||||||
|
throw new NullReferenceException("Element is null!"); |
||||||
|
|
||||||
|
pinningSurface.Children.Remove(element); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,272 +1,426 @@ |
|||||||
<UserControl x:Class="ICSharpCode.SharpDevelop.Debugging.DebuggerTooltipControl" |
<?xml version="1.0" encoding="utf-8"?> |
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
<UserControl |
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
x:Class="ICSharpCode.SharpDevelop.Debugging.DebuggerTooltipControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:debugging="clr-namespace:ICSharpCode.SharpDevelop.Debugging" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:localControls="clr-namespace:Services.Debugger.Tooltips" |
||||||
xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" |
Background="Transparent"> |
||||||
xmlns:debugging="clr-namespace:ICSharpCode.SharpDevelop.Debugging" |
<UserControl.Resources> |
||||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
<ResourceDictionary> |
||||||
xmlns:localControls="clr-namespace:Services.Debugger.Tooltips" |
<ResourceDictionary.MergedDictionaries> |
||||||
Background="Transparent" |
<ResourceDictionary |
||||||
> |
Source="VisualizerPicker.xaml" /> |
||||||
<UserControl.Resources> |
<ResourceDictionary |
||||||
<ResourceDictionary> |
Source="PinControlsDictionary.xaml" /> |
||||||
<ResourceDictionary.MergedDictionaries> |
</ResourceDictionary.MergedDictionaries> |
||||||
<ResourceDictionary Source="VisualizerPicker.xaml" /> |
<!-- TODO move styles to ResourceDictionary --> |
||||||
<ResourceDictionary Source="PinControlsDictionary.xaml"/> |
<Style |
||||||
</ResourceDictionary.MergedDictionaries> |
x:Key="ExpandCollapseToggleStyle" |
||||||
|
TargetType="{x:Type ToggleButton}"> |
||||||
<!-- TODO move styles to ResourceDictionary --> |
<Setter |
||||||
<Style x:Key="ExpandCollapseToggleStyle" |
Property="Focusable" |
||||||
TargetType="{x:Type ToggleButton}"> |
Value="False" /> |
||||||
<Setter Property="Focusable" |
<Setter |
||||||
Value="False"/> |
Property="Width" |
||||||
<Setter Property="Width" |
Value="19" /> |
||||||
Value="19"/> |
<Setter |
||||||
<Setter Property="Height" |
Property="Height" |
||||||
Value="13"/> |
Value="13" /> |
||||||
<Setter Property="Template"> |
<Setter |
||||||
<Setter.Value> |
Property="Template"> |
||||||
<ControlTemplate TargetType="{x:Type ToggleButton}"> |
<Setter.Value> |
||||||
<Border Width="19" |
<ControlTemplate |
||||||
Height="13" |
TargetType="{x:Type ToggleButton}"> |
||||||
Background="Transparent"> |
<Border |
||||||
<Border Width="9" |
Width="19" |
||||||
Height="9" |
Height="13" |
||||||
BorderThickness="1" |
Background="Transparent"> |
||||||
BorderBrush="#FF7898B5" |
<Border |
||||||
CornerRadius="1" |
Width="9" |
||||||
SnapsToDevicePixels="true"> |
Height="9" |
||||||
<Border.Background> |
BorderThickness="1" |
||||||
<LinearGradientBrush StartPoint="0,0" |
BorderBrush="#FF7898B5" |
||||||
EndPoint="1,1"> |
CornerRadius="1" |
||||||
<LinearGradientBrush.GradientStops> |
SnapsToDevicePixels="true"> |
||||||
<GradientStop Color="White" |
<Border.Background> |
||||||
Offset=".2"/> |
<LinearGradientBrush |
||||||
<GradientStop Color="#FFC0B7A6" |
StartPoint="0,0" |
||||||
Offset="1"/> |
EndPoint="1,1"> |
||||||
</LinearGradientBrush.GradientStops> |
<LinearGradientBrush.GradientStops> |
||||||
</LinearGradientBrush> |
<GradientStop |
||||||
</Border.Background> |
Color="White" |
||||||
<Path x:Name="ExpandPath" |
Offset=".2" /> |
||||||
Margin="1,1,1,1" |
<GradientStop |
||||||
Fill="Black" |
Color="#FFC0B7A6" |
||||||
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"/> |
Offset="1" /> |
||||||
</Border> |
</LinearGradientBrush.GradientStops> |
||||||
</Border> |
</LinearGradientBrush> |
||||||
<ControlTemplate.Triggers> |
</Border.Background> |
||||||
<Trigger Property="IsChecked" |
<Path |
||||||
Value="True"> |
x:Name="ExpandPath" |
||||||
<Setter Property="Data" |
Margin="1,1,1,1" |
||||||
TargetName="ExpandPath" |
Fill="Black" |
||||||
Value="M 0 2 L 0 3 L 5 3 L 5 2 Z"/> |
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" /> |
||||||
</Trigger> |
</Border> |
||||||
</ControlTemplate.Triggers> |
</Border> |
||||||
</ControlTemplate> |
<ControlTemplate.Triggers> |
||||||
</Setter.Value> |
<Trigger |
||||||
</Setter> |
Property="IsChecked" |
||||||
</Style> |
Value="True"> |
||||||
<Style x:Key="upDownBorderStyle" TargetType="{x:Type Border}"> |
<Setter |
||||||
<Setter Property="BorderBrush" Value="Gray" /> |
Property="Data" |
||||||
<Setter Property="HorizontalAlignment" Value="Stretch" /> |
TargetName="ExpandPath" |
||||||
<Setter Property="Margin" Value="0" /> |
Value="M 0 2 L 0 3 L 5 3 L 5 2 Z" /> |
||||||
<Setter Property="Padding" Value="0" /> |
</Trigger> |
||||||
<Setter Property="Background" Value="#FFECF7FC" /> |
</ControlTemplate.Triggers> |
||||||
<Setter Property="Height" Value="14" /> |
</ControlTemplate> |
||||||
<Style.Triggers> |
</Setter.Value> |
||||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled}" Value="False"> |
</Setter> |
||||||
<Setter Property="Background" Value="#FFE0E0E0"></Setter> |
</Style> |
||||||
</DataTrigger> |
<Style |
||||||
</Style.Triggers> |
x:Key="upDownBorderStyle" |
||||||
</Style> |
TargetType="{x:Type Border}"> |
||||||
<Style x:Key="upButtonStyle" TargetType="{x:Type RepeatButton}"> |
<Setter |
||||||
<Setter Property="Template"> |
Property="BorderBrush" |
||||||
<Setter.Value> |
Value="Gray" /> |
||||||
<ControlTemplate TargetType="{x:Type RepeatButton}"> |
<Setter |
||||||
<Border Style="{StaticResource upDownBorderStyle}" BorderThickness="1 1 1 0"> |
Property="HorizontalAlignment" |
||||||
<ContentPresenter HorizontalAlignment="Center"></ContentPresenter> |
Value="Stretch" /> |
||||||
</Border> |
<Setter |
||||||
</ControlTemplate> |
Property="Margin" |
||||||
</Setter.Value> |
Value="0" /> |
||||||
</Setter> |
<Setter |
||||||
</Style> |
Property="Padding" |
||||||
<Style x:Key="downButtonStyle" TargetType="{x:Type RepeatButton}"> |
Value="0" /> |
||||||
<Setter Property="Template"> |
<Setter |
||||||
<Setter.Value> |
Property="Background" |
||||||
<ControlTemplate TargetType="{x:Type RepeatButton}"> |
Value="#FFECF7FC" /> |
||||||
<Border Style="{StaticResource upDownBorderStyle}" BorderThickness="1 0 1 1"> |
<Setter |
||||||
<ContentPresenter HorizontalAlignment="Center"></ContentPresenter> |
Property="Height" |
||||||
</Border> |
Value="14" /> |
||||||
</ControlTemplate> |
<Style.Triggers> |
||||||
</Setter.Value> |
<DataTrigger |
||||||
</Setter> |
Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled}" |
||||||
</Style> |
Value="False"> |
||||||
<Style TargetType="{x:Type TextBox}" x:Key="TextStyle"> |
<Setter |
||||||
<Setter Property="OverridesDefaultStyle" Value="True"/> |
Property="Background" |
||||||
<Setter Property="VerticalAlignment" Value="Top"/> |
Value="#FFE0E0E0"></Setter> |
||||||
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/> |
</DataTrigger> |
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
</Style.Triggers> |
||||||
<Setter Property="Template"> |
</Style> |
||||||
<Setter.Value> |
<Style |
||||||
<ControlTemplate TargetType="{x:Type TextBoxBase}"> |
x:Key="upButtonStyle" |
||||||
<Border |
TargetType="{x:Type RepeatButton}"> |
||||||
Name="Border" |
<Setter |
||||||
Background="Transparent" |
Property="Template"> |
||||||
BorderBrush="Transparent" |
<Setter.Value> |
||||||
BorderThickness="0"> |
<ControlTemplate |
||||||
<ScrollViewer Margin="0" Name="PART_ContentHost" /> |
TargetType="{x:Type RepeatButton}"> |
||||||
</Border> |
<Border |
||||||
</ControlTemplate> |
Style="{StaticResource upDownBorderStyle}" |
||||||
</Setter.Value> |
BorderThickness="1 1 1 0"> |
||||||
</Setter> |
<ContentPresenter |
||||||
</Style> |
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> |
||||||
|
<Style |
||||||
|
TargetType="{x:Type TextBox}" |
||||||
|
x:Key="TextStyle"> |
||||||
|
<Setter |
||||||
|
Property="OverridesDefaultStyle" |
||||||
|
Value="True" /> |
||||||
|
<Setter |
||||||
|
Property="VerticalAlignment" |
||||||
|
Value="Top" /> |
||||||
|
<Setter |
||||||
|
Property="KeyboardNavigation.TabNavigation" |
||||||
|
Value="None" /> |
||||||
|
<Setter |
||||||
|
Property="FocusVisualStyle" |
||||||
|
Value="{x:Null}" /> |
||||||
|
<Setter |
||||||
|
Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate |
||||||
|
TargetType="{x:Type TextBoxBase}"> |
||||||
|
<Border |
||||||
|
Name="Border" |
||||||
|
Background="Transparent" |
||||||
|
BorderBrush="Transparent" |
||||||
|
BorderThickness="0"> |
||||||
|
<ScrollViewer |
||||||
|
Margin="0" |
||||||
|
Name="PART_ContentHost" /> |
||||||
|
</Border> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
</ResourceDictionary> |
</ResourceDictionary> |
||||||
</UserControl.Resources> |
</UserControl.Resources> |
||||||
<Grid Background="Transparent" Name="ParentGrid"> |
<Grid |
||||||
<Grid.ColumnDefinitions> |
Background="Transparent" |
||||||
<ColumnDefinition/> |
Name="ParentGrid"> |
||||||
<ColumnDefinition/> |
<Grid.ColumnDefinitions> |
||||||
</Grid.ColumnDefinitions> |
<ColumnDefinition /> |
||||||
<Grid.RowDefinitions> |
<ColumnDefinition /> |
||||||
<RowDefinition Height="Auto"/> |
</Grid.ColumnDefinitions> |
||||||
<RowDefinition Height="50"/> |
<Grid.RowDefinitions> |
||||||
</Grid.RowDefinitions> |
<RowDefinition |
||||||
<StackPanel Orientation="Vertical"> |
Height="Auto" /> |
||||||
<RepeatButton Name="btnUp" Focusable="False" Style="{StaticResource upButtonStyle}" Content="^" Click="BtnUp_Click"></RepeatButton> |
<RowDefinition |
||||||
<DataGrid VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Disabled" |
Height="50" /> |
||||||
GridLinesVisibility="None" |
</Grid.RowDefinitions> |
||||||
RowHeight="18" MaxHeight="202" |
<StackPanel |
||||||
SelectionMode="Single" |
Orientation="Vertical"> |
||||||
SelectionUnit="FullRow" |
<RepeatButton |
||||||
ItemsSource="{Binding}" |
Name="btnUp" |
||||||
Name="dataGrid" |
Focusable="False" |
||||||
AutoGenerateColumns="False" |
Style="{StaticResource upButtonStyle}" |
||||||
CanUserAddRows="False" HeadersVisibility="None" |
Content="^" |
||||||
BorderBrush="Gray" |
Click="BtnUp_Click"></RepeatButton> |
||||||
BorderThickness="1"> |
<DataGrid |
||||||
<DataGrid.Background> |
VerticalScrollBarVisibility="Disabled" |
||||||
|
HorizontalScrollBarVisibility="Disabled" |
||||||
<!-- Control backgound --> |
GridLinesVisibility="None" |
||||||
<LinearGradientBrush StartPoint="0,-0.03" EndPoint="0,1"> |
RowHeight="18" |
||||||
<GradientStop Color="White"/> |
MaxHeight="202" |
||||||
<GradientStop Color="#FFFAFCFE" Offset="0.983"/> |
SelectionMode="Single" |
||||||
<GradientStop Color="#FFECF7FC" Offset="0.07"/> |
SelectionUnit="FullRow" |
||||||
<GradientStop Color="#FFEEF7FA" Offset="0.436"/> |
ItemsSource="{Binding}" |
||||||
</LinearGradientBrush> |
Name="dataGrid" |
||||||
</DataGrid.Background> |
AutoGenerateColumns="False" |
||||||
<DataGrid.RowStyle> |
CanUserAddRows="False" |
||||||
<Style TargetType="{x:Type DataGridRow}"> |
HeadersVisibility="None" |
||||||
<Setter Property="Background" Value="Transparent"></Setter> |
BorderBrush="Gray" |
||||||
<Style.Triggers> |
BorderThickness="1"> |
||||||
<Trigger Property="IsMouseOver" Value="True"> |
<DataGrid.Background> |
||||||
<Setter Property="Background" Value="#FFE2F6FE" /> |
<!-- Control backgound --> |
||||||
</Trigger> |
<LinearGradientBrush |
||||||
</Style.Triggers> |
StartPoint="0,-0.03" |
||||||
</Style> |
EndPoint="0,1"> |
||||||
</DataGrid.RowStyle> |
<GradientStop |
||||||
<DataGrid.CellStyle> |
Color="White" /> |
||||||
<Style TargetType="{x:Type DataGridCell}"> |
<GradientStop |
||||||
<Setter Property="Focusable" Value="false" /> <!-- Focusable=true blocks shortcuts if cell is focused --> |
Color="#FFFAFCFE" |
||||||
<Setter Property="BorderThickness" Value="0" /> |
Offset="0.983" /> |
||||||
<Style.Triggers> |
<GradientStop |
||||||
<Trigger Property="IsSelected" Value="True"> <!-- disable selection highlight --> |
Color="#FFECF7FC" |
||||||
<Setter Property="Foreground" Value="Black" /> |
Offset="0.07" /> |
||||||
<Setter Property="Background" Value="{x:Null}" /> |
<GradientStop |
||||||
</Trigger> |
Color="#FFEEF7FA" |
||||||
</Style.Triggers> |
Offset="0.436" /> |
||||||
</Style> |
</LinearGradientBrush> |
||||||
</DataGrid.CellStyle> |
</DataGrid.Background> |
||||||
<DataGrid.Columns> |
<DataGrid.RowStyle> |
||||||
<DataGridTemplateColumn> <!-- "Plus" expander --> |
<Style |
||||||
<DataGridTemplateColumn.CellTemplate> |
TargetType="{x:Type DataGridRow}"> |
||||||
<DataTemplate> |
<Setter |
||||||
<Grid Background="White"> |
Property="Background" |
||||||
<StackPanel VerticalAlignment="Center"> |
Value="Transparent"></Setter> |
||||||
<ToggleButton x:Name="btnExpander" Style="{StaticResource ExpandCollapseToggleStyle}" Click="btnExpander_Click" Padding="0" Margin="0" /> |
<Style.Triggers> |
||||||
</StackPanel> |
<Trigger |
||||||
</Grid> |
Property="IsMouseOver" |
||||||
<DataTemplate.Triggers> |
Value="True"> |
||||||
<DataTrigger Binding="{Binding Path=HasChildNodes}" Value="False"> |
<Setter |
||||||
<Setter TargetName="btnExpander" |
Property="Background" |
||||||
Property="Visibility" Value="Collapsed"/> |
Value="#FFE2F6FE" /> |
||||||
</DataTrigger> |
</Trigger> |
||||||
</DataTemplate.Triggers> |
</Style.Triggers> |
||||||
</DataTemplate> |
</Style> |
||||||
</DataGridTemplateColumn.CellTemplate> |
</DataGrid.RowStyle> |
||||||
</DataGridTemplateColumn> |
<DataGrid.CellStyle> |
||||||
<!-- Icon --> |
<Style |
||||||
<DataGridTemplateColumn> |
TargetType="{x:Type DataGridCell}"> |
||||||
<DataGridTemplateColumn.CellTemplate> |
<Setter |
||||||
<DataTemplate> |
Property="Focusable" |
||||||
<Image Source="{Binding ImageSource}"></Image> |
Value="false" /> |
||||||
</DataTemplate> |
<!-- Focusable=true blocks shortcuts if cell is focused --> |
||||||
</DataGridTemplateColumn.CellTemplate> |
<Setter |
||||||
</DataGridTemplateColumn> |
Property="BorderThickness" |
||||||
<DataGridTemplateColumn MinWidth="20" Header="Name"> <!-- Name --> |
Value="0" /> |
||||||
<DataGridTemplateColumn.CellTemplate> |
<Style.Triggers> |
||||||
<DataTemplate> |
<Trigger |
||||||
<Border BorderBrush="#FFDDDDDD" BorderThickness="0 0 1 0"> |
Property="IsSelected" |
||||||
<TextBlock Margin="6 0" Text="{Binding Path=Name, Mode=OneWay}" VerticalAlignment="Top"></TextBlock> |
Value="True"> |
||||||
</Border> |
<!-- disable selection highlight --> |
||||||
</DataTemplate> |
<Setter |
||||||
</DataGridTemplateColumn.CellTemplate> |
Property="Foreground" |
||||||
</DataGridTemplateColumn> |
Value="Black" /> |
||||||
<!-- Visualizer picker --> |
<Setter |
||||||
<DataGridTemplateColumn> |
Property="Background" |
||||||
<DataGridTemplateColumn.CellTemplate> |
Value="{x:Null}" /> |
||||||
<DataTemplate> |
</Trigger> |
||||||
<debugging:VisualizerPicker Focusable="False" x:Name="visPicker" ItemsSource="{Binding Path=VisualizerCommands, Mode=OneWay}" Margin="4 0 0 0"></debugging:VisualizerPicker> |
</Style.Triggers> |
||||||
<DataTemplate.Triggers> |
</Style> |
||||||
<DataTrigger Binding="{Binding Path=HasVisualizerCommands}" Value="False"> |
</DataGrid.CellStyle> |
||||||
<Setter TargetName="visPicker" Property="Visibility" Value="Collapsed"/> |
<DataGrid.Columns> |
||||||
</DataTrigger> |
<DataGridTemplateColumn> |
||||||
</DataTemplate.Triggers> |
<!-- "Plus" expander --> |
||||||
</DataTemplate> |
<DataGridTemplateColumn.CellTemplate> |
||||||
</DataGridTemplateColumn.CellTemplate> |
<DataTemplate> |
||||||
</DataGridTemplateColumn> |
<Grid |
||||||
|
Background="White"> |
||||||
<DataGridTemplateColumn MinWidth="20" Header="Text"> <!-- Text (value) --> |
<StackPanel |
||||||
<DataGridTemplateColumn.CellTemplate> |
VerticalAlignment="Center"> |
||||||
<DataTemplate> |
<ToggleButton |
||||||
<TextBox |
x:Name="btnExpander" |
||||||
Style="{StaticResource TextStyle}" |
Style="{StaticResource ExpandCollapseToggleStyle}" |
||||||
IsEnabled="{Binding CanSetText}" |
Click="btnExpander_Click" |
||||||
KeyUp="TextBox_KeyUp" |
Padding="0" |
||||||
Margin="4 0" |
Margin="0" /> |
||||||
Text="{Binding Path=Text}"/> |
</StackPanel> |
||||||
</DataTemplate> |
</Grid> |
||||||
</DataGridTemplateColumn.CellTemplate> |
<DataTemplate.Triggers> |
||||||
</DataGridTemplateColumn> |
<DataTrigger |
||||||
|
Binding="{Binding Path=HasChildNodes}" |
||||||
<DataGridTemplateColumn> <!-- Pin --> |
Value="False"> |
||||||
|
<Setter |
||||||
<DataGridTemplateColumn.CellTemplate> |
TargetName="btnExpander" |
||||||
<DataTemplate> |
Property="Visibility" |
||||||
<ToggleButton |
Value="Collapsed" /> |
||||||
DataContext="{Binding}" |
</DataTrigger> |
||||||
Visibility="Collapsed" |
</DataTemplate.Triggers> |
||||||
Name="PinButton" |
</DataTemplate> |
||||||
VerticalAlignment="Center" |
</DataGridTemplateColumn.CellTemplate> |
||||||
Checked="PinButton_Checked" |
|
||||||
Unchecked="PinButton_Unchecked" |
|
||||||
Template="{StaticResource PinTooltipButtonTemplate}"/> |
|
||||||
<DataTemplate.Triggers> |
|
||||||
<DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGridRow}}" Value="True"> |
|
||||||
<Setter TargetName="PinButton" Property="Visibility" Value="Visible"/> |
|
||||||
</DataTrigger> |
|
||||||
</DataTemplate.Triggers> |
|
||||||
</DataTemplate> |
|
||||||
</DataGridTemplateColumn.CellTemplate> |
|
||||||
</DataGridTemplateColumn> |
</DataGridTemplateColumn> |
||||||
</DataGrid.Columns> |
<!-- Icon --> |
||||||
</DataGrid> |
<DataGridTemplateColumn> |
||||||
<RepeatButton Name="btnDown" Focusable="False" Style="{StaticResource downButtonStyle}" Content="v" Click="BtnDown_Click"></RepeatButton> |
<DataGridTemplateColumn.CellTemplate> |
||||||
|
<DataTemplate> |
||||||
<!-- commentTextbox --> |
<Image |
||||||
<Border Name="BorderComment" Background="White" BorderThickness="1,0,1,1" BorderBrush="Black" Height="0" MaxHeight="50"> |
Source="{Binding ImageSource}"></Image> |
||||||
<TextBox Name="CommentTextBox" Margin="3" Height="34" TextChanged="CommentTextBox_TextChanged"/> |
</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> |
||||||
|
<!-- Visualizer picker --> |
||||||
|
<DataGridTemplateColumn> |
||||||
|
<DataGridTemplateColumn.CellTemplate> |
||||||
|
<DataTemplate> |
||||||
|
<debugging:VisualizerPicker |
||||||
|
Focusable="False" |
||||||
|
x:Name="visPicker" |
||||||
|
ItemsSource="{Binding Path=VisualizerCommands, Mode=OneWay}" |
||||||
|
Margin="4 0 0 0"></debugging:VisualizerPicker> |
||||||
|
<DataTemplate.Triggers> |
||||||
|
<DataTrigger |
||||||
|
Binding="{Binding Path=HasVisualizerCommands}" |
||||||
|
Value="False"> |
||||||
|
<Setter |
||||||
|
TargetName="visPicker" |
||||||
|
Property="Visibility" |
||||||
|
Value="Collapsed" /> |
||||||
|
</DataTrigger> |
||||||
|
</DataTemplate.Triggers> |
||||||
|
</DataTemplate> |
||||||
|
</DataGridTemplateColumn.CellTemplate> |
||||||
|
</DataGridTemplateColumn> |
||||||
|
<DataGridTemplateColumn |
||||||
|
MinWidth="20" |
||||||
|
Header="Text"> |
||||||
|
<!-- Text (value) --> |
||||||
|
<DataGridTemplateColumn.CellTemplate> |
||||||
|
<DataTemplate> |
||||||
|
<TextBox |
||||||
|
Style="{StaticResource TextStyle}" |
||||||
|
IsEnabled="{Binding CanSetText}" |
||||||
|
KeyUp="TextBox_KeyUp" |
||||||
|
LostFocus="TextBox_LostFocus" |
||||||
|
Margin="4 0" |
||||||
|
Text="{Binding Path=Text}" /> |
||||||
|
</DataTemplate> |
||||||
|
</DataGridTemplateColumn.CellTemplate> |
||||||
|
</DataGridTemplateColumn> |
||||||
|
<DataGridTemplateColumn> |
||||||
|
<!-- Pin --> |
||||||
|
<DataGridTemplateColumn.CellTemplate> |
||||||
|
<DataTemplate> |
||||||
|
<ToggleButton |
||||||
|
IsChecked="{Binding IsChecked}" |
||||||
|
DataContext="{Binding}" |
||||||
|
Visibility="Collapsed" |
||||||
|
Name="PinButton" |
||||||
|
VerticalAlignment="Center" |
||||||
|
Checked="PinButton_Checked" |
||||||
|
Unchecked="PinButton_Unchecked" |
||||||
|
Template="{StaticResource PinTooltipButtonTemplate}" /> |
||||||
|
<DataTemplate.Triggers> |
||||||
|
<DataTrigger |
||||||
|
Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGridRow}}" |
||||||
|
Value="True"> |
||||||
|
<Setter |
||||||
|
TargetName="PinButton" |
||||||
|
Property="Visibility" |
||||||
|
Value="Visible" /> |
||||||
|
</DataTrigger> |
||||||
|
</DataTemplate.Triggers> |
||||||
|
</DataTemplate> |
||||||
|
</DataGridTemplateColumn.CellTemplate> |
||||||
|
</DataGridTemplateColumn> |
||||||
|
</DataGrid.Columns> |
||||||
|
</DataGrid> |
||||||
|
<RepeatButton |
||||||
|
Name="btnDown" |
||||||
|
Focusable="False" |
||||||
|
Style="{StaticResource downButtonStyle}" |
||||||
|
Content="v" |
||||||
|
Click="BtnDown_Click"></RepeatButton> |
||||||
|
<!-- commentTextbox --> |
||||||
|
<Border |
||||||
|
Name="BorderComment" |
||||||
|
Background="White" |
||||||
|
BorderThickness="1,0,1,1" |
||||||
|
BorderBrush="Black" |
||||||
|
Height="0" |
||||||
|
MaxHeight="50"> |
||||||
|
<TextBox |
||||||
|
Name="CommentTextBox" |
||||||
|
TextChanged="CommentTextBox_TextChanged" |
||||||
|
Margin="3"/> |
||||||
</Border> |
</Border> |
||||||
</StackPanel> |
</StackPanel> |
||||||
<Canvas MinWidth="25" Background="Transparent" Grid.Column="1" Name="PinControlCanvas" Visibility="Collapsed"> |
<Canvas |
||||||
|
MinWidth="25" |
||||||
|
Background="Transparent" |
||||||
|
Grid.Column="1" |
||||||
|
Name="PinControlCanvas" |
||||||
|
Visibility="Collapsed"> |
||||||
<!-- Pin close control --> |
<!-- Pin close control --> |
||||||
</Canvas> |
</Canvas> |
||||||
</Grid> |
</Grid> |
||||||
</UserControl> |
</UserControl> |
@ -0,0 +1,86 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.ObjectModel; |
||||||
|
using System.Windows; |
||||||
|
|
||||||
|
using ICSharpCode.AvalonEdit; |
||||||
|
using ICSharpCode.Core.Presentation; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Bookmarks; |
||||||
|
using ICSharpCode.SharpDevelop.Debugging; |
||||||
|
using ICSharpCode.SharpDevelop.Editor; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
|
||||||
|
namespace Services.Debugger.Tooltips |
||||||
|
{ |
||||||
|
public class PinningBinding : DefaultLanguageBinding |
||||||
|
{ |
||||||
|
ITextEditor _editor; |
||||||
|
|
||||||
|
public PinningBinding() |
||||||
|
{} |
||||||
|
|
||||||
|
public override void Attach(ITextEditor editor) |
||||||
|
{ |
||||||
|
if (editor == null) |
||||||
|
return; |
||||||
|
|
||||||
|
_editor = editor; |
||||||
|
|
||||||
|
// load pins
|
||||||
|
var pins = BookmarkManager.Bookmarks.FindAll( |
||||||
|
b => b is PinBookmark && b.FileName == _editor.FileName); |
||||||
|
|
||||||
|
foreach (var bookmark in pins) { |
||||||
|
var pin = (PinBookmark)bookmark; |
||||||
|
pin.Popup = new DebuggerPopup(null, true); |
||||||
|
pin.Popup.HorizontalOffset = pin.SavedPopupPosition.X; |
||||||
|
pin.Popup.VerticalOffset = pin.SavedPopupPosition.Y; |
||||||
|
pin.Popup.contentControl.pinCloseControl.Mark = pin; |
||||||
|
|
||||||
|
var nodes = new ObservableCollection<ITreeNode>(); |
||||||
|
|
||||||
|
foreach (var tuple in pin.SavedNodes) { |
||||||
|
var node = new TreeNode(); |
||||||
|
node.IconImage = |
||||||
|
new ResourceServiceImage( |
||||||
|
!string.IsNullOrEmpty(tuple.Item1) ? tuple.Item1 : "Icons.16x16.Field"); |
||||||
|
node.Name = tuple.Item2; |
||||||
|
node.Text = tuple.Item3; |
||||||
|
|
||||||
|
nodes.Add(node); |
||||||
|
} |
||||||
|
|
||||||
|
pin.SavedNodes.Clear(); |
||||||
|
|
||||||
|
pin.Popup.SetItemsSource(nodes); |
||||||
|
pin.Nodes = nodes; |
||||||
|
pin.Popup.Open(); |
||||||
|
} |
||||||
|
|
||||||
|
base.Attach(editor); |
||||||
|
} |
||||||
|
|
||||||
|
public override void Detach() |
||||||
|
{ |
||||||
|
// save pins
|
||||||
|
var pins = BookmarkManager.Bookmarks.FindAll( |
||||||
|
b => b is PinBookmark && b.FileName == _editor.FileName); |
||||||
|
|
||||||
|
foreach (var bookmark in pins) { |
||||||
|
var pin = (PinBookmark)bookmark; |
||||||
|
pin.SavedPopupPosition = new Point |
||||||
|
{ |
||||||
|
X = pin.Popup.HorizontalOffset, |
||||||
|
Y = pin.Popup.VerticalOffset |
||||||
|
}; |
||||||
|
|
||||||
|
pin.Popup.CloseSelfAndChildren(); |
||||||
|
} |
||||||
|
|
||||||
|
base.Detach(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,123 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Drawing; |
||||||
|
using System.Linq; |
||||||
|
using System.Windows.Media; |
||||||
|
|
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Debugging; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Debugging |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// A node in the variable tree.
|
||||||
|
/// The node is imutable.
|
||||||
|
/// </summary>
|
||||||
|
public class TreeNode: IComparable<TreeNode>, ITreeNode |
||||||
|
{ |
||||||
|
IImage iconImage = null; |
||||||
|
string name = string.Empty; |
||||||
|
string text = string.Empty; |
||||||
|
string type = string.Empty; |
||||||
|
IEnumerable<TreeNode> childNodes = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The image displayed for this node.
|
||||||
|
/// </summary>
|
||||||
|
public IImage IconImage { |
||||||
|
get { return iconImage; } |
||||||
|
set { iconImage = value; } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// System.Windows.Media.ImageSource version of <see cref="IconImage"/>.
|
||||||
|
/// </summary>
|
||||||
|
public ImageSource ImageSource { |
||||||
|
get { |
||||||
|
return iconImage == null ? null : iconImage.ImageSource; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// System.Drawing.Image version of <see cref="IconImage"/>.
|
||||||
|
/// </summary>
|
||||||
|
public Image Image { |
||||||
|
get { |
||||||
|
return iconImage == null ? null : iconImage.Bitmap; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string Name { |
||||||
|
get { return name; } |
||||||
|
set { name = value; } |
||||||
|
} |
||||||
|
|
||||||
|
public virtual string Text |
||||||
|
{ |
||||||
|
get { return text; } |
||||||
|
set { text = value; } |
||||||
|
} |
||||||
|
|
||||||
|
public virtual string Type { |
||||||
|
get { return type; } |
||||||
|
protected set { type = value; } |
||||||
|
} |
||||||
|
|
||||||
|
public virtual IEnumerable<TreeNode> ChildNodes { |
||||||
|
get { return childNodes; } |
||||||
|
protected set { childNodes = value; } |
||||||
|
} |
||||||
|
|
||||||
|
IEnumerable<ITreeNode> ITreeNode.ChildNodes { |
||||||
|
get { return childNodes; } |
||||||
|
} |
||||||
|
|
||||||
|
public virtual bool HasChildNodes { |
||||||
|
get { return childNodes != null; } |
||||||
|
} |
||||||
|
|
||||||
|
public virtual bool CanSetText { |
||||||
|
get { return false; } |
||||||
|
} |
||||||
|
|
||||||
|
public virtual IEnumerable<IVisualizerCommand> VisualizerCommands { |
||||||
|
get { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public virtual bool HasVisualizerCommands { |
||||||
|
get { |
||||||
|
return (VisualizerCommands != null) && (VisualizerCommands.Count() > 0); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsChecked { get; set; } |
||||||
|
|
||||||
|
public TreeNode() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public TreeNode(IImage iconImage, string name, string text, string type, IEnumerable<TreeNode> childNodes) |
||||||
|
{ |
||||||
|
this.iconImage = iconImage; |
||||||
|
this.name = name; |
||||||
|
this.text = text; |
||||||
|
this.type = type; |
||||||
|
this.childNodes = childNodes; |
||||||
|
} |
||||||
|
|
||||||
|
public int CompareTo(TreeNode other) |
||||||
|
{ |
||||||
|
return this.Name.CompareTo(other.Name); |
||||||
|
} |
||||||
|
|
||||||
|
public virtual bool SetText(string newValue) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue