29 changed files with 1125 additions and 535 deletions
@ -0,0 +1,75 @@
@@ -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 @@
@@ -1,272 +1,426 @@
|
||||
<UserControl 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" |
||||
Background="Transparent" |
||||
> |
||||
<UserControl.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="VisualizerPicker.xaml" /> |
||||
<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> |
||||
<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> |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<UserControl |
||||
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" |
||||
Background="Transparent"> |
||||
<UserControl.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary |
||||
Source="VisualizerPicker.xaml" /> |
||||
<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> |
||||
<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> |
||||
</UserControl.Resources> |
||||
<Grid Background="Transparent" Name="ParentGrid"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition/> |
||||
<ColumnDefinition/> |
||||
</Grid.ColumnDefinitions> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"/> |
||||
<RowDefinition Height="50"/> |
||||
</Grid.RowDefinitions> |
||||
<StackPanel Orientation="Vertical"> |
||||
<RepeatButton Name="btnUp" Focusable="False" Style="{StaticResource upButtonStyle}" Content="^" Click="BtnUp_Click"></RepeatButton> |
||||
<DataGrid VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Disabled" |
||||
GridLinesVisibility="None" |
||||
RowHeight="18" MaxHeight="202" |
||||
SelectionMode="Single" |
||||
SelectionUnit="FullRow" |
||||
ItemsSource="{Binding}" |
||||
Name="dataGrid" |
||||
AutoGenerateColumns="False" |
||||
CanUserAddRows="False" HeadersVisibility="None" |
||||
BorderBrush="Gray" |
||||
BorderThickness="1"> |
||||
<DataGrid.Background> |
||||
|
||||
<!-- Control backgound --> |
||||
<LinearGradientBrush 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> |
||||
</DataGrid.Background> |
||||
<DataGrid.RowStyle> |
||||
<Style TargetType="{x:Type DataGridRow}"> |
||||
<Setter Property="Background" Value="Transparent"></Setter> |
||||
<Style.Triggers> |
||||
<Trigger Property="IsMouseOver" Value="True"> |
||||
<Setter Property="Background" Value="#FFE2F6FE" /> |
||||
</Trigger> |
||||
</Style.Triggers> |
||||
</Style> |
||||
</DataGrid.RowStyle> |
||||
<DataGrid.CellStyle> |
||||
<Style TargetType="{x:Type DataGridCell}"> |
||||
<Setter Property="Focusable" Value="false" /> <!-- Focusable=true blocks shortcuts if cell is focused --> |
||||
<Setter Property="BorderThickness" Value="0" /> |
||||
<Style.Triggers> |
||||
<Trigger Property="IsSelected" Value="True"> <!-- disable selection highlight --> |
||||
<Setter Property="Foreground" Value="Black" /> |
||||
<Setter Property="Background" Value="{x:Null}" /> |
||||
</Trigger> |
||||
</Style.Triggers> |
||||
</Style> |
||||
</DataGrid.CellStyle> |
||||
<DataGrid.Columns> |
||||
<DataGridTemplateColumn> <!-- "Plus" expander --> |
||||
<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> |
||||
<!-- 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> |
||||
<!-- 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" |
||||
Margin="4 0" |
||||
Text="{Binding Path=Text}"/> |
||||
</DataTemplate> |
||||
</DataGridTemplateColumn.CellTemplate> |
||||
</DataGridTemplateColumn> |
||||
|
||||
<DataGridTemplateColumn> <!-- Pin --> |
||||
|
||||
<DataGridTemplateColumn.CellTemplate> |
||||
<DataTemplate> |
||||
<ToggleButton |
||||
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> |
||||
<Grid |
||||
Background="Transparent" |
||||
Name="ParentGrid"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition |
||||
Height="Auto" /> |
||||
<RowDefinition |
||||
Height="50" /> |
||||
</Grid.RowDefinitions> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<RepeatButton |
||||
Name="btnUp" |
||||
Focusable="False" |
||||
Style="{StaticResource upButtonStyle}" |
||||
Content="^" |
||||
Click="BtnUp_Click"></RepeatButton> |
||||
<DataGrid |
||||
VerticalScrollBarVisibility="Disabled" |
||||
HorizontalScrollBarVisibility="Disabled" |
||||
GridLinesVisibility="None" |
||||
RowHeight="18" |
||||
MaxHeight="202" |
||||
SelectionMode="Single" |
||||
SelectionUnit="FullRow" |
||||
ItemsSource="{Binding}" |
||||
Name="dataGrid" |
||||
AutoGenerateColumns="False" |
||||
CanUserAddRows="False" |
||||
HeadersVisibility="None" |
||||
BorderBrush="Gray" |
||||
BorderThickness="1"> |
||||
<DataGrid.Background> |
||||
<!-- Control backgound --> |
||||
<LinearGradientBrush |
||||
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> |
||||
</DataGrid.Background> |
||||
<DataGrid.RowStyle> |
||||
<Style |
||||
TargetType="{x:Type DataGridRow}"> |
||||
<Setter |
||||
Property="Background" |
||||
Value="Transparent"></Setter> |
||||
<Style.Triggers> |
||||
<Trigger |
||||
Property="IsMouseOver" |
||||
Value="True"> |
||||
<Setter |
||||
Property="Background" |
||||
Value="#FFE2F6FE" /> |
||||
</Trigger> |
||||
</Style.Triggers> |
||||
</Style> |
||||
</DataGrid.RowStyle> |
||||
<DataGrid.CellStyle> |
||||
<Style |
||||
TargetType="{x:Type DataGridCell}"> |
||||
<Setter |
||||
Property="Focusable" |
||||
Value="false" /> |
||||
<!-- Focusable=true blocks shortcuts if cell is focused --> |
||||
<Setter |
||||
Property="BorderThickness" |
||||
Value="0" /> |
||||
<Style.Triggers> |
||||
<Trigger |
||||
Property="IsSelected" |
||||
Value="True"> |
||||
<!-- disable selection highlight --> |
||||
<Setter |
||||
Property="Foreground" |
||||
Value="Black" /> |
||||
<Setter |
||||
Property="Background" |
||||
Value="{x:Null}" /> |
||||
</Trigger> |
||||
</Style.Triggers> |
||||
</Style> |
||||
</DataGrid.CellStyle> |
||||
<DataGrid.Columns> |
||||
<DataGridTemplateColumn> |
||||
<!-- "Plus" expander --> |
||||
<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> |
||||
<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" Margin="3" Height="34" TextChanged="CommentTextBox_TextChanged"/> |
||||
<!-- 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> |
||||
<!-- 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> |
||||
</StackPanel> |
||||
<Canvas MinWidth="25" Background="Transparent" Grid.Column="1" Name="PinControlCanvas" Visibility="Collapsed"> |
||||
</StackPanel> |
||||
<Canvas |
||||
MinWidth="25" |
||||
Background="Transparent" |
||||
Grid.Column="1" |
||||
Name="PinControlCanvas" |
||||
Visibility="Collapsed"> |
||||
<!-- Pin close control --> |
||||
</Canvas> |
||||
</Canvas> |
||||
</Grid> |
||||
</UserControl> |
@ -0,0 +1,86 @@
@@ -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 @@
@@ -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