Browse Source

modify UI of control

add drag and drop to PinBookmark
pull/11/head
eusebiu 15 years ago
parent
commit
20e51d050f
  1. 15
      src/AddIns/Debugger/Debugger.AddIn/TreeModel/ExpressionNode.cs
  2. 10
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
  3. 5
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml
  4. 2
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml.cs
  5. 2
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/ITreeNode.cs
  6. 15
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinBookmark.cs
  7. 30
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinControlsDictionary.xaml
  8. 12
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinDebuggerControl.xaml
  9. 57
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinDebuggerControl.xaml.cs
  10. 2
      src/Main/Base/Project/Src/Services/Debugger/TreeNode.cs

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

@ -31,7 +31,7 @@ namespace Debugger.AddIn.TreeModel
Expression expression; Expression expression;
bool canSetText; bool canSetText;
GetValueException error; GetValueException error;
string fullName;
string fullText; string fullText;
public bool Evaluated { public bool Evaluated {
@ -78,6 +78,9 @@ namespace Debugger.AddIn.TreeModel
get { get {
if (!evaluated) EvaluateExpression(); if (!evaluated) EvaluateExpression();
if(!string.IsNullOrEmpty(fullName))
return fullName;
if (expression is MemberReferenceExpression) { if (expression is MemberReferenceExpression) {
var memberExpression = (MemberReferenceExpression)expression; var memberExpression = (MemberReferenceExpression)expression;
@ -111,15 +114,21 @@ namespace Debugger.AddIn.TreeModel
} }
} }
if (currentExpression is ThisReferenceExpression) {
stack.Push("this");
}
// create fullname // create fullname
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
while(stack.Count > 0) while(stack.Count > 0)
sb.Append(stack.Pop()); sb.Append(stack.Pop());
return sb.ToString(); fullName = sb.ToString();
return fullName;
} }
return Name.Trim(); fullName = Name.Trim();
return fullName;
} }
} }

10
src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

@ -30,6 +30,8 @@ namespace ICSharpCode.SharpDevelop.Debugging
BookmarkManager.Added += BookmarkAdded; BookmarkManager.Added += BookmarkAdded;
BookmarkManager.Removed += BookmarkRemoved; BookmarkManager.Removed += BookmarkRemoved;
IsDebuggerRunning = false;
} }
static void GetDescriptors() static void GetDescriptors()
@ -80,6 +82,8 @@ namespace ICSharpCode.SharpDevelop.Debugging
} }
} }
public static bool IsDebuggerRunning { get; set; }
/// <summary> /// <summary>
/// Returns true if debugger is already loaded. /// Returns true if debugger is already loaded.
/// </summary> /// </summary>
@ -109,9 +113,11 @@ namespace ICSharpCode.SharpDevelop.Debugging
} }
static void OnDebugStarted(object sender, EventArgs e) static void OnDebugStarted(object sender, EventArgs e)
{ {
if (DebugStarted != null) if (DebugStarted != null)
DebugStarted(null, e); DebugStarted(null, e);
IsDebuggerRunning = true;
} }
static void OnDebugStopped(object sender, EventArgs e) static void OnDebugStopped(object sender, EventArgs e)
@ -124,6 +130,8 @@ namespace ICSharpCode.SharpDevelop.Debugging
LayoutConfiguration.CurrentLayoutName = oldLayoutConfiguration; LayoutConfiguration.CurrentLayoutName = oldLayoutConfiguration;
if (DebugStopped != null) if (DebugStopped != null)
DebugStopped(null, e); DebugStopped(null, e);
IsDebuggerRunning = false;
} }
static MessageViewCategory debugCategory = null; static MessageViewCategory debugCategory = null;

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

@ -144,7 +144,7 @@
BorderBrush="#FFDDDDDD" BorderBrush="#FFDDDDDD"
BorderThickness="0 0 1 0"> BorderThickness="0 0 1 0">
<TextBlock <TextBlock
Margin="6 0" Style="{StaticResource TextBlockStyle}"
Text="{Binding Path=Name, Mode=OneWay}" Text="{Binding Path=Name, Mode=OneWay}"
VerticalAlignment="Top"></TextBlock> VerticalAlignment="Top"></TextBlock>
</Border> </Border>
@ -183,7 +183,6 @@
Style="{StaticResource TextStyle}" Style="{StaticResource TextStyle}"
IsEnabled="{Binding CanSetText}" IsEnabled="{Binding CanSetText}"
KeyUp="TextBox_KeyUp" KeyUp="TextBox_KeyUp"
Margin="4 0"
Text="{Binding Path=Text}" /> Text="{Binding Path=Text}" />
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
@ -193,7 +192,7 @@
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<ToggleButton <ToggleButton
IsChecked="{Binding IsChecked}" IsChecked="{Binding IsPinned}"
DataContext="{Binding}" DataContext="{Binding}"
Visibility="Collapsed" Visibility="Collapsed"
Name="PinButton" Name="PinButton"

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

@ -80,7 +80,7 @@ namespace ICSharpCode.SharpDevelop.Debugging
if (pin != null) { if (pin != null) {
foreach (var node in this.itemsSource) { foreach (var node in this.itemsSource) {
if (pin.ContainsNode(node)) if (pin.ContainsNode(node))
node.IsChecked = true; node.IsPinned = true;
} }
} }
} }

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

@ -32,7 +32,7 @@ namespace ICSharpCode.SharpDevelop.Debugging
bool HasVisualizerCommands { get; } bool HasVisualizerCommands { get; }
bool IsChecked { get; set; } bool IsPinned { get; set; }
bool SetText(string newValue); bool SetText(string newValue);
} }

15
src/Main/Base/Project/Src/Services/Debugger/Tooltips/PinBookmark.cs

@ -49,7 +49,16 @@ namespace Services.Debugger.Tooltips
public string Tooltip { public string Tooltip {
get { return tooltip; } get { return tooltip; }
set { tooltip = value; } set { tooltip = value; }
} }
public override bool CanDragDrop {
get { return true; }
}
public override void Drop(int lineNumber)
{
this.Location = new Location(ColumnNumber, lineNumber);
}
} }
public static class PinBookmarkExtensions public static class PinBookmarkExtensions
@ -62,7 +71,7 @@ namespace Services.Debugger.Tooltips
throw new ArgumentNullException("Node is null"); throw new ArgumentNullException("Node is null");
foreach (var currentNode in mark.Nodes) { foreach (var currentNode in mark.Nodes) {
if (node.Name.Trim() == currentNode.Name.Trim()) if (node.FullName.Trim() == currentNode.FullName.Trim())
return true; return true;
} }
@ -77,7 +86,7 @@ namespace Services.Debugger.Tooltips
throw new ArgumentNullException("Node is null"); throw new ArgumentNullException("Node is null");
foreach (var currentNode in mark.Nodes) { foreach (var currentNode in mark.Nodes) {
if (node.Name.Trim() == currentNode.Name.Trim()) { if (node.FullName.Trim() == currentNode.FullName.Trim()) {
mark.Nodes.Remove(currentNode); mark.Nodes.Remove(currentNode);
return; return;
} }

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

@ -75,10 +75,10 @@
<Border Width="16" Height="16" Name="TheBorder" CornerRadius="0" BorderThickness="1" BorderBrush="Black" Background="{StaticResource SilverPressedBrushKey}"> <Border Width="16" Height="16" Name="TheBorder" CornerRadius="0" BorderThickness="1" BorderBrush="Black" Background="{StaticResource SilverPressedBrushKey}">
<Canvas Name="TheCanvas"> <Canvas Name="TheCanvas">
<Line X1="4" X2="10" Y1="2" Y2="2" Stroke="Black" StrokeThickness="1"/> <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="9" X2="9" Y1="2" Y2="8" Stroke="Black" StrokeThickness="1"/>
<Line X1="2" X2="12" Y1="9" Y2="9" Stroke="Black" StrokeThickness="1"/> <Line X1="2" X2="12" Y1="8" Y2="8" Stroke="Black" StrokeThickness="1"/>
<Rectangle Fill="Black" Width="3" Height="6" Canvas.Left="3" Canvas.Top="3"/> <Rectangle Fill="Black" Width="2" Height="5" Canvas.Left="4" Canvas.Top="3"/>
<Line X1="7" X2="7" Y1="10" Y2="13" Stroke="Black" StrokeThickness="1"/> <Line X1="7" X2="7" Y1="9" Y2="12" Stroke="Black" StrokeThickness="1"/>
</Canvas> </Canvas>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
@ -126,11 +126,11 @@
<ControlTemplate x:Key="PinTooltipButtonTemplate" TargetType="ToggleButton"> <ControlTemplate x:Key="PinTooltipButtonTemplate" TargetType="ToggleButton">
<Border Width="16" Height="16" Name="TheBorder" CornerRadius="2" BorderBrush="Transparent" BorderThickness="1" Background="Transparent"> <Border Width="16" Height="16" Name="TheBorder" CornerRadius="2" BorderBrush="Transparent" BorderThickness="1" Background="Transparent">
<Canvas RenderTransform="{StaticResource Rotate}" Name="TheCanvas"> <Canvas RenderTransform="{StaticResource Rotate}" Name="TheCanvas">
<Line X1="4" X2="10" Y1="2" Y2="2" Name="Line1" Stroke="Silver" StrokeThickness="1"/> <Line X1="4" X2="10" Y1="2" Y2="2" Stroke="Silver" StrokeThickness="1" Name="Line1"/>
<Line X1="10" X2="10" Y1="3" Y2="9" Name="Line2" Stroke="Silver" StrokeThickness="1"/> <Line X1="9" X2="9" Y1="2" Y2="8" Stroke="Silver" StrokeThickness="1" Name="Line2"/>
<Line X1="2" X2="12" Y1="9" Y2="9" Name="Line3" Stroke="Silver" StrokeThickness="1"/> <Line X1="2" X2="12" Y1="8" Y2="8" Stroke="Silver" StrokeThickness="1" Name="Line3"/>
<Rectangle Width="3" Height="6" Name="Rectangle" Fill="Silver" Canvas.Left="3" Canvas.Top="3"/> <Rectangle Fill="Silver" Width="2" Height="7" Canvas.Left="4" Canvas.Top="2" Name="Rectangle"/>
<Line X1="7" X2="7" Y1="10" Y2="13" Name="Line4" Stroke="Silver" StrokeThickness="1"/> <Line X1="7" X2="7" Y1="9" Y2="12" Stroke="Silver" StrokeThickness="1" Name="Line4"/>
</Canvas> </Canvas>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
@ -158,7 +158,10 @@
Value="True" /> Value="True" />
<Setter <Setter
Property="VerticalAlignment" Property="VerticalAlignment"
Value="Top" /> Value="Center" />
<Setter
Property="FontFamily" Value="Khmer UI" />
<Setter Property="FontSize" Value="12" />
<Setter <Setter
Property="KeyboardNavigation.TabNavigation" Property="KeyboardNavigation.TabNavigation"
Value="None" /> Value="None" />
@ -184,6 +187,13 @@
</Setter> </Setter>
</Style> </Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle">
<Setter Property="Margin" Value="4 0" />
<Setter
Property="FontFamily" Value="Khmer UI" />
<Setter Property="FontSize" Value="12" />
</Style>
<Style x:Key="PinThumbStyle" TargetType="Thumb"> <Style x:Key="PinThumbStyle" TargetType="Thumb">
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>

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

@ -156,14 +156,13 @@
<!-- Name --> <!-- Name -->
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<Border IsEnabled="False" <Border
BorderBrush="#FFDDDDDD" BorderBrush="#FFDDDDDD"
BorderThickness="0 0 1 0"> BorderThickness="0 0 1 0">
<TextBlock <TextBlock
FontFamily="Arial" Style="{StaticResource TextBlockStyle}"
Margin="6 0"
Text="{Binding Path=FullName, Mode=OneWay}" Text="{Binding Path=FullName, Mode=OneWay}"
VerticalAlignment="Top"></TextBlock> VerticalAlignment="Center"></TextBlock>
</Border> </Border>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
@ -177,7 +176,6 @@
<TextBox <TextBox
Style="{StaticResource TextStyle}" Style="{StaticResource TextStyle}"
IsEnabled="false" IsEnabled="false"
Margin="4 0"
Text="{Binding Path=Text}" /> Text="{Binding Path=Text}" />
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>

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

@ -10,6 +10,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Bookmarks; using ICSharpCode.SharpDevelop.Bookmarks;
@ -32,14 +33,16 @@ namespace Services.Debugger.Tooltips
{ {
InitializeComponent(); InitializeComponent();
if (!DebuggerService.IsDebuggerLoaded) if (!DebuggerService.IsDebuggerRunning)
Opacity = MINIMUM_OPACITY; Opacity = MINIMUM_OPACITY;
PinCloseControl.Opacity = 0;
Loaded += OnLoaded; Loaded += OnLoaded;
this.PinCloseControl.Closed += PinCloseControl_Closed; this.PinCloseControl.Closed += PinCloseControl_Closed;
this.PinCloseControl.ShowingComment += PinCloseControl_ShowingComment; this.PinCloseControl.ShowingComment += PinCloseControl_ShowingComment;
this.PinCloseControl.PinningChanged += PinCloseControl_PinningChanged; this.PinCloseControl.PinningChanged += PinCloseControl_PinningChanged;
BookmarkManager.Removed += BookmarkManager_Removed; BookmarkManager.Removed += BookmarkManager_Removed;
DebuggerService.DebugStarted += delegate { Opacity = 1d; };
} }
#region Properties #region Properties
@ -214,29 +217,59 @@ namespace Services.Debugger.Tooltips
#endregion #endregion
void AnimateCloseControls(bool show)
{
DoubleAnimation animation = new DoubleAnimation();
animation.From = show ? 0 : 1;
animation.To = show ? 1 : 0;
animation.BeginTime = new TimeSpan(0, 0, show ? 0 : 1);
animation.Duration = new Duration(TimeSpan.FromMilliseconds(500));
animation.SetValue(Storyboard.TargetProperty, this.PinCloseControl);
animation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(Rectangle.OpacityProperty));
Storyboard board = new Storyboard();
board.Children.Add(animation);
board.Begin(this);
}
void RefreshContentImage_MouseDown(object sender, MouseButtonEventArgs e)
{
// refresh content
ITreeNode node = ((Image)sender).DataContext as ITreeNode;
if (!DebuggerService.IsDebuggerRunning)
return;
}
protected override void OnMouseEnter(System.Windows.Input.MouseEventArgs e) protected override void OnMouseEnter(System.Windows.Input.MouseEventArgs e)
{ {
AnimateCloseControls(true);
Opacity = 1d; Opacity = 1d;
Cursor = Cursors.Arrow; Cursor = Cursors.Arrow;
base.OnMouseEnter(e); base.OnMouseEnter(e);
} }
protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e) protected override void OnMouseMove(MouseEventArgs e)
{ {
Opacity = MINIMUM_OPACITY; Opacity = 1d;
Cursor = Cursors.IBeam; Cursor = Cursors.Arrow;
base.OnMouseLeave(e); base.OnMouseMove(e);
} }
void RefreshContentImage_MouseDown(object sender, MouseButtonEventArgs e) protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
{ {
// refresh content if (DebuggerService.IsDebuggerRunning)
ITreeNode node = ((Image)sender).DataContext as ITreeNode; Opacity = 1;
else
if (!DebuggerService.IsDebuggerLoaded) Opacity = MINIMUM_OPACITY;
return;
AnimateCloseControls(false);
Cursor = Cursors.IBeam;
base.OnMouseLeave(e);
} }
} }
} }

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

@ -101,7 +101,7 @@ namespace ICSharpCode.SharpDevelop.Debugging
} }
} }
public bool IsChecked { get; set; } public bool IsPinned { get; set; }
public TreeNode() public TreeNode()
{ {

Loading…
Cancel
Save