src/file.cpp

changeset 276
a21e49914264
parent 274
d232fe4d88a6
child 286
7a562bf3d829
--- a/src/file.cpp	Thu Jun 13 01:13:06 2013 +0300
+++ b/src/file.cpp	Thu Jun 13 02:55:47 2013 +0300
@@ -710,7 +710,7 @@
 			LDLine* obj = new LDLine;
 			obj->setColor (atol (tokens[1]));
 			for (short i = 0; i < 2; ++i)
-				obj->coords[i] = parseVertex (tokens, 2 + (i * 3)); // 2 - 7
+				obj->setVertex (i, parseVertex (tokens, 2 + (i * 3))); // 2 - 7
 			return obj;
 		}
 	
@@ -724,7 +724,7 @@
 			obj->setColor (atol (tokens[1]));
 			
 			for (short i = 0; i < 3; ++i)
-				obj->coords[i] = parseVertex (tokens, 2 + (i * 3)); // 2 - 10
+				obj->setVertex (i, parseVertex (tokens, 2 + (i * 3))); // 2 - 10
 			
 			return obj;
 		}
@@ -739,7 +739,7 @@
 			obj->setColor (atol (tokens[1]));
 			
 			for (short i = 0; i < 4; ++i)
-				obj->coords[i] = parseVertex (tokens, 2 + (i * 3)); // 2 - 13
+				obj->setVertex (i, parseVertex (tokens, 2 + (i * 3))); // 2 - 13
 			
 			return obj;
 		}
@@ -754,7 +754,7 @@
 			obj->setColor (atol (tokens[1]));
 			
 			for (short i = 0; i < 4; ++i)
-				obj->coords[i] = parseVertex (tokens, 2 + (i * 3)); // 2 - 13
+				obj->setVertex (i, parseVertex (tokens, 2 + (i * 3))); // 2 - 13
 			
 			return obj;
 		}
@@ -919,6 +919,11 @@
 // =============================================================================
 void LDOpenFile::setObject (ulong idx, LDObject* obj) {
 	assert (idx < numObjs ());
+	
+	str oldcode = m_objs[idx]->raw ();
+	str newcode = obj->raw ();
+	m_history << new EditHistory (idx, oldcode, newcode);
+	
 	m_objs[idx] = obj;
 }
 

mercurial