Esempio n. 1
0
 public AdornmentAndData(AdornmentPositioningBehavior behavior, SnapshotSpan?visualSpan, object tag, AdornmentElement element, AdornmentRemovedCallback removedCallback)
 {
     _behavior        = behavior;
     _visualSpan      = visualSpan;
     _tag             = tag;
     _element         = element;
     _removedCallback = removedCallback;
 }
Esempio n. 2
0
        public void RemoveAdornment(AdornmentElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            for (int i = 0; (i < _elements.Count); ++i)
            {
                AdornmentAndData data = _elements[i];
                if (data.Adornment == element)
                {
                    _elements.RemoveAt(i);

                    this.RemoveTranslatableVisual(data);
                    break;
                }
            }
        }
Esempio n. 3
0
 public void RemovedCallback(object tag, AdornmentElement element)
 {
     //An adornment was removed ... remove the corresponding entry from the _lineSpans.
     _lineSpans.Remove(tag);
 }
Esempio n. 4
0
        public bool AddAdornment(AdornmentPositioningBehavior behavior, SnapshotSpan?visualSpan, object tag, AdornmentElement element, AdornmentRemovedCallback removedCallback)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (_isOverlayLayer && behavior != AdornmentPositioningBehavior.OwnerControlled)
            {
                throw new ArgumentOutOfRangeException("behavior", "Only AdornmentPositioningBehavior.OwnerControlled is supported");
            }
            if (IsTextRelative(behavior) && !visualSpan.HasValue)
            {
                throw new ArgumentNullException("visualSpan");
            }

            bool visible = true;

            if (visualSpan.HasValue)
            {
                //Does the visual span intersect anything visible?
                visible = _view.TextViewLines.IntersectsBufferSpan(visualSpan.Value);
            }

            if (visible)
            {
                AdornmentAndData data = new AdornmentAndData(behavior, visualSpan, tag, element, removedCallback);
                _elements.Add(data);
                Children.Add(element);
            }

            return(visible);
        }
Esempio n. 5
0
 public bool AddAdornment(SnapshotSpan visualSpan, object tag, AdornmentElement element)
 {
     return(this.AddAdornment(AdornmentPositioningBehavior.TextRelative, visualSpan, tag, element, null));
 }