Reorganize archiver by introducing non deterministic patches
[texmacs.git] / src / src / Data / History / archiver.hpp
blob77fbabebe1b1702335a02588f6a6ab64c702654b
2 /******************************************************************************
3 * MODULE : archiver.hpp
4 * DESCRIPTION: undo/redo history
5 * COPYRIGHT : (C) 2009 Joris van der Hoeven
6 *******************************************************************************
7 * This software falls under the GNU general public license version 3 or later.
8 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
9 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10 ******************************************************************************/
12 #ifndef ARCHIVER_H
13 #define ARCHIVER_H
14 #include "patch.hpp"
16 class archiver_rep: public concrete_struct {
17 patch archive; // undo and redo archive
18 patch current; // current sequence of modifications
19 int depth; // archive depth
20 int last_save; // archive depth at last save
21 int last_autosave; // archive depth at last autosave
23 protected:
24 void apply (patch p);
25 void show_all ();
27 public:
28 archiver_rep ();
29 ~archiver_rep ();
30 void clear ();
32 void add (patch p);
33 void start_slave (double a);
34 bool active ();
35 bool has_history ();
36 void cancel (); // cancel current series of modifications
37 void confirm (); // move current modifications to history
38 void retract (); // reopen last history item for further modifications
39 void forget (); // undo and forget about last history item
40 void simplify ();
42 int undo_possibilities ();
43 int redo_possibilities ();
44 path undo_one (int i);
45 path redo_one (int i);
46 path undo (int i=0);
47 path redo (int i=0);
49 void require_save ();
50 void require_autosave ();
51 void notify_save ();
52 void notify_autosave ();
53 bool conform_save ();
54 bool conform_autosave ();
57 class archiver {
58 CONCRETE (archiver);
59 archiver ();
61 CONCRETE_CODE (archiver);
63 #endif // defined ARCHIVER_H