removed LDObject::swap

Sat, 03 Mar 2018 16:59:03 +0200

author
Santeri Piippo
date
Sat, 03 Mar 2018 16:59:03 +0200
changeset 1260
0347e9bc883e
parent 1259
0384b1d49786
child 1261
5d2c9d36da9d

removed LDObject::swap

src/editHistory.cpp file | annotate | diff | comparison | revisions
src/linetypes/modelobject.cpp file | annotate | diff | comparison | revisions
src/linetypes/modelobject.h file | annotate | diff | comparison | revisions
src/toolsets/movetoolset.cpp file | annotate | diff | comparison | revisions
--- a/src/editHistory.cpp	Sat Mar 03 16:56:49 2018 +0200
+++ b/src/editHistory.cpp	Sat Mar 03 16:59:03 2018 +0200
@@ -223,7 +223,7 @@
 
 void SwapHistoryEntry::undo() const
 {
-	LDObject::fromID (m_a)->swap (LDObject::fromID (m_b));
+	parent()->document()->swapObjects(LDObject::fromID (m_a), LDObject::fromID (m_b));
 }
 
 void SwapHistoryEntry::redo() const
--- a/src/linetypes/modelobject.cpp	Sat Mar 03 16:56:49 2018 +0200
+++ b/src/linetypes/modelobject.cpp	Sat Mar 03 16:59:03 2018 +0200
@@ -110,16 +110,6 @@
 	return format ("0 BFC %1", statementToString());
 }
 
-// =============================================================================
-//
-// Swap this object with another.
-//
-void LDObject::swap (LDObject* other)
-{
-	if (model() == other->model())
-		model()->swapObjects (this, other);
-}
-
 int LDObject::triangleCount() const
 {
 	return 0;
--- a/src/linetypes/modelobject.h	Sat Mar 03 16:56:49 2018 +0200
+++ b/src/linetypes/modelobject.h	Sat Mar 03 16:59:03 2018 +0200
@@ -80,7 +80,6 @@
 	void setColor (LDColor color);
 	void setHidden (bool value);
 	void setVertex (int i, const Vertex& vert);
-	void swap (LDObject* other);
 	bool isInverted() const;
 	void setInverted(bool value);
 	virtual int triangleCount() const;
--- a/src/toolsets/movetoolset.cpp	Sat Mar 03 16:56:49 2018 +0200
+++ b/src/toolsets/movetoolset.cpp	Sat Mar 03 16:59:03 2018 +0200
@@ -40,7 +40,6 @@
 	int start = up ? 0 : (countof(objs) - 1);
 	int end = up ? countof(objs) : -1;
 	int increment = up ? 1 : -1;
-	QSet<LDObject*> objsToCompile;
 	Model* model = (*objs.begin())->model();
 
 	for (int i = start; i != end; i += increment)
@@ -58,9 +57,7 @@
 			return;
 		}
 
-		objsToCompile << obj;
-		objsToCompile << model->getObject(target);
-		obj->swap(model->getObject(target));
+		model->swapObjects(obj, model->getObject(target));
 	}
 }
 

mercurial