r956: README.BUILD - add more library recommendations
[cinelerra_cv/ct.git] / cinelerra / mainundo.h
bloba93b7fdc1ba9e8c20cdad1e9f50e96409ba41468
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