Inheritance: Flood.GUI.Controls.Control
 public VisualLineElement(VisualLine visualLine, int offset, int length )
     : base(visualLine)
 {
     MouseInputEnabled = true;
     TextRunProperties = visualLine.TextLayer.GlobalTextRunProperties;
     Offset = offset;
     Length = length;
     UpdateText();
 }
 /// <summary>
 /// <see cref="IVisualLineTransformer.Transform"/> implementation.
 /// Sets <see cref="CurrentElements"/> and calls <see cref="Colorize"/>.
 /// </summary>
 public void Transform(VisualLine line, IList<VisualLineElement> elements)
 {
     if (elements == null)
         throw new ArgumentNullException("elements");
     if (this.CurrentElements != null)
         throw new InvalidOperationException("Recursive Transform() call");
     this.CurrentElements = elements;
     try {
         Colorize(line);
     } finally {
         this.CurrentElements = null;
     }
 }
        /// <inheritdoc/>
        protected override void Colorize(VisualLine line)
        {
            IHighlighter highlighter = line.TextLayer.Services.GetService(typeof(IHighlighter)) as IHighlighter;
            if (highlighter != null) {
                lineNumberBeingColorized = line.DocumentLine.LineNumber;
                HighlightedLine hl = highlighter.HighlightLine(lineNumberBeingColorized);
                lineNumberBeingColorized = 0;
                foreach (HighlightedSection section in hl.Sections) {
                    if (IsEmptyColor(section.Color))
                        continue;

                    ChangeVisualElements(section.Offset, section.Offset + section.Length,
                                   visualLineElement => ApplyColorToElement(visualLineElement, section.Color));
                }
            }
        }
Exemple #4
0
        public void RebuildDocument()
        {
            lines.Clear();
            DeleteAllChildren();

            foreach (var docLine in Document.Lines)
            {
                var line = new VisualLine(this, docLine);
                lines.Add(docLine,line);
            }
        }
Exemple #5
0
 public void LineInserted(DocumentLine insertionPos, DocumentLine newDocLine)
 {
     var prevLine = lines[insertionPos];
     var line = new VisualLine(this, newDocLine);
     line.BringNextToControl(prevLine,true);
     lines.Add(newDocLine,line);
 }
Exemple #6
0
        public VisualLine InitVisualLine(VisualLine visualLine)
        {
            Debug.WriteLine("Initializing line " + visualLine.DocumentLine.LineNumber);

            visualLine.ConstructVisualElements(elementGenerators.ToArray());

            visualLine.RunTransformers(visualLine, lineTransformers.ToArray());

            return visualLine;
        }
 /// <summary>
 /// Initializes the generator for the <see cref="ITextRunConstructionContext"/>
 /// </summary>
 public virtual void StartGeneration(VisualLine line)
 {
 }
Exemple #8
0
 internal void RunTransformers(VisualLine line, IVisualLineTransformer[] transformers)
 {
     Debug.Assert(phase == LifetimePhase.Transforming);
     foreach (IVisualLineTransformer transformer in transformers) {
         transformer.Transform(line, elements);
     }
     phase = LifetimePhase.Live;
 }
 /// <summary>
 /// Performs the colorization.
 /// </summary>
 protected abstract void Colorize(VisualLine line);