Skip to content

Instantly share code, notes, and snippets.

@abock
Created March 3, 2019 15:46
Show Gist options
  • Save abock/05490c5cbe90609c877a8ff09838712e to your computer and use it in GitHub Desktop.
Save abock/05490c5cbe90609c877a8ff09838712e to your computer and use it in GitHub Desktop.
diff --git a/main/external/vs-editor-core b/main/external/vs-editor-core
index de514b321e..47276defe8 160000
--- a/main/external/vs-editor-core
+++ b/main/external/vs-editor-core
@@ -1 +1 @@
-Subproject commit de514b321eb0c941f23e45b2f5a812055df93ebe
+Subproject commit 47276defe80eba388835c6217d111921d06648cd
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs
index 9723c2036e..5343baf7ce 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs
@@ -4,6 +4,7 @@ using CoreGraphics;
using Foundation;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
+
using Mono.Debugging.Client;
using MonoDevelop.Components;
using MonoDevelop.Components.Mac;
@@ -94,9 +95,38 @@ namespace MonoDevelop.Debugger.VSTextView.ExceptionCaught
return nsButton;
}
+ static readonly nfloat shadowRadius = ObjCRuntime.Dlfcn.GetNFloat (
+ ObjCRuntime.Dlfcn.dlopen (ObjCRuntime.Constants.CoreGraphicsLibrary, 0),
+ "kCGWindowShadowRadius");
+
private NSView CreateButton (ExceptionCaughtButton button)
{
+ var popover = new NSView ();
+ popover.TranslatesAutoresizingMaskIntoConstraints = false;
+ popover.Shadow = new NSShadow {
+ ShadowColor = NSColor.Black,
+ ShadowBlurRadius = shadowRadius
+ };
+
+ var effectView = new NSVisualEffectView ();
+ effectView.Material = NSVisualEffectMaterial.Popover;
+ effectView.BlendingMode = NSVisualEffectBlendingMode.WithinWindow;
+
+ popover.AddSubview (effectView);
+ effectView.TranslatesAutoresizingMaskIntoConstraints = false;
+ effectView.LeadingAnchor.ConstraintEqualToAnchor (popover.LeadingAnchor, 10).Active = true;
+ effectView.TrailingAnchor.ConstraintEqualToAnchor (popover.TrailingAnchor, -10).Active = true;
+ effectView.TopAnchor.ConstraintEqualToAnchor (popover.TopAnchor, 10).Active = true;
+ effectView.BottomAnchor.ConstraintEqualToAnchor (popover.BottomAnchor, -10).Active = true;
+
var box = new NSGridView ();
+ effectView.AddSubview (box);
+ box.TranslatesAutoresizingMaskIntoConstraints = false;
+ box.LeadingAnchor.ConstraintEqualToAnchor (effectView.LeadingAnchor).Active = true;
+ box.TrailingAnchor.ConstraintEqualToAnchor (effectView.TrailingAnchor).Active = true;
+ box.TopAnchor.ConstraintEqualToAnchor (effectView.TopAnchor).Active = true;
+ box.BottomAnchor.ConstraintEqualToAnchor (effectView.BottomAnchor).Active = true;
+
var ligthingImage = new NSImageView { Image = Xwt.Drawing.Image.FromResource ("lightning-16.png").ToNSImage () };
ligthingImage.TranslatesAutoresizingMaskIntoConstraints = false;
box.AddColumn (new [] { ligthingImage });
@@ -128,9 +158,8 @@ namespace MonoDevelop.Debugger.VSTextView.ExceptionCaught
};
LoadData (button.exception, messageLabel, typeLabel);
box.SetFrameSize (box.FittingSize);
- box.WantsLayer = true;
- box.Layer.BackgroundColor = MonoDevelop.Ide.Gui.Styles.PopoverWindow.DefaultBackgroundColor.ToCGColor ();
- return box;
+
+ return popover;
}
static NSTextField CreateTextField ( )
@@ -157,15 +186,15 @@ namespace MonoDevelop.Debugger.VSTextView.ExceptionCaught
messageLabel.Hidden = true;
}
if (!string.IsNullOrEmpty (exception.Type)) {
- var str = GettextCatalog.GetString ("<b>{0}</b> has been thrown", exception.Type);
- var indexOfStartBold = str.IndexOf ("<b>", StringComparison.Ordinal);
- var indexOfEndBold = str.IndexOf ("</b>", StringComparison.Ordinal);
- str = str.Remove (indexOfStartBold, indexOfEndBold + 4 - indexOfStartBold);//Remove <b>TypeName</b>
- var mutableString = new NSMutableAttributedString (str);
- mutableString.Insert (new NSAttributedString (exception.Type, new NSStringAttributes {
- Font = NSFont.BoldSystemFontOfSize (NSFont.SystemFontSize)
- }), indexOfStartBold);
- typeLabel.AttributedStringValue = mutableString;
+ var formattedStr = (NSMutableAttributedString)Xwt
+ .FormattedText
+ .FromMarkup (GettextCatalog.GetString ("<b>{0}</b> has been thrown", exception.Type))
+ .ToAttributedString ();
+ formattedStr.AddAttribute (
+ NSStringAttributeKey.Font,
+ NSFont.UserFixedPitchFontOfSize (16),
+ new NSRange (0, formattedStr.Length));
+ typeLabel.AttributedStringValue = formattedStr;
typeLabel.Hidden = false;
} else {
typeLabel.Hidden = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment