Exemplo n.º 1
0
        public SqlFoldingStrategy(FoldingManager foldingManager, SqlTextEditor editor)
        {
            FoldingManager = foldingManager;
            FoldingMargin  = editor.TextArea.LeftMargins.OfType <FoldingMargin>().SingleOrDefault();

            _editor = editor;

            editor.TextArea.MouseRightButtonUp += TextAreaMouseRightButtonUpHandler;
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
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;
     }
 }
Exemplo n.º 4
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;
 }
Exemplo n.º 5
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;
 }