diff options
Diffstat (limited to 'main/src/addins')
4 files changed, 50 insertions, 39 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; } diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/MacDebuggerTooltipWindow.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/MacDebuggerTooltipWindow.cs index 1f508f5eca..80ffe9bc4a 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/MacDebuggerTooltipWindow.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/MacDebuggerTooltipWindow.cs @@ -78,6 +78,11 @@ namespace MonoDevelop.Debugger treeView.Resized += OnTreeViewResized; } + public void Expand () + { + treeView.ExpandItem (treeView.ItemAtRow (0), false); + } + public DebuggerSession GetDebuggerSession () { return controller.GetStackFrame ()?.DebuggerSession; diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs index 2a43053cfe..47bf09fbc0 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs @@ -191,9 +191,11 @@ namespace MonoDevelop.Debugger public PinnedWatch PinnedWatch { get => pinnedWatch; set { - if (pinnedWatch != value) { + if (pinnedWatch != value && pinColumn != null) { pinnedWatch = value; Runtime.RunInMainThread (() => { + if (pinColumn == null) + return; if (value == null) { pinColumn.MinWidth = pinColumn.MaxWidth = pinColumn.Width = MacDebuggerObjectPinView.MinWidth; } else { diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeViewDataSource.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeViewDataSource.cs index e257c352c5..8a4c282cfe 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeViewDataSource.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeViewDataSource.cs @@ -75,11 +75,13 @@ namespace MonoDevelop.Debugger parent.Children.Add (value); - foreach (var child in node.Children) - Add (value, child); + if (treeView.AllowExpanding) { + foreach (var child in node.Children) + Add (value, child); - if (node.HasChildren && !node.ChildrenLoaded) - Add (value, new LoadingObjectValueNode (node)); + if (node.HasChildren && !node.ChildrenLoaded) + Add (value, new LoadingObjectValueNode (node)); + } } void Insert (MacObjectValueNode parent, int index, ObjectValueNode node) @@ -89,11 +91,13 @@ namespace MonoDevelop.Debugger parent.Children.Insert (index, value); - foreach (var child in node.Children) - Add (value, child); + if (treeView.AllowExpanding) { + foreach (var child in node.Children) + Add (value, child); - if (node.HasChildren && !node.ChildrenLoaded) - Add (value, new LoadingObjectValueNode (node)); + if (node.HasChildren && !node.ChildrenLoaded) + Add (value, new LoadingObjectValueNode (node)); + } } void Remove (MacObjectValueNode node, List<MacObjectValueNode> removed) |