Beispiel #1
0
        public HexFormattedLineSourceImpl(TF.ITextFormatterProvider textFormatterProvider, double baseIndent, bool useDisplayMode, HexClassifier aggregateClassifier, HexAndAdornmentSequencer sequencer, VSTC.IClassificationFormatMap classificationFormatMap)
        {
            if (textFormatterProvider == null)
            {
                throw new ArgumentNullException(nameof(textFormatterProvider));
            }
            if (aggregateClassifier == null)
            {
                throw new ArgumentNullException(nameof(aggregateClassifier));
            }
            if (sequencer == null)
            {
                throw new ArgumentNullException(nameof(sequencer));
            }
            if (classificationFormatMap == null)
            {
                throw new ArgumentNullException(nameof(classificationFormatMap));
            }

            textFormatter                  = textFormatterProvider.Create(useDisplayMode);
            formattedTextCache             = new TF.FormattedTextCache(useDisplayMode);
            UseDisplayMode                 = useDisplayMode;
            BaseIndentation                = baseIndent;
            ColumnWidth                    = formattedTextCache.GetColumnWidth(classificationFormatMap.DefaultTextProperties);
            LineHeight                     = HexFormattedLineImpl.DEFAULT_TOP_SPACE + HexFormattedLineImpl.DEFAULT_BOTTOM_SPACE + formattedTextCache.GetLineHeight(classificationFormatMap.DefaultTextProperties);
            TextHeightAboveBaseline        = formattedTextCache.GetTextHeightAboveBaseline(classificationFormatMap.DefaultTextProperties);
            TextHeightBelowBaseline        = formattedTextCache.GetTextHeightBelowBaseline(classificationFormatMap.DefaultTextProperties);
            HexAndAdornmentSequencer       = sequencer;
            this.aggregateClassifier       = aggregateClassifier;
            this.classificationFormatMap   = classificationFormatMap;
            defaultTextParagraphProperties = new VSTF.TextFormattingParagraphProperties(classificationFormatMap.DefaultTextProperties, ColumnWidth * TabSize);
        }
Beispiel #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);
        }
		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);
		}