示例#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;
        }