@@ -40,9 +40,9 @@ namespace MonoDevelop.Debugger
4040{
4141 public class MacObjectValueTreeView : NSOutlineView , IObjectValueTreeView
4242 {
43- const int MinimumNameColumnWidth = 48 ;
44- const int MinimumValueColumnWidth = 64 ;
45- const int MinimumTypeColumnWidth = 48 ;
43+ const int MinimumNameColumnWidth = 45 ;
44+ const int MinimumValueColumnWidth = 75 ;
45+ const int MinimumTypeColumnWidth = 30 ;
4646
4747 MacObjectValueTreeViewDelegate treeViewDelegate ;
4848 MacObjectValueTreeViewDataSource dataSource ;
@@ -59,13 +59,7 @@ public class MacObjectValueTreeView : NSOutlineView, IObjectValueTreeView
5959
6060 PreviewButtonIcon currentHoverIcon ;
6161 nint currentHoverRow = - 1 ;
62-
63- double nameColumnWidth = 0.3 ;
64- double valueColumnWidth = 0.5 ;
65- double typeColumnWidth = 0.2 ;
66-
6762 bool allowEditing ;
68- bool autoresizing ;
6963 bool disposed ;
7064
7165 public MacObjectValueTreeView (
@@ -88,30 +82,33 @@ public MacObjectValueTreeView (
8882
8983 DataSource = dataSource = new MacObjectValueTreeViewDataSource ( this , controller . Root , controller . AllowWatchExpressions ) ;
9084 Delegate = treeViewDelegate = new MacObjectValueTreeViewDelegate ( this ) ;
91- ColumnAutoresizingStyle = NSTableViewColumnAutoresizingStyle . None ;
85+ ColumnAutoresizingStyle = compactView ? NSTableViewColumnAutoresizingStyle . None : NSTableViewColumnAutoresizingStyle . Uniform ;
9286 treeViewDelegate . SelectionChanged += OnSelectionChanged ;
9387 UsesAlternatingRowBackgroundColors = true ;
9488 FocusRingType = NSFocusRingType . None ;
9589 AutoresizesOutlineColumn = false ;
9690 AllowsColumnResizing = ! compactView ;
9791
98- var resizingMask = compactView ? NSTableColumnResizing . None : NSTableColumnResizing . UserResizingMask ;
92+ var resizingMask = compactView ? NSTableColumnResizing . None : NSTableColumnResizing . UserResizingMask | NSTableColumnResizing . Autoresizing ;
9993
10094 nameColumn = new NSTableColumn ( "name" ) { Editable = controller . AllowWatchExpressions , MinWidth = MinimumNameColumnWidth , ResizingMask = resizingMask } ;
10195 nameColumn . Title = GettextCatalog . GetString ( "Name" ) ;
96+ nameColumn . Width = MinimumNameColumnWidth * 2 ;
10297 AddColumn ( nameColumn ) ;
10398
10499 OutlineTableColumn = nameColumn ;
105100
106101 valueColumn = new NSTableColumn ( "value" ) { Editable = controller . AllowEditing , MinWidth = MinimumValueColumnWidth , ResizingMask = resizingMask } ;
107102 valueColumn . Title = GettextCatalog . GetString ( "Value" ) ;
103+ valueColumn . Width = MinimumValueColumnWidth * 2 ;
108104 if ( compactView )
109105 valueColumn . MaxWidth = 800 ;
110106 AddColumn ( valueColumn ) ;
111107
112108 if ( ! compactView ) {
113109 typeColumn = new NSTableColumn ( "type" ) { Editable = false , MinWidth = MinimumTypeColumnWidth , ResizingMask = resizingMask } ;
114110 typeColumn . Title = GettextCatalog . GetString ( "Type" ) ;
111+ typeColumn . Width = MinimumTypeColumnWidth * 2 ;
115112 AddColumn ( typeColumn ) ;
116113 }
117114
@@ -213,53 +210,6 @@ public int PinnedWatchOffset {
213210 }
214211 }
215212
216- double GetVisibleTableWidth ( )
217- {
218- var scrollView = EnclosingScrollView ;
219-
220- if ( scrollView != null )
221- return scrollView . DocumentVisibleRect . Width ;
222-
223- return VisibleRect ( ) . Width ;
224- }
225-
226- internal void OnColumnResized ( )
227- {
228- if ( autoresizing || compactView )
229- return ;
230-
231- var width = GetVisibleTableWidth ( ) ;
232-
233- nameColumnWidth = nameColumn . Width / width ;
234- valueColumnWidth = valueColumn . Width / width ;
235- typeColumnWidth = typeColumn . Width / width ;
236- }
237-
238- // Note: this resizing method is the one used by the Locals pad and the Watches pad
239- void ScaleColumnSizesToFit ( )
240- {
241- if ( compactView || Superview == null || RowCount == 0 )
242- return ;
243-
244- var totalWidth = GetVisibleTableWidth ( ) ;
245- int columnWidth ;
246-
247- try {
248- autoresizing = true ;
249-
250- columnWidth = Math . Max ( ( int ) ( totalWidth * valueColumnWidth ) , MinimumNameColumnWidth ) ;
251- valueColumn . Width = columnWidth ;
252-
253- columnWidth = Math . Max ( ( int ) ( totalWidth * nameColumnWidth ) , MinimumValueColumnWidth ) ;
254- nameColumn . Width = columnWidth ;
255-
256- columnWidth = Math . Max ( ( int ) ( totalWidth * typeColumnWidth ) , MinimumTypeColumnWidth ) ;
257- typeColumn . Width = columnWidth ;
258- } finally {
259- autoresizing = false ;
260- }
261- }
262-
263213 // Note: this resizing method is the one used by debugger tooltips and pinned watches in the editor
264214 void OptimizeColumnSizes ( bool emitResized = true )
265215 {
@@ -296,39 +246,27 @@ void OptimizeColumnSizes (bool emitResized = true)
296246 }
297247 }
298248
299- try {
300- autoresizing = true ;
249+ bool changed = false ;
301250
302- bool changed = false ;
303- if ( nameColumn . Width != nameWidth ) {
304- nameColumn . MinWidth = nameColumn . Width = nameWidth ;
305- changed = true ;
306- }
307- if ( valueColumn . Width != valueWidth ) {
308- valueColumn . MinWidth = valueColumn . Width = valueWidth ;
309- changed = true ;
310- }
251+ if ( nameColumn . Width != nameWidth ) {
252+ nameColumn . MinWidth = nameColumn . Width = nameWidth ;
253+ changed = true ;
254+ }
311255
312- if ( changed ) {
313- SizeToFit ( ) ;
256+ if ( valueColumn . Width != valueWidth ) {
257+ valueColumn . MinWidth = valueColumn . Width = valueWidth ;
258+ changed = true ;
259+ }
314260
315- if ( emitResized )
316- OnResized ( ) ;
317- }
261+ if ( changed ) {
262+ SizeToFit ( ) ;
318263
319- ReloadData ( ) ;
320- SetNeedsDisplayInRect ( Frame ) ;
321- } finally {
322- autoresizing = false ;
264+ if ( emitResized )
265+ OnResized ( ) ;
323266 }
324- }
325267
326- void UpdateColumnSizes ( )
327- {
328- if ( compactView )
329- OptimizeColumnSizes ( ) ;
330- else
331- ScaleColumnSizesToFit ( ) ;
268+ ReloadData ( ) ;
269+ SetNeedsDisplayInRect ( Frame ) ;
332270 }
333271
334272 static NSFont GetNSFontFromPangoFontDescription ( Pango . FontDescription fontDescription )
@@ -375,35 +313,25 @@ internal void QueueResize ()
375313 public override void ViewDidMoveToSuperview ( )
376314 {
377315 base . ViewDidMoveToSuperview ( ) ;
378- UpdateColumnSizes ( ) ;
316+ OptimizeColumnSizes ( ) ;
379317 }
380318
381319 public override void ViewDidMoveToWindow ( )
382320 {
383321 base . ViewDidMoveToWindow ( ) ;
384-
385- if ( compactView )
386- OptimizeColumnSizes ( ) ;
322+ OptimizeColumnSizes ( ) ;
387323 }
388324
389325 public override void ViewDidEndLiveResize ( )
390326 {
391327 base . ViewDidEndLiveResize ( ) ;
392- UpdateColumnSizes ( ) ;
328+ OptimizeColumnSizes ( ) ;
393329 }
394330
395331 public override void ViewDidUnhide ( )
396332 {
397333 base . ViewDidHide ( ) ;
398- UpdateColumnSizes ( ) ;
399- }
400-
401- public override void SetFrameSize ( CGSize newSize )
402- {
403- base . SetFrameSize ( newSize ) ;
404-
405- //if (!autoresizing && !compactView)
406- // ScaleColumnSizesToFit ();
334+ OptimizeColumnSizes ( ) ;
407335 }
408336
409337 /// <summary>
0 commit comments