]> git.lyx.org Git - lyx.git/blob - src/undo.h
Point fix, earlier forgotten
[lyx.git] / src / undo.h
1 // -*- C++ -*-
2 /**
3  * \file undo.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Asger Alstrup
8  * \author Lars Gullik Bjønnes
9  * \author André Pönitz
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef UNDO_H
15 #define UNDO_H
16
17 #include "ParagraphList.h"
18
19 /**
20  * These are the elements put on the undo stack. Each object
21  * contains complete paragraphs and sufficient information
22  * to restore the state. The work is done in undo_funcs.C
23  */
24 class Undo {
25 public:
26         /**
27          * The undo kinds are used to combine consecutive undo recordings
28          * of the same kind.
29          */
30         enum undo_kind {
31                 /**
32                  * Insert something - these will combine to one big chunk
33                  * when many inserts come after each other.
34                  */
35                 INSERT,
36
37                 /**
38                  * Delete something - these will combine to one big chunk
39                  * when many deletes come after each other.
40                  */
41                 DELETE,
42
43                 /// Atomic - each of these will have its own entry in the stack
44                 ATOMIC
45         };
46         ///
47         Undo(undo_kind kind, int inset_id,
48              int first, int last,
49              int cursor, int cursor_pos,
50              ParagraphList const & par_arg);
51
52         /// Which kind of operation are we recording for?
53         undo_kind kind;
54
55         /**
56          * ID of hosting inset if the cursor is in one. 
57          * if -1, then the cursor is not in an inset.
58          * if >= 0, then the cursor is in inset with given id.
59          */ 
60         int inset_id;
61
62         /// Offset to the first paragraph in the main document paragraph list
63         int first_par_offset;
64
65         /// Offset to the last paragraph from the end of the main par. list
66         int last_par_offset;
67
68         /**
69          * Offset from the start of the main document paragraph list,
70          * except if inside an inset, in which case it's the offset
71          * inside the hosting inset.
72          */
73         int cursor_par_offset;
74
75         /// The position of the cursor in the hosting paragraph
76         int cursor_pos;
77
78         /// The contents of the paragraphs saved
79         ParagraphList pars;
80 };
81
82
83 #endif