diff options
Diffstat (limited to 'main/src/addins')
5 files changed, 41 insertions, 18 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 eee1df7af6..6827a7ae10 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 @@ -126,8 +126,8 @@ namespace MonoDevelop.Debugger.VSTextView.PinnedWatches var origin = textView.ConvertPointFromView (Frame.Location, this); var maxHeight = NMath.Max (textView.Frame.Bottom - origin.Y, treeView.RowHeight * 2); - var height = treeView.FittingSize.Height; - var width = treeView.Frame.Width; + var height = (treeView.RowHeight + treeView.IntercellSpacing.Height) * treeView.RowCount; + var width = treeView.OptimalTooltipWidth; height = NMath.Min (height, maxHeight); 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 64c05cb3a1..eba622d244 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 @@ -69,7 +69,7 @@ namespace MonoDevelop.Debugger View = scrollView }; - widthConstraint = scrollView.WidthAnchor.ConstraintEqualToAnchor (treeView.WidthAnchor); + widthConstraint = scrollView.WidthAnchor.ConstraintEqualToConstant (treeView.Frame.Width); widthConstraint.Active = true; heightConstraint = scrollView.HeightAnchor.ConstraintEqualToConstant (treeView.Frame.Height); @@ -108,12 +108,16 @@ namespace MonoDevelop.Debugger void OnTreeViewResized (object sender, EventArgs e) { - Console.WriteLine ("OnTreeViewResized: treeView.Frame.Width = {0}", treeView.Frame.Width); + var height = (treeView.RowHeight + treeView.IntercellSpacing.Height) * treeView.RowCount; var maxHeight = GetMaxHeight (treeView.Window); - var height = treeView.FittingSize.Height; height = NMath.Min (height, maxHeight); + Console.WriteLine ("OnTreeViewResized()"); + Console.WriteLine ("\told size = {0}x{1}", widthConstraint.Constant, heightConstraint.Constant); + Console.WriteLine ("\tnew size = {0}x{1}", treeView.OptimalTooltipWidth, height); + + widthConstraint.Constant = treeView.OptimalTooltipWidth; heightConstraint.Constant = height; } diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectCellViewBase.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectCellViewBase.cs index 117c6d61bb..880e3961fe 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectCellViewBase.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectCellViewBase.cs @@ -171,7 +171,7 @@ namespace MonoDevelop.Debugger modified?.Dispose (); - return width; + return NMath.Ceiling (width + 2); } protected void UpdateFont (NSControl control, int sizeDelta = 0) diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectValueView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectValueView.cs index a7e294d348..1ed8e95423 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectValueView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectValueView.cs @@ -321,7 +321,6 @@ namespace MonoDevelop.Debugger public static nfloat GetOptimalWidth (MacObjectValueTreeView treeView, ObjectValueNode node, bool hideValueButton) { nfloat optimalWidth = MarginSize; - string evaluateStatusIcon = null; string valueButtonText = null; var showViewerButton = false; @@ -392,8 +391,8 @@ namespace MonoDevelop.Debugger // Third Item: Value Button if (valueButtonText != null && !hideValueButton) { - // FIXME: what left/right padding do we need to add for the button around the button label? 6px? - optimalWidth += GetWidthForString (treeView.CustomFont, valueButtonText, -3) + 6; + // FIXME: what left/right padding do we need to add for the button around the button label? 4px? + optimalWidth += GetWidthForString (treeView.CustomFont, valueButtonText, -3) + 4; optimalWidth += RowCellSpacing; } 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 df3a14b467..6ecde768f1 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 @@ -213,12 +213,21 @@ namespace MonoDevelop.Debugger } } + /// <summary> + /// Gets the optimal tooltip window width in order to display the name/value/pin columns w/o truncation. + /// </summary> + public nfloat OptimalTooltipWidth { + get; private set; + } + // Note: this resizing method is the one used by debugger tooltips and pinned watches in the editor void OptimizeColumnSizes (bool emitResized = true) { if (!compactView || Superview == null || RowCount == 0) return; + Console.WriteLine ("OptimizeColumnSizes({0})", emitResized); + nfloat nameWidth = MinimumNameColumnWidth; nfloat valueWidth = MinimumValueColumnWidth; @@ -237,31 +246,32 @@ namespace MonoDevelop.Debugger bool changed = false; - if (nameColumn.Width != nameWidth) { + if ((int) nameColumn.Width != (int) nameWidth) { nameColumn.MinWidth = nameColumn.Width = nameWidth; changed = true; } - if (valueColumn.Width != valueWidth) { + if ((int) valueColumn.Width != (int) valueWidth) { valueColumn.MinWidth = valueColumn.Width = valueWidth; changed = true; } + Console.WriteLine ("\tchanged = {0}", changed); + if (changed) { - var optimalWidth = nameColumn.Width + valueColumn.Width + pinColumn.Width; - Console.WriteLine ("OptimizeColumnWidths: optimal width = {0}", optimalWidth); + var optimalTooltipWidth = nameWidth + valueWidth + pinColumn.Width + IntercellSpacing.Width * 2; - var size = Frame.Size; - size.Width = optimalWidth; - SetFrameSize (size); + Console.WriteLine ("\tOptimalTooltipWidth: old = {0}, new = {1}", OptimalTooltipWidth, optimalTooltipWidth); - //SizeToFit (); + OptimalTooltipWidth = optimalTooltipWidth; if (emitResized) OnResized (); + + SizeToFit (); } - ReloadData (); + //ReloadData (); SetNeedsDisplayInRect (Frame); } @@ -321,24 +331,28 @@ namespace MonoDevelop.Debugger public override void ViewDidMoveToSuperview () { base.ViewDidMoveToSuperview (); + Console.WriteLine ("ViewDidMoveToSuperview()"); OptimizeColumnSizes (); } public override void ViewDidMoveToWindow () { base.ViewDidMoveToWindow (); + Console.WriteLine ("ViewDidMoveToWindow()"); OptimizeColumnSizes (); } public override void ViewDidEndLiveResize () { base.ViewDidEndLiveResize (); + Console.WriteLine ("ViewDidEndLiveResize()"); OptimizeColumnSizes (); } public override void ViewDidUnhide () { base.ViewDidHide (); + Console.WriteLine ("ViewDidUnhide()"); OptimizeColumnSizes (); } @@ -355,6 +369,7 @@ namespace MonoDevelop.Debugger public override void ExpandItem (NSObject item, bool expandChildren) { + Console.WriteLine ("ExpandItem(item, expandChildren = {0})", expandChildren); NSAnimationContext.BeginGrouping (); NSAnimationContext.CurrentContext.Duration = 0; base.ExpandItem (item, expandChildren); @@ -365,6 +380,7 @@ namespace MonoDevelop.Debugger public override void ExpandItem (NSObject item) { + Console.WriteLine ("ExpandItem(item)"); NSAnimationContext.BeginGrouping (); NSAnimationContext.CurrentContext.Duration = 0; base.ExpandItem (item); @@ -385,6 +401,7 @@ namespace MonoDevelop.Debugger public override void CollapseItem (NSObject item, bool collapseChildren) { + Console.WriteLine ("CollapseItem(item, collapseChildren = {0})", collapseChildren); NSAnimationContext.BeginGrouping (); NSAnimationContext.CurrentContext.Duration = 0; base.CollapseItem (item, collapseChildren); @@ -395,6 +412,7 @@ namespace MonoDevelop.Debugger public override void CollapseItem (NSObject item) { + Console.WriteLine ("CollapseItem(item)"); NSAnimationContext.BeginGrouping (); NSAnimationContext.CurrentContext.Duration = 0; base.CollapseItem (item); @@ -549,6 +567,7 @@ namespace MonoDevelop.Debugger return; dataSource.Replace (node, replacementNodes); + Console.WriteLine ("OnEvaluationCompleted()"); OptimizeColumnSizes (false); OnResized (); } @@ -564,6 +583,7 @@ namespace MonoDevelop.Debugger return; dataSource.ReloadChildren (node); + Console.WriteLine ("OnChildrenLoaded()"); OptimizeColumnSizes (false); OnResized (); } |