diff options
author | Matt Ward <matt.ward@microsoft.com> | 2019-11-26 22:01:25 +0300 |
---|---|---|
committer | monojenkins <jo.shields+jenkins@xamarin.com> | 2019-11-28 13:00:13 +0300 |
commit | 832a9562bfddd90ecaa732bb4e557c1b14b9196c (patch) | |
tree | 291a776c20c77bc958073de47f8b0f50bfbdc325 | |
parent | 0e8ec1ef61c5958238df4b3a5b99de7a225830de (diff) |
[Debugger] Enable native tree view on Mac for Exception Caught dialog
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs | 73 |
1 files changed, 54 insertions, 19 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs index d696bbcaff..b8beef69f7 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs @@ -30,6 +30,7 @@ using System.IO; using System.Linq; using System.Collections.Generic; +using Foundation; using Gtk; using Mono.Debugging.Client; @@ -56,6 +57,7 @@ namespace MonoDevelop.Debugger VBox vboxAroundInnerExceptionMessage, rightVBox, container; Button close, helpLinkButton, innerExceptionHelpLinkButton; TreeView exceptionValueTreeView, stackTraceTreeView; + MacObjectValueTreeView macExceptionValueTreeView; Expander expanderProperties, expanderStacktrace; InnerExceptionsTree innerExceptionsTreeView; ObjectValueTreeViewController controller; @@ -181,12 +183,17 @@ widget ""*.exception_help_link_label"" style ""exception-help-link-label"" Widget CreateExceptionValueTreeView () { + Widget scrolledWidget = null; if (useNewTreeView) { controller = new ObjectValueTreeViewController (); controller.SetStackFrame (DebuggingService.CurrentFrame); controller.AllowExpanding = true; - exceptionValueTreeView = controller.GetGtkControl (ObjectValueTreeViewFlags.ExceptionCaughtFlags); + if (Platform.IsMac) { + macExceptionValueTreeView = controller.GetMacControl (ObjectValueTreeViewFlags.ObjectValuePadFlags); + } else { + exceptionValueTreeView = controller.GetGtkControl (ObjectValueTreeViewFlags.ExceptionCaughtFlags); + } } else { var objValueTreeView = new ObjectValueTreeView (); objValueTreeView.Frame = DebuggingService.CurrentFrame; @@ -199,26 +206,54 @@ widget ""*.exception_help_link_label"" style ""exception-help-link-label"" exceptionValueTreeView = objValueTreeView; } - exceptionValueTreeView.ModifyBase (StateType.Normal, Styles.ExceptionCaughtDialog.ValueTreeBackgroundColor.ToGdkColor ()); - exceptionValueTreeView.ModifyBase (StateType.Active, Styles.ObjectValueTreeActiveBackgroundColor.ToGdkColor ()); - exceptionValueTreeView.ModifyFont (Pango.FontDescription.FromString (Platform.IsWindows ? "9" : "11")); - exceptionValueTreeView.RulesHint = false; - exceptionValueTreeView.CanFocus = true; - exceptionValueTreeView.Show (); - - var scrolled = new ScrolledWindow { - HeightRequest = 180, - CanFocus = true, - HscrollbarPolicy = PolicyType.Automatic, - VscrollbarPolicy = PolicyType.Automatic - }; - - scrolled.ShadowType = ShadowType.None; - scrolled.Add (exceptionValueTreeView); - scrolled.Show (); + if (useNewTreeView && Platform.IsMac) { + var scrolled = new AppKit.NSScrollView { + DocumentView = macExceptionValueTreeView, + AutohidesScrollers = false, + HasVerticalScroller = true, + HasHorizontalScroller = true, + }; + + // disable implicit animations + scrolled.WantsLayer = true; + scrolled.Layer.Actions = new NSDictionary ( + "actions", NSNull.Null, + "contents", NSNull.Null, + "hidden", NSNull.Null, + "onLayout", NSNull.Null, + "onOrderIn", NSNull.Null, + "onOrderOut", NSNull.Null, + "position", NSNull.Null, + "sublayers", NSNull.Null, + "transform", NSNull.Null, + "bounds", NSNull.Null); + + var host = new GtkNSViewHost (scrolled); + host.ShowAll (); + scrolledWidget = host; + } else { + exceptionValueTreeView.ModifyBase (StateType.Normal, Styles.ExceptionCaughtDialog.ValueTreeBackgroundColor.ToGdkColor ()); + exceptionValueTreeView.ModifyBase (StateType.Active, Styles.ObjectValueTreeActiveBackgroundColor.ToGdkColor ()); + exceptionValueTreeView.ModifyFont (Pango.FontDescription.FromString (Platform.IsWindows ? "9" : "11")); + exceptionValueTreeView.RulesHint = false; + exceptionValueTreeView.CanFocus = true; + exceptionValueTreeView.Show (); + + var scrolled = new ScrolledWindow { + HeightRequest = 180, + CanFocus = true, + HscrollbarPolicy = PolicyType.Automatic, + VscrollbarPolicy = PolicyType.Automatic + }; + + scrolled.ShadowType = ShadowType.None; + scrolled.Add (exceptionValueTreeView); + scrolled.Show (); + scrolledWidget = scrolled; + } var vbox = new VBox (); - expanderProperties = WrapInExpander (GettextCatalog.GetString ("Properties"), scrolled); + expanderProperties = WrapInExpander (GettextCatalog.GetString ("Properties"), scrolledWidget); vbox.PackStart (new VBox (), false, false, 5); vbox.PackStart (expanderProperties, true, true, 0); vbox.ShowAll (); |