0:   //  UndoableInsert.cs 
1:   //  Copyright (c) 2000 Mike Krueger
2:   //
3:   //  This program is free software; you can redistribute it and/or modify
4:   //  it under the terms of the GNU General Public License as published by
5:   //  the Free Software Foundation; either version 2 of the License, or
6:   //  (at your option) any later version.
7:   //
8:   //  This program is distributed in the hope that it will be useful,
9:   //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10:   //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11:   //  GNU General Public License for more details.
12:   //
13:   //  You should have received a copy of the GNU General Public License
14:   //  along with this program; if not, write to the Free Software
15:   //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16:  
17:   using System;
18:   using System.Diagnostics;
19:   using System.Drawing;
20:  
21:   using SharpDevelop.Internal.Text;
22:  
23:   namespace SharpDevelop.Internal.Undo {
24:       
25:       /// <summary>
26:       /// This class is for the undo of TextBuffer insert operations
27:       /// </summary>
28:       class UndoableInsert : IUndoableOperation
29:       {
30:           TextBuffer buffer;
31:           Point      fromto;
32:           string     text;
33:           
34:           public UndoableInsert(TextBuffer bufferPoint fromPoint tostring text)
35:           {
36:               if (buffer == null)
37:                   throw new ArgumentNullException("UndoableInsert(TextBuffer buffer, Point from, Point to, string text) : buffer can't be null");
38:               
39:               Debug.Assert(text != null"SharpDevelop.Internal.Undo.UndoableInsert : text == null");
40:               
41:               this.buffer buffer;
42:               this.from   from;
43:               this.to     to;
44:               this.text   text;
45:           }
46:           
47:           public void Undo()
48:           {
49:               buffer._Delete(fromto);
50:           }
51:           
52:           public void Redo()
53:           {
54:               buffer._Insert(fromtext);
55:           }
56:       }
57:   }
58:  

This page was automatically generated by SharpDevelop.