Inheritance: Flood.GUI.Controls.Control
Ejemplo n.º 1
0
 public VisualLineElement(VisualLine visualLine, int offset, int length )
     : base(visualLine)
 {
     MouseInputEnabled = true;
     TextRunProperties = visualLine.TextLayer.GlobalTextRunProperties;
     Offset = offset;
     Length = length;
     UpdateText();
 }
Ejemplo n.º 2
0
 /// <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;
     }
 }
Ejemplo n.º 3
0
        /// <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));
                }
            }
        }
Ejemplo n.º 4
0
        public void RebuildDocument()
        {
            lines.Clear();
            DeleteAllChildren();

            foreach (var docLine in Document.Lines)
            {
                var line = new VisualLine(this, docLine);
                lines.Add(docLine,line);
            }
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes the generator for the <see cref="ITextRunConstructionContext"/>
 /// </summary>
 public virtual void StartGeneration(VisualLine line)
 {
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Performs the colorization.
 /// </summary>
 protected abstract void Colorize(VisualLine line);