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