コード例 #1
0
 public override void SetChange(VSTF.TextViewLineChange change)
 {
     if (!IsValid)
     {
         throw new ObjectDisposedException(nameof(HexFormattedLineImpl));
     }
     this.change = change;
 }
コード例 #2
0
ファイル: HexFormattedLine.cs プロジェクト: pashav15/pashav
 /// <summary>
 /// Sets the change
 /// </summary>
 /// <param name="change">New value</param>
 public abstract void SetChange(VSTF.TextViewLineChange change);
コード例 #3
0
        public HexFormattedLineImpl(HexLinePartsCollection linePartsCollection, int linePartsIndex, int linePartsLength, int startColumn, int endColumn, HexBufferLine bufferLine, VST.Span lineSpan, TextLine textLine, double indentation, double virtualSpaceWidth)
        {
            if (linePartsCollection is null)
            {
                throw new ArgumentNullException(nameof(linePartsCollection));
            }
            if (linePartsIndex < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(linePartsIndex));
            }
            if (linePartsLength < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(linePartsLength));
            }
            if (linePartsIndex + linePartsLength > linePartsCollection.LineParts.Count)
            {
                throw new ArgumentOutOfRangeException(nameof(linePartsLength));
            }
            if (textLine is null)
            {
                throw new ArgumentNullException(nameof(textLine));
            }

            this.bufferLine          = bufferLine ?? throw new ArgumentNullException(nameof(bufferLine));
            isValid                  = true;
            this.linePartsIndex      = linePartsIndex;
            this.linePartsLength     = linePartsLength;
            this.linePartsCollection = linePartsCollection;
            this.startColumn         = startColumn;
            this.endColumn           = endColumn;
            textLines                = new ReadOnlyCollection <TextLine>(new[] { textLine });
            Debug.Assert(textLines.Count == 1);            // Assumed by all code accessing TextLine prop

            realTopSpace    = 0;
            realBottomSpace = 0;
            realBaseline    = TextLine.Baseline;
            double baseLineHeight = TextLine.TextHeight - TextLine.Baseline;
            var    lineParts      = linePartsCollection.LineParts;

            for (int i = 0; i < linePartsLength; i++)
            {
                var adornmentElement = lineParts[linePartsIndex + i].AdornmentElement;
                if (adornmentElement is null)
                {
                    continue;
                }
                double adornmentBaseLineHeight = adornmentElement.TextHeight - adornmentElement.Baseline;
                if (adornmentBaseLineHeight > baseLineHeight)
                {
                    baseLineHeight = adornmentBaseLineHeight;
                }
                if (adornmentElement.Baseline > realBaseline)
                {
                    realBaseline = adornmentElement.Baseline;
                }
                if (adornmentElement.TopSpace > realTopSpace)
                {
                    realTopSpace = adornmentElement.TopSpace;
                }
                if (adornmentElement.BottomSpace > realBottomSpace)
                {
                    realBottomSpace = adornmentElement.BottomSpace;
                }
            }
            realTextHeight = Math.Ceiling(baseLineHeight + realBaseline);

            IsLastVisualLine       = bufferLine.LineNumber + 1 == bufferLine.LineProvider.LineCount;
            this.virtualSpaceWidth = virtualSpaceWidth;
            textLeft       = indentation;
            textWidth      = TextLine.WidthIncludingTrailingWhitespace;
            lineExtent     = lineSpan;
            endOfLineWidth = Math.Floor(realTextHeight * 0.58333333333333337);            // Same as VS
            width          = textWidth;
            change         = VSTF.TextViewLineChange.NewOrReformatted;
            SetLineTransform(DefaultLineTransform);
        }