internal static ICocoaTextView CreateShrunkenTextView(
            ICocoaTextEditorFactoryService textEditorFactoryService,
            ITextBuffer finalBuffer)
        {
            var roles = textEditorFactoryService.CreateTextViewRoleSet(OutliningRegionTextViewRole);
            var view  = textEditorFactoryService.CreateTextView(finalBuffer, roles);

            view.Background = NSColor.Clear.CGColor;

            const double HorizontalCorrection = 8.0;
            const double VerticalCorrection   = 4.0;

            // Force the view to render, measuring its size in the process.
            view.DisplayTextLineContainingBufferPosition(
                new SnapshotPoint(view.TextSnapshot, 0),
                0,
                ViewRelativePosition.Top,
                double.MaxValue,
                double.MaxValue);

            view.VisualElement.SetFrameSize(new CGSize(view.MaxTextRightCoordinate + HorizontalCorrection, view.TextViewLines.LastVisibleLine.Bottom + VerticalCorrection));

            // Zoom out a bit to shrink the text.
            view.ZoomLevel *= 0.75;

            return(view);
        }
Exemple #2
0
 /// <summary>
 /// Create a hidden ITextView.  It will have no roles in order to keep it out of
 /// most plugins
 /// </summary>
 public ITextView CreateHiddenTextView()
 {
     return(_textEditorFactoryService.CreateTextView(
                _textBufferFactoryService.CreateTextBuffer(),
                _textEditorFactoryService.NoRoles));
 }