public SqlFoldingStrategy(FoldingManager foldingManager, SqlTextEditor editor) { FoldingManager = foldingManager; FoldingMargin = editor.TextArea.LeftMargins.OfType <FoldingMargin>().SingleOrDefault(); _editor = editor; editor.TextArea.MouseRightButtonUp += TextAreaMouseRightButtonUpHandler; }
private void SetFolding() { foldingManager = FoldingManager.Install(TextArea); FoldingMargin m = new FoldingMargin() { FoldingManager = foldingManager }; m.FoldingMarkerBackgroundBrush = Brushes.Transparent; m.SelectedFoldingMarkerBackgroundBrush = Brushes.Transparent; m.FoldingMarkerBrush = Foreground; m.SelectedFoldingMarkerBrush = Foreground; var lm = TextArea.LeftMargins; lm.Remove(lm.Last()); TextArea.LeftMargins.Add(m); }
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; } }
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; }
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; }