Browse Source

add pan with scrollviewer

pull/15/head
Eusebiu Marcu 15 years ago
parent
commit
445d37dd93
  1. 7
      src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml
  2. 31
      src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml.cs
  3. 95
      src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStackPad.cs
  4. 3
      src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ThreadStack.xaml.cs

7
src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml

@ -123,10 +123,13 @@
Click="Reset_Click" Click="Reset_Click"
Template="{StaticResource ButtonTemplate}" /> Template="{StaticResource ButtonTemplate}" />
</Canvas> </Canvas>
<Grid <ScrollViewer
x:Name="drawingSurface" x:Name="drawingSurface"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
Grid.Column="1"> Grid.Column="1">
<Grid <Grid
x:Name="ContentControl"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Center"> HorizontalAlignment="Center">
<local:ParallelStacksGraphLayout <local:ParallelStacksGraphLayout
@ -139,6 +142,6 @@
OverlapRemovalConstraint="Automatic" OverlapRemovalConstraint="Automatic"
OverlapRemovalAlgorithmType="FSA" /> OverlapRemovalAlgorithmType="FSA" />
</Grid> </Grid>
</Grid> </ScrollViewer>
</Grid> </Grid>
</UserControl> </UserControl>

31
src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml.cs

@ -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

95
src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStackPad.cs

@ -71,77 +71,39 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
if (ParallelStacksView == ParallelStacksView.Threads) if (ParallelStacksView == ParallelStacksView.Threads)
{ {
if (isMethodView) using(new PrintTimes("Parallel stack - method view + threads refresh")) {
{ try {
// build method view for threads // create all simple ThreadStacks
using(new PrintTimes("Parallel stack - method view + threads refresh")) { foreach (Thread thread in debuggedProcess.Threads) {
try { if (debuggedProcess.IsPaused) {
// create all simple ThreadStacks Utils.DoEvents(debuggedProcess);
foreach (Thread thread in debuggedProcess.Threads) {
if (debuggedProcess.IsPaused) {
Utils.DoEvents(debuggedProcess);
}
CreateThreadStack(thread);
} }
CreateThreadStack(thread);
CreateMethodViewStacks();
} }
catch(AbortedBecauseDebuggeeResumedException) { } }
catch(System.Exception) { catch(AbortedBecauseDebuggeeResumedException) { }
if (debuggedProcess == null || debuggedProcess.HasExited) { catch(System.Exception) {
// Process unexpectedly exited if (debuggedProcess == null || debuggedProcess.HasExited) {
} else { // Process unexpectedly exited
throw; } else {
} throw;
} }
} }
} }
if (isMethodView)
{
// build method view for threads
CreateMethodViewStacks();
}
else else
{ {
// normal view // normal view
using(new PrintTimes("Parallel stack - threads refresh")) { CreateCommonStacks();
try {
// create all simple ThreadStacks
foreach (Thread thread in debuggedProcess.Threads) {
if (debuggedProcess.IsPaused) {
Utils.DoEvents(debuggedProcess);
}
CreateThreadStack(thread);
}
CreateCommonStacks();
}
catch(AbortedBecauseDebuggeeResumedException) { }
catch(System.Exception) {
if (debuggedProcess == null || debuggedProcess.HasExited) {
// Process unexpectedly exited
} else {
throw;
}
}
}
}
using(new PrintTimes("Graph refresh")) {
// paint the ThreadStaks
graph = new ParallelStacksGraph();
foreach (var stack in this.currentThreadStacks.FindAll(ts => ts.ThreadStackParents == null ))
{
graph.AddVertex(stack);
// add the children
AddChildren(stack);
}
surface.SetGraph(graph);
} }
} }
else else
{ {
MessageBox.Show(
"Not yet supported", "Tasks view", MessageBoxButton.OK, MessageBoxImage.Information);
// TODO : hadle tasks here
if (isMethodView) if (isMethodView)
{ {
// build method view for tasks // build method view for tasks
@ -150,7 +112,20 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
{ {
// normal // normal
} }
surface.SetGraph(new ParallelStacksGraph()); }
using(new PrintTimes("Graph refresh")) {
// paint the ThreadStaks
graph = new ParallelStacksGraph();
foreach (var stack in this.currentThreadStacks.FindAll(ts => ts.ThreadStackParents == null ))
{
graph.AddVertex(stack);
// add the children
AddChildren(stack);
}
surface.SetGraph(graph);
} }
} }

3
src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ThreadStack.xaml.cs

@ -247,6 +247,9 @@ namespace Debugger.AddIn.Pads.ParallelPad
private void OnToolTipOpening(object sender, ToolTipEventArgs e) private void OnToolTipOpening(object sender, ToolTipEventArgs e)
{ {
if (Process.IsRunning)
return;
StackPanel panel = new StackPanel(); StackPanel panel = new StackPanel();
dynamic selectedItem = datagrid.SelectedItem; dynamic selectedItem = datagrid.SelectedItem;

Loading…
Cancel
Save