Exemple #1
0
        protected override void SetTextBufferStrategy(ITextDocument textDocument)
        {
            if (TextDocument != null)
            {
                // In case the text buffer strategy already exists, we need to unset this first.
                TextDocument.Modified           -= this.TextDocument_Modified;
                TextDocument.TextSegmentAlter   -= this.TextDocument_TextSegmentAlter;
                TextDocument.TextSegmentRemoved -= this.TextDocument_TextSegmentRemoved;
                TextDocument.TextSegmentAdded   -= this.TextDocument_TextSegmentAdded;
            }

            base.SetTextBufferStrategy(textDocument);

            textDocument = TextDocument;

            textDocument.RegisterTextView(this);

            this._renderer = textDocument.GetRenderer(this);

            textDocument.TextSegmentAlter   += this.TextDocument_TextSegmentAlter;
            textDocument.TextSegmentRemoved += this.TextDocument_TextSegmentRemoved;
            textDocument.TextSegmentAdded   += this.TextDocument_TextSegmentAdded;
            textDocument.Modified           += this.TextDocument_Modified;
        }
Exemple #2
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (TextDocument != null)
            {
                TextDocument.Modified           -= this.TextDocument_Modified;
                TextDocument.TextSegmentAlter   -= this.TextDocument_TextSegmentAlter;
                TextDocument.TextSegmentRemoved -= this.TextDocument_TextSegmentRemoved;
                TextDocument.TextSegmentAdded   -= this.TextDocument_TextSegmentAdded;
            }

            this.ScrollHost.VerticalScrollChanged   -= this.VScroll_ValueChanged;
            this.ScrollHost.HorizontalScrollChanged -= this.HScroll_ValueChanged;
            this.ScrollHost.Detach();

            Events.Dispose();
            this.DisposeBuffer();

            foreach (var textStyle in this._textStyles)
            {
                textStyle.Dispose();
            }

            this._textStyles.Clear();

            if (this.Caret != null)
            {
                this.Caret.Dispose();
                this.Caret = null;
            }

            if (this._renderer != null)
            {
                this._renderer.Dispose();
                this._renderer = null;
            }

            if (this._layoutLinesOverflow != null)
            {
                this._layoutLinesOverflow.Clear();
                this._layoutLinesOverflow = null;
            }

            this._textSegmentSelection = null;

            if (this.backBrush != null)
            {
                this.backBrush.Dispose();
                this.backBrush = null;
            }

            if (this.caretBrushSelection != null)
            {
                this.caretBrushSelection.Dispose();
                this.caretBrushSelection = null;
            }

            foreach (var column in this.Columns)
            {
                column.Dispose();
            }
        }