示例#1
0
		public LineManager(DocumentLineTree documentLineTree, TextDocument document)
		{
			this.document = document;
			this.documentLineTree = documentLineTree;
			UpdateListOfLineTrackers();
			
			Rebuild();
		}
		public LineManager(IList<char> textBuffer, DocumentLineTree documentLineTree, TextDocument document)
		{
			this.document = document;
			this.textBuffer = textBuffer;
			this.documentLineTree = documentLineTree;
			UpdateListOfLineTrackers();
			
			Rebuild();
		}
示例#3
0
        /// <summary>
        /// Create a new text document with the specified initial text.
        /// </summary>
        public TextDocument(IEnumerable<char> initialText)
        {
            if (initialText == null)
              throw new ArgumentNullException("initialText");
              rope = new Rope<char>(initialText);
              lineTree = new DocumentLineTree(this);
              lineManager = new LineManager(lineTree, this);
              lineTrackers.CollectionChanged += delegate {
              lineManager.UpdateListOfLineTrackers();
              };

              anchorTree = new TextAnchorTree(this);
              undoStack = new UndoStack();
              FireChangeEvents();
        }
示例#4
0
		/// <summary>
		/// Rebuild the tree, in O(n).
		/// </summary>
		public void RebuildDocument()
		{
			foreach (CollapsedLineSection s in GetAllCollapsedSections()) {
				s.Start = null;
				s.End = null;
			}
			
			HeightTreeNode[] nodes = new HeightTreeNode[document.LineCount];
			int lineNumber = 0;
			foreach (DocumentLine ls in document.Lines) {
				nodes[lineNumber++] = new HeightTreeNode(ls, defaultLineHeight);
			}
			Debug.Assert(nodes.Length > 0);
			// now build the corresponding balanced tree
			int height = DocumentLineTree.GetTreeHeight(nodes.Length);
			Debug.WriteLine("HeightTree will have height: " + height);
			root = BuildTree(nodes, 0, nodes.Length, height);
			root.color = BLACK;
			#if DEBUG
			CheckProperties();
			#endif
		}
示例#5
0
		public LineManager(DocumentLineTree documentLineTree, TextDocument document) {
			this.document = document;
			this.documentLineTree = documentLineTree;

			Rebuild();
		}
示例#6
0
		public LineManager(GapTextBuffer textBuffer, DocumentLineTree documentLineTree, TextDocument document)
		{
		}
示例#7
0
		/// <summary>
		/// Create a new text document with the specified initial text.
		/// </summary>
		public TextDocument(IEnumerable<char> initialText) {
			if (initialText == null)
				throw new ArgumentNullException("initialText");
			rope = new Rope<char>(initialText);
			lineTree = new DocumentLineTree(this);
			lineManager = new LineManager(lineTree, this);

			FireChangeEvents();
		}