src/addObjectDialog.cpp

changeset 996
9ecc878c7dea
parent 988
ac4a2ae54f76
--- a/src/addObjectDialog.cpp	Sun Sep 06 20:45:51 2015 +0300
+++ b/src/addObjectDialog.cpp	Tue Sep 22 00:59:21 2015 +0300
@@ -147,39 +147,41 @@
 
 	switch (type)
 	{
-		case OBJ_Line:
-		case OBJ_CondLine:
-		case OBJ_Triangle:
-		case OBJ_Quad:
-			// Apply coordinates
-			if (obj)
-			{
-				for (int i = 0; i < coordCount / 3; ++i)
-				{
-					obj->vertex (i).apply ([&](Axis ax, double value)
-					{
-						dsb_coords[(i * 3) + ax]->setValue (value);
-					});
-				}
-			}
-			break;
+	case OBJ_Line:
+	case OBJ_CondLine:
+	case OBJ_Triangle:
+	case OBJ_Quad:
+		// Apply coordinates
+		if (obj)
+		{
+			LDVertexObject* vo = static_cast<LDVertexObject*> (obj);
 
-		case OBJ_Comment:
-			layout->addWidget (le_comment, 0, 1);
-			break;
-
-		case OBJ_Bfc:
-			layout->addWidget (rb_bfcType, 0, 1);
-			break;
+			for (int i = 0; i < coordCount / 3; ++i)
+			{
+				vo->vertex (i).apply ([&](Axis ax, double value)
+				{
+					dsb_coords[(i * 3) + ax]->setValue (value);
+				});
+			}
+		}
+		break;
 
-		case OBJ_Subfile:
-			layout->addWidget (tw_subfileList, 1, 1, 1, 2);
-			layout->addWidget (lb_subfileName, 2, 1);
-			layout->addWidget (le_subfileName, 2, 2);
-			break;
+	case OBJ_Comment:
+		layout->addWidget (le_comment, 0, 1);
+		break;
+
+	case OBJ_Bfc:
+		layout->addWidget (rb_bfcType, 0, 1);
+		break;
 
-		default:
-			break;
+	case OBJ_Subfile:
+		layout->addWidget (tw_subfileList, 1, 1, 1, 2);
+		layout->addWidget (lb_subfileName, 2, 1);
+		layout->addWidget (le_subfileName, 2, 2);
+		break;
+
+	default:
+		break;
 	}
 
 	if (defaults->hasMatrix())
@@ -197,7 +199,7 @@
 				dsb_coords[ax]->setValue (value);
 			});
 
-			defaultMatrix = mo->transform();
+			defaultMatrix = mo->transformationMatrix();
 		}
 
 		le_matrix->setText (defaultMatrix.toString());
@@ -222,6 +224,7 @@
 	QWidget::connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept()));
 	QWidget::connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject()));
 	layout->addWidget (bbx_buttons, 5, 0, 1, 4);
+	defaults->destroy();
 	setLayout (layout);
 	setWindowTitle (format (tr ("Edit %1"), typeName));
 	setWindowIcon (icon);
@@ -335,7 +338,8 @@
 			if (not obj)
 				obj = LDObject::getDefault (type);
 
-			for (int i = 0; i < obj->numVertices(); ++i)
+			LDVertexObject* vo = static_cast<LDVertexObject*> (obj);
+			for (int i = 0; i < vo->numVertices(); ++i)
 			{
 				Vertex v;
 
@@ -344,7 +348,7 @@
 					value = dlg.dsb_coords[(i * 3) + ax]->value();
 				});
 
-				obj->setVertex (i, v);
+				vo->setVertex (i, v);
 			}
 		} break;
 
@@ -376,7 +380,7 @@
 			for_axes (ax)
 				ref->setCoordinate (ax, dlg.dsb_coords[ax]->value());
 
-			ref->setTransform (transform);
+			ref->setTransformationMatrix (transform);
 			ref->setFileInfo (file);
 		} break;
 

mercurial