A VisualLineElementGenerator that produces line elements for folded FoldingSections.
Inheritance: ICSharpCode.AvalonEdit.Rendering.VisualLineElementGenerator
Ejemplo 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;
			}
Ejemplo n.º 2
0
            /*
             * void DemoMode()
             * {
             *      foldingGenerator = new FoldingElementGenerator() { FoldingManager = fm };
             *      foldingMargin = new FoldingMargin { FoldingManager = fm };
             *      foldingMarginBorder = new Border {
             *              Child = foldingMargin,
             *              Background = new LinearGradientBrush(Colors.White, Colors.Transparent, 0)
             *      };
             *      foldingMarginBorder.SizeChanged += UpdateTextViewClip;
             *      textEditor.TextArea.TextView.ElementGenerators.Add(foldingGenerator);
             *      textEditor.TextArea.LeftMargins.Add(foldingMarginBorder);
             * }
             *
             * void UpdateTextViewClip(object sender, SizeChangedEventArgs e)
             * {
             *      textEditor.TextArea.TextView.Clip = new RectangleGeometry(
             *              new Rect(-foldingMarginBorder.ActualWidth,
             *                       0,
             *                       textEditor.TextArea.TextView.ActualWidth + foldingMarginBorder.ActualWidth,
             *                       textEditor.TextArea.TextView.ActualHeight));
             * }
             */

            public void Uninstall()
            {
                Clear();
                if (textArea != null)
                {
                    textArea.Caret.PositionChanged -= textArea_Caret_PositionChanged;
                    textArea.LeftMargins.Remove(margin);
                    textArea.TextView.ElementGenerators.Remove(generator);
                    margin    = null;
                    generator = null;
                    textArea  = null;
                }
            }
Ejemplo 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;
 }