public TextView(Control parent, TextDocument textDocument) : base(parent) { Dock = Pos.Fill; TextLayer = new TextLayer(this, textDocument); CarretLayer = new CarretLayer(this); }
private void Init() { DeleteAllChildren(); phase = LifetimePhase.Generating; TextLayer.InitVisualLine(this); }
public VisualLine(TextLayer parent, DocumentLine documentLine) : base(parent) { DocumentLine = documentLine; elements = new List <VisualLineElement>(); Init(); documentLine.TextChanged += OnTextChanged; }
public VisualLine(TextLayer parent, DocumentLine documentLine) : base(parent) { DocumentLine = documentLine; elements = new List<VisualLineElement>(); Init(); documentLine.TextChanged += OnTextChanged; }
/// <inheritdoc/> protected override void OnRemoveFromTextLayer(TextLayer textLayer) { base.OnRemoveFromTextLayer(textLayer); textLayer.Services.RemoveService(typeof(IHighlighter)); textLayer.Services.RemoveService(typeof(DocumentHighlighter)); }
/// <inheritdoc/> protected override void OnAddToTextLayer(TextLayer textLayer) { base.OnAddToTextLayer(textLayer); OnDocumentChanged(textLayer); }
/// <summary> /// Creates the IHighlighter instance for the specified text document. /// </summary> protected virtual IHighlighter CreateHighlighter(TextLayer textLayer, TextDocument document) { return new TextLayerDocumentHighlighter(this, textLayer, ruleSet); }
public TextLayerDocumentHighlighter(HighlightingColorizer colorizer, TextLayer textLayer, HighlightingRuleSet baseRuleSet) : base(textLayer.Document, baseRuleSet) { Debug.Assert(colorizer != null); Debug.Assert(textLayer != null); this.colorizer = colorizer; this.textLayer = textLayer; }
void OnDocumentChanged(TextLayer textLayer) { // remove existing highlighter, if any exists textLayer.Services.RemoveService(typeof(IHighlighter)); textLayer.Services.RemoveService(typeof(DocumentHighlighter)); TextDocument document = textLayer.Document; if (document != null) { IHighlighter highlighter = CreateHighlighter(textLayer, document); textLayer.Services.AddService(typeof(IHighlighter), highlighter); // for backward compatiblity, we're registering using both the interface and concrete types if (highlighter is DocumentHighlighter) textLayer.Services.AddService(typeof(DocumentHighlighter), highlighter); } }
void ITextLayerConnect.RemoveFromTextLayer(TextLayer textLayer) { OnRemoveFromTextLayer(textLayer); }
void ITextLayerConnect.AddToTextLayer(TextLayer textLayer) { OnAddToTextLayer(textLayer); }
/// <summary> /// Called when removed from a text view. /// </summary> protected virtual void OnRemoveFromTextLayer(TextLayer textLayer) { }
/// <summary> /// Called when added to a text view. /// </summary> protected virtual void OnAddToTextLayer(TextLayer textLayer) { }