163 m_index (idx), |
163 m_index (idx), |
164 m_code (obj->asText()) {} |
164 m_code (obj->asText()) {} |
165 |
165 |
166 void AddHistoryEntry::undo() const |
166 void AddHistoryEntry::undo() const |
167 { |
167 { |
168 parent()->document()->getObject (m_index)->destroy(); |
168 LDObject* object = parent()->document()->getObject(m_index); |
|
169 parent()->document()->remove(object); |
169 } |
170 } |
170 |
171 |
171 void AddHistoryEntry::redo() const |
172 void AddHistoryEntry::redo() const |
172 { |
173 { |
173 parent()->document()->insertObject (m_index, ParseLine (m_code)); |
174 parent()->document()->insertObject (m_index, ParseLine (m_code)); |
199 m_oldCode (oldCode), |
200 m_oldCode (oldCode), |
200 m_newCode (newCode) {} |
201 m_newCode (newCode) {} |
201 |
202 |
202 void EditHistoryEntry::undo() const |
203 void EditHistoryEntry::undo() const |
203 { |
204 { |
204 LDObject* obj = parent()->document()->getObject (m_index); |
205 LDObject* object = parent()->document()->getObject (m_index); |
205 LDObject* newobj = ParseLine (m_oldCode); |
206 LDObject* newObject = ParseLine (m_oldCode); |
206 obj->replace (newobj); |
207 parent()->document()->replace(object, newObject); |
207 } |
208 } |
208 |
209 |
209 void EditHistoryEntry::redo() const |
210 void EditHistoryEntry::redo() const |
210 { |
211 { |
211 LDObject* obj = parent()->document()->getObject (m_index); |
212 LDObject* object = parent()->document()->getObject (m_index); |
212 LDObject* newobj = ParseLine (m_newCode); |
213 LDObject* newObject = ParseLine (m_newCode); |
213 obj->replace (newobj); |
214 parent()->document()->replace(object, newObject); |
214 } |
215 } |
215 |
216 |
216 // |
217 // |
217 // --------------------------------------------------------------------------------------------------------------------- |
218 // --------------------------------------------------------------------------------------------------------------------- |
218 // |
219 // |