Mon, 10 Jun 2013 15:15:23 +0300
Laid down the foundations of the new history system
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #ifndef HISTORY_H |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #define HISTORY_H |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "common.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "ldtypes.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #define IMPLEMENT_HISTORY_TYPE(N) \ |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | virtual ~N##History (); \ |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
27 | virtual void undo () const; \ |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
28 | virtual void redo () const; \ |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
29 | virtual History::Type type () { return History::N; } |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
31 | class AbstractHistoryEntry; |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
32 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | // ============================================================================= |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
34 | class History { |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
35 | PROPERTY (long, pos, setPos) |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
36 | PROPERTY (LDOpenFile*, file, setFile) |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
37 | READ_PROPERTY (bool, opened, setOpened) |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
38 | |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
39 | public: |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
40 | typedef vector<AbstractHistoryEntry*> list; |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
41 | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
42 | enum Type { |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
43 | Del, |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
44 | Edit, |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
45 | ListMove, |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
46 | Add, |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
47 | Move, |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
48 | }; |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
49 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
50 | History (); |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
51 | void undo (); |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
52 | void redo (); |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
53 | void clear (); |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
54 | void updateActions (); |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
55 | |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
56 | void open (); |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
57 | void close (); |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
58 | void add (AbstractHistoryEntry* entry); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
59 | long size () const { return m_changesets.size (); } |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
60 | |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
61 | History& operator<< (AbstractHistoryEntry* entry) { |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
62 | add (entry); |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
63 | return *this; |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
64 | } |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
65 | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
66 | const list& changeset (long pos) const { |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
67 | return m_changesets[pos]; |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
68 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
69 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
70 | private: |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
71 | list m_currentArchive; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
72 | vector<list> m_changesets; |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
73 | }; |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
74 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | // ============================================================================= |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
78 | class AbstractHistoryEntry { |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
79 | PROPERTY (History*, parent, setParent) |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
80 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | public: |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
82 | virtual void undo () const {} |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
83 | virtual void redo () const {} |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
84 | virtual ~AbstractHistoryEntry () {} |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
85 | virtual History::Type type () { return (History::Type) 0; } |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | // ============================================================================= |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
91 | class DelHistory : public AbstractHistoryEntry { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | public: |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | enum Type { |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
94 | Cut, // was deleted with a cut operation |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
95 | Other, // was deleted witout specific reason |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
98 | PROPERTY (ulong, index, setIndex) |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
99 | PROPERTY (str, code, setCode) |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
100 | PROPERTY (DelHistory::Type, type, setType) |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
101 | |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
102 | public: |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | IMPLEMENT_HISTORY_TYPE (Del) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
105 | DelHistory (ulong idx, LDObject* obj, Type type = Other) : |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
106 | m_index (idx), m_code (obj->raw ()), m_type (type) {} |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | // ============================================================================= |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
112 | class EditHistory : public AbstractHistoryEntry { |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
113 | PROPERTY (ulong, index, setIndex) |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
114 | PROPERTY (str, oldCode, setOldCode) |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
115 | PROPERTY (str, newCode, setNewCode) |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
116 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | public: |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | IMPLEMENT_HISTORY_TYPE (Edit) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
120 | EditHistory (ulong idx, str oldCode, str newCode) : |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
121 | m_index (idx), m_oldCode (oldCode), m_newCode (newCode) {} |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | // ============================================================================= |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
127 | class ListMoveHistory : public AbstractHistoryEntry { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | public: |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | IMPLEMENT_HISTORY_TYPE (ListMove) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
131 | vector<ulong> idxs; |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
132 | long dest; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
134 | ListMoveHistory (vector<ulong> idxs, long dest) : |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
135 | idxs (idxs), dest (dest) {} |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | // ============================================================================= |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
141 | class AddHistory : public AbstractHistoryEntry { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | public: |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | enum Type { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | Other, // was "just added" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | Paste, // was added through a paste operation |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
148 | PROPERTY (ulong, index, setIndex) |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
149 | PROPERTY (str, code, setCode) |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
150 | PROPERTY (AddHistory::Type, type, setType) |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
151 | |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
152 | public: |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
153 | IMPLEMENT_HISTORY_TYPE (Add) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
155 | AddHistory (ulong idx, LDObject* obj, Type type = Other) : |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
156 | m_index (idx), m_code (obj->raw ()), m_type (type) {} |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | // ============================================================================= |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
162 | class MoveHistory : public AbstractHistoryEntry { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | public: |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | IMPLEMENT_HISTORY_TYPE (Move) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
166 | vector<ulong> indices; |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
167 | vertex dest; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
169 | MoveHistory (vector<ulong> indices, vertex dest) : |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
170 | indices (indices), dest (dest) {} |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | #endif // HISTORY_H |