]> git.lyx.org Git - lyx.git/blob - src/undo.h
make text private in LyXParagraph some changes to import ascii file
[lyx.git] / src / undo.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *       
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef UNDO_H
13 #define UNDO_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "lyxparagraph.h"
20
21 #include <list>
22 using std::list;
23
24 ///
25 class Undo {
26 public:
27         /// The undo kinds
28         enum undo_kind {
29                 ///
30                 INSERT,
31                 ///
32                 DELETE,
33                 ///
34                 EDIT,
35                 ///
36                 FINISH
37         };
38         ///
39         undo_kind kind;
40         ///
41         int number_of_before_par;
42         ///
43         int number_of_behind_par;
44         ///
45         int number_of_cursor_par;
46         ///
47         int cursor_pos; // valid if >= 0
48         ///
49         LyXParagraph * par;
50         ///
51         Undo(undo_kind kind_arg,
52              int number_before_arg, int number_behind_arg,
53              int cursor_par_arg, int cursor_pos_arg,
54              LyXParagraph * par_arg);
55         ///
56         ~Undo();
57 };
58
59
60 /// A limited Stack for the undo informations.
61 class UndoStack{
62 private:
63         ///
64         typedef list<Undo*> Stakk;
65         ///
66         Stakk stakk;
67         /// the maximum number of undo steps stored.
68         Stakk::size_type limit;
69 public:
70         ///
71         UndoStack();
72         ///
73         Undo * pop();
74         ///
75         Undo * top();
76         ///
77         bool empty() const;
78         ///
79         ~UndoStack();
80         ///
81         void clear();
82         ///
83         void SetStackLimit(Stakk::size_type l);
84         ///
85         void push(Undo * undo_arg);
86 };
87
88 #endif