forked from dliganov/Chaotic-DAW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Awful_UndoRedo.h
70 lines (58 loc) · 1.51 KB
/
Awful_UndoRedo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef UNDOREDO_H
#define UNDOREDO_H
#include "awful.h"
#include "awful_elements.h"
#include "awful_panels.h"
typedef enum ActionType
{
Action_Empty,
Action_Add,
Action_Delete,
Action_Move,
Action_Bind,
Action_ParamChange,
Action_Resize
}ActionType;
typedef struct Action
{
ActionType atype;
void* adata1;
void* adata2;
void* adata3;
float f1;
float f2;
int i1;
int i2;
int groupID;
Action* prev;
Action* next;
}Action;
// We have our own native undo manager
class UndoManagerC
{
public:
Action* first_action;
Action* last_action;
Action* current_action;
int current_group;
bool started;
UndoManagerC();
void StartNewGroup();
void Perform(Action* act);
void Unperform(Action* current_action);
Action* FlushSkipped(Action* fnext, Element* eltodel);
void FlushFurtherActions();
bool IsOK(ActionType atype, void* adata);
void DoNewAction(ActionType atype, void* adata1, void* adata2, void* adata3);
void DoNewAction(ActionType atype, void* adata1, float f1, float f2, int i1, int i2);
void RedoAction();
void UndoAction();
void AddAction(Action* a);
void RemoveAction(Action* a);
void WipeElementFromHistory(Element* el);
void WipeInstrumentFromHistory(Instrument* i);
void WipeParameterFromHistory(Parameter* param);
void WipeEffectFromHistory(Eff* eff);
void WipeEntireHistory();
};
#endif //UNDOREDO_H