|
|
|
@ -8,26 +8,23 @@ using System.Windows.Input; |
|
|
|
using System.Windows.Media; |
|
|
|
using System.Windows.Media; |
|
|
|
using System.Windows.Shapes; |
|
|
|
using System.Windows.Shapes; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using Microsoft.Windows.Themes; |
|
|
|
|
|
|
|
|
|
|
|
namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
{ |
|
|
|
{ |
|
|
|
public partial class DrawSurface : UserControl |
|
|
|
public partial class DrawSurface : UserControl |
|
|
|
{ |
|
|
|
{ |
|
|
|
Point dragStartedPoint; |
|
|
|
private Point dragStartedPoint; |
|
|
|
|
|
|
|
private ScaleTransform zoom = new ScaleTransform(); |
|
|
|
TransformGroup group = new TransformGroup(); |
|
|
|
|
|
|
|
ScaleTransform zoom = new ScaleTransform(); |
|
|
|
|
|
|
|
TranslateTransform translate = new TranslateTransform(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DrawSurface() |
|
|
|
public DrawSurface() |
|
|
|
{ |
|
|
|
{ |
|
|
|
InitializeComponent(); |
|
|
|
InitializeComponent(); |
|
|
|
|
|
|
|
|
|
|
|
group.Children.Add(zoom); |
|
|
|
ContentControl.LayoutTransform = zoom; |
|
|
|
group.Children.Add(translate); |
|
|
|
|
|
|
|
drawingSurface.RenderTransform = group; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.MouseLeftButtonDown += DrawSurface_PreviewMouseLeftButtonDown; |
|
|
|
this.PreviewMouseLeftButtonDown += DrawSurface_PreviewMouseLeftButtonDown; |
|
|
|
this.MouseLeftButtonUp += DrawSurface_MouseLeftButtonUp; |
|
|
|
this.PreviewMouseLeftButtonUp += DrawSurface_MouseLeftButtonUp; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void SetGraph(ParallelStacksGraph graph) |
|
|
|
public void SetGraph(ParallelStacksGraph graph) |
|
|
|
@ -56,7 +53,7 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
|
|
|
|
|
|
|
|
void DrawSurface_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
|
|
void DrawSurface_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (e.OriginalSource is Shape || e.OriginalSource is TextBlock) |
|
|
|
if (e.OriginalSource is TextBlock || e.OriginalSource is Shape || e.OriginalSource is ScrollChrome) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
dragStartedPoint = e.GetPosition(drawingSurface); |
|
|
|
dragStartedPoint = e.GetPosition(drawingSurface); |
|
|
|
@ -77,6 +74,9 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
|
|
|
|
|
|
|
|
void DrawSurface_PreviewMouseMove(object sender, MouseEventArgs e) |
|
|
|
void DrawSurface_PreviewMouseMove(object sender, MouseEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (e.OriginalSource is TextBlock || e.OriginalSource is Shape || e.OriginalSource is ScrollChrome) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (!drawingSurface.IsMouseCaptured) return; |
|
|
|
if (!drawingSurface.IsMouseCaptured) return; |
|
|
|
|
|
|
|
|
|
|
|
if (e.LeftButton == MouseButtonState.Pressed) |
|
|
|
if (e.LeftButton == MouseButtonState.Pressed) |
|
|
|
@ -84,8 +84,10 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
Cursor = Cursors.SizeAll; |
|
|
|
Cursor = Cursors.SizeAll; |
|
|
|
var point = e.GetPosition(drawingSurface); |
|
|
|
var point = e.GetPosition(drawingSurface); |
|
|
|
Vector v = point - dragStartedPoint; |
|
|
|
Vector v = point - dragStartedPoint; |
|
|
|
translate.X += v.X / 200; |
|
|
|
ContentControl.Margin = new Thickness( |
|
|
|
translate.Y += v.Y / 200; |
|
|
|
ContentControl.Margin.Left + v.X / 80, |
|
|
|
|
|
|
|
ContentControl.Margin.Top + v.Y / 80, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
e.Handled = true; |
|
|
|
e.Handled = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -113,9 +115,6 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
void Reset_Click(object sender, RoutedEventArgs e) |
|
|
|
void Reset_Click(object sender, RoutedEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this.SliderControl.Value = 5; |
|
|
|
this.SliderControl.Value = 5; |
|
|
|
|
|
|
|
|
|
|
|
translate.X = 0; |
|
|
|
|
|
|
|
translate.Y = 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|