3232
3333namespace MonoDevelop . Debugger . VSTextView . PinnedWatches
3434{
35- sealed class PinnedWatchView : NSScrollView
35+ sealed class PinnedWatchView : NSView
3636 {
37+ readonly PinnedWatch watch ;
38+ readonly StackFrame frame ;
3739 readonly ObjectValueTreeViewController controller ;
3840 readonly NSLayoutConstraint heightConstraint ;
3941 readonly NSLayoutConstraint widthConstraint ;
4042 readonly MacObjectValueTreeView treeView ;
43+ MacDebuggerTooltipWindow popover ;
4144 NSLayoutConstraint superHeightConstraint ;
4245 NSLayoutConstraint superWidthConstraint ;
4346 ObjectValue objectValue ;
4447 bool disposed ;
4548
4649 public PinnedWatchView ( PinnedWatch watch , StackFrame frame )
4750 {
48- HasVerticalScroller = true ;
49- AutohidesScrollers = true ;
51+ this . watch = watch ?? throw new ArgumentNullException ( nameof ( watch ) ) ;
52+ this . frame = frame ;
5053
5154 controller = new ObjectValueTreeViewController ( ) ;
5255 controller . SetStackFrame ( frame ) ;
5356 controller . AllowEditing = true ;
57+ controller . AllowExpanding = false ;
5458
5559 treeView = controller . GetMacControl ( headersVisible : false , compactView : true , allowPinning : true ) ;
5660
5761 controller . PinnedWatch = watch ;
5862
5963 if ( watch . Value != null )
60- controller . AddValue ( watch . Value ) ;
64+ controller . AddValue ( objectValue = watch . Value ) ;
6165
6266 var rect = treeView . Frame ;
6367
6468 if ( rect . Height < 1 )
6569 treeView . Frame = new CoreGraphics . CGRect ( rect . X , rect . Y , rect . Width , 19 ) ;
6670
67- DocumentView = treeView ;
71+ AddSubview ( treeView ) ;
6872 Frame = treeView . Frame ;
6973
7074 heightConstraint = HeightAnchor . ConstraintEqualToConstant ( treeView . Frame . Height ) ;
@@ -76,6 +80,27 @@ public PinnedWatchView (PinnedWatch watch, StackFrame frame)
7680 DebuggingService . ResumedEvent += OnDebuggerResumed ;
7781 DebuggingService . PausedEvent += OnDebuggerPaused ;
7882 treeView . Resized += OnTreeViewResized ;
83+
84+ AddTrackingArea ( new NSTrackingArea (
85+ default ,
86+ NSTrackingAreaOptions . ActiveInActiveApp |
87+ NSTrackingAreaOptions . InVisibleRect |
88+ NSTrackingAreaOptions . MouseEnteredAndExited ,
89+ this ,
90+ null ) ) ;
91+ }
92+
93+ public override void MouseEntered ( NSEvent theEvent )
94+ {
95+ if ( popover != null && popover . Shown )
96+ return ;
97+
98+ if ( objectValue != null && objectValue . HasChildren ) {
99+ if ( popover == null )
100+ popover = new MacDebuggerTooltipWindow ( watch . Location , frame , objectValue , watch ) ;
101+ popover . Show ( treeView . Frame , this , NSRectEdge . MaxXEdge ) ;
102+ popover . Expand ( ) ;
103+ }
79104 }
80105
81106 public void Refresh ( )
@@ -141,41 +166,16 @@ void OnTreeViewResized (object sender, EventArgs e)
141166
142167 superHeightConstraint . Constant = height ;
143168 superWidthConstraint . Constant = width ;
144-
145- #if REPARENT_SO_SCROLLING_WORKS
146- // Find our parent CocoaEditorGridView
147- var gridView = textView . Superview ;
148- while ( gridView != null && gridView . GetType ( ) . Name != CocoaEditorGridView )
149- gridView = gridView . Superview ;
150-
151- if ( gridView == null )
152- return ;
153-
154- // Find the CocoaTextViewScrollView
155- NSView textViewScrollView = null ;
156- foreach ( var child in gridView . Subviews ) {
157- if ( child . GetType ( ) . Name == CocoaTextViewScrollView ) {
158- textViewScrollView = child ;
159- break ;
160- }
161- }
162-
163- materialView . RemoveFromSuperview ( ) ;
164-
165- gridView . AddSubview ( materialView , NSWindowOrderingMode . Above , textViewScrollView ) ;
166- #endif
167169 }
168170
169171 void OnDebuggerResumed ( object sender , EventArgs e )
170172 {
171173 controller . ChangeCheckpoint ( ) ;
172- controller . AllowExpanding = false ;
173174 controller . AllowEditing = false ;
174175 }
175176
176177 void OnDebuggerPaused ( object sender , EventArgs e )
177178 {
178- controller . AllowExpanding = true ;
179179 controller . AllowEditing = true ;
180180 }
181181
0 commit comments