forked from segfault87/stitchy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editoractions.h
131 lines (104 loc) · 2.21 KB
/
editoractions.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef _EDITORACTIONS_H_
#define _EDITORACTIONS_H_
#include <QList>
#include <QUndoCommand>
class Canvas;
class Cell;
class SelectionGroup;
class SparseMap;
class EditorAction : public QUndoCommand
{
public:
EditorAction(Document *document);
virtual ~EditorAction();
protected:
Document *document_;
};
class CanvasAction : public EditorAction
{
public:
CanvasAction(Document *document, Canvas *canvas);
virtual ~CanvasAction();
protected:
Canvas *canvas_;
};
class MergeAction : public EditorAction
{
public:
MergeAction(Document *document, const SparseMap *map,
const QPoint &point = QPoint());
virtual ~MergeAction();
protected:
void replaceWith(const QList<Cell> &cells);
void mergeWith_(const QList<Cell> &cells);
QList<Cell> previousState_;
QList<Cell> drawn_;
};
class ActionDraw : public MergeAction
{
public:
ActionDraw(Document *document, SparseMap *map);
~ActionDraw();
void redo();
void undo();
};
class ActionErase : public MergeAction
{
public:
ActionErase(Document *document, SparseMap *map);
~ActionErase();
void redo();
void undo();
};
class ActionMove : public EditorAction
{
public:
ActionMove(Document *document, const QPoint &originalPosition,
const QSize &size, SelectionGroup *group);
~ActionMove();
void redo();
void undo();
private:
void setData(SelectionGroup *group);
private:
QSize size_;
QPoint originalPosition_;
QPoint targetPosition_;
SparseMap *map_;
QList<Cell> previousState_;
};
class ActionPaste : public CanvasAction
{
public:
ActionPaste(Document *document, Canvas *canvas, const QByteArray &data);
~ActionPaste();
void redo();
void undo();
private:
QByteArray data_;
};
class ActionFloatMove : public CanvasAction
{
public:
ActionFloatMove(Document *document, Canvas *canvas,
const QPoint &from, const QPoint &to);
~ActionFloatMove();
void redo();
void undo();
private:
QPoint from_;
QPoint to_;
};
class ActionFloatCommit : public MergeAction
{
public:
ActionFloatCommit(Document *document, Canvas *canvas,
SelectionGroup *group);
~ActionFloatCommit();
void redo();
void undo();
private:
Canvas *canvas_;
QByteArray data_;
};
#endif