prevent popup deactivation while button_down
[goodguy/history.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
41
42
43 // For tweeking operations:
44 // If a pair of update_undo_before and update_undo_after are called
45 // within a certain time limit and the creator is nonzero and equal,
46 // the before undo is discarded and the previous after undo is replaced.
47         void update_undo_before(const char *description = "", 
48                 void *creator = 0);
49         void update_undo_after(const char *description, 
50                 uint32_t load_flags,
51                 int changes_made = 1);
52
53 // Used in undo and redo to reset the creators in all the records.
54         void reset_creators();
55
56         int undo();
57         int redo();
58
59         void dump(FILE *fp=stdout);
60 private:
61 // Entry point for all update commands
62         void update_undo_entry(const char *description, 
63                 uint32_t load_flags, 
64                 void *creator, 
65                 int changes_made);
66         int load_from_undo(FileXML *file, uint32_t load_flags);    
67
68 // Placing the before & after undo operations in the same stack makes the
69 // compression more efficient.
70 // So even numbers are before and odd numbers are after
71         UndoStack *undo_stack;
72
73
74
75
76 // loads undo from the stringfile to the project
77         int load_undo_before(FileXML *file, uint32_t load_flags);    
78         int load_undo_after(FileXML *file, uint32_t load_flags);    
79
80
81         MWindow *mwindow;
82         Timer *last_update;
83 };
84
85 #endif