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