protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (!disposed)
         {
             disposed = true;
             Document.TextContentChanged -= DocumentTextContentChanged;
             Document.DocumentChanged    -= AdjustScrollBarsOnDocumentChange;
             Document.UpdateCommited     -= DocumentUpdateCommitted;
             motherTextEditorControl      = null;
             if (vScrollBar != null)
             {
                 vScrollBar.Dispose();
                 vScrollBar = null;
             }
             if (hScrollBar != null)
             {
                 hScrollBar.Dispose();
                 hScrollBar = null;
             }
             if (hRuler != null)
             {
                 hRuler.Dispose();
                 hRuler = null;
             }
         }
     }
     base.Dispose(disposing);
 }
Пример #2
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         if (!disposed)
         {
             disposed = true;
             if (caret != null)
             {
                 caret.PositionChanged -= new EventHandler(SearchMatchingBracket);
                 caret.Dispose();
             }
             if (selectionManager != null)
             {
                 selectionManager.Dispose();
             }
             Document.TextContentChanged             -= new EventHandler(TextContentChanged);
             Document.FoldingManager.FoldingsChanged -= new EventHandler(DocumentFoldingsChanged);
             motherTextAreaControl   = null;
             motherTextEditorControl = null;
             foreach (AbstractMargin margin in leftMargins)
             {
                 if (margin is IDisposable)
                 {
                     (margin as IDisposable).Dispose();
                 }
             }
             textView.Dispose();
         }
     }
 }
        public TextAreaControl(CodeView motherTextEditorControl)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            this.textArea = new TextArea(motherTextEditorControl, this);


            Controls.Add(textArea);

            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(this.vScrollBar);

            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
            Controls.Add(this.hScrollBar);
            ResizeRedraw = true;

            Document.TextContentChanged += DocumentTextContentChanged;
            Document.DocumentChanged    += AdjustScrollBarsOnDocumentChange;
            Document.UpdateCommited     += DocumentUpdateCommitted;
        }
Пример #4
0
        public TextArea(CodeView motherTextEditorControl, TextAreaControl motherTextAreaControl)
        {
            this.motherTextAreaControl   = motherTextAreaControl;
            this.motherTextEditorControl = motherTextEditorControl;

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

            this.textAreaClipboardHandler = 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                   += new EventHandler(SearchMatchingBracket);
            Document.TextContentChanged             += new EventHandler(TextContentChanged);
            Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged);
        }