Inheritance: Flood.GUI.Controls.Control
Exemplo n.º 1
0
 public VisualLineElement(VisualLine visualLine, int offset, int length )
     : base(visualLine)
 {
     MouseInputEnabled = true;
     TextRunProperties = visualLine.TextLayer.GlobalTextRunProperties;
     Offset = offset;
     Length = length;
     UpdateText();
 }
Exemplo 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;
     }
 }
Exemplo 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));
                }
            }
        }
Exemplo 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);
            }
        }
Exemplo 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);
 }
Exemplo 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;
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes the generator for the <see cref="ITextRunConstructionContext"/>
 /// </summary>
 public virtual void StartGeneration(VisualLine line)
 {
 }
Exemplo 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;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Performs the colorization.
 /// </summary>
 protected abstract void Colorize(VisualLine line);