public void Dispose() { if (weakLineTracker != null) weakLineTracker.Deregister(); this.root = null; this.weakLineTracker = null; }
public HeightTree(TextDocument document, double defaultLineHeight) { this.document = document; weakLineTracker = WeakLineTracker.Register(document, this); this.DefaultLineHeight = defaultLineHeight; RebuildDocument(); }
/// <summary> /// Registers the <paramref name="targetTracker"/> as line tracker for the <paramref name="textDocument"/>. /// A weak reference to the target tracker will be used, and the WeakLineTracker will deregister itself /// when the target tracker is garbage collected. /// </summary> public static WeakLineTracker Register(TextDocument textDocument, ILineTracker targetTracker) { if (textDocument == null) throw new ArgumentNullException("textDocument"); if (targetTracker == null) throw new ArgumentNullException("targetTracker"); WeakLineTracker wlt = new WeakLineTracker(textDocument, targetTracker); textDocument.LineTrackers.Add(wlt); return wlt; }
public AvalonEditTextDocument(ICSharpCode.AvalonEdit.Document.TextDocument avalonEditTextDocument, Encoding encodingForAlphanumericLiterals, ColumnsLayout columnsLayout) { // Document source name and text format Source = new TextSourceInfo(_avalonEditTextDocument.FileName, encodingForAlphanumericLiterals, columnsLayout); _avalonEditTextDocument = avalonEditTextDocument; // Listen to all line changes in the editor _avalonEditTextDocument.VerifyAccess(); _weakLineTracker = WeakLineTracker.Register(_avalonEditTextDocument, this); }
/// <summary> /// Creates a new DocumentHighlighter instance. /// </summary> public DocumentHighlighter(TextDocument document, IHighlightingDefinition definition) { if (document == null) throw new ArgumentNullException("document"); if (definition == null) throw new ArgumentNullException("definition"); this.document = document; this.definition = definition; document.VerifyAccess(); weakLineTracker = WeakLineTracker.Register(document, this); InvalidateHighlighting(); }
/// <summary> /// Creates a new DocumentHighlighter instance. /// </summary> public DocumentHighlighter(TextDocument document, IHighlightingDefinition definition) { if (document == null) throw new ArgumentNullException("document"); if (definition == null) throw new ArgumentNullException("definition"); this.document = document; this.definition = definition; this.engine = new HighlightingEngine(definition.MainRuleSet); document.VerifyAccess(); weakLineTracker = WeakLineTracker.Register(document, this); InvalidateSpanStacks(); }
/// <summary> /// Registers the <paramref name="targetTracker"/> as line tracker for the <paramref name="textDocument"/>. /// A weak reference to the target tracker will be used, and the WeakLineTracker will deregister itself /// when the target tracker is garbage collected. /// </summary> public static WeakLineTracker Register(TextDocument textDocument, ILineTracker targetTracker) { if (textDocument == null) { throw new ArgumentNullException("textDocument"); } if (targetTracker == null) { throw new ArgumentNullException("targetTracker"); } WeakLineTracker wlt = new WeakLineTracker(textDocument, targetTracker); textDocument.LineTrackers.Add(wlt); return(wlt); }