Exemplo n.º 1
0
        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            TextArea = new TextArea(motherTextEditorControl, this);
            Controls.Add(TextArea);

            VScrollBar.ValueChanged += VScrollBarValueChanged;
            Controls.Add(VScrollBar);

            HScrollBar.ValueChanged += HScrollBarValueChanged;
            Controls.Add(HScrollBar);
            ResizeRedraw       = true;
            AutoHideScrollbars = true;

            Document.TextContentChanged += DocumentTextContentChanged;
            Document.DocumentChanged    += AdjustScrollBarsOnDocumentChange;
            Document.UpdateCommited     += DocumentUpdateCommitted;

            ContextMenuStrip = new ContextMenu(this);
        }
Exemplo n.º 2
0
        public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
        {
            MotherTextAreaControl   = motherTextAreaControl;
            MotherTextEditorControl = motherTextEditorControl;

            Caret            = new Caret(this);
            SelectionManager = new SelectionManager(Document, this);

            ClipboardHandler = new TextAreaClipboardHandler(this);

            ResizeRedraw = true;

            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
//			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
//			SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.Opaque, false);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, true);

            TextView = new TextView(this);

            GutterMargin  = new GutterMargin(this);
            FoldMargin    = new FoldMargin(this);
            IconBarMargin = new IconBarMargin(this);
            leftMargins.AddRange(new AbstractMargin[] { IconBarMargin, GutterMargin, FoldMargin });
            OptionsChanged();


            new TextAreaMouseHandler(this).Attach();
            new TextAreaDragDropHandler().Attach(this);

            bracketshemes.Add(new BracketHighlightingSheme('{', '}'));
            bracketshemes.Add(new BracketHighlightingSheme('(', ')'));
            bracketshemes.Add(new BracketHighlightingSheme('[', ']'));

            Caret.PositionChanged                   += SearchMatchingBracket;
            Document.TextContentChanged             += TextContentChanged;
            Document.FoldingManager.FoldingsChanged += DocumentFoldingsChanged;
        }