public void Dispose ()
		{
			options = options.Kill ();
			
			DetachDocument ();
			if (caret != null) {
				caret.PositionChanged -= CaretPositionChanged;
				caret = null;
			}
		}
		public TextEditorData (Document doc)
		{
			LineHeight = 16;
			
			caret = new Caret (this);
			caret.PositionChanged += CaretPositionChanged;
			
			options = TextEditorOptions.DefaultOptions;
			Document = doc;
			this.SearchEngine = new BasicSearchEngine ();
			
			this.heightTree = new HeightTree (this);
			this.heightTree.Rebuild ();
		}
Beispiel #3
0
		public TextEditorData (TextDocument doc)
		{
			LineHeight = 16;

			caret = new Caret (this);
			caret.PositionChanged += CaretPositionChanged;

			options = TextEditorOptions.DefaultOptions;
			
			document = doc;
			document.BeginUndo += OnBeginUndo;
			document.EndUndo += OnEndUndo;

			document.Undone += DocumentHandleUndone;
			document.Redone += DocumentHandleRedone;
			document.LineChanged += HandleDocLineChanged;
			document.TextReplaced += HandleTextReplaced;

			document.TextSet += HandleDocTextSet;
			document.Folded += HandleTextEditorDataDocumentFolded;
			document.FoldTreeUpdated += HandleFoldTreeUpdated;
			SearchEngine = new BasicSearchEngine ();

			HeightTree = new HeightTree (this);
			HeightTree.Rebuild ();
		}
		public TextEditorData (Document doc)
		{
			caret = new Caret (this);
			caret.PositionChanged += CaretPositionChanged;
			
			options = TextEditorOptions.DefaultOptions;
			Document = doc;
			this.SearchEngine = new BasicSearchEngine ();
			SelectionChanging += HandleSelectionChanging;
		}
		public void Dispose ()
		{
			options = options.Kill ();
			
			if (document != null) {
				document.LineChanged -= HandleDocLineChanged;
				document.BeginUndo -= OnBeginUndo;
				document.EndUndo   -= OnEndUndo;
				document.Undone -= DocumentHandleUndone;
				document.Redone -= DocumentHandleRedone;
				
				// DOCUMENT MUST NOT BE DISPOSED !!! (Split View shares document)
				document = null;
			}
			if (caret != null) {
				caret.PositionChanged -= CaretPositionChanged;
				caret = null;
			}
			SelectionChanging -= HandleSelectionChanging;
		}
Beispiel #6
0
		static void UpdateCaretPosition (Caret caret)
		{
			int offset = caret.Offset;
			if (offset < 0 || offset > caret.TextEditorData.Document.Length)
				return;
			DocumentLocation location = caret.TextEditorData.LogicalToVisualLocation (caret.Location);
			IdeApp.Workbench.StatusBar.ShowCaretState (caret.Line + 1,
			                                           location.Column + 1,
			                                           caret.TextEditorData.IsSomethingSelected ? caret.TextEditorData.SelectionRange.Length : 0,
			                                           caret.IsInInsertMode);
		}
Beispiel #7
0
		public TextEditorData (TextDocument doc)
		{
			LineHeight = 16;

			caret = new Caret (this);
			caret.PositionChanged += CaretPositionChanged;

			options = TextEditorOptions.DefaultOptions;
			document = doc;
			AttachDocument ();
			SearchEngine = new BasicSearchEngine ();

			HeightTree = new HeightTree (this);
			HeightTree.Rebuild ();
			IndentationTracker = new DefaultIndentationTracker (document);
		}