src/editHistory.cpp

changeset 1079
67c6e5d32e68
parent 1073
a0a0d581309b
child 1144
4f226fd97826
equal deleted inserted replaced
1078:c72e3115a297 1079:67c6e5d32e68
169 parent()->document()->remove(object); 169 parent()->document()->remove(object);
170 } 170 }
171 171
172 void AddHistoryEntry::redo() const 172 void AddHistoryEntry::redo() const
173 { 173 {
174 parent()->document()->insertObject (m_index, ParseLine (m_code)); 174 parent()->document()->insertFromString(m_index, m_code);
175 } 175 }
176 176
177 // 177 //
178 // --------------------------------------------------------------------------------------------------------------------- 178 // ---------------------------------------------------------------------------------------------------------------------
179 // 179 //
201 m_newCode (newCode) {} 201 m_newCode (newCode) {}
202 202
203 void EditHistoryEntry::undo() const 203 void EditHistoryEntry::undo() const
204 { 204 {
205 LDObject* object = parent()->document()->getObject (m_index); 205 LDObject* object = parent()->document()->getObject (m_index);
206 LDObject* newObject = ParseLine (m_oldCode); 206 parent()->document()->replaceWithFromString(object, m_oldCode);
207 parent()->document()->replace(object, newObject);
208 } 207 }
209 208
210 void EditHistoryEntry::redo() const 209 void EditHistoryEntry::redo() const
211 { 210 {
212 LDObject* object = parent()->document()->getObject (m_index); 211 LDObject* object = parent()->document()->getObject (m_index);
213 LDObject* newObject = ParseLine (m_newCode); 212 parent()->document()->replaceWithFromString(object, m_newCode);
214 parent()->document()->replace(object, newObject);
215 } 213 }
216 214
217 // 215 //
218 // --------------------------------------------------------------------------------------------------------------------- 216 // ---------------------------------------------------------------------------------------------------------------------
219 // 217 //

mercurial