]> git.lyx.org Git - lyx.git/blob - src/undo.h
ca904037d11bf73f3d2c3eaf6549bb817720af78
[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
23 using std::list;
24
25 ///
26 class Undo {
27 public:
28         /// The undo kinds
29         enum undo_kind {
30                 ///
31                 INSERT,
32                 ///
33                 DELETE,
34                 ///
35                 EDIT,
36                 ///
37                 FINISH
38         };
39         ///
40         undo_kind kind;
41         ///
42         int number_of_before_par;
43         ///
44         int number_of_behind_par;
45         ///
46         int number_of_cursor_par;
47         ///
48         int cursor_pos; // valid if >= 0
49         ///
50         LyXParagraph * par;
51         ///
52         Undo(undo_kind kind_arg,
53              int number_before_arg, int number_behind_arg,
54              int cursor_par_arg, int cursor_pos_arg,
55              LyXParagraph * par_arg);
56         ///
57         ~Undo();
58 };
59
60
61 /// A limited Stack for the undo informations.
62 class UndoStack{
63 private:
64         ///
65         typedef list<Undo*> Stakk;
66         ///
67         Stakk stakk;
68         /// the maximum number of undo steps stored.
69         Stakk::size_type limit;
70 public:
71         ///
72         UndoStack();
73         ///
74         Undo * pop();
75         ///
76         Undo * top();
77         ///
78         bool empty() const;
79         ///
80         ~UndoStack();
81         ///
82         void clear();
83         ///
84         void SetStackLimit(Stakk::size_type l);
85         ///
86         void push(Undo * undo_arg);
87 };
88
89 #endif