Tue, 16 Jul 2013 02:47:11 +0300
change camera to top if switching to draw mode in free camera
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
4 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
9 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
14 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include "history.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "ldtypes.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "file.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "misc.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "gui.h" |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
24 | #include "gldraw.h" |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
26 | bool g_fullRefresh = false; |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
27 | |
376 | 28 | History::History() { |
29 | setOpened (false); | |
30 | setPos (-1); | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | |
376 | 33 | void History::undo() { |
34 | if (m_changesets.size() == 0 || pos() == -1) | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
35 | return; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | |
376 | 37 | const list& set = changeset (pos()); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
38 | g_fullRefresh = false; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
39 | |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
40 | // Iterate the list in reverse and undo all actions |
376 | 41 | for (const AbstractHistoryEntry * change : c_rev<AbstractHistoryEntry*> (set)) |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
42 | change->undo(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
43 | |
376 | 44 | setPos (pos() - 1); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
45 | |
376 | 46 | if (!g_fullRefresh) |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
47 | g_win->refresh(); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
48 | else |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
49 | g_win->fullRefresh(); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
50 | |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
51 | updateActions(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | |
376 | 54 | void History::redo() { |
55 | if (pos() == (long) m_changesets.size()) | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
56 | return; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | |
376 | 58 | const list& set = changeset (pos() + 1); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
59 | g_fullRefresh = false; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
60 | |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
61 | // Redo things - in the order as they were done in the first place |
376 | 62 | for (const AbstractHistoryEntry * change : set) |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
63 | change->redo(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
64 | |
376 | 65 | setPos (pos() + 1); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
66 | |
376 | 67 | if (!g_fullRefresh) |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
68 | g_win->refresh(); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
69 | else |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
70 | g_win->fullRefresh(); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
71 | |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
72 | updateActions(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | |
376 | 75 | void History::clear() { |
76 | for (vector<AbstractHistoryEntry*> set : m_changesets) | |
77 | for (AbstractHistoryEntry * change : set) | |
78 | delete change; | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
80 | m_changesets.clear(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | |
376 | 83 | void History::updateActions() const { |
382
c1642530ea35
Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
84 | ACTION (Undo)->setEnabled (pos() != -1); |
c1642530ea35
Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
85 | ACTION (Redo)->setEnabled (pos() < (long) m_changesets.size() - 1); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | |
376 | 88 | void History::open() { |
89 | if (opened()) | |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
90 | return; |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
91 | |
376 | 92 | setOpened (true); |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
93 | } |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
94 | |
376 | 95 | void History::close() { |
96 | if (!opened()) | |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
97 | return; |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
98 | |
376 | 99 | setOpened (false); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
100 | |
376 | 101 | if (m_currentArchive.size() == 0) |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
102 | return; |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
103 | |
376 | 104 | while (pos() < size() - 1) |
105 | m_changesets.erase (size() - 1); | |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
106 | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
107 | m_changesets << m_currentArchive; |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
108 | m_currentArchive.clear(); |
376 | 109 | setPos (pos() + 1); |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
110 | updateActions(); |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
111 | } |
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
112 | |
376 | 113 | void History::add (AbstractHistoryEntry* entry) { |
114 | if (!opened()) { | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
115 | delete entry; |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
116 | return; |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
117 | } |
348
20134b519f90
fixed: stuff that was changed during file open was written to history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
347
diff
changeset
|
118 | |
376 | 119 | entry->setParent (this); |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
120 | m_currentArchive << entry; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
121 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
122 | |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
123 | // ============================================================================= |
376 | 124 | void AddHistory::undo() const { |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
125 | LDOpenFile* f = parent()->file(); |
376 | 126 | LDObject* obj = f->object (index()); |
127 | f->forgetObject (obj); | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
128 | delete obj; |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
129 | |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
130 | g_fullRefresh = true; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
131 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
132 | |
376 | 133 | void AddHistory::redo() const { |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
134 | LDOpenFile* f = parent()->file(); |
376 | 135 | LDObject* obj = parseLine (code()); |
136 | f->insertObj (index(), obj); | |
137 | g_win->R()->compileObject (obj); | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
138 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
139 | |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
140 | AddHistory::~AddHistory() {} |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
141 | |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
142 | // ============================================================================= |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
143 | // heh |
376 | 144 | void DelHistory::undo() const { |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
145 | LDOpenFile* f = parent()->file(); |
376 | 146 | LDObject* obj = parseLine (code()); |
147 | f->insertObj (index(), obj); | |
148 | g_win->R()->compileObject (obj); | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
149 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
150 | |
376 | 151 | void DelHistory::redo() const { |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
152 | LDOpenFile* f = parent()->file(); |
376 | 153 | LDObject* obj = f->object (index()); |
154 | f->forgetObject (obj); | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
155 | delete obj; |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
156 | |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
275
diff
changeset
|
157 | g_fullRefresh = true; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
158 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
159 | |
347
02e10ed4f8eb
astyle history.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
160 | DelHistory::~DelHistory() {} |
275
7b5afec27688
Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
161 | |
7b5afec27688
Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
162 | // ============================================================================= |
376 | 163 | void EditHistory::undo() const { |
388
7ff483614aa1
Multiple file support works now! woo!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
164 | LDObject* obj = LDOpenFile::current()->object (index()); |
376 | 165 | LDObject* newobj = parseLine (oldCode()); |
166 | obj->replace (newobj); | |
167 | g_win->R()->compileObject (newobj); | |
275
7b5afec27688
Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
168 | } |
7b5afec27688
Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
169 | |
376 | 170 | void EditHistory::redo() const { |
388
7ff483614aa1
Multiple file support works now! woo!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
382
diff
changeset
|
171 | LDObject* obj = LDOpenFile::current()->object (index()); |
376 | 172 | LDObject* newobj = parseLine (newCode()); |
173 | obj->replace (newobj); | |
174 | g_win->R()->compileObject (newobj); | |
275
7b5afec27688
Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
175 | } |
7b5afec27688
Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
176 | |
362
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
177 | EditHistory::~EditHistory() {} |
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
178 | |
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
179 | // ============================================================================= |
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
180 | |
376 | 181 | void SwapHistory::undo() const { |
182 | LDObject::fromID (a)->swap (LDObject::fromID (b)); | |
362
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
183 | } |
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
184 | |
376 | 185 | void SwapHistory::redo() const { |
362
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
186 | undo(); // :v |
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
187 | } |
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
188 | |
344fe1da32c8
Added history functionality for swapping
Santeri Piippo <crimsondusk64@gmail.com>
parents:
355
diff
changeset
|
189 | SwapHistory::~SwapHistory() {} |