Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / mainundo.h
blob3526f15bd2de210d0bfd27e7955b91923a413d94
1 #ifndef MAINUNDO_H
2 #define MAINUNDO_H
5 #include "bctimer.inc"
6 #include "linklist.h"
7 #include "mwindow.inc"
9 #include <stdint.h>
12 class UndoStackItem;
13 class MainUndoStackItem;
16 class MainUndo
18 public:
19 MainUndo(MWindow *mwindow);
20 ~MainUndo();
22 // Use this function for UndoStackItem subclasses with custom
23 // undo and redo functions. All fields including description must
24 // be populated before calling this function.
25 void push_undo_item(UndoStackItem *item);
27 void update_undo(char *description,
28 uint32_t load_flags,
29 void *creator = 0,
30 int changes_made = 1);
32 // alternatively, call this one after the change
33 void push_state(char *description, uint32_t load_flags, void* creator);
35 // Used in undo and redo to reset the creators in all the records.
36 void reset_creators();
38 int undo();
39 int redo();
41 private:
42 List<UndoStackItem> undo_stack;
43 List<UndoStackItem> redo_stack;
44 MainUndoStackItem* new_entry; // for setting the after buffer
46 MWindow *mwindow;
47 Timer *last_update;
48 char* data_after; // the state after a change
50 void capture_state();
51 void prune_undo();
52 bool ignore_push(char *description, uint32_t load_flags, void* creator);
54 friend class MainUndoStackItem;
57 #endif
59 // Local Variables:
60 // mode: C++
61 // c-file-style: "linux"
62 // End: