diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml b/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml index 8b367d0316..872579fd82 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml @@ -123,10 +123,13 @@ Click="Reset_Click" Template="{StaticResource ButtonTemplate}" /> - - + \ No newline at end of file diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml.cs b/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml.cs index 03a07653fe..0cc26e1326 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/DrawSurface.xaml.cs +++ b/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.Shapes; +using Microsoft.Windows.Themes; + namespace Debugger.AddIn.Pads.ParallelPad { public partial class DrawSurface : UserControl { - Point dragStartedPoint; - - TransformGroup group = new TransformGroup(); - ScaleTransform zoom = new ScaleTransform(); - TranslateTransform translate = new TranslateTransform(); + private Point dragStartedPoint; + private ScaleTransform zoom = new ScaleTransform(); public DrawSurface() { InitializeComponent(); - group.Children.Add(zoom); - group.Children.Add(translate); - drawingSurface.RenderTransform = group; + ContentControl.LayoutTransform = zoom; - this.MouseLeftButtonDown += DrawSurface_PreviewMouseLeftButtonDown; - this.MouseLeftButtonUp += DrawSurface_MouseLeftButtonUp; + this.PreviewMouseLeftButtonDown += DrawSurface_PreviewMouseLeftButtonDown; + this.PreviewMouseLeftButtonUp += DrawSurface_MouseLeftButtonUp; } public void SetGraph(ParallelStacksGraph graph) @@ -56,7 +53,7 @@ namespace Debugger.AddIn.Pads.ParallelPad 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; dragStartedPoint = e.GetPosition(drawingSurface); @@ -77,6 +74,9 @@ namespace Debugger.AddIn.Pads.ParallelPad 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 (e.LeftButton == MouseButtonState.Pressed) @@ -84,8 +84,10 @@ namespace Debugger.AddIn.Pads.ParallelPad Cursor = Cursors.SizeAll; var point = e.GetPosition(drawingSurface); Vector v = point - dragStartedPoint; - translate.X += v.X / 200; - translate.Y += v.Y / 200; + ContentControl.Margin = new Thickness( + ContentControl.Margin.Left + v.X / 80, + ContentControl.Margin.Top + v.Y / 80, 0, 0); + e.Handled = true; } } @@ -113,9 +115,6 @@ namespace Debugger.AddIn.Pads.ParallelPad void Reset_Click(object sender, RoutedEventArgs e) { this.SliderControl.Value = 5; - - translate.X = 0; - translate.Y = 0; } #endregion diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStackPad.cs b/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStackPad.cs index 54dcc9ae32..3831e7d11f 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStackPad.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ParallelStackPad.cs @@ -71,77 +71,39 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads if (ParallelStacksView == ParallelStacksView.Threads) { - if (isMethodView) - { - // build method view for threads - using(new PrintTimes("Parallel stack - method view + threads refresh")) { - try { - // create all simple ThreadStacks - foreach (Thread thread in debuggedProcess.Threads) { - if (debuggedProcess.IsPaused) { - Utils.DoEvents(debuggedProcess); - } - CreateThreadStack(thread); + using(new PrintTimes("Parallel stack - method view + threads refresh")) { + try { + // create all simple ThreadStacks + foreach (Thread thread in debuggedProcess.Threads) { + if (debuggedProcess.IsPaused) { + Utils.DoEvents(debuggedProcess); } - - CreateMethodViewStacks(); + CreateThreadStack(thread); } - catch(AbortedBecauseDebuggeeResumedException) { } - catch(System.Exception) { - if (debuggedProcess == null || debuggedProcess.HasExited) { - // Process unexpectedly exited - } else { - throw; - } + } + catch(AbortedBecauseDebuggeeResumedException) { } + catch(System.Exception) { + if (debuggedProcess == null || debuggedProcess.HasExited) { + // Process unexpectedly exited + } else { + throw; } } } + + if (isMethodView) + { + // build method view for threads + CreateMethodViewStacks(); + } else { // normal view - using(new PrintTimes("Parallel stack - threads refresh")) { - 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); + CreateCommonStacks(); } } else { - MessageBox.Show( - "Not yet supported", "Tasks view", MessageBoxButton.OK, MessageBoxImage.Information); - - // TODO : hadle tasks here if (isMethodView) { // build method view for tasks @@ -150,7 +112,20 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads { // 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); } } @@ -399,7 +374,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads private void CreateMethodViewStacks() { - var list = + var list = new List, ObservableCollection, List>>(); // find all threadstacks that contains the selected frame diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ThreadStack.xaml.cs b/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ThreadStack.xaml.cs index 03e417e3cb..04f7f16bad 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/ParallelPad/ThreadStack.xaml.cs +++ b/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) { + if (Process.IsRunning) + return; + StackPanel panel = new StackPanel(); dynamic selectedItem = datagrid.SelectedItem;