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 | #include "history.h" |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "ldtypes.h" |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "file.h" |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "misc.h" |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "gui.h" |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
25 | EXTERN_ACTION (undo) |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
26 | EXTERN_ACTION (redo) |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
27 | |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | // ============================================================================= |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
29 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
30 | // ============================================================================= |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
31 | namespace History { |
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:
153
diff
changeset
|
32 | std::vector<HistoryEntry*> s_entries; |
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:
153
diff
changeset
|
33 | static long s_pos = -1; |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
34 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
35 | // ========================================================================= |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
36 | void addEntry (HistoryEntry* entry) { |
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:
153
diff
changeset
|
37 | // If there's any entries ahead the current position, we need to |
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:
153
diff
changeset
|
38 | // remove them now |
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:
153
diff
changeset
|
39 | for (ulong i = s_pos + 1; i < s_entries.size(); ++i) { |
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:
153
diff
changeset
|
40 | delete s_entries[i]; |
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:
153
diff
changeset
|
41 | s_entries.erase (s_entries.begin() + i); |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
42 | } |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
43 | |
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:
153
diff
changeset
|
44 | s_entries.push_back (entry); |
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:
153
diff
changeset
|
45 | s_pos++; |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
46 | |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
47 | updateActions (); |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
48 | } |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
49 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
50 | // ========================================================================= |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
51 | void undo () { |
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:
153
diff
changeset
|
52 | if (s_pos == -1) |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
53 | return; // nothing to undo |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
54 | |
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:
153
diff
changeset
|
55 | s_entries[s_pos--]->undo (); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
56 | updateActions (); |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
57 | } |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
58 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
59 | // ========================================================================= |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
60 | void redo () { |
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:
153
diff
changeset
|
61 | if (s_pos == (long) s_entries.size () - 1) |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
62 | return; // nothing to redo; |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
63 | |
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:
153
diff
changeset
|
64 | s_entries[++s_pos]->redo (); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
65 | updateActions (); |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
66 | } |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
67 | |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
68 | // ========================================================================= |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
94
diff
changeset
|
69 | void clear () { |
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:
153
diff
changeset
|
70 | for (HistoryEntry* entry : s_entries) |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
94
diff
changeset
|
71 | delete entry; |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
94
diff
changeset
|
72 | |
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:
153
diff
changeset
|
73 | s_entries.clear (); |
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:
153
diff
changeset
|
74 | s_pos = -1; |
96
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
94
diff
changeset
|
75 | updateActions (); |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
94
diff
changeset
|
76 | } |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
94
diff
changeset
|
77 | |
2f175b3d8211
Added history dialog, cannot display all types yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
94
diff
changeset
|
78 | // ========================================================================= |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
79 | void updateActions () { |
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:
153
diff
changeset
|
80 | ACTION (undo)->setEnabled (s_pos > -1); |
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:
153
diff
changeset
|
81 | ACTION (redo)->setEnabled (s_pos < (long) s_entries.size () - 1); |
127
a6e2067bb2f1
Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
82 | |
a6e2067bb2f1
Keep track of when the file was last saved and warn if there are unsaved changes when the application is closing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
118
diff
changeset
|
83 | // Update the window title as well |
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:
153
diff
changeset
|
84 | g_win->setTitle (); |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
85 | } |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
86 | |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
87 | // ========================================================================= |
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
88 | 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:
153
diff
changeset
|
89 | return s_pos; |
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:
153
diff
changeset
|
90 | } |
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:
153
diff
changeset
|
91 | |
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:
153
diff
changeset
|
92 | // ========================================================================= |
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:
153
diff
changeset
|
93 | std::vector<HistoryEntry*>& entries () { |
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:
153
diff
changeset
|
94 | return s_entries; |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
95 | } |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
96 | } |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
97 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
98 | // ============================================================================= |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
99 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
100 | // ============================================================================= |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
101 | void DelHistory::undo () { |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | for (ulong i = 0; i < cache.size(); ++i) { |
94
a9e67f6e610e
Added history management for cut and paste, copy doesn't alter the object list by itself so it doesn't touch history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
103 | ulong idx = cache.size() - i - 1; |
a9e67f6e610e
Added history management for cut and paste, copy doesn't alter the object list by itself so it doesn't touch history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
93
diff
changeset
|
104 | LDObject* obj = cache[idx]->clone (); |
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:
153
diff
changeset
|
105 | g_curfile->insertObj (indices[idx], obj); |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | } |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | |
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:
153
diff
changeset
|
108 | g_win->refresh (); |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | } |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | // ============================================================================= |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
112 | void DelHistory::redo () { |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | for (ulong i = 0; i < cache.size(); ++i) { |
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:
153
diff
changeset
|
114 | LDObject* obj = g_curfile->m_objs[indices[i]]; |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | |
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:
153
diff
changeset
|
116 | g_curfile->forgetObject (obj); |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | delete obj; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | } |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
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:
153
diff
changeset
|
120 | g_win->refresh (); |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | } |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | // ============================================================================= |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
124 | DelHistory::~DelHistory () { |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | for (LDObject* obj : cache) |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | delete obj; |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | } |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | // ============================================================================= |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | // ============================================================================= |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
132 | void SetColorHistory::undo () { |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
133 | // Restore colors |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
134 | for (ulong i = 0; i < ulaIndices.size (); ++i) |
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:
153
diff
changeset
|
135 | g_curfile->m_objs[ulaIndices[i]]->dColor = daColors[i]; |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
136 | |
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:
153
diff
changeset
|
137 | g_win->refresh (); |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
138 | } |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
139 | |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
140 | void SetColorHistory::redo () { |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
141 | // Re-set post color |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
142 | for (ulong i = 0; i < ulaIndices.size (); ++i) |
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:
153
diff
changeset
|
143 | g_curfile->m_objs[ulaIndices[i]]->dColor = dNewColor; |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
144 | |
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:
153
diff
changeset
|
145 | g_win->refresh (); |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
146 | } |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
147 | |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
148 | SetColorHistory::~SetColorHistory () {} |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
149 | |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
150 | // ============================================================================= |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
151 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
152 | // ============================================================================= |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
153 | void EditHistory::undo () { |
146
2ab24976acaa
Now capable of calculating coordinates based on mouse x and y and snapping them to the grid
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
154 | for (ulong idx : ulaIndices) |
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:
153
diff
changeset
|
155 | g_curfile->object (idx)->replace (paOldObjs[idx]->clone ()); |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
156 | |
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:
153
diff
changeset
|
157 | g_win->refresh (); |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
158 | } |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
159 | |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
160 | void EditHistory::redo () { |
118
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
161 | for (ulong idx : ulaIndices) |
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:
153
diff
changeset
|
162 | g_curfile->object (idx)->replace (paNewObjs[idx]->clone ()); |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
163 | |
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:
153
diff
changeset
|
164 | g_win->refresh (); |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
165 | } |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
166 | |
117
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
167 | EditHistory::~EditHistory () { |
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
168 | for (ulong idx : ulaIndices) { |
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
169 | delete paOldObjs[idx]; |
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
170 | delete paNewObjs[idx]; |
7eb7a43a511b
Generalized SetContentsHistory to an EditHistory
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
171 | } |
90
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
172 | } |
03f718ed5b33
Added history handling for set contents
Santeri Piippo <crimsondusk64@gmail.com>
parents:
89
diff
changeset
|
173 | |
89
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
174 | // ============================================================================= |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
175 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5e6c08e98dbf
Allow undo of set color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
85
diff
changeset
|
176 | // ============================================================================= |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
177 | std::vector<LDObject*> ListMoveHistory::getObjects (short ofs) { |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
178 | std::vector<LDObject*> objs; |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
180 | for (ulong idx : ulaIndices) |
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:
153
diff
changeset
|
181 | objs.push_back (g_curfile->m_objs[idx + ofs]); |
85
b1541b547c8c
Added undo/redo foundations. Capable of undoing and redoing delete operations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
183 | return objs; |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
184 | } |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
185 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
186 | void ListMoveHistory::undo () { |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
187 | std::vector<LDObject*> objs = getObjects (bUp ? -1 : 1); |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
188 | LDObject::moveObjects (objs, !bUp); |
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:
153
diff
changeset
|
189 | g_win->buildObjList (); |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
190 | } |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
191 | |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
192 | void ListMoveHistory::redo () { |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
193 | std::vector<LDObject*> objs = getObjects (0); |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
194 | LDObject::moveObjects (objs, bUp); |
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:
153
diff
changeset
|
195 | g_win->buildObjList (); |
91
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
196 | } |
b4dda6348e7e
History handling for list moving
Santeri Piippo <crimsondusk64@gmail.com>
parents:
90
diff
changeset
|
197 | |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
198 | ListMoveHistory::~ListMoveHistory() {} |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
199 | |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
200 | // ============================================================================= |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
201 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
202 | // ============================================================================= |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
203 | AddHistory::~AddHistory () { |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
204 | for (LDObject* pObj : paObjs) |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
205 | delete pObj; |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
206 | } |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
207 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
208 | void AddHistory::undo () { |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
209 | for (ulong i = 0; i < paObjs.size(); ++i) { |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
210 | ulong idx = ulaIndices[ulaIndices.size() - i - 1]; |
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:
153
diff
changeset
|
211 | LDObject* obj = g_curfile->m_objs[idx]; |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
212 | |
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:
153
diff
changeset
|
213 | g_curfile->forgetObject (obj); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
214 | delete obj; |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
215 | } |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
216 | |
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:
153
diff
changeset
|
217 | g_win->refresh (); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
218 | } |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
219 | |
97
52bcca21579e
Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
220 | void AddHistory::redo () { |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
221 | for (ulong i = 0; i < paObjs.size(); ++i) { |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
222 | ulong idx = ulaIndices[i]; |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
223 | LDObject* obj = paObjs[i]->clone (); |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
224 | |
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:
153
diff
changeset
|
225 | g_curfile->insertObj (idx, obj); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
226 | } |
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
227 | |
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:
153
diff
changeset
|
228 | g_win->refresh (); |
93
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
229 | } |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
230 | |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
231 | // ============================================================================= |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
232 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
233 | // ============================================================================= |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
234 | QuadSplitHistory::~QuadSplitHistory () { |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
235 | for (LDQuad* pQuad : paQuads) |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
236 | delete pQuad; |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
237 | } |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
238 | |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
239 | void QuadSplitHistory::undo () { |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
240 | for (ulong i = 0; i < paQuads.size(); ++i) { |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
241 | // The quad was replaced by the first triangle and a second one was |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
242 | // added after it. Thus, we remove the second one here and replace |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
243 | // the first with a copy of the quad. |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
244 | ulong idx = ulaIndices[i]; |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
245 | |
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:
153
diff
changeset
|
246 | LDTriangle* tri1 = static_cast<LDTriangle*> (g_curfile->m_objs[idx]), |
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:
153
diff
changeset
|
247 | *tri2 = static_cast<LDTriangle*> (g_curfile->m_objs[idx + 1]); |
93
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
248 | LDQuad* pCopy = paQuads[i]->clone (); |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
249 | |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
250 | tri1->replace (pCopy); |
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:
153
diff
changeset
|
251 | g_curfile->forgetObject (tri2); |
93
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
252 | delete tri2; |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
253 | } |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
254 | |
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:
153
diff
changeset
|
255 | g_win->refresh (); |
93
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
256 | } |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
257 | |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
258 | void QuadSplitHistory::redo () { |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
259 | for (long i = paQuads.size() - 1; i >= 0; --i) { |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
260 | ulong idx = ulaIndices[i]; |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
261 | |
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:
153
diff
changeset
|
262 | LDQuad* pQuad = static_cast<LDQuad*> (g_curfile->m_objs[idx]); |
93
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
263 | std::vector<LDTriangle*> paTriangles = pQuad->splitToTriangles (); |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
264 | |
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:
153
diff
changeset
|
265 | g_curfile->m_objs[idx] = paTriangles[0]; |
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:
153
diff
changeset
|
266 | g_curfile->insertObj (idx + 1, paTriangles[1]); |
93
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
267 | delete pQuad; |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
268 | } |
92682e6369e9
Added history handling for quad splitting.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
92
diff
changeset
|
269 | |
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:
153
diff
changeset
|
270 | g_win->refresh (); |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
271 | } |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
272 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
273 | // ============================================================================= |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
274 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
275 | // ============================================================================= |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
276 | void InlineHistory::undo () { |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
277 | for (long i = ulaBitIndices.size() - 1; i >= 0; --i) { |
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:
153
diff
changeset
|
278 | LDObject* obj = g_curfile->m_objs [ulaBitIndices[i]]; |
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:
153
diff
changeset
|
279 | g_curfile->forgetObject (obj); |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
280 | delete obj; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
281 | } |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
282 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
283 | for (ulong i = 0; i < ulaRefIndices.size(); ++i) { |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
284 | LDSubfile* obj = paRefs[i]->clone (); |
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:
153
diff
changeset
|
285 | g_curfile->insertObj (ulaRefIndices[i], obj); |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
286 | } |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
287 | |
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:
153
diff
changeset
|
288 | g_win->refresh (); |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
289 | } |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
290 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
291 | void InlineHistory::redo () { |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
292 | for (long i = ulaRefIndices.size() - 1; i >= 0; --i) { |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
293 | ulong idx = ulaRefIndices[i]; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
294 | |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
160
diff
changeset
|
295 | assert (g_curfile->object (idx)->getType () == LDObject::Subfile); |
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:
153
diff
changeset
|
296 | LDSubfile* ref = static_cast<LDSubfile*> (g_curfile->object (idx)); |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
297 | vector<LDObject*> objs = ref->inlineContents (bDeep, false); |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
298 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
299 | for (LDObject* obj : objs) |
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:
153
diff
changeset
|
300 | g_curfile->insertObj (idx++, obj); |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
301 | |
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:
153
diff
changeset
|
302 | g_curfile->forgetObject (ref); |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
303 | delete ref; |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
304 | } |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
305 | |
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:
153
diff
changeset
|
306 | g_win->refresh (); |
98
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
307 | } |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
308 | |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
309 | InlineHistory::~InlineHistory () { |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
310 | for (LDSubfile* ref : paRefs) |
5dcc551f260a
Added inlining history management
Santeri Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
311 | delete ref; |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
312 | } |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
313 | |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
314 | // ============================================================================= |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
315 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
316 | // ============================================================================= |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
317 | MoveHistory::~MoveHistory () {} |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
318 | |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
319 | void MoveHistory::undo () { |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
320 | const vertex vInverse = -vVector; |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
321 | |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
322 | for (ulong i : ulaIndices) |
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:
153
diff
changeset
|
323 | g_curfile->object (i)->move (vInverse); |
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:
153
diff
changeset
|
324 | g_win->refresh (); |
102
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
325 | } |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
326 | |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
327 | void MoveHistory::redo () { |
cacd4681ccb4
Added basic object moving with MLCAD-like controls.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
328 | for (ulong i : ulaIndices) |
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:
153
diff
changeset
|
329 | g_curfile->object (i)->move (vVector); |
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:
153
diff
changeset
|
330 | g_win->refresh (); |
118
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
331 | } |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
332 | |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
333 | // ============================================================================= |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
334 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
335 | // ============================================================================= |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
336 | ComboHistory::~ComboHistory () { |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
337 | for (HistoryEntry* pEntry : paEntries) |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
338 | delete pEntry; |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
339 | } |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
340 | |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
341 | void ComboHistory::undo () { |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
342 | for (long i = paEntries.size() - 1; i >= 0; --i) { |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
343 | HistoryEntry* pEntry = paEntries[i]; |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
344 | pEntry->undo (); |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
345 | } |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
346 | } |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
347 | |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
348 | void ComboHistory::redo () { |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
349 | for (HistoryEntry* pEntry : paEntries) |
649110bb36a8
Added winding reversal, though undoing it isn't quite ready yet.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
350 | pEntry->redo (); |
92
586d294ca83f
Added history management for auto-bordering (and mass-addition in general)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
91
diff
changeset
|
351 | } |