Replace casts

Sat, 22 Aug 2015 15:37:02 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 22 Aug 2015 15:37:02 +0300
changeset 944
1a6f1997fcbe
parent 943
af81220741d9
child 945
c310073e4f22

Replace casts

src/actions.cc file | annotate | diff | comparison | revisions
src/actionsEdit.cc file | annotate | diff | comparison | revisions
src/addObjectDialog.cc file | annotate | diff | comparison | revisions
src/addObjectDialog.h file | annotate | diff | comparison | revisions
src/basics.cc file | annotate | diff | comparison | revisions
src/basics.h file | annotate | diff | comparison | revisions
src/editHistory.cc file | annotate | diff | comparison | revisions
src/editHistory.h file | annotate | diff | comparison | revisions
src/editmodes/abstractEditMode.cc file | annotate | diff | comparison | revisions
src/editmodes/drawMode.cc file | annotate | diff | comparison | revisions
src/editmodes/magicWandMode.cc file | annotate | diff | comparison | revisions
src/editmodes/magicWandMode.h file | annotate | diff | comparison | revisions
src/editmodes/selectMode.cc file | annotate | diff | comparison | revisions
src/extPrograms.cc file | annotate | diff | comparison | revisions
src/glCompiler.cc file | annotate | diff | comparison | revisions
src/glCompiler.h file | annotate | diff | comparison | revisions
src/glRenderer.cc file | annotate | diff | comparison | revisions
src/glRenderer.h file | annotate | diff | comparison | revisions
src/ldDocument.cc file | annotate | diff | comparison | revisions
src/ldDocument.h file | annotate | diff | comparison | revisions
src/ldObject.cc file | annotate | diff | comparison | revisions
src/ldObject.h file | annotate | diff | comparison | revisions
src/ldObjectMath.cpp file | annotate | diff | comparison | revisions
src/mainWindow.cc file | annotate | diff | comparison | revisions
src/miscallenous.cc file | annotate | diff | comparison | revisions
src/partDownloader.cc file | annotate | diff | comparison | revisions
--- 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;
--- a/src/actionsEdit.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/actionsEdit.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -56,7 +56,7 @@
 	// Now, copy the contents into the clipboard.
 	QString data;
 
-	for (LDObjectPtr obj : objs)
+	for (LDObject* obj : objs)
 	{
 		if (not data.isEmpty())
 			data += "\n";
@@ -97,7 +97,7 @@
 
 	for (QString line : clipboardText.split ("\n"))
 	{
-		LDObjectPtr pasted = ParseLine (line);
+		LDObject* pasted = ParseLine (line);
 		CurrentDocument()->insertObj (idx++, pasted);
 		pasted->select();
 		++num;
@@ -132,11 +132,11 @@
 		LDObjectList objs = ref->inlineContents (deep, false);
 
 		// Merge in the inlined objects
-		for (LDObjectPtr inlineobj : objs)
+		for (LDObject* inlineobj : objs)
 		{
 			QString line = inlineobj->asText();
 			inlineobj->destroy();
-			LDObjectPtr newobj = ParseLine (line);
+			LDObject* newobj = ParseLine (line);
 			CurrentDocument()->insertObj (idx++, newobj);
 			newobj->select();
 		}
@@ -192,7 +192,7 @@
 	if (Selection().size() != 1)
 		return;
 
-	LDObjectPtr obj = Selection()[0];
+	LDObject* obj = Selection()[0];
 	QDialog* dlg = new QDialog;
 	Ui::EditRawUI ui;
 
@@ -200,7 +200,7 @@
 	ui.code->setText (obj->asText());
 
 	if (obj->type() == OBJ_Error)
-		ui.errorDescription->setText (obj.staticCast<LDError>()->reason());
+		ui.errorDescription->setText (static_cast<LDError*> (obj)->reason());
 	else
 	{
 		ui.errorDescription->hide();
@@ -211,7 +211,7 @@
 		return;
 
 	// Reinterpret it from the text of the input field
-	LDObjectPtr newobj = ParseLine (ui.code->text());
+	LDObject* newobj = ParseLine (ui.code->text());
 	obj->replace (newobj);
 	refresh();
 }
@@ -233,7 +233,7 @@
 	// Show the dialog to the user now and ask for a color.
 	if (ColorSelector::selectColor (color, defaultcol, g_win))
 	{
-		for (LDObjectPtr obj : objs)
+		for (LDObject* obj : objs)
 		{
 			if (obj->isColored())
 				obj->setColor (color);
@@ -250,7 +250,7 @@
 	LDObjectList objs = Selection();
 	int num = 0;
 
-	for (LDObjectPtr obj : objs)
+	for (LDObject* obj : objs)
 	{
 		const LDObjectType type = obj->type();
 
@@ -261,7 +261,7 @@
 
 		if (type == OBJ_Quad)
 		{
-			LDQuadPtr quad = obj.staticCast<LDQuad>();
+			LDQuadPtr quad = static_cast<LDQuad*> (obj);
 			lines[0] = LDSpawn<LDLine> (quad->vertex (0), quad->vertex (1));
 			lines[1] = LDSpawn<LDLine> (quad->vertex (1), quad->vertex (2));
 			lines[2] = LDSpawn<LDLine> (quad->vertex (2), quad->vertex (3));
@@ -269,7 +269,7 @@
 		}
 		else
 		{
-			LDTrianglePtr tri = obj.staticCast<LDTriangle>();
+			LDTrianglePtr tri = static_cast<LDTriangle*> (obj);
 			lines[0] = LDSpawn<LDLine> (tri->vertex (0), tri->vertex (1));
 			lines[1] = LDSpawn<LDLine> (tri->vertex (1), tri->vertex (2));
 			lines[2] = LDSpawn<LDLine> (tri->vertex (2), tri->vertex (0));
@@ -297,7 +297,7 @@
 {
 	int num = 0;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		if (obj->numVertices() < 2)
 			continue;
@@ -358,7 +358,7 @@
 	// Apply the grid values
 	vect *= *CurrentGrid().coordinateSnap;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 		obj->move (vect);
 
 	g_win->refresh();
@@ -400,7 +400,7 @@
 //
 void MainWindow::slot_actionInvert()
 {
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 		obj->invert();
 
 	refresh();
@@ -450,9 +450,9 @@
 	setlocale (LC_ALL, "C");
 	int num = 0;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
-		LDMatrixObjectPtr mo = obj.dynamicCast<LDMatrixObject>();
+		LDMatrixObjectPtr mo = dynamic_cast<LDMatrixObject*> (obj);
 
 		if (mo != null)
 		{
@@ -490,7 +490,7 @@
 {
 	int num = 0;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		if (not obj->isColored())
 			continue;
@@ -526,7 +526,7 @@
 	if (ui.y->isChecked()) sel << Y;
 	if (ui.z->isChecked()) sel << Z;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		for (int i = 0; i < obj->numVertices(); ++i)
 		{
@@ -572,7 +572,7 @@
 	if (ui.y->isChecked()) sel << Y;
 	if (ui.z->isChecked()) sel << Z;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		for (int i = 0; i < obj->numVertices(); ++i)
 		{
@@ -611,7 +611,7 @@
 //
 static bool IsColorUsed (LDColor color)
 {
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 	{
 		if (obj->isColored() and obj->color() == color)
 			return true;
@@ -639,7 +639,7 @@
 		return;
 	}
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		if (not obj->isColored())
 			continue;
@@ -655,7 +655,7 @@
 //
 void MainWindow::slot_actionAddHistoryLine()
 {
-	LDObjectPtr obj;
+	LDObject* obj;
 	bool ishistory = false,
 		 prevIsHistory = false;
 
@@ -682,7 +682,7 @@
 		obj != null and obj->next() != null and not obj->next()->isScemantic();
 		obj = obj->next())
 	{
-		LDCommentPtr comm = obj.dynamicCast<LDComment>();
+		LDCommentPtr comm = dynamic_cast<LDComment*> (obj);
 
 		if (comm != null and comm->text().startsWith ("!HISTORY "))
 			ishistory = true;
@@ -720,16 +720,16 @@
 
 	cfg::SplitLinesSegments = segments;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		if (not Eq (obj->type(), OBJ_Line, OBJ_CondLine))
 			continue;
 
-		QVector<LDObjectPtr> newsegs;
+		QVector<LDObject*> newsegs;
 
 		for (int i = 0; i < segments; ++i)
 		{
-			LDObjectPtr segment;
+			LDObject* segment;
 			Vertex v0, v1;
 
 			v0.apply ([&](Axis ax, double& a)
@@ -754,7 +754,7 @@
 
 		int ln = obj->lineNumber();
 
-		for (LDObjectPtr seg : newsegs)
+		for (LDObject* seg : newsegs)
 			CurrentDocument()->insertObj (ln++, seg);
 
 		obj->destroy();
--- a/src/addObjectDialog.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/addObjectDialog.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -37,7 +37,7 @@
 
 // =============================================================================
 //
-AddObjectDialog::AddObjectDialog (const LDObjectType type, LDObjectPtr obj, QWidget* parent) :
+AddObjectDialog::AddObjectDialog (const LDObjectType type, LDObject* obj, QWidget* parent) :
 	QDialog (parent)
 {
 	setlocale (LC_ALL, "C");
@@ -52,7 +52,7 @@
 			le_comment = new QLineEdit;
 
 			if (obj)
-				le_comment->setText (obj.staticCast<LDComment>()->text());
+				le_comment->setText (static_cast<LDComment*> (obj)->text());
 
 			le_comment->setMinimumWidth (384);
 		} break;
@@ -92,7 +92,7 @@
 			}
 
 			if (obj)
-				rb_bfcType->setValue ((int) obj.staticCast<LDBFC>()->statement());
+				rb_bfcType->setValue ((int) static_cast<LDBFC*> (obj)->statement());
 		} break;
 
 		case OBJ_Subfile:
@@ -100,7 +100,7 @@
 			coordCount = 3;
 			tw_subfileList = new QTreeWidget();
 			tw_subfileList->setHeaderLabel (tr ("Primitives"));
-			PopulatePrimitives (tw_subfileList, (obj != null ? obj.staticCast<LDSubfile>()->fileInfo()->name() : ""));
+			PopulatePrimitives (tw_subfileList, (obj != null ? static_cast<LDSubfile*> (obj)->fileInfo()->name() : ""));
 
 			connect (tw_subfileList, SIGNAL (itemSelectionChanged()), this, SLOT (slot_subfileTypeChanged()));
 			lb_subfileName = new QLabel ("File:");
@@ -109,7 +109,7 @@
 
 			if (obj)
 			{
-				LDSubfilePtr ref = obj.staticCast<LDSubfile>();
+				LDSubfilePtr ref = static_cast<LDSubfile*> (obj);
 				le_subfileName->setText (ref->fileInfo()->name());
 			}
 		} break;
@@ -121,7 +121,7 @@
 	}
 
 	QPixmap icon = GetIcon (format ("add-%1", typeName));
-	LDObjectPtr defaults = LDObject::getDefault (type);
+	LDObject* defaults = LDObject::getDefault (type);
 
 	lb_typeIcon = new QLabel;
 	lb_typeIcon->setPixmap (icon);
@@ -189,7 +189,7 @@
 
 	if (defaults->hasMatrix())
 	{
-		LDMatrixObjectPtr mo = obj.dynamicCast<LDMatrixObject>();
+		LDMatrixObjectPtr mo = dynamic_cast<LDMatrixObject*> (obj);
 		QLabel* lb_matrix = new QLabel ("Matrix:");
 		le_matrix = new QLineEdit;
 		// le_matrix->setValidator (new QDoubleValidator);
@@ -276,17 +276,17 @@
 // =============================================================================
 // =============================================================================
 template<typename T>
-static QSharedPointer<T> InitObject (LDObjectPtr& obj)
+static QSharedPointer<T> InitObject (LDObject*& obj)
 {
 	if (obj == null)
 		obj = LDSpawn<T>();
 
-	return obj.staticCast<T>();
+	return static_cast<T*> (obj);
 }
 
 // =============================================================================
 // =============================================================================
-void AddObjectDialog::staticDialog (const LDObjectType type, LDObjectPtr obj)
+void AddObjectDialog::staticDialog (const LDObjectType type, LDObject* obj)
 {
 	setlocale (LC_ALL, "C");
 
--- a/src/addObjectDialog.h	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/addObjectDialog.h	Sat Aug 22 15:37:02 2015 +0300
@@ -34,8 +34,8 @@
 	Q_OBJECT
 
 public:
-	AddObjectDialog (const LDObjectType type, LDObjectPtr obj, QWidget* parent = null);
-	static void staticDialog (const LDObjectType type, LDObjectPtr obj);
+	AddObjectDialog (const LDObjectType type, LDObject* obj, QWidget* parent = null);
+	static void staticDialog (const LDObjectType type, LDObject* obj);
 
 	QLabel* lb_typeIcon;
 
--- a/src/basics.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/basics.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -227,13 +227,13 @@
 	if (CurrentDocument() == null)
 		return;
 
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 		calcObject (obj);
 }
 
 // =============================================================================
 //
-void LDBoundingBox::calcObject (LDObjectPtr obj)
+void LDBoundingBox::calcObject (LDObject* obj)
 {
 	switch (obj->type())
 	{
@@ -241,23 +241,17 @@
 		case OBJ_Triangle:
 		case OBJ_Quad:
 		case OBJ_CondLine:
-		{
 			for (int i = 0; i < obj->numVertices(); ++i)
 				calcVertex (obj->vertex (i));
-		} break;
+			break;
 
 		case OBJ_Subfile:
-		{
-			LDSubfilePtr ref = obj.staticCast<LDSubfile>();
-			LDObjectList objs = ref->inlineContents (true, false);
-
-			for (LDObjectPtr obj : objs)
+			for (LDObject* obj : static_cast<LDSubfile*> (obj)->inlineContents (true, false))
 			{
 				calcObject (obj);
 				obj->destroy();
 			}
-		}
-		break;
+			break;
 
 		default:
 			break;
@@ -274,7 +268,7 @@
 
 // =============================================================================
 //
-LDBoundingBox& LDBoundingBox::operator<< (LDObjectPtr obj)
+LDBoundingBox& LDBoundingBox::operator<< (LDObject* obj)
 {
 	calcObject (obj);
 	return *this;
--- a/src/basics.h	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/basics.h	Sat Aug 22 15:37:02 2015 +0300
@@ -40,8 +40,8 @@
 using uint16 = quint16;
 using uint32 = quint32;
 using uint64 = quint64;
-using LDObjectPtr = QSharedPointer<LDObject>;
-using LDObjectList = QList<LDObjectPtr>;
+using LDObject* = QSharedPointer<LDObject>;
+using LDObjectList = QList<LDObject*>;
 using LDObjectWeakPtr = QWeakPointer<LDObject>;
 using LDObjectWeakList = QList<LDObjectWeakPtr>;
 using LDDocumentPtr = QSharedPointer<LDDocument>;
@@ -180,7 +180,7 @@
 
 	// Calculates the given \c obj to the bounding box, adjusting
 	// extremas if necessary.
-	void calcObject (LDObjectPtr obj);
+	void calcObject (LDObject* obj);
 
 	// Calculates the given \c vertex to the bounding box, adjusting
 	// extremas if necessary.
@@ -190,7 +190,7 @@
 	Vertex center() const;
 
 	// An operator overload for calcObject()
-	LDBoundingBox& operator<< (LDObjectPtr obj);
+	LDBoundingBox& operator<< (LDObject* obj);
 
 	// An operator overload for calcVertex()
 	LDBoundingBox& operator<< (const Vertex& v);
--- a/src/editHistory.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/editHistory.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -131,7 +131,7 @@
 //
 void AddHistory::undo() const
 {
-	LDObjectPtr obj = parent()->document()->getObject (index());
+	LDObject* obj = parent()->document()->getObject (index());
 	obj->destroy();
 }
 
@@ -139,14 +139,14 @@
 //
 void AddHistory::redo() const
 {
-	LDObjectPtr obj = ParseLine (code());
+	LDObject* obj = ParseLine (code());
 	parent()->document()->insertObj (index(), obj);
 	g_win->R()->compileObject (obj);
 }
 
 // =============================================================================
 //
-DelHistory::DelHistory (int idx, LDObjectPtr obj) :
+DelHistory::DelHistory (int idx, LDObject* obj) :
 	m_index (idx),
 	m_code (obj->asText()) {}
 
@@ -155,7 +155,7 @@
 //
 void DelHistory::undo() const
 {
-	LDObjectPtr obj = ParseLine (code());
+	LDObject* obj = ParseLine (code());
 	parent()->document()->insertObj (index(), obj);
 	g_win->R()->compileObject (obj);
 }
@@ -164,7 +164,7 @@
 //
 void DelHistory::redo() const
 {
-	LDObjectPtr obj = parent()->document()->getObject (index());
+	LDObject* obj = parent()->document()->getObject (index());
 	obj->destroy();
 }
 
@@ -172,8 +172,8 @@
 //
 void EditHistory::undo() const
 {
-	LDObjectPtr obj = CurrentDocument()->getObject (index());
-	LDObjectPtr newobj = ParseLine (oldCode());
+	LDObject* obj = CurrentDocument()->getObject (index());
+	LDObject* newobj = ParseLine (oldCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
 }
@@ -182,8 +182,8 @@
 //
 void EditHistory::redo() const
 {
-	LDObjectPtr obj = CurrentDocument()->getObject (index());
-	LDObjectPtr newobj = ParseLine (newCode());
+	LDObject* obj = CurrentDocument()->getObject (index());
+	LDObject* newobj = ParseLine (newCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
 }
--- a/src/editHistory.h	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/editHistory.h	Sat Aug 22 15:37:02 2015 +0300
@@ -108,7 +108,7 @@
 
 public:
 	IMPLEMENT_HISTORY_TYPE (Del)
-	DelHistory (int idx, LDObjectPtr obj);
+	DelHistory (int idx, LDObject* obj);
 };
 
 // =============================================================================
@@ -138,7 +138,7 @@
 public:
 	IMPLEMENT_HISTORY_TYPE (Add)
 
-	AddHistory (int idx, LDObjectPtr obj) :
+	AddHistory (int idx, LDObject* obj) :
 		m_index (idx),
 		m_code (obj->asText()) {}
 };
--- a/src/editmodes/abstractEditMode.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/editmodes/abstractEditMode.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -165,7 +165,7 @@
 
 	if (objs.size() > 0)
 	{
-		for (LDObjectPtr obj : objs)
+		for (LDObject* obj : objs)
 		{
 			renderer()->document()->insertObj (pos++, obj);
 			renderer()->compileObject (obj);
--- a/src/editmodes/drawMode.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/editmodes/drawMode.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -112,9 +112,9 @@
 		case 3:
 		case 4:
 		{
-			LDObjectPtr obj = (verts.size() == 3) ?
-				static_cast<LDObjectPtr> (LDSpawn<LDTriangle>()) :
-				static_cast<LDObjectPtr> (LDSpawn<LDQuad>());
+			LDObject* obj = (verts.size() == 3) ?
+				static_cast<LDObject*> (LDSpawn<LDTriangle>()) :
+				static_cast<LDObject*> (LDSpawn<LDQuad>());
 
 			obj->setColor (MainColor());
 
--- a/src/editmodes/magicWandMode.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/editmodes/magicWandMode.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -26,7 +26,7 @@
 	Super (renderer)
 {
 	// Get vertex<->object data
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 	{
 		// Note: this deliberately only takes vertex-objects into account.
 		// The magic wand does not process subparts.
@@ -40,7 +40,7 @@
 	return EditModeType::MagicWand;
 }
 
-void MagicWandMode::fillBoundaries (LDObjectPtr obj, QVector<BoundaryType>& boundaries, QVector<LDObjectPtr>& candidates)
+void MagicWandMode::fillBoundaries (LDObject* obj, QVector<BoundaryType>& boundaries, QVector<LDObject*>& candidates)
 {
 	// All boundaries obviously share vertices with the object, therefore they're all in the list
 	// of candidates.
@@ -71,7 +71,7 @@
 	}
 }
 
-void MagicWandMode::doMagic (LDObjectPtr obj, MagicWandMode::MagicType type)
+void MagicWandMode::doMagic (LDObject* obj, MagicWandMode::MagicType type)
 {
 	if (obj == null)
 	{
@@ -110,7 +110,7 @@
 			return;
 	}
 
-	QVector<LDObjectPtr> candidates;
+	QVector<LDObject*> candidates;
 
 	// Get the list of objects that touch this object, i.e. share a vertex
 	// with this.
@@ -123,7 +123,7 @@
 	if (matchesneeded > 1)
 		fillBoundaries (obj, boundaries, candidates);
 
-	for (LDObjectPtr candidate : candidates)
+	for (LDObject* candidate : candidates)
 	{
 		try
 		{
@@ -181,12 +181,12 @@
 		case Set:
 			CurrentDocument()->clearSelection();
 		case Additive:
-			for (LDObjectPtr obj : m_selection)
+			for (LDObject* obj : m_selection)
 				obj->select();
 			break;
 
 		case Subtractive:
-			for (LDObjectPtr obj : m_selection)
+			for (LDObject* obj : m_selection)
 				obj->deselect();
 			break;
 
--- a/src/editmodes/magicWandMode.h	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/editmodes/magicWandMode.h	Sat Aug 22 15:37:02 2015 +0300
@@ -24,8 +24,8 @@
 
 class MagicWandMode : public AbstractSelectMode
 {
-	QMap<Vertex, QVector<LDObjectPtr>> m_vertices;
-	QVector<LDObjectPtr> m_selection;
+	QMap<Vertex, QVector<LDObject*>> m_vertices;
+	QVector<LDObject*> m_selection;
 
 	DEFINE_CLASS (MagicWandMode, AbstractSelectMode)
 
@@ -40,10 +40,10 @@
 	};
 
 	MagicWandMode (GLRenderer* renderer);
-	void doMagic (LDObjectPtr obj, MagicType type);
+	void doMagic (LDObject* obj, MagicType type);
 	virtual EditModeType type() const override;
 	virtual bool mouseReleased (MouseEventData const& data) override;
 
 private:
-	void fillBoundaries (LDObjectPtr obj, QVector<BoundaryType>& boundaries, QVector<LDObjectPtr>& candidates);
+	void fillBoundaries (LDObject* obj, QVector<BoundaryType>& boundaries, QVector<LDObject*>& candidates);
 };
--- a/src/editmodes/selectMode.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/editmodes/selectMode.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -118,7 +118,7 @@
 	if (ev->buttons() & Qt::LeftButton)
 	{
 		renderer()->document()->clearSelection();
-		LDObjectPtr obj = renderer()->pickOneObject (ev->x(), ev->y());
+		LDObject* obj = renderer()->pickOneObject (ev->x(), ev->y());
 
 		if (obj != null)
 		{
--- a/src/extPrograms.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/extPrograms.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -169,16 +169,16 @@
 //
 static void WriteObjects (const LDObjectList& objects, QFile& f)
 {
-	for (LDObjectPtr obj : objects)
+	for (LDObject* obj : objects)
 	{
 		if (obj->type() == OBJ_Subfile)
 		{
-			LDSubfilePtr ref = obj.staticCast<LDSubfile>();
+			LDSubfilePtr ref = static_cast<LDSubfile*> (obj);
 			LDObjectList objs = ref->inlineContents (true, false);
 
 			WriteObjects (objs, f);
 
-			for (LDObjectPtr obj : objs)
+			for (LDObject* obj : objs)
 				obj->destroy();
 		}
 		else
@@ -220,7 +220,7 @@
 {
 	LDObjectList objects;
 
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 	{
 		if (not obj->isColored() or obj->color() != color)
 			continue;
@@ -331,7 +331,7 @@
 	// Insert the new objects
 	CurrentDocument()->clearSelection();
 
-	for (LDObjectPtr obj : objs)
+	for (LDObject* obj : objs)
 	{
 		if (not obj->isScemantic())
 		{
--- a/src/glCompiler.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/glCompiler.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -53,7 +53,7 @@
 static const QColor		g_BFCFrontColor (64, 192, 80);
 static const QColor		g_BFCBackColor (208, 64, 64);
 
-// static QMap<LDObjectPtr, String> g_objectOrigins;
+// static QMap<LDObject*, String> g_objectOrigins;
 
 // =============================================================================
 //
@@ -132,7 +132,7 @@
 
 // =============================================================================
 //
-QColor GLCompiler::getColorForPolygon (LDPolygon& poly, LDObjectPtr topobj,
+QColor GLCompiler::getColorForPolygon (LDPolygon& poly, LDObject* topobj,
 									   EVBOComplement complement) const
 {
 	QColor qcol;
@@ -228,7 +228,7 @@
 
 // =============================================================================
 //
-void GLCompiler::stageForCompilation (LDObjectPtr obj)
+void GLCompiler::stageForCompilation (LDObject* obj)
 {
 	/*
 	g_objectOrigins[obj] = format ("%1:%2 (%3)",
@@ -240,7 +240,7 @@
 
 // =============================================================================
 //
-void GLCompiler::unstage (LDObjectPtr obj)
+void GLCompiler::unstage (LDObject* obj)
 {
 	m_staged.removeOne (obj);
 }
@@ -252,7 +252,7 @@
 	if (doc == null)
 		return;
 
-	for (LDObjectPtr obj : doc->objects())
+	for (LDObject* obj : doc->objects())
 		compileObject (obj);
 }
 
@@ -312,7 +312,7 @@
 
 // =============================================================================
 //
-void GLCompiler::dropObject (LDObjectPtr obj)
+void GLCompiler::dropObject (LDObject* obj)
 {
 	auto it = m_objectInfo.find (obj);
 
@@ -327,7 +327,7 @@
 
 // =============================================================================
 //
-void GLCompiler::compileObject (LDObjectPtr obj)
+void GLCompiler::compileObject (LDObject* obj)
 {
 //	print ("Compile %1\n", g_objectOrigins[obj]);
 
@@ -356,7 +356,7 @@
 
 		case OBJ_Subfile:
 		{
-			LDSubfilePtr ref = obj.staticCast<LDSubfile>();
+			LDSubfilePtr ref = static_cast<LDSubfile*> (obj);
 			auto data = ref->inlinePolygons();
 
 			for (LDPolygon& poly : data)
@@ -377,7 +377,7 @@
 
 // =============================================================================
 //
-void GLCompiler::compilePolygon (LDPolygon& poly, LDObjectPtr topobj, ObjectVBOInfo* objinfo)
+void GLCompiler::compilePolygon (LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo)
 {
 	EVBOSurface surface;
 	int numverts;
--- a/src/glCompiler.h	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/glCompiler.h	Sat Aug 22 15:37:02 2015 +0300
@@ -36,16 +36,16 @@
 	GLCompiler (GLRenderer* renderer);
 	~GLCompiler();
 	void				compileDocument (LDDocumentPtr doc);
-	void				dropObject (LDObjectPtr obj);
+	void				dropObject (LDObject* obj);
 	void				initialize();
-	QColor				getColorForPolygon (LDPolygon& poly, LDObjectPtr topobj,
+	QColor				getColorForPolygon (LDPolygon& poly, LDObject* topobj,
 											EVBOComplement complement) const;
 	QColor				indexColorForID (int id) const;
 	void				needMerge();
 	void				prepareVBO (int vbonum);
 	void				setRenderer (GLRenderer* compiler);
-	void				stageForCompilation (LDObjectPtr obj);
-	void				unstage (LDObjectPtr obj);
+	void				stageForCompilation (LDObject* obj);
+	void				unstage (LDObject* obj);
 
 	static uint32		colorToRGB (const QColor& color);
 
@@ -66,8 +66,8 @@
 
 private:
 	void			compileStaged();
-	void			compileObject (LDObjectPtr obj);
-	void			compilePolygon (LDPolygon& poly, LDObjectPtr topobj, ObjectVBOInfo* objinfo);
+	void			compileObject (LDObject* obj);
+	void			compilePolygon (LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo);
 
 	QMap<LDObjectWeakPtr, ObjectVBOInfo>	m_objectInfo;
 	LDObjectWeakList						m_staged; // Objects that need to be compiled
--- a/src/glRenderer.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/glRenderer.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -921,7 +921,7 @@
 		LDObjectList oldsel = Selection();
 		CurrentDocument()->clearSelection();
 
-		for (LDObjectPtr obj : oldsel)
+		for (LDObject* obj : oldsel)
 			compileObject (obj);
 	}
 
@@ -950,7 +950,7 @@
 	// Read pixels from the color buffer.
 	glReadPixels (x0, m_height - y1, areawidth, areaheight, GL_RGBA, GL_UNSIGNED_BYTE, pixeldata);
 
-	LDObjectPtr removedObj;
+	LDObject* removedObj;
 	QList<qint32> indices;
 
 	// Go through each pixel read and add them to the selection.
@@ -971,7 +971,7 @@
 
 	for (qint32 idx : indices)
 	{
-		LDObjectPtr obj = LDObject::fromID (idx);
+		LDObject* obj = LDObject::fromID (idx);
 		assert (obj != null);
 
 		// If this is an additive single pick and the object is currently selected,
@@ -995,7 +995,7 @@
 	g_win->updateSelection();
 
 	// Recompile the objects now to update their color
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 		compileObject (obj);
 
 	if (removedObj)
@@ -1008,14 +1008,14 @@
 //
 // Simpler version of GLRenderer::pick which simply picks whatever object on the screen
 //
-LDObjectPtr GLRenderer::pickOneObject (int mouseX, int mouseY)
+LDObject* GLRenderer::pickOneObject (int mouseX, int mouseY)
 {
 	uchar pixel[4];
 	doMakeCurrent();
 	setPicking (true);
 	drawGLScene();
 	glReadPixels (mouseX, m_height - mouseY, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
-	LDObjectPtr obj = LDObject::fromID ((pixel[0] * 0x10000) + (pixel[1] * 0x100) + pixel[2]);
+	LDObject* obj = LDObject::fromID ((pixel[0] * 0x10000) + (pixel[1] * 0x100) + pixel[2]);
 	setPicking (false);
 	repaint();
 	return obj;
@@ -1108,7 +1108,7 @@
 
 // =============================================================================
 //
-static QList<Vertex> GetVerticesOf (LDObjectPtr obj)
+static QList<Vertex> GetVerticesOf (LDObject* obj)
 {
 	QList<Vertex> verts;
 
@@ -1117,12 +1117,9 @@
 		for (int i = 0; i < obj->numVertices(); ++i)
 			verts << obj->vertex (i);
 	}
-	elif (obj->type() == OBJ_Subfile)
+	else if (obj->type() == OBJ_Subfile)
 	{
-		LDSubfilePtr ref = obj.staticCast<LDSubfile>();
-		LDObjectList objs = ref->inlineContents (true, false);
-
-		for (LDObjectPtr obj : objs)
+		for (LDObject* obj : static_cast<LDSubfile*> (obj)->inlineContents (true, false))
 		{
 			verts << GetVerticesOf (obj);
 			obj->destroy();
@@ -1134,14 +1131,14 @@
 
 // =============================================================================
 //
-void GLRenderer::compileObject (LDObjectPtr obj)
+void GLRenderer::compileObject (LDObject* obj)
 {
 	compiler()->stageForCompilation (obj);
 }
 
 // =============================================================================
 //
-void GLRenderer::forgetObject (LDObjectPtr obj)
+void GLRenderer::forgetObject (LDObject* obj)
 {
 	if (compiler() != null)
 		compiler()->dropObject (obj);
@@ -1408,15 +1405,15 @@
 //
 LDOverlayPtr GLRenderer::findOverlayObject (ECamera cam)
 {
-	for (LDObjectPtr obj : document()->objects())
+	for (LDObject* obj : document()->objects())
 	{
-		LDOverlayPtr ovlobj = obj.dynamicCast<LDOverlay>();
+		LDOverlayPtr overlay = dynamic_cast<LDOverlay*> (obj);
 
-		if (ovlobj != null and obj.staticCast<LDOverlay>()->camera() == cam)
-			return ovlobj;
+		if (overlay and overlay->camera() == cam)
+			return overlay;
 	}
 
-	return LDOverlayPtr();
+	return nullptr;
 }
 
 // =============================================================================
@@ -1463,7 +1460,7 @@
 		if (meta.img == null and ovlobj != null)
 		{
 			// If this is the last overlay image, we need to remove the empty space after it as well.
-			LDObjectPtr nextobj = ovlobj->next();
+			LDObject* nextobj = ovlobj->next();
 
 			if (nextobj and nextobj->type() == OBJ_Empty)
 				nextobj->destroy();
@@ -1489,7 +1486,7 @@
 
 			for (i = 0; i < document()->getObjectCount(); ++i)
 			{
-				LDObjectPtr obj = document()->getObject (i);
+				LDObject* obj = document()->getObject (i);
 
 				if (obj->isScemantic())
 				{
--- a/src/glRenderer.h	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/glRenderer.h	Sat Aug 22 15:37:02 2015 +0300
@@ -153,14 +153,14 @@
 
 	inline ECamera			camera() const;
 	void					clearOverlay();
-	void					compileObject (LDObjectPtr obj);
+	void					compileObject (LDObject* obj);
 	Vertex					coordconv2_3 (const QPoint& pos2d, bool snap) const;
 	QPoint					coordconv3_2 (const Vertex& pos3d);
 	EditModeType			currentEditModeType() const;
 	int						depthNegateFactor() const;
 	void					drawBlip (QPainter& paint, QPointF pos) const;
 	void					drawGLScene();
-	void					forgetObject (LDObjectPtr obj);
+	void					forgetObject (LDObject* obj);
 	Axis					getCameraAxis (bool y, ECamera camid = (ECamera) -1);
 	const char*				getCameraName() const;
 	double					getDepthValue() const;
@@ -181,7 +181,7 @@
 	void					needZoomToFit();
 	void					pick (int mouseX, int mouseY, bool additive);
 	void					pick (QRect const& range, bool additive);
-	LDObjectPtr				pickOneObject (int mouseX, int mouseY);
+	LDObject*				pickOneObject (int mouseX, int mouseY);
 	Vertex const&			position3D() const;
 	void					refresh();
 	void					resetAngles();
--- a/src/ldDocument.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/ldDocument.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -395,7 +395,7 @@
 	// User wishes to abort, so stop here now.
 	if (isAborted())
 	{
-		for (LDObjectPtr obj : m_objects)
+		for (LDObject* obj : m_objects)
 			obj->destroy();
 
 		m_objects.clear();
@@ -416,13 +416,13 @@
 		while (line.endsWith ("\n") or line.endsWith ("\r"))
 			line.chop (1);
 
-		LDObjectPtr obj = ParseLine (line);
+		LDObject* obj = ParseLine (line);
 
 		// Check for parse errors and warn about tthem
 		if (obj->type() == OBJ_Error)
 		{
 			print ("Couldn't parse line #%1: %2",
-				progress() + 1, obj.staticCast<LDError>()->reason());
+				progress() + 1, static_cast<LDError*> (obj)->reason());
 
 			if (warnings() != null)
 				(*warnings())++;
@@ -746,12 +746,12 @@
 	// files on the parts tracker.
 	QStringList unknowns;
 
-	for (LDObjectPtr obj : file->objects())
+	for (LDObject* obj : file->objects())
 	{
-		if (obj->type() != OBJ_Error or obj.staticCast<LDError>()->fileReferenced().isEmpty())
+		if (obj->type() != OBJ_Error or static_cast<LDError*> (obj)->fileReferenced().isEmpty(j)
 			continue;
 
-		unknowns << obj.staticCast<LDError>()->fileReferenced();
+		unknowns << static_cast<LDError*> (obj)->fileReferenced();
 	}
 
 	if (cfg::TryDownloadMissingFiles and not unknowns.isEmpty())
@@ -784,11 +784,11 @@
 		path = fullPath();
 
 	// If the second object in the list holds the file name, update that now.
-	LDObjectPtr nameObject = getObject (1);
+	LDObject* nameObject = getObject (1);
 
 	if (nameObject != null and nameObject->type() == OBJ_Comment)
 	{
-		LDCommentPtr nameComment = nameObject.staticCast<LDComment>();
+		LDCommentPtr nameComment = static_cast<LDComment*> (nameObject);
 
 		if (nameComment->text().left (6) == "Name: ")
 		{
@@ -803,9 +803,8 @@
 	if (sizeptr != null)
 		*sizeptr = 0;
 
-	// File is open, now save the model to it. Note that LDraw requires files to
-	// have DOS line endings, so we terminate the lines with \r\n.
-	for (LDObjectPtr obj : objects())
+	// File is open, now save the model to it. Note that LDraw requires files to have DOS line endings.
+	for (LDObject* obj : objects())
 	{
 		QByteArray subdata ((obj->asText() + "\r\n").toUtf8());
 		data.append (subdata);
@@ -836,7 +835,7 @@
 //
 void LDDocument::clear()
 {
-	for (LDObjectPtr obj : objects())
+	for (LDObject* obj : objects())
 		forgetObject (obj);
 }
 
@@ -908,7 +907,7 @@
 // code and returns the object parsed from it. parseLine never returns null,
 // the object will be LDError if it could not be parsed properly.
 // =============================================================================
-LDObjectPtr ParseLine (QString line)
+LDObject* ParseLine (QString line)
 {
 	try
 	{
@@ -1066,7 +1065,7 @@
 				CheckTokenNumbers (tokens, 1, 13);
 
 				// Quadrilateral / Conditional line
-				LDObjectPtr obj;
+				LDObject* obj;
 
 				if (num == 4)
 					obj = LDSpawn<LDQuad>();
@@ -1113,11 +1112,11 @@
 	print ("Reloading subfiles of %1", getDisplayName());
 
 	// Go through all objects in the current file and reload the subfiles
-	for (LDObjectPtr obj : objects())
+	for (LDObject* obj : objects())
 	{
 		if (obj->type() == OBJ_Subfile)
 		{
-			LDSubfilePtr ref = obj.staticCast<LDSubfile>();
+			LDSubfilePtr ref = static_cast<LDSubfile*> (obj);
 			LDDocumentPtr fileInfo = GetDocument (ref->fileInfo()->name());
 
 			if (fileInfo != null)
@@ -1134,7 +1133,7 @@
 		// Reparse gibberish files. It could be that they are invalid because
 		// of loading errors. Circumstances may be different now.
 		if (obj->type() == OBJ_Error)
-			obj->replace (ParseLine (obj.staticCast<LDError>()->contents()));
+			obj->replace (ParseLine (static_cast<LDError*> (obj)->contents()));
 	}
 
 	m_needsReCache = true;
@@ -1145,7 +1144,7 @@
 
 // =============================================================================
 //
-int LDDocument::addObject (LDObjectPtr obj)
+int LDDocument::addObject (LDObject* obj)
 {
 	history()->add (new AddHistory (objects().size(), obj));
 	m_objects << obj;
@@ -1159,7 +1158,7 @@
 //
 void LDDocument::addObjects (const LDObjectList& objs)
 {
-	for (LDObjectPtr obj : objs)
+	for (LDObject* obj : objs)
 	{
 		if (obj != null)
 			addObject (obj);
@@ -1168,7 +1167,7 @@
 
 // =============================================================================
 //
-void LDDocument::insertObj (int pos, LDObjectPtr obj)
+void LDDocument::insertObj (int pos, LDObject* obj)
 {
 	history()->add (new AddHistory (pos, obj));
 	m_objects.insert (pos, obj);
@@ -1184,7 +1183,7 @@
 
 // =============================================================================
 //
-void LDDocument::addKnownVertices (LDObjectPtr obj)
+void LDDocument::addKnownVertices (LDObject* obj)
 {
 	auto it = m_objectVertices.find (obj);
 
@@ -1199,7 +1198,7 @@
 
 // =============================================================================
 //
-void LDDocument::forgetObject (LDObjectPtr obj)
+void LDDocument::forgetObject (LDObject* obj)
 {
 	int idx = obj->lineNumber();
 	obj->deselect();
@@ -1230,7 +1229,7 @@
 
 // =============================================================================
 //
-void LDDocument::setObject (int idx, LDObjectPtr obj)
+void LDDocument::setObject (int idx, LDObject* obj)
 {
 	assert (idx >= 0 and idx < m_objects.size());
 
@@ -1254,7 +1253,7 @@
 
 // =============================================================================
 //
-LDObjectPtr LDDocument::getObject (int pos) const
+LDObject* LDDocument::getObject (int pos) const
 {
 	if (pos < m_objects.size())
 		return m_objects[pos];
@@ -1297,12 +1296,12 @@
 	{
 		m_vertices.clear();
 
-		for (LDObjectPtr obj : inlineContents (true, true))
+		for (LDObject* obj : inlineContents (true, true))
 		{
 			if (obj->type() == OBJ_Subfile)
 			{
 				print ("Warning: unable to inline %1 into %2",
-					obj.staticCast<LDSubfile>()->fileInfo()->getDisplayName(),
+					static_cast<LDSubfile*> (obj)->fileInfo()->getDisplayName(),
 					getDisplayName());
 				continue;
 			}
@@ -1323,7 +1322,7 @@
 	{
 		m_objectVertices.clear();
 
-		for (LDObjectPtr obj : inlineContents (true, false))
+		for (LDObject* obj : inlineContents (true, false))
 			addKnownVertices (obj);
 
 		mergeVertices();
@@ -1375,7 +1374,7 @@
 
 	LDObjectList objs, objcache;
 
-	for (LDObjectPtr obj : objects())
+	for (LDObject* obj : objects())
 	{
 		// Skip those without scemantic meaning
 		if (not obj->isScemantic())
@@ -1385,7 +1384,7 @@
 		// just add it into the objects normally. Yay, recursion!
 		if (deep == true and obj->type() == OBJ_Subfile)
 		{
-			for (LDObjectPtr otherobj : obj.staticCast<LDSubfile>()->inlineContents (deep, renderinline))
+			for (LDObject* otherobj : static_cast<LDSubfile*> (obj)->inlineContents (deep, renderinline))
 				objs << otherobj;
 		}
 		else
@@ -1468,7 +1467,7 @@
 
 // =============================================================================
 //
-void LDDocument::addToSelection (LDObjectPtr obj) // [protected]
+void LDDocument::addToSelection (LDObject* obj) // [protected]
 {
 	if (obj->isSelected())
 		return;
@@ -1481,7 +1480,7 @@
 
 // =============================================================================
 //
-void LDDocument::removeFromSelection (LDObjectPtr obj) // [protected]
+void LDDocument::removeFromSelection (LDObject* obj) // [protected]
 {
 	if (not obj->isSelected())
 		return;
@@ -1496,7 +1495,7 @@
 //
 void LDDocument::clearSelection()
 {
-	for (LDObjectPtr obj : m_sel)
+	for (LDObject* obj : m_sel)
 		removeFromSelection (obj);
 
 	assert (m_sel.isEmpty());
@@ -1511,7 +1510,7 @@
 
 // =============================================================================
 //
-void LDDocument::swapObjects (LDObjectPtr one, LDObjectPtr other)
+void LDDocument::swapObjects (LDObject* one, LDObject* other)
 {
 	int a = m_objects.indexOf (one);
 	int b = m_objects.indexOf (other);
--- a/src/ldDocument.h	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/ldDocument.h	Sat Aug 22 15:37:02 2015 +0300
@@ -76,7 +76,7 @@
 	PROPERTY (private,	LDDocumentFlags,	flags,			setFlags,			STOCK_WRITE)
 	PROPERTY (private,	LDDocumentWeakPtr,	self,			setSelf,			STOCK_WRITE)
 
-	QMap<LDObjectPtr, QVector<Vertex>> m_objectVertices;
+	QMap<LDObject*, QVector<Vertex>> m_objectVertices;
 	QVector<Vertex> m_vertices;
 	bool m_verticesOutdated;
 	bool m_needVertexMerge;
@@ -85,32 +85,32 @@
 	LDDocument(LDDocumentPtr* selfptr);
 	~LDDocument();
 
-	int addObject (LDObjectPtr obj); // Adds an object to this file at the end of the file.
+	int addObject (LDObject* obj); // Adds an object to this file at the end of the file.
 	void addObjects (const LDObjectList& objs);
 	void clearSelection();
-	void forgetObject (LDObjectPtr obj); // Deletes the given object from the object chain.
+	void forgetObject (LDObject* obj); // Deletes the given object from the object chain.
 	QString getDisplayName();
 	const LDObjectList& getSelection() const;
 	bool hasUnsavedChanges() const; // Does this document have unsaved changes?
 	void initializeCachedData();
 	LDObjectList inlineContents (bool deep, bool renderinline);
-	void insertObj (int pos, LDObjectPtr obj);
+	void insertObj (int pos, LDObject* obj);
 	int getObjectCount() const;
-	LDObjectPtr getObject (int pos) const;
+	LDObject* getObject (int pos) const;
 	bool save (QString path = "", int64* sizeptr = null); // Saves this file to disk.
-	void swapObjects (LDObjectPtr one, LDObjectPtr other);
+	void swapObjects (LDObject* one, LDObject* other);
 	bool isSafeToClose(); // Perform safety checks. Do this before closing any files!
-	void setObject (int idx, LDObjectPtr obj);
+	void setObject (int idx, LDObject* obj);
 	QList<LDPolygon> inlinePolygons();
 	void vertexChanged (const Vertex& a, const Vertex& b);
 	const QVector<Vertex>& inlineVertices();
 	void clear();
-	void addKnownVertices (LDObjectPtr obj);
+	void addKnownVertices (LDObject* obj);
 	void redoVertices();
 	void needVertexMerge();
 	void reloadAllSubfiles();
 
-	inline LDDocument& operator<< (LDObjectPtr obj)
+	inline LDDocument& operator<< (LDObject* obj)
 	{
 		addObject (obj);
 		return *this;
@@ -158,8 +158,8 @@
 	void mergeVertices();
 
 protected:
-	void addToSelection (LDObjectPtr obj);
-	void removeFromSelection (LDObjectPtr obj);
+	void addToSelection (LDObject* obj);
+	void removeFromSelection (LDObject* obj);
 
 	LDGLData* getGLData()
 	{
@@ -203,7 +203,7 @@
 void CloseAllDocuments();
 
 // Parses a string line containing an LDraw object and returns the object parsed.
-LDObjectPtr ParseLine (QString line);
+LDObject* ParseLine (QString line);
 
 // Retrieves the pointer to the given document by file name. Document is loaded
 // from file if necessary. Can return null if neither succeeds.
--- a/src/ldObject.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/ldObject.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -76,6 +76,28 @@
 LDOBJ_DEFAULT_CTOR (LDBFC, LDObject)
 LDOBJ_DEFAULT_CTOR (LDComment, LDObject)
 
+LDObject::~LDObject()
+{
+	// Don't bother during program termination
+	if (IsExiting() == false)
+	{
+		// If this object was selected, unselect it now
+		if (isSelected() and document() != null)
+			deselect();
+
+		// If this object was associated to a file, remove it off it now
+		if (document() != null)
+			document()->forgetObject (self());
+
+		// Delete the GL lists
+		if (g_win != null)
+			g_win->R()->forgetObject (self());
+
+		// Remove this object from the list of LDObjects
+		g_allObjects.erase (g_allObjects.find (id()));
+	}
+}
+
 // =============================================================================
 //
 void LDObject::chooseID()
@@ -298,35 +320,6 @@
 //
 void LDObject::destroy()
 {
-	// Don't bother during program termination
-	if (IsExiting() or isDestructed())
-		return;
-
-	// If this object was selected, unselect it now
-	if (isSelected() and document() != null)
-		deselect();
-
-	// If this object was associated to a file, remove it off it now
-	if (document() != null)
-		document()->forgetObject (self());
-
-	// Delete the GL lists
-	if (g_win != null)
-		g_win->R()->forgetObject (self());
-
-	// Remove this object from the list of LDObjects
-	g_allObjects.erase (g_allObjects.find (id()));
-	setDestructed (true);
-}
-
-//
-// Deletes the object. Only the shared pointer is to call this!
-//
-void LDObject::finalDelete()
-{
-	if (not isDestructed())
-		destroy();
-
 	delete this;
 }
 
@@ -346,32 +339,31 @@
 {
 	switch (obj->type())
 	{
-		case OBJ_Line:
-		case OBJ_CondLine:
-		case OBJ_Triangle:
-		case OBJ_Quad:
-			for (int i = 0; i < obj->numVertices(); ++i)
-			{
-				Vertex v = obj->vertex (i);
-				v.transform (transform, pos);
-				obj->setVertex (i, v);
-			}
+	case OBJ_Line:
+	case OBJ_CondLine:
+	case OBJ_Triangle:
+	case OBJ_Quad:
+		for (int i = 0; i < obj->numVertices(); ++i)
+		{
+			Vertex v = obj->vertex (i);
+			v.transform (transform, pos);
+			obj->setVertex (i, v);
+		}
+		break;
 
-			break;
-
-		case OBJ_Subfile:
+	case OBJ_Subfile:
 		{
-			LDSubfilePtr ref = qSharedPointerCast<LDSubfile> (obj);
+			LDSubfilePtr ref = static_cast<LDSubfile*> (obj);
 			Matrix newMatrix = transform * ref->transform();
 			Vertex newpos = ref->position();
 			newpos.transform (transform, pos);
 			ref->setPosition (newpos);
 			ref->setTransform (newMatrix);
-			break;
 		}
+		break;
 
-		default:
-			break;
+	default:
+		break;
 	}
 
 	if (obj->color() == MainColor())
@@ -723,9 +715,9 @@
 
 	if (idx > 0)
 	{
-		LDBFCPtr bfc = previous().dynamicCast<LDBFC>();
+		LDBFC* bfc = dynamic_cast<LDBFC*> (previous());
 
-		if (not bfc.isNull() and bfc->statement() == BFCStatement::InvertNext)
+		if (bfc and bfc->statement() == BFCStatement::InvertNext)
 		{
 			// This is prefixed with an invertnext, thus remove it.
 			bfc->destroy();
--- a/src/ldObject.h	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/ldObject.h	Sat Aug 22 15:37:02 2015 +0300
@@ -26,7 +26,7 @@
 #define LDOBJ(T)												\
 public:															\
 	static constexpr LDObjectType SubclassType = OBJ_##T;		\
-	LD##T (LDObjectPtr* selfptr);								\
+	LD##T (LDObject** selfptr);								\
 																\
 	virtual LDObjectType type() const override					\
 	{															\
@@ -56,7 +56,6 @@
 class LDDocument;
 
 class LDBFC;
-using LDBFCPtr = QSharedPointer<LDBFC>;
 
 //
 // Object type codes.
@@ -93,7 +92,6 @@
 {
 	PROPERTY (public,		bool,				isHidden,		setHidden,		STOCK_WRITE)
 	PROPERTY (public,		bool,				isSelected,		setSelected,	STOCK_WRITE)
-	PROPERTY (public,		bool,				isDestructed,	setDestructed,	STOCK_WRITE)
 	PROPERTY (public,		LDObject*,			parent,			setParent,		STOCK_WRITE)
 	PROPERTY (public,		LDDocument*,		document,		setDocument,	CUSTOM_WRITE)
 	PROPERTY (private,		int32,				id,				setID,			STOCK_WRITE)
@@ -103,12 +101,13 @@
 
 public:
 	LDObject (LDDocument* document = nullptr);
+	virtual ~LDObject();
 
 	// This object as LDraw code
 	virtual QString				asText() const = 0;
 
 	// Makes a copy of this object
-	LDObjectPtr					createCopy() const;
+	LDObject*					createCopy() const;
 
 	// What color does the object default to?
 	virtual LDColor				defaultColor() const = 0;
@@ -140,19 +139,19 @@
 	void						move (Vertex vect);
 
 	// Object after this in the current file
-	LDObjectPtr					next() const;
+	LDObject*					next() const;
 
 	// Number of vertices this object has
 	virtual int					numVertices() const = 0;
 
 	// Object prior to this in the current file
-	LDObjectPtr					previous() const;
+	LDObject*					previous() const;
 
 	// Is the previous object INVERTNEXT?
 	bool						previousIsInvertnext (LDBFCPtr& ptr);
 
 	// Replace this LDObject with another LDObject. Object is deleted in the process.
-	void						replace (LDObjectPtr other);
+	void						replace (LDObject* other);
 
 	// Selects this object.
 	void						select();
@@ -164,10 +163,10 @@
 	void						setVertexCoord (int i, Axis ax, double value);
 
 	// Swap this object with another.
-	void						swap (LDObjectPtr other);
+	void						swap (LDObject* other);
 
 	// What object in the current file ultimately references this?
-	LDObjectPtr					topLevelParent();
+	LDObject*					topLevelParent();
 
 	// Type enumerator of this object
 	virtual LDObjectType		type() const = 0;
@@ -182,31 +181,19 @@
 	static QString typeName (LDObjectType type);
 
 	// Returns a default-constructed LDObject by the given type
-	static LDObjectPtr getDefault (const LDObjectType type);
+	static LDObject* getDefault (const LDObjectType type);
 
 	// TODO: move this to LDDocument?
 	static void moveObjects (LDObjectList objs, const bool up);
 
 	// Get a description of a list of LDObjects
 	static QString describeObjects (const LDObjectList& objs);
-	static LDObjectPtr fromID (int id);
+	static LDObject* fromID (int id);
 	LDPolygon* getPolygon();
 
 	// TODO: make this private!
 	QListWidgetItem* qObjListEntry;
 
-	// This is public because I cannot protect it as the lambda deletor would
-	// have to be the friend. Do not call this! Ever!
-	void finalDelete();
-
-	// Even though we supply a custom deleter to QSharedPointer, the shared
-	// pointer's base class still calls operator delete directly in one of
-	// its methods. The method should never be called but we need to declare
-	// the class making this delete call a friend anyway.
-	//
-	// Do not directly delete LDObjects. Ever.
-	virtual ~LDObject();
-
 private:
 	Vertex m_coords[4];
 
@@ -289,9 +276,6 @@
 	void setPosition (const Vertex& a);
 };
 
-using LDMatrixObjectPtr = QSharedPointer<LDMatrixObject>;
-using LDMatrixObjectWeakPtr = QWeakPointer<LDMatrixObject>;
-
 //
 //
 // Represents a line in the LDraw file that could not be properly parsed. It is
@@ -317,9 +301,6 @@
 		m_reason (reason) {}
 };
 
-using LDErrorPtr = QSharedPointer<LDError>;
-using LDErrorWeakPtr = QWeakPointer<LDError>;
-
 //
 //
 // Represents an empty line in the LDraw code file.
@@ -334,9 +315,6 @@
 	LDOBJ_NO_MATRIX
 };
 
-using LDEmptyPtr = QSharedPointer<LDEmpty>;
-using LDEmptyWeakPtr = QWeakPointer<LDEmpty>;
-
 //
 //
 // Represents a code-0 comment in the LDraw code file.
@@ -357,9 +335,6 @@
 		m_text (text) {}
 };
 
-using LDCommentPtr = QSharedPointer<LDComment>;
-using LDCommentWeakPtr = QWeakPointer<LDComment>;
-
 //
 //
 // Represents a 0 BFC statement in the LDraw code.
@@ -401,9 +376,6 @@
 	static const char* StatementStrings[];
 };
 
-using LDBFCPtr = QSharedPointer<LDBFC>;
-using LDBFCWeakPtr = QWeakPointer<LDBFC>;
-
 //
 // LDSubfile
 //
@@ -438,8 +410,6 @@
 };
 
 Q_DECLARE_OPERATORS_FOR_FLAGS (LDSubfile::InlineFlags)
-using LDSubfilePtr = QSharedPointer<LDSubfile>;
-using LDSubfileWeakPtr = QWeakPointer<LDSubfile>;
 
 //
 // LDLine
@@ -460,9 +430,6 @@
 	LDLine (Vertex v1, Vertex v2, LDDocument* document = nullptr);
 };
 
-using LDLinePtr = QSharedPointer<LDLine>;
-using LDLineWeakPtr = QWeakPointer<LDLine>;
-
 //
 // LDCondLine
 //
@@ -483,9 +450,6 @@
 	LDLinePtr toEdgeLine();
 };
 
-using LDCondLinePtr = QSharedPointer<LDCondLine>;
-using LDCondLineWeakPtr = QWeakPointer<LDCondLine>;
-
 //
 // LDTriangle
 //
@@ -507,9 +471,6 @@
 	LDTriangle (Vertex const& v1, Vertex const& v2, Vertex const& v3, LDDocument* document = nullptr);
 };
 
-using LDTrianglePtr = QSharedPointer<LDTriangle>;
-using LDTriangleWeakPtr = QWeakPointer<LDTriangle>;
-
 //
 // LDQuad
 //
@@ -533,9 +494,6 @@
 	QList<LDTrianglePtr> splitToTriangles();
 };
 
-using LDQuadPtr = QSharedPointer<LDQuad>;
-using LDQuadWeakPtr = QWeakPointer<LDQuad>;
-
 //
 // LDVertex
 //
@@ -559,9 +517,6 @@
 	virtual void getVertices (QVector<Vertex>& verts) const override;
 };
 
-using LDVertexPtr = QSharedPointer<LDVertex>;
-using LDVertexWeakPtr = QWeakPointer<LDVertex>;
-
 //
 // LDOverlay
 //
@@ -584,9 +539,6 @@
 	PROPERTY (public,	QString,	fileName,	setFileName,	STOCK_WRITE)
 };
 
-using LDOverlayPtr = QSharedPointer<LDOverlay>;
-using LDOverlayWeakPtr = QWeakPointer<LDOverlay>;
-
 // Other common LDraw stuff
 static const QString CALicenseText ("!LICENSE Redistributable under CCAL version 2.0 : "
 	"see CAreadme.txt");
@@ -600,13 +552,13 @@
 QString PreferredLicenseText();
 
 template<typename T>
-inline void DynamicExecute (LDObjectPtr obj, std::function<void (QSharedPointer<T> const&)> func)
+inline void DynamicExecute (LDObject* obj, std::function<void (QSharedPointer<T> const&)> func)
 {
 	static_assert (std::is_base_of<LDObject, T>::value,
 		"DynamicExecute may only be used with LDObject-derivatives");
 
 	if (obj->type() == T::SubclassType)
-		func (obj.staticCast<T>());
+		func (static_cast<T*> (obj));
 }
 
 struct LDIterationBreakage {};
@@ -620,7 +572,7 @@
 
 	try
 	{
-		for (LDObjectPtr const& obj : objs)
+		for (LDObject* const& obj : objs)
 			DynamicExecute<T> (obj, func);
 	}
 	catch (LDIterationBreakage) {}
--- a/src/ldObjectMath.cpp	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/ldObjectMath.cpp	Sat Aug 22 15:37:02 2015 +0300
@@ -41,21 +41,21 @@
 	// ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2
 	Matrix transform (
 	{
-		(l* l * (1 - cosangle)) + cosangle,
-		(m* l * (1 - cosangle)) - (n* sinangle),
-		(n* l * (1 - cosangle)) + (m* sinangle),
+		(l * l * (1 - cosangle)) + cosangle,
+		(m * l * (1 - cosangle)) - (n * sinangle),
+		(n * l * (1 - cosangle)) + (m * sinangle),
 
-		(l* m * (1 - cosangle)) + (n* sinangle),
-		(m* m * (1 - cosangle)) + cosangle,
-		(n* m * (1 - cosangle)) - (l* sinangle),
+		(l * m * (1 - cosangle)) + (n * sinangle),
+		(m * m * (1 - cosangle)) + cosangle,
+		(n * m * (1 - cosangle)) - (l * sinangle),
 
-		(l* n * (1 - cosangle)) - (m* sinangle),
-		(m* n * (1 - cosangle)) + (l* sinangle),
-		(n* n * (1 - cosangle)) + cosangle
+		(l * n * (1 - cosangle)) - (m * sinangle),
+		(m * n * (1 - cosangle)) + (l * sinangle),
+		(n * n * (1 - cosangle)) + cosangle
 	});
 
 	// Apply the above matrix to everything
-	for (LDObjectPtr obj : objects)
+	for (LDObject* obj : objects)
 	{
 		if (obj->numVertices())
 		{
@@ -68,7 +68,7 @@
 		}
 		elif (obj->hasMatrix())
 		{
-			LDMatrixObjectPtr mo = obj.dynamicCast<LDMatrixObject>();
+			LDMatrixObjectPtr mo = dynamic_cast<LDMatrixObject*> (obj);
 
 			// Transform the position
 			Vertex v = mo->position();
@@ -80,7 +80,7 @@
 		}
 		elif (obj->type() == OBJ_Vertex)
 		{
-			LDVertexPtr vert = obj.staticCast<LDVertex>();
+			LDVertexPtr vert = static_cast<LDVertex*> (obj);
 			Vertex v = vert->pos;
 			RotateVertex (v, rotpoint, transform);
 			vert->pos = v;
--- a/src/mainWindow.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/mainWindow.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -278,7 +278,7 @@
 			CurrentDocument()->getObject (0)->type() == OBJ_Comment)
 		{
 			// Append title
-			LDCommentPtr comm = CurrentDocument()->getObject (0).staticCast<LDComment>();
+			LDCommentPtr comm = static_cast <LDComment*> (CurrentDocument()->getObject (0));
 			title += format (": %1", comm->text());
 		}
 
@@ -308,7 +308,7 @@
 	LDObjectList selCopy = Selection();
 
 	// Delete the objects that were being selected
-	for (LDObjectPtr obj : selCopy)
+	for (LDObject* obj : selCopy)
 		obj->destroy();
 
 	refresh();
@@ -332,7 +332,7 @@
 
 	ui->objectList->clear();
 
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 	{
 		QString descr;
 
@@ -340,7 +340,7 @@
 		{
 			case OBJ_Comment:
 			{
-				descr = obj.staticCast<LDComment>()->text();
+				descr = static_cast<LDComment*> (obj)->text();
 
 				// Remove leading whitespace
 				while (descr[0] == ' ')
@@ -375,13 +375,13 @@
 
 			case OBJ_Vertex:
 			{
-				descr = obj.staticCast<LDVertex>()->pos.toString (true);
+				descr = static_cast<LDVertex*> (obj)->pos.toString (true);
 				break;
 			}
 
 			case OBJ_Subfile:
 			{
-				LDSubfilePtr ref = obj.staticCast<LDSubfile>();
+				LDSubfilePtr ref = static_cast<LDSubfile*> (obj);
 
 				descr = format ("%1 %2, (", ref->fileInfo()->getDisplayName(), ref->position().toString (true));
 
@@ -394,13 +394,13 @@
 
 			case OBJ_BFC:
 			{
-				descr = LDBFC::StatementStrings[int (obj.staticCast<LDBFC>()->statement())];
+				descr = LDBFC::StatementStrings[int (static_cast<LDBFC*> (obj)->statement())];
 				break;
 			}
 
 			case OBJ_Overlay:
 			{
-				LDOverlayPtr ovl = obj.staticCast<LDOverlay>();
+				LDOverlayPtr ovl = static_cast<LDOverlay*> (obj);
 				descr = format ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()],
 					Basename (ovl->fileName()), ovl->x(), ovl->y(),
 					ovl->width(), ovl->height());
@@ -455,7 +455,7 @@
 	if (Selection().isEmpty())
 		return;
 
-	LDObjectPtr obj = Selection().last();
+	LDObject* obj = Selection().last();
 	ui->objectList->scrollToItem (obj->qObjListEntry);
 }
 
@@ -472,7 +472,7 @@
 	CurrentDocument()->clearSelection();
 	const QList<QListWidgetItem*> items = ui->objectList->selectedItems();
 
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 	{
 		for (QListWidgetItem* item : items)
 		{
@@ -492,7 +492,7 @@
 	LDObjectList compound = priorSelection + Selection();
 	RemoveDuplicates (compound);
 
-	for (LDObjectPtr obj : compound)
+	for (LDObject* obj : compound)
 		R()->compileObject (obj);
 
 	R()->update();
@@ -525,7 +525,7 @@
 	if (col == null)
 		return;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		if (not obj->isColored())
 			continue; // uncolored object
@@ -575,7 +575,7 @@
 	int top = -1;
 	int bottom = -1;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		if (obj->qObjListEntry == null)
 			continue;
@@ -615,7 +615,7 @@
 {
 	LDColor result;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		if (not obj->isColored())
 			continue; // doesn't use color
@@ -660,11 +660,11 @@
 void MainWindow::spawnContextMenu (const QPoint pos)
 {
 	const bool single = (Selection().size() == 1);
-	LDObjectPtr singleObj = single ? Selection().first() : nullptr;
+	LDObject* singleObj = single ? Selection().first() : nullptr;
 
 	bool hasSubfiles = false;
 
-	for (LDObjectPtr obj : Selection())
+	for (LDObject* obj : Selection())
 	{
 		if (obj->type() == OBJ_Subfile)
 		{
@@ -727,7 +727,7 @@
 {
 	LDObjectList objs;
 
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 	{
 		if (not obj->isColored() or obj->color() != color)
 			continue;
@@ -735,7 +735,7 @@
 		objs << obj;
 	}
 
-	for (LDObjectPtr obj : objs)
+	for (LDObject* obj : objs)
 		obj->destroy();
 }
 
@@ -756,7 +756,7 @@
 //
 void MainWindow::slot_editObject (QListWidgetItem* listitem)
 {
-	for (LDObjectPtr it : CurrentDocument()->objects())
+	for (LDObject* it : CurrentDocument()->objects())
 	{
 		if (it->qObjListEntry == listitem)
 		{
@@ -897,7 +897,7 @@
 {
 	std::map<LDColor, int> counts;
 
-	for (LDObjectPtr obj : CurrentDocument()->objects())
+	for (LDObject* obj : CurrentDocument()->objects())
 	{
 		if (not obj->isColored() or obj->color() == null)
 			continue;
@@ -1009,7 +1009,7 @@
 	ui->objectList->clear();
 	LDDocumentPtr f = getCurrentDocument();
 
-for (LDObjectPtr obj : *f)
+for (LDObject* obj : *f)
 		ui->objectList->addItem (obj->qObjListEntry);
 
 #endif
--- a/src/miscallenous.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/miscallenous.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -174,10 +174,10 @@
 			LDBoundingBox box;
 
 			// Calculate center vertex
-			for (LDObjectPtr obj : objs)
+			for (LDObject* obj : objs)
 			{
 				if (obj->hasMatrix())
-					box << obj.dynamicCast<LDMatrixObject>()->position();
+					box << static_cast<LDMatrixObject*> (obj)->position();
 				else
 					box << obj;
 			}
--- a/src/partDownloader.cc	Sat Aug 22 13:51:20 2015 +0300
+++ b/src/partDownloader.cc	Sat Aug 22 15:37:02 2015 +0300
@@ -501,11 +501,11 @@
 	// from unknown file references, try resolve that by downloading the reference.
 	// This is why downloading a part may end up downloading multiple files, as
 	// it resolves dependencies.
-	for (LDObjectPtr obj : f->objects())
+	for (LDObject* obj : f->objects())
 	{
-		LDErrorPtr err = obj.dynamicCast<LDError>();
+		LDErrorPtr err = dynamic_cast<LDError*> (obj);
 
-		if ((err == null) or (err->fileReferenced().isEmpty()))
+		if (err == null or err->fileReferenced().isEmpty())
 			continue;
 
 		QString dest = err->fileReferenced();

mercurial