src/actionsEdit.cc

changeset 805
d88c0354de97
parent 804
d8589e8e2973
child 806
4240f47aa2d4
--- a/src/actionsEdit.cc	Mon Jun 16 17:55:10 2014 +0300
+++ b/src/actionsEdit.cc	Mon Jun 16 18:31:13 2014 +0300
@@ -285,7 +285,6 @@
 				continue;
 
 			long idx = obj->lineNumber() + i + 1;
-			lines[i]->setColor (edgecolor());
 			getCurrentDocument()->insertObj (idx, lines[i]);
 		}
 
@@ -567,7 +566,7 @@
 		if (not obj->isColored())
 			continue;
 
-		obj->setColor ((obj->type() == OBJ_Line || obj->type() == OBJ_CondLine) ? edgecolor() : maincolor());
+		obj->setColor (obj->defaultColor());
 		num++;
 	}
 
@@ -675,7 +674,7 @@
 		if (obj->type() != OBJ_CondLine)
 			continue;
 
-		obj.staticCast<LDCondLine>()->demote();
+		obj.staticCast<LDCondLine>()->toEdgeLine();
 		++num;
 	}
 
@@ -803,20 +802,15 @@
 		for (int i = 0; i < segments; ++i)
 		{
 			LDObjectPtr segment;
-
-			if (obj->type() == OBJ_Line)
-				segment = spawn<LDLine>();
-			else
-				segment = spawn<LDCondLine>();
-
 			Vertex v0, v1;
 			v0.apply ([&](Axis ax, double& a) { a = (obj->vertex (0)[ax] + (((obj->vertex (1)[ax] - obj->vertex (0)[ax]) * i) / segments)); });
 			v1.apply ([&](Axis ax, double& a) { a = (obj->vertex (0)[ax] + (((obj->vertex (1)[ax] - obj->vertex (0)[ax]) * (i + 1)) / segments)); });
-			print ("%1, %2\n", v0.toString(true), v1.toString(true));
-			segment->setVertex (0, v0);
-			segment->setVertex (0, v1);
-			segment->setVertex (2, obj->vertex (2));
-			segment->setVertex (3, obj->vertex (3));
+
+			if (obj->type() == OBJ_Line)
+				segment = spawn<LDLine> (v0, v1);
+			else
+				segment = spawn<LDCondLine> (v0, v1, obj->vertex (2), obj->vertex (3));
+
 			newsegs << segment;
 		}
 

mercurial