IEnumerable <HexGlyphTag> GetGlyphTags(WpfHexViewLine line) { foreach (var tagSpan in tagAggregator.GetTags(line.BufferSpan)) { if (line.IntersectsBufferSpan(tagSpan.Span)) { yield return(tagSpan.Tag); } } var taggerContext = new HexTaggerContext(line.BufferLine, line.BufferLine.TextSpan); foreach (var tagSpan in tagAggregator.GetLineTags(taggerContext)) { yield return(tagSpan.Tag); } }
public override IEnumerable <IHexTextTagSpan <HexSpaceNegotiatingAdornmentTag> > GetLineTags(HexTaggerContext context) { if (wpfHexView.IsClosed) { yield break; } var taggerContext = new HexTaggerContext(context.Line, context.LineSpan); foreach (var tagSpan in tagAggregator.GetLineTags(taggerContext)) { var uiElem = tagSpan.Tag.Adornment; double topSpace = tagSpan.Tag.TopSpace ?? 0; double bottomSpace = tagSpan.Tag.BottomSpace ?? 0; double textHeight = tagSpan.Tag.TextHeight ?? (Filter(uiElem.DesiredSize.Height) - (topSpace + bottomSpace)); var adornmentInfo = new AdornmentTagInfo(context.Line.BufferSpan, uiElem, tagSpan); var tag = new HexSpaceNegotiatingAdornmentTag(Filter(uiElem.DesiredSize.Width), topSpace, tagSpan.Tag.Baseline ?? textHeight * 0.75, textHeight, bottomSpace, tagSpan.Tag.Affinity ?? VST.PositionAffinity.Predecessor, adornmentInfo, providerTag); adornmentInfo.Tag = tag; yield return(new HexTextTagSpan <HexSpaceNegotiatingAdornmentTag>(tagSpan.Span, tag)); } }
void AddMarkerElements(NormalizedHexBufferSpanCollection spans) { foreach (var tag in tagAggregator.GetTags(spans)) { if (tag.Tag?.Type == null) { continue; } if (!tag.Span.IntersectsWith(wpfHexView.HexViewLines.FormattedSpan)) { continue; } var markerElement = TryCreateMarkerElement(tag.Span, tag.Flags, tag.Tag); if (markerElement == null) { continue; } var layer = markerElement.ZIndex < 0 ? negativeTextMarkerAdornmentLayer : textMarkerAdornmentLayer; bool added = layer.AddAdornment(VSTE.AdornmentPositioningBehavior.TextRelative, markerElement.Span, null, markerElement, onRemovedDelegate); if (added) { markerElements.Add(markerElement); } } var formattedEnd = wpfHexView.HexViewLines.FormattedSpan.End; foreach (var span in spans) { var overlap = wpfHexView.HexViewLines.FormattedSpan.Overlap(span); if (overlap == null) { continue; } var pos = overlap.Value.Start; for (;;) { var line = wpfHexView.WpfHexViewLines.GetWpfHexViewLineContainingBufferPosition(pos); Debug.Assert(line != null); if (line != null) { var taggerContext = new HexTaggerContext(line.BufferLine, line.BufferLine.TextSpan); foreach (var tag in tagAggregator.GetLineTags(taggerContext)) { if (tag.Tag?.Type == null) { continue; } var markerElement = TryCreateMarkerElement(line, tag.Span, tag.Tag); if (markerElement == null) { continue; } var layer = markerElement.ZIndex < 0 ? negativeTextMarkerAdornmentLayer : textMarkerAdornmentLayer; bool added = layer.AddAdornment(VSTE.AdornmentPositioningBehavior.TextRelative, markerElement.Span, null, markerElement, onRemovedDelegate); if (added) { markerElements.Add(markerElement); } } } pos = line.BufferEnd; if (pos > overlap.Value.End || pos >= formattedEnd) { break; } } } }