18 new shapewipe transitions from rafa, rework savefile/confirm for nested edl edits
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mainundo.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef MAINUNDO_H
23 #define MAINUNDO_H
24
25 #include <stdio.h>
26 #include <stdint.h>
27
28 #include "bctimer.inc"
29 #include "filexml.inc"
30 #include "mwindow.inc"
31 #include "undostack.inc"
32
33
34 class MainUndo
35 {
36 public:
37         MainUndo(MWindow *mwindow);
38         ~MainUndo();
39
40 // For tweeking operations:
41 // If a pair of update_undo_before and update_undo_after are called
42 // within a certain time limit and the creator is nonzero and equal,
43 // the before undo is discarded and the previous after undo is replaced.
44         void update_undo_before(const char *description = "",
45                 void *creator = 0);
46         void update_undo_after(const char *description,
47                 uint32_t load_flags,
48                 int changes_made = 1);
49
50 // Used in undo and redo to reset the creators in all the records.
51         void reset_creators();
52
53         int undo();
54         int redo();
55
56 // load_flags for the next undo/redo stack item
57         int undo_load_flags();
58         int redo_load_flags();
59         void dump(FILE *fp=stdout);
60
61         void save(FILE *fp);
62         void load(FILE *fp);
63 private:
64 // Entry point for all update commands
65         void update_undo_entry(const char *description,
66                 uint32_t load_flags,
67                 void *creator,
68                 int changes_made);
69         int load_from_undo(FileXML *file, uint32_t load_flags);
70
71 // Placing the before & after undo operations in the same stack makes the
72 // compression more efficient.
73 // So even numbers are before and odd numbers are after
74         UndoStack *undo_stack;
75         UndoStackItem *next_undo();
76         UndoStackItem *next_redo();
77
78 // loads undo from the stringfile to the project
79         int load_undo_before(FileXML *file, uint32_t load_flags);
80         int load_undo_after(FileXML *file, uint32_t load_flags);
81
82
83         MWindow *mwindow;
84         Timer *last_update;
85 };
86
87 #endif