diff options
author | Sandy Armstrong <sandy@xamarin.com> | 2019-11-14 21:31:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-14 21:31:00 +0300 |
commit | 3b7961bbbccdacb4cefe472cd964db2222b12a81 (patch) | |
tree | ed6375bccf4d92ebadaca4b6216e109a44d4938c /main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches | |
parent | 0ada7904fce8c6b87b8a85443b50ab62d0cda3ab (diff) | |
parent | 1758e1ac67a3f9e41444f6716ec76d08090dc8b2 (diff) |
Merge pull request #9301 from mono/backport-pr-9284-to-release-8.4
[release-8.4] [Debugger] Simplify PinnedWatchView, allow scrolling children via popover
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchView.cs | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchView.cs index c4f994e08f..c9181053ef 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchView.cs @@ -32,12 +32,15 @@ using Mono.Debugging.Client; namespace MonoDevelop.Debugger.VSTextView.PinnedWatches { - sealed class PinnedWatchView : NSScrollView + sealed class PinnedWatchView : NSView { + readonly PinnedWatch watch; + readonly StackFrame frame; readonly ObjectValueTreeViewController controller; readonly NSLayoutConstraint heightConstraint; readonly NSLayoutConstraint widthConstraint; readonly MacObjectValueTreeView treeView; + MacDebuggerTooltipWindow popover; NSLayoutConstraint superHeightConstraint; NSLayoutConstraint superWidthConstraint; ObjectValue objectValue; @@ -45,26 +48,27 @@ namespace MonoDevelop.Debugger.VSTextView.PinnedWatches public PinnedWatchView (PinnedWatch watch, StackFrame frame) { - HasVerticalScroller = true; - AutohidesScrollers = true; + this.watch = watch ?? throw new ArgumentNullException (nameof (watch)); + this.frame = frame; controller = new ObjectValueTreeViewController (); controller.SetStackFrame (frame); controller.AllowEditing = true; + controller.AllowExpanding = false; treeView = controller.GetMacControl (headersVisible: false, compactView: true, allowPinning: true); controller.PinnedWatch = watch; if (watch.Value != null) - controller.AddValue (watch.Value); + controller.AddValue (objectValue = watch.Value); var rect = treeView.Frame; if (rect.Height < 1) treeView.Frame = new CoreGraphics.CGRect (rect.X, rect.Y, rect.Width, 19); - DocumentView = treeView; + AddSubview (treeView); Frame = treeView.Frame; heightConstraint = HeightAnchor.ConstraintEqualToConstant (treeView.Frame.Height); @@ -76,6 +80,27 @@ namespace MonoDevelop.Debugger.VSTextView.PinnedWatches DebuggingService.ResumedEvent += OnDebuggerResumed; DebuggingService.PausedEvent += OnDebuggerPaused; treeView.Resized += OnTreeViewResized; + + AddTrackingArea (new NSTrackingArea ( + default, + NSTrackingAreaOptions.ActiveInActiveApp | + NSTrackingAreaOptions.InVisibleRect | + NSTrackingAreaOptions.MouseEnteredAndExited, + this, + null)); + } + + public override void MouseEntered (NSEvent theEvent) + { + if (popover != null && popover.Shown) + return; + + if (objectValue != null && objectValue.HasChildren) { + if (popover == null) + popover = new MacDebuggerTooltipWindow (watch.Location, frame, objectValue, watch); + popover.Show (treeView.Frame, this, NSRectEdge.MaxXEdge); + popover.Expand (); + } } public void Refresh() @@ -141,41 +166,16 @@ namespace MonoDevelop.Debugger.VSTextView.PinnedWatches superHeightConstraint.Constant = height; superWidthConstraint.Constant = width; - -#if REPARENT_SO_SCROLLING_WORKS - // Find our parent CocoaEditorGridView - var gridView = textView.Superview; - while (gridView != null && gridView.GetType ().Name != CocoaEditorGridView) - gridView = gridView.Superview; - - if (gridView == null) - return; - - // Find the CocoaTextViewScrollView - NSView textViewScrollView = null; - foreach (var child in gridView.Subviews) { - if (child.GetType ().Name == CocoaTextViewScrollView) { - textViewScrollView = child; - break; - } - } - - materialView.RemoveFromSuperview (); - - gridView.AddSubview (materialView, NSWindowOrderingMode.Above, textViewScrollView); -#endif } void OnDebuggerResumed (object sender, EventArgs e) { controller.ChangeCheckpoint (); - controller.AllowExpanding = false; controller.AllowEditing = false; } void OnDebuggerPaused (object sender, EventArgs e) { - controller.AllowExpanding = true; controller.AllowEditing = true; } |