Mon, 06 May 2013 15:39:45 +0300
Further work on ext programs, LDObjectType_e integrated into LDObject
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 |
104 | 3 | * Copyright (C) 2013 Santeri Piippo |
85
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, |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
35 | HISTORY_Edit, |
96
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, |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
40 | HISTORY_Move, |
118
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
41 | HISTORY_Combo, |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
42 | }; |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
44 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
46 | // ============================================================================= |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | class HistoryEntry { |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | public: |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | virtual void undo () {} |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | virtual void redo () {} |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | virtual ~HistoryEntry () {} |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
52 | 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
|
53 | }; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
55 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
56 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
57 | // ============================================================================= |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
58 | 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
|
59 | public: |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
60 | enum Type { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
61 | Cut, // were deleted with a cut operation |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
62 | Other, // were deleted witout specific reason |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
63 | }; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
64 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
65 | 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
|
66 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | vector<ulong> indices; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | vector<LDObject*> cache; |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
69 | const Type eType; |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
71 | 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
|
72 | 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
|
73 | }; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | |
89
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 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
77 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
78 | class SetColorHistory : public HistoryEntry { |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
79 | public: |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
80 | IMPLEMENT_HISTORY_TYPE (SetColor) |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
81 | |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
82 | vector<ulong> ulaIndices; |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
83 | vector<short> daColors; |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
84 | short dNewColor; |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
85 | |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
86 | SetColorHistory (vector<ulong> ulaIndices, vector<short> daColors, short dNewColor) : |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
87 | ulaIndices (ulaIndices), daColors (daColors), dNewColor (dNewColor) {} |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
88 | }; |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
89 | |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
90 | // ============================================================================= |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
91 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
92 | // ============================================================================= |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
93 | class EditHistory : public HistoryEntry { |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
94 | public: |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
95 | IMPLEMENT_HISTORY_TYPE (Edit) |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
96 | |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
97 | const std::vector<ulong> ulaIndices; |
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
98 | const std::vector<LDObject*> paOldObjs, paNewObjs; |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
99 | |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
100 | EditHistory (std::vector<ulong> ulaIndices, std::vector<LDObject*> paOldObjs, |
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
101 | std::vector<LDObject*> paNewObjs) : |
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
102 | ulaIndices (ulaIndices), paOldObjs (paOldObjs), paNewObjs (paNewObjs) {} |
89
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 | |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
105 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
106 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
107 | // ============================================================================= |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
108 | class ListMoveHistory : public HistoryEntry { |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
109 | public: |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
110 | IMPLEMENT_HISTORY_TYPE (ListMove) |
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<ulong> ulaIndices; |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
113 | bool bUp; |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
114 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
115 | std::vector<LDObject*> getObjects (short ofs); |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
116 | ListMoveHistory (vector<ulong> ulaIndices, const bool bUp) : |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
117 | ulaIndices (ulaIndices), bUp (bUp) {} |
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 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
120 | // ============================================================================= |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
121 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
122 | // ============================================================================= |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
123 | 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
|
124 | public: |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
125 | enum Type { |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
126 | Other, // was "just added" |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
127 | Paste, // was added through a paste operation |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
128 | }; |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
129 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
130 | 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
|
131 | |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
132 | 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
|
133 | std::vector<LDObject*> paObjs; |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
134 | 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
|
135 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
136 | 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
|
137 | const Type eType = Other) : |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
138 | 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
|
139 | }; |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
140 | |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
141 | // ============================================================================= |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
142 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
143 | // ============================================================================= |
93
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
144 | class QuadSplitHistory : public HistoryEntry { |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
145 | public: |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
146 | IMPLEMENT_HISTORY_TYPE (QuadSplit) |
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 | std::vector<ulong> ulaIndices; |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
149 | std::vector<LDQuad*> 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 | 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
|
152 | ulaIndices (ulaIndices), paQuads (paQuads) {} |
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 | |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
155 | // ============================================================================= |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
156 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
157 | // ============================================================================= |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
158 | class InlineHistory : public HistoryEntry { |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
159 | public: |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
160 | IMPLEMENT_HISTORY_TYPE (Inline) |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
161 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
162 | const std::vector<ulong> ulaBitIndices, ulaRefIndices; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
163 | const std::vector<LDSubfile*> paRefs; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
164 | const bool bDeep; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
165 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
166 | 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
|
167 | const std::vector<LDSubfile*> paRefs, const bool bDeep) : |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
168 | ulaBitIndices (ulaBitIndices), ulaRefIndices (ulaRefIndices), paRefs (paRefs), bDeep (bDeep) {} |
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 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
171 | // ============================================================================= |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
172 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
173 | // ============================================================================= |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
174 | class MoveHistory : public HistoryEntry { |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
175 | public: |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
176 | IMPLEMENT_HISTORY_TYPE (Move) |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
177 | |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
178 | const std::vector<ulong> ulaIndices; |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
179 | const vertex vVector; |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
180 | |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
181 | MoveHistory (const std::vector<ulong> ulaIndices, const vertex vVector) : |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
182 | ulaIndices (ulaIndices), vVector (vVector) {} |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
183 | }; |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
184 | |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
185 | // ============================================================================= |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
186 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
187 | // ============================================================================= |
118
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
188 | class ComboHistory : public HistoryEntry { |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
189 | public: |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
190 | IMPLEMENT_HISTORY_TYPE (Combo) |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
191 | |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
160
diff
changeset
|
192 | std::vector<HistoryEntry*> paEntries; |
118
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
193 | |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
160
diff
changeset
|
194 | ComboHistory (std::vector<HistoryEntry*> paEntries) : paEntries (paEntries) {} |
118
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
195 | }; |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
196 | |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
197 | // ============================================================================= |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
198 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
199 | // ============================================================================= |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | namespace History { |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | void addEntry (HistoryEntry* entry); |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
202 | void undo (); |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
203 | void redo (); |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
204 | void clear (); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
205 | void updateActions (); |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
206 | long pos (); |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
207 | std::vector<HistoryEntry*>& entries (); |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | }; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | #endif // HISTORY_H |