// Token: 0x06003010 RID: 12304 RVA: 0x000D8268 File Offset: 0x000D6468
 private void RaiseChangedEventForLayerContent(HighlightLayer highlightLayer)
 {
     if (this.Changed != null)
     {
         List <TextSegment> list = new List <TextSegment>();
         StaticTextPointer  staticTextPointer = this._textContainer.CreateStaticPointerAtOffset(0);
         for (;;)
         {
             if (!highlightLayer.IsContentHighlighted(staticTextPointer, LogicalDirection.Forward))
             {
                 staticTextPointer = highlightLayer.GetNextChangePosition(staticTextPointer, LogicalDirection.Forward);
                 if (staticTextPointer.IsNull)
                 {
                     break;
                 }
             }
             StaticTextPointer staticTextPointer2 = staticTextPointer;
             staticTextPointer = highlightLayer.GetNextChangePosition(staticTextPointer, LogicalDirection.Forward);
             Invariant.Assert(!staticTextPointer.IsNull, "Highlight start not followed by highlight end!");
             list.Add(new TextSegment(staticTextPointer2.CreateDynamicTextPointer(LogicalDirection.Forward), staticTextPointer.CreateDynamicTextPointer(LogicalDirection.Forward)));
         }
         if (list.Count > 0)
         {
             this.Changed(this, new Highlights.LayerHighlightChangedEventArgs(new ReadOnlyCollection <TextSegment>(list), highlightLayer.OwnerType));
         }
     }
 }
 // Token: 0x06003009 RID: 12297 RVA: 0x000D813C File Offset: 0x000D633C
 internal void RemoveLayer(HighlightLayer highlightLayer)
 {
     Invariant.Assert(this._layers != null && this._layers.Contains(highlightLayer));
     this.RaiseChangedEventForLayerContent(highlightLayer);
     highlightLayer.Changed -= this.OnLayerChanged;
     this._layers.Remove(highlightLayer);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Removes a HighlightLayer to this collection.
        /// </summary>
        /// <param name="highlightLayer">
        /// HighlightLayer to add.
        /// </param>
        internal void RemoveLayer(HighlightLayer highlightLayer)
        {
            Invariant.Assert(_layers != null && _layers.Contains(highlightLayer));

            // Raise final change event to cover existing content.
            RaiseChangedEventForLayerContent(highlightLayer);

            highlightLayer.Changed -= new HighlightChangedEventHandler(OnLayerChanged);

            _layers.Remove(highlightLayer);
        }
 // Token: 0x06003008 RID: 12296 RVA: 0x000D80E0 File Offset: 0x000D62E0
 internal void AddLayer(HighlightLayer highlightLayer)
 {
     if (this._layers == null)
     {
         this._layers = new ArrayList(1);
     }
     Invariant.Assert(!this._layers.Contains(highlightLayer));
     this._layers.Add(highlightLayer);
     highlightLayer.Changed += this.OnLayerChanged;
     this.RaiseChangedEventForLayerContent(highlightLayer);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Adds a HighlightLayer to this collection.
        /// </summary>
        /// <param name="highlightLayer">
        /// HighlightLayer to add.
        /// </param>
        internal void AddLayer(HighlightLayer highlightLayer)
        {
            // Delay alloc the layers store.
            if (_layers == null)
            {
                _layers = new ArrayList(1);
            }

            Invariant.Assert(!_layers.Contains(highlightLayer));

            _layers.Add(highlightLayer);

            highlightLayer.Changed += new HighlightChangedEventHandler(OnLayerChanged);

            // Raise initial change event to cover existing content.
            RaiseChangedEventForLayerContent(highlightLayer);
        }
        // Token: 0x06003004 RID: 12292 RVA: 0x000D7F8C File Offset: 0x000D618C
        internal virtual object GetHighlightValue(StaticTextPointer textPosition, LogicalDirection direction, Type highlightLayerOwnerType)
        {
            object obj = DependencyProperty.UnsetValue;

            for (int i = 0; i < this.LayerCount; i++)
            {
                HighlightLayer layer = this.GetLayer(i);
                if (layer.OwnerType == highlightLayerOwnerType)
                {
                    obj = layer.GetHighlightValue(textPosition, direction);
                    if (obj != DependencyProperty.UnsetValue)
                    {
                        break;
                    }
                }
            }
            return(obj);
        }
Exemplo n.º 7
0
        // Raises initial or final change event for added/removed layers.
        private void RaiseChangedEventForLayerContent(HighlightLayer highlightLayer)
        {
            List <TextSegment> ranges;
            StaticTextPointer  highlightTransitionPosition;
            StaticTextPointer  highlightRangeStart;

            if (this.Changed != null)
            {
                // Build a list of all highlights in this layer -- they're all
                // going to "change" as the layer is added/removed.

                ranges = new List <TextSegment>();

                highlightTransitionPosition = _textContainer.CreateStaticPointerAtOffset(0);

                while (true)
                {
                    // Move to the next highlight start.
                    if (!highlightLayer.IsContentHighlighted(highlightTransitionPosition, LogicalDirection.Forward))
                    {
                        highlightTransitionPosition = highlightLayer.GetNextChangePosition(highlightTransitionPosition, LogicalDirection.Forward);

                        // No more highlights?
                        if (highlightTransitionPosition.IsNull)
                        {
                            break;
                        }
                    }

                    highlightRangeStart         = highlightTransitionPosition;
                    highlightTransitionPosition = highlightLayer.GetNextChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
                    Invariant.Assert(!highlightTransitionPosition.IsNull, "Highlight start not followed by highlight end!");

                    ranges.Add(new TextSegment(highlightRangeStart.CreateDynamicTextPointer(LogicalDirection.Forward), highlightTransitionPosition.CreateDynamicTextPointer(LogicalDirection.Forward)));
                }

                if (ranges.Count > 0)
                {
                    Changed(this, new LayerHighlightChangedEventArgs(new ReadOnlyCollection <TextSegment>(ranges), highlightLayer.OwnerType));
                }
            }
        }
Exemplo n.º 8
0
        // Raises initial or final change event for added/removed layers.
        private void RaiseChangedEventForLayerContent(HighlightLayer highlightLayer)
        {
            List<TextSegment> ranges;
            StaticTextPointer highlightTransitionPosition;
            StaticTextPointer highlightRangeStart;

            if (this.Changed != null)
            {
                // Build a list of all highlights in this layer -- they're all
                // going to "change" as the layer is added/removed.

                ranges = new List<TextSegment>();

                highlightTransitionPosition = _textContainer.CreateStaticPointerAtOffset(0);

                while (true)
                {
                    // Move to the next highlight start.
                    if (!highlightLayer.IsContentHighlighted(highlightTransitionPosition, LogicalDirection.Forward))
                    {
                        highlightTransitionPosition = highlightLayer.GetNextChangePosition(highlightTransitionPosition, LogicalDirection.Forward);

                        // No more highlights?
                        if (highlightTransitionPosition.IsNull)
                            break;
                    }

                    highlightRangeStart = highlightTransitionPosition;
                    highlightTransitionPosition = highlightLayer.GetNextChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
                    Invariant.Assert(!highlightTransitionPosition.IsNull, "Highlight start not followed by highlight end!");

                    ranges.Add(new TextSegment(highlightRangeStart.CreateDynamicTextPointer(LogicalDirection.Forward), highlightTransitionPosition.CreateDynamicTextPointer(LogicalDirection.Forward)));
                }

                if (ranges.Count > 0)
                {
                    Changed(this, new LayerHighlightChangedEventArgs(new ReadOnlyCollection<TextSegment>(ranges), highlightLayer.OwnerType));
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Removes a HighlightLayer to this collection.
        /// </summary>
        /// <param name="highlightLayer">
        /// HighlightLayer to add.
        /// </param>
        internal void RemoveLayer(HighlightLayer highlightLayer)
        {
            Invariant.Assert(_layers != null && _layers.Contains(highlightLayer));

            // Raise final change event to cover existing content.
            RaiseChangedEventForLayerContent(highlightLayer);

            highlightLayer.Changed -= new HighlightChangedEventHandler(OnLayerChanged);

            _layers.Remove(highlightLayer);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Adds a HighlightLayer to this collection.
        /// </summary>
        /// <param name="highlightLayer">
        /// HighlightLayer to add.
        /// </param>
        internal void AddLayer(HighlightLayer highlightLayer)
        {
            // Delay alloc the layers store.
            if (_layers == null)
            {
                _layers = new ArrayList(1);
            }

            Invariant.Assert(!_layers.Contains(highlightLayer));

            _layers.Add(highlightLayer);

            highlightLayer.Changed += new HighlightChangedEventHandler(OnLayerChanged);

            // Raise initial change event to cover existing content.
            RaiseChangedEventForLayerContent(highlightLayer);
        }