Thu, 11 Apr 2013 17:15:01 +0300
Recent files are now remembered and displayed in a submenu
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri `arezey` Piippo |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #ifndef HISTORY_H |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #define HISTORY_H |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "common.h" |
93
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
23 | #include "ldtypes.h" |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #define IMPLEMENT_HISTORY_TYPE(N) \ |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
26 | virtual ~N##History (); \ |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
27 | virtual void undo (); \ |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
28 | virtual void redo (); \ |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
29 | virtual HistoryType type () { return HISTORY_##N; } |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
31 | // ============================================================================= |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
32 | enum HistoryType { |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
33 | HISTORY_Del, |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
34 | HISTORY_SetColor, |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
35 | HISTORY_SetContents, |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
36 | HISTORY_ListMove, |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
37 | HISTORY_Add, |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
38 | HISTORY_QuadSplit, |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
39 | HISTORY_Inline, |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
40 | }; |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
42 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
44 | // ============================================================================= |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | class HistoryEntry { |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | public: |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | virtual void undo () {} |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | virtual void redo () {} |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | virtual ~HistoryEntry () {} |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
50 | virtual HistoryType type () { return (HistoryType)(0); } |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | }; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
53 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
54 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
55 | // ============================================================================= |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
56 | class DelHistory : public HistoryEntry { |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | public: |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
58 | enum Type { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
59 | Cut, // were deleted with a cut operation |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
60 | Other, // were deleted witout specific reason |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
61 | }; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
62 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
63 | IMPLEMENT_HISTORY_TYPE (Del) |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | vector<ulong> indices; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | vector<LDObject*> cache; |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
67 | const Type eType; |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
69 | DelHistory (vector<ulong> indices, vector<LDObject*> cache, const Type eType = Other) : |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
70 | indices (indices), cache (cache), eType (eType) {} |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | }; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
73 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
74 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
75 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
76 | class SetColorHistory : public HistoryEntry { |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
77 | public: |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
78 | IMPLEMENT_HISTORY_TYPE (SetColor) |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
79 | |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
80 | vector<ulong> ulaIndices; |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
81 | vector<short> daColors; |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
82 | short dNewColor; |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
83 | |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
84 | SetColorHistory (vector<ulong> ulaIndices, vector<short> daColors, short dNewColor) : |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
85 | ulaIndices (ulaIndices), daColors (daColors), dNewColor (dNewColor) {} |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
86 | }; |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
87 | |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
88 | // ============================================================================= |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
89 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
90 | // ============================================================================= |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
91 | class SetContentsHistory : public HistoryEntry { |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
92 | public: |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
93 | IMPLEMENT_HISTORY_TYPE (SetContents) |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
94 | |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
95 | ulong ulIndex; |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
96 | LDObject* oldObj, *newObj; |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
97 | |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
98 | SetContentsHistory (ulong ulIndex, LDObject* oldObj, LDObject* newObj) : |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
99 | ulIndex (ulIndex), oldObj (oldObj), newObj (newObj) {} |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
100 | }; |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
101 | |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
102 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
103 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
104 | // ============================================================================= |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
105 | class ListMoveHistory : public HistoryEntry { |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
106 | public: |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
107 | IMPLEMENT_HISTORY_TYPE (ListMove) |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
108 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
109 | std::vector<ulong> ulaIndices; |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
110 | bool bUp; |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
111 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
112 | std::vector<LDObject*> getObjects (short ofs); |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
113 | ListMoveHistory (vector<ulong> ulaIndices, const bool bUp) : |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
114 | ulaIndices (ulaIndices), bUp (bUp) {} |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
115 | }; |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
116 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
117 | // ============================================================================= |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
118 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
119 | // ============================================================================= |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
120 | class AddHistory : public HistoryEntry { |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
121 | public: |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
122 | enum Type { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
123 | Other, // was "just added" |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
124 | Paste, // was added through a paste operation |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
125 | }; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
126 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
127 | IMPLEMENT_HISTORY_TYPE (Add) |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
128 | |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
129 | std::vector<ulong> ulaIndices; |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
130 | std::vector<LDObject*> paObjs; |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
131 | const Type eType; |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
132 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
133 | AddHistory (std::vector<ulong> ulaIndices, std::vector<LDObject*> paObjs, |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
134 | const Type eType = Other) : |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
135 | ulaIndices (ulaIndices), paObjs (paObjs), eType (eType) {} |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
136 | }; |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
137 | |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
138 | // ============================================================================= |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
139 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
140 | // ============================================================================= |
93
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
141 | class QuadSplitHistory : public HistoryEntry { |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
142 | public: |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
143 | IMPLEMENT_HISTORY_TYPE (QuadSplit) |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
144 | |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
145 | std::vector<ulong> ulaIndices; |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
146 | std::vector<LDQuad*> paQuads; |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
147 | |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
148 | QuadSplitHistory (std::vector<ulong> ulaIndices, std::vector<LDQuad*> paQuads) : |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
149 | ulaIndices (ulaIndices), paQuads (paQuads) {} |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
150 | }; |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
151 | |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
152 | // ============================================================================= |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
153 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
154 | // ============================================================================= |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
155 | class InlineHistory : public HistoryEntry { |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
156 | public: |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
157 | IMPLEMENT_HISTORY_TYPE (Inline) |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
158 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
159 | const std::vector<ulong> ulaBitIndices, ulaRefIndices; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
160 | const std::vector<LDSubfile*> paRefs; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
161 | const bool bDeep; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
162 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
163 | InlineHistory (const std::vector<ulong> ulaBitIndices, const std::vector<ulong> ulaRefIndices, |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
164 | const std::vector<LDSubfile*> paRefs, const bool bDeep) : |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
165 | ulaBitIndices (ulaBitIndices), ulaRefIndices (ulaRefIndices), paRefs (paRefs), bDeep (bDeep) {} |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
166 | }; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
167 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
168 | // ============================================================================= |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
169 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
170 | // ============================================================================= |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | namespace History { |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | extern std::vector<HistoryEntry*> entries; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | void addEntry (HistoryEntry* entry); |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | void undo (); |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | void redo (); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
177 | void clear (); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
178 | void updateActions (); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
179 | long pos (); |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
180 | }; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | #endif // HISTORY_H |