Esempio n. 1
0
 public FoldingManagerInstallation(TextArea textArea)
     : base(textArea.Document)
 {
     this.textArea = textArea;
     margin = new FoldingMargin() { FoldingManager = this };
     generator = new FoldingElementGenerator() { FoldingManager = this };
     textArea.LeftMargins.Add(margin);
     textArea.TextView.Services.AddService(typeof(FoldingManager), this);
     // HACK: folding only works correctly when it has highest priority
     textArea.TextView.ElementGenerators.Insert(0, generator);
     textArea.Caret.PositionChanged += textArea_Caret_PositionChanged;
 }
Esempio n. 2
0
 public void Uninstall()
 {
     Clear();
     if (textArea != null)
     {
         textArea.Caret.PositionChanged -= textArea_Caret_PositionChanged;
         textArea.LeftMargins.Remove(margin);
         textArea.TextView.ElementGenerators.Remove(generator);
         textArea.TextView.Services.RemoveService(typeof(FoldingManager));
         margin = null;
         generator = null;
         textArea = null;
     }
 }
Esempio n. 3
0
 public FoldingManagerInstallation(TextArea textArea)
     : base(textArea.TextView, textArea.Document)
 {
     this.textArea = textArea;
     margin = new FoldingMargin() { FoldingManager = this };
     generator = new FoldingElementGenerator() { FoldingManager = this };
     textArea.LeftMargins.Add(margin);
     textArea.TextView.ElementGenerators.Add(generator);
     textArea.Caret.PositionChanged += textArea_Caret_PositionChanged;
 }