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

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

@ -8,26 +8,23 @@ using System.Windows.Input; @@ -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 @@ -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 @@ -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 @@ -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 @@ -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

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

@ -71,9 +71,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -71,9 +71,6 @@ 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
@ -83,8 +80,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -83,8 +80,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
}
CreateThreadStack(thread);
}
CreateMethodViewStacks();
}
catch(AbortedBecauseDebuggeeResumedException) { }
catch(System.Exception) {
@ -95,30 +90,27 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -95,30 +90,27 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
}
}
}
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;
}
else
{
if (isMethodView)
{
// build method view for tasks
}
else
{
// normal
}
}
@ -136,23 +128,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -136,23 +128,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
surface.SetGraph(graph);
}
}
else
{
MessageBox.Show(
"Not yet supported", "Tasks view", MessageBoxButton.OK, MessageBoxImage.Information);
// TODO : hadle tasks here
if (isMethodView)
{
// build method view for tasks
}
else
{
// normal
}
surface.SetGraph(new ParallelStacksGraph());
}
}
protected override ToolBar BuildToolBar()
{

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

@ -247,6 +247,9 @@ namespace Debugger.AddIn.Pads.ParallelPad @@ -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;

Loading…
Cancel
Save