src/actions.cc

changeset 944
1a6f1997fcbe
parent 943
af81220741d9
child 945
c310073e4f22
--- a/src/actions.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/actions.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -238,7 +238,7 @@
 	if (Selection().size() != 1)
 		return;
 
-	LDObjectPtr obj = Selection() [0];
+	LDObject* obj = Selection() [0];
 	AddObjectDialog::staticDialog (obj->type(), obj);
 }
 
@@ -266,7 +266,7 @@
 //
 void MainWindow::slot_actionSelectAll()
 {
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 		obj->select();
 }
 
@@ -279,7 +279,7 @@
 
 	QList<LDColor> colors;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		if (obj->isColored())
 			colors << obj->color();
@@ -288,7 +288,7 @@
 	RemoveDuplicates (colors);
 	CurrentDocument()->clearSelection();
 
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 	{
 		if (colors.contains (obj->color()))
 			obj->select();
@@ -305,19 +305,19 @@
 	QList<LDObjectType> types;
 	QStringList subfilenames;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		types << obj->type();
 
 		if (types.last() == OBJ_Subfile)
-			subfilenames << obj.staticCast<LDSubfile>()->fileInfo()->name();
+			subfilenames << static_cast<LDSubfile*> (obj)->fileInfo()->name();
 	}
 
 	RemoveDuplicates (types);
 	RemoveDuplicates (subfilenames);
 	CurrentDocument()->clearSelection();
 
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 	{
 		LDObjectType type = obj->type();
 
@@ -325,7 +325,7 @@
 			continue;
 
 		// For subfiles, type check is not enough, we check the name of the document as well.
-		if (type == OBJ_Subfile and not subfilenames.contains (obj.staticCast<LDSubfile>()->fileInfo()->name()))
+		if (type == OBJ_Subfile and not subfilenames.contains (static_cast<LDSubfile*> (obj)->fileInfo()->name()))
 			continue;
 
 		obj->select();
@@ -382,7 +382,7 @@
 
 	CurrentDocument()->clearSelection();
 
-	for (LDObjectPtr obj : objs)
+	for (LDObject* obj : objs)
 	{
 		CurrentDocument()->insertObj (idx, obj);
 		obj->select();
@@ -415,7 +415,7 @@
 		return;
 	}
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		QString contents = obj->asText();
 		QByteArray data = contents.toUtf8();
@@ -449,7 +449,7 @@
 
 	for (QString line : QString (te_edit->toPlainText()).split ("\n"))
 	{
-		LDObjectPtr obj = ParseLine (line);
+		LDObject* obj = ParseLine (line);
 
 		CurrentDocument()->insertObj (idx, obj);
 		obj->select();
@@ -498,7 +498,7 @@
 //
 void MainWindow::slot_actionVisibilityToggle()
 {
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 		obj->setHidden (not obj->isHidden());
 
 	refresh();
@@ -508,7 +508,7 @@
 //
 void MainWindow::slot_actionVisibilityHide()
 {
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 		obj->setHidden (true);
 
 	refresh();
@@ -518,7 +518,7 @@
 //
 void MainWindow::slot_actionVisibilityReveal()
 {
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	obj->setHidden (false);
 	refresh();
 }
@@ -690,7 +690,7 @@
 {
 	bool ok;
 	int defval = 0;
-	LDObjectPtr obj;
+	LDObject* obj;
 
 	if (Selection().size() == 1)
 		defval = Selection()[0]->lineNumber();
@@ -725,7 +725,7 @@
 	QString			subtitle;
 
 	// Comment containing the title of the parent document
-	LDCommentPtr	titleobj (CurrentDocument()->getObject (0).dynamicCast<LDComment>());
+	LDCommentPtr	titleobj = dynamic_cast<LDComment*> (CurrentDocument()->getObject (0));
 
 	// License text for the subfile
 	QString			license (PreferredLicenseText());
@@ -814,7 +814,7 @@
 	});
 
 	// Get the body of the document in LDraw code
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 		code << obj->asText();
 
 	// Create the new subfile document
@@ -841,7 +841,7 @@
 	// Add the actual subfile code to the new document
 	for (QString line : code)
 	{
-		LDObjectPtr obj = ParseLine (line);
+		LDObject* obj = ParseLine (line);
 		doc->addObject (obj);
 	}
 
@@ -850,7 +850,7 @@
 	{
 		// Save was successful. Delete the original selection now from the
 		// main document.
-		for (LDObjectPtr obj : Selection())
+		for (LDObject* obj : Selection())
 			obj->destroy();
 
 		// Add a reference to the new subfile to where the selection was
@@ -885,9 +885,9 @@
 
 void MainWindow::slot_actionOpenSubfiles()
 {
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
-		LDSubfilePtr ref = obj.dynamicCast<LDSubfile>();
+		LDSubfilePtr ref = dynamic_cast<LDSubfile*> (obj);
 
 		if (ref == null or not ref->fileInfo()->isImplicit())
 			continue;

mercurial