src/toolsets/extprogramtoolset.cpp

changeset 1186
eae8b3bce545
parent 1164
eabcd749759a
child 1194
99085cfaeabd
--- a/src/toolsets/extprogramtoolset.cpp	Sun Mar 05 13:33:37 2017 +0200
+++ b/src/toolsets/extprogramtoolset.cpp	Sun Mar 05 16:47:52 2017 +0200
@@ -157,14 +157,14 @@
 			LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
 			Model model {m_documents};
 			ref->inlineContents(model, true, false);
-			writeObjects(model.objects(), f);
+			writeObjects(model.objects().toQVector(), f);
 		}
 		else if (obj->type() == LDObjectType::BezierCurve)
 		{
 			LDBezierCurve* curve = static_cast<LDBezierCurve*> (obj);
 			Model model {m_documents};
 			curve->rasterize(model, grid()->bezierCurveSegments());
-			writeObjects(model.objects(), f);
+			writeObjects(model.objects().toQVector(), f);
 		}
 		else
 			f.write ((obj->asText() + "\r\n").toUtf8());
@@ -321,15 +321,9 @@
 	for (LDColor color : colorsToReplace)
 		m_window->deleteByColor (color);
 
-	// Insert the new objects
+	// Insert the new objects.
 	currentDocument()->clearSelection();
-
-	for (LDObject* object : model.objects())
-	{
-		if (object->isScemantic())
-			currentDocument()->addObject(object);
-	}
-
+	currentDocument()->merge(model, -1, [](LDObject* object) {return object->isScemantic();});
 	m_window->doFullRefresh();
 }
 

mercurial