]> git.lyx.org Git - lyx.git/blob - src/undo.h
fixes to compile and link gtk
[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_fwd.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 plist,
49              int first, int last,
50              int cursor, int cursor_pos,
51              ParagraphList const & par_arg);
52
53         /// Which kind of operation are we recording for?
54         undo_kind kind;
55
56         /// to what paragraph list do we belong?
57         int plist;
58
59         /**
60          * ID of hosting inset if the cursor is in one.
61          * if -1, then the cursor is not in an inset.
62          * if >= 0, then the cursor is in inset with given id.
63          */
64         int inset_id;
65
66         /// Offset to the first paragraph in the main document paragraph list
67         int first_par_offset;
68
69         /// Offset to the last paragraph from the end of the main par. list
70         int last_par_offset;
71
72         /**
73          * Offset from the start of the main document paragraph list,
74          * except if inside an inset, in which case it's the offset
75          * inside the hosting inset.
76          */
77         int cursor_par_offset;
78
79         /// The position of the cursor in the hosting paragraph
80         int cursor_pos;
81
82         /// The contents of the paragraphs saved
83         ParagraphList pars;
84 };
85
86
87 #endif