19 changed files with 718 additions and 48 deletions
After Width: | Height: | Size: 671 B |
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
// 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.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Collections.Specialized; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.NRefactory; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Bookmarks; |
||||
using ICSharpCode.SharpDevelop.Debugging; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
|
||||
namespace Services.Debugger.Tooltips |
||||
{ |
||||
public class PinBookmark : SDBookmark |
||||
{ |
||||
string tooltip; |
||||
|
||||
public DebuggerPopup Popup { get; set; } |
||||
|
||||
public static readonly IImage PinImage = new ResourceServiceImage("Bookmarks.Pin"); |
||||
|
||||
public PinBookmark(FileName fileName, Location location) : base(fileName, location) |
||||
{ |
||||
Nodes = new ObservableCollection<ITreeNode>(); |
||||
Nodes.CollectionChanged += new NotifyCollectionChangedEventHandler(Nodes_CollectionChanged); |
||||
IsVisibleInBookmarkPad = false; |
||||
} |
||||
|
||||
void Nodes_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) |
||||
{ |
||||
if (e.Action == NotifyCollectionChangedAction.Add || |
||||
e.Action == NotifyCollectionChangedAction.Remove) |
||||
Popup.contentControl.ItemsSource = Nodes; |
||||
} |
||||
|
||||
public ObservableCollection<ITreeNode> Nodes { get; set; } |
||||
|
||||
public List<Tuple<string, string>> SavedNodes { get; set; } |
||||
|
||||
public string Comment { get; set; } |
||||
|
||||
public override IImage Image { |
||||
get { |
||||
return PinImage; |
||||
} |
||||
} |
||||
|
||||
public string Tooltip { |
||||
get { return tooltip; } |
||||
set { tooltip = value; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<UserControl |
||||
Background="Transparent" |
||||
x:Class="Services.Debugger.Tooltips.PinCloseControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<UserControl.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary |
||||
Source="PinControlsDictionary.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
||||
</UserControl.Resources> |
||||
<StackPanel> |
||||
<Button |
||||
Name="CloseButton" |
||||
Click="CloseButton_Click" |
||||
Template="{StaticResource CloseButtonTemplate}" /> |
||||
<ToggleButton |
||||
Name="UnpinButton" |
||||
Checked="UnpinButton_Checked" |
||||
Unchecked="UnpinButton_Unchecked" |
||||
Template="{StaticResource PinButtonTemplate}" /> |
||||
<ToggleButton |
||||
Name="CommentButton" |
||||
Checked="CommentButton_Checked" |
||||
Unchecked="CommentButton_Unchecked" |
||||
Template="{StaticResource CommentButtonTemplate}" /> |
||||
</StackPanel> |
||||
</UserControl> |
@ -0,0 +1,89 @@
@@ -0,0 +1,89 @@
|
||||
// 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.Generic; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Controls.Primitives; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
using ICSharpCode.SharpDevelop.Bookmarks; |
||||
using ICSharpCode.SharpDevelop.Debugging; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace Services.Debugger.Tooltips |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for PinCloseControl.xaml
|
||||
/// </summary>
|
||||
public partial class PinCloseControl : UserControl |
||||
{ |
||||
readonly DebuggerTooltipControl toolTipControl; |
||||
|
||||
public PinCloseControl(DebuggerTooltipControl parent) |
||||
{ |
||||
Margin = new Thickness(5, 0, 0, 0); |
||||
InitializeComponent(); |
||||
|
||||
this.toolTipControl = parent; |
||||
} |
||||
|
||||
void Unpin() |
||||
{ |
||||
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveContent as ITextEditorProvider; |
||||
if (provider != null) { |
||||
ITextEditor editor = provider.TextEditor; |
||||
if (!string.IsNullOrEmpty(editor.FileName)) { |
||||
|
||||
var pin = new PinBookmark(editor.FileName, toolTipControl.LogicalPosition); |
||||
BookmarkManager.RemoveMark(pin); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void CloseButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
Unpin(); |
||||
toolTipControl.containingPopup.CloseSelfAndChildren(); |
||||
} |
||||
|
||||
void CommentButton_Checked(object sender, RoutedEventArgs e) |
||||
{ |
||||
toolTipControl.ShowComment(true); |
||||
} |
||||
|
||||
void CommentButton_Unchecked(object sender, RoutedEventArgs e) |
||||
{ |
||||
toolTipControl.ShowComment(false); |
||||
} |
||||
|
||||
void UnpinButton_Checked(object sender, RoutedEventArgs e) |
||||
{ |
||||
Unpin(); |
||||
} |
||||
|
||||
void UnpinButton_Unchecked(object sender, RoutedEventArgs e) |
||||
{ |
||||
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveContent as ITextEditorProvider; |
||||
if (provider != null) { |
||||
ITextEditor editor = provider.TextEditor; |
||||
if (!string.IsNullOrEmpty(editor.FileName)) { |
||||
|
||||
var pin = new PinBookmark(editor.FileName, toolTipControl.LogicalPosition); |
||||
|
||||
BookmarkManager.ToggleBookmark( |
||||
editor, |
||||
toolTipControl.LogicalPosition.Line, |
||||
b => b.CanToggle && b is PinBookmark, |
||||
location => pin); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,151 @@
@@ -0,0 +1,151 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
> |
||||
<LinearGradientBrush x:Key="OrangeBrushKey" EndPoint="0,1" StartPoint="0,0"> |
||||
<LinearGradientBrush.GradientStops> |
||||
<GradientStop Offset="0" Color="White" /> |
||||
<GradientStop Offset="0.5" Color="Orange" /> |
||||
<GradientStop Offset="1" Color="Orange" /> |
||||
</LinearGradientBrush.GradientStops> |
||||
</LinearGradientBrush> |
||||
|
||||
<LinearGradientBrush x:Key="OrangePressedBrushKey" EndPoint="0,1" StartPoint="0,0"> |
||||
<LinearGradientBrush.GradientStops> |
||||
<GradientStop Offset="1" Color="White" /> |
||||
<GradientStop Offset="0.5" Color="Orange" /> |
||||
<GradientStop Offset="0" Color="Orange" /> |
||||
</LinearGradientBrush.GradientStops> |
||||
</LinearGradientBrush> |
||||
|
||||
<LinearGradientBrush x:Key="SilverBrushKey" EndPoint="0,1" StartPoint="0,0"> |
||||
<LinearGradientBrush.GradientStops> |
||||
<GradientStop Offset="0" Color="White" /> |
||||
<GradientStop Offset="0.5" Color="LightGray" /> |
||||
<GradientStop Offset="1" Color="LightGray" /> |
||||
</LinearGradientBrush.GradientStops> |
||||
</LinearGradientBrush> |
||||
|
||||
<LinearGradientBrush x:Key="SilverPressedBrushKey" EndPoint="0,1" StartPoint="0,0"> |
||||
<LinearGradientBrush.GradientStops> |
||||
<GradientStop Offset="1" Color="White" /> |
||||
<GradientStop Offset="0.5" Color="LightGray" /> |
||||
<GradientStop Offset="0" Color="LightGray" /> |
||||
</LinearGradientBrush.GradientStops> |
||||
</LinearGradientBrush> |
||||
|
||||
<ControlTemplate x:Key="CloseButtonTemplate" TargetType="Button"> |
||||
<Border Width="16" Height="16" Name="TheBorder" CornerRadius="2,2,0,0" BorderThickness="1" BorderBrush="Black" Background="{StaticResource SilverPressedBrushKey}"> |
||||
<Canvas> |
||||
<Line X1="3" X2="11" Y1="3" Y2="11" Stroke="Black" StrokeThickness="2"/> |
||||
<Line X1="3" X2="11" Y1="11" Y2="3" Stroke="Black" StrokeThickness="2"/> |
||||
</Canvas> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="UIElement.IsMouseOver" Value="true"> |
||||
<Setter TargetName="TheBorder" Property="Background" Value="{StaticResource OrangeBrushKey}"/> |
||||
<Setter TargetName="TheBorder" Property="BorderBrush" Value="Silver"/> |
||||
</Trigger> |
||||
<Trigger Property="ButtonBase.IsPressed" Value="True"> |
||||
<Setter TargetName="TheBorder" Property="Background" Value="{StaticResource OrangePressedBrushKey}"/> |
||||
<Setter TargetName="TheBorder" Property="BorderBrush" Value="Silver"/> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
|
||||
<TransformGroup x:Key="Rotate"> |
||||
<RotateTransform Angle="270" CenterX="7" CenterY="7"/> |
||||
</TransformGroup> |
||||
|
||||
<TransformGroup x:Key="RotateUnpin"> |
||||
<RotateTransform Angle="270" CenterX="7" CenterY="7"/> |
||||
<RotateTransform Angle="-90" CenterX="7" CenterY="7"/> |
||||
<ScaleTransform ScaleY="-1" CenterX="7" CenterY="7"/> |
||||
</TransformGroup> |
||||
|
||||
<TransformGroup x:Key="RotatePin"> |
||||
<RotateTransform Angle="-90" CenterX="7" CenterY="7"/> |
||||
</TransformGroup> |
||||
|
||||
<TransformGroup x:Key="FlipComment"> |
||||
<ScaleTransform CenterX="7" CenterY="7" ScaleY="-1"/> |
||||
</TransformGroup> |
||||
|
||||
<ControlTemplate x:Key="PinButtonTemplate" TargetType="ToggleButton"> |
||||
<Border Width="16" Height="16" Name="TheBorder" CornerRadius="0" BorderThickness="1" BorderBrush="Black" Background="{StaticResource SilverPressedBrushKey}"> |
||||
<Canvas Name="TheCanvas"> |
||||
<Line X1="4" X2="10" Y1="2" Y2="2" Stroke="Black" StrokeThickness="1"/> |
||||
<Line X1="10" X2="10" Y1="3" Y2="9" Stroke="Black" StrokeThickness="1"/> |
||||
<Line X1="2" X2="12" Y1="9" Y2="9" Stroke="Black" StrokeThickness="1"/> |
||||
<Rectangle Fill="Black" Width="3" Height="6" Canvas.Left="3" Canvas.Top="3"/> |
||||
<Line X1="7" X2="7" Y1="10" Y2="13" Stroke="Black" StrokeThickness="1"/> |
||||
</Canvas> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="UIElement.IsMouseOver" Value="true"> |
||||
<Setter TargetName="TheBorder" Property="Background" Value="{StaticResource OrangeBrushKey}"/> |
||||
<Setter TargetName="TheBorder" Property="BorderBrush" Value="Silver"/> |
||||
</Trigger> |
||||
<Trigger Property="ButtonBase.IsPressed" Value="True"> |
||||
<Setter TargetName="TheCanvas" Property="RenderTransform" Value="{StaticResource RotatePin}"/> |
||||
<Setter TargetName="TheBorder" Property="Background" Value="{StaticResource OrangePressedBrushKey}"/> |
||||
<Setter TargetName="TheBorder" Property="BorderBrush" Value="Silver"/> |
||||
</Trigger> |
||||
<Trigger Property="IsChecked" Value="true"> |
||||
<Setter TargetName="TheCanvas" Property="RenderTransform" Value="{StaticResource RotatePin}"/> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
|
||||
<ControlTemplate x:Key="CommentButtonTemplate" TargetType="ToggleButton"> |
||||
<Border Width="16" Height="16" Name="TheBorder" CornerRadius="0,0,2,2" BorderThickness="1" BorderBrush="Black" Background="{StaticResource SilverPressedBrushKey}"> |
||||
<Canvas Name="TheCanvas"> |
||||
<Line X1="2" Y1="3" X2="8" Y2="7" Stroke="Black" StrokeThickness="2"/> |
||||
<Line X1="7" Y1="6" X2="12" Y2="3" Stroke="Black" StrokeThickness="2"/> |
||||
<Line X1="2" Y1="8" X2="8" Y2="12" Stroke="Black" StrokeThickness="2"/> |
||||
<Line X1="8" Y1="11" X2="12" Y2="8" Stroke="Black" StrokeThickness="2"/> |
||||
</Canvas> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="UIElement.IsMouseOver" Value="true"> |
||||
<Setter TargetName="TheBorder" Property="Background" Value="{StaticResource OrangeBrushKey}"/> |
||||
<Setter TargetName="TheBorder" Property="BorderBrush" Value="Silver"/> |
||||
</Trigger> |
||||
<Trigger Property="ButtonBase.IsPressed" Value="True"> |
||||
<Setter TargetName="TheBorder" Property="Background" Value="{StaticResource OrangePressedBrushKey}"/> |
||||
<Setter TargetName="TheBorder" Property="BorderBrush" Value="Silver"/> |
||||
</Trigger> |
||||
<Trigger Property="IsChecked" Value="True"> |
||||
<Setter TargetName="TheCanvas" Property="RenderTransform" Value="{StaticResource FlipComment}"/> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
|
||||
<SolidColorBrush x:Key="MouseOverPinBrush" Color="Black" /> |
||||
|
||||
<ControlTemplate x:Key="PinTooltipButtonTemplate" TargetType="ToggleButton"> |
||||
<Border Width="16" Height="16" Name="TheBorder" CornerRadius="2" BorderBrush="Transparent" BorderThickness="1" Background="Transparent"> |
||||
<Canvas RenderTransform="{StaticResource Rotate}" Name="TheCanvas"> |
||||
<Line X1="4" X2="10" Y1="2" Y2="2" Name="Line1" Stroke="Silver" StrokeThickness="1"/> |
||||
<Line X1="10" X2="10" Y1="3" Y2="9" Name="Line2" Stroke="Silver" StrokeThickness="1"/> |
||||
<Line X1="2" X2="12" Y1="9" Y2="9" Name="Line3" Stroke="Silver" StrokeThickness="1"/> |
||||
<Rectangle Width="3" Height="6" Name="Rectangle" Fill="Silver" Canvas.Left="3" Canvas.Top="3"/> |
||||
<Line X1="7" X2="7" Y1="10" Y2="13" Name="Line4" Stroke="Silver" StrokeThickness="1"/> |
||||
</Canvas> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="ButtonBase.IsPressed" Value="True"> |
||||
<Setter TargetName="TheCanvas" Property="RenderTransform" Value="{StaticResource RotateUnpin}"/> |
||||
</Trigger> |
||||
<Trigger Property="ButtonBase.IsMouseOver" Value="True"> |
||||
<Setter TargetName="Line1" Property="Stroke" Value="{StaticResource MouseOverPinBrush}"/> |
||||
<Setter TargetName="Line2" Property="Stroke" Value="{StaticResource MouseOverPinBrush}"/> |
||||
<Setter TargetName="Line3" Property="Stroke" Value="{StaticResource MouseOverPinBrush}"/> |
||||
<Setter TargetName="Line4" Property="Stroke" Value="{StaticResource MouseOverPinBrush}"/> |
||||
<Setter TargetName="Rectangle" Property="Fill" Value="{StaticResource MouseOverPinBrush}"/> |
||||
</Trigger> |
||||
<Trigger Property="IsChecked" Value="True"> |
||||
<Setter TargetName="TheCanvas" Property="RenderTransform" Value="{StaticResource RotateUnpin}"/> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</ResourceDictionary> |
Binary file not shown.
Loading…
Reference in new issue