public DocumentUndoManager (DocumentBuffer buffer)
	{
		frozen_cnt = 0;
		try_merge = false;
		undo_stack = new Stack ();
		redo_stack = new Stack ();
		
		this.buffer  = buffer;
		chop_buffer = new ChopBuffer (buffer.TagTable);
		
		buffer.InsertText += OnInsertText;
		buffer.DeleteRange += OnDeleteRange;
	}
        public DocumentUndoManager(DocumentBuffer buffer)
        {
            frozen_cnt = 0;
            try_merge  = false;
            undo_stack = new Stack();
            redo_stack = new Stack();

            this.buffer = buffer;
            chop_buffer = new ChopBuffer(buffer.TagTable);

            buffer.InsertText  += OnInsertText;
            buffer.DeleteRange += OnDeleteRange;
        }
        public void TestDeserializePerformance()
        {
            foreach (string file in files)
            {
                DocumentEditor editor = new DocumentEditor();
                DocumentBuffer buffer = (DocumentBuffer)editor.Buffer;

                MonoDocument document = new MonoDocument(file);
                string       filename = Path.GetFileName(file);

                buffer.Undoer.FreezeUndo();
                DateTime startTime = DateTime.Now;
                DocumentBufferArchiver.Deserialize(buffer, document.Xml);
                DateTime stopTime = DateTime.Now;
                buffer.Undoer.ThrawUndo();

                TimeSpan duration = stopTime - startTime;
                Assert.Less(duration.TotalMilliseconds, 1000, "SP:" + filename);
            }
        }
        public void TestSerialize()
        {
            string originalXml, newXml, filename;

            foreach (string file in files)
            {
                DocumentEditor editor = new DocumentEditor();
                DocumentBuffer buffer = (DocumentBuffer)editor.Buffer;

                MonoDocument document = new MonoDocument(file);
                filename    = Path.GetFileName(file);
                originalXml = document.Xml;

                buffer.Undoer.FreezeUndo();
                DocumentBufferArchiver.Deserialize(buffer, originalXml);
                buffer.Undoer.ThrawUndo();
                newXml = DocumentBufferArchiver.Serialize(buffer);

                Assert.AreEqual(originalXml, newXml, "SR:" + filename);
            }
        }