コード例 #1
0
 private void FileExtensionRemoved(object sender, FileExtensionEventArgs e)
 {
     if (e.Extension == extension)
     {
         extension = null;
         _exceptionCaughtLayer.RemoveAllAdornments();
     }
 }
コード例 #2
0
 private void FileExtensionRemoved(object sender, FileExtensionEventArgs e)
 {
     if (e.Extension == extension)
     {
         extension = null;
         _exceptionCaughtLayer.RemoveAllAdornments();
         if (exceptionCaughtButtonWindow != null)
         {
             exceptionCaughtButtonWindow.Close();
             exceptionCaughtButtonWindow = null;
         }
     }
 }
コード例 #3
0
        private void RenderAdornment(FileLineExtension fileLineExtension)
        {
            NSView view;
            bool   mini;

            if (fileLineExtension is ExceptionCaughtButton button)
            {
                mini = false;
                view = CreateButton(cocoaViewFactory, button);
            }
            else if (fileLineExtension is ExceptionCaughtMiniButton miniButton)
            {
                mini = true;
                view = CreateMiniButton(cocoaViewFactory, miniButton);
            }
            else
            {
                return;
            }
            if (extension != fileLineExtension)
            {
                extension = fileLineExtension;
                var newSpan = textView.TextSnapshot.SpanFromMDColumnAndLine(extension.Line, extension.Column, extension.Line, extension.Column);
                trackingSpan = textView.TextSnapshot.CreateTrackingSpan(newSpan, SpanTrackingMode.EdgeInclusive);
            }
            var span = trackingSpan.GetSpan(textView.TextSnapshot);

            if (textView.TextViewLines == null)
            {
                return;
            }
            if (!textView.TextViewLines.FormattedSpan.Contains(span.End))
            {
                return;
            }
            _exceptionCaughtLayer.RemoveAllAdornments();
            if (exceptionCaughtButtonWindow != null)
            {
                exceptionCaughtButtonWindow.Close();
                exceptionCaughtButtonWindow = null;
            }
            var charBound = textView.TextViewLines.GetCharacterBounds(span.End);

            if (mini)
            {
                try {
                    view.SetFrameOrigin(new CGPoint(
                                            Math.Round(charBound.Left),
                                            Math.Round(charBound.TextTop - charBound.TextHeight / 2 - view.Frame.Height / 2)));
                } catch (Exception e) {
                    view.SetFrameOrigin(default);
コード例 #4
0
        private void RenderAdornment(FileLineExtension fileLineExtension)
        {
            NSView view;

            if (fileLineExtension is ExceptionCaughtButton button)
            {
                view = CreateButton(cocoaViewFactory, button);
            }
            else if (fileLineExtension is ExceptionCaughtMiniButton miniButton)
            {
                view = CreateMiniButton(cocoaViewFactory, miniButton);
            }
            else
            {
                return;
            }
            if (extension != fileLineExtension)
            {
                extension = fileLineExtension;
                var newSpan = textView.TextSnapshot.SpanFromMDColumnAndLine(extension.Line, extension.Column, extension.Line, extension.Column);
                trackingSpan = textView.TextSnapshot.CreateTrackingSpan(newSpan, SpanTrackingMode.EdgeInclusive);
            }
            var span = trackingSpan.GetSpan(textView.TextSnapshot);

            if (textView.TextViewLines == null)
            {
                return;
            }
            if (!textView.TextViewLines.FormattedSpan.IntersectsWith(span))
            {
                return;
            }
            var charBound = textView.TextViewLines.GetCharacterBounds(span.End);

            view.SetFrameOrigin(new CGPoint(
                                    Math.Round(charBound.Left),
                                    Math.Round(charBound.TextTop + charBound.TextHeight / 2 - view.Frame.Height / 2)));
            _exceptionCaughtLayer.RemoveAllAdornments();
            _exceptionCaughtLayer.AddAdornment(XPlatAdornmentPositioningBehavior.TextRelative, span, null, view, null);
        }