示例#1
0
 public PreviewFactoryService(
     IThreadingContext threadingContext,
     ITextBufferFactoryService textBufferFactoryService,
     IContentTypeRegistryService contentTypeRegistryService,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     ICocoaTextEditorFactoryService textEditorFactoryService,
     IEditorOptionsFactoryService editorOptionsFactoryService,
     ITextDifferencingSelectorService differenceSelectorService,
     IDifferenceBufferFactoryService differenceBufferService,
     ICocoaDifferenceViewerFactoryService differenceViewerService
     )
     : base(
         threadingContext,
         textBufferFactoryService,
         contentTypeRegistryService,
         projectionBufferFactoryService,
         editorOptionsFactoryService,
         differenceSelectorService,
         differenceBufferService,
         textEditorFactoryService.CreateTextViewRoleSet(
             TextViewRoles.PreviewRole,
             PredefinedTextViewRoles.Analyzable
             )
         )
 {
     _differenceViewerService = differenceViewerService;
 }
 public CocoaDifferenceViewElementFactory(
     ICocoaDifferenceViewerFactoryService diffFactory,
     ICocoaTextEditorFactoryService textEditorFactoryService)
 {
     _diffFactory    = diffFactory;
     _previewRoleSet = textEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Analyzable);
 }
示例#3
0
        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);
        }
        public PreviewFactoryService(
            IThreadingContext threadingContext,
            ITextBufferFactoryService textBufferFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            ICocoaTextEditorFactoryService textEditorFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            ITextDifferencingSelectorService differenceSelectorService,
            IDifferenceBufferFactoryService differenceBufferService,
            ICocoaDifferenceViewerFactoryService differenceViewerService)
            : base(threadingContext)
        {
            Contract.ThrowIfFalse(ThreadingContext.HasMainThread);

            _textBufferFactoryService       = textBufferFactoryService;
            _contentTypeRegistryService     = contentTypeRegistryService;
            _projectionBufferFactoryService = projectionBufferFactoryService;
            _editorOptionsFactoryService    = editorOptionsFactoryService;
            _differenceSelectorService      = differenceSelectorService;
            _differenceBufferService        = differenceBufferService;
            _differenceViewerService        = differenceViewerService;

            _previewRoleSet = textEditorFactoryService.CreateTextViewRoleSet(
                TextViewRoles.PreviewRole, PredefinedTextViewRoles.Analyzable);
        }