Example #1
0
 protected LineNumberMarginBase(string marginName, IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, ITextFormatterProvider textFormatterProvider)
 {
     if (marginName == null)
     {
         throw new ArgumentNullException(nameof(marginName));
     }
     if (wpfTextViewHost == null)
     {
         throw new ArgumentNullException(nameof(wpfTextViewHost));
     }
     if (classificationFormatMapService == null)
     {
         throw new ArgumentNullException(nameof(classificationFormatMapService));
     }
     if (textFormatterProvider == null)
     {
         throw new ArgumentNullException(nameof(textFormatterProvider));
     }
     identityTagToLine       = new Dictionary <object, Line>();
     this.marginName         = marginName;
     this.wpfTextViewHost    = wpfTextViewHost;
     classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(wpfTextViewHost.TextView);
     textLayer = new Layer();
     this.textFormatterProvider = textFormatterProvider;
     Children.Add(textLayer);
     wpfTextViewHost.TextView.Options.OptionChanged += Options_OptionChanged;
     IsVisibleChanged += LineNumberMargin_IsVisibleChanged;
     ClipToBounds      = true;
     IsHitTestVisible  = false;
     UpdateVisibility();
 }
Example #2
0
        public FormattedLineSource(ITextFormatterProvider textFormatterProvider, ITextParagraphPropertiesFactoryService textParagraphPropertiesFactoryService, ITextSnapshot sourceTextSnapshot, ITextSnapshot visualBufferSnapshot, int tabSize, double baseIndent, double wordWrapWidth, double maxAutoIndent, bool useDisplayMode, IClassifier aggregateClassifier, ITextAndAdornmentSequencer sequencer, IClassificationFormatMap classificationFormatMap, bool isViewWrapEnabled)
        {
            if (textFormatterProvider == null)
            {
                throw new ArgumentNullException(nameof(textFormatterProvider));
            }
            if (sourceTextSnapshot == null)
            {
                throw new ArgumentNullException(nameof(sourceTextSnapshot));
            }
            if (visualBufferSnapshot == null)
            {
                throw new ArgumentNullException(nameof(visualBufferSnapshot));
            }
            if (aggregateClassifier == null)
            {
                throw new ArgumentNullException(nameof(aggregateClassifier));
            }
            if (sequencer == null)
            {
                throw new ArgumentNullException(nameof(sequencer));
            }
            if (classificationFormatMap == null)
            {
                throw new ArgumentNullException(nameof(classificationFormatMap));
            }
            if (tabSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(tabSize));
            }
            if (sourceTextSnapshot != visualBufferSnapshot)
            {
                throw new NotSupportedException("Text snapshot must be identical to visual snapshot");
            }

            this.textFormatter      = textFormatterProvider.Create(useDisplayMode);
            this.formattedTextCache = new FormattedTextCache(useDisplayMode);
            this.textParagraphPropertiesFactoryService = textParagraphPropertiesFactoryService;
            SourceTextSnapshot                  = sourceTextSnapshot;
            TopTextSnapshot                     = visualBufferSnapshot;
            UseDisplayMode                      = useDisplayMode;
            TabSize                             = tabSize;
            BaseIndentation                     = baseIndent;
            WordWrapWidth                       = wordWrapWidth;
            MaxAutoIndent                       = Math.Round(maxAutoIndent);
            ColumnWidth                         = formattedTextCache.GetColumnWidth(classificationFormatMap.DefaultTextProperties);
            this.wrapGlyphWidth                 = isViewWrapEnabled ? 1.5 * ColumnWidth : 0;
            LineHeight                          = WpfTextViewLine.DEFAULT_TOP_SPACE + WpfTextViewLine.DEFAULT_BOTTOM_SPACE + formattedTextCache.GetLineHeight(classificationFormatMap.DefaultTextProperties);
            TextHeightAboveBaseline             = formattedTextCache.GetTextHeightAboveBaseline(classificationFormatMap.DefaultTextProperties);
            TextHeightBelowBaseline             = formattedTextCache.GetTextHeightBelowBaseline(classificationFormatMap.DefaultTextProperties);
            TextAndAdornmentSequencer           = textAndAdornmentSequencer;
            this.aggregateClassifier            = aggregateClassifier;
            this.textAndAdornmentSequencer      = sequencer;
            this.classificationFormatMap        = classificationFormatMap;
            this.defaultTextParagraphProperties = new TextFormattingParagraphProperties(classificationFormatMap.DefaultTextProperties, ColumnWidth * TabSize);
        }
		protected LineNumberMarginBase(string marginName, IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, ITextFormatterProvider textFormatterProvider) {
			if (marginName == null)
				throw new ArgumentNullException(nameof(marginName));
			if (wpfTextViewHost == null)
				throw new ArgumentNullException(nameof(wpfTextViewHost));
			if (classificationFormatMapService == null)
				throw new ArgumentNullException(nameof(classificationFormatMapService));
			if (textFormatterProvider == null)
				throw new ArgumentNullException(nameof(textFormatterProvider));
			identityTagToLine = new Dictionary<object, Line>();
			this.marginName = marginName;
			this.wpfTextViewHost = wpfTextViewHost;
			classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(wpfTextViewHost.TextView);
			textLayer = new Layer();
			this.textFormatterProvider = textFormatterProvider;
			Children.Add(textLayer);
			wpfTextViewHost.TextView.Options.OptionChanged += Options_OptionChanged;
			IsVisibleChanged += LineNumberMargin_IsVisibleChanged;
			ClipToBounds = true;
			IsHitTestVisible = false;
			UpdateVisibility();
		}
Example #4
0
		public FormattedLineSource(ITextFormatterProvider textFormatterProvider, ITextParagraphPropertiesFactoryService textParagraphPropertiesFactoryService, ITextSnapshot sourceTextSnapshot, ITextSnapshot visualBufferSnapshot, int tabSize, double baseIndent, double wordWrapWidth, double maxAutoIndent, bool useDisplayMode, IClassifier aggregateClassifier, ITextAndAdornmentSequencer sequencer, IClassificationFormatMap classificationFormatMap, bool isViewWrapEnabled) {
			if (textFormatterProvider == null)
				throw new ArgumentNullException(nameof(textFormatterProvider));
			if (sourceTextSnapshot == null)
				throw new ArgumentNullException(nameof(sourceTextSnapshot));
			if (visualBufferSnapshot == null)
				throw new ArgumentNullException(nameof(visualBufferSnapshot));
			if (aggregateClassifier == null)
				throw new ArgumentNullException(nameof(aggregateClassifier));
			if (sequencer == null)
				throw new ArgumentNullException(nameof(sequencer));
			if (classificationFormatMap == null)
				throw new ArgumentNullException(nameof(classificationFormatMap));
			if (tabSize <= 0)
				throw new ArgumentOutOfRangeException(nameof(tabSize));
			if (sourceTextSnapshot != visualBufferSnapshot)
				throw new NotSupportedException("Text snapshot must be identical to visual snapshot");

			textFormatter = textFormatterProvider.Create(useDisplayMode);
			formattedTextCache = new FormattedTextCache(useDisplayMode);
			this.textParagraphPropertiesFactoryService = textParagraphPropertiesFactoryService;
			SourceTextSnapshot = sourceTextSnapshot;
			TopTextSnapshot = visualBufferSnapshot;
			UseDisplayMode = useDisplayMode;
			TabSize = tabSize;
			BaseIndentation = baseIndent;
			WordWrapWidth = wordWrapWidth;
			MaxAutoIndent = Math.Round(maxAutoIndent);
			ColumnWidth = formattedTextCache.GetColumnWidth(classificationFormatMap.DefaultTextProperties);
			wrapGlyphWidth = isViewWrapEnabled ? 1.5 * ColumnWidth : 0;
			LineHeight = WpfTextViewLine.DEFAULT_TOP_SPACE + WpfTextViewLine.DEFAULT_BOTTOM_SPACE + formattedTextCache.GetLineHeight(classificationFormatMap.DefaultTextProperties);
			TextHeightAboveBaseline = formattedTextCache.GetTextHeightAboveBaseline(classificationFormatMap.DefaultTextProperties);
			TextHeightBelowBaseline = formattedTextCache.GetTextHeightBelowBaseline(classificationFormatMap.DefaultTextProperties);
			TextAndAdornmentSequencer = sequencer;
			this.aggregateClassifier = aggregateClassifier;
			this.classificationFormatMap = classificationFormatMap;
			defaultTextParagraphProperties = new TextFormattingParagraphProperties(classificationFormatMap.DefaultTextProperties, ColumnWidth * TabSize);
		}
 public CustomLineNumberMarginImpl(IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, ITextFormatterProvider textFormatterProvider)
     : base(PredefinedDsMarginNames.CustomLineNumber, wpfTextViewHost, classificationFormatMapService, textFormatterProvider) => CustomLineNumberMargin.SetMargin(wpfTextViewHost.TextView, this);
 CustomLineNumberMarginProvider(IClassificationFormatMapService classificationFormatMapService, ITextFormatterProvider textFormatterProvider)
 {
     this.classificationFormatMapService = classificationFormatMapService;
     this.textFormatterProvider          = textFormatterProvider;
 }
		public CustomLineNumberMarginImpl(IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, ITextFormatterProvider textFormatterProvider)
			: base(PredefinedDsMarginNames.CustomLineNumber, wpfTextViewHost, classificationFormatMapService, textFormatterProvider) {
			CustomLineNumberMargin.SetMargin(wpfTextViewHost.TextView, this);
		}
		CustomLineNumberMarginProvider(IClassificationFormatMapService classificationFormatMapService, ITextFormatterProvider textFormatterProvider) {
			this.classificationFormatMapService = classificationFormatMapService;
			this.textFormatterProvider = textFormatterProvider;
		}
Example #9
0
 SpacerMarginProvider(IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypeService themeClassificationTypeService, ITextFormatterProvider textFormatterProvider)
 {
     this.classificationFormatMapService = classificationFormatMapService;
     this.themeClassificationTypeService = themeClassificationTypeService;
     this.textFormatterProvider          = textFormatterProvider;
 }
Example #10
0
 FormattedTextSourceFactoryService(ITextFormatterProvider textFormatterProvider, ITextParagraphPropertiesFactoryServiceSelector textParagraphPropertiesFactoryServiceSelector)
 {
     this.textFormatterProvider = textFormatterProvider;
     this.textParagraphPropertiesFactoryServiceSelector = textParagraphPropertiesFactoryServiceSelector;
 }
Example #11
0
 public LineNumberMargin(IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypeService themeClassificationTypeService, ITextFormatterProvider textFormatterProvider)
     : base(PredefinedMarginNames.LineNumber, wpfTextViewHost, classificationFormatMapService, textFormatterProvider)
 {
     this.lineNumberClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.LineNumber);
 }
Example #12
0
		SpacerMarginProvider(IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypeService themeClassificationTypeService, ITextFormatterProvider textFormatterProvider) {
			this.classificationFormatMapService = classificationFormatMapService;
			this.themeClassificationTypeService = themeClassificationTypeService;
			this.textFormatterProvider = textFormatterProvider;
		}
		FormattedTextSourceFactoryService(ITextFormatterProvider textFormatterProvider, ITextParagraphPropertiesFactoryServiceSelector textParagraphPropertiesFactoryServiceSelector) {
			this.textFormatterProvider = textFormatterProvider;
			this.textParagraphPropertiesFactoryServiceSelector = textParagraphPropertiesFactoryServiceSelector;
		}
Example #14
0
		public LineNumberMargin(IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypeService themeClassificationTypeService, ITextFormatterProvider textFormatterProvider)
			: base(PredefinedMarginNames.LineNumber, wpfTextViewHost, classificationFormatMapService, textFormatterProvider) {
			lineNumberClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.LineNumber);
		}
Example #15
0
 LineNumberMarginProvider(IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypes themeClassificationTypes, ITextFormatterProvider textFormatterProvider)
 {
     this.classificationFormatMapService = classificationFormatMapService;
     this.themeClassificationTypes       = themeClassificationTypes;
     this.textFormatterProvider          = textFormatterProvider;
 }