// 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));
         }
     }
 }
Esempio n. 2
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));
                }
            }
        }
Esempio n. 3
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));
                }
            }
        }