public HexLinePartsTextSource(HexLinePartsCollection linePartsCollection) { if (linePartsCollection == null) { throw new ArgumentNullException(nameof(linePartsCollection)); } this.linePartsCollection = linePartsCollection; text = linePartsCollection.Text; }
protected override void DisposeCore() { isValid = false; foreach (var t in textLines) { t.Dispose(); } bufferLine = null !; linePartsCollection = null !; textLines = null !; drawingVisual = null !; }
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); }
public HexLinePartsTextSource(HexLinePartsCollection linePartsCollection) { if (linePartsCollection == null) throw new ArgumentNullException(nameof(linePartsCollection)); this.linePartsCollection = linePartsCollection; text = linePartsCollection.Text; }