Пример #1
0
 public EvalExprEvent(TemplateFrame frame, Interval outputInterval, Interval sourceInterval)
     : base(frame, outputInterval)
 {
     this._sourceInterval = sourceInterval;
     if (_sourceInterval != null)
         expr = frame.Template.impl.Template.Substring(_sourceInterval.Start, _sourceInterval.Length);
 }
Пример #2
0
        public InterpEvent(TemplateFrame frame, Interval interval)
        {
            if (frame == null)
                throw new ArgumentNullException("frame");
            if (interval == null)
                throw new ArgumentNullException("interval");

            this._frame = frame;
            this._interval = interval;
        }
        private static TextPointer Highlight(FlowDocument document, Interval interval)
        {
            if (document == null)
                throw new ArgumentNullException("document");

            TextPointer contentStart = document.ContentStart;

            // clear any existing highlight
            TextRange documentRange = new TextRange(document.ContentStart, document.ContentEnd);
            documentRange.ApplyPropertyValue(FlowDocument.BackgroundProperty, FlowDocument.BackgroundProperty.DefaultMetadata.DefaultValue);

            if (interval == null)
                return null;

            // highlight the new text
            int startOffset = interval.Start;
            int endOffset = interval.End;
            TextPointer highlightStart = document.GetPointerFromCharOffset(ref startOffset);
            TextPointer highlightStop = document.GetPointerFromCharOffset(ref endOffset);
            if (startOffset != 0 || endOffset != 0)
                return null;

            var textRange = new TextRange(highlightStart, highlightStop);
            textRange.ApplyPropertyValue(FlowDocument.BackgroundProperty, Brushes.Yellow);
            return textRange.Start;
        }
Пример #4
0
 public IndentEvent(TemplateFrame frame, Interval outputInterval, Interval sourceInterval)
     : base(frame, outputInterval, sourceInterval)
 {
 }
Пример #5
0
 public EvalTemplateEvent(TemplateFrame frame, Interval interval)
     : base(frame, interval)
 {
 }
Пример #6
0
        /// <summary>
        /// Determines whether the specified interval falls completely within this interval.
        /// </summary>
        /// <param name="interval">The interval to check.</param>
        /// <returns>true if the specified interval falls completely within this interval, otherwise false.</returns>
        public bool Contains(Interval interval)
        {
            if (interval == null)
                throw new ArgumentNullException("interval");

            return interval.Start >= this.Start && interval.End <= this.End;
        }