Example #1
0
 public HeightTree(TextDocument document, double defaultLineHeight)
 {
     this.document = document;
     weakLineTracker = WeakLineTracker.Register(document, this);
     this.DefaultLineHeight = defaultLineHeight;
     RebuildDocument();
 }
Example #2
0
 /// <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;
 }
Example #3
0
 public void Dispose()
 {
     if (weakLineTracker != null)
         weakLineTracker.Deregister();
     this.root = null;
     this.weakLineTracker = null;
 }