fix paren style

Thu, 04 Jan 2018 19:44:26 +0200

author
Santeri Piippo
date
Thu, 04 Jan 2018 19:44:26 +0200
changeset 1217
314e12e23c3a
parent 1216
12f9ea615cbc
child 1218
e0b59d183f96

fix paren style

src/addObjectDialog.cpp file | annotate | diff | comparison | revisions
src/addObjectDialog.h file | annotate | diff | comparison | revisions
src/basics.cpp file | annotate | diff | comparison | revisions
src/basics.h file | annotate | diff | comparison | revisions
src/colors.cpp file | annotate | diff | comparison | revisions
src/colors.h file | annotate | diff | comparison | revisions
src/crashCatcher.cpp file | annotate | diff | comparison | revisions
src/dialogs.cpp file | annotate | diff | comparison | revisions
src/dialogs.h file | annotate | diff | comparison | revisions
src/dialogs/colorselector.cpp file | annotate | diff | comparison | revisions
src/dialogs/colorselector.h file | annotate | diff | comparison | revisions
src/dialogs/configdialog.cpp file | annotate | diff | comparison | revisions
src/dialogs/configdialog.h file | annotate | diff | comparison | revisions
src/dialogs/configdialog.ui file | annotate | diff | comparison | revisions
src/dialogs/ldrawpathdialog.cpp file | annotate | diff | comparison | revisions
src/dialogs/ldrawpathdialog.h file | annotate | diff | comparison | revisions
src/dialogs/newpartdialog.cpp file | annotate | diff | comparison | revisions
src/dialogs/newpartdialog.h file | annotate | diff | comparison | revisions
src/dialogs/openprogressdialog.cpp file | annotate | diff | comparison | revisions
src/dialogs/openprogressdialog.h file | annotate | diff | comparison | revisions
src/documentation.cpp file | annotate | diff | comparison | revisions
src/documentation.h file | annotate | diff | comparison | revisions
src/documentloader.cpp file | annotate | diff | comparison | revisions
src/documentloader.h file | annotate | diff | comparison | revisions
src/documentmanager.cpp file | annotate | diff | comparison | revisions
src/documentmanager.h file | annotate | diff | comparison | revisions
src/doublemap.h file | annotate | diff | comparison | revisions
src/editHistory.cpp file | annotate | diff | comparison | revisions
src/editHistory.h file | annotate | diff | comparison | revisions
src/editmodes/abstractEditMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/abstractEditMode.h file | annotate | diff | comparison | revisions
src/editmodes/circleMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/circleMode.h file | annotate | diff | comparison | revisions
src/editmodes/curvemode.cpp file | annotate | diff | comparison | revisions
src/editmodes/curvemode.h file | annotate | diff | comparison | revisions
src/editmodes/drawMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/drawMode.h file | annotate | diff | comparison | revisions
src/editmodes/linePathMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/linePathMode.h file | annotate | diff | comparison | revisions
src/editmodes/magicWandMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/magicWandMode.h file | annotate | diff | comparison | revisions
src/editmodes/rectangleMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/rectangleMode.h file | annotate | diff | comparison | revisions
src/editmodes/selectMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/selectMode.h file | annotate | diff | comparison | revisions
src/format.h file | annotate | diff | comparison | revisions
src/glCompiler.cpp file | annotate | diff | comparison | revisions
src/glCompiler.h file | annotate | diff | comparison | revisions
src/glRenderer.cpp file | annotate | diff | comparison | revisions
src/glRenderer.h file | annotate | diff | comparison | revisions
src/glShared.h file | annotate | diff | comparison | revisions
src/guiutilities.cpp file | annotate | diff | comparison | revisions
src/guiutilities.h file | annotate | diff | comparison | revisions
src/hierarchyelement.cpp file | annotate | diff | comparison | revisions
src/hierarchyelement.h file | annotate | diff | comparison | revisions
src/ldDocument.cpp file | annotate | diff | comparison | revisions
src/ldDocument.h file | annotate | diff | comparison | revisions
src/ldObject.cpp file | annotate | diff | comparison | revisions
src/ldObject.h file | annotate | diff | comparison | revisions
src/ldObjectMath.cpp file | annotate | diff | comparison | revisions
src/ldObjectMath.h file | annotate | diff | comparison | revisions
src/ldobjectiterator.h file | annotate | diff | comparison | revisions
src/ldpaths.cpp file | annotate | diff | comparison | revisions
src/ldpaths.h file | annotate | diff | comparison | revisions
src/macros.h file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
src/mainwindow.cpp file | annotate | diff | comparison | revisions
src/mainwindow.h file | annotate | diff | comparison | revisions
src/mainwindow.ui file | annotate | diff | comparison | revisions
src/messageLog.cpp file | annotate | diff | comparison | revisions
src/messageLog.h file | annotate | diff | comparison | revisions
src/miscallenous.cpp file | annotate | diff | comparison | revisions
src/miscallenous.h file | annotate | diff | comparison | revisions
src/partdownloader.cpp file | annotate | diff | comparison | revisions
src/partdownloader.h file | annotate | diff | comparison | revisions
src/partdownloadrequest.cpp file | annotate | diff | comparison | revisions
src/partdownloadrequest.h file | annotate | diff | comparison | revisions
src/primitives.cpp file | annotate | diff | comparison | revisions
src/primitives.h file | annotate | diff | comparison | revisions
src/radioGroup.cpp file | annotate | diff | comparison | revisions
src/radioGroup.h file | annotate | diff | comparison | revisions
src/ringFinder.cpp file | annotate | diff | comparison | revisions
src/ringFinder.h file | annotate | diff | comparison | revisions
src/toolsets/algorithmtoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/algorithmtoolset.h file | annotate | diff | comparison | revisions
src/toolsets/basictoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/basictoolset.h file | annotate | diff | comparison | revisions
src/toolsets/extprogramtoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/extprogramtoolset.h file | annotate | diff | comparison | revisions
src/toolsets/filetoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/filetoolset.h file | annotate | diff | comparison | revisions
src/toolsets/movetoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/movetoolset.h file | annotate | diff | comparison | revisions
src/toolsets/toolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/toolset.h file | annotate | diff | comparison | revisions
src/toolsets/viewtoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/viewtoolset.h file | annotate | diff | comparison | revisions
src/version.cpp file | annotate | diff | comparison | revisions
src/version.h file | annotate | diff | comparison | revisions
--- a/src/addObjectDialog.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/addObjectDialog.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -37,24 +37,24 @@
 
 // =============================================================================
 //
-AddObjectDialog::AddObjectDialog (const LDObjectType type, LDObject* obj, QWidget* parent) :
-	QDialog (parent)
+AddObjectDialog::AddObjectDialog(const LDObjectType type, LDObject* obj, QWidget* parent) :
+	QDialog(parent)
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
 	int coordCount = 0;
-	QString typeName = LDObject::typeName (type);
+	QString typeName = LDObject::typeName(type);
 
-	switch (type)
+	switch(type)
 	{
 		case OBJ_Comment:
 		{
 			le_comment = new QLineEdit;
 
 			if (obj)
-				le_comment->setText (static_cast<LDComment*> (obj)->text());
+				le_comment->setText(static_cast<LDComment*>(obj)->text());
 
-			le_comment->setMinimumWidth (384);
+			le_comment->setMinimumWidth(384);
 		} break;
 
 		case OBJ_Line:
@@ -75,51 +75,51 @@
 
 		case OBJ_Bfc:
 		{
-			rb_bfcType = new RadioGroup ("Statement", {}, 0, Qt::Vertical);
+			rb_bfcType = new RadioGroup("Statement", {}, 0, Qt::Vertical);
 
-			for_enum (BfcStatement, i)
+			for_enum(BfcStatement, i)
 			{
 				// Separate these in two columns
-				if (int (i) == int (BfcStatement::NumValues) / 2)
+				if (int(i) == int(BfcStatement::NumValues) / 2)
 					rb_bfcType->rowBreak();
 
-				rb_bfcType->addButton (LDBfc::statementToString (i));
+				rb_bfcType->addButton(LDBfc::statementToString(i));
 			}
 
 			if (obj)
-				rb_bfcType->setValue ((int) static_cast<LDBfc*> (obj)->statement());
+				rb_bfcType->setValue((int) static_cast<LDBfc*>(obj)->statement());
 		} break;
 
 		case OBJ_SubfileReference:
 		{
 			coordCount = 3;
 			tw_subfileList = new QTreeWidget();
-			tw_subfileList->setHeaderLabel (tr ("Primitives"));
-			populatePrimitivesTree (tw_subfileList, (obj ? static_cast<LDSubfileReference*> (obj)->fileInfo()->name() : ""));
+			tw_subfileList->setHeaderLabel(tr("Primitives"));
+			populatePrimitivesTree(tw_subfileList,(obj ? static_cast<LDSubfileReference*>(obj)->fileInfo()->name() : ""));
 
-			connect (tw_subfileList, SIGNAL (itemSelectionChanged()), this, SLOT (slot_subfileTypeChanged()));
-			lb_subfileName = new QLabel ("File:");
+			connect(tw_subfileList, SIGNAL(itemSelectionChanged()), this, SLOT(slot_subfileTypeChanged()));
+			lb_subfileName = new QLabel("File:");
 			le_subfileName = new QLineEdit;
 			le_subfileName->setFocus();
 
 			if (obj)
 			{
-				LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
-				le_subfileName->setText (ref->fileInfo()->name());
+				LDSubfileReference* ref = static_cast<LDSubfileReference*>(obj);
+				le_subfileName->setText(ref->fileInfo()->name());
 			}
 		} break;
 
 		default:
 		{
-			Critical (format ("Unhandled LDObject type %1 (%2) in AddObjectDialog", (int) type, typeName));
+			Critical(format("Unhandled LDObject type %1(%2) in AddObjectDialog",(int) type, typeName));
 		} return;
 	}
 
-	QPixmap icon = GetIcon (format ("add-%1", typeName));
-	LDObject* defaults = LDObject::getDefault (type);
+	QPixmap icon = GetIcon(format("add-%1", typeName));
+	LDObject* defaults = LDObject::getDefault(type);
 
 	lb_typeIcon = new QLabel;
-	lb_typeIcon->setPixmap (icon);
+	lb_typeIcon->setPixmap(icon);
 
 	// Show a color edit dialog for the types that actually use the color
 	if (defaults->isColored())
@@ -130,22 +130,22 @@
 			m_color = (type == OBJ_CondLine or type == OBJ_Line) ? EdgeColor : MainColor;
 
 		pb_color = new QPushButton;
-		setButtonBackground (pb_color, m_color);
-		connect (pb_color, SIGNAL (clicked()), this, SLOT (slot_colorButtonClicked()));
+		setButtonBackground(pb_color, m_color);
+		connect(pb_color, SIGNAL(clicked()), this, SLOT(slot_colorButtonClicked()));
 	}
 
 	for (int i = 0; i < coordCount; ++i)
 	{
 		dsb_coords[i] = new QDoubleSpinBox;
-		dsb_coords[i]->setDecimals (5);
-		dsb_coords[i]->setMinimum (-10000.0);
-		dsb_coords[i]->setMaximum (10000.0);
+		dsb_coords[i]->setDecimals(5);
+		dsb_coords[i]->setMinimum(-10000.0);
+		dsb_coords[i]->setMaximum(10000.0);
 	}
 
 	QGridLayout* const layout = new QGridLayout;
-	layout->addWidget (lb_typeIcon, 0, 0);
+	layout->addWidget(lb_typeIcon, 0, 0);
 
-	switch (type)
+	switch(type)
 	{
 		case OBJ_Line:
 		case OBJ_CondLine:
@@ -156,26 +156,26 @@
 			{
 				for (int i = 0; i < coordCount / 3; ++i)
 				{
-					obj->vertex (i).apply ([&](Axis ax, double value)
+					obj->vertex(i).apply([&](Axis ax, double value)
 					{
-						dsb_coords[(i * 3) + ax]->setValue (value);
+						dsb_coords[(i * 3) + ax]->setValue(value);
 					});
 				}
 			}
 			break;
 
 		case OBJ_Comment:
-			layout->addWidget (le_comment, 0, 1);
+			layout->addWidget(le_comment, 0, 1);
 			break;
 
 		case OBJ_Bfc:
-			layout->addWidget (rb_bfcType, 0, 1);
+			layout->addWidget(rb_bfcType, 0, 1);
 			break;
 
 		case OBJ_SubfileReference:
-			layout->addWidget (tw_subfileList, 1, 1, 1, 2);
-			layout->addWidget (lb_subfileName, 2, 1);
-			layout->addWidget (le_subfileName, 2, 2);
+			layout->addWidget(tw_subfileList, 1, 1, 1, 2);
+			layout->addWidget(lb_subfileName, 2, 1);
+			layout->addWidget(le_subfileName, 2, 2);
 			break;
 
 		default:
@@ -184,65 +184,65 @@
 
 	if (defaults->hasMatrix())
 	{
-		LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
-		QLabel* lb_matrix = new QLabel ("Matrix:");
+		LDMatrixObject* mo = dynamic_cast<LDMatrixObject*>(obj);
+		QLabel* lb_matrix = new QLabel("Matrix:");
 		le_matrix = new QLineEdit;
-		// le_matrix->setValidator (new QDoubleValidator);
+		// le_matrix->setValidator(new QDoubleValidator);
 		Matrix defaultMatrix = IdentityMatrix;
 
 		if (mo)
 		{
-			mo->position().apply ([&](Axis ax, double value)
+			mo->position().apply([&](Axis ax, double value)
 			{
-				dsb_coords[ax]->setValue (value);
+				dsb_coords[ax]->setValue(value);
 			});
 
 			defaultMatrix = mo->transform();
 		}
 
-		le_matrix->setText (defaultMatrix.toString());
-		layout->addWidget (lb_matrix, 4, 1);
-		layout->addWidget (le_matrix, 4, 2, 1, 3);
+		le_matrix->setText(defaultMatrix.toString());
+		layout->addWidget(lb_matrix, 4, 1);
+		layout->addWidget(le_matrix, 4, 2, 1, 3);
 	}
 
 	if (defaults->isColored())
-		layout->addWidget (pb_color, 1, 0);
+		layout->addWidget(pb_color, 1, 0);
 
 	if (coordCount > 0)
 	{
 		QGridLayout* const qCoordLayout = new QGridLayout;
 
 		for (int i = 0; i < coordCount; ++i)
-			qCoordLayout->addWidget (dsb_coords[i], (i / 3), (i % 3));
+			qCoordLayout->addWidget(dsb_coords[i],(i / 3),(i % 3));
 
-		layout->addLayout (qCoordLayout, 0, 1, (coordCount / 3), 3);
+		layout->addLayout(qCoordLayout, 0, 1,(coordCount / 3), 3);
 	}
 
-	QDialogButtonBox* bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-	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);
-	setLayout (layout);
-	setWindowTitle (format (tr ("Edit %1"), typeName));
-	setWindowIcon (icon);
+	QDialogButtonBox* bbx_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+	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);
+	setLayout(layout);
+	setWindowTitle(format(tr("Edit %1"), typeName));
+	setWindowIcon(icon);
 }
 
 // =============================================================================
 // =============================================================================
-void AddObjectDialog::setButtonBackground (QPushButton* button, LDColor color)
+void AddObjectDialog::setButtonBackground(QPushButton* button, LDColor color)
 {
-	button->setIcon (GetIcon ("palette"));
-	button->setAutoFillBackground (true);
+	button->setIcon(GetIcon("palette"));
+	button->setAutoFillBackground(true);
 
 	if (color.isValid())
-		button->setStyleSheet (format ("background-color: %1", color.hexcode()));
+		button->setStyleSheet(format("background-color: %1", color.hexcode()));
 }
 
 // =============================================================================
 // =============================================================================
 QString AddObjectDialog::currentSubfileName()
 {
-	PrimitiveTreeItem* item = static_cast<PrimitiveTreeItem*> (tw_subfileList->currentItem());
+	PrimitiveTreeItem* item = static_cast<PrimitiveTreeItem*>(tw_subfileList->currentItem());
 
 	if (item->primitive() == nullptr)
 		return ""; // selected a heading
@@ -254,8 +254,8 @@
 // =============================================================================
 void AddObjectDialog::slot_colorButtonClicked()
 {
-	ColorSelector::selectColor (this, m_color, m_color);
-	setButtonBackground (pb_color, m_color);
+	ColorSelector::selectColor(this, m_color, m_color);
+	setButtonBackground(pb_color, m_color);
 }
 
 // =============================================================================
@@ -265,26 +265,26 @@
 	QString name = currentSubfileName();
 
 	if (name.length() > 0)
-		le_subfileName->setText (name);
+		le_subfileName->setText(name);
 }
 
 // =============================================================================
 // =============================================================================
 template<typename T>
-static T* InitObject (LDObject*& obj)
+static T* InitObject(LDObject*& obj)
 {
 	if (obj == nullptr)
 		obj = new T;
 
-	return static_cast<T*> (obj);
+	return static_cast<T*>(obj);
 }
 
 // =============================================================================
 // =============================================================================
 #include "documentmanager.h"
-void AddObjectDialog::staticDialog (const LDObjectType type, LDObject* obj)
+void AddObjectDialog::staticDialog(const LDObjectType type, LDObject* obj)
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
 	// FIXME: Redirect to Edit Raw
 	if (obj and obj->type() == OBJ_Error)
@@ -295,7 +295,7 @@
 
 	const bool newObject = (obj == nullptr);
 	Matrix transform = IdentityMatrix;
-	AddObjectDialog dlg (type, obj);
+	AddObjectDialog dlg(type, obj);
 
 	if (obj and obj->type() != type)
 		return;
@@ -305,7 +305,7 @@
 
 	if (type == OBJ_SubfileReference)
 	{
-		QStringList matrixstrvals = dlg.le_matrix->text().split (" ", QString::SkipEmptyParts);
+		QStringList matrixstrvals = dlg.le_matrix->text().split(" ", QString::SkipEmptyParts);
 
 		if (matrixstrvals.size() == 9)
 		{
@@ -315,16 +315,16 @@
 			for (QString val : matrixstrvals)
 				matrixvals[i++] = val.toFloat();
 
-			transform = Matrix (matrixvals);
+			transform = Matrix(matrixvals);
 		}
 	}
 
-	switch (type)
+	switch(type)
 	{
 		case OBJ_Comment:
 		{
-			LDComment* comm = InitObject<LDComment> (obj);
-			comm->setText (dlg.le_comment->text());
+			LDComment* comm = InitObject<LDComment>(obj);
+			comm->setText(dlg.le_comment->text());
 		}
 		break;
 
@@ -334,27 +334,27 @@
 		case OBJ_CondLine:
 		{
 			if (not obj)
-				obj = LDObject::getDefault (type);
+				obj = LDObject::getDefault(type);
 
 			for (int i = 0; i < obj->numVertices(); ++i)
 			{
 				Vertex v;
 
-				v.apply ([&](Axis ax, double& value)
+				v.apply([&](Axis ax, double& value)
 				{
 					value = dlg.dsb_coords[(i * 3) + ax]->value();
 				});
 
-				obj->setVertex (i, v);
+				obj->setVertex(i, v);
 			}
 		} break;
 
 		case OBJ_Bfc:
 		{
-			LDBfc* bfc = InitObject<LDBfc> (obj);
+			LDBfc* bfc = InitObject<LDBfc>(obj);
 			int value = dlg.rb_bfcType->value();
-			if (value == qBound (0, value, int (BfcStatement::NumValues) - 1))
-				bfc->setStatement (BfcStatement (dlg.rb_bfcType->value()));
+			if (value == qBound(0, value, int(BfcStatement::NumValues) - 1))
+				bfc->setStatement(BfcStatement(dlg.rb_bfcType->value()));
 		} break;
 
 		case OBJ_SubfileReference:
@@ -364,21 +364,21 @@
 			if (name.length() == 0)
 				return; // no subfile filename
 
-			LDDocument* document = g_win->documents()->getDocumentByName (name);
+			LDDocument* document = g_win->documents()->getDocumentByName(name);
 
 			if (not document)
 			{
-				Critical (format ("Couldn't open `%1': %2", name, strerror (errno)));
+				Critical(format("Couldn't open `%1': %2", name, strerror(errno)));
 				return;
 			}
 
-			LDSubfileReference* ref = InitObject<LDSubfileReference> (obj);
+			LDSubfileReference* ref = InitObject<LDSubfileReference>(obj);
 
-			for_axes (ax)
-				ref->setCoordinate (ax, dlg.dsb_coords[ax]->value());
+			for_axes(ax)
+				ref->setCoordinate(ax, dlg.dsb_coords[ax]->value());
 
-			ref->setTransform (transform);
-			ref->setFileInfo (document);
+			ref->setTransform(transform);
+			ref->setFileInfo(document);
 		} break;
 
 		default:
@@ -386,12 +386,12 @@
 	}
 
 	if (obj->isColored())
-		obj->setColor (dlg.m_color);
+		obj->setColor(dlg.m_color);
 
 	if (newObject)
 	{
 		int idx = g_win->suggestInsertPoint();
-		g_win->currentDocument()->insertObj (idx, obj);
+		g_win->currentDocument()->insertObj(idx, obj);
 	}
 
 	g_win->refresh();
--- a/src/addObjectDialog.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/addObjectDialog.h	Thu Jan 04 19:44:26 2018 +0200
@@ -34,8 +34,8 @@
 	Q_OBJECT
 
 public:
-	AddObjectDialog (const LDObjectType type, LDObject* obj, QWidget* parent = nullptr);
-	static void staticDialog (const LDObjectType type, LDObject* obj);
+	AddObjectDialog(const LDObjectType type, LDObject* obj, QWidget* parent = nullptr);
+	static void staticDialog(const LDObjectType type, LDObject* obj);
 
 	QLabel* lb_typeIcon;
 
@@ -58,7 +58,7 @@
 	QLineEdit* le_matrix;
 
 private:
-	void setButtonBackground (QPushButton* button, LDColor color);
+	void setButtonBackground(QPushButton* button, LDColor color);
 	QString currentSubfileName();
 
 	LDColor m_color;
--- a/src/basics.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/basics.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -30,42 +30,42 @@
 Vertex::Vertex() :
 	QVector3D() {}
 
-Vertex::Vertex (const QVector3D& a) :
-	QVector3D (a) {}
+Vertex::Vertex(const QVector3D& a) :
+	QVector3D(a) {}
 
-Vertex::Vertex (qreal xpos, qreal ypos, qreal zpos) :
+Vertex::Vertex(qreal xpos, qreal ypos, qreal zpos) :
 	QVector3D(xpos, ypos, zpos) {}
 
 
-void Vertex::transform (const Matrix& matr, const Vertex& pos)
+void Vertex::transform(const Matrix& matr, const Vertex& pos)
 {
-	double x2 = (matr[0] * x()) + (matr[1] * y()) + (matr[2] * z()) + pos.x();
-	double y2 = (matr[3] * x()) + (matr[4] * y()) + (matr[5] * z()) + pos.y();
-	double z2 = (matr[6] * x()) + (matr[7] * y()) + (matr[8] * z()) + pos.z();
-	setX (x2);
-	setY (y2);
-	setZ (z2);
+	double x2 = (matr[0] * x()) +(matr[1] * y()) +(matr[2] * z()) + pos.x();
+	double y2 = (matr[3] * x()) +(matr[4] * y()) +(matr[5] * z()) + pos.y();
+	double z2 = (matr[6] * x()) +(matr[7] * y()) +(matr[8] * z()) + pos.z();
+	setX(x2);
+	setY(y2);
+	setZ(z2);
 }
 
-void Vertex::apply (ApplyFunction func)
+void Vertex::apply(ApplyFunction func)
 {
 	double newX = x(), newY = y(), newZ = z();
-	func (X, newX);
-	func (Y, newY);
-	func (Z, newZ);
-	*this = Vertex (newX, newY, newZ);
+	func(X, newX);
+	func(Y, newY);
+	func(Z, newZ);
+	*this = Vertex(newX, newY, newZ);
 }
 
-void Vertex::apply (ApplyConstFunction func) const
+void Vertex::apply(ApplyConstFunction func) const
 {
-	func (X, x());
-	func (Y, y());
-	func (Z, z());
+	func(X, x());
+	func(Y, y());
+	func(Z, z());
 }
 
-double Vertex::operator[] (Axis ax) const
+double Vertex::operator[](Axis ax) const
 {
-	switch (ax)
+	switch(ax)
 	{
 		case X: return x();
 		case Y: return y();
@@ -75,53 +75,53 @@
 	return 0.0;
 }
 
-void Vertex::setCoordinate (Axis ax, qreal value)
+void Vertex::setCoordinate(Axis ax, qreal value)
 {
-	switch (ax)
+	switch(ax)
 	{
-		case X: setX (value); break;
-		case Y: setY (value); break;
-		case Z: setZ (value); break;
+		case X: setX(value); break;
+		case Y: setY(value); break;
+		case Z: setZ(value); break;
 	}
 }
 
-QString Vertex::toString (bool mangled) const
+QString Vertex::toString(bool mangled) const
 {
 	if (mangled)
-		return format ("(%1, %2, %3)", x(), y(), z());
+		return format("(%1, %2, %3)", x(), y(), z());
 
-	return format ("%1 %2 %3", x(), y(), z());
+	return format("%1 %2 %3", x(), y(), z());
 }
 
-Vertex Vertex::operator* (qreal scalar) const
+Vertex Vertex::operator*(qreal scalar) const
 {
-	return Vertex (x() * scalar, y() * scalar, z() * scalar);
+	return Vertex(x() * scalar, y() * scalar, z() * scalar);
 }
 
 Vertex& Vertex::operator+= (const Vertex& other)
 {
-	setX (x() + other.x());
-	setY (y() + other.y());
-	setZ (z() + other.z());
+	setX(x() + other.x());
+	setY(y() + other.y());
+	setZ(z() + other.z());
 	return *this;
 }
 
-Vertex Vertex::operator+ (const Vertex& other) const
+Vertex Vertex::operator+(const Vertex& other) const
 {
-	Vertex result (*this);
+	Vertex result(*this);
 	result += other;
 	return result;
 }
 
 Vertex& Vertex::operator*= (qreal scalar)
 {
-	setX (x() * scalar);
-	setY (y() * scalar);
-	setZ (z() * scalar);
+	setX(x() * scalar);
+	setY(y() * scalar);
+	setZ(z() * scalar);
 	return *this;
 }
 
-bool Vertex::operator< (const Vertex& other) const
+bool Vertex::operator<(const Vertex& other) const
 {
 	if (x() != other.x()) return x() < other.x();
 	if (y() != other.y()) return y() < other.y();
@@ -131,7 +131,7 @@
 
 // =============================================================================
 //
-Matrix::Matrix (double vals[])
+Matrix::Matrix(double vals[])
 {
 	for (int i = 0; i < 9; ++i)
 		m_vals[i] = vals[i];
@@ -139,7 +139,7 @@
 
 // =============================================================================
 //
-Matrix::Matrix (double fillval)
+Matrix::Matrix(double fillval)
 {
 	for (int i = 0; i < 9; ++i)
 		m_vals[i] = fillval;
@@ -147,10 +147,10 @@
 
 // =============================================================================
 //
-Matrix::Matrix (const std::initializer_list<double>& vals)
+Matrix::Matrix(const std::initializer_list<double>& vals)
 {
 	if (vals.size() == 9)
-		memcpy (&m_vals[0], vals.begin(), sizeof m_vals);
+		memcpy(&m_vals[0], vals.begin(), sizeof m_vals);
 }
 
 // =============================================================================
@@ -160,9 +160,9 @@
 	for (int i = 0; i < 3; ++i)
 	{
 		for (int j = 0; j < 3; ++j)
-			print ("%1\t", m_vals[i * 3 + j]);
+			print("%1\t", m_vals[i * 3 + j]);
 
-		print ("\n");
+		print("\n");
 	}
 }
 
@@ -177,7 +177,7 @@
 		if (i > 0)
 			val += ' ';
 
-		val += QString::number (m_vals[i]);
+		val += QString::number(m_vals[i]);
 	}
 
 	return val;
@@ -187,12 +187,12 @@
 //
 void Matrix::zero()
 {
-	memset (&m_vals[0], 0, sizeof m_vals);
+	memset(&m_vals[0], 0, sizeof m_vals);
 }
 
 // =============================================================================
 //
-Matrix Matrix::mult (const Matrix& other) const
+Matrix Matrix::mult(const Matrix& other) const
 {
 	Matrix val;
 	val.zero();
@@ -209,7 +209,7 @@
 //
 Matrix& Matrix::operator= (const Matrix& other)
 {
-	memcpy (&m_vals[0], &other.m_vals[0], sizeof m_vals);
+	memcpy(&m_vals[0], &other.m_vals[0], sizeof m_vals);
 	return *this;
 }
 
@@ -217,12 +217,12 @@
 //
 double Matrix::getDeterminant() const
 {
-	return (value (0) * value (4) * value (8)) +
-		   (value (1) * value (5) * value (6)) +
-		   (value (2) * value (3) * value (7)) -
-		   (value (2) * value (4) * value (6)) -
-		   (value (1) * value (3) * value (8)) -
-		   (value (0) * value (5) * value (7));
+	return (value(0) * value(4) * value(8)) +
+		  (value(1) * value(5) * value(6)) +
+		  (value(2) * value(3) * value(7)) -
+		  (value(2) * value(4) * value(6)) -
+		  (value(1) * value(3) * value(8)) -
+		  (value(0) * value(5) * value(7));
 }
 
 // =============================================================================
@@ -231,7 +231,7 @@
 {
 	for (int i = 0; i < 9; ++i)
 	{
-		if (value (i) != other[i])
+		if (value(i) != other[i])
 			return false;
 	}
 
@@ -247,22 +247,22 @@
 
 // =============================================================================
 //
-void LDBoundingBox::calcObject (LDObject* obj)
+void LDBoundingBox::calcObject(LDObject* obj)
 {
-	switch (obj->type())
+	switch(obj->type())
 	{
 	case OBJ_Line:
 	case OBJ_Triangle:
 	case OBJ_Quad:
 	case OBJ_CondLine:
 		for (int i = 0; i < obj->numVertices(); ++i)
-			calcVertex (obj->vertex (i));
+			calcVertex(obj->vertex(i));
 		break;
 
 	case OBJ_SubfileReference:
-		for (LDObject* it : static_cast<LDSubfileReference*> (obj)->inlineContents (true, false))
+		for (LDObject* it : static_cast<LDSubfileReference*>(obj)->inlineContents(true, false))
 		{
-			calcObject (it);
+			calcObject(it);
 			it->destroy();
 		}
 		break;
@@ -274,30 +274,30 @@
 
 // =============================================================================
 //
-LDBoundingBox& LDBoundingBox::operator<< (const Vertex& v)
+LDBoundingBox& LDBoundingBox::operator<<(const Vertex& v)
 {
-	calcVertex (v);
+	calcVertex(v);
 	return *this;
 }
 
 // =============================================================================
 //
-LDBoundingBox& LDBoundingBox::operator<< (LDObject* obj)
+LDBoundingBox& LDBoundingBox::operator<<(LDObject* obj)
 {
-	calcObject (obj);
+	calcObject(obj);
 	return *this;
 }
 
 // =============================================================================
 //
-void LDBoundingBox::calcVertex (const Vertex& vertex)
+void LDBoundingBox::calcVertex(const Vertex& vertex)
 {
-	m_vertex0.setX (qMin (vertex.x(), m_vertex0.x()));
-	m_vertex0.setY (qMin (vertex.y(), m_vertex0.y()));
-	m_vertex0.setZ (qMin (vertex.z(), m_vertex0.z()));
-	m_vertex1.setX (qMax (vertex.x(), m_vertex1.x()));
-	m_vertex1.setY (qMax (vertex.y(), m_vertex1.y()));
-	m_vertex1.setZ (qMax (vertex.z(), m_vertex1.z()));
+	m_vertex0.setX(qMin(vertex.x(), m_vertex0.x()));
+	m_vertex0.setY(qMin(vertex.y(), m_vertex0.y()));
+	m_vertex0.setZ(qMin(vertex.z(), m_vertex0.z()));
+	m_vertex1.setX(qMax(vertex.x(), m_vertex1.x()));
+	m_vertex1.setY(qMax(vertex.y(), m_vertex1.y()));
+	m_vertex1.setZ(qMax(vertex.z(), m_vertex1.z()));
 	m_isEmpty = false;
 }
 
@@ -307,8 +307,8 @@
 //
 void LDBoundingBox::reset()
 {
-	m_vertex0 = Vertex (10000.0, 10000.0, 10000.0);
-	m_vertex1 = Vertex (-10000.0, -10000.0, -10000.0);
+	m_vertex0 = Vertex(10000.0, 10000.0, 10000.0);
+	m_vertex1 = Vertex(-10000.0, -10000.0, -10000.0);
 	m_isEmpty = true;
 }
 
@@ -331,8 +331,8 @@
 	else if (yscale > zscale)
 		size = yscale;
 
-	if (qAbs (size) >= 2.0)
-		return qAbs (size / 2);
+	if (qAbs(size) >= 2.0)
+		return qAbs(size / 2);
 
 	return 1.0;
 }
@@ -343,7 +343,7 @@
 //
 Vertex LDBoundingBox::center() const
 {
-	return Vertex (
+	return Vertex(
 		(m_vertex0.x() + m_vertex1.x()) / 2,
 		(m_vertex0.y() + m_vertex1.y()) / 2,
 		(m_vertex0.z() + m_vertex1.z()) / 2);
--- a/src/basics.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/basics.h	Thu Jan 04 19:44:26 2018 +0200
@@ -57,33 +57,33 @@
 class Vertex : public QVector3D
 {
 public:
-	using ApplyFunction = std::function<void (Axis, double&)>;
-	using ApplyConstFunction = std::function<void (Axis, double)>;
+	using ApplyFunction = std::function<void(Axis, double&)>;
+	using ApplyConstFunction = std::function<void(Axis, double)>;
 
 	Vertex();
-	Vertex (const QVector3D& a);
-	Vertex (qreal xpos, qreal ypos, qreal zpos);
+	Vertex(const QVector3D& a);
+	Vertex(qreal xpos, qreal ypos, qreal zpos);
 
-	void	apply (ApplyFunction func);
-	void	apply (ApplyConstFunction func) const;
-	QString	toString (bool mangled = false) const;
-	void	transform (const Matrix& matr, const Vertex& pos);
-	void	setCoordinate (Axis ax, qreal value);
+	void	apply(ApplyFunction func);
+	void	apply(ApplyConstFunction func) const;
+	QString	toString(bool mangled = false) const;
+	void	transform(const Matrix& matr, const Vertex& pos);
+	void	setCoordinate(Axis ax, qreal value);
 
 	Vertex&	operator+= (const Vertex& other);
-	Vertex	operator+ (const Vertex& other) const;
+	Vertex	operator+(const Vertex& other) const;
 	Vertex&	operator*= (qreal scalar);
-	Vertex	operator* (qreal scalar) const;
-	bool	operator< (const Vertex& other) const;
-	double	operator[] (Axis ax) const;
+	Vertex	operator*(qreal scalar) const;
+	bool	operator<(const Vertex& other) const;
+	double	operator[](Axis ax) const;
 };
 
-inline Vertex operator* (qreal scalar, const Vertex& vertex)
+inline Vertex operator*(qreal scalar, const Vertex& vertex)
 {
 	return vertex * scalar;
 }
 
-Q_DECLARE_METATYPE (Vertex)
+Q_DECLARE_METATYPE(Vertex)
 
 //
 // A mathematical 3 x 3 matrix
@@ -92,21 +92,21 @@
 {
 public:
 	Matrix() {}
-	Matrix (const std::initializer_list<double>& vals);
+	Matrix(const std::initializer_list<double>& vals);
 
 	// Constructs a matrix all 9 elements initialized to the same value.
-	Matrix (double fillval);
+	Matrix(double fillval);
 
 	// Constructs a matrix with a C-array.
 	// note: @vals is expected to have exactly 9 elements.
-	Matrix (double vals[]);
+	Matrix(double vals[]);
 
 	// Calculates the matrix's determinant.
 	double			getDeterminant() const;
 
 	// Multiplies this matrix with @other
 	// note: a.mult(b) is not equivalent to b.mult(a)!
-	Matrix			mult (const Matrix& other) const;
+	Matrix			mult(const Matrix& other) const;
 
 	// Prints the matrix to stdout.
 	void			dump() const;
@@ -121,33 +121,33 @@
 	Matrix&			operator= (const Matrix& other);
 
 	// Returns a mutable reference to a value by @idx
-	inline double& value (int idx)
+	inline double& value(int idx)
 	{
 		return m_vals[idx];
 	}
 
 	// An overload of value() for const matrices.
-	inline const double& value (int idx) const
+	inline const double& value(int idx) const
 	{
 		return m_vals[idx];
 	}
 
 	// An operator overload for mult().
-	inline Matrix operator* (const Matrix& other) const
+	inline Matrix operator*(const Matrix& other) const
 	{
-		return mult (other);
+		return mult(other);
 	}
 
 	// An operator overload for value().
-	inline double& operator[] (int idx)
+	inline double& operator[](int idx)
 	{
-		return value (idx);
+		return value(idx);
 	}
 
 	// An operator overload for value() const.
-	inline const double& operator[] (int idx) const
+	inline const double& operator[](int idx) const
 	{
-		return value (idx);
+		return value(idx);
 	}
 
 	// Checks whether the two matrices have the same values.
@@ -166,8 +166,8 @@
 public:
 	LDBoundingBox();
 
-	void calcObject (LDObject* obj);
-	void calcVertex (const Vertex& vertex);
+	void calcObject(LDObject* obj);
+	void calcVertex(const Vertex& vertex);
 	Vertex center() const;
 	bool isEmpty() const;
 	double longestMeasurement() const;
@@ -175,8 +175,8 @@
 	const Vertex& vertex0() const;
 	const Vertex& vertex1() const;
 
-	LDBoundingBox& operator<< (LDObject* obj);
-	LDBoundingBox& operator<< (const Vertex& v);
+	LDBoundingBox& operator<<(LDObject* obj);
+	LDBoundingBox& operator<<(const Vertex& v);
 
 private:
 	bool m_isEmpty;
@@ -193,44 +193,44 @@
 // =============================================================================
 // Plural expression
 template<typename T>
-static inline const char* plural (T n)
+static inline const char* plural(T n)
 {
 	return (n != 1) ? "s" : "";
 }
 
 template<typename T>
-bool isZero (T a)
+bool isZero(T a)
 {
-	return qFuzzyCompare (a + 1.0, 1.0);
+	return qFuzzyCompare(a + 1.0, 1.0);
 }
 
 template<typename T>
-bool isInteger (T a)
+bool isInteger(T a)
 {
-	return (qAbs (a - floor(a)) < 0.00001) or (qAbs (a - ceil(a)) < 0.00001);
+	return (qAbs(a - floor(a)) < 0.00001) or(qAbs(a - ceil(a)) < 0.00001);
 }
 
 template<typename T>
-void removeDuplicates (T& a)
+void removeDuplicates(T& a)
 {
-	std::sort (a.begin(), a.end());
-	a.erase (std::unique (a.begin(), a.end()), a.end());
+	std::sort(a.begin(), a.end());
+	a.erase(std::unique(a.begin(), a.end()), a.end());
 }
 
 //
 // Returns true if first arg is equal to any of the other args
 //
 template<typename T, typename Arg, typename... Args>
-bool isOneOf (T const& a, Arg const& arg, Args const&... args)
+bool isOneOf(T const& a, Arg const& arg, Args const&... args)
 {
 	if (a == arg)
 		return true;
 
-	return isOneOf (a, args...);
+	return isOneOf(a, args...);
 }
 
 template<typename T>
-bool isOneOf (T const&)
+bool isOneOf(T const&)
 {
 	return false;
 }
--- a/src/colors.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/colors.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -30,7 +30,7 @@
 
 void initColors()
 {
-	print ("Initializing color information.\n");
+	print("Initializing color information.\n");
 	static ColorData colors;
 	colorData = &colors;
 }
@@ -45,18 +45,18 @@
 
 bool LDColor::isLDConfigColor() const
 {
-	return colorData->contains (index());
+	return colorData->contains(index());
 }
 
 const ColorData::Entry& LDColor::data() const
 {
-	return colorData->get (index());
+	return colorData->get(index());
 }
 
 QString LDColor::name() const
 {
 	if (isDirect())
-		return "0x" + QString::number (index(), 16).toUpper();
+		return "0x" + QString::number(index(), 16).toUpper();
 	else if (isLDConfigColor())
 		return data().name;
 	else if (index() == -1)
@@ -75,12 +75,12 @@
 	if (isDirect())
 	{
 		QColor color;
-		color.setRed ((index() & 0x0FF0000) >> 16);
-		color.setGreen ((index() & 0x000FF00) >> 8);
-		color.setBlue (index() & 0x00000FF);
+		color.setRed((index() & 0x0FF0000) >> 16);
+		color.setGreen((index() & 0x000FF00) >> 8);
+		color.setBlue(index() & 0x00000FF);
 
 		if (index() >= 0x3000000)
-			color.setAlpha (128);
+			color.setAlpha(128);
 
 		return color;
 	}
@@ -97,7 +97,7 @@
 QColor LDColor::edgeColor() const
 {
 	if (isDirect())
-		return ::luma (faceColor()) < 48 ? Qt::white : Qt::black;
+		return ::luma(faceColor()) < 48 ? Qt::white : Qt::black;
 	else if (isLDConfigColor())
 		return data().edgeColor;
 	else
@@ -106,12 +106,12 @@
 
 int LDColor::luma() const
 {
-	return ::luma (faceColor());
+	return ::luma(faceColor());
 }
 
 int LDColor::edgeLuma() const
 {
-	return ::luma (edgeColor());
+	return ::luma(edgeColor());
 }
 
 qint32 LDColor::index() const
@@ -122,9 +122,9 @@
 QString LDColor::indexString() const
 {
 	if (isDirect())
-		return "0x" + QString::number (index(), 16).toUpper();
+		return "0x" + QString::number(index(), 16).toUpper();
 
-	return QString::number (index());
+	return QString::number(index());
 }
 
 bool LDColor::isDirect() const
@@ -132,9 +132,9 @@
 	return index() >= 0x02000000;
 }
 
-int luma (const QColor& col)
+int luma(const QColor& col)
 {
-	return (0.2126f * col.red()) + (0.7152f * col.green()) + (0.0722f * col.blue());
+	return (0.2126f * col.red()) +(0.7152f * col.green()) +(0.0722f * col.blue());
 }
 
 ColorData::ColorData()
@@ -160,15 +160,15 @@
 		colorData = nullptr;
 }
 
-bool ColorData::contains (int code) const
+bool ColorData::contains(int code) const
 {
 	return code >= 0 and code < EntryCount;
 }
 
-const ColorData::Entry& ColorData::get (int code) const
+const ColorData::Entry& ColorData::get(int code) const
 {
-	if (not contains (code))
-		throw std::runtime_error ("Attempted to get non-existant color information");
+	if (not contains(code))
+		throw std::runtime_error("Attempted to get non-existant color information");
 
 	return m_data[code];
 }
@@ -176,54 +176,54 @@
 void ColorData::loadFromLdconfig()
 {
 	QString path = LDPaths::ldConfigPath();
-	QFile fp (path);
+	QFile fp(path);
 
-	if (not fp.open (QIODevice::ReadOnly))
+	if (not fp.open(QIODevice::ReadOnly))
 	{
-		QMessageBox::critical (nullptr, "Error", "Unable to open LDConfig.ldr for parsing: " + fp.errorString());
+		QMessageBox::critical(nullptr, "Error", "Unable to open LDConfig.ldr for parsing: " + fp.errorString());
 		return;
 	}
 
 	// TODO: maybe LDConfig can be loaded as a Document? Or would that be overkill?
 	while (not fp.atEnd())
 	{
-		QString line = QString::fromUtf8 (fp.readLine());
+		QString line = QString::fromUtf8(fp.readLine());
 
 		if (line.isEmpty() or line[0] != '0')
 			continue; // empty or illogical
 
-		line.remove ('\r');
-		line.remove ('\n');
+		line.remove('\r');
+		line.remove('\n');
 
 		// Parse the line
-		LDConfigParser parser (line, ' ');
+		LDConfigParser parser(line, ' ');
 		QString name;
 		QString facename;
 		QString edgename;
 		QString codestring;
 
 		// Check 0 !COLOUR, parse the name
-		if (not parser.compareToken (0, "0") or not parser.compareToken (1, "!COLOUR") or not parser.getToken (name, 2))
+		if (not parser.compareToken(0, "0") or not parser.compareToken(1, "!COLOUR") or not parser.getToken(name, 2))
 			continue;
 
 		// Replace underscores in the name with spaces for readability
-		name.replace ("_", " ");
+		name.replace("_", " ");
 
-		if (not parser.parseTag ("CODE", codestring))
+		if (not parser.parseTag("CODE", codestring))
 			continue;
 
 		bool ok;
-		int code = codestring.toShort (&ok);
+		int code = codestring.toShort(&ok);
 
-		if (not ok or not contains (code))
+		if (not ok or not contains(code))
 			continue;
 
-		if (not parser.parseTag ("VALUE", facename) or not parser.parseTag ("EDGE", edgename))
+		if (not parser.parseTag("VALUE", facename) or not parser.parseTag("EDGE", edgename))
 			continue;
 
 		// Ensure that our colors are correct
-		QColor faceColor (facename);
-		QColor edgeColor (edgename);
+		QColor faceColor(facename);
+		QColor edgeColor(edgename);
 
 		if (not faceColor.isValid() or not edgeColor.isValid())
 			continue;
@@ -234,22 +234,22 @@
 		entry.edgeColor = edgeColor;
 		entry.hexcode = facename;
 
-		if (parser.parseTag ("ALPHA", codestring))
-			entry.faceColor.setAlpha (qBound (0, codestring.toInt(), 255));
+		if (parser.parseTag("ALPHA", codestring))
+			entry.faceColor.setAlpha(qBound(0, codestring.toInt(), 255));
 	}
 }
 
 // =============================================================================
 //
-LDConfigParser::LDConfigParser (QString inText, char sep)
+LDConfigParser::LDConfigParser(QString inText, char sep)
 {
-	m_tokens = inText.split (sep, QString::SkipEmptyParts);
+	m_tokens = inText.split(sep, QString::SkipEmptyParts);
 	m_pos = -1;
 }
 
 // =============================================================================
 //
-bool LDConfigParser::getToken (QString& val, const int pos)
+bool LDConfigParser::getToken(QString& val, const int pos)
 {
 	if (pos >= m_tokens.size())
 		return false;
@@ -260,9 +260,9 @@
 
 // =============================================================================
 //
-bool LDConfigParser::findToken (int& result, char const* needle, int args)
+bool LDConfigParser::findToken(int& result, char const* needle, int args)
 {
-	for (int i = 0; i < (m_tokens.size() - args); ++i)
+	for (int i = 0; i <(m_tokens.size() - args); ++i)
 	{
 		if (m_tokens[i] == needle)
 		{
@@ -276,11 +276,11 @@
 
 // =============================================================================
 //
-bool LDConfigParser::compareToken (int inPos, QString text)
+bool LDConfigParser::compareToken(int inPos, QString text)
 {
 	QString tok;
 
-	if (not getToken (tok, inPos))
+	if (not getToken(tok, inPos))
 		return false;
 
 	return (tok == text);
@@ -290,14 +290,14 @@
 //
 // Helper function for parseLDConfig
 //
-bool LDConfigParser::parseTag (char const* tag, QString& val)
+bool LDConfigParser::parseTag(char const* tag, QString& val)
 {
 	int pos;
 
 	// Try find the token and get its position
-	if (not findToken (pos, tag, 1))
+	if (not findToken(pos, tag, 1))
 		return false;
 
 	// Get the token after it and store it into val
-	return getToken (val, pos + 1);
+	return getToken(val, pos + 1);
 }
\ No newline at end of file
--- a/src/colors.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/colors.h	Thu Jan 04 19:44:26 2018 +0200
@@ -35,8 +35,8 @@
 	ColorData();
 	~ColorData();
 	void loadFromLdconfig();
-	bool contains (int code) const;
-	const Entry& get (int code) const;
+	bool contains(int code) const;
+	const Entry& get(int code) const;
 
 private:
 	Entry m_data[EntryCount];
@@ -45,9 +45,9 @@
 class LDColor
 {
 public:
-	LDColor() : m_index (0) {}
-	LDColor (qint32 index) : m_index (index) {}
-	LDColor (const LDColor& other) : m_index (other.m_index) {}
+	LDColor() : m_index(0) {}
+	LDColor(qint32 index) : m_index(index) {}
+	LDColor(const LDColor& other) : m_index(other.m_index) {}
 
 	bool isLDConfigColor() const;
 	bool isValid() const;
@@ -61,20 +61,20 @@
 	bool isDirect() const;
 	QString indexString() const;
 
-	static LDColor nullColor() { return LDColor (-1); }
+	static LDColor nullColor() { return LDColor(-1); }
 
 	LDColor& operator= (qint32 index) { m_index = index; return *this; }
 	LDColor& operator= (LDColor other) { m_index = other.index(); return *this; }
 	LDColor operator++() { return ++m_index; }
-	LDColor operator++ (int) { return m_index++; }
+	LDColor operator++(int) { return m_index++; }
 	LDColor operator--() { return --m_index; }
-	LDColor operator-- (int) { return m_index--; }
+	LDColor operator--(int) { return m_index--; }
 
 	bool operator== (LDColor other) const { return index() == other.index(); }
 	bool operator!= (LDColor other) const { return index() != other.index(); }
-	bool operator< (LDColor other) const { return index() < other.index(); }
+	bool operator<(LDColor other) const { return index() < other.index(); }
 	bool operator<= (LDColor other) const { return index() <= other.index(); }
-	bool operator> (LDColor other) const { return index() > other.index(); }
+	bool operator>(LDColor other) const { return index() > other.index(); }
 	bool operator>= (LDColor other) const { return index() >= other.index(); }
 
 private:
@@ -89,14 +89,14 @@
 class LDConfigParser
 {
 public:
-	LDConfigParser (QString inText, char sep);
+	LDConfigParser(QString inText, char sep);
 
-	bool getToken (QString& val, const int pos);
-	bool findToken (int& result, char const* needle, int args);
-	bool compareToken (int inPos, QString text);
-	bool parseTag (char const* tag, QString& val);
+	bool getToken(QString& val, const int pos);
+	bool findToken(int& result, char const* needle, int args);
+	bool compareToken(int inPos, QString text);
+	bool parseTag(char const* tag, QString& val);
 
-	inline QString operator[] (const int idx)
+	inline QString operator[](const int idx)
 	{
 		return m_tokens[idx];
 	}
@@ -107,7 +107,7 @@
 };
 
 void initColors();
-int luma (const QColor& col);
+int luma(const QColor& col);
 
 enum
 {
--- a/src/crashCatcher.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/crashCatcher.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -37,59 +37,59 @@
 	struct sigaction sighandler;
 	sighandler.sa_handler = SIG_DFL;
 	sighandler.sa_flags = 0;
-	sigaction (SIGABRT, &sighandler, 0);
+	sigaction(SIGABRT, &sighandler, 0);
 	abort();
 }
 
 
-static void handleCrash (int sig)
+static void handleCrash(int sig)
 {
 	static bool isActive = false;
-	printf ("!! Caught signal %d, launching gdb\n", sig);
+	printf("!! Caught signal %d, launching gdb\n", sig);
 
 	if (isActive)
 	{
-		printf ("Caught signal while crash catcher is active! Execution cannot continue.\n");
+		printf("Caught signal while crash catcher is active! Execution cannot continue.\n");
 		finalAbort();
 	}
 
-	pid_t const pid (getpid());
+	pid_t const pid(getpid());
 	QProcess proc;
 	QTemporaryFile commandsFile;
 	isActive = true;
 
 	if (commandsFile.open())
 	{
-		commandsFile.write (format ("attach %1\n", pid).toLocal8Bit());
-		commandsFile.write (QString ("backtrace full\n").toLocal8Bit());
-		commandsFile.write (QString ("detach\n").toLocal8Bit());
-		commandsFile.write (QString ("quit").toLocal8Bit());
+		commandsFile.write(format("attach %1\n", pid).toLocal8Bit());
+		commandsFile.write(QString("backtrace full\n").toLocal8Bit());
+		commandsFile.write(QString("detach\n").toLocal8Bit());
+		commandsFile.write(QString("quit").toLocal8Bit());
 		commandsFile.close();
 	}
 
-	proc.start ("gdb", {"-x", commandsFile.fileName()});
+	proc.start("gdb", {"-x", commandsFile.fileName()});
 
 	// Linux doesn't allow ptrace to be used on anything but direct child processes
 	// so we need to use prctl to register an exception to this to allow GDB attach to us.
 	// We need to do this now and no earlier because only now we actually know GDB's PID.
 #ifdef Q_OS_LINUX
-	prctl (PR_SET_PTRACER, proc.pid(), 0, 0, 0);
+	prctl(PR_SET_PTRACER, proc.pid(), 0, 0, 0);
 #endif
 
-	proc.waitForFinished (1000);
-	QString output (proc.readAllStandardOutput());
-	QString err (proc.readAllStandardError());
-	QFile f (UNIXNAME "-crash.log");
+	proc.waitForFinished(1000);
+	QString output(proc.readAllStandardOutput());
+	QString err(proc.readAllStandardError());
+	QFile f(UNIXNAME "-crash.log");
 
-	if (f.open (QIODevice::WriteOnly))
+	if (f.open(QIODevice::WriteOnly))
 	{
-		fprint (f, format ("=== Program crashed with signal %1 ===\n\n"
+		fprint(f, format("=== Program crashed with signal %1 ===\n\n"
 			"GDB stdout:\n%3\nGDB stderr:\n%4\n", sig,
 			output, err));
 		f.close();
 	}
 
-	printf ("Backtrace written to " UNIXNAME "-crash.log. Aborting.\n");
+	printf("Backtrace written to " UNIXNAME "-crash.log. Aborting.\n");
 	finalAbort();
 }
 
@@ -100,22 +100,22 @@
 	static const int signalsToCatch[] = {
 		SIGSEGV, // segmentation fault
 		SIGABRT, // abort() calls
-		SIGFPE, // floating point exceptions (e.g. division by zero)
+		SIGFPE, // floating point exceptions(e.g. division by zero)
 		SIGILL, // illegal instructions
 	};
 
 	struct sigaction sighandler;
 	sighandler.sa_handler = &handleCrash;
 	sighandler.sa_flags = 0;
-	sigemptyset (&sighandler.sa_mask);
+	sigemptyset(&sighandler.sa_mask);
 
 	for (int sig : signalsToCatch)
 	{
-		if (sigaction (sig, &sighandler, nullptr) == -1)
-			fprint (stderr, "Couldn't set signal handler %1: %2", sig, strerror (errno));
+		if (sigaction(sig, &sighandler, nullptr) == -1)
+			fprint(stderr, "Couldn't set signal handler %1: %2", sig, strerror(errno));
 	}
 
-	print ("Crash catcher hooked to signals: %1\n", signalsToCatch);
+	print("Crash catcher hooked to signals: %1\n", signalsToCatch);
 }
 
 #endif // Q_OS_UNIX
\ No newline at end of file
--- a/src/dialogs.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -45,10 +45,10 @@
 
 // =============================================================================
 // =============================================================================
-OverlayDialog::OverlayDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f)
+OverlayDialog::OverlayDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
 {
 	ui = new Ui_OverlayUI;
-	ui->setupUi (this);
+	ui->setupUi(this);
 
 	m_cameraArgs =
 	{
@@ -65,13 +65,13 @@
 	if (cam == EFreeCamera)
 		cam = ETopCamera;
 
-	connect (ui->width, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
-	connect (ui->height, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
-	connect (ui->buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_help()));
-	connect (ui->fileSearchButton, SIGNAL (clicked (bool)), this, SLOT (slot_fpath()));
+	connect(ui->width, SIGNAL(valueChanged(double)), this, SLOT(slot_dimensionsChanged()));
+	connect(ui->height, SIGNAL(valueChanged(double)), this, SLOT(slot_dimensionsChanged()));
+	connect(ui->buttonBox, SIGNAL(helpRequested()), this, SLOT(slot_help()));
+	connect(ui->fileSearchButton, SIGNAL(clicked(bool)), this, SLOT(slot_fpath()));
 
 	slot_dimensionsChanged();
-	fillDefaults (cam);
+	fillDefaults(cam);
 }
 
 // =============================================================================
@@ -83,26 +83,26 @@
 
 // =============================================================================
 // =============================================================================
-void OverlayDialog::fillDefaults (int newcam)
+void OverlayDialog::fillDefaults(int newcam)
 {
-	LDGLOverlay& info = g_win->renderer()->getOverlay (newcam);
-	RadioDefault<int> (newcam, m_cameraArgs);
+	LDGLOverlay& info = g_win->renderer()->getOverlay(newcam);
+	RadioDefault<int>(newcam, m_cameraArgs);
 
 	if (info.img)
 	{
-		ui->filename->setText (info.fname);
-		ui->originX->setValue (info.ox);
-		ui->originY->setValue (info.oy);
-		ui->width->setValue (info.lw);
-		ui->height->setValue (info.lh);
+		ui->filename->setText(info.fname);
+		ui->originX->setValue(info.ox);
+		ui->originY->setValue(info.oy);
+		ui->width->setValue(info.lw);
+		ui->height->setValue(info.lh);
 	}
 	else
 	{
-		ui->filename->setText ("");
-		ui->originX->setValue (0);
-		ui->originY->setValue (0);
-		ui->width->setValue (0.0f);
-		ui->height->setValue (0.0f);
+		ui->filename->setText("");
+		ui->originX->setValue(0);
+		ui->originY->setValue(0);
+		ui->width->setValue(0.0f);
+		ui->height->setValue(0.0f);
 	}
 }
 
@@ -135,36 +135,36 @@
 
 int OverlayDialog::camera() const
 {
-	return RadioSwitch<int> (ETopCamera, m_cameraArgs);
+	return RadioSwitch<int>(ETopCamera, m_cameraArgs);
 }
 
 void OverlayDialog::slot_fpath()
 {
-	ui->filename->setText (QFileDialog::getOpenFileName (nullptr, "Overlay image"));
+	ui->filename->setText(QFileDialog::getOpenFileName(nullptr, "Overlay image"));
 }
 
 void OverlayDialog::slot_help()
 {
-	showDocumentation (g_docs_overlays);
+	showDocumentation(g_docs_overlays);
 }
 
 void OverlayDialog::slot_dimensionsChanged()
 {
-	bool enable = (ui->width->value() != 0) or (ui->height->value() != 0);
-	ui->buttonBox->button (QDialogButtonBox::Ok)->setEnabled (enable);
+	bool enable = (ui->width->value() != 0) or(ui->height->value() != 0);
+	ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
 }
 
 // =============================================================================
 // =============================================================================
-ExtProgPathPrompt::ExtProgPathPrompt (QString progName, QWidget* parent, Qt::WindowFlags f) :
-	QDialog (parent, f),
-	ui (new Ui_ExtProgPath)
+ExtProgPathPrompt::ExtProgPathPrompt(QString progName, QWidget* parent, Qt::WindowFlags f) :
+	QDialog(parent, f),
+	ui(new Ui_ExtProgPath)
 {
-	ui->setupUi (this);
+	ui->setupUi(this);
 	QString labelText = ui->m_label->text();
-	labelText.replace ("<PROGRAM>", progName);
-	ui->m_label->setText (labelText);
-	connect (ui->m_findPath, SIGNAL (clicked (bool)), this, SLOT (findPath()));
+	labelText.replace("<PROGRAM>", progName);
+	ui->m_label->setText(labelText);
+	connect(ui->m_findPath, SIGNAL(clicked(bool)), this, SLOT(findPath()));
 }
 
 // =============================================================================
@@ -178,10 +178,10 @@
 // =============================================================================
 void ExtProgPathPrompt::findPath()
 {
-	QString path = QFileDialog::getOpenFileName (nullptr, "", "", g_extProgPathFilter);
+	QString path = QFileDialog::getOpenFileName(nullptr, "", "", g_extProgPathFilter);
 
 	if (not path.isEmpty())
-		ui->m_path->setText (path);
+		ui->m_path->setText(path);
 }
 
 // =============================================================================
@@ -193,25 +193,25 @@
 
 // =============================================================================
 // =============================================================================
-AboutDialog::AboutDialog (QWidget* parent, Qt::WindowFlags f) :
-	QDialog (parent, f)
+AboutDialog::AboutDialog(QWidget* parent, Qt::WindowFlags f) :
+	QDialog(parent, f)
 {
 	Ui::AboutUI ui;
-	ui.setupUi (this);
-	ui.versionInfo->setText (APPNAME " " + QString (fullVersionString()));
+	ui.setupUi(this);
+	ui.versionInfo->setText(APPNAME " " + QString(fullVersionString()));
 
 	QPushButton* mailButton = new QPushButton;
-	mailButton->setText (tr ("Contact"));
-	mailButton->setIcon (GetIcon ("mail"));
-	ui.buttonBox->addButton (static_cast<QAbstractButton*> (mailButton), QDialogButtonBox::HelpRole);
-	connect (ui.buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_mail()));
+	mailButton->setText(tr("Contact"));
+	mailButton->setIcon(GetIcon("mail"));
+	ui.buttonBox->addButton(static_cast<QAbstractButton*>(mailButton), QDialogButtonBox::HelpRole);
+	connect(ui.buttonBox, SIGNAL(helpRequested()), this, SLOT(slot_mail()));
 
-	setWindowTitle (format (tr ("About %1"), APPNAME));
+	setWindowTitle(format(tr("About %1"), APPNAME));
 }
 
 // =============================================================================
 // =============================================================================
 void AboutDialog::slot_mail()
 {
-	QDesktopServices::openUrl (QUrl ("mailto:Teemu Piippo <arezey@gmail.com>?subject=LDForge"));
+	QDesktopServices::openUrl(QUrl("mailto:Teemu Piippo <arezey@gmail.com>?subject=LDForge"));
 }
--- a/src/dialogs.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs.h	Thu Jan 04 19:44:26 2018 +0200
@@ -43,7 +43,7 @@
 	Q_OBJECT
 
 public:
-	explicit OverlayDialog (QWidget* parent = nullptr, Qt::WindowFlags f = 0);
+	explicit OverlayDialog(QWidget* parent = nullptr, Qt::WindowFlags f = 0);
 	virtual ~OverlayDialog();
 
 	QString         fpath() const;
@@ -61,7 +61,7 @@
 	void slot_fpath();
 	void slot_help();
 	void slot_dimensionsChanged();
-	void fillDefaults (int newcam);
+	void fillDefaults(int newcam);
 };
 
 // =============================================================================
@@ -70,7 +70,7 @@
 	Q_OBJECT
 
 public:
-	explicit ExtProgPathPrompt (QString progName, QWidget* parent = 0, Qt::WindowFlags f = 0);
+	explicit ExtProgPathPrompt(QString progName, QWidget* parent = 0, Qt::WindowFlags f = 0);
 	virtual ~ExtProgPathPrompt();
 	QString getPath() const;
 
@@ -87,7 +87,7 @@
 	Q_OBJECT
 
 public:
-	AboutDialog (QWidget* parent = nullptr, Qt::WindowFlags f = 0);
+	AboutDialog(QWidget* parent = nullptr, Qt::WindowFlags f = 0);
 
 private slots:
 	void slot_mail();
--- a/src/dialogs/colorselector.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/colorselector.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -31,65 +31,65 @@
 
 enum { NUM_COLUMNS = 16 };
 
-ColorSelector::ColorSelector (QWidget* parent, LDColor defaultvalue) :
-	QDialog (parent),
-	HierarchyElement (parent),
-	ui (*new Ui_ColorSelUi),
-	m_selection (defaultvalue)
+ColorSelector::ColorSelector(QWidget* parent, LDColor defaultvalue) :
+	QDialog(parent),
+	HierarchyElement(parent),
+	ui(*new Ui_ColorSelUi),
+	m_selection(defaultvalue)
 {
 	m_firstResize = true;
-	ui.setupUi (this);
+	ui.setupUi(this);
 
-	QGridLayout* layout = new QGridLayout (this);
+	QGridLayout* layout = new QGridLayout(this);
 
 	// Spawn color selector buttons
 	for (LDColor ldcolor; ldcolor.isLDConfigColor(); ++ldcolor)
 	{
-		QPushButton* button = new QPushButton (this);
-		button->setMinimumSize (QSize (32, 32));
-		button->setMaximumSize (button->minimumSize());
+		QPushButton* button = new QPushButton(this);
+		button->setMinimumSize(QSize(32, 32));
+		button->setMaximumSize(button->minimumSize());
 
-		if (ldcolor.isValid ())
+		if (ldcolor.isValid())
 		{
-			QColor color (ldcolor.faceColor());
+			QColor color(ldcolor.faceColor());
 
 			if (ldcolor == MainColor)
 			{
-				color = QColor (config.mainColor());
-				color.setAlphaF (config.mainColorAlpha());
+				color = QColor(config.mainColor());
+				color.setAlphaF(config.mainColorAlpha());
 			}
 
-			QString color2name (luma (color) < 80 ? "white" : "black");
-			button->setAutoFillBackground (true);
-			button->setStyleSheet (format ("background-color: rgba(%1, %2, %3, %4); color: %5",
+			QString color2name(luma(color) < 80 ? "white" : "black");
+			button->setAutoFillBackground(true);
+			button->setStyleSheet(format("background-color: rgba(%1, %2, %3, %4); color: %5",
 				color.red(), color.green(), color.blue(), color.alpha(), color2name));
-			button->setCheckable (true);
-			button->setText (QString::number (ldcolor.index()));
-			button->setToolTip (format ("%1: %2", ldcolor.index(), ldcolor.name()));
+			button->setCheckable(true);
+			button->setText(QString::number(ldcolor.index()));
+			button->setToolTip(format("%1: %2", ldcolor.index(), ldcolor.name()));
 			m_buttons[ldcolor.index()] = button;
 			m_buttonsReversed[button] = ldcolor.index();
-			connect (button, SIGNAL (clicked(bool)), this, SLOT (colorButtonClicked()));
+			connect(button, SIGNAL(clicked(bool)), this, SLOT(colorButtonClicked()));
 
 			if (ldcolor == selection())
-				button->setChecked (true);
+				button->setChecked(true);
 		}
 		else
 		{
-			button->setEnabled (false);
+			button->setEnabled(false);
 		}
 
-		layout->addWidget (button, ldcolor.index() / NUM_COLUMNS, ldcolor.index() % NUM_COLUMNS);
+		layout->addWidget(button, ldcolor.index() / NUM_COLUMNS, ldcolor.index() % NUM_COLUMNS);
 	}
 
 	QWidget* widget = new QWidget();
-	widget->setLayout (layout);
-	ui.definedColors->setWidget (widget);
-	connect (ui.directColor, SIGNAL (clicked (bool)), this, SLOT (chooseDirectColor()));
+	widget->setLayout(layout);
+	ui.definedColors->setWidget(widget);
+	connect(ui.directColor, SIGNAL(clicked(bool)), this, SLOT(chooseDirectColor()));
 
-	ui.definedColors->setMinimumWidth (ui.definedColors->widget()->width() + 16);
+	ui.definedColors->setMinimumWidth(ui.definedColors->widget()->width() + 16);
 
 #ifdef TRANSPARENT_DIRECT_COLORS
-	connect (ui.transparentDirectColor, SIGNAL (clicked (bool)), this, SLOT (transparentCheckboxClicked()));
+	connect(ui.transparentDirectColor, SIGNAL(clicked(bool)), this, SLOT(transparentCheckboxClicked()));
 #else
 	ui.transparentDirectColor->hide();
 #endif
@@ -104,27 +104,27 @@
 
 void ColorSelector::colorButtonClicked()
 {
-	QPushButton* button = qobject_cast<QPushButton*> (sender());
-	auto it = m_buttonsReversed.find (button);
+	QPushButton* button = qobject_cast<QPushButton*>(sender());
+	auto it = m_buttonsReversed.find(button);
 	LDColor color;
 
-	if (Q_UNLIKELY (button == nullptr or it == m_buttonsReversed.end()
-		or not (color = *it).isValid()))
+	if (Q_UNLIKELY(button == nullptr or it == m_buttonsReversed.end()
+		or not(color = *it).isValid()))
 	{
-		print ("colorButtonClicked() called with invalid sender");
+		print("colorButtonClicked() called with invalid sender");
 		return;
 	}
 
 	if (selection().isValid())
 	{
-		auto button = m_buttons.find (selection().index());
+		auto button = m_buttons.find(selection().index());
 
 		if (button != m_buttons.end())
-			(*button)->setChecked (false);
+			(*button)->setChecked(false);
 	}
 
 	m_selection = color;
-	button->setChecked (true);
+	button->setChecked(true);
 	drawColorInfo();
 }
 
@@ -132,29 +132,29 @@
 {
 	if (not selection().isValid())
 	{
-		ui.colorLabel->setText ("---");
-		ui.iconLabel->setPixmap (QPixmap());
-		ui.transparentDirectColor->setChecked (false);
+		ui.colorLabel->setText("---");
+		ui.iconLabel->setPixmap(QPixmap());
+		ui.transparentDirectColor->setChecked(false);
 		return;
 	}
 
-	ui.colorLabel->setText (format ("%1 - %2", selection().indexString(),
+	ui.colorLabel->setText(format("%1 - %2", selection().indexString(),
 		(selection().isDirect() ? "<direct color>" : selection().name())));
-	ui.iconLabel->setPixmap (guiUtilities()->makeColorIcon (selection(), 16).pixmap (16, 16));
+	ui.iconLabel->setPixmap(guiUtilities()->makeColorIcon(selection(), 16).pixmap(16, 16));
 
 #ifdef TRANSPARENT_DIRECT_COLORS
-	ui.transparentDirectColor->setEnabled (selection().isDirect());
-	ui.transparentDirectColor->setChecked (selection().isDirect() and selection().faceColor().alphaF() < 1.0);
+	ui.transparentDirectColor->setEnabled(selection().isDirect());
+	ui.transparentDirectColor->setChecked(selection().isDirect() and selection().faceColor().alphaF() < 1.0);
 #else
-	ui.transparentDirectColor->setChecked (false);
-	ui.transparentDirectColor->setEnabled (false);
+	ui.transparentDirectColor->setChecked(false);
+	ui.transparentDirectColor->setEnabled(false);
 #endif
 }
 
-void ColorSelector::selectDirectColor (QColor color)
+void ColorSelector::selectDirectColor(QColor color)
 {
 	qint32 colorIndex = (ui.transparentDirectColor->isChecked() ? 0x03000000 : 0x02000000);
-	colorIndex |= (color.red() << 16) | (color.green() << 8) | (color.blue());
+	colorIndex |= (color.red() << 16) |(color.green() << 8) |(color.blue());
 	m_selection = colorIndex;
 	drawColorInfo();
 }
@@ -162,23 +162,23 @@
 void ColorSelector::chooseDirectColor()
 {
 	QColor defcolor = selection() != -1 ? selection().faceColor() : Qt::white;
-	QColor newcolor = QColorDialog::getColor (defcolor);
+	QColor newcolor = QColorDialog::getColor(defcolor);
 
 	if (not newcolor.isValid())
 		return; // canceled
 
-	selectDirectColor (newcolor);
+	selectDirectColor(newcolor);
 }
 
 void ColorSelector::transparentCheckboxClicked()
 {
 	if (selection().isDirect())
-		selectDirectColor (selection().faceColor());
+		selectDirectColor(selection().faceColor());
 }
 
-bool ColorSelector::selectColor (QWidget* parent, LDColor& val, LDColor defaultvalue)
+bool ColorSelector::selectColor(QWidget* parent, LDColor& val, LDColor defaultvalue)
 {
-	ColorSelector dlg (parent, defaultvalue);
+	ColorSelector dlg(parent, defaultvalue);
 
 	if (dlg.exec() and dlg.selection().isValid())
 	{
--- a/src/dialogs/colorselector.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/colorselector.h	Thu Jan 04 19:44:26 2018 +0200
@@ -26,9 +26,9 @@
 	Q_OBJECT
 
 public:
-	explicit ColorSelector (QWidget* parent, LDColor defaultvalue = LDColor::nullColor());
+	explicit ColorSelector(QWidget* parent, LDColor defaultvalue = LDColor::nullColor());
 	virtual ~ColorSelector();
-	static bool selectColor (QWidget* parent, LDColor& val, LDColor defval = LDColor::nullColor());
+	static bool selectColor(QWidget* parent, LDColor& val, LDColor defval = LDColor::nullColor());
 	LDColor selection() const;
 
 private:
@@ -39,7 +39,7 @@
 	LDColor m_selection;
 
 	void drawColorInfo();
-	void selectDirectColor (QColor col);
+	void selectDirectColor(QColor col);
 
 private slots:
 	void colorButtonClicked();
--- a/src/dialogs/configdialog.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/configdialog.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -43,19 +43,19 @@
 
 const char* g_extProgPathFilter =
 #ifdef _WIN32
-	"Applications (*.exe)(*.exe);;"
+	"Applications(*.exe)(*.exe);;"
 #endif
-	"All files (*.*)(*.*)";
+	"All files(*.*)(*.*)";
 
-ShortcutListItem::ShortcutListItem (QListWidget* view, int type) :
-	QListWidgetItem (view, type) {}
+ShortcutListItem::ShortcutListItem(QListWidget* view, int type) :
+	QListWidgetItem(view, type) {}
 
 QAction* ShortcutListItem::action() const
 {
 	return m_action;
 }
 
-void ShortcutListItem::setAction (QAction* action)
+void ShortcutListItem::setAction(QAction* action)
 {
 	m_action = action;
 }
@@ -65,24 +65,24 @@
 	return m_sequence;
 }
 
-void ShortcutListItem::setSequence (const QKeySequence& sequence)
+void ShortcutListItem::setSequence(const QKeySequence& sequence)
 {
 	m_sequence = sequence;
 }
 
-ConfigDialog::ConfigDialog (QWidget* parent, ConfigDialog::Tab defaulttab, Qt::WindowFlags f) :
-	QDialog (parent, f),
-	HierarchyElement (parent),
-	ui (*new Ui_ConfigDialog),
-	m_settings (makeSettings (this))
+ConfigDialog::ConfigDialog(QWidget* parent, ConfigDialog::Tab defaulttab, Qt::WindowFlags f) :
+	QDialog(parent, f),
+	HierarchyElement(parent),
+	ui(*new Ui_ConfigDialog),
+	m_settings(makeSettings(this))
 {
-	ui.setupUi (this);
+	ui.setupUi(this);
 
 	// Set defaults
-	applyToWidgetOptions (
+	applyToWidgetOptions(
 	[&](QWidget* widget, QString confname)
 	{
-		QVariant value = m_settings->value (confname, config.defaultValueByName (confname));
+		QVariant value = m_settings->value(confname, config.defaultValueByName(confname));
 		QLineEdit* le;
 		QSpinBox* spinbox;
 		QDoubleSpinBox* doublespinbox;
@@ -90,63 +90,63 @@
 		QCheckBox* checkbox;
 		QPushButton* button;
 
-		if ((le = qobject_cast<QLineEdit*> (widget)))
+		if ((le = qobject_cast<QLineEdit*>(widget)))
 		{
-			le->setText (value.toString());
+			le->setText(value.toString());
 		}
-		else if ((spinbox = qobject_cast<QSpinBox*> (widget)))
+		else if ((spinbox = qobject_cast<QSpinBox*>(widget)))
 		{
-			spinbox->setValue (value.toInt());
+			spinbox->setValue(value.toInt());
 		}
-		else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)))
+		else if ((doublespinbox = qobject_cast<QDoubleSpinBox*>(widget)))
 		{
-			doublespinbox->setValue (value.toDouble());
+			doublespinbox->setValue(value.toDouble());
 		}
-		else if ((slider = qobject_cast<QSlider*> (widget)))
+		else if ((slider = qobject_cast<QSlider*>(widget)))
 		{
-			slider->setValue (value.toInt());
+			slider->setValue(value.toInt());
 		}
-		else if ((checkbox = qobject_cast<QCheckBox*> (widget)))
+		else if ((checkbox = qobject_cast<QCheckBox*>(widget)))
 		{
-			checkbox->setChecked (value.toBool());
+			checkbox->setChecked(value.toBool());
 		}
-		else if ((button = qobject_cast<QPushButton*> (widget)))
+		else if ((button = qobject_cast<QPushButton*>(widget)))
 		{
-			setButtonBackground (button, value.toString());
-			connect (button, SIGNAL (clicked()), this, SLOT (setButtonColor()));
+			setButtonBackground(button, value.toString());
+			connect(button, SIGNAL(clicked()), this, SLOT(setButtonColor()));
 		}
 		else
 		{
-			print ("Unknown widget of type %1\n", widget->metaObject()->className());
+			print("Unknown widget of type %1\n", widget->metaObject()->className());
 		}
 	});
 
-	m_window->applyToActions ([&](QAction* act)
+	m_window->applyToActions([&](QAction* act)
 	{
-		addShortcut (act);
+		addShortcut(act);
 	});
 
-	ui.shortcutsList->setSortingEnabled (true);
+	ui.shortcutsList->setSortingEnabled(true);
 	ui.shortcutsList->sortItems();
 	quickColors = LoadQuickColorList();
 	updateQuickColorList();
 	initExtProgs();
-	selectPage (defaulttab);
-	connect (ui.shortcut_set, SIGNAL (clicked()), this, SLOT (slot_setShortcut()));
-	connect (ui.shortcut_reset, SIGNAL (clicked()), this, SLOT (slot_resetShortcut()));
-	connect (ui.shortcut_clear, SIGNAL (clicked()), this, SLOT (slot_clearShortcut()));
-	connect (ui.quickColor_add, SIGNAL (clicked()), this, SLOT (slot_setColor()));
-	connect (ui.quickColor_remove, SIGNAL (clicked()), this, SLOT (slot_delColor()));
-	connect (ui.quickColor_edit, SIGNAL (clicked()), this, SLOT (slot_setColor()));
-	connect (ui.quickColor_addSep, SIGNAL (clicked()), this, SLOT (slot_addColorSeparator()));
-	connect (ui.quickColor_moveUp, SIGNAL (clicked()), this, SLOT (slot_moveColor()));
-	connect (ui.quickColor_moveDown, SIGNAL (clicked()), this, SLOT (slot_moveColor()));
-	connect (ui.quickColor_clear, SIGNAL (clicked()), this, SLOT (slot_clearColors()));
-	connect (ui.findDownloadPath, SIGNAL (clicked (bool)), this, SLOT (slot_findDownloadFolder()));
-	connect (ui.buttonBox, SIGNAL (clicked (QAbstractButton*)),
-		this, SLOT (buttonClicked (QAbstractButton*)));
-	connect (ui.m_pages, SIGNAL (currentChanged (int)), this, SLOT (selectPage (int)));
-	connect (ui.m_pagelist, SIGNAL (currentRowChanged (int)), this, SLOT (selectPage (int)));
+	selectPage(defaulttab);
+	connect(ui.shortcut_set, SIGNAL(clicked()), this, SLOT(slot_setShortcut()));
+	connect(ui.shortcut_reset, SIGNAL(clicked()), this, SLOT(slot_resetShortcut()));
+	connect(ui.shortcut_clear, SIGNAL(clicked()), this, SLOT(slot_clearShortcut()));
+	connect(ui.quickColor_add, SIGNAL(clicked()), this, SLOT(slot_setColor()));
+	connect(ui.quickColor_remove, SIGNAL(clicked()), this, SLOT(slot_delColor()));
+	connect(ui.quickColor_edit, SIGNAL(clicked()), this, SLOT(slot_setColor()));
+	connect(ui.quickColor_addSep, SIGNAL(clicked()), this, SLOT(slot_addColorSeparator()));
+	connect(ui.quickColor_moveUp, SIGNAL(clicked()), this, SLOT(slot_moveColor()));
+	connect(ui.quickColor_moveDown, SIGNAL(clicked()), this, SLOT(slot_moveColor()));
+	connect(ui.quickColor_clear, SIGNAL(clicked()), this, SLOT(slot_clearColors()));
+	connect(ui.findDownloadPath, SIGNAL(clicked(bool)), this, SLOT(slot_findDownloadFolder()));
+	connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)),
+		this, SLOT(buttonClicked(QAbstractButton*)));
+	connect(ui.m_pages, SIGNAL(currentChanged(int)), this, SLOT(selectPage(int)));
+	connect(ui.m_pagelist, SIGNAL(currentRowChanged(int)), this, SLOT(selectPage(int)));
 }
 
 ConfigDialog::~ConfigDialog()
@@ -154,29 +154,29 @@
 	delete &ui;
 }
 
-void ConfigDialog::selectPage (int row)
+void ConfigDialog::selectPage(int row)
 {
-	ui.m_pagelist->setCurrentRow (row);
-	ui.m_pages->setCurrentIndex (row);
+	ui.m_pagelist->setCurrentRow(row);
+	ui.m_pages->setCurrentIndex(row);
 }
 
 //
 // Adds a shortcut entry to the list of shortcuts.
 //
-void ConfigDialog::addShortcut (QAction* act)
+void ConfigDialog::addShortcut(QAction* act)
 {
 	ShortcutListItem* item = new ShortcutListItem;
-	item->setIcon (act->icon());
-	item->setAction (act);
-	item->setSequence (act->shortcut());
-	setShortcutText (item);
+	item->setIcon(act->icon());
+	item->setAction(act);
+	item->setSequence(act->shortcut());
+	setShortcutText(item);
 
 	// If the action doesn't have a valid icon, use an empty one
 	// so that the list is kept aligned.
 	if (act->icon().isNull())
-		item->setIcon (GetIcon ("empty"));
+		item->setIcon(GetIcon("empty"));
 
-	ui.shortcutsList->insertItem (ui.shortcutsList->count(), item);
+	ui.shortcutsList->insertItem(ui.shortcutsList->count(), item);
 }
 
 //
@@ -191,51 +191,51 @@
 	{
 		ExtProgramType program = (ExtProgramType) i;
 		ExternalProgramWidgets& widgets = m_externalProgramWidgets[i];
-		QString name = m_window->externalPrograms()->externalProgramName (program);
+		QString name = m_window->externalPrograms()->externalProgramName(program);
 		QLabel* icon = new QLabel;
-		QLabel* progLabel = new QLabel (name);
+		QLabel* progLabel = new QLabel(name);
 		QLineEdit* input = new QLineEdit;
 		QPushButton* setPathButton = new QPushButton;
 
-		icon->setPixmap (GetIcon (name.toLower()));
-		input->setText (m_window->externalPrograms()->getPathSetting (program));
-		setPathButton->setIcon (GetIcon ("folder"));
+		icon->setPixmap(GetIcon(name.toLower()));
+		input->setText(m_window->externalPrograms()->getPathSetting(program));
+		setPathButton->setIcon(GetIcon("folder"));
 		widgets.input = input;
 		widgets.setPathButton = setPathButton;
 		widgets.wineBox = nullptr;
-		connect (setPathButton, SIGNAL (clicked()), this, SLOT (slot_setExtProgPath()));
-		pathsLayout->addWidget (icon, row, 0);
-		pathsLayout->addWidget (progLabel, row, 1);
-		pathsLayout->addWidget (input, row, 2);
-		pathsLayout->addWidget (setPathButton, row, 3);
+		connect(setPathButton, SIGNAL(clicked()), this, SLOT(slot_setExtProgPath()));
+		pathsLayout->addWidget(icon, row, 0);
+		pathsLayout->addWidget(progLabel, row, 1);
+		pathsLayout->addWidget(input, row, 2);
+		pathsLayout->addWidget(setPathButton, row, 3);
 
 #ifdef Q_OS_UNIX
 		{
-			QCheckBox* wineBox = new QCheckBox ("Wine");
-			wineBox->setChecked (m_window->externalPrograms()->programUsesWine (program));
+			QCheckBox* wineBox = new QCheckBox("Wine");
+			wineBox->setChecked(m_window->externalPrograms()->programUsesWine(program));
 			widgets.wineBox = wineBox;
-			pathsLayout->addWidget (wineBox, row, 4);
+			pathsLayout->addWidget(wineBox, row, 4);
 		}
 #endif
 		++row;
 	}
-	ui.extProgs->setLayout (pathsLayout);
+	ui.extProgs->setLayout(pathsLayout);
 }
 
-void ConfigDialog::applyToWidgetOptions (std::function<void (QWidget*, QString)> func)
+void ConfigDialog::applyToWidgetOptions(std::function<void(QWidget*, QString)> func)
 {
 	// Apply configuration
 	for (QWidget* widget : findChildren<QWidget*>())
 	{
-		if (not widget->objectName().startsWith ("config"))
+		if (not widget->objectName().startsWith("config"))
 			continue;
 
-		QString optionname (widget->objectName().mid (strlen ("config")));
+		QString optionname(widget->objectName().mid(strlen("config")));
 
-		if (config.existsEntry (optionname))
-			func (widget, optionname);
+		if (config.existsEntry(optionname))
+			func(widget, optionname);
 		else
-			print ("Couldn't find configuration entry named %1", optionname);
+			print("Couldn't find configuration entry named %1", optionname);
 	}
 }
 
@@ -244,7 +244,7 @@
 //
 void ConfigDialog::applySettings()
 {
-	applyToWidgetOptions ([&](QWidget* widget, QString confname)
+	applyToWidgetOptions([&](QWidget* widget, QString confname)
 	{
 		QVariant value;
 		QLineEdit* le;
@@ -254,30 +254,30 @@
 		QCheckBox* checkbox;
 		QPushButton* button;
 
-		if ((le = qobject_cast<QLineEdit*> (widget)))
+		if ((le = qobject_cast<QLineEdit*>(widget)))
 			value = le->text();
-		else if ((spinbox = qobject_cast<QSpinBox*> (widget)))
+		else if ((spinbox = qobject_cast<QSpinBox*>(widget)))
 			value = spinbox->value();
-		else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)))
+		else if ((doublespinbox = qobject_cast<QDoubleSpinBox*>(widget)))
 			value = doublespinbox->value();
-		else if ((slider = qobject_cast<QSlider*> (widget)))
+		else if ((slider = qobject_cast<QSlider*>(widget)))
 			value = slider->value();
-		else if ((checkbox = qobject_cast<QCheckBox*> (widget)))
+		else if ((checkbox = qobject_cast<QCheckBox*>(widget)))
 			value = checkbox->isChecked();
-		else if ((button = qobject_cast<QPushButton*> (widget)))
+		else if ((button = qobject_cast<QPushButton*>(widget)))
 			value = m_buttonColors[button];
 		else
 		{
-			print ("Unknown widget of type %1\n", widget->metaObject()->className());
+			print("Unknown widget of type %1\n", widget->metaObject()->className());
 			return;
 		}
 
-		m_settings->setValue (confname, value);
+		m_settings->setValue(confname, value);
 	});
 
 	// Rebuild the quick color toolbar
-	m_window->setQuickColors (quickColors);
-	config.setQuickColorToolbar (quickColorString());
+	m_window->setQuickColors(quickColors);
+	config.setQuickColorToolbar(quickColorString());
 
 	// Ext program settings
 	for (int i = 0; i < NumExternalPrograms; ++i)
@@ -285,17 +285,17 @@
 		ExtProgramType program = (ExtProgramType) i;
 		ExtProgramToolset* toolset = m_window->externalPrograms();
 		ExternalProgramWidgets& widgets = m_externalProgramWidgets[i];
-		toolset->getPathSetting (program) = widgets.input->text();
+		toolset->getPathSetting(program) = widgets.input->text();
 
 		if (widgets.wineBox)
-			toolset->setWineSetting (program, widgets.wineBox->isChecked());
+			toolset->setWineSetting(program, widgets.wineBox->isChecked());
 	}
 
 	// Apply shortcuts
 	for (int i = 0; i < ui.shortcutsList->count(); ++i)
 	{
-		auto item = static_cast<ShortcutListItem*> (ui.shortcutsList->item (i));
-		item->action()->setShortcut (item->sequence());
+		auto item = static_cast<ShortcutListItem*>(ui.shortcutsList->item(i));
+		item->action()->setShortcut(item->sequence());
 	}
 
 	m_window->syncSettings();
@@ -309,20 +309,20 @@
 //
 // A dialog button was clicked
 //
-void ConfigDialog::buttonClicked (QAbstractButton* button)
+void ConfigDialog::buttonClicked(QAbstractButton* button)
 {
 	QDialogButtonBox* dbb = ui.buttonBox;
 
-	if (button == dbb->button (QDialogButtonBox::Ok))
+	if (button == dbb->button(QDialogButtonBox::Ok))
 	{
 		applySettings();
 		accept();
 	}
-	else if (button == dbb->button (QDialogButtonBox::Apply))
+	else if (button == dbb->button(QDialogButtonBox::Apply))
 	{
 		applySettings();
 	}
-	else if (button == dbb->button (QDialogButtonBox::Cancel))
+	else if (button == dbb->button(QDialogButtonBox::Cancel))
 	{
 		reject();
 	}
@@ -331,7 +331,7 @@
 //
 // Update the list of color toolbar items in the quick color tab.
 //
-void ConfigDialog::updateQuickColorList (ColorToolbarItem* sel)
+void ConfigDialog::updateQuickColorList(ColorToolbarItem* sel)
 {
 	for (QListWidgetItem * item : quickColorItems)
 		delete item;
@@ -345,8 +345,8 @@
 
 		if (entry.isSeparator())
 		{
-			item->setText ("<hr />");
-			item->setIcon (GetIcon ("empty"));
+			item->setText("<hr />");
+			item->setIcon(GetIcon("empty"));
 		}
 		else
 		{
@@ -354,23 +354,23 @@
 
 			if (color.isValid())
 			{
-				item->setText (color.name());
-				item->setIcon (guiUtilities()->makeColorIcon (color, 16));
+				item->setText(color.name());
+				item->setIcon(guiUtilities()->makeColorIcon(color, 16));
 			}
 			else
 			{
-				item->setText ("[[unknown color]]");
-				item->setIcon (GetIcon ("error"));
+				item->setText("[[unknown color]]");
+				item->setIcon(GetIcon("error"));
 			}
 		}
 
-		ui.quickColorList->addItem (item);
+		ui.quickColorList->addItem(item);
 		quickColorItems << item;
 
 		if (sel and &entry == sel)
 		{
-			ui.quickColorList->setCurrentItem (item);
-			ui.quickColorList->scrollToItem (item);
+			ui.quickColorList->setCurrentItem(item);
+			ui.quickColorList->scrollToItem(item);
 		}
 	}
 }
@@ -382,7 +382,7 @@
 {
 	ColorToolbarItem* entry = nullptr;
 	QListWidgetItem* item = nullptr;
-	const bool isNew = static_cast<QPushButton*> (sender()) == ui.quickColor_add;
+	const bool isNew = static_cast<QPushButton*>(sender()) == ui.quickColor_add;
 
 	if (not isNew)
 	{
@@ -391,7 +391,7 @@
 		if (not item)
 			return;
 
-		int i = getItemRow (item, quickColorItems);
+		int i = getItemRow(item, quickColorItems);
 		entry = &quickColors[i];
 
 		if (entry->isSeparator() == true)
@@ -401,23 +401,23 @@
 	LDColor defaultValue = entry ? entry->color() : LDColor::nullColor();
 	LDColor value;
 
-	if (not ColorSelector::selectColor (this, value, defaultValue))
+	if (not ColorSelector::selectColor(this, value, defaultValue))
 		return;
 
 	if (entry)
 	{
-		entry->setColor (value);
+		entry->setColor(value);
 	}
 	else
 	{
-		ColorToolbarItem newentry (value, nullptr);
+		ColorToolbarItem newentry(value, nullptr);
 		item = getSelectedQuickColor();
-		int idx = (item) ? getItemRow (item, quickColorItems) + 1 : quickColorItems.size();
-		quickColors.insert (idx, newentry);
+		int idx = (item) ? getItemRow(item, quickColorItems) + 1 : quickColorItems.size();
+		quickColors.insert(idx, newentry);
 		entry = &quickColors[idx];
 	}
 
-	updateQuickColorList (entry);
+	updateQuickColorList(entry);
 }
 
 //
@@ -429,7 +429,7 @@
 		return;
 
 	QListWidgetItem* item = ui.quickColorList->selectedItems() [0];
-	quickColors.removeAt (getItemRow (item, quickColorItems));
+	quickColors.removeAt(getItemRow(item, quickColorItems));
 	updateQuickColorList();
 }
 
@@ -438,20 +438,20 @@
 //
 void ConfigDialog::slot_moveColor()
 {
-	const bool up = (static_cast<QPushButton*> (sender()) == ui.quickColor_moveUp);
+	const bool up = (static_cast<QPushButton*>(sender()) == ui.quickColor_moveUp);
 
 	if (ui.quickColorList->selectedItems().isEmpty())
 		return;
 
 	QListWidgetItem* item = ui.quickColorList->selectedItems() [0];
-	int idx = getItemRow (item, quickColorItems);
-	int dest = up ? (idx - 1) : (idx + 1);
+	int idx = getItemRow(item, quickColorItems);
+	int dest = up ?(idx - 1) :(idx + 1);
 
 	if (dest < 0 or dest >= quickColorItems.size())
 		return; // destination out of bounds
 
-	qSwap (quickColors[dest], quickColors[idx]);
-	updateQuickColorList (&quickColors[dest]);
+	qSwap(quickColors[dest], quickColors[idx]);
+	updateQuickColorList(&quickColors[dest]);
 }
 
 //
@@ -461,7 +461,7 @@
 void ConfigDialog::slot_addColorSeparator()
 {
 	quickColors << ColorToolbarItem::makeSeparator();
-	updateQuickColorList (&quickColors[quickColors.size() - 1]);
+	updateQuickColorList(&quickColors[quickColors.size() - 1]);
 }
 
 //
@@ -478,39 +478,39 @@
 //
 void ConfigDialog::setButtonColor()
 {
-	QPushButton* button = qobject_cast<QPushButton*> (sender());
+	QPushButton* button = qobject_cast<QPushButton*>(sender());
 
 	if (button == nullptr)
 	{
-		print ("setButtonColor: null sender!\n");
+		print("setButtonColor: null sender!\n");
 		return;
 	}
 
-	QColor color = QColorDialog::getColor (m_buttonColors[button]);
+	QColor color = QColorDialog::getColor(m_buttonColors[button]);
 
 	if (color.isValid())
 	{
 		QString colorname;
-		colorname.sprintf ("#%.2X%.2X%.2X", color.red(), color.green(), color.blue());
-		setButtonBackground (button, colorname);
+		colorname.sprintf("#%.2X%.2X%.2X", color.red(), color.green(), color.blue());
+		setButtonBackground(button, colorname);
 	}
 }
 
 //
 // Sets background color of a given button.
 //
-void ConfigDialog::setButtonBackground (QPushButton* button, QString value)
+void ConfigDialog::setButtonBackground(QPushButton* button, QString value)
 {
-	button->setIcon (GetIcon ("colorselect"));
-	button->setAutoFillBackground (true);
-	button->setStyleSheet (format ("background-color: %1", value));
-	m_buttonColors[button] = QColor (value);
+	button->setIcon(GetIcon("colorselect"));
+	button->setAutoFillBackground(true);
+	button->setStyleSheet(format("background-color: %1", value));
+	m_buttonColors[button] = QColor(value);
 }
 
 //
 // Finds the given list widget item in the list of widget items given.
 //
-int ConfigDialog::getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack)
+int ConfigDialog::getItemRow(QListWidgetItem* item, QList<QListWidgetItem*>& haystack)
 {
 	int i = 0;
 
@@ -544,7 +544,7 @@
 	QList<ShortcutListItem*> out;
 
 	for (QListWidgetItem* entry : ui.shortcutsList->selectedItems())
-		out << static_cast<ShortcutListItem*> (entry);
+		out << static_cast<ShortcutListItem*>(entry);
 
 	return out;
 }
@@ -561,8 +561,8 @@
 
 	ShortcutListItem* item = sel[0];
 
-	if (KeySequenceDialog::staticDialog (item, this))
-		setShortcutText (item);
+	if (KeySequenceDialog::staticDialog(item, this))
+		setShortcutText(item);
 }
 
 //
@@ -574,8 +574,8 @@
 
 	for (ShortcutListItem* item : sel)
 	{
-		item->setSequence (m_window->defaultShortcut (item->action()));
-		setShortcutText (item);
+		item->setSequence(m_window->defaultShortcut(item->action()));
+		setShortcutText(item);
 	}
 }
 
@@ -588,8 +588,8 @@
 
 	for (ShortcutListItem* item : sel)
 	{
-		item->setSequence (QKeySequence());
-		setShortcutText (item);
+		item->setSequence(QKeySequence());
+		setShortcutText(item);
 	}
 }
 
@@ -613,14 +613,14 @@
 	{
 		ExtProgramToolset* toolset = m_window->externalPrograms();
 		ExternalProgramWidgets& widgets = m_externalProgramWidgets[program];
-		QString filepath = QFileDialog::getOpenFileName (this,
-			format ("Path to %1", toolset->externalProgramName (program)),
+		QString filepath = QFileDialog::getOpenFileName(this,
+			format("Path to %1", toolset->externalProgramName(program)),
 			widgets.input->text(), g_extProgPathFilter);
 	
 		if (filepath.isEmpty())
 			return;
 	
-		widgets.input->setText (filepath);
+		widgets.input->setText(filepath);
 	}
 }
 
@@ -632,19 +632,19 @@
 	QString dpath = QFileDialog::getExistingDirectory();
 
 	if (not dpath.isEmpty())
-		ui.configDownloadFilePath->setText (dpath);
+		ui.configDownloadFilePath->setText(dpath);
 }
 
 //
 //
 // Updates the text string for a given shortcut list item
 //
-void ConfigDialog::setShortcutText (ShortcutListItem* item)
+void ConfigDialog::setShortcutText(ShortcutListItem* item)
 {
 	QAction* act = item->action();
 	QString label = act->iconText();
 	QString keybind = item->sequence().toString();
-	item->setText (format ("%1 (%2)", label, keybind));
+	item->setText(format("%1(%2)", label, keybind));
 }
 
 //
@@ -662,7 +662,7 @@
 		if (entry.isSeparator())
 			val += '|';
 		else
-			val += format ("%1", entry.color().index());
+			val += format("%1", entry.color().index());
 	}
 
 	return val;
@@ -670,37 +670,37 @@
 
 //
 //
-KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent, Qt::WindowFlags f) :
-	QDialog (parent, f), seq (seq)
+KeySequenceDialog::KeySequenceDialog(QKeySequence seq, QWidget* parent, Qt::WindowFlags f) :
+	QDialog(parent, f), seq(seq)
 {
 	lb_output = new QLabel;
 
-	bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \
-	connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); \
-	connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); \
+	bbx_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \
+	connect(bbx_buttons, SIGNAL(accepted()), this, SLOT(accept())); \
+	connect(bbx_buttons, SIGNAL(rejected()), this, SLOT(reject())); \
 
-	setWhatsThis (tr ("Into this dialog you can input a key sequence for use as a "
+	setWhatsThis(tr("Into this dialog you can input a key sequence for use as a "
 		"shortcut in LDForge. Use OK to confirm the new shortcut and Cancel to "
 		"dismiss."));
 
 	QVBoxLayout* layout = new QVBoxLayout;
-	layout->addWidget (lb_output);
-	layout->addWidget (bbx_buttons);
-	setLayout (layout);
+	layout->addWidget(lb_output);
+	layout->addWidget(bbx_buttons);
+	setLayout(layout);
 
 	updateOutput();
 }
 
 //
 //
-bool KeySequenceDialog::staticDialog (ShortcutListItem* item, QWidget* parent)
+bool KeySequenceDialog::staticDialog(ShortcutListItem* item, QWidget* parent)
 {
-	KeySequenceDialog dlg (item->sequence(), parent);
+	KeySequenceDialog dlg(item->sequence(), parent);
 
 	if (dlg.exec() == QDialog::Rejected)
 		return false;
 
-	item->setSequence (dlg.seq);
+	item->setSequence(dlg.seq);
 	return true;
 }
 
@@ -713,13 +713,13 @@
 	if (seq == QKeySequence())
 		shortcut = "&lt;empty&gt;";
 
-	QString text = format ("<center><b>%1</b></center>", shortcut);
-	lb_output->setText (text);
+	QString text = format("<center><b>%1</b></center>", shortcut);
+	lb_output->setText(text);
 }
 
 //
 //
-void KeySequenceDialog::keyPressEvent (QKeyEvent* ev)
+void KeySequenceDialog::keyPressEvent(QKeyEvent* ev)
 {
 	seq = ev->key() + ev->modifiers();
 	updateOutput();
--- a/src/dialogs/configdialog.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/configdialog.h	Thu Jan 04 19:44:26 2018 +0200
@@ -28,12 +28,12 @@
 class ShortcutListItem : public QListWidgetItem
 {
 public:
-	explicit ShortcutListItem (QListWidget* view = nullptr, int type = Type);
+	explicit ShortcutListItem(QListWidget* view = nullptr, int type = Type);
 
 	QAction* action() const;
 	QKeySequence sequence() const;
-	void setAction (QAction* action);
-	void setSequence (const QKeySequence& sequence);
+	void setAction(QAction* action);
+	void setSequence(const QKeySequence& sequence);
 
 private:
 	QAction* m_action;
@@ -65,7 +65,7 @@
 		DownloadTab
 	};
 
-	explicit ConfigDialog (QWidget* parent = nullptr, Tab defaulttab = (Tab) 0, Qt::WindowFlags f = 0);
+	explicit ConfigDialog(QWidget* parent = nullptr, Tab defaulttab = (Tab) 0, Qt::WindowFlags f = 0);
 	virtual ~ConfigDialog();
 
 	QList<ColorToolbarItem> quickColors;
@@ -78,16 +78,16 @@
 	class QSettings* m_settings;
 
 	void applySettings();
-	void addShortcut (QAction* act);
-	void setButtonBackground (QPushButton* button, QString value);
-	void updateQuickColorList (ColorToolbarItem* sel = nullptr);
-	void setShortcutText (ShortcutListItem* item);
-	int getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack);
+	void addShortcut(QAction* act);
+	void setButtonBackground(QPushButton* button, QString value);
+	void updateQuickColorList(ColorToolbarItem* sel = nullptr);
+	void setShortcutText(ShortcutListItem* item);
+	int getItemRow(QListWidgetItem* item, QList<QListWidgetItem*>& haystack);
 	QString quickColorString();
 	QListWidgetItem* getSelectedQuickColor();
 	QList<ShortcutListItem*> getShortcutSelection();
 	void initExtProgs();
-	void applyToWidgetOptions (std::function<void (QWidget*, QString)> func);
+	void applyToWidgetOptions(std::function<void(QWidget*, QString)> func);
 
 private slots:
 	void setButtonColor();
@@ -101,8 +101,8 @@
 	void slot_clearColors();
 	void slot_setExtProgPath();
 	void slot_findDownloadFolder();
-	void buttonClicked (QAbstractButton* button);
-	void selectPage (int row);
+	void buttonClicked(QAbstractButton* button);
+	void selectPage(int row);
 };
 
 // =============================================================================
@@ -112,8 +112,8 @@
 	Q_OBJECT
 
 public:
-	explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = nullptr, Qt::WindowFlags f = 0);
-	static bool staticDialog (ShortcutListItem* item, QWidget* parent = nullptr);
+	explicit KeySequenceDialog(QKeySequence seq, QWidget* parent = nullptr, Qt::WindowFlags f = 0);
+	static bool staticDialog(ShortcutListItem* item, QWidget* parent = nullptr);
 
 	QLabel* lb_output;
 	QDialogButtonBox* bbx_buttons;
@@ -123,5 +123,5 @@
 	void updateOutput();
 
 private slots:
-	virtual void keyPressEvent (QKeyEvent* ev) override;
+	virtual void keyPressEvent(QKeyEvent* ev) override;
 };
--- a/src/dialogs/configdialog.ui	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/configdialog.ui	Thu Jan 04 19:44:26 2018 +0200
@@ -291,14 +291,14 @@
                    <string>Polygons' front sides become green and back sides red.</string>
                   </property>
                   <property name="text">
-                   <string>Red/green BFC view (incomplete)</string>
+                   <string>Red/green BFC view(incomplete)</string>
                   </property>
                  </widget>
                 </item>
                 <item row="2" column="1">
                  <widget class="QCheckBox" name="configColorizeObjectsList">
                   <property name="whatsThis">
-                   <string>Makes colored objects (non-16 and 24) appear colored in the list view. A red triangle will, for instance, have its entry written in red text. This can be useful to locate colored objects.</string>
+                   <string>Makes colored objects(non-16 and 24) appear colored in the list view. A red triangle will, for instance, have its entry written in red text. This can be useful to locate colored objects.</string>
                   </property>
                   <property name="text">
                    <string>Colorize objects in list view</string>
--- a/src/dialogs/ldrawpathdialog.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/ldrawpathdialog.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -23,29 +23,29 @@
 #include "ui_ldrawpathdialog.h"
 #include "../mainwindow.h"
 
-LDrawPathDialog::LDrawPathDialog (const QString& defaultPath, bool validDefault, QWidget* parent, Qt::WindowFlags f) :
-	QDialog (parent, f),
-	m_hasValidDefault (validDefault),
-	ui (*new Ui_LDrawPathDialog)
+LDrawPathDialog::LDrawPathDialog(const QString& defaultPath, bool validDefault, QWidget* parent, Qt::WindowFlags f) :
+	QDialog(parent, f),
+	m_hasValidDefault(validDefault),
+	ui(*new Ui_LDrawPathDialog)
 {
-	ui.setupUi (this);
-	ui.status->setText ("---");
+	ui.setupUi(this);
+	ui.status->setText("---");
 
 	if (validDefault)
 		ui.heading->hide();
 	else
 	{
-		cancelButton()->setText ("Exit");
-		cancelButton()->setIcon (GetIcon ("exit"));
+		cancelButton()->setText("Exit");
+		cancelButton()->setIcon(GetIcon("exit"));
 	}
 
-	okButton()->setEnabled (false);
+	okButton()->setEnabled(false);
 
-	connect (ui.path, SIGNAL (textChanged (QString)), this, SIGNAL (pathChanged (QString)));
-	connect (ui.searchButton, SIGNAL (clicked()), this, SLOT (searchButtonClicked()));
-	connect (ui.buttonBox, SIGNAL (rejected()), this, SLOT (reject()));
-	connect (ui.buttonBox, SIGNAL (accepted()), this, SLOT (accept()));
-	setPath (defaultPath);
+	connect(ui.path, SIGNAL(textChanged(QString)), this, SIGNAL(pathChanged(QString)));
+	connect(ui.searchButton, SIGNAL(clicked()), this, SLOT(searchButtonClicked()));
+	connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+	connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+	setPath(defaultPath);
 }
 
 LDrawPathDialog::~LDrawPathDialog()
@@ -55,17 +55,17 @@
 
 QPushButton* LDrawPathDialog::okButton()
 {
-	return ui.buttonBox->button (QDialogButtonBox::Ok);
+	return ui.buttonBox->button(QDialogButtonBox::Ok);
 }
 
 QPushButton* LDrawPathDialog::cancelButton()
 {
-	return ui.buttonBox->button (QDialogButtonBox::Cancel);
+	return ui.buttonBox->button(QDialogButtonBox::Cancel);
 }
 
-void LDrawPathDialog::setPath (QString path)
+void LDrawPathDialog::setPath(QString path)
 {
-	ui.path->setText (path);
+	ui.path->setText(path);
 }
 
 QString LDrawPathDialog::path() const
@@ -75,22 +75,22 @@
 
 void LDrawPathDialog::searchButtonClicked()
 {
-	QString newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
+	QString newpath = QFileDialog::getExistingDirectory(this, "Find LDraw Path");
 
 	if (not newpath.isEmpty())
-		setPath (newpath);
+		setPath(newpath);
 }
 
-void LDrawPathDialog::setStatusText (const QString& statusText, bool ok)
+void LDrawPathDialog::setStatusText(const QString& statusText, bool ok)
 {
-	okButton()->setEnabled (ok);
+	okButton()->setEnabled(ok);
 
 	if (statusText.isEmpty() && ok == false)
-		ui.status->setText ("---");
+		ui.status->setText("---");
 	else
 	{
-		ui.status->setText (QString ("<span style=\"color: %1\">%2</span>")
-			.arg (ok ? "#270" : "#700")
-			.arg (statusText));
+		ui.status->setText(QString("<span style=\"color: %1\">%2</span>")
+			.arg(ok ? "#270" : "#700")
+			.arg(statusText));
 	}
 }
\ No newline at end of file
--- a/src/dialogs/ldrawpathdialog.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/ldrawpathdialog.h	Thu Jan 04 19:44:26 2018 +0200
@@ -25,14 +25,14 @@
 	Q_OBJECT
 
 public:
-	LDrawPathDialog (const QString& defaultPath, bool validDefault, QWidget* parent = nullptr, Qt::WindowFlags f = 0);
+	LDrawPathDialog(const QString& defaultPath, bool validDefault, QWidget* parent = nullptr, Qt::WindowFlags f = 0);
 	virtual ~LDrawPathDialog();
 	QString path() const;
-	void setPath (QString path);
-	void setStatusText (const QString& statusText, bool ok);
+	void setPath(QString path);
+	void setStatusText(const QString& statusText, bool ok);
 
 signals:
-	void pathChanged (QString newPath);
+	void pathChanged(QString newPath);
 
 private:
 	const bool m_hasValidDefault;
--- a/src/dialogs/newpartdialog.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/newpartdialog.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -24,20 +24,20 @@
 #include "newpartdialog.h"
 #include "ui_newpartdialog.h"
 
-NewPartDialog::NewPartDialog (QWidget *parent) :
-	QDialog (parent),
-	HierarchyElement (parent),
-	ui (*new Ui_NewPart)
+NewPartDialog::NewPartDialog(QWidget *parent) :
+	QDialog(parent),
+	HierarchyElement(parent),
+	ui(*new Ui_NewPart)
 {
-	ui.setupUi (this);
+	ui.setupUi(this);
 
 	QString authortext = config.defaultName();
 
 	if (not config.defaultUser().isEmpty())
-		authortext.append (format (" [%1]", config.defaultUser()));
+		authortext.append(format(" [%1]", config.defaultUser()));
 
-	ui.author->setText (authortext);
-	ui.useCaLicense->setChecked (config.useCaLicense());
+	ui.author->setText(authortext);
+	ui.useCaLicense->setChecked(config.useCaLicense());
 }
 
 BfcStatement NewPartDialog::getWinding() const
@@ -66,19 +66,19 @@
 	return ui.title->text();
 }
 
-void NewPartDialog::fillHeader (LDDocument* newdoc) const
+void NewPartDialog::fillHeader(LDDocument* newdoc) const
 {
 	LDObjectList objs;
-	objs << new LDComment (title());
-	objs << new LDComment ("Name: <untitled>.dat");
-	objs << new LDComment ("Author: " + author());
-	objs << new LDComment ("!LDRAW_ORG Unofficial_Part");
+	objs << new LDComment(title());
+	objs << new LDComment("Name: <untitled>.dat");
+	objs << new LDComment("Author: " + author());
+	objs << new LDComment("!LDRAW_ORG Unofficial_Part");
 
 	if (useCaLicense())
-		objs << new LDComment (CALicenseText);
+		objs << new LDComment(CALicenseText);
 	
 	objs << new LDEmpty();
-	objs << new LDBfc (getWinding());
+	objs << new LDBfc(getWinding());
 	objs << new LDEmpty();
-	newdoc->addObjects (objs);
+	newdoc->addObjects(objs);
 }
--- a/src/dialogs/newpartdialog.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/newpartdialog.h	Thu Jan 04 19:44:26 2018 +0200
@@ -25,10 +25,10 @@
 {
 	Q_OBJECT
 public:
-	NewPartDialog (QWidget *parent);
+	NewPartDialog(QWidget *parent);
 
 	QString author() const;
-	void fillHeader (LDDocument* newdoc) const;
+	void fillHeader(LDDocument* newdoc) const;
 	BfcStatement getWinding() const;
 	bool useCaLicense() const;
 	QString title() const;
--- a/src/dialogs/openprogressdialog.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/openprogressdialog.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -20,14 +20,14 @@
 #include "ui_openprogressdialog.h"
 #include "../main.h"
 
-OpenProgressDialog::OpenProgressDialog (QWidget* parent, Qt::WindowFlags f) :
-	QDialog (parent, f),
-	ui (*new Ui_OpenProgressUI),
-	m_progress (0),
-	m_numLines (0)
+OpenProgressDialog::OpenProgressDialog(QWidget* parent, Qt::WindowFlags f) :
+	QDialog(parent, f),
+	ui(*new Ui_OpenProgressUI),
+	m_progress(0),
+	m_numLines(0)
 {
-	ui.setupUi (this);
-	ui.progressText->setText ("Parsing...");
+	ui.setupUi(this);
+	ui.progressText->setText("Parsing...");
 }
 
 OpenProgressDialog::~OpenProgressDialog()
@@ -35,20 +35,20 @@
 	delete &ui;
 }
 
-void OpenProgressDialog::setNumLines (int a)
+void OpenProgressDialog::setNumLines(int a)
 {
 	m_numLines = a;
-	ui.progressBar->setRange (0, numLines());
+	ui.progressBar->setRange(0, numLines());
 	updateValues();
 }
 
 void OpenProgressDialog::updateValues()
 {
-	ui.progressText->setText (format ("Parsing... %1 / %2", progress(), numLines()));
-	ui.progressBar->setValue (progress());
+	ui.progressText->setText(format("Parsing... %1 / %2", progress(), numLines()));
+	ui.progressBar->setValue(progress());
 }
 
-void OpenProgressDialog::setProgress (int progress)
+void OpenProgressDialog::setProgress(int progress)
 {
 	m_progress = progress;
 	updateValues();
--- a/src/dialogs/openprogressdialog.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/dialogs/openprogressdialog.h	Thu Jan 04 19:44:26 2018 +0200
@@ -24,15 +24,15 @@
 	Q_OBJECT
 
 public:
-	OpenProgressDialog (QWidget* parent = nullptr, Qt::WindowFlags f = 0);
+	OpenProgressDialog(QWidget* parent = nullptr, Qt::WindowFlags f = 0);
 	virtual ~OpenProgressDialog();
 
 	int progress() const { return m_progress; }
 	int numLines() const { return m_numLines; }
-	void setNumLines (int value);
+	void setNumLines(int value);
 
 public slots:
-	void setProgress (int progress);
+	void setProgress(int progress);
 
 private:
 	class Ui_OpenProgressUI& ui;
--- a/src/documentation.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/documentation.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -28,23 +28,23 @@
 class DocumentViewer : public QDialog
 {
 	public:
-		explicit DocumentViewer (QWidget* parent = nullptr, Qt::WindowFlags f = 0) : QDialog (parent, f)
+		explicit DocumentViewer(QWidget* parent = nullptr, Qt::WindowFlags f = 0) : QDialog(parent, f)
 		{
-			te_text = new QTextEdit (this);
-			te_text->setMinimumSize (QSize (400, 300));
-			te_text->setReadOnly (true);
+			te_text = new QTextEdit(this);
+			te_text->setMinimumSize(QSize(400, 300));
+			te_text->setReadOnly(true);
 
-			QDialogButtonBox* bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Close);
-			QVBoxLayout* layout = new QVBoxLayout (this);
-			layout->addWidget (te_text);
-			layout->addWidget (bbx_buttons);
+			QDialogButtonBox* bbx_buttons = new QDialogButtonBox(QDialogButtonBox::Close);
+			QVBoxLayout* layout = new QVBoxLayout(this);
+			layout->addWidget(te_text);
+			layout->addWidget(bbx_buttons);
 
-			connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject()));
+			connect(bbx_buttons, SIGNAL(rejected()), this, SLOT(reject()));
 		}
 
-		void setText (const char* text)
+		void setText(const char* text)
 		{
-			te_text->setText (text);
+			te_text->setText(text);
 		}
 
 	private:
@@ -68,9 +68,9 @@
 
 // =============================================================================
 // =============================================================================
-void showDocumentation (const char* text)
+void showDocumentation(const char* text)
 {
 	DocumentViewer dlg;
-	dlg.setText (text);
+	dlg.setText(text);
 	dlg.exec();
 }
--- a/src/documentation.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/documentation.h	Thu Jan 04 19:44:26 2018 +0200
@@ -18,4 +18,4 @@
 
 #pragma once
 extern const char* g_docs_overlays;
-void showDocumentation (const char* text);
+void showDocumentation(const char* text);
--- a/src/documentloader.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/documentloader.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -23,12 +23,12 @@
 #include "mainwindow.h"
 #include "dialogs/openprogressdialog.h"
 
-DocumentLoader::DocumentLoader (bool onForeground, QObject *parent) :
-	QObject (parent),
-	m_warningCount (0),
-	m_isDone (false),
-	m_hasAborted (false),
-	m_isOnForeground (onForeground) {}
+DocumentLoader::DocumentLoader(bool onForeground, QObject *parent) :
+	QObject(parent),
+	m_warningCount(0),
+	m_isDone(false),
+	m_hasAborted(false),
+	m_isOnForeground(onForeground) {}
 
 bool DocumentLoader::hasAborted()
 {
@@ -60,12 +60,12 @@
 	return m_objects;
 }
 
-void DocumentLoader::read (QIODevice* fp)
+void DocumentLoader::read(QIODevice* fp)
 {
 	if (fp and fp->isOpen())
 	{
 		while (not fp->atEnd())
-			m_lines << QString::fromUtf8 (fp->readLine());
+			m_lines << QString::fromUtf8(fp->readLine());
 	}
 }
 
@@ -79,21 +79,21 @@
 	{
 		// Show a progress dialog if we're loading the main ldDocument.here so we can show progress updates and keep the
 		// WM posted that we're still here.
-		m_progressDialog = new OpenProgressDialog (g_win);
-		m_progressDialog->setNumLines (m_lines.size());
-		m_progressDialog->setModal (true);
+		m_progressDialog = new OpenProgressDialog(g_win);
+		m_progressDialog->setNumLines(m_lines.size());
+		m_progressDialog->setModal(true);
 		m_progressDialog->show();
-		connect (this, SIGNAL (workDone()), m_progressDialog, SLOT (accept()));
-		connect (m_progressDialog, SIGNAL (rejected()), this, SLOT (abort()));
+		connect(this, SIGNAL(workDone()), m_progressDialog, SLOT(accept()));
+		connect(m_progressDialog, SIGNAL(rejected()), this, SLOT(abort()));
 	}
 	else
 		m_progressDialog = nullptr;
 
 	// Begin working
-	work (0);
+	work(0);
 }
 
-void DocumentLoader::work (int i)
+void DocumentLoader::work(int i)
 {
 	// User wishes to abort, so stop here now.
 	if (hasAborted())
@@ -109,20 +109,20 @@
 	// Parse up to 200 lines per iteration
 	int max = i + 200;
 
-	for (; i < max and i < (int) m_lines.size(); ++i)
+	for (; i < max and i <(int) m_lines.size(); ++i)
 	{
 		QString line = m_lines[i];
 
 		// Trim the trailing newline
-		while (line.endsWith ("\n") or line.endsWith ("\r"))
-			line.chop (1);
+		while (line.endsWith("\n") or line.endsWith("\r"))
+			line.chop(1);
 
-		LDObject* obj = ParseLine (line);
+		LDObject* obj = ParseLine(line);
 
 		// Check for parse errors and warn about them
 		if (obj->type() == OBJ_Error)
 		{
-			print ("Couldn't parse line #%1: %2", progress() + 1, static_cast<LDError*> (obj)->reason());
+			print("Couldn't parse line #%1: %2", progress() + 1, static_cast<LDError*>(obj)->reason());
 			++m_warningCount;
 		}
 
@@ -132,7 +132,7 @@
 	m_progress = i;
 
 	if (m_progressDialog)
-		m_progressDialog->setProgress (i);
+		m_progressDialog->setProgress(i);
 
 	if (i >= m_lines.size() - 1)
 	{
@@ -145,12 +145,12 @@
 		// needs to be updated as well. Thus, we take a detour through the event loop by using the meta-object system.
 		//
 		// This terminates the loop here and control goes back to the function which called the file loader. It will
-		// keep processing the event loop until we're ready (see loadFileContents), thus the event loop will eventually
+		// keep processing the event loop until we're ready(see loadFileContents), thus the event loop will eventually
 		// catch the invokation we throw here and send us back.
 		if (isOnForeground())
-			QMetaObject::invokeMethod (this, "work", Qt::QueuedConnection, Q_ARG (int, i));
+			QMetaObject::invokeMethod(this, "work", Qt::QueuedConnection, Q_ARG(int, i));
 		else
-			work (i);
+			work(i);
 	}
 }
 
--- a/src/documentloader.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/documentloader.h	Thu Jan 04 19:44:26 2018 +0200
@@ -30,7 +30,7 @@
 	Q_OBJECT
 
 public:
-	DocumentLoader (bool onForeground = false, QObject* parent = 0);
+	DocumentLoader(bool onForeground = false, QObject* parent = 0);
 
 	Q_SLOT void abort();
 	bool hasAborted();
@@ -38,7 +38,7 @@
 	bool isOnForeground() const;
 	const LDObjectList& objects() const;
 	int progress() const;
-	void read (QIODevice* fp);
+	void read(QIODevice* fp);
 	Q_SLOT void start();
 	int warningCount() const;
 
@@ -53,9 +53,9 @@
 	bool m_isOnForeground;
 
 private slots:
-	void work (int i);
+	void work(int i);
 
 signals:
-	void progressUpdate (int progress);
+	void progressUpdate(int progress);
 	void workDone();
 };
--- a/src/documentmanager.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/documentmanager.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -26,21 +26,21 @@
 #include "documentloader.h"
 #include "glRenderer.h"
 
-ConfigOption (QStringList RecentFiles)
-ConfigOption (bool TryDownloadMissingFiles = false)
+ConfigOption(QStringList RecentFiles)
+ConfigOption(bool TryDownloadMissingFiles = false)
 
 enum
 {
 	MaxRecentFiles = 10
 };
 
-DocumentManager::DocumentManager (QObject* parent) :
-	QObject (parent),
-	HierarchyElement (parent),
-	m_loadingMainFile (false),
-	m_isLoadingLogoedStuds (false),
-	m_logoedStud (nullptr),
-	m_logoedStud2 (nullptr) {}
+DocumentManager::DocumentManager(QObject* parent) :
+	QObject(parent),
+	HierarchyElement(parent),
+	m_loadingMainFile(false),
+	m_isLoadingLogoedStuds(false),
+	m_logoedStud(nullptr),
+	m_logoedStud2(nullptr) {}
 
 DocumentManager::~DocumentManager()
 {
@@ -58,27 +58,27 @@
 	m_documents.clear();
 }
 
-LDDocument* DocumentManager::getDocumentByName (QString filename)
+LDDocument* DocumentManager::getDocumentByName(QString filename)
 {
-	LDDocument* doc = findDocumentByName (filename);
+	LDDocument* doc = findDocumentByName(filename);
 
 	if (doc == nullptr)
 	{
 		bool tmp = m_loadingMainFile;
 		m_loadingMainFile = false;
-		doc = openDocument (filename, true, true);
+		doc = openDocument(filename, true, true);
 		m_loadingMainFile = tmp;
 	}
 
 	return doc;
 }
 
-void DocumentManager::openMainModel (QString path)
+void DocumentManager::openMainModel(QString path)
 {
 	// If there's already a file with the same name, this file must replace it.
 	LDDocument* documentToReplace = nullptr;
 	LDDocument* file = nullptr;
-	QString shortName = LDDocument::shortenName (path);
+	QString shortName = LDDocument::shortenName(path);
 
 	for (LDDocument* doc : m_documents)
 	{
@@ -105,15 +105,15 @@
 	}
 
 	bool aborted;
-	file = openDocument (path, false, false, file, &aborted);
+	file = openDocument(path, false, false, file, &aborted);
 
 	if (file == nullptr)
 	{
 		if (not aborted)
 		{
 			// Tell the user loading failed.
-			setlocale (LC_ALL, "C");
-			Critical (format (tr ("Failed to open %1: %2"), path, strerror (errno)));
+			setlocale(LC_ALL, "C");
+			Critical(format(tr("Failed to open %1: %2"), path, strerror(errno)));
 		}
 
 		m_loadingMainFile = false;
@@ -122,9 +122,9 @@
 
 	file->openForEditing();
 	m_window->closeInitialDocument();
-	m_window->changeDocument (file);
+	m_window->changeDocument(file);
 	m_window->doFullRefresh();
-	addRecentFile (path);
+	addRecentFile(path);
 	m_loadingMainFile = false;
 
 	// If there were problems loading subfile references, try see if we can find these
@@ -133,20 +133,20 @@
 
 	for (LDObject* obj : file->objects())
 	{
-		if (obj->type() != OBJ_Error or static_cast<LDError*> (obj)->fileReferenced().isEmpty())
+		if (obj->type() != OBJ_Error or static_cast<LDError*>(obj)->fileReferenced().isEmpty())
 			continue;
 
-		unknowns << static_cast<LDError*> (obj)->fileReferenced();
+		unknowns << static_cast<LDError*>(obj)->fileReferenced();
 	}
 
 	if (config.tryDownloadMissingFiles() and not unknowns.isEmpty())
 	{
-		PartDownloader dl (m_window);
-		dl.setSourceType (PartDownloader::PartsTracker);
-		dl.setPrimaryFile (file);
+		PartDownloader dl(m_window);
+		dl.setSourceType(PartDownloader::PartsTracker);
+		dl.setPrimaryFile(file);
 
 		for (QString const& unknown : unknowns)
-			dl.downloadFromPartsTracker (unknown);
+			dl.downloadFromPartsTracker(unknown);
 
 		dl.exec();
 		dl.checkIfFinished();
@@ -154,23 +154,23 @@
 	}
 }
 
-LDDocument* DocumentManager::findDocumentByName (QString name)
+LDDocument* DocumentManager::findDocumentByName(QString name)
 {
 	for (LDDocument* document : m_documents)
 	{
-		if (isOneOf (name, document->name(), document->defaultName()))
+		if (isOneOf(name, document->name(), document->defaultName()))
 			return document;
 	}
 
 	return nullptr;
 }
 
-QString Dirname (QString path)
+QString Dirname(QString path)
 {
-	int lastpos = path.lastIndexOf (DIRSLASH);
+	int lastpos = path.lastIndexOf(DIRSLASH);
 
 	if (lastpos > 0)
-		return path.left (lastpos);
+		return path.left(lastpos);
 
 #ifndef _WIN32
 	if (path[0] == DIRSLASH_CHAR)
@@ -180,34 +180,34 @@
 	return "";
 }
 
-QString Basename (QString path)
+QString Basename(QString path)
 {
-	int lastpos = path.lastIndexOf (DIRSLASH);
+	int lastpos = path.lastIndexOf(DIRSLASH);
 
 	if (lastpos != -1)
-		return path.mid (lastpos + 1);
+		return path.mid(lastpos + 1);
 
 	return path;
 }
 
-QString DocumentManager::findDocumentPath (QString relativePath, bool subdirs)
+QString DocumentManager::findDocumentPath(QString relativePath, bool subdirs)
 {
 	// LDraw models use backslashes as path separators. Replace those into forward slashes for Qt.
-	relativePath.replace ("\\", "/");
+	relativePath.replace("\\", "/");
 
 	// Try find it relative to other currently open documents. We want a file in the immediate vicinity of a current
 	// part model to override stock LDraw stuff.
-	QString relativeTopDir = Basename (Dirname (relativePath));
+	QString relativeTopDir = Basename(Dirname(relativePath));
 
 	for (LDDocument* document : m_documents)
 	{
-		QString partpath = format ("%1/%2", Dirname (document->fullPath()), relativePath);
-		QFileInfo fileinfo (partpath);
+		QString partpath = format("%1/%2", Dirname(document->fullPath()), relativePath);
+		QFileInfo fileinfo(partpath);
 
 		if (fileinfo.exists())
 		{
 			// Ensure we don't mix subfiles and 48-primitives with non-subfiles and non-48
-			QString partTopDir = Basename (Dirname (partpath));
+			QString partTopDir = Basename(Dirname(partpath));
 
 			for (QString subdir : g_specialSubdirectories)
 			{
@@ -221,13 +221,13 @@
 		continue;
 	}
 
-	if (QFileInfo::exists (relativePath))
+	if (QFileInfo::exists(relativePath))
 		return relativePath;
 
 	// Try with just the LDraw path first
-	QString fullPath = format ("%1" DIRSLASH "%2", config.lDrawPath(), relativePath);
+	QString fullPath = format("%1" DIRSLASH "%2", config.lDrawPath(), relativePath);
 
-	if (QFileInfo::exists (fullPath))
+	if (QFileInfo::exists(fullPath))
 		return fullPath;
 
 	if (subdirs)
@@ -237,11 +237,11 @@
 		QStringList dirs = { config.lDrawPath(), config.downloadFilePath() };
 		for (const QString& topdir : dirs)
 		{
-			for (const QString& subdir : QStringList ({ "parts", "p" }))
+			for (const QString& subdir : QStringList({ "parts", "p" }))
 			{
-				fullPath = format ("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relativePath);
+				fullPath = format("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relativePath);
 
-				if (QFile::exists (fullPath))
+				if (QFile::exists(fullPath))
 					return fullPath;
 			}
 		}
@@ -251,10 +251,10 @@
 	return "";
 }
 
-QFile* DocumentManager::openLDrawFile (QString relpath, bool subdirs, QString* pathpointer)
+QFile* DocumentManager::openLDrawFile(QString relpath, bool subdirs, QString* pathpointer)
 {
-	print ("Opening %1...\n", relpath);
-	QString path = findDocumentPath (relpath, subdirs);
+	print("Opening %1...\n", relpath);
+	QString path = findDocumentPath(relpath, subdirs);
 
 	if (pathpointer)
 		*pathpointer = path;
@@ -262,24 +262,24 @@
 	if (path.isEmpty())
 		return nullptr;
 
-	QFile* fp = new QFile (path);
+	QFile* fp = new QFile(path);
 
-	if (fp->open (QIODevice::ReadOnly))
+	if (fp->open(QIODevice::ReadOnly))
 		return fp;
 
 	fp->deleteLater();
 	return nullptr;
 }
 
-LDObjectList DocumentManager::loadFileContents (QFile* fp, int* numWarnings, bool* ok)
+LDObjectList DocumentManager::loadFileContents(QFile* fp, int* numWarnings, bool* ok)
 {
 	LDObjectList objs;
 
 	if (numWarnings)
 		*numWarnings = 0;
 
-	DocumentLoader* loader = new DocumentLoader (m_loadingMainFile);
-	loader->read (fp);
+	DocumentLoader* loader = new DocumentLoader(m_loadingMainFile);
+	loader->read(fp);
 	loader->start();
 
 	// After start() returns, if the loader isn't done yet, it's delaying
@@ -298,7 +298,7 @@
 	return objs;
 }
 
-LDDocument* DocumentManager::openDocument (QString path, bool search, bool implicit, LDDocument* fileToOverride, bool* aborted)
+LDDocument* DocumentManager::openDocument(QString path, bool search, bool implicit, LDDocument* fileToOverride, bool* aborted)
 {
 	// Convert the file name to lowercase when searching because some parts contain subfile
 	// subfile references with uppercase file names. I'll assume here that the library will always
@@ -308,14 +308,14 @@
 
 	if (search)
 	{
-		fp = openLDrawFile (path.toLower(), true, &fullpath);
+		fp = openLDrawFile(path.toLower(), true, &fullpath);
 	}
 	else
 	{
-		fp = new QFile (path);
+		fp = new QFile(path);
 		fullpath = path;
 
-		if (not fp->open (QIODevice::ReadOnly))
+		if (not fp->open(QIODevice::ReadOnly))
 		{
 			delete fp;
 			return nullptr;
@@ -325,16 +325,16 @@
 	if (not fp)
 		return nullptr;
 
-	LDDocument* load = (fileToOverride ? fileToOverride : m_window->newDocument (implicit));
-	load->setFullPath (fullpath);
-	load->setName (LDDocument::shortenName (load->fullPath()));
+	LDDocument* load = (fileToOverride ? fileToOverride : m_window->newDocument(implicit));
+	load->setFullPath(fullpath);
+	load->setName(LDDocument::shortenName(load->fullPath()));
 
 	// Loading the file shouldn't count as actual edits to the document.
-	load->history()->setIgnoring (true);
+	load->history()->setIgnoring(true);
 
 	int numWarnings;
 	bool ok;
-	LDObjectList objs = loadFileContents (fp, &numWarnings, &ok);
+	LDObjectList objs = loadFileContents(fp, &numWarnings, &ok);
 	fp->close();
 	fp->deleteLater();
 
@@ -347,23 +347,23 @@
 		return nullptr;
 	}
 
-	load->addObjects (objs);
+	load->addObjects(objs);
 
 	if (m_loadingMainFile)
 	{
-		m_window->changeDocument (load);
-		m_window->renderer()->setDocument (load);
-		print (tr ("File %1 parsed successfully (%2 errors)."), path, numWarnings);
+		m_window->changeDocument(load);
+		m_window->renderer()->setDocument(load);
+		print(tr("File %1 parsed successfully(%2 errors)."), path, numWarnings);
 	}
 
-	load->history()->setIgnoring (false);
+	load->history()->setIgnoring(false);
 	return load;
 }
 
-void DocumentManager::addRecentFile (QString path)
+void DocumentManager::addRecentFile(QString path)
 {
 	QStringList recentFiles = config.recentFiles();
-	int idx = recentFiles.indexOf (path);
+	int idx = recentFiles.indexOf(path);
 
 	// If this file already is in the list, pop it out.
 	if (idx != -1)
@@ -371,16 +371,16 @@
 		if (idx == recentFiles.size() - 1)
 			return; // first recent file - abort and do nothing
 
-		recentFiles.removeAt (idx);
+		recentFiles.removeAt(idx);
 	}
 
 	// If there's too many recent files, drop one out.
-	while (recentFiles.size() > (MaxRecentFiles - 1))
-		recentFiles.removeAt (0);
+	while (recentFiles.size() >(MaxRecentFiles - 1))
+		recentFiles.removeAt(0);
 
 	// Add the file
 	recentFiles << path;
-	config.setRecentFiles (recentFiles);
+	config.setRecentFiles(recentFiles);
 	m_window->syncSettings();
 	m_window->updateRecentFilesMenu();
 }
@@ -398,19 +398,19 @@
 
 void DocumentManager::loadLogoedStuds()
 {
-	if (m_isLoadingLogoedStuds or (m_logoedStud and m_logoedStud2))
+	if (m_isLoadingLogoedStuds or(m_logoedStud and m_logoedStud2))
 		return;
 
 	m_isLoadingLogoedStuds = true;
-	m_logoedStud = openDocument ("stud-logo.dat", true, true);
-	m_logoedStud2 = openDocument ("stud2-logo.dat", true, true);
+	m_logoedStud = openDocument("stud-logo.dat", true, true);
+	m_logoedStud2 = openDocument("stud2-logo.dat", true, true);
 	m_isLoadingLogoedStuds = false;
 
 	if (m_logoedStud and m_logoedStud2)
-		print (tr ("Logoed studs loaded.\n"));
+		print(tr("Logoed studs loaded.\n"));
 }
 
-bool DocumentManager::preInline (LDDocument* doc, LDObjectList& objs, bool deep, bool renderinline)
+bool DocumentManager::preInline(LDDocument* doc, LDObjectList& objs, bool deep, bool renderinline)
 {
 	// Possibly substitute with logoed studs:
 	// stud.dat -> stud-logo.dat
@@ -422,12 +422,12 @@
 
 		if (doc->name() == "stud.dat" and m_logoedStud)
 		{
-			objs = m_logoedStud->inlineContents (deep, renderinline);
+			objs = m_logoedStud->inlineContents(deep, renderinline);
 			return true;
 		}
 		else if (doc->name() == "stud2.dat" and m_logoedStud2)
 		{
-			objs = m_logoedStud2->inlineContents (deep, renderinline);
+			objs = m_logoedStud2->inlineContents(deep, renderinline);
 			return true;
 		}
 	}
@@ -436,7 +436,7 @@
 
 LDDocument* DocumentManager::createNew()
 {
-	LDDocument* document = new LDDocument (this);
-	m_documents.insert (document);
+	LDDocument* document = new LDDocument(this);
+	m_documents.insert(document);
 	return document;
 }
--- a/src/documentmanager.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/documentmanager.h	Thu Jan 04 19:44:26 2018 +0200
@@ -28,23 +28,23 @@
 public:
 	using Documents = QSet<LDDocument*>;
 
-	DocumentManager (QObject* parent = nullptr);
+	DocumentManager(QObject* parent = nullptr);
 	~DocumentManager();
 
-	void addRecentFile (QString path);
+	void addRecentFile(QString path);
 	const Documents& allDocuments() const { return m_documents; }
 	void clear();
 	LDDocument* createNew();
-	LDDocument* findDocumentByName (QString name);
-	QString findDocumentPath (QString relpath, bool subdirs);
-	LDDocument* getDocumentByName (QString filename);
+	LDDocument* findDocumentByName(QString name);
+	QString findDocumentPath(QString relpath, bool subdirs);
+	LDDocument* getDocumentByName(QString filename);
 	bool isSafeToCloseAll();
-	LDObjectList loadFileContents (QFile* fp, int* numWarnings, bool* ok);
+	LDObjectList loadFileContents(QFile* fp, int* numWarnings, bool* ok);
 	void loadLogoedStuds();
-	LDDocument* openDocument (QString path, bool search, bool implicit, LDDocument* fileToOverride = nullptr, bool* aborted = nullptr);
-	QFile* openLDrawFile (QString relpath, bool subdirs, QString* pathpointer);
-	void openMainModel (QString path);
-	bool preInline (LDDocument* doc, LDObjectList&, bool deep, bool renderinline);
+	LDDocument* openDocument(QString path, bool search, bool implicit, LDDocument* fileToOverride = nullptr, bool* aborted = nullptr);
+	QFile* openLDrawFile(QString relpath, bool subdirs, QString* pathpointer);
+	void openMainModel(QString path);
+	bool preInline(LDDocument* doc, LDObjectList&, bool deep, bool renderinline);
 
 private:
 	Documents m_documents;
@@ -54,6 +54,6 @@
 	LDDocument* m_logoedStud2;
 };
 
-QString Basename (QString path);
-QString Dirname (QString path);
-static const QStringList g_specialSubdirectories ({ "s", "48", "8" });
\ No newline at end of file
+QString Basename(QString path);
+QString Dirname(QString path);
+static const QStringList g_specialSubdirectories({ "s", "48", "8" });
\ No newline at end of file
--- a/src/doublemap.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/doublemap.h	Thu Jan 04 19:44:26 2018 +0200
@@ -29,74 +29,74 @@
 		m_reverseMap.clear();
 	}
 
-	void insert (const Key& key, const Value& value)
+	void insert(const Key& key, const Value& value)
 	{
 		m_map[key] = value;
 		m_reverseMap[value] = key;
 	}
 
-	bool containsKey (const Key& key) const
+	bool containsKey(const Key& key) const
 	{
-		return m_map.contains (key);
+		return m_map.contains(key);
 	}
 
-	bool containsValue (const Value& value) const
+	bool containsValue(const Value& value) const
 	{
-		return m_reverseMap.contains (value);
+		return m_reverseMap.contains(value);
 	}
 
-	void removeKey (const Key& key)
+	void removeKey(const Key& key)
 	{
-		m_reverseMap.remove (m_map[key]);
-		m_map.remove (key);
+		m_reverseMap.remove(m_map[key]);
+		m_map.remove(key);
 	}
 
-	void removeValue (const Key& key)
+	void removeValue(const Key& key)
 	{
-		m_reverseMap.remove (m_map[key]);
-		m_map.remove (key);
+		m_reverseMap.remove(m_map[key]);
+		m_map.remove(key);
 	}
 
-	Value& lookup (const Key& key)
+	Value& lookup(const Key& key)
 	{
 		return m_map[key];
 	}
 
-	const Value& lookup (const Key& key) const
+	const Value& lookup(const Key& key) const
 	{
 		return m_map[key];
 	}
 
-	Key& reverseLookup (const Value& key)
+	Key& reverseLookup(const Value& key)
 	{
 		return m_reverseMap[key];
 	}
 
-	const Key& reverseLookup (const Value& key) const
+	const Key& reverseLookup(const Value& key) const
 	{
 		return m_reverseMap[key];
 	}
 
-	Value* find (const Key& key)
+	Value* find(const Key& key)
 	{
-		auto iterator = m_map.find (key);
+		auto iterator = m_map.find(key);
 		return iterator == m_map.end() ? NULL : &(*iterator);
 	}
 
-	Key* reverseFind (const Value& value)
+	Key* reverseFind(const Value& value)
 	{
-		auto iterator = m_reverseMap.find (value);
+		auto iterator = m_reverseMap.find(value);
 		return iterator == m_reverseMap.end() ? NULL : &(*iterator);
 	}
 
-	Value& operator[] (const Key& key)
+	Value& operator[](const Key& key)
 	{
-		return lookup (key);
+		return lookup(key);
 	}
 
-	const Value& operator[] (const Key& key) const
+	const Value& operator[](const Key& key) const
 	{
-		return lookup (key);
+		return lookup(key);
 	}
 
 private:
--- a/src/editHistory.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editHistory.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -23,10 +23,10 @@
 #include "mainwindow.h"
 #include "glRenderer.h"
 
-EditHistory::EditHistory (LDDocument* document) :
-	m_document (document),
-	m_isIgnoring (false),
-	m_position (-1) {}
+EditHistory::EditHistory(LDDocument* document) :
+	m_document(document),
+	m_isIgnoring(false),
+	m_position(-1) {}
 
 void EditHistory::undo()
 {
@@ -34,8 +34,8 @@
 		return;
 
 	// Don't take the changes done here as actual edits to the document
-	setIgnoring (true);
-	const Changeset& set = changesetAt (position());
+	setIgnoring(true);
+	const Changeset& set = changesetAt(position());
 
 	// Iterate the list in reverse and undo all actions
 	for (int i = set.size() - 1; i >= 0; --i)
@@ -45,7 +45,7 @@
 	}
 
 	m_position--;
-	setIgnoring (false);
+	setIgnoring(false);
 	emit undone();
 }
 
@@ -54,15 +54,15 @@
 	if (position() == m_changesets.size())
 		return;
 
-	setIgnoring (true);
-	const Changeset& set = changesetAt (position() + 1);
+	setIgnoring(true);
+	const Changeset& set = changesetAt(position() + 1);
 
 	// Redo things in original order
 	for (const AbstractHistoryEntry* change : set)
 		change->redo();
 
 	++m_position;
-	setIgnoring (false);
+	setIgnoring(false);
 	emit redone();
 }
 
@@ -96,7 +96,7 @@
 	emit stepAdded();
 }
 
-void EditHistory::add (AbstractHistoryEntry* entry)
+void EditHistory::add(AbstractHistoryEntry* entry)
 {
 	if (isIgnoring())
 	{
@@ -104,7 +104,7 @@
 		return;
 	}
 
-	entry->setParent (this);
+	entry->setParent(this);
 	m_currentChangeset << entry;
 }
 
@@ -113,7 +113,7 @@
 	return m_changesets.size();
 }
 
-const EditHistory::Changeset& EditHistory::changesetAt (int pos) const
+const EditHistory::Changeset& EditHistory::changesetAt(int pos) const
 {
 	return m_changesets[pos];
 }
@@ -128,7 +128,7 @@
 	return m_isIgnoring;
 }
 
-void EditHistory::setIgnoring (bool value)
+void EditHistory::setIgnoring(bool value)
 {
 	m_isIgnoring = value;
 }
@@ -150,7 +150,7 @@
 	return m_parent;
 }
 
-void AbstractHistoryEntry::setParent (EditHistory* parent)
+void AbstractHistoryEntry::setParent(EditHistory* parent)
 {
 	m_parent = parent;
 }
@@ -159,26 +159,26 @@
 // ---------------------------------------------------------------------------------------------------------------------
 //
 
-AddHistoryEntry::AddHistoryEntry (int idx, LDObject* obj) :
-	m_index (idx),
-	m_code (obj->asText()) {}
+AddHistoryEntry::AddHistoryEntry(int idx, LDObject* obj) :
+	m_index(idx),
+	m_code(obj->asText()) {}
 
 void AddHistoryEntry::undo() const
 {
-	parent()->document()->getObject (m_index)->destroy();
+	parent()->document()->getObject(m_index)->destroy();
 }
 
 void AddHistoryEntry::redo() const
 {
-	parent()->document()->insertObj (m_index, ParseLine (m_code));
+	parent()->document()->insertObj(m_index, ParseLine(m_code));
 }
 
 //
 // ---------------------------------------------------------------------------------------------------------------------
 //
 
-DelHistoryEntry::DelHistoryEntry (int idx, LDObject* obj) :
-	AddHistoryEntry (idx, obj) {}
+DelHistoryEntry::DelHistoryEntry(int idx, LDObject* obj) :
+	AddHistoryEntry(idx, obj) {}
 
 void DelHistoryEntry::undo() const
 {
@@ -194,37 +194,37 @@
 // ---------------------------------------------------------------------------------------------------------------------
 //
 
-EditHistoryEntry::EditHistoryEntry (int idx, QString oldCode, QString newCode) :
-	m_index (idx),
-	m_oldCode (oldCode),
-	m_newCode (newCode) {}
+EditHistoryEntry::EditHistoryEntry(int idx, QString oldCode, QString newCode) :
+	m_index(idx),
+	m_oldCode(oldCode),
+	m_newCode(newCode) {}
 
 void EditHistoryEntry::undo() const
 {
-	LDObject* obj = parent()->document()->getObject (m_index);
-	LDObject* newobj = ParseLine (m_oldCode);
-	obj->replace (newobj);
+	LDObject* obj = parent()->document()->getObject(m_index);
+	LDObject* newobj = ParseLine(m_oldCode);
+	obj->replace(newobj);
 }
 
 void EditHistoryEntry::redo() const
 {
-	LDObject* obj = parent()->document()->getObject (m_index);
-	LDObject* newobj = ParseLine (m_newCode);
-	obj->replace (newobj);
+	LDObject* obj = parent()->document()->getObject(m_index);
+	LDObject* newobj = ParseLine(m_newCode);
+	obj->replace(newobj);
 }
 
 //
 // ---------------------------------------------------------------------------------------------------------------------
 //
 
-SwapHistoryEntry::SwapHistoryEntry (int a, int b) :
-	m_a (a),
-	m_b (b) {}
+SwapHistoryEntry::SwapHistoryEntry(int a, int b) :
+	m_a(a),
+	m_b(b) {}
 
 
 void SwapHistoryEntry::undo() const
 {
-	LDObject::fromID (m_a)->swap (LDObject::fromID (m_b));
+	LDObject::fromID(m_a)->swap(LDObject::fromID(m_b));
 }
 
 void SwapHistoryEntry::redo() const
--- a/src/editHistory.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editHistory.h	Thu Jan 04 19:44:26 2018 +0200
@@ -29,17 +29,17 @@
 public:
 	using Changeset = QList<AbstractHistoryEntry*>;
 
-	EditHistory (LDDocument* document);
+	EditHistory(LDDocument* document);
 
-	void add (AbstractHistoryEntry* entry);
+	void add(AbstractHistoryEntry* entry);
 	void addStep();
-	const Changeset& changesetAt (int pos) const;
+	const Changeset& changesetAt(int pos) const;
 	void clear();
 	LDDocument* document() const;
 	bool isIgnoring() const;
 	int position();
 	void redo();
-	void setIgnoring (bool value);
+	void setIgnoring(bool value);
 	int size() const;
 	void undo();
 
@@ -64,7 +64,7 @@
 
 	EditHistory* parent() const;
 	virtual void redo() const = 0;
-	void setParent (EditHistory* parent);
+	void setParent(EditHistory* parent);
 	virtual void undo() const = 0;
 
 private:
@@ -74,7 +74,7 @@
 class AddHistoryEntry : public AbstractHistoryEntry
 {
 public:
-	AddHistoryEntry (int idx, LDObject* obj);
+	AddHistoryEntry(int idx, LDObject* obj);
 	void undo() const override;
 	void redo() const override;
 	
@@ -86,7 +86,7 @@
 class DelHistoryEntry : public AddHistoryEntry
 {
 public:
-	DelHistoryEntry (int idx, LDObject* obj);
+	DelHistoryEntry(int idx, LDObject* obj);
 	void undo() const override;
 	void redo() const override;
 };
@@ -94,7 +94,7 @@
 class EditHistoryEntry : public AbstractHistoryEntry
 {
 public:
-	EditHistoryEntry (int idx, QString oldCode, QString newCode);
+	EditHistoryEntry(int idx, QString oldCode, QString newCode);
 	void undo() const override;
 	void redo() const override;
 	
@@ -107,7 +107,7 @@
 class SwapHistoryEntry : public AbstractHistoryEntry
 {
 public:
-	SwapHistoryEntry (int a, int b);
+	SwapHistoryEntry(int a, int b);
 	void undo() const override;
 	void redo() const override;
 
--- a/src/editmodes/abstractEditMode.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/abstractEditMode.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -30,30 +30,30 @@
 #include "../glRenderer.h"
 #include "../miscallenous.h"
 
-ConfigOption (bool DrawLineLengths = true)
-ConfigOption (bool DrawAngles = false)
+ConfigOption(bool DrawLineLengths = true)
+ConfigOption(bool DrawAngles = false)
 
-AbstractEditMode::AbstractEditMode (GLRenderer* renderer) :
-	QObject (renderer),
-	HierarchyElement (renderer),
-	m_renderer (renderer) {}
+AbstractEditMode::AbstractEditMode(GLRenderer* renderer) :
+	QObject(renderer),
+	HierarchyElement(renderer),
+	m_renderer(renderer) {}
 
 AbstractEditMode::~AbstractEditMode() {}
 
-AbstractEditMode* AbstractEditMode::createByType (GLRenderer* renderer, EditModeType type)
+AbstractEditMode* AbstractEditMode::createByType(GLRenderer* renderer, EditModeType type)
 {
-	switch (type)
+	switch(type)
 	{
-	case EditModeType::Select: return new SelectMode (renderer);
-	case EditModeType::Draw: return new DrawMode (renderer);
-	case EditModeType::Rectangle: return new RectangleMode (renderer);
-	case EditModeType::Circle: return new CircleMode (renderer);
-	case EditModeType::MagicWand: return new MagicWandMode (renderer);
-	case EditModeType::LinePath: return new LinePathMode (renderer);
-	case EditModeType::Curve: return new CurveMode (renderer);
+	case EditModeType::Select: return new SelectMode(renderer);
+	case EditModeType::Draw: return new DrawMode(renderer);
+	case EditModeType::Rectangle: return new RectangleMode(renderer);
+	case EditModeType::Circle: return new CircleMode(renderer);
+	case EditModeType::MagicWand: return new MagicWandMode(renderer);
+	case EditModeType::LinePath: return new LinePathMode(renderer);
+	case EditModeType::Curve: return new CurveMode(renderer);
 	}
 
-	throw std::logic_error ("bad type given to AbstractEditMode::createByType");
+	throw std::logic_error("bad type given to AbstractEditMode::createByType");
 }
 
 GLRenderer* AbstractEditMode::renderer() const
@@ -61,53 +61,53 @@
 	return m_renderer;
 }
 
-AbstractDrawMode::AbstractDrawMode (GLRenderer* renderer) :
-	AbstractEditMode (renderer),
-	m_polybrush (QBrush (QColor (64, 192, 0, 128)))
+AbstractDrawMode::AbstractDrawMode(GLRenderer* renderer) :
+	AbstractEditMode(renderer),
+	m_polybrush(QBrush(QColor(64, 192, 0, 128)))
 {
-	renderer->setContextMenuPolicy (Qt::NoContextMenu); // We need the right mouse button for removing vertices
-	renderer->setCursor (Qt::CrossCursor);
+	renderer->setContextMenuPolicy(Qt::NoContextMenu); // We need the right mouse button for removing vertices
+	renderer->setCursor(Qt::CrossCursor);
 	m_window->currentDocument()->clearSelection();
 	m_window->updateSelection();
 	m_drawedVerts.clear();
 }
 
-AbstractSelectMode::AbstractSelectMode (GLRenderer* renderer) :
-	AbstractEditMode (renderer)
+AbstractSelectMode::AbstractSelectMode(GLRenderer* renderer) :
+	AbstractEditMode(renderer)
 {
 	renderer->unsetCursor();
-	renderer->setContextMenuPolicy (Qt::DefaultContextMenu);
+	renderer->setContextMenuPolicy(Qt::DefaultContextMenu);
 }
 
 // =============================================================================
 //
-void AbstractDrawMode::addDrawnVertex (Vertex const& pos)
+void AbstractDrawMode::addDrawnVertex(Vertex const& pos)
 {
-	if (preAddVertex (pos))
+	if (preAddVertex(pos))
 		return;
 
 	m_drawedVerts << pos;
 }
 
-bool AbstractDrawMode::mouseReleased (MouseEventData const& data)
+bool AbstractDrawMode::mouseReleased(MouseEventData const& data)
 {
-	if (Super::mouseReleased (data))
+	if (Super::mouseReleased(data))
 		return true;
 
-	if ((data.releasedButtons & Qt::MidButton) and (m_drawedVerts.size() < 4) and (not data.mouseMoved))
+	if ((data.releasedButtons & Qt::MidButton) and(m_drawedVerts.size() < 4) and(not data.mouseMoved))
 	{
 		// Find the closest vertex to our cursor
 		double			minimumDistance = 1024.0;
 		const Vertex*	closest = nullptr;
-		Vertex			cursorPosition = renderer()->convert2dTo3d (data.ev->pos(), false);
-		QPoint			cursorPosition2D (data.ev->pos());
+		Vertex			cursorPosition = renderer()->convert2dTo3d(data.ev->pos(), false);
+		QPoint			cursorPosition2D(data.ev->pos());
 		const Axis		relZ = renderer()->getRelativeZ();
 		QVector<Vertex>	vertices = renderer()->document()->inlineVertices();
 
 		// Sort the vertices in order of distance to camera
-		std::sort (vertices.begin(), vertices.end(), [&](const Vertex& a, const Vertex& b) -> bool
+		std::sort(vertices.begin(), vertices.end(), [&](const Vertex& a, const Vertex& b) -> bool
 		{
-			if (renderer()->getFixedCamera (renderer()->camera()).negatedDepth)
+			if (renderer()->getFixedCamera(renderer()->camera()).negatedDepth)
 				return a[relZ] > b[relZ];
 
 			return a[relZ] < b[relZ];
@@ -116,8 +116,8 @@
 		for (const Vertex& vrt : vertices)
 		{
 			// If the vertex in 2d space is very close to the cursor then we use it regardless of depth.
-			QPoint vect2d = renderer()->convert3dTo2d (vrt) - cursorPosition2D;
-			const double distance2DSquared = std::pow (vect2d.x(), 2) + std::pow (vect2d.y(), 2);
+			QPoint vect2d = renderer()->convert3dTo2d(vrt) - cursorPosition2D;
+			const double distance2DSquared = std::pow(vect2d.x(), 2) + std::pow(vect2d.y(), 2);
 			if (distance2DSquared < 16.0 * 16.0)
 			{
 				closest = &vrt;
@@ -140,12 +140,12 @@
 		}
 
 		if (closest)
-			addDrawnVertex (*closest);
+			addDrawnVertex(*closest);
 
 		return true;
 	}
 
-	if ((data.releasedButtons & Qt::RightButton) and (not m_drawedVerts.isEmpty()))
+	if ((data.releasedButtons & Qt::RightButton) and(not m_drawedVerts.isEmpty()))
 	{
 		// Remove the last vertex
 		m_drawedVerts.removeLast();
@@ -160,14 +160,14 @@
 			return true;
 		}
 
-		addDrawnVertex (getCursorVertex());
+		addDrawnVertex(getCursorVertex());
 		return true;
 	}
 
 	return false;
 }
 
-void AbstractDrawMode::finishDraw (LDObjectList const& objs)
+void AbstractDrawMode::finishDraw(LDObjectList const& objs)
 {
 	int pos = m_window->suggestInsertPoint();
 
@@ -175,8 +175,8 @@
 	{
 		for (LDObject* obj : objs)
 		{
-			renderer()->document()->insertObj (pos++, obj);
-			renderer()->compileObject (obj);
+			renderer()->document()->insertObj(pos++, obj);
+			renderer()->compileObject(obj);
 		}
 
 		m_window->refresh();
@@ -186,74 +186,74 @@
 	m_drawedVerts.clear();
 }
 
-void AbstractDrawMode::drawLength (QPainter &painter, const Vertex &v0, const Vertex &v1,
+void AbstractDrawMode::drawLength(QPainter &painter, const Vertex &v0, const Vertex &v1,
 	const QPointF& v0p, const QPointF& v1p) const
 {
 	if (not config.drawLineLengths())
 		return;
 
-	const QString label = QString::number ((v1 - v0).length());
-	QPoint origin = QLineF (v0p, v1p).pointAt (0.5).toPoint();
-	painter.drawText (origin, label);
+	const QString label = QString::number((v1 - v0).length());
+	QPoint origin = QLineF(v0p, v1p).pointAt(0.5).toPoint();
+	painter.drawText(origin, label);
 }
 
-void AbstractDrawMode::renderPolygon (QPainter& painter, const QVector<Vertex>& poly3d,
+void AbstractDrawMode::renderPolygon(QPainter& painter, const QVector<Vertex>& poly3d,
 	bool withlengths, bool withangles) const
 {
-	QVector<QPoint> poly (poly3d.size());
-	QFontMetrics metrics = QFontMetrics (QFont());
+	QVector<QPoint> poly(poly3d.size());
+	QFontMetrics metrics = QFontMetrics(QFont());
 
 	// Convert to 2D
 	for (int i = 0; i < poly3d.size(); ++i)
-		poly[i] = renderer()->convert3dTo2d (poly3d[i]);
+		poly[i] = renderer()->convert3dTo2d(poly3d[i]);
 
 	// Draw the polygon-to-be
-	painter.setBrush (m_polybrush);
-	painter.drawPolygon (QPolygonF (poly));
+	painter.setBrush(m_polybrush);
+	painter.drawPolygon(QPolygonF(poly));
 
 	// Draw vertex blips
 	for (int i = 0; i < poly3d.size(); ++i)
 	{
-		renderer()->drawBlip (painter, poly[i]);
-		renderer()->drawBlipCoordinates (painter, poly3d[i], poly[i]);
+		renderer()->drawBlip(painter, poly[i]);
+		renderer()->drawBlipCoordinates(painter, poly3d[i], poly[i]);
 	}
 
 	// Draw line lenghts and angle info if appropriate
-	if (poly3d.size() >= 2 and (withlengths or withangles))
+	if (poly3d.size() >= 2 and(withlengths or withangles))
 	{
-		painter.setPen (renderer()->textPen());
+		painter.setPen(renderer()->textPen());
 
 		for (int i = 0; i < poly3d.size(); ++i)
 		{
 			const int j = (i + 1) % poly3d.size();
-			const int h = (i - 1 >= 0) ? (i - 1) : (poly3d.size() - 1);
+			const int h = (i - 1 >= 0) ?(i - 1) :(poly3d.size() - 1);
 
 			if (withlengths)
-				drawLength (painter, poly3d[i], poly3d[j], poly[i], poly[j]);
+				drawLength(painter, poly3d[i], poly3d[j], poly[i], poly[j]);
 
 			if (withangles and config.drawAngles())
 			{
-				QLineF l0 (poly[h], poly[i]),
-					l1 (poly[i], poly[j]);
+				QLineF l0(poly[h], poly[i]),
+					l1(poly[i], poly[j]);
 
-				double angle = 180 - l0.angleTo (l1);
+				double angle = 180 - l0.angleTo(l1);
 
 				if (angle < 0)
-					angle = 180 - l1.angleTo (l0);
+					angle = 180 - l1.angleTo(l0);
 
-				QString label = QString::number (angle) + QString::fromUtf8 (QByteArray ("\302\260"));
+				QString label = QString::number(angle) + QString::fromUtf8(QByteArray("\302\260"));
 				QPoint pos = poly[i];
-				pos.setY (pos.y() + metrics.height());
+				pos.setY(pos.y() + metrics.height());
 
-				painter.drawText (pos, label);
+				painter.drawText(pos, label);
 			}
 		}
 	}
 }
 
-bool AbstractDrawMode::keyReleased (QKeyEvent *ev)
+bool AbstractDrawMode::keyReleased(QKeyEvent *ev)
 {
-	if (Super::keyReleased (ev))
+	if (Super::keyReleased(ev))
 		return true;
 
 	if (not m_drawedVerts.isEmpty() and ev->key() == Qt::Key_Backspace)
@@ -266,11 +266,11 @@
 }
 
 template<typename T>
-T intervalClamp (T a, T interval)
+T intervalClamp(T a, T interval)
 {
 	T remainder = a % interval;
 
-	if (remainder >= float (interval / 2))
+	if (remainder >= float(interval / 2))
 		a += interval;
 
 	a -= remainder;
@@ -288,11 +288,11 @@
 		Vertex const& v1 = result;
 		Axis relX, relY;
 
-		renderer()->getRelativeAxes (relX, relY);
-		QLineF ln (v0[relX], v0[relY], v1[relX], v1[relY]);
-		ln.setAngle (intervalClamp<int> (ln.angle(), 45));
-		result.setCoordinate (relX, Grid::Snap (ln.x2(), Grid::Coordinate));
-		result.setCoordinate (relY, Grid::Snap (ln.y2(), Grid::Coordinate));
+		renderer()->getRelativeAxes(relX, relY);
+		QLineF ln(v0[relX], v0[relY], v1[relX], v1[relY]);
+		ln.setAngle(intervalClamp<int>(ln.angle(), 45));
+		result.setCoordinate(relX, Grid::Snap(ln.x2(), Grid::Coordinate));
+		result.setCoordinate(relY, Grid::Snap(ln.y2(), Grid::Coordinate));
 	}
 
 	return result;
--- a/src/editmodes/abstractEditMode.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/abstractEditMode.h	Thu Jan 04 19:44:26 2018 +0200
@@ -48,20 +48,20 @@
 		Qt::MouseButtons releasedButtons;
 	};
 
-	AbstractEditMode (GLRenderer* renderer);
+	AbstractEditMode(GLRenderer* renderer);
 	virtual ~AbstractEditMode();
 
 	virtual bool			allowFreeCamera() const = 0;
-	virtual void			render (QPainter&) const {}
+	virtual void			render(QPainter&) const {}
 	GLRenderer*				renderer() const;
 	virtual EditModeType	type() const = 0;
-	virtual bool			mousePressed (QMouseEvent*) { return false; }
-	virtual bool			mouseReleased (MouseEventData const&) { return false; }
-	virtual bool			mouseDoubleClicked (QMouseEvent*) { return false; }
-	virtual bool			mouseMoved (QMouseEvent*) { return false; }
-	virtual bool			keyReleased (QKeyEvent*) { return false; }
+	virtual bool			mousePressed(QMouseEvent*) { return false; }
+	virtual bool			mouseReleased(MouseEventData const&) { return false; }
+	virtual bool			mouseDoubleClicked(QMouseEvent*) { return false; }
+	virtual bool			mouseMoved(QMouseEvent*) { return false; }
+	virtual bool			keyReleased(QKeyEvent*) { return false; }
 
-	static AbstractEditMode* createByType (GLRenderer* renderer, EditModeType type);
+	static AbstractEditMode* createByType(GLRenderer* renderer, EditModeType type);
 
 private:
 	GLRenderer* m_renderer;
@@ -72,28 +72,28 @@
 //
 class AbstractDrawMode : public AbstractEditMode
 {
-	DEFINE_CLASS (AbstractDrawMode, AbstractEditMode)
+	DEFINE_CLASS(AbstractDrawMode, AbstractEditMode)
 
 protected:
 	QList<Vertex>			m_drawedVerts;
 	QBrush					m_polybrush;
 
 public:
-	AbstractDrawMode (GLRenderer* renderer);
+	AbstractDrawMode(GLRenderer* renderer);
 
-	void addDrawnVertex (const Vertex& pos);
+	void addDrawnVertex(const Vertex& pos);
 	virtual bool allowFreeCamera() const override final { return false; }
 	virtual void endDraw() {}
-	void drawLength (QPainter& painter,
+	void drawLength(QPainter& painter,
 		const Vertex& v0, const Vertex& v1,
 		const QPointF& v0p, const QPointF& v1p) const;
-	void finishDraw (const LDObjectList& objs);
+	void finishDraw(const LDObjectList& objs);
 	Vertex getCursorVertex() const;
-	bool keyReleased (QKeyEvent* ev) override;
+	bool keyReleased(QKeyEvent* ev) override;
 	virtual int maxVertices() const { return 0; }
-	bool mouseReleased (const AbstractEditMode::MouseEventData& data) override;
-	virtual bool preAddVertex (Vertex const&) { return false; }
-	void renderPolygon (QPainter& painter, const QVector<Vertex>& poly3d, bool withlengths, bool withangles) const;
+	bool mouseReleased(const AbstractEditMode::MouseEventData& data) override;
+	virtual bool preAddVertex(Vertex const&) { return false; }
+	void renderPolygon(QPainter& painter, const QVector<Vertex>& poly3d, bool withlengths, bool withangles) const;
 };
 
 //
@@ -101,10 +101,10 @@
 //
 class AbstractSelectMode : public AbstractEditMode
 {
-	DEFINE_CLASS (AbstractSelectMode, AbstractEditMode)
+	DEFINE_CLASS(AbstractSelectMode, AbstractEditMode)
 
 public:
-	AbstractSelectMode (GLRenderer* renderer);
+	AbstractSelectMode(GLRenderer* renderer);
 
 	virtual bool allowFreeCamera() const override
 	{
--- a/src/editmodes/circleMode.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/circleMode.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -27,31 +27,31 @@
 #include "../mainwindow.h"
 #include "../ldObjectMath.h"
 
-CircleMode::CircleMode (GLRenderer* renderer) :
-	Super (renderer) {}
+CircleMode::CircleMode(GLRenderer* renderer) :
+	Super(renderer) {}
 
 EditModeType CircleMode::type() const
 {
 	return EditModeType::Circle;
 }
 
-double CircleMode::getCircleDrawDist (int pos) const
+double CircleMode::getCircleDrawDist(int pos) const
 {
 	if (m_drawedVerts.size() >= pos + 1)
 	{
 		Vertex v1 = (m_drawedVerts.size() >= pos + 2) ? m_drawedVerts[pos + 1] :
-			renderer()->convert2dTo3d (renderer()->mousePosition(), false);
+			renderer()->convert2dTo3d(renderer()->mousePosition(), false);
 		Axis localx, localy;
-		renderer()->getRelativeAxes (localx, localy);
+		renderer()->getRelativeAxes(localx, localy);
 		double dx = m_drawedVerts[0][localx] - v1[localx];
 		double dy = m_drawedVerts[0][localy] - v1[localy];
-		return Grid::Snap (sqrt ((dx * dx) + (dy * dy)), Grid::Coordinate);
+		return Grid::Snap(sqrt((dx * dx) +(dy * dy)), Grid::Coordinate);
 	}
 
 	return 0.0;
 }
 
-Matrix CircleMode::getCircleDrawMatrix (double scale)
+Matrix CircleMode::getCircleDrawMatrix(double scale)
 {
 	// Matrix templates. 2 is substituted with the scale value, 1 is inverted to -1 if needed.
 	static const Matrix templates[3] =
@@ -77,42 +77,42 @@
 void CircleMode::buildCircle()
 {
 	LDObjectList objs;
-	const int segments (m_window->ringToolSegments());
-	const int divisions (m_window->ringToolHiRes() ? HighResolution : LowResolution);
-	double dist0 (getCircleDrawDist (0));
-	double dist1 (getCircleDrawDist (1));
+	const int segments(m_window->ringToolSegments());
+	const int divisions(m_window->ringToolHiRes() ? HighResolution : LowResolution);
+	double dist0(getCircleDrawDist(0));
+	double dist1(getCircleDrawDist(1));
 	LDDocument* refFile;
 	Matrix transform;
 	bool circleOrDisc = false;
 
 	if (dist1 < dist0)
-		qSwap (dist0, dist1);
+		qSwap(dist0, dist1);
 
 	if (dist0 == dist1)
 	{
 		// If the radii are the same, there's no ring space to fill. Use a circle.
-		refFile = GetPrimitive (::Circle, segments, divisions, 0);
-		transform = getCircleDrawMatrix (dist0);
+		refFile = GetPrimitive(::Circle, segments, divisions, 0);
+		transform = getCircleDrawMatrix(dist0);
 		circleOrDisc = true;
 	}
 	else if (dist0 == 0 or dist1 == 0)
 	{
 		// If either radii is 0, use a disc.
-		refFile = GetPrimitive (::Disc, segments, divisions, 0);
-		transform = getCircleDrawMatrix ((dist0 != 0) ? dist0 : dist1);
+		refFile = GetPrimitive(::Disc, segments, divisions, 0);
+		transform = getCircleDrawMatrix((dist0 != 0) ? dist0 : dist1);
 		circleOrDisc = true;
 	}
-	else if (g_RingFinder.findRings (dist0, dist1))
+	else if (g_RingFinder.findRings(dist0, dist1))
 	{
 		// The ring finder found a solution, use that. Add the component rings to the file.
 		for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents())
 		{
-			refFile = GetPrimitive (::Ring, segments, divisions, cmp.num);
+			refFile = GetPrimitive(::Ring, segments, divisions, cmp.num);
 			LDSubfileReference* ref = LDSpawn<LDSubfileReference>();
-			ref->setFileInfo (refFile);
-			ref->setTransform (getCircleDrawMatrix (cmp.scale));
-			ref->setPosition (m_drawedVerts[0]);
-			ref->setColor (MainColor);
+			ref->setFileInfo(refFile);
+			ref->setTransform(getCircleDrawMatrix(cmp.scale));
+			ref->setPosition(m_drawedVerts[0]);
+			ref->setColor(MainColor);
 			objs << ref;
 		}
 	}
@@ -121,35 +121,35 @@
 		// Ring finder failed, last resort: draw the ring with quads
 		QList<QLineF> c0, c1;
 		Axis localx, localy, localz;
-		renderer()->getRelativeAxes (localx, localy);
-		localz = (Axis) (3 - localx - localy);
-		double x0 (m_drawedVerts[0][localx]);
-		double y0 (m_drawedVerts[0][localy]);
+		renderer()->getRelativeAxes(localx, localy);
+		localz = (Axis)(3 - localx - localy);
+		double x0(m_drawedVerts[0][localx]);
+		double y0(m_drawedVerts[0][localy]);
 
 		Vertex templ;
-		templ.setCoordinate (localx, x0);
-		templ.setCoordinate (localy, y0);
-		templ.setCoordinate (localz, renderer()->getDepthValue());
+		templ.setCoordinate(localx, x0);
+		templ.setCoordinate(localy, y0);
+		templ.setCoordinate(localz, renderer()->getDepthValue());
 
 		// Calculate circle coords
-		MakeCircle (segments, divisions, dist0, c0);
-		MakeCircle (segments, divisions, dist1, c1);
+		MakeCircle(segments, divisions, dist0, c0);
+		MakeCircle(segments, divisions, dist1, c1);
 
 		for (int i = 0; i < segments; ++i)
 		{
 			Vertex v0, v1, v2, v3;
 			v0 = v1 = v2 = v3 = templ;
-			v0.setCoordinate (localx, v0[localx] + c0[i].x1());
-			v0.setCoordinate (localy, v0[localy] + c0[i].y1());
-			v1.setCoordinate (localx, v1[localx] + c0[i].x2());
-			v1.setCoordinate (localy, v1[localy] + c0[i].y2());
-			v2.setCoordinate (localx, v2[localx] + c1[i].x2());
-			v2.setCoordinate (localy, v2[localy] + c1[i].y2());
-			v3.setCoordinate (localx, v3[localx] + c1[i].x1());
-			v3.setCoordinate (localy, v3[localy] + c1[i].y1());
+			v0.setCoordinate(localx, v0[localx] + c0[i].x1());
+			v0.setCoordinate(localy, v0[localy] + c0[i].y1());
+			v1.setCoordinate(localx, v1[localx] + c0[i].x2());
+			v1.setCoordinate(localy, v1[localy] + c0[i].y2());
+			v2.setCoordinate(localx, v2[localx] + c1[i].x2());
+			v2.setCoordinate(localy, v2[localy] + c1[i].y2());
+			v3.setCoordinate(localx, v3[localx] + c1[i].x1());
+			v3.setCoordinate(localy, v3[localy] + c1[i].y1());
 
-			LDQuad* quad (LDSpawn<LDQuad> (v0, v1, v2, v3));
-			quad->setColor (MainColor);
+			LDQuad* quad(LDSpawn<LDQuad>(v0, v1, v2, v3));
+			quad->setColor(MainColor);
 
 			// Ensure the quads always are BFC-front towards the camera
 			if (renderer()->camera() % 3 <= 0)
@@ -162,23 +162,23 @@
 	if (circleOrDisc and refFile)
 	{
 		LDSubfileReference* ref = LDSpawn<LDSubfileReference>();
-		ref->setFileInfo (refFile);
-		ref->setTransform (transform);
-		ref->setPosition (m_drawedVerts[0]);
-		ref->setColor (MainColor);
+		ref->setFileInfo(refFile);
+		ref->setTransform(transform);
+		ref->setPosition(m_drawedVerts[0]);
+		ref->setColor(MainColor);
 		objs << ref;
 	}
 
 	if (not objs.isEmpty())
 	{
 		Axis relZ = renderer()->getRelativeZ();;
-		const int l (relZ == X ? 1 : 0);
-		const int m (relZ == Y ? 1 : 0);
-		const int n (relZ == Z ? 1 : 0);
-		RotateObjects (l, m, n, -m_angleOffset, objs);
+		const int l(relZ == X ? 1 : 0);
+		const int m(relZ == Y ? 1 : 0);
+		const int n(relZ == Z ? 1 : 0);
+		RotateObjects(l, m, n, -m_angleOffset, objs);
 	}
 
-	finishDraw (objs);
+	finishDraw(objs);
 }
 
 double CircleMode::getAngleOffset() const
@@ -186,68 +186,68 @@
 	if (m_drawedVerts.isEmpty())
 		return 0.0;
 
-	const int divisions (m_window->ringToolHiRes() ? HighResolution : LowResolution);
-	QPointF originspot (renderer()->convert3dTo2d (m_drawedVerts.first()));
-	QLineF bearing (originspot, renderer()->mousePositionF());
-	QLineF bearing2 (originspot, QPointF (originspot.x(), 0.0));
-	double angleoffset (-bearing.angleTo (bearing2) + 90);
+	const int divisions(m_window->ringToolHiRes() ? HighResolution : LowResolution);
+	QPointF originspot(renderer()->convert3dTo2d(m_drawedVerts.first()));
+	QLineF bearing(originspot, renderer()->mousePositionF());
+	QLineF bearing2(originspot, QPointF(originspot.x(), 0.0));
+	double angleoffset(-bearing.angleTo(bearing2) + 90);
 	angleoffset /= (360.0 / divisions); // convert angle to 0-16 scale
-	angleoffset = round (angleoffset); // round to nearest 16th
+	angleoffset = round(angleoffset); // round to nearest 16th
 	angleoffset *= ((2 * Pi) / divisions); // convert to radians
 	angleoffset *= renderer()->depthNegateFactor(); // negate based on camera
 	return angleoffset;
 }
 
-void CircleMode::render (QPainter& painter) const
+void CircleMode::render(QPainter& painter) const
 {
-	QFontMetrics metrics = QFontMetrics (QFont());
+	QFontMetrics metrics = QFontMetrics(QFont());
 
 	// If we have not specified the center point of the circle yet, preview it on the screen.
 	if (m_drawedVerts.isEmpty())
 	{
-		QPoint pos2d = renderer()->convert3dTo2d (renderer()->position3D());
-		renderer()->drawBlip (painter, pos2d);
-		renderer()->drawBlipCoordinates (painter, renderer()->position3D(), pos2d);
+		QPoint pos2d = renderer()->convert3dTo2d(renderer()->position3D());
+		renderer()->drawBlip(painter, pos2d);
+		renderer()->drawBlipCoordinates(painter, renderer()->position3D(), pos2d);
 		return;
 	}
 
 	QVector<Vertex> innerverts, outerverts;
 	QVector<QPointF> innerverts2d, outerverts2d;
-	const double innerdistance (getCircleDrawDist (0));
-	const double outerdistance (m_drawedVerts.size() >= 2 ? getCircleDrawDist (1) : -1);
-	const int divisions (m_window->ringToolHiRes() ? HighResolution : LowResolution);
-	const int segments (m_window->ringToolSegments());
-	const double angleUnit (2 * Pi / divisions);
+	const double innerdistance(getCircleDrawDist(0));
+	const double outerdistance(m_drawedVerts.size() >= 2 ? getCircleDrawDist(1) : -1);
+	const int divisions(m_window->ringToolHiRes() ? HighResolution : LowResolution);
+	const int segments(m_window->ringToolSegments());
+	const double angleUnit(2 * Pi / divisions);
 	Axis relX, relY;
-	renderer()->getRelativeAxes (relX, relY);
-	const double angleoffset (m_drawedVerts.size() < 3 ? getAngleOffset() : m_angleOffset);
+	renderer()->getRelativeAxes(relX, relY);
+	const double angleoffset(m_drawedVerts.size() < 3 ? getAngleOffset() : m_angleOffset);
 
 	// Calculate the preview positions of vertices
 	for (int i = 0; i < segments + 1; ++i)
 	{
-		const double sinangle (sin (angleoffset + i * angleUnit));
-		const double cosangle (cos (angleoffset + i * angleUnit));
-		Vertex v (Origin);
-		v.setCoordinate (relX, m_drawedVerts[0][relX] + (cosangle * innerdistance));
-		v.setCoordinate (relY, m_drawedVerts[0][relY] + (sinangle * innerdistance));
+		const double sinangle(sin(angleoffset + i * angleUnit));
+		const double cosangle(cos(angleoffset + i * angleUnit));
+		Vertex v(Origin);
+		v.setCoordinate(relX, m_drawedVerts[0][relX] +(cosangle * innerdistance));
+		v.setCoordinate(relY, m_drawedVerts[0][relY] +(sinangle * innerdistance));
 		innerverts << v;
-		innerverts2d << renderer()->convert3dTo2d (v);
+		innerverts2d << renderer()->convert3dTo2d(v);
 
 		if (outerdistance != -1)
 		{
-			v.setCoordinate (relX, m_drawedVerts[0][relX] + (cosangle * outerdistance));
-			v.setCoordinate (relY, m_drawedVerts[0][relY] + (sinangle * outerdistance));
+			v.setCoordinate(relX, m_drawedVerts[0][relX] +(cosangle * outerdistance));
+			v.setCoordinate(relY, m_drawedVerts[0][relY] +(sinangle * outerdistance));
 			outerverts << v;
-			outerverts2d << renderer()->convert3dTo2d (v);
+			outerverts2d << renderer()->convert3dTo2d(v);
 		}
 	}
 
-	QVector<QLineF> lines (segments);
+	QVector<QLineF> lines(segments);
 
 	if (outerdistance != -1 and outerdistance != innerdistance)
 	{
-		painter.setBrush (m_polybrush);
-		painter.setPen (Qt::NoPen);
+		painter.setBrush(m_polybrush);
+		painter.setPen(Qt::NoPen);
 
 		// Compile polygons
 		for (int i = 0; i < segments; ++i)
@@ -257,51 +257,51 @@
 				<< innerverts2d[i + 1]
 				<< outerverts2d[i + 1]
 				<< outerverts2d[i];
-			painter.drawPolygon (QPolygonF (points));
-			lines << QLineF (innerverts2d[i], innerverts2d[i + 1]);
-			lines << QLineF (outerverts2d[i], outerverts2d[i + 1]);
+			painter.drawPolygon(QPolygonF(points));
+			lines << QLineF(innerverts2d[i], innerverts2d[i + 1]);
+			lines << QLineF(outerverts2d[i], outerverts2d[i + 1]);
 		}
 
 		// Add bordering edges for unclosed rings/discs
 		if (segments != divisions)
 		{
-			lines << QLineF (innerverts2d.first(), outerverts2d.first());
-			lines << QLineF (innerverts2d.last(), outerverts2d.last());
+			lines << QLineF(innerverts2d.first(), outerverts2d.first());
+			lines << QLineF(innerverts2d.last(), outerverts2d.last());
 		}
 	}
 	else
 	{
 		for (int i = 0; i < segments; ++i)
-			lines << QLineF (innerverts2d[i], innerverts2d[i + 1]);
+			lines << QLineF(innerverts2d[i], innerverts2d[i + 1]);
 	}
 
 	// Draw green blips at where the points are
 	for (QPointF const& point : innerverts2d + outerverts2d)
-		renderer()->drawBlip (painter, point);
+		renderer()->drawBlip(painter, point);
 
 	// Draw edge lines
-	painter.setPen (renderer()->linePen());
-	painter.drawLines (lines);
+	painter.setPen(renderer()->linePen());
+	painter.drawLines(lines);
 
 	// Draw the current radius in the middle of the circle.
-	QPoint origin = renderer()->convert3dTo2d (m_drawedVerts[0]);
-	QString label = QString::number (innerdistance);
-	painter.setPen (renderer()->textPen());
-	painter.drawText (origin.x() - (metrics.width (label) / 2), origin.y(), label);
+	QPoint origin = renderer()->convert3dTo2d(m_drawedVerts[0]);
+	QString label = QString::number(innerdistance);
+	painter.setPen(renderer()->textPen());
+	painter.drawText(origin.x() -(metrics.width(label) / 2), origin.y(), label);
 
 	if (m_drawedVerts.size() >= 2)
 	{
-		painter.drawText (origin.x() - (metrics.width (label) / 2),
-			origin.y() + metrics.height(), QString::number (outerdistance));
+		painter.drawText(origin.x() -(metrics.width(label) / 2),
+			origin.y() + metrics.height(), QString::number(outerdistance));
 	}
 }
 
-bool CircleMode::mouseReleased (MouseEventData const& data)
+bool CircleMode::mouseReleased(MouseEventData const& data)
 {
 	if (data.releasedButtons & Qt::LeftButton)
 	{
 		if (m_drawedVerts.size() < 2)
-			addDrawnVertex (renderer()->position3D());
+			addDrawnVertex(renderer()->position3D());
 		else
 			buildCircle();
 		return true;
@@ -312,7 +312,7 @@
 	}
 }
 
-bool CircleMode::preAddVertex (const Vertex&)
+bool CircleMode::preAddVertex(const Vertex&)
 {
 	m_angleOffset = getAngleOffset();
 	return false;
--- a/src/editmodes/circleMode.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/circleMode.h	Thu Jan 04 19:44:26 2018 +0200
@@ -21,19 +21,19 @@
 
 class CircleMode : public AbstractDrawMode
 {
-	DEFINE_CLASS (CircleMode, AbstractDrawMode)
+	DEFINE_CLASS(CircleMode, AbstractDrawMode)
 	double m_angleOffset;
 
 public:
-	CircleMode (GLRenderer* renderer);
+	CircleMode(GLRenderer* renderer);
 
-	virtual void render (QPainter& painter) const override;
+	virtual void render(QPainter& painter) const override;
 	virtual EditModeType type() const override;
 
-	double getCircleDrawDist (int pos) const;
-	Matrix getCircleDrawMatrix (double scale);
-	bool mouseReleased (const AbstractEditMode::MouseEventData& data) override;
-	bool preAddVertex (Vertex const&) override;
+	double getCircleDrawDist(int pos) const;
+	Matrix getCircleDrawMatrix(double scale);
+	bool mouseReleased(const AbstractEditMode::MouseEventData& data) override;
+	bool preAddVertex(Vertex const&) override;
 
 private:
 	void buildCircle();
--- a/src/editmodes/curvemode.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/curvemode.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -20,17 +20,17 @@
 #include "../ldObject.h"
 #include "../glRenderer.h"
 
-CurveMode::CurveMode (GLRenderer* renderer) :
-	Super (renderer) {}
+CurveMode::CurveMode(GLRenderer* renderer) :
+	Super(renderer) {}
 
-void CurveMode::render (QPainter& painter) const
+void CurveMode::render(QPainter& painter) const
 {
 	if (m_drawedVerts.size() >= 1)
 	{
 		Vertex curve[4];
 		QPoint curve2d[4];
 
-		for (int i = 0; i < qMin (countof(curve), m_drawedVerts.size()); ++i)
+		for (int i = 0; i < qMin(countof(curve), m_drawedVerts.size()); ++i)
 			curve[i] = m_drawedVerts[i];
 
 		// Factor the cursor into the preview
@@ -45,35 +45,35 @@
 			curve[3] = curve[2];
 
 		for (int i = 0; i < countof(curve); ++i)
-			curve2d[i] = renderer()->convert3dTo2d (curve[i]);
+			curve2d[i] = renderer()->convert3dTo2d(curve[i]);
 
-		painter.setPen (QColor (0, 112, 112));
+		painter.setPen(QColor(0, 112, 112));
 		if (m_drawedVerts.size() >= 2)
-			painter.drawLine (curve2d[0], curve2d[2]);
+			painter.drawLine(curve2d[0], curve2d[2]);
 
 		if (m_drawedVerts.size() >= 3)
-			painter.drawLine (curve2d[1], curve2d[3]);
+			painter.drawLine(curve2d[1], curve2d[3]);
 
-		for (int i = 0; i < qMin (countof(curve), m_drawedVerts.size() + 1); ++i)
+		for (int i = 0; i < qMin(countof(curve), m_drawedVerts.size() + 1); ++i)
 		{
 			if (i < 2)
-				renderer()->drawBlip (painter, curve2d[i]);
+				renderer()->drawBlip(painter, curve2d[i]);
 			else
 				// Give control points a different color
-				renderer()->drawBlip (painter, curve2d[i], QColor (0, 112, 112));
-			renderer()->drawBlipCoordinates (painter, curve[i], curve2d[i]);
+				renderer()->drawBlip(painter, curve2d[i], QColor(0, 112, 112));
+			renderer()->drawBlipCoordinates(painter, curve[i], curve2d[i]);
 		}
 
-		QPainterPath path (curve2d[0]);
-		path.cubicTo (curve2d[2], curve2d[3], curve2d[1]);
-		painter.strokePath (path, renderer()->linePen());
+		QPainterPath path(curve2d[0]);
+		path.cubicTo(curve2d[2], curve2d[3], curve2d[1]);
+		painter.strokePath(path, renderer()->linePen());
 	}
 	else
 	{
 		// Even if we have nothing, still draw the vertex at the cursor
-		QPoint vertex2d = renderer()->convert3dTo2d (getCursorVertex());
-		renderer()->drawBlip (painter, vertex2d);
-		renderer()->drawBlipCoordinates (painter, getCursorVertex(), vertex2d);
+		QPoint vertex2d = renderer()->convert3dTo2d(getCursorVertex());
+		renderer()->drawBlip(painter, vertex2d);
+		renderer()->drawBlipCoordinates(painter, getCursorVertex(), vertex2d);
 	}
 }
 
@@ -87,7 +87,7 @@
 	if (m_drawedVerts.size() == 4)
 	{
 		LDObjectList objs;
-		objs << LDSpawn<LDBezierCurve> (m_drawedVerts[0], m_drawedVerts[1], m_drawedVerts[2], m_drawedVerts[3]);
-		finishDraw (objs);
+		objs << LDSpawn<LDBezierCurve>(m_drawedVerts[0], m_drawedVerts[1], m_drawedVerts[2], m_drawedVerts[3]);
+		finishDraw(objs);
 	}
 }
--- a/src/editmodes/curvemode.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/curvemode.h	Thu Jan 04 19:44:26 2018 +0200
@@ -21,12 +21,12 @@
 
 class CurveMode : public AbstractDrawMode
 {
-	DEFINE_CLASS (CurveMode, AbstractDrawMode)
+	DEFINE_CLASS(CurveMode, AbstractDrawMode)
 
 public:
-	CurveMode (GLRenderer* renderer);
+	CurveMode(GLRenderer* renderer);
 	void endDraw() override;
-	void render (QPainter& painter) const override;
+	void render(QPainter& painter) const override;
 	EditModeType type() const override;
 	int maxVertices() const override { return 4; }
 };
--- a/src/editmodes/drawMode.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/drawMode.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -22,15 +22,15 @@
 #include "../ldObject.h"
 #include "../glRenderer.h"
 
-DrawMode::DrawMode (GLRenderer* renderer) :
-	Super (renderer) {}
+DrawMode::DrawMode(GLRenderer* renderer) :
+	Super(renderer) {}
 
 EditModeType DrawMode::type() const
 {
 	return EditModeType::Draw;
 }
 
-void DrawMode::render (QPainter& painter) const
+void DrawMode::render(QPainter& painter) const
 {
 	QVector<Vertex> poly;
 
@@ -41,10 +41,10 @@
 	if (poly.size() < 4)
 		poly << getCursorVertex();
 
-	renderPolygon (painter, poly, true, true);
+	renderPolygon(painter, poly, true, true);
 }
 
-bool DrawMode::preAddVertex (Vertex const& pos)
+bool DrawMode::preAddVertex(Vertex const& pos)
 {
 	// If we picked an already-existing vertex, stop drawing
 	for (Vertex& vert : m_drawedVerts)
@@ -67,13 +67,13 @@
 	QList<Vertex>& verts = m_drawedVerts;
 	LDObjectList objs;
 
-	switch (verts.size())
+	switch(verts.size())
 	{
 		case 2:
 		{
 			// 2 verts - make a line
-			LDLine* obj = LDSpawn<LDLine> (verts[0], verts[1]);
-			obj->setColor (EdgeColor);
+			LDLine* obj = LDSpawn<LDLine>(verts[0], verts[1]);
+			obj->setColor(EdgeColor);
 			objs << obj;
 			break;
 		}
@@ -82,18 +82,18 @@
 		case 4:
 		{
 			LDObject* obj = (verts.size() == 3) ?
-				static_cast<LDObject*> (LDSpawn<LDTriangle>()) :
-				static_cast<LDObject*> (LDSpawn<LDQuad>());
+				static_cast<LDObject*>(LDSpawn<LDTriangle>()) :
+				static_cast<LDObject*>(LDSpawn<LDQuad>());
 
-			obj->setColor (MainColor);
+			obj->setColor(MainColor);
 
 			for (int i = 0; i < verts.size(); ++i)
-				obj->setVertex (i, verts[i]);
+				obj->setVertex(i, verts[i]);
 
 			objs << obj;
 			break;
 		}
 	}
 
-	finishDraw (objs);
+	finishDraw(objs);
 }
--- a/src/editmodes/drawMode.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/drawMode.h	Thu Jan 04 19:44:26 2018 +0200
@@ -21,15 +21,15 @@
 
 class DrawMode : public AbstractDrawMode
 {
-	DEFINE_CLASS (DrawMode, AbstractDrawMode)
+	DEFINE_CLASS(DrawMode, AbstractDrawMode)
 	bool m_rectdraw;
 
 public:
-	DrawMode (GLRenderer* renderer);
+	DrawMode(GLRenderer* renderer);
 
-	void render (QPainter& painter) const override;
+	void render(QPainter& painter) const override;
 	int maxVertices() const override { return 4; }
 	EditModeType type() const override;
 	void endDraw() override;
-	bool preAddVertex (Vertex const&) override;
+	bool preAddVertex(Vertex const&) override;
 };
--- a/src/editmodes/linePathMode.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/linePathMode.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -21,52 +21,52 @@
 #include "../glRenderer.h"
 #include "../mainwindow.h"
 
-LinePathMode::LinePathMode (GLRenderer *renderer) :
-	Super (renderer) {}
+LinePathMode::LinePathMode(GLRenderer *renderer) :
+	Super(renderer) {}
 
-void LinePathMode::render (QPainter& painter) const
+void LinePathMode::render(QPainter& painter) const
 {
 	QVector<QPointF> points;
 	QList<Vertex> points3d = m_drawedVerts;
 	points3d << renderer()->position3D();
 
 	for (Vertex const& vrt : points3d)
-		points << renderer()->convert3dTo2d (vrt);
+		points << renderer()->convert3dTo2d(vrt);
 
-	painter.setPen (renderer()->textPen());
+	painter.setPen(renderer()->textPen());
 
 	if (points.size() == points3d.size())
 	{
 		for (int i = 0; i < points.size() - 1; ++i)
 		{
-			painter.drawLine (QLineF (points[i], points[i + 1]));
-			drawLength (painter, points3d[i], points3d[i + 1], points[i], points[i + 1]);
+			painter.drawLine(QLineF(points[i], points[i + 1]));
+			drawLength(painter, points3d[i], points3d[i + 1], points[i], points[i + 1]);
 		}
 	
 		for (int i = 0; i < points.size(); ++i)
 		{
 			const QPointF& point = points[i];
-			renderer()->drawBlip (painter, point);
-			renderer()->drawBlipCoordinates (painter, points3d[i], point);
+			renderer()->drawBlip(painter, point);
+			renderer()->drawBlipCoordinates(painter, points3d[i], point);
 		}
 	}
 }
 
-bool LinePathMode::mouseReleased (MouseEventData const& data)
+bool LinePathMode::mouseReleased(MouseEventData const& data)
 {
-	if (Super::mouseReleased (data))
+	if (Super::mouseReleased(data))
 		return true;
 
 	if (data.releasedButtons & Qt::LeftButton)
 	{
-		addDrawnVertex (renderer()->position3D());
+		addDrawnVertex(renderer()->position3D());
 		return true;
 	}
 
 	return false;
 }
 
-bool LinePathMode::preAddVertex (Vertex const& pos)
+bool LinePathMode::preAddVertex(Vertex const& pos)
 {
 	// If we picked the vertex we last drew, stop drawing
 	if (not m_drawedVerts.isEmpty() and pos == m_drawedVerts.last())
@@ -85,17 +85,17 @@
 	for (int i = 0; i < m_drawedVerts.size() - 1; ++i)
 	{
 		LDLine* line = LDSpawn<LDLine>();
-		line->setVertex (0, m_drawedVerts[i]);
-		line->setVertex (1, m_drawedVerts[i + 1]);
+		line->setVertex(0, m_drawedVerts[i]);
+		line->setVertex(1, m_drawedVerts[i + 1]);
 		objs << line;
 	}
 
-	finishDraw (objs);
+	finishDraw(objs);
 }
 
-bool LinePathMode::keyReleased (QKeyEvent* ev)
+bool LinePathMode::keyReleased(QKeyEvent* ev)
 {
-	if (Super::keyReleased (ev))
+	if (Super::keyReleased(ev))
 		return true;
 
 	if (ev->key() == Qt::Key_Enter or ev->key() == Qt::Key_Return)
--- a/src/editmodes/linePathMode.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/linePathMode.h	Thu Jan 04 19:44:26 2018 +0200
@@ -21,16 +21,16 @@
 
 class LinePathMode : public AbstractDrawMode
 {
-	DEFINE_CLASS (LinePathMode, AbstractDrawMode)
+	DEFINE_CLASS(LinePathMode, AbstractDrawMode)
 
 public:
-	LinePathMode (GLRenderer* renderer);
+	LinePathMode(GLRenderer* renderer);
 
-	void render (QPainter& painter) const override;
+	void render(QPainter& painter) const override;
 	EditModeType type() const override { return EditModeType::LinePath; }
-	bool mouseReleased (MouseEventData const& data) override;
-	bool preAddVertex (Vertex const& pos) override;
-	bool keyReleased (QKeyEvent*) override;
+	bool mouseReleased(MouseEventData const& data) override;
+	bool preAddVertex(Vertex const& pos) override;
+	bool keyReleased(QKeyEvent*) override;
 	void endDraw() override;
 };
 
--- a/src/editmodes/magicWandMode.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/magicWandMode.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -22,8 +22,8 @@
 #include "../mainwindow.h"
 #include "../glRenderer.h"
 
-MagicWandMode::MagicWandMode (GLRenderer* renderer) :
-	Super (renderer)
+MagicWandMode::MagicWandMode(GLRenderer* renderer) :
+	Super(renderer)
 {
 	// Get vertex<->object data
 	for (LDObject* obj : currentDocument()->objects())
@@ -31,7 +31,7 @@
 		// Note: this deliberately only takes vertex-objects into account.
 		// The magic wand does not process subparts.
 		for (int i = 0; i < obj->numVertices(); ++i)
-			m_vertices[obj->vertex (i)] << obj;
+			m_vertices[obj->vertex(i)] << obj;
 	}
 }
 
@@ -40,20 +40,20 @@
 	return EditModeType::MagicWand;
 }
 
-void MagicWandMode::fillBoundaries (LDObject* obj, QVector<BoundaryType>& boundaries, QVector<LDObject*>& 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.
 	for (LDObject* candidate : candidates)
 	{
-		if (not isOneOf (candidate->type(), OBJ_Line, OBJ_CondLine) or candidate->vertex (0) == candidate->vertex (1))
+		if (not isOneOf(candidate->type(), OBJ_Line, OBJ_CondLine) or candidate->vertex(0) == candidate->vertex(1))
 			continue;
 
 		int matches = 0;
 
 		for (int i = 0; i < obj->numVertices(); ++i)
 		{
-			if (not isOneOf (obj->vertex (i), candidate->vertex (0), candidate->vertex (1)))
+			if (not isOneOf(obj->vertex(i), candidate->vertex(0), candidate->vertex(1)))
 				continue;
 
 			if (++matches == 2)
@@ -63,7 +63,7 @@
 				if (candidate->type() == OBJ_CondLine)
 					m_selection << candidate;
 				else
-					boundaries.append (std::make_tuple (candidate->vertex (0), candidate->vertex (1)));
+					boundaries.append(std::make_tuple(candidate->vertex(0), candidate->vertex(1)));
 
 				break;
 			}
@@ -71,7 +71,7 @@
 	}
 }
 
-void MagicWandMode::doMagic (LDObject* obj, MagicWandMode::MagicType type)
+void MagicWandMode::doMagic(LDObject* obj, MagicWandMode::MagicType type)
 {
 	if (obj == nullptr)
 	{
@@ -91,10 +91,10 @@
 	if (type != InternalRecursion)
 	{
 		m_selection.clear();
-		m_selection.append (obj);
+		m_selection.append(obj);
 	}
 
-	switch (obj->type())
+	switch(obj->type())
 	{
 		case OBJ_Line:
 		case OBJ_CondLine:
@@ -115,26 +115,26 @@
 	// Get the list of objects that touch this object, i.e. share a vertex
 	// with this.
 	for (int i = 0; i < obj->numVertices(); ++i)
-		candidates += m_vertices[obj->vertex (i)];
+		candidates += m_vertices[obj->vertex(i)];
 
-	removeDuplicates (candidates);
+	removeDuplicates(candidates);
 
 	// If we're dealing with surfaces, get a list of boundaries.
 	if (matchesneeded > 1)
-		fillBoundaries (obj, boundaries, candidates);
+		fillBoundaries(obj, boundaries, candidates);
 
 	for (LDObject* candidate : candidates)
 	{
 		try
 		{
-			// If we're doing this on lines, we need exact type match. Surface types (quads and
+			// If we're doing this on lines, we need exact type match. Surface types(quads and
 			// triangles) can be mixed. Also don't consider self a candidate, and don't consider
 			// objects we have already processed.
 			if ((candidate == obj) or
 				(candidate->color() != obj->color()) or
-				(m_selection.contains (candidate)) or
-				(matchesneeded == 1 and (candidate->type() != objtype)) or
-				((candidate->numVertices() > 2) ^ (matchesneeded == 2)))
+				(m_selection.contains(candidate)) or
+				(matchesneeded == 1 and(candidate->type() != objtype)) or
+				((candidate->numVertices() > 2) ^(matchesneeded == 2)))
 			{
 				throw 0;
 			}
@@ -160,23 +160,23 @@
 			// Check if a boundary gets in between the objects.
 			for (auto boundary : boundaries)
 			{
-				if (isOneOf (matches[0], std::get<0> (boundary), std::get<1> (boundary)) and
-					isOneOf (matches[1], std::get<0> (boundary), std::get<1> (boundary)))
+				if (isOneOf(matches[0], std::get<0>(boundary), std::get<1>(boundary)) and
+					isOneOf(matches[1], std::get<0>(boundary), std::get<1>(boundary)))
 				{
 					throw 0;
 				}
 			}
 
-			m_selection.append (candidate);
-			doMagic (candidate, InternalRecursion);
+			m_selection.append(candidate);
+			doMagic(candidate, InternalRecursion);
 		}
-		catch (int&)
+		catch(int&)
 		{
 			continue;
 		}
 	}
 
-	switch (type)
+	switch(type)
 	{
 	case Set:
 		currentDocument()->clearSelection();
@@ -198,9 +198,9 @@
 		m_window->buildObjectList();
 }
 
-bool MagicWandMode::mouseReleased (MouseEventData const& data)
+bool MagicWandMode::mouseReleased(MouseEventData const& data)
 {
-	if (Super::mouseReleased (data))
+	if (Super::mouseReleased(data))
 		return true;
 
 	if (data.releasedButtons & Qt::LeftButton and not data.mouseMoved)
@@ -212,7 +212,7 @@
 		else if (data.keymods & Qt::ControlModifier)
 			wandtype = MagicWandMode::Subtractive;
 
-		doMagic (renderer()->pickOneObject (data.ev->x(), data.ev->y()), wandtype);
+		doMagic(renderer()->pickOneObject(data.ev->x(), data.ev->y()), wandtype);
 		return true;
 	}
 
--- a/src/editmodes/magicWandMode.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/magicWandMode.h	Thu Jan 04 19:44:26 2018 +0200
@@ -27,7 +27,7 @@
 	QMap<Vertex, QVector<LDObject*>> m_vertices;
 	QVector<LDObject*> m_selection;
 
-	DEFINE_CLASS (MagicWandMode, AbstractSelectMode)
+	DEFINE_CLASS(MagicWandMode, AbstractSelectMode)
 
 public:
 	using BoundaryType = std::tuple<Vertex, Vertex>;
@@ -39,11 +39,11 @@
 		InternalRecursion
 	};
 
-	MagicWandMode (GLRenderer* renderer);
-	void doMagic (LDObject* obj, MagicType type);
+	MagicWandMode(GLRenderer* renderer);
+	void doMagic(LDObject* obj, MagicType type);
 	virtual EditModeType type() const override;
-	virtual bool mouseReleased (MouseEventData const& data) override;
+	virtual bool mouseReleased(MouseEventData const& data) override;
 
 private:
-	void fillBoundaries (LDObject* obj, QVector<BoundaryType>& boundaries, QVector<LDObject*>& candidates);
+	void fillBoundaries(LDObject* obj, QVector<BoundaryType>& boundaries, QVector<LDObject*>& candidates);
 };
--- a/src/editmodes/rectangleMode.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/rectangleMode.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -22,19 +22,19 @@
 #include "../ldObject.h"
 #include "../glRenderer.h"
 
-RectangleMode::RectangleMode (GLRenderer* renderer) :
-	Super (renderer),
-	m_rectangleVerts (QVector<Vertex>(4)) {}
+RectangleMode::RectangleMode(GLRenderer* renderer) :
+	Super(renderer),
+	m_rectangleVerts(QVector<Vertex>(4)) {}
 
 EditModeType RectangleMode::type() const
 {
 	return EditModeType::Rectangle;
 }
 
-void RectangleMode::render (QPainter& painter) const
+void RectangleMode::render(QPainter& painter) const
 {
-	renderPolygon (painter, (m_drawedVerts.size() > 0) ? m_rectangleVerts :
-		QVector<Vertex> ({renderer()->position3D()}), true, false);
+	renderPolygon(painter,(m_drawedVerts.size() > 0) ? m_rectangleVerts :
+		QVector<Vertex>({renderer()->position3D()}), true, false);
 }
 
 void RectangleMode::endDraw()
@@ -45,17 +45,17 @@
 		updateRectVerts();
 
 		for (int i = 0; i < quad->numVertices(); ++i)
-			quad->setVertex (i, m_rectangleVerts[i]);
+			quad->setVertex(i, m_rectangleVerts[i]);
 
-		quad->setColor (MainColor);
-		finishDraw (LDObjectList ({quad}));
+		quad->setColor(MainColor);
+		finishDraw(LDObjectList({quad}));
 	}
 }
 
 //
 // Update rect vertices when the mouse moves since the 3d position likely has changed
 //
-bool RectangleMode::mouseMoved (QMouseEvent*)
+bool RectangleMode::mouseMoved(QMouseEvent*)
 {
 	updateRectVerts();
 	return false;
@@ -74,19 +74,19 @@
 	Vertex v0 = m_drawedVerts[0],
 		   v1 = (m_drawedVerts.size() >= 2) ? m_drawedVerts[1] : renderer()->position3D();
 
-	const Axis localx = renderer()->getCameraAxis (false),
-			   localy = renderer()->getCameraAxis (true),
-			   localz = (Axis) (3 - localx - localy);
+	const Axis localx = renderer()->getCameraAxis(false),
+			   localy = renderer()->getCameraAxis(true),
+			   localz = (Axis)(3 - localx - localy);
 
 	for (int i = 0; i < 4; ++i)
-		m_rectangleVerts[i].setCoordinate (localz, renderer()->getDepthValue());
+		m_rectangleVerts[i].setCoordinate(localz, renderer()->getDepthValue());
 
-	m_rectangleVerts[0].setCoordinate (localx, v0[localx]);
-	m_rectangleVerts[0].setCoordinate (localy, v0[localy]);
-	m_rectangleVerts[1].setCoordinate (localx, v1[localx]);
-	m_rectangleVerts[1].setCoordinate (localy, v0[localy]);
-	m_rectangleVerts[2].setCoordinate (localx, v1[localx]);
-	m_rectangleVerts[2].setCoordinate (localy, v1[localy]);
-	m_rectangleVerts[3].setCoordinate (localx, v0[localx]);
-	m_rectangleVerts[3].setCoordinate (localy, v1[localy]);
+	m_rectangleVerts[0].setCoordinate(localx, v0[localx]);
+	m_rectangleVerts[0].setCoordinate(localy, v0[localy]);
+	m_rectangleVerts[1].setCoordinate(localx, v1[localx]);
+	m_rectangleVerts[1].setCoordinate(localy, v0[localy]);
+	m_rectangleVerts[2].setCoordinate(localx, v1[localx]);
+	m_rectangleVerts[2].setCoordinate(localy, v1[localy]);
+	m_rectangleVerts[3].setCoordinate(localx, v0[localx]);
+	m_rectangleVerts[3].setCoordinate(localy, v1[localy]);
 }
--- a/src/editmodes/rectangleMode.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/rectangleMode.h	Thu Jan 04 19:44:26 2018 +0200
@@ -21,16 +21,16 @@
 
 class RectangleMode : public AbstractDrawMode
 {
-	DEFINE_CLASS (RectangleMode, AbstractDrawMode)
+	DEFINE_CLASS(RectangleMode, AbstractDrawMode)
 	QVector<Vertex> m_rectangleVerts;
 
 public:
-	RectangleMode (GLRenderer* renderer);
+	RectangleMode(GLRenderer* renderer);
 
-	void render (QPainter& painter) const override;
+	void render(QPainter& painter) const override;
 	EditModeType type() const override;
 	void endDraw() override;
-	bool mouseMoved (QMouseEvent*) override;
+	bool mouseMoved(QMouseEvent*) override;
 	int maxVertices() const override { return 2; }
 
 private:
--- a/src/editmodes/selectMode.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/selectMode.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -23,16 +23,16 @@
 #include "../mainwindow.h"
 #include "../glRenderer.h"
 
-SelectMode::SelectMode (GLRenderer* renderer) :
-	Super (renderer),
-	m_rangepick (false) {}
+SelectMode::SelectMode(GLRenderer* renderer) :
+	Super(renderer),
+	m_rangepick(false) {}
 
 EditModeType SelectMode::type() const
 {
 	return EditModeType::Select;
 }
 
-void SelectMode::render (QPainter& painter) const
+void SelectMode::render(QPainter& painter) const
 {
 	// If we're range-picking, draw a rectangle encompassing the selection area.
 	if (m_rangepick)
@@ -42,18 +42,18 @@
 			x1 = renderer()->mousePosition().x(),
 			y1 = renderer()->mousePosition().y();
 
-		QRect rect (x0, y0, x1 - x0, y1 - y0);
+		QRect rect(x0, y0, x1 - x0, y1 - y0);
 		QColor fillColor = (m_addpick ? "#40FF00" : "#00CCFF");
-		fillColor.setAlphaF (0.2f);
-		painter.setPen (QPen (QColor (0, 0, 0, 208), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
-		painter.setBrush (QBrush (fillColor));
-		painter.drawRect (rect);
+		fillColor.setAlphaF(0.2f);
+		painter.setPen(QPen(QColor(0, 0, 0, 208), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+		painter.setBrush(QBrush(fillColor));
+		painter.drawRect(rect);
 	}
 }
 
-bool SelectMode::mouseReleased (MouseEventData const& data)
+bool SelectMode::mouseReleased(MouseEventData const& data)
 {
-	if (Super::mouseReleased (data))
+	if (Super::mouseReleased(data))
 		return true;
 
 	if (data.releasedButtons & Qt::LeftButton)
@@ -72,18 +72,18 @@
 
 			if (not m_rangepick)
 			{
-				area = QRect (mx, my, 1, 1);
+				area = QRect(mx, my, 1, 1);
 			}
 			else
 			{
-				int const x = qMin (m_rangeStart.x(), mx);
-				int const y = qMin (m_rangeStart.y(), my);
-				int const width = qAbs (m_rangeStart.x() - mx);
-				int const height = qAbs (m_rangeStart.y() - my);
-				area = QRect (x, y, width, height);
+				int const x = qMin(m_rangeStart.x(), mx);
+				int const y = qMin(m_rangeStart.y(), my);
+				int const width = qAbs(m_rangeStart.x() - mx);
+				int const height = qAbs(m_rangeStart.y() - my);
+				area = QRect(x, y, width, height);
 			}
 
-			renderer()->pick (area, m_addpick);
+			renderer()->pick(area, m_addpick);
 		}
 
 		m_rangepick = false;
@@ -93,16 +93,16 @@
 	return false;
 }
 
-bool SelectMode::mousePressed (QMouseEvent* ev)
+bool SelectMode::mousePressed(QMouseEvent* ev)
 {
-	if (Super::mousePressed (ev))
+	if (Super::mousePressed(ev))
 		return true;
 
 	if (ev->modifiers() & Qt::ControlModifier)
 	{
 		m_rangepick = true;
-		m_rangeStart.setX (ev->x());
-		m_rangeStart.setY (ev->y());
+		m_rangeStart.setX(ev->x());
+		m_rangeStart.setY(ev->y());
 		m_addpick = (ev->modifiers() & Qt::AltModifier);
 		return true;
 	}
@@ -110,19 +110,19 @@
 	return false;
 }
 
-bool SelectMode::mouseDoubleClicked (QMouseEvent* ev)
+bool SelectMode::mouseDoubleClicked(QMouseEvent* ev)
 {
-	if (Super::mouseDoubleClicked (ev))
+	if (Super::mouseDoubleClicked(ev))
 		return true;
 
 	if (ev->buttons() & Qt::LeftButton)
 	{
 		renderer()->document()->clearSelection();
-		LDObject* obj = renderer()->pickOneObject (ev->x(), ev->y());
+		LDObject* obj = renderer()->pickOneObject(ev->x(), ev->y());
 
 		if (obj)
 		{
-			AddObjectDialog::staticDialog (obj->type(), obj);
+			AddObjectDialog::staticDialog(obj->type(), obj);
 			m_window->endAction();
 			return true;
 		}
@@ -131,7 +131,7 @@
 	return false;
 }
 
-bool SelectMode::mouseMoved (QMouseEvent*)
+bool SelectMode::mouseMoved(QMouseEvent*)
 {
 	return m_rangepick;
 }
--- a/src/editmodes/selectMode.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/editmodes/selectMode.h	Thu Jan 04 19:44:26 2018 +0200
@@ -25,15 +25,15 @@
 	bool m_rangepick;
 	bool m_addpick;
 
-	DEFINE_CLASS (SelectMode, AbstractSelectMode)
+	DEFINE_CLASS(SelectMode, AbstractSelectMode)
 
 public:
-	SelectMode (GLRenderer* renderer);
+	SelectMode(GLRenderer* renderer);
 
-	void render (QPainter& painter) const override;
-	bool mousePressed (QMouseEvent* ev) override;
-	bool mouseReleased (MouseEventData const& data) override;
-	bool mouseDoubleClicked (QMouseEvent* ev) override;
-	bool mouseMoved (QMouseEvent*) override;
+	void render(QPainter& painter) const override;
+	bool mousePressed(QMouseEvent* ev) override;
+	bool mouseReleased(MouseEventData const& data) override;
+	bool mouseDoubleClicked(QMouseEvent* ev) override;
+	bool mouseMoved(QMouseEvent*) override;
 	EditModeType type() const override;
 };
\ No newline at end of file
--- a/src/format.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/format.h	Thu Jan 04 19:44:26 2018 +0200
@@ -26,26 +26,26 @@
 class StringFormatArg
 {
 public:
-	StringFormatArg (const QString& a) : m_text (a) {}
-	StringFormatArg (char a) : m_text (a) {}
-	StringFormatArg (uchar a) : m_text (a) {}
-	StringFormatArg (QChar a) : m_text (a) {}
-	StringFormatArg (int a) : m_text (QString::number (a)) {}
-	StringFormatArg (long a) : m_text (QString::number (a)) {}
-	StringFormatArg (float a) : m_text (QString::number (a)) {}
-	StringFormatArg (double a) : m_text (QString::number (a)) {}
-	StringFormatArg (const Vertex& a) : m_text (a.toString()) {}
-	StringFormatArg (const Matrix& a) : m_text (a.toString()) {}
-	StringFormatArg (const char* a) : m_text (a) {}
-	StringFormatArg (LDColor a) : m_text (a.indexString()) {}
+	StringFormatArg(const QString& a) : m_text(a) {}
+	StringFormatArg(char a) : m_text(a) {}
+	StringFormatArg(uchar a) : m_text(a) {}
+	StringFormatArg(QChar a) : m_text(a) {}
+	StringFormatArg(int a) : m_text(QString::number(a)) {}
+	StringFormatArg(long a) : m_text(QString::number(a)) {}
+	StringFormatArg(float a) : m_text(QString::number(a)) {}
+	StringFormatArg(double a) : m_text(QString::number(a)) {}
+	StringFormatArg(const Vertex& a) : m_text(a.toString()) {}
+	StringFormatArg(const Matrix& a) : m_text(a.toString()) {}
+	StringFormatArg(const char* a) : m_text(a) {}
+	StringFormatArg(LDColor a) : m_text(a.indexString()) {}
 
-	StringFormatArg (const void* a)
+	StringFormatArg(const void* a)
 	{
-		m_text.sprintf ("%p", a);
+		m_text.sprintf("%p", a);
 	}
 
 	template<typename T>
-	StringFormatArg (const QList<T>& a)
+	StringFormatArg(const QList<T>& a)
 	{
 		m_text = "{";
 
@@ -54,7 +54,7 @@
 			if (&it != &a.first())
 				m_text += ", ";
 
-			StringFormatArg arg (it);
+			StringFormatArg arg(it);
 			m_text += arg.text();
 		}
 
@@ -73,15 +73,15 @@
 
 // Helper function for format()
 template<typename Arg1, typename... Rest>
-void formatHelper (QString& str, Arg1 arg1, Rest... rest)
+void formatHelper(QString& str, Arg1 arg1, Rest... rest)
 {
-	str = str.arg (StringFormatArg (arg1).text());
-	formatHelper (str, rest...);
+	str = str.arg(StringFormatArg(arg1).text());
+	formatHelper(str, rest...);
 }
 
 
-static void formatHelper (QString& str) __attribute__ ((unused));
-static void formatHelper (QString& str)
+static void formatHelper(QString& str) __attribute__((unused));
+static void formatHelper(QString& str)
 {
 	(void) str;
 }
@@ -92,49 +92,49 @@
 // The formatting ultimately uses String's arg() method to actually format the args so the format string should be
 // prepared accordingly, with %1 referring to the first arg, %2 to the second, etc.
 template<typename... Args>
-QString format (QString fmtstr, Args... args)
+QString format(QString fmtstr, Args... args)
 {
-	formatHelper (fmtstr, args...);
+	formatHelper(fmtstr, args...);
 	return fmtstr;
 }
 
 
 // From messageLog.cc - declared here so that I don't need to include messageLog.h here.
-void printToLog (const QString& msg);
+void printToLog(const QString& msg);
 
 
 // Format and print the given args to the message log.
 template<typename... Args>
-void print (QString fmtstr, Args... args)
+void print(QString fmtstr, Args... args)
 {
-	formatHelper (fmtstr, args...);
-	printToLog (fmtstr);
+	formatHelper(fmtstr, args...);
+	printToLog(fmtstr);
 }
 
 template<typename... Args>
-void fprint (FILE* fp, QString fmtstr, Args... args)
+void fprint(FILE* fp, QString fmtstr, Args... args)
 {
-	formatHelper (fmtstr, args...);
-	fprintf (fp, "%s", qPrintable (fmtstr));
+	formatHelper(fmtstr, args...);
+	fprintf(fp, "%s", qPrintable(fmtstr));
 }
 
 
 template<typename... Args>
-void fprint (QIODevice& dev, QString fmtstr, Args... args)
+void fprint(QIODevice& dev, QString fmtstr, Args... args)
 {
-	formatHelper (fmtstr, args...);
-	dev.write (fmtstr.toUtf8());
+	formatHelper(fmtstr, args...);
+	dev.write(fmtstr.toUtf8());
 }
 
 
 // Exactly like print() except no-op in release builds.
 template<typename... Args>
 #ifndef RELEASE
-void dprint (QString fmtstr, Args... args)
+void dprint(QString fmtstr, Args... args)
 {
-	formatHelper (fmtstr, args...);
-	printToLog (fmtstr);
+	formatHelper(fmtstr, args...);
+	printToLog(fmtstr);
 }
 #else
-void dprint (QString, Args...) {}
+void dprint(QString, Args...) {}
 #endif
--- a/src/glCompiler.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/glCompiler.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -47,11 +47,11 @@
 	{ GL_STACK_OVERFLOW,				"The operation would have caused an overflow" },
 };
 
-ConfigOption (QString SelectColorBlend = "#0080FF")
+ConfigOption(QString SelectColorBlend = "#0080FF")
 
 // static QMap<LDObject*, String> g_objectOrigins;
 
-void CheckGLErrorImpl (const char* file, int line)
+void CheckGLErrorImpl(const char* file, int line)
 {
 	QString errmsg;
 	GLenum errnum = glGetError();
@@ -68,35 +68,35 @@
 		}
 	}
 
-	print ("OpenGL ERROR: at %1:%2: %3", Basename (QString (file)), line, errmsg);
+	print("OpenGL ERROR: at %1:%2: %3", Basename(QString(file)), line, errmsg);
 }
 
 
-GLCompiler::GLCompiler (GLRenderer* renderer) :
-	HierarchyElement (renderer),
-	m_renderer (renderer)
+GLCompiler::GLCompiler(GLRenderer* renderer) :
+	HierarchyElement(renderer),
+	m_renderer(renderer)
 {
 	needMerge();
-	memset (m_vboSizes, 0, sizeof m_vboSizes);
+	memset(m_vboSizes, 0, sizeof m_vboSizes);
 }
 
 
 void GLCompiler::initialize()
 {
 	initializeOpenGLFunctions();
-	glGenBuffers (NumVbos, &m_vbo[0]);
+	glGenBuffers(NumVbos, &m_vbo[0]);
 	CHECK_GL_ERROR();
 }
 
 
 GLCompiler::~GLCompiler()
 {
-	glDeleteBuffers (NumVbos, &m_vbo[0]);
+	glDeleteBuffers(NumVbos, &m_vbo[0]);
 	CHECK_GL_ERROR();
 }
 
 
-QColor GLCompiler::indexColorForID (int id) const
+QColor GLCompiler::indexColorForID(int id) const
 {
 	// Calculate a color based from this index. This method caters for
 	// 16777216 objects. I don't think that will be exceeded anytime soon. :)
@@ -104,17 +104,17 @@
 		g = (id / 0x100) % 0x100,
 		b = id % 0x100;
 
-	return QColor (r, g, b);
+	return QColor(r, g, b);
 }
 
 
-QColor GLCompiler::getColorForPolygon (LDPolygon& poly, LDObject* topobj, ComplementVboType complement) const
+QColor GLCompiler::getColorForPolygon(LDPolygon& poly, LDObject* topobj, ComplementVboType complement) const
 {
 	QColor qcol;
-	static const QColor bfcFrontColor (64, 192, 80);
-	static const QColor bfcBackColor (208, 64, 64);
+	static const QColor bfcFrontColor(64, 192, 80);
+	static const QColor bfcBackColor(208, 64, 64);
 
-	switch (complement)
+	switch(complement)
 	{
 	case SurfacesVboComplement:
 	case NumVboComplements:
@@ -129,7 +129,7 @@
 		break;
 
 	case PickColorsVboComplement:
-		return indexColorForID (topobj->id());
+		return indexColorForID(topobj->id());
 
 	case RandomColorsVboComplement:
 		qcol = topobj->randomColor();
@@ -145,7 +145,7 @@
 		}
 		else if (poly.color == EdgeColor)
 		{
-			qcol = luma (QColor (config.backgroundColor())) > 40 ? Qt::black : Qt::white;
+			qcol = luma(QColor(config.backgroundColor())) > 40 ? Qt::black : Qt::white;
 		}
 		else
 		{
@@ -168,9 +168,9 @@
 
 		// Warn about the unknown color, but only once.
 		static QList<int> warnedColors;
-		if (not warnedColors.contains (poly.color))
+		if (not warnedColors.contains(poly.color))
 		{
-			print ("Unknown color %1!\n", poly.color);
+			print("Unknown color %1!\n", poly.color);
 			warnedColors << poly.color;
 		}
 
@@ -186,11 +186,11 @@
 
 	if (blendAlpha != 0.0)
 	{
-		QColor selcolor (config.selectColorBlend());
+		QColor selcolor(config.selectColorBlend());
 		double denom = blendAlpha + 1.0;
-		qcol.setRed ((qcol.red() + (selcolor.red() * blendAlpha)) / denom);
-		qcol.setGreen ((qcol.green() + (selcolor.green() * blendAlpha)) / denom);
-		qcol.setBlue ((qcol.blue() + (selcolor.blue() * blendAlpha)) / denom);
+		qcol.setRed((qcol.red() +(selcolor.red() * blendAlpha)) / denom);
+		qcol.setGreen((qcol.green() +(selcolor.green() * blendAlpha)) / denom);
+		qcol.setBlue((qcol.blue() +(selcolor.blue() * blendAlpha)) / denom);
 	}
 
 	return qcol;
@@ -199,15 +199,15 @@
 
 void GLCompiler::needMerge()
 {
-	for (int i = 0; i < countof (m_vboChanged); ++i)
+	for (int i = 0; i < countof(m_vboChanged); ++i)
 		m_vboChanged[i] = true;
 }
 
 
-void GLCompiler::stageForCompilation (LDObject* obj)
+void GLCompiler::stageForCompilation(LDObject* obj)
 {
 	/*
-	g_objectOrigins[obj] = format ("%1:%2 (%3)",
+	g_objectOrigins[obj] = format("%1:%2(%3)",
 		obj->document()->getDisplayName(), obj->lineNumber(), obj->typeName());
 	*/
 
@@ -215,32 +215,32 @@
 }
 
 
-void GLCompiler::unstage (LDObject* obj)
+void GLCompiler::unstage(LDObject* obj)
 {
-	m_staged.remove (obj);
+	m_staged.remove(obj);
 }
 
 
-void GLCompiler::compileDocument (LDDocument* doc)
+void GLCompiler::compileDocument(LDDocument* doc)
 {
 	if (doc)
 	{
 		for (LDObject* obj : doc->objects())
-			compileObject (obj);
+			compileObject(obj);
 	}
 }
 
 
 void GLCompiler::compileStaged()
 {
-	for (QSetIterator<LDObject*> it (m_staged); it.hasNext();)
-		compileObject (it.next());
+	for (QSetIterator<LDObject*> it(m_staged); it.hasNext();)
+		compileObject(it.next());
 
 	m_staged.clear();
 }
 
 
-void GLCompiler::prepareVBO (int vbonum)
+void GLCompiler::prepareVBO(int vbonum)
 {
 	// Compile anything that still awaits it
 	compileStaged();
@@ -254,7 +254,7 @@
 	{
 		if (it.key() == nullptr)
 		{
-			it = m_objectInfo.erase (it);
+			it = m_objectInfo.erase(it);
 			continue;
 		}
 
@@ -264,35 +264,35 @@
 		++it;
 	}
 
-	glBindBuffer (GL_ARRAY_BUFFER, m_vbo[vbonum]);
-	glBufferData (GL_ARRAY_BUFFER, vbodata.size() * sizeof(GLfloat), vbodata.constData(), GL_STATIC_DRAW);
-	glBindBuffer (GL_ARRAY_BUFFER, 0);
+	glBindBuffer(GL_ARRAY_BUFFER, m_vbo[vbonum]);
+	glBufferData(GL_ARRAY_BUFFER, vbodata.size() * sizeof(GLfloat), vbodata.constData(), GL_STATIC_DRAW);
+	glBindBuffer(GL_ARRAY_BUFFER, 0);
 	CHECK_GL_ERROR();
 	m_vboChanged[vbonum] = false;
 	m_vboSizes[vbonum] = vbodata.size();
 }
 
 
-void GLCompiler::dropObjectInfo (LDObject* obj)
+void GLCompiler::dropObjectInfo(LDObject* obj)
 {
-	if (m_objectInfo.contains (obj))
+	if (m_objectInfo.contains(obj))
 	{
-		m_objectInfo.remove (obj);
+		m_objectInfo.remove(obj);
 		needMerge();
 	}
 }
 
 
-void GLCompiler::compileObject (LDObject* obj)
+void GLCompiler::compileObject(LDObject* obj)
 {
 	if (obj == nullptr or obj->document() == nullptr or obj->document()->isCache())
 		return;
 
 	ObjectVBOInfo info;
 	info.isChanged = true;
-	dropObjectInfo (obj);
+	dropObjectInfo(obj);
 
-	switch (obj->type())
+	switch(obj->type())
 	{
 	// Note: We cannot split quads into triangles here, it would mess up the wireframe view.
 	// Quads must go into separate vbos.
@@ -303,31 +303,31 @@
 		{
 			LDPolygon* poly = obj->getPolygon();
 			poly->id = obj->id();
-			compilePolygon (*poly, obj, &info);
+			compilePolygon(*poly, obj, &info);
 			delete poly;
 			break;
 		}
 
 	case OBJ_SubfileReference:
 		{
-			LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
+			LDSubfileReference* ref = static_cast<LDSubfileReference*>(obj);
 			auto data = ref->inlinePolygons();
 
 			for (LDPolygon& poly : data)
 			{
 				poly.id = obj->id();
-				compilePolygon (poly, obj, &info);
+				compilePolygon(poly, obj, &info);
 			}
 			break;
 		}
 
 	case OBJ_BezierCurve:
 		{
-			LDBezierCurve* curve = static_cast<LDBezierCurve*> (obj);
+			LDBezierCurve* curve = static_cast<LDBezierCurve*>(obj);
 			for (LDPolygon& poly : curve->rasterizePolygons())
 			{
 				poly.id = obj->id();
-				compilePolygon (poly, obj, &info);
+				compilePolygon(poly, obj, &info);
 			}
 		}
 		break;
@@ -341,12 +341,12 @@
 }
 
 
-void GLCompiler::compilePolygon (LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo)
+void GLCompiler::compilePolygon(LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo)
 {
 	SurfaceVboType surface;
 	int numverts;
 
-	switch (poly.num)
+	switch(poly.num)
 	{
 	case 2:	surface = LinesVbo;				numverts = 2; break;
 	case 3:	surface = TrianglesVbo;			numverts = 3; break;
@@ -357,9 +357,9 @@
 
 	for (ComplementVboType complement = FirstVboComplement; complement < NumVboComplements; ++complement)
 	{
-		const int vbonum = vboNumber (surface, complement);
+		const int vbonum = vboNumber(surface, complement);
 		QVector<GLfloat>& vbodata = objinfo->data[vbonum];
-		const QColor color = getColorForPolygon (poly, topobj, complement);
+		const QColor color = getColorForPolygon(poly, topobj, complement);
 
 		for (int vert = 0; vert < numverts; ++vert)
 		{
@@ -372,35 +372,35 @@
 			}
 			else
 			{
-				vbodata	<< ((GLfloat) color.red()) / 255.0f
-						<< ((GLfloat) color.green()) / 255.0f
-						<< ((GLfloat) color.blue()) / 255.0f
-						<< ((GLfloat) color.alpha()) / 255.0f;
+				vbodata	<<((GLfloat) color.red()) / 255.0f
+						<<((GLfloat) color.green()) / 255.0f
+						<<((GLfloat) color.blue()) / 255.0f
+						<<((GLfloat) color.alpha()) / 255.0f;
 			}
 		}
 	}
 }
 
 
-void GLCompiler::setRenderer (GLRenderer* renderer)
+void GLCompiler::setRenderer(GLRenderer* renderer)
 {
 	m_renderer = renderer;
 }
 
 
-int GLCompiler::vboNumber (SurfaceVboType surface, ComplementVboType complement)
+int GLCompiler::vboNumber(SurfaceVboType surface, ComplementVboType complement)
 {
 	return (surface * NumVboComplements) + complement;
 }
 
 
-GLuint GLCompiler::vbo (int vbonum) const
+GLuint GLCompiler::vbo(int vbonum) const
 {
 	return m_vbo[vbonum];
 }
 
 
-int GLCompiler::vboSize (int vbonum) const
+int GLCompiler::vboSize(int vbonum) const
 {
 	return m_vboSizes[vbonum];
 }
\ No newline at end of file
--- a/src/glCompiler.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/glCompiler.h	Thu Jan 04 19:44:26 2018 +0200
@@ -34,27 +34,27 @@
 		bool				isChanged;
 	};
 
-	GLCompiler (GLRenderer* renderer);
+	GLCompiler(GLRenderer* renderer);
 	~GLCompiler();
-	void compileDocument (LDDocument* doc);
-	void dropObjectInfo (LDObject* obj);
-	QColor getColorForPolygon (LDPolygon& poly, LDObject* topobj, ComplementVboType complement) const;
-	QColor indexColorForID (int id) const;
+	void compileDocument(LDDocument* doc);
+	void dropObjectInfo(LDObject* obj);
+	QColor getColorForPolygon(LDPolygon& poly, LDObject* topobj, ComplementVboType complement) const;
+	QColor indexColorForID(int id) const;
 	void initialize();
 	void needMerge();
-	void prepareVBO (int vbonum);
-	void setRenderer (GLRenderer* compiler);
-	void stageForCompilation (LDObject* obj);
-	void unstage (LDObject* obj);
-	GLuint vbo (int vbonum) const;
-	int vboSize (int vbonum) const;
+	void prepareVBO(int vbonum);
+	void setRenderer(GLRenderer* compiler);
+	void stageForCompilation(LDObject* obj);
+	void unstage(LDObject* obj);
+	GLuint vbo(int vbonum) const;
+	int vboSize(int vbonum) const;
 
-	static int vboNumber (SurfaceVboType surface, ComplementVboType complement);
+	static int vboNumber(SurfaceVboType surface, ComplementVboType complement);
 
 private:
 	void compileStaged();
-	void compileObject (LDObject* obj);
-	void compilePolygon (LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo);
+	void compileObject(LDObject* obj);
+	void compilePolygon(LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo);
 
 	QMap<LDObject*, ObjectVBOInfo>	m_objectInfo;
 	QSet<LDObject*> m_staged; // Objects that need to be compiled
@@ -64,5 +64,5 @@
 	GLRenderer* m_renderer;
 };
 
-#define CHECK_GL_ERROR() { CheckGLErrorImpl (__FILE__, __LINE__); }
-void CheckGLErrorImpl (const char* file, int line);
+#define CHECK_GL_ERROR() { CheckGLErrorImpl(__FILE__, __LINE__); }
+void CheckGLErrorImpl(const char* file, int line);
--- a/src/glRenderer.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/glRenderer.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -52,50 +52,50 @@
 	{{  0, -1, 0 }, Z, Y, false,  true, true }, // right
 };
 
-ConfigOption (QColor BackgroundColor = "#FFFFFF")
-ConfigOption (QColor MainColor = "#A0A0A0")
-ConfigOption (float MainColorAlpha = 1.0)
-ConfigOption (int LineThickness = 2)
-ConfigOption (bool BfcRedGreenView = false)
-ConfigOption (int Camera = 6)
-ConfigOption (bool BlackEdges = false)
-ConfigOption (bool DrawAxes = false)
-ConfigOption (bool DrawWireframe = false)
-ConfigOption (bool UseLogoStuds = false)
-ConfigOption (bool AntiAliasedLines = true)
-ConfigOption (bool RandomColors = false)
-ConfigOption (bool HighlightObjectBelowCursor = true)
-ConfigOption (bool DrawSurfaces = true)
-ConfigOption (bool DrawEdgeLines = true)
-ConfigOption (bool DrawConditionalLines = true)
+ConfigOption(QColor BackgroundColor = "#FFFFFF")
+ConfigOption(QColor MainColor = "#A0A0A0")
+ConfigOption(float MainColorAlpha = 1.0)
+ConfigOption(int LineThickness = 2)
+ConfigOption(bool BfcRedGreenView = false)
+ConfigOption(int Camera = 6)
+ConfigOption(bool BlackEdges = false)
+ConfigOption(bool DrawAxes = false)
+ConfigOption(bool DrawWireframe = false)
+ConfigOption(bool UseLogoStuds = false)
+ConfigOption(bool AntiAliasedLines = true)
+ConfigOption(bool RandomColors = false)
+ConfigOption(bool HighlightObjectBelowCursor = true)
+ConfigOption(bool DrawSurfaces = true)
+ConfigOption(bool DrawEdgeLines = true)
+ConfigOption(bool DrawConditionalLines = true)
 
 // =============================================================================
 //
-GLRenderer::GLRenderer (QWidget* parent) :
-	QGLWidget (parent),
-	HierarchyElement (parent),
-	m_document (nullptr),
-	m_initialized (false)
+GLRenderer::GLRenderer(QWidget* parent) :
+	QGLWidget(parent),
+	HierarchyElement(parent),
+	m_document(nullptr),
+	m_initialized(false)
 {
 	m_isPicking = false;
 	m_camera = (ECamera) config.camera();
 	m_drawToolTip = false;
-	m_currentEditMode = AbstractEditMode::createByType (this, EditModeType::Select);
+	m_currentEditMode = AbstractEditMode::createByType(this, EditModeType::Select);
 	m_panning = false;
-	m_compiler = new GLCompiler (this);
+	m_compiler = new GLCompiler(this);
 	m_objectAtCursor = nullptr;
-	setDrawOnly (false);
-	m_messageLog = new MessageManager (this);
-	m_messageLog->setRenderer (this);
+	setDrawOnly(false);
+	m_messageLog = new MessageManager(this);
+	m_messageLog->setRenderer(this);
 	m_width = m_height = -1;
 	m_position3D = Origin;
-	m_toolTipTimer = new QTimer (this);
-	m_toolTipTimer->setSingleShot (true);
+	m_toolTipTimer = new QTimer(this);
+	m_toolTipTimer->setSingleShot(true);
 	m_isCameraMoving = false;
-	m_thinBorderPen = QPen (QColor (0, 0, 0, 208), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
-	m_thinBorderPen.setWidth (1);
-	setAcceptDrops (true);
-	connect (m_toolTipTimer, SIGNAL (timeout()), this, SLOT (slot_toolTipTimer()));
+	m_thinBorderPen = QPen(QColor(0, 0, 0, 208), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
+	m_thinBorderPen.setWidth(1);
+	setAcceptDrops(true);
+	connect(m_toolTipTimer, SIGNAL(timeout()), this, SLOT(slot_toolTipTimer()));
 
 	// Init camera icons
 	for (ECamera cam = EFirstCamera; cam < ENumCameras; ++cam)
@@ -108,7 +108,7 @@
 		};
 
 		CameraIcon* info = &m_cameraIcons[cam];
-		info->image = new QPixmap (GetIcon (cameraIconNames[cam]));
+		info->image = new QPixmap(GetIcon(cameraIconNames[cam]));
 		info->cam = cam;
 	}
 
@@ -119,20 +119,20 @@
 //
 GLRenderer::~GLRenderer()
 {
-	for (int i = 0; i < countof (currentDocumentData().overlays); ++i)
+	for (int i = 0; i < countof(currentDocumentData().overlays); ++i)
 		delete currentDocumentData().overlays[i].img;
 
 	for (CameraIcon& info : m_cameraIcons)
 		delete info.image;
 
 	if (messageLog())
-		messageLog()->setRenderer (nullptr);
+		messageLog()->setRenderer(nullptr);
 
-	m_compiler->setRenderer (nullptr);
+	m_compiler->setRenderer(nullptr);
 	delete m_compiler;
 	delete m_currentEditMode;
-	glDeleteBuffers (1, &m_axesVbo);
-	glDeleteBuffers (1, &m_axesColorVbo);
+	glDeleteBuffers(1, &m_axesVbo);
+	glDeleteBuffers(1, &m_axesColorVbo);
 }
 
 // =============================================================================
@@ -146,12 +146,12 @@
 	for (CameraIcon& info : m_cameraIcons)
 	{
 		// MATH
-		int x1 = (m_width - (info.cam != EFreeCamera ? 48 : 16)) + ((i % 3) * 16) - 1;
+		int x1 = (m_width -(info.cam != EFreeCamera ? 48 : 16)) +((i % 3) * 16) - 1;
 		int y1 = ((i / 3) * 16) + 1;
 
-		info.sourceRect = QRect (0, 0, 16, 16);
-		info.targetRect = QRect (x1, y1, 16, 16);
-		info.selRect = QRect (
+		info.sourceRect = QRect(0, 0, 16, 16);
+		info.targetRect = QRect(x1, y1, 16, 16);
+		info.selRect = QRect(
 			info.targetRect.x(),
 			info.targetRect.y(),
 			info.targetRect.width() + 1,
@@ -166,25 +166,25 @@
 //
 void GLRenderer::initGLData()
 {
-	glEnable (GL_BLEND);
-	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-	glEnable (GL_POLYGON_OFFSET_FILL);
-	glPolygonOffset (1.0f, 1.0f);
-	glEnable (GL_DEPTH_TEST);
-	glShadeModel (GL_SMOOTH);
-	glEnable (GL_MULTISAMPLE);
+	glEnable(GL_BLEND);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glEnable(GL_POLYGON_OFFSET_FILL);
+	glPolygonOffset(1.0f, 1.0f);
+	glEnable(GL_DEPTH_TEST);
+	glShadeModel(GL_SMOOTH);
+	glEnable(GL_MULTISAMPLE);
 
 	if (config.antiAliasedLines())
 	{
-		glEnable (GL_LINE_SMOOTH);
-		glEnable (GL_POLYGON_SMOOTH);
-		glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
-		glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+		glEnable(GL_LINE_SMOOTH);
+		glEnable(GL_POLYGON_SMOOTH);
+		glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+		glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
 	}
 	else
 	{
-		glDisable (GL_LINE_SMOOTH);
-		glDisable (GL_POLYGON_SMOOTH);
+		glDisable(GL_LINE_SMOOTH);
+		glDisable(GL_POLYGON_SMOOTH);
 	}
 }
 
@@ -193,7 +193,7 @@
 	return m_isDrawOnly;
 }
 
-void GLRenderer::setDrawOnly (bool value)
+void GLRenderer::setDrawOnly(bool value)
 {
 	m_isDrawOnly = value;
 }
@@ -235,9 +235,9 @@
 //
 void GLRenderer::resetAngles()
 {
-	rotation (X) = 30.0f;
-	rotation (Y) = 325.f;
-	panning (X) = panning (Y) = rotation (Z) = 0.0f;
+	rotation(X) = 30.0f;
+	rotation(Y) = 325.f;
+	panning(X) = panning(Y) = rotation(Z) = 0.0f;
 	needZoomToFit();
 }
 
@@ -249,11 +249,11 @@
 
 	for (int i = 0; i < 7; ++i)
 	{
-		setCamera ((ECamera) i);
+		setCamera((ECamera) i);
 		resetAngles();
 	}
 
-	setCamera (oldcam);
+	setCamera(oldcam);
 }
 
 // =============================================================================
@@ -264,11 +264,11 @@
 	initializeOpenGLFunctions();
 #endif
 	setBackground();
-	glLineWidth (config.lineThickness());
-	glLineStipple (1, 0x6666);
-	setAutoFillBackground (false);
-	setMouseTracking (true);
-	setFocusPolicy (Qt::WheelFocus);
+	glLineWidth(config.lineThickness());
+	glLineStipple(1, 0x6666);
+	setAutoFillBackground(false);
+	setMouseTracking(true);
+	setFocusPolicy(Qt::WheelFocus);
 	compiler()->initialize();
 	initializeAxes();
 	m_initialized = true;
@@ -287,20 +287,20 @@
 
 	static const AxisInfo axisinfo[3] =
 	{
-		{ QColor (192,  96,  96), Vertex (10000, 0, 0) }, // X
-		{ QColor (48,  192,  48), Vertex (0, 10000, 0) }, // Y
-		{ QColor (48,  112, 192), Vertex (0, 0, 10000) }, // Z
+		{ QColor(192,  96,  96), Vertex(10000, 0, 0) }, // X
+		{ QColor(48,  192,  48), Vertex(0, 10000, 0) }, // Y
+		{ QColor(48,  112, 192), Vertex(0, 0, 10000) }, // Z
 	};
 
 	float axisdata[18];
 	float colordata[18];
-	memset (axisdata, 0, sizeof axisdata);
+	memset(axisdata, 0, sizeof axisdata);
 
 	for (int i = 0; i < 3; ++i)
 	{
 		const AxisInfo& data = axisinfo[i];
 
-		for_axes (ax)
+		for_axes(ax)
 		{
 			axisdata[(i * 6) + ax] = data.extrema[ax];
 			axisdata[(i * 6) + 3 + ax] = -data.extrema[ax];
@@ -312,13 +312,13 @@
 		colordata[offset + 2] = colordata[offset + 5] = data.color.blue();
 	}
 
-	glGenBuffers (1, &m_axesVbo);
-	glBindBuffer (GL_ARRAY_BUFFER, m_axesVbo);
-	glBufferData (GL_ARRAY_BUFFER, sizeof axisdata, axisdata, GL_STATIC_DRAW);
-	glGenBuffers (1, &m_axesColorVbo);
-	glBindBuffer (GL_ARRAY_BUFFER, m_axesColorVbo);
-	glBufferData (GL_ARRAY_BUFFER, sizeof colordata, colordata, GL_STATIC_DRAW);
-	glBindBuffer (GL_ARRAY_BUFFER, 0);
+	glGenBuffers(1, &m_axesVbo);
+	glBindBuffer(GL_ARRAY_BUFFER, m_axesVbo);
+	glBufferData(GL_ARRAY_BUFFER, sizeof axisdata, axisdata, GL_STATIC_DRAW);
+	glGenBuffers(1, &m_axesColorVbo);
+	glBindBuffer(GL_ARRAY_BUFFER, m_axesColorVbo);
+	glBufferData(GL_ARRAY_BUFFER, sizeof colordata, colordata, GL_STATIC_DRAW);
+	glBindBuffer(GL_ARRAY_BUFFER, 0);
 }
 
 // =============================================================================
@@ -327,7 +327,7 @@
 {
 	if (isPicking())
 	{
-		glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
+		glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
 		return;
 	}
 
@@ -336,10 +336,10 @@
 	if (not color.isValid())
 		return;
 
-	color.setAlpha (255);
-	m_useDarkBackground = luma (color) < 80;
+	color.setAlpha(255);
+	m_useDarkBackground = luma(color) < 80;
 	m_backgroundColor = color;
-	qglClearColor (color);
+	qglClearColor(color);
 }
 
 // =============================================================================
@@ -358,25 +358,25 @@
 {
 	if (m_initialized)
 	{
-		compiler()->compileDocument (currentDocument());
+		compiler()->compileDocument(currentDocument());
 		refresh();
 	}
 }
 
 // =============================================================================
 //
-void GLRenderer::resizeGL (int w, int h)
+void GLRenderer::resizeGL(int w, int h)
 {
 	m_width = w;
 	m_height = h;
 
 	calcCameraIcons();
 
-	glViewport (0, 0, w, h);
-	glMatrixMode (GL_PROJECTION);
+	glViewport(0, 0, w, h);
+	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
-	gluPerspective (45.0f, (double) w / (double) h, 1.0f, 40000.0f);
-	glMatrixMode (GL_MODELVIEW);
+	gluPerspective(45.0f,(double) w /(double) h, 1.0f, 40000.0f);
+	glMatrixMode(GL_MODELVIEW);
 }
 
 // =============================================================================
@@ -393,23 +393,23 @@
 	}
 
 	if (config.drawWireframe() and not isPicking())
-		glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 
-	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-	glEnable (GL_DEPTH_TEST);
+	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+	glEnable(GL_DEPTH_TEST);
 
 	if (camera() != EFreeCamera)
 	{
-		glMatrixMode (GL_PROJECTION);
+		glMatrixMode(GL_PROJECTION);
 		glPushMatrix();
 
 		glLoadIdentity();
-		glOrtho (-m_virtualWidth, m_virtualWidth, -m_virtualHeight, m_virtualHeight, -200.0f, 200.0f);
-		glTranslatef (panning (X), panning (Y), 0.0f);
+		glOrtho(-m_virtualWidth, m_virtualWidth, -m_virtualHeight, m_virtualHeight, -200.0f, 200.0f);
+		glTranslatef(panning(X), panning(Y), 0.0f);
 
 		if (camera() != EFrontCamera and camera() != EBackCamera)
 		{
-			glRotatef (90.0f, g_FixedCameras[camera()].glrotate[0],
+			glRotatef(90.0f, g_FixedCameras[camera()].glrotate[0],
 				g_FixedCameras[camera()].glrotate[1],
 				g_FixedCameras[camera()].glrotate[2]);
 		}
@@ -417,45 +417,45 @@
 		// Back camera needs to be handled differently
 		if (camera() == EBackCamera)
 		{
-			glRotatef (180.0f, 1.0f, 0.0f, 0.0f);
-			glRotatef (180.0f, 0.0f, 0.0f, 1.0f);
+			glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
+			glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
 		}
 	}
 	else
 	{
-		glMatrixMode (GL_MODELVIEW);
+		glMatrixMode(GL_MODELVIEW);
 		glPushMatrix();
 		glLoadIdentity();
 
-		glTranslatef (0.0f, 0.0f, -2.0f);
-		glTranslatef (panning (X), panning (Y), -zoom());
-		glRotatef (rotation (X), 1.0f, 0.0f, 0.0f);
-		glRotatef (rotation (Y), 0.0f, 1.0f, 0.0f);
-		glRotatef (rotation (Z), 0.0f, 0.0f, 1.0f);
+		glTranslatef(0.0f, 0.0f, -2.0f);
+		glTranslatef(panning(X), panning(Y), -zoom());
+		glRotatef(rotation(X), 1.0f, 0.0f, 0.0f);
+		glRotatef(rotation(Y), 0.0f, 1.0f, 0.0f);
+		glRotatef(rotation(Z), 0.0f, 0.0f, 1.0f);
 	}
 
-	glEnableClientState (GL_VERTEX_ARRAY);
-	glEnableClientState (GL_COLOR_ARRAY);
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glEnableClientState(GL_COLOR_ARRAY);
 
 	if (isPicking())
 	{
-		drawVbos (TrianglesVbo, PickColorsVboComplement, GL_TRIANGLES);
-		drawVbos (QuadsVbo, PickColorsVboComplement, GL_QUADS);
-		drawVbos (LinesVbo, PickColorsVboComplement, GL_LINES);
-		drawVbos (ConditionalLinesVbo, PickColorsVboComplement, GL_LINES);
+		drawVbos(TrianglesVbo, PickColorsVboComplement, GL_TRIANGLES);
+		drawVbos(QuadsVbo, PickColorsVboComplement, GL_QUADS);
+		drawVbos(LinesVbo, PickColorsVboComplement, GL_LINES);
+		drawVbos(ConditionalLinesVbo, PickColorsVboComplement, GL_LINES);
 	}
 	else
 	{
 		if (config.bfcRedGreenView())
 		{
-			glEnable (GL_CULL_FACE);
-			glCullFace (GL_BACK);
-			drawVbos (TrianglesVbo, BfcFrontColorsVboComplement, GL_TRIANGLES);
-			drawVbos (QuadsVbo, BfcFrontColorsVboComplement, GL_QUADS);
-			glCullFace (GL_FRONT);
-			drawVbos (TrianglesVbo, BfcBackColorsVboComplement, GL_TRIANGLES);
-			drawVbos (QuadsVbo, BfcBackColorsVboComplement, GL_QUADS);
-			glDisable (GL_CULL_FACE);
+			glEnable(GL_CULL_FACE);
+			glCullFace(GL_BACK);
+			drawVbos(TrianglesVbo, BfcFrontColorsVboComplement, GL_TRIANGLES);
+			drawVbos(QuadsVbo, BfcFrontColorsVboComplement, GL_QUADS);
+			glCullFace(GL_FRONT);
+			drawVbos(TrianglesVbo, BfcBackColorsVboComplement, GL_TRIANGLES);
+			drawVbos(QuadsVbo, BfcBackColorsVboComplement, GL_QUADS);
+			glDisable(GL_CULL_FACE);
 		}
 		else
 		{
@@ -466,65 +466,65 @@
 			else
 				colors = NormalColorsVboComplement;
 
-			drawVbos (TrianglesVbo, colors, GL_TRIANGLES);
-			drawVbos (QuadsVbo, colors, GL_QUADS);
+			drawVbos(TrianglesVbo, colors, GL_TRIANGLES);
+			drawVbos(QuadsVbo, colors, GL_QUADS);
 		}
 
-		drawVbos (LinesVbo, NormalColorsVboComplement, GL_LINES);
-		glEnable (GL_LINE_STIPPLE);
-		drawVbos (ConditionalLinesVbo, NormalColorsVboComplement, GL_LINES);
-		glDisable (GL_LINE_STIPPLE);
+		drawVbos(LinesVbo, NormalColorsVboComplement, GL_LINES);
+		glEnable(GL_LINE_STIPPLE);
+		drawVbos(ConditionalLinesVbo, NormalColorsVboComplement, GL_LINES);
+		glDisable(GL_LINE_STIPPLE);
 
 		if (config.drawAxes())
 		{
-			glBindBuffer (GL_ARRAY_BUFFER, m_axesVbo);
-			glVertexPointer (3, GL_FLOAT, 0, NULL);
-			glBindBuffer (GL_ARRAY_BUFFER, m_axesVbo);
-			glColorPointer (3, GL_FLOAT, 0, NULL);
-			glDrawArrays (GL_LINES, 0, 6);
+			glBindBuffer(GL_ARRAY_BUFFER, m_axesVbo);
+			glVertexPointer(3, GL_FLOAT, 0, NULL);
+			glBindBuffer(GL_ARRAY_BUFFER, m_axesVbo);
+			glColorPointer(3, GL_FLOAT, 0, NULL);
+			glDrawArrays(GL_LINES, 0, 6);
 			CHECK_GL_ERROR();
 		}
 	}
 
 	glPopMatrix();
-	glBindBuffer (GL_ARRAY_BUFFER, 0);
-	glDisableClientState (GL_VERTEX_ARRAY);
-	glDisableClientState (GL_COLOR_ARRAY);
+	glBindBuffer(GL_ARRAY_BUFFER, 0);
+	glDisableClientState(GL_VERTEX_ARRAY);
+	glDisableClientState(GL_COLOR_ARRAY);
 	CHECK_GL_ERROR();
-	glDisable (GL_CULL_FACE);
-	glMatrixMode (GL_MODELVIEW);
-	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+	glDisable(GL_CULL_FACE);
+	glMatrixMode(GL_MODELVIEW);
+	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 }
 
 // =============================================================================
 //
-void GLRenderer::drawVbos (SurfaceVboType surface, ComplementVboType colors, GLenum type)
+void GLRenderer::drawVbos(SurfaceVboType surface, ComplementVboType colors, GLenum type)
 {
 	// Filter this through some configuration options
-	if ((isOneOf (surface, QuadsVbo, TrianglesVbo) and config.drawSurfaces() == false)
-		or (surface == LinesVbo and config.drawEdgeLines() == false)
-		or (surface == ConditionalLinesVbo and config.drawConditionalLines() == false))
+	if ((isOneOf(surface, QuadsVbo, TrianglesVbo) and config.drawSurfaces() == false)
+		or(surface == LinesVbo and config.drawEdgeLines() == false)
+		or(surface == ConditionalLinesVbo and config.drawConditionalLines() == false))
 	{
 		return;
 	}
 
-	int surfacenum = m_compiler->vboNumber (surface, SurfacesVboComplement);
-	int colornum = m_compiler->vboNumber (surface, colors);
-	m_compiler->prepareVBO (surfacenum);
-	m_compiler->prepareVBO (colornum);
-	GLuint surfacevbo = m_compiler->vbo (surfacenum);
-	GLuint colorvbo = m_compiler->vbo (colornum);
-	GLsizei count = m_compiler->vboSize (surfacenum) / 3;
+	int surfacenum = m_compiler->vboNumber(surface, SurfacesVboComplement);
+	int colornum = m_compiler->vboNumber(surface, colors);
+	m_compiler->prepareVBO(surfacenum);
+	m_compiler->prepareVBO(colornum);
+	GLuint surfacevbo = m_compiler->vbo(surfacenum);
+	GLuint colorvbo = m_compiler->vbo(colornum);
+	GLsizei count = m_compiler->vboSize(surfacenum) / 3;
 
 	if (count > 0)
 	{
-		glBindBuffer (GL_ARRAY_BUFFER, surfacevbo);
-		glVertexPointer (3, GL_FLOAT, 0, nullptr);
+		glBindBuffer(GL_ARRAY_BUFFER, surfacevbo);
+		glVertexPointer(3, GL_FLOAT, 0, nullptr);
 		CHECK_GL_ERROR();
-		glBindBuffer (GL_ARRAY_BUFFER, colorvbo);
-		glColorPointer (4, GL_FLOAT, 0, nullptr);
+		glBindBuffer(GL_ARRAY_BUFFER, colorvbo);
+		glColorPointer(4, GL_FLOAT, 0, nullptr);
 		CHECK_GL_ERROR();
-		glDrawArrays (type, 0, count);
+		glDrawArrays(type, 0, count);
 		CHECK_GL_ERROR();
 	}
 }
@@ -534,7 +534,7 @@
 // This converts a 2D point on the screen to a 3D point in the model. If 'snap'
 // is true, the 3D point will snap to the current grid.
 //
-Vertex GLRenderer::convert2dTo3d (const QPoint& pos2d, bool snap) const
+Vertex GLRenderer::convert2dTo3d(const QPoint& pos2d, bool snap) const
 {
 	if (camera() == EFreeCamera)
 		return Origin;
@@ -547,25 +547,25 @@
 				negYFac = cam->negatedY ? -1 : 1;
 
 	// Calculate cx and cy - these are the LDraw unit coords the cursor is at.
-	double cx = (-m_virtualWidth + ((2 * pos2d.x() * m_virtualWidth) / m_width) - panning (X));
-	double cy = (m_virtualHeight - ((2 * pos2d.y() * m_virtualHeight) / m_height) - panning (Y));
+	double cx = (-m_virtualWidth +((2 * pos2d.x() * m_virtualWidth) / m_width) - panning(X));
+	double cy = (m_virtualHeight -((2 * pos2d.y() * m_virtualHeight) / m_height) - panning(Y));
 
 	if (snap)
 	{
-		cx = Grid::Snap (cx, Grid::Coordinate);
-		cy = Grid::Snap (cy, Grid::Coordinate);
+		cx = Grid::Snap(cx, Grid::Coordinate);
+		cy = Grid::Snap(cy, Grid::Coordinate);
 	}
 
 	cx *= negXFac;
 	cy *= negYFac;
 
-	RoundToDecimals (cx, 4);
-	RoundToDecimals (cy, 4);
+	RoundToDecimals(cx, 4);
+	RoundToDecimals(cy, 4);
 
 	// Create the vertex from the coordinates
-	pos3d.setCoordinate (axisX, cx);
-	pos3d.setCoordinate (axisY, cy);
-	pos3d.setCoordinate ((Axis) (3 - axisX - axisY), getDepthValue());
+	pos3d.setCoordinate(axisX, cx);
+	pos3d.setCoordinate(axisY, cy);
+	pos3d.setCoordinate((Axis)(3 - axisX - axisY), getDepthValue());
 	return pos3d;
 }
 
@@ -574,10 +574,10 @@
 // Inverse operation for the above - convert a 3D position to a 2D screen position. Don't ask me how this code manages
 // to work, I don't even know.
 //
-QPoint GLRenderer::convert3dTo2d (const Vertex& pos3d)
+QPoint GLRenderer::convert3dTo2d(const Vertex& pos3d)
 {
 	if (camera() == EFreeCamera)
-		return QPoint (0, 0);
+		return QPoint(0, 0);
 
 	const LDFixedCamera* cam = &g_FixedCameras[camera()];
 	const Axis axisX = cam->localX;
@@ -590,31 +590,31 @@
 	const double z = pos3d.z();
 	Vertex transformed;
 
-	glGetFloatv (GL_MODELVIEW_MATRIX, matrix);
-	transformed.setX ((matrix[0] * x) + (matrix[1] * y) + (matrix[2] * z) + matrix[3]);
-	transformed.setY ((matrix[4] * x) + (matrix[5] * y) + (matrix[6] * z) + matrix[7]);
-	transformed.setZ ((matrix[8] * x) + (matrix[9] * y) + (matrix[10] * z) + matrix[11]);
-	double rx = (((transformed[axisX] * negXFac) + m_virtualWidth + panning (X)) * m_width) / (2 * m_virtualWidth);
-	double ry = (((transformed[axisY] * negYFac) - m_virtualHeight + panning (Y)) * m_height) / (2 * m_virtualHeight);
-	return QPoint (rx, -ry);
+	glGetFloatv(GL_MODELVIEW_MATRIX, matrix);
+	transformed.setX((matrix[0] * x) +(matrix[1] * y) +(matrix[2] * z) + matrix[3]);
+	transformed.setY((matrix[4] * x) +(matrix[5] * y) +(matrix[6] * z) + matrix[7]);
+	transformed.setZ((matrix[8] * x) +(matrix[9] * y) +(matrix[10] * z) + matrix[11]);
+	double rx = (((transformed[axisX] * negXFac) + m_virtualWidth + panning(X)) * m_width) /(2 * m_virtualWidth);
+	double ry = (((transformed[axisY] * negYFac) - m_virtualHeight + panning(Y)) * m_height) /(2 * m_virtualHeight);
+	return QPoint(rx, -ry);
 }
 
 QPen GLRenderer::textPen() const
 {
-	return QPen (m_useDarkBackground ? Qt::white : Qt::black);
+	return QPen(m_useDarkBackground ? Qt::white : Qt::black);
 }
 
 QPen GLRenderer::linePen() const
 {
-	QPen linepen (m_thinBorderPen);
-	linepen.setWidth (2);
-	linepen.setColor (luma (m_backgroundColor) < 40 ? Qt::white : Qt::black);
+	QPen linepen(m_thinBorderPen);
+	linepen.setWidth(2);
+	linepen.setColor(luma(m_backgroundColor) < 40 ? Qt::white : Qt::black);
 	return linepen;
 }
 
 // =============================================================================
 //
-void GLRenderer::paintEvent (QPaintEvent*)
+void GLRenderer::paintEvent(QPaintEvent*)
 {
 	doMakeCurrent();
 	m_virtualWidth = zoom();
@@ -622,9 +622,9 @@
 	initGLData();
 	drawGLScene();
 
-	QPainter paint (this);
-	QFontMetrics metrics = QFontMetrics (QFont());
-	paint.setRenderHint (QPainter::HighQualityAntialiasing);
+	QPainter paint(this);
+	QFontMetrics metrics = QFontMetrics(QFont());
+	paint.setRenderHint(QPainter::HighQualityAntialiasing);
 
 	// If we wish to only draw the brick, stop here
 	if (isDrawOnly())
@@ -633,11 +633,11 @@
 #ifndef RELEASE
 	if (not isPicking())
 	{
-		QString text = format ("Rotation: (%1°, %2°, %3°)\nPanning: (%4, %5), Zoom: %6",
+		QString text = format("Rotation:(%1°, %2°, %3°)\nPanning:(%4, %5), Zoom: %6",
 			rotation(X), rotation(Y), rotation(Z), panning(X), panning(Y), zoom());
-		QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text);
-		paint.setPen (textPen());
-		paint.drawText ((width() - textSize.width()) / 2, height() - textSize.height(), textSize.width(),
+		QRect textSize = metrics.boundingRect(0, 0, m_width, m_height, Qt::AlignCenter, text);
+		paint.setPen(textPen());
+		paint.drawText((width() - textSize.width()) / 2, height() - textSize.height(), textSize.width(),
 			textSize.height(), Qt::AlignCenter, text);
 	}
 #endif
@@ -649,31 +649,31 @@
 
 		if (overlay.img)
 		{
-			QPoint v0 = convert3dTo2d (currentDocumentData().overlays[camera()].v0);
-			QPoint v1 = convert3dTo2d (currentDocumentData().overlays[camera()].v1);
-			QRect targetRect (v0.x(), v0.y(), qAbs (v1.x() - v0.x()), qAbs (v1.y() - v0.y()));
-			QRect sourceRect (0, 0, overlay.img->width(), overlay.img->height());
-			paint.drawImage (targetRect, *overlay.img, sourceRect);
+			QPoint v0 = convert3dTo2d(currentDocumentData().overlays[camera()].v0);
+			QPoint v1 = convert3dTo2d(currentDocumentData().overlays[camera()].v1);
+			QRect targetRect(v0.x(), v0.y(), qAbs(v1.x() - v0.x()), qAbs(v1.y() - v0.y()));
+			QRect sourceRect(0, 0, overlay.img->width(), overlay.img->height());
+			paint.drawImage(targetRect, *overlay.img, sourceRect);
 		}
 
 		// Paint the coordinates onto the screen.
-		QString text = format (tr ("X: %1, Y: %2, Z: %3"), m_position3D[X], m_position3D[Y], m_position3D[Z]);
-		QFontMetrics metrics = QFontMetrics (font());
-		QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text);
-		paint.setPen (textPen());
-		paint.drawText (m_width - textSize.width(), m_height - 16, textSize.width(),
+		QString text = format(tr("X: %1, Y: %2, Z: %3"), m_position3D[X], m_position3D[Y], m_position3D[Z]);
+		QFontMetrics metrics = QFontMetrics(font());
+		QRect textSize = metrics.boundingRect(0, 0, m_width, m_height, Qt::AlignCenter, text);
+		paint.setPen(textPen());
+		paint.drawText(m_width - textSize.width(), m_height - 16, textSize.width(),
 			textSize.height(), Qt::AlignCenter, text);
 	}
 
 	if (not isPicking())
 	{
 		// Draw edit mode HUD
-		m_currentEditMode->render (paint);
+		m_currentEditMode->render(paint);
 
 		// Draw a background for the selected camera
-		paint.setPen (m_thinBorderPen);
-		paint.setBrush (QBrush (QColor (0, 128, 160, 128)));
-		paint.drawRect (m_cameraIcons[camera()].selRect);
+		paint.setPen(m_thinBorderPen);
+		paint.setBrush(QBrush(QColor(0, 128, 160, 128)));
+		paint.drawRect(m_cameraIcons[camera()].selRect);
 
 		// Draw the camera icons
 		for (CameraIcon& info : m_cameraIcons)
@@ -682,23 +682,23 @@
 			if (&info == &m_cameraIcons[EFreeCamera] and not m_currentEditMode->allowFreeCamera())
 				continue;
 
-			paint.drawPixmap (info.targetRect, *info.image, info.sourceRect);
+			paint.drawPixmap(info.targetRect, *info.image, info.sourceRect);
 		}
 
 		// Draw a label for the current camera in the bottom left corner
 		{
 			const int margin = 4;
-			paint.setPen (textPen());
-			paint.drawText (QPoint (margin, height() - (margin + metrics.descent())), currentCameraName());
+			paint.setPen(textPen());
+			paint.drawText(QPoint(margin, height() -(margin + metrics.descent())), currentCameraName());
 		}
 
 		// Tool tips
 		if (m_drawToolTip)
 		{
-			if (not m_cameraIcons[m_toolTipCamera].targetRect.contains (m_mousePosition))
+			if (not m_cameraIcons[m_toolTipCamera].targetRect.contains(m_mousePosition))
 				m_drawToolTip = false;
 			else
-				QToolTip::showText (m_globalpos, currentCameraName());
+				QToolTip::showText(m_globalpos, currentCameraName());
 		}
 	}
 
@@ -711,9 +711,9 @@
 
 		for (const MessageManager::Line& line : messageLog()->getLines())
 		{
-			penColor.setAlphaF (line.alpha);
-			paint.setPen (penColor);
-			paint.drawText (QPoint (margin, y + margin + metrics.ascent()), line.text);
+			penColor.setAlphaF(line.alpha);
+			paint.setPen(penColor);
+			paint.drawText(QPoint(margin, y + margin + metrics.ascent()), line.text);
 			y += metrics.height();
 		}
 	}
@@ -721,30 +721,30 @@
 
 // =============================================================================
 //
-void GLRenderer::drawBlip (QPainter& painter, QPointF pos, QColor color) const
+void GLRenderer::drawBlip(QPainter& painter, QPointF pos, QColor color) const
 {
 	QPen pen = m_thinBorderPen;
 	const int blipsize = 8;
-	pen.setWidth (1);
-	painter.setPen (pen);
-	painter.setBrush (color);
-	painter.drawEllipse (pos.x() - blipsize / 2, pos.y() - blipsize / 2, blipsize, blipsize);
+	pen.setWidth(1);
+	painter.setPen(pen);
+	painter.setBrush(color);
+	painter.drawEllipse(pos.x() - blipsize / 2, pos.y() - blipsize / 2, blipsize, blipsize);
 }
 
-void GLRenderer::drawBlipCoordinates (QPainter& painter, const Vertex& pos3d)
+void GLRenderer::drawBlipCoordinates(QPainter& painter, const Vertex& pos3d)
 {
-	drawBlipCoordinates (painter, pos3d, convert3dTo2d (pos3d));
+	drawBlipCoordinates(painter, pos3d, convert3dTo2d(pos3d));
 }
 
-void GLRenderer::drawBlipCoordinates (QPainter& painter, const Vertex& pos3d, QPointF pos)
+void GLRenderer::drawBlipCoordinates(QPainter& painter, const Vertex& pos3d, QPointF pos)
 {
-	painter.setPen (textPen());
-	painter.drawText (pos.x(), pos.y() - 8, pos3d.toString (true));
+	painter.setPen(textPen());
+	painter.drawText(pos.x(), pos.y() - 8, pos3d.toString(true));
 }
 
 // =============================================================================
 //
-void GLRenderer::clampAngle (double& angle) const
+void GLRenderer::clampAngle(double& angle) const
 {
 	while (angle < 0)
 		angle += 360.0;
@@ -755,9 +755,9 @@
 
 // =============================================================================
 //
-void GLRenderer::mouseReleaseEvent (QMouseEvent* ev)
+void GLRenderer::mouseReleaseEvent(QMouseEvent* ev)
 {
-	bool wasLeft = (m_lastButtons & Qt::LeftButton) and not (ev->buttons() & Qt::LeftButton);
+	bool wasLeft = (m_lastButtons & Qt::LeftButton) and not(ev->buttons() & Qt::LeftButton);
 	Qt::MouseButtons releasedbuttons = m_lastButtons & ~ev->buttons();
 	m_panning = false;
 
@@ -768,9 +768,9 @@
 		{
 			for (CameraIcon & info : m_cameraIcons)
 			{
-				if (info.targetRect.contains (ev->pos()))
+				if (info.targetRect.contains(ev->pos()))
 				{
-					setCamera (info.cam);
+					setCamera(info.cam);
 					goto end;
 				}
 			}
@@ -785,7 +785,7 @@
 		data.keymods = m_currentKeyboardModifiers;
 		data.releasedButtons = releasedbuttons;
 
-		if (m_currentEditMode->mouseReleased (data))
+		if (m_currentEditMode->mouseReleased(data))
 			goto end;
 	}
 
@@ -796,50 +796,50 @@
 
 // =============================================================================
 //
-void GLRenderer::mousePressEvent (QMouseEvent* ev)
+void GLRenderer::mousePressEvent(QMouseEvent* ev)
 {
 	m_totalMouseMove = 0;
 	m_lastButtons = ev->buttons();
 
-	if (m_currentEditMode->mousePressed (ev))
+	if (m_currentEditMode->mousePressed(ev))
 		ev->accept();
 }
 
 // =============================================================================
 //
-void GLRenderer::mouseMoveEvent (QMouseEvent* ev)
+void GLRenderer::mouseMoveEvent(QMouseEvent* ev)
 {
 	int dx = ev->x() - m_mousePosition.x();
 	int dy = ev->y() - m_mousePosition.y();
-	m_totalMouseMove += qAbs (dx) + qAbs (dy);
+	m_totalMouseMove += qAbs(dx) + qAbs(dy);
 	m_isCameraMoving = false;
 
-	if (not m_currentEditMode->mouseMoved (ev))
+	if (not m_currentEditMode->mouseMoved(ev))
 	{
 		const bool left = ev->buttons() & Qt::LeftButton,
 				mid = ev->buttons() & Qt::MidButton,
 				shift = ev->modifiers() & Qt::ShiftModifier;
 
-		if (mid or (left and shift))
+		if (mid or(left and shift))
 		{
-			panning (X) += 0.03f * dx * (zoom() / 7.5f);
-			panning (Y) -= 0.03f * dy * (zoom() / 7.5f);
+			panning(X) += 0.03f * dx *(zoom() / 7.5f);
+			panning(Y) -= 0.03f * dy *(zoom() / 7.5f);
 			m_panning = true;
 			m_isCameraMoving = true;
 		}
 		else if (left and camera() == EFreeCamera)
 		{
-			rotation (X) = rotation (X) + dy;
-			rotation (Y) = rotation (Y) + dx;
-			clampAngle (rotation (X));
-			clampAngle (rotation (Y));
+			rotation(X) = rotation(X) + dy;
+			rotation(Y) = rotation(Y) + dx;
+			clampAngle(rotation(X));
+			clampAngle(rotation(Y));
 			m_isCameraMoving = true;
 		}
 	}
 
 	// Start the tool tip timer
 	if (not m_drawToolTip)
-		m_toolTipTimer->start (500);
+		m_toolTipTimer->start(500);
 
 	// Update 2d position
 	m_mousePosition = ev->pos();
@@ -852,7 +852,7 @@
 #endif
 
 	// Calculate 3d position of the cursor
-	m_position3D = (camera() != EFreeCamera) ? convert2dTo3d (m_mousePosition, true) : Origin;
+	m_position3D = (camera() != EFreeCamera) ? convert2dTo3d(m_mousePosition, true) : Origin;
 
 	highlightCursorObject();
 	update();
@@ -861,28 +861,28 @@
 
 // =============================================================================
 //
-void GLRenderer::keyPressEvent (QKeyEvent* ev)
+void GLRenderer::keyPressEvent(QKeyEvent* ev)
 {
 	m_currentKeyboardModifiers = ev->modifiers();
 }
 
 // =============================================================================
 //
-void GLRenderer::keyReleaseEvent (QKeyEvent* ev)
+void GLRenderer::keyReleaseEvent(QKeyEvent* ev)
 {
 	m_currentKeyboardModifiers = ev->modifiers();
-	m_currentEditMode->keyReleased (ev);
+	m_currentEditMode->keyReleased(ev);
 	update();
 }
 
 // =============================================================================
 //
-void GLRenderer::wheelEvent (QWheelEvent* ev)
+void GLRenderer::wheelEvent(QWheelEvent* ev)
 {
 	doMakeCurrent();
 
-	zoomNotch (ev->delta() > 0);
-	zoom() = qBound (0.01, zoom(), 10000.0);
+	zoomNotch(ev->delta() > 0);
+	zoom() = qBound(0.01, zoom(), 10000.0);
 	m_isCameraMoving = true;
 	update();
 	ev->accept();
@@ -890,7 +890,7 @@
 
 // =============================================================================
 //
-void GLRenderer::leaveEvent (QEvent* ev)
+void GLRenderer::leaveEvent(QEvent* ev)
 {
 	(void) ev;
 	m_drawToolTip = false;
@@ -900,34 +900,34 @@
 
 // =============================================================================
 //
-void GLRenderer::contextMenuEvent (QContextMenuEvent* ev)
+void GLRenderer::contextMenuEvent(QContextMenuEvent* ev)
 {
-	m_window->spawnContextMenu (ev->globalPos());
+	m_window->spawnContextMenu(ev->globalPos());
 }
 
 // =============================================================================
 //
-void GLRenderer::setCamera (const ECamera cam)
+void GLRenderer::setCamera(const ECamera cam)
 {
 	// The edit mode may forbid the free camera.
 	if (cam == EFreeCamera and not m_currentEditMode->allowFreeCamera())
 		return;
 
 	m_camera = cam;
-	config.setCamera ((int) cam);
+	config.setCamera((int) cam);
 	m_window->updateEditModeActions();
 }
 
 // =============================================================================
 //
-void GLRenderer::pick (int mouseX, int mouseY, bool additive)
+void GLRenderer::pick(int mouseX, int mouseY, bool additive)
 {
-	pick (QRect (mouseX, mouseY, mouseX + 1, mouseY + 1), additive);
+	pick(QRect(mouseX, mouseY, mouseX + 1, mouseY + 1), additive);
 }
 
 // =============================================================================
 //
-void GLRenderer::pick (QRect const& range, bool additive)
+void GLRenderer::pick(QRect const& range, bool additive)
 {
 	doMakeCurrent();
 
@@ -938,11 +938,11 @@
 		currentDocument()->clearSelection();
 
 		for (LDObject* obj : oldSelection)
-			compileObject (obj);
+			compileObject(obj);
 	}
 
 	// Paint the picking scene
-	setPicking (true);
+	setPicking(true);
 	drawGLScene();
 
 	int x0 = range.left();
@@ -951,10 +951,10 @@
 	int y1 = y0 + range.height();
 
 	// Clamp the values to ensure they're within bounds
-	x0 = qMax (0, x0);
-	y0 = qMax (0, y0);
-	x1 = qMin (x1, m_width);
-	y1 = qMin (y1, m_height);
+	x0 = qMax(0, x0);
+	y0 = qMax(0, y0);
+	x1 = qMin(x1, m_width);
+	y1 = qMin(y1, m_height);
 	const int areawidth = (x1 - x0);
 	const int areaheight = (y1 - y0);
 	const qint32 numpixels = areawidth * areaheight;
@@ -964,7 +964,7 @@
 	uchar* pixelptr = &pixeldata[0];
 
 	// Read pixels from the color buffer.
-	glReadPixels (x0, m_height - y1, areawidth, areaheight, GL_RGBA, GL_UNSIGNED_BYTE, pixeldata);
+	glReadPixels(x0, m_height - y1, areawidth, areaheight, GL_RGBA, GL_UNSIGNED_BYTE, pixeldata);
 
 	LDObject* removedObj = nullptr;
 	QList<qint32> indices;
@@ -983,11 +983,11 @@
 			indices << idx;
 	}
 
-	removeDuplicates (indices);
+	removeDuplicates(indices);
 
 	for (qint32 idx : indices)
 	{
-		LDObject* obj = LDObject::fromID (idx);
+		LDObject* obj = LDObject::fromID(idx);
 
 		if (obj == nullptr)
 			continue;
@@ -1014,44 +1014,44 @@
 
 	// Recompile the objects now to update their color
 	for (LDObject* obj : selectedObjects())
-		compileObject (obj);
+		compileObject(obj);
 
 	if (removedObj)
-		compileObject (removedObj);
+		compileObject(removedObj);
 
-	setPicking (false);
+	setPicking(false);
 	repaint();
 }
 
 //
 // Simpler version of GLRenderer::pick which simply picks whatever object on the screen
 //
-LDObject* GLRenderer::pickOneObject (int mouseX, int mouseY)
+LDObject* GLRenderer::pickOneObject(int mouseX, int mouseY)
 {
 	uchar pixel[4];
 	doMakeCurrent();
-	setPicking (true);
+	setPicking(true);
 	drawGLScene();
-	glReadPixels (mouseX, m_height - mouseY, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
-	LDObject* obj = LDObject::fromID ((pixel[0] * 0x10000) + (pixel[1] * 0x100) + pixel[2]);
-	setPicking (false);
+	glReadPixels(mouseX, m_height - mouseY, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
+	LDObject* obj = LDObject::fromID((pixel[0] * 0x10000) +(pixel[1] * 0x100) + pixel[2]);
+	setPicking(false);
 	repaint();
 	return obj;
 }
 
 // =============================================================================
 //
-void GLRenderer::setEditMode (EditModeType a)
+void GLRenderer::setEditMode(EditModeType a)
 {
 	if (m_currentEditMode and m_currentEditMode->type() == a)
 		return;
 
 	delete m_currentEditMode;
-	m_currentEditMode = AbstractEditMode::createByType (this, a);
+	m_currentEditMode = AbstractEditMode::createByType(this, a);
 
 	// If we cannot use the free camera, use the top one instead.
 	if (camera() == EFreeCamera and not m_currentEditMode->allowFreeCamera())
-		setCamera (ETopCamera);
+		setCamera(ETopCamera);
 
 	m_window->updateEditModeActions();
 	update();
@@ -1066,7 +1066,7 @@
 
 // =============================================================================
 //
-void GLRenderer::setDocument (LDDocument* document)
+void GLRenderer::setDocument(LDDocument* document)
 {
 	m_document = document;
 
@@ -1086,30 +1086,30 @@
 
 // =============================================================================
 //
-void GLRenderer::setPicking (bool value)
+void GLRenderer::setPicking(bool value)
 {
 	m_isPicking = value;
 	setBackground();
 
 	if (isPicking())
 	{
-		glDisable (GL_DITHER);
+		glDisable(GL_DITHER);
 
 		// Use particularly thick lines while picking ease up selecting lines.
-		glLineWidth (qMax<double> (config.lineThickness(), 6.5));
+		glLineWidth(qMax<double>(config.lineThickness(), 6.5));
 	}
 	else
 	{
-		glEnable (GL_DITHER);
+		glEnable(GL_DITHER);
 
 		// Restore line thickness
-		glLineWidth (config.lineThickness());
+		glLineWidth(config.lineThickness());
 	}
 }
 
 // =============================================================================
 //
-void GLRenderer::getRelativeAxes (Axis& relX, Axis& relY) const
+void GLRenderer::getRelativeAxes(Axis& relX, Axis& relY) const
 {
 	const LDFixedCamera* cam = &g_FixedCameras[camera()];
 	relX = cam->localX;
@@ -1121,22 +1121,22 @@
 Axis GLRenderer::getRelativeZ() const
 {
 	const LDFixedCamera* cam = &g_FixedCameras[camera()];
-	return (Axis) (3 - cam->localX - cam->localY);
+	return (Axis)(3 - cam->localX - cam->localY);
 }
 
 // =============================================================================
 //
-void GLRenderer::compileObject (LDObject* obj)
+void GLRenderer::compileObject(LDObject* obj)
 {
-	compiler()->stageForCompilation (obj);
+	compiler()->stageForCompilation(obj);
 }
 
 // =============================================================================
 //
-void GLRenderer::forgetObject (LDObject* obj)
+void GLRenderer::forgetObject(LDObject* obj)
 {
-	compiler()->dropObjectInfo (obj);
-	compiler()->unstage (obj);
+	compiler()->dropObjectInfo(obj);
+	compiler()->unstage(obj);
 
 	if (m_objectAtCursor == obj)
 		m_objectAtCursor = nullptr;
@@ -1147,11 +1147,11 @@
 QByteArray GLRenderer::capturePixels()
 {
 	QByteArray result;
-	result.resize (4 * width() * height());
+	result.resize(4 * width() * height());
 	m_takingScreenCapture = true;
 	update(); // Smile!
 	m_takingScreenCapture = false;
-	glReadPixels (0, 0, width(), height(), GL_RGBA, GL_UNSIGNED_BYTE, reinterpret_cast<uchar*> (result.data()));
+	glReadPixels(0, 0, width(), height(), GL_RGBA, GL_UNSIGNED_BYTE, reinterpret_cast<uchar*>(result.data()));
 	return result;
 }
 
@@ -1164,7 +1164,7 @@
 	// a tooltip.
 	for (CameraIcon & icon : m_cameraIcons)
 	{
-		if (icon.targetRect.contains (m_mousePosition))
+		if (icon.targetRect.contains(m_mousePosition))
 		{
 			m_toolTipCamera = icon.cam;
 			m_drawToolTip = true;
@@ -1176,7 +1176,7 @@
 
 // =============================================================================
 //
-Axis GLRenderer::getCameraAxis (bool y, ECamera camid)
+Axis GLRenderer::getCameraAxis(bool y, ECamera camid)
 {
 	if (camid == (ECamera) -1)
 		camid = camera();
@@ -1187,14 +1187,14 @@
 
 // =============================================================================
 //
-bool GLRenderer::setupOverlay (ECamera cam, QString file, int x, int y, int w, int h)
+bool GLRenderer::setupOverlay(ECamera cam, QString file, int x, int y, int w, int h)
 {
-	QImage* img = new QImage (QImage (file).convertToFormat (QImage::Format_ARGB32));
-	LDGLOverlay& info = getOverlay (cam);
+	QImage* img = new QImage(QImage(file).convertToFormat(QImage::Format_ARGB32));
+	LDGLOverlay& info = getOverlay(cam);
 
 	if (img->isNull())
 	{
-		Critical (tr ("Failed to load overlay image!"));
+		Critical(tr("Failed to load overlay image!"));
 		currentDocumentData().overlays[cam].invalid = true;
 		delete img;
 		return false;
@@ -1215,23 +1215,23 @@
 	else if (info.lh == 0)
 		info.lh = (info.lw * img->height()) / img->width();
 
-	const Axis x2d = getCameraAxis (false, cam),
-		y2d = getCameraAxis (true, cam);
+	const Axis x2d = getCameraAxis(false, cam),
+		y2d = getCameraAxis(true, cam);
 	const double negXFac = g_FixedCameras[cam].negatedX ? -1 : 1,
 		negYFac = g_FixedCameras[cam].negatedY ? -1 : 1;
 
 	info.v0 = info.v1 = Origin;
-	info.v0.setCoordinate (x2d, -(info.ox * info.lw * negXFac) / img->width());
-	info.v0.setCoordinate (y2d, (info.oy * info.lh * negYFac) / img->height());
-	info.v1.setCoordinate (x2d, info.v0[x2d] + info.lw);
-	info.v1.setCoordinate (y2d, info.v0[y2d] + info.lh);
+	info.v0.setCoordinate(x2d, -(info.ox * info.lw * negXFac) / img->width());
+	info.v0.setCoordinate(y2d,(info.oy * info.lh * negYFac) / img->height());
+	info.v1.setCoordinate(x2d, info.v0[x2d] + info.lw);
+	info.v1.setCoordinate(y2d, info.v0[y2d] + info.lh);
 
 	// Set alpha of all pixels to 0.5
 	for (long i = 0; i < img->width(); ++i)
 	for (long j = 0; j < img->height(); ++j)
 	{
-		uint32 pixel = img->pixel (i, j);
-		img->setPixel (i, j, 0x80000000 | (pixel & 0x00FFFFFF));
+		uint32 pixel = img->pixel(i, j);
+		img->setPixel(i, j, 0x80000000 |(pixel & 0x00FFFFFF));
 	}
 
 	updateOverlayObjects();
@@ -1254,7 +1254,7 @@
 
 // =============================================================================
 //
-void GLRenderer::setDepthValue (double depth)
+void GLRenderer::setDepthValue(double depth)
 {
 	if (camera() < EFreeCamera)
 		currentDocumentData().depthValues[camera()] = depth;
@@ -1272,17 +1272,17 @@
 
 // =============================================================================
 //
-QString GLRenderer::cameraName (ECamera camera) const
+QString GLRenderer::cameraName(ECamera camera) const
 {
-	switch (camera)
+	switch(camera)
 	{
-	case ETopCamera: return tr ("Top Camera");
-	case EFrontCamera: return tr ("Front Camera");
-	case ELeftCamera: return tr ("Left Camera");
-	case EBottomCamera: return tr ("Bottom Camera");
-	case EBackCamera: return tr ("Back Camera");
-	case ERightCamera: return tr ("Right Camera");
-	case EFreeCamera: return tr ("Free Camera");
+	case ETopCamera: return tr("Top Camera");
+	case EFrontCamera: return tr("Front Camera");
+	case ELeftCamera: return tr("Left Camera");
+	case EBottomCamera: return tr("Bottom Camera");
+	case EBackCamera: return tr("Back Camera");
+	case ERightCamera: return tr("Right Camera");
+	case EFreeCamera: return tr("Free Camera");
 	default: break;
 	}
 
@@ -1291,19 +1291,19 @@
 
 QString GLRenderer::currentCameraName() const
 {
-	return cameraName (camera());
+	return cameraName(camera());
 }
 
 // =============================================================================
 //
-LDGLOverlay& GLRenderer::getOverlay (int newcam)
+LDGLOverlay& GLRenderer::getOverlay(int newcam)
 {
 	return currentDocumentData().overlays[newcam];
 }
 
 // =============================================================================
 //
-void GLRenderer::zoomNotch (bool inward)
+void GLRenderer::zoomNotch(bool inward)
 {
 	zoom() *= inward ? 0.833f : 1.2f;
 }
@@ -1325,7 +1325,7 @@
 
 	// Use the pick list while drawing the scene, this way we can tell whether borders
 	// are background or not.
-	setPicking (true);
+	setPicking(true);
 
 	while (--runaway)
 	{
@@ -1336,17 +1336,17 @@
 			break;
 		}
 
-		zoomNotch (inward);
-		QVector<unsigned char> capture (4 * m_width * m_height);
+		zoomNotch(inward);
+		QVector<unsigned char> capture(4 * m_width * m_height);
 		drawGLScene();
-		glReadPixels (0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, capture.data());
-		QImage image (capture.constData(), m_width, m_height, QImage::Format_ARGB32);
+		glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, capture.data());
+		QImage image(capture.constData(), m_width, m_height, QImage::Format_ARGB32);
 		bool filled = false;
 
 		// Check the top and bottom rows
 		for (int i = 0; i < image.width(); ++i)
 		{
-			if (image.pixel (i, 0) != black or image.pixel (i, m_height - 1) != black)
+			if (image.pixel(i, 0) != black or image.pixel(i, m_height - 1) != black)
 			{
 				filled = true;
 				break;
@@ -1358,7 +1358,7 @@
 		{
 			for (int i = 0; i < image.height(); ++i)
 			{
-				if (image.pixel (0, i) != black or image.pixel (m_width - 1, i) != black)
+				if (image.pixel(0, i) != black or image.pixel(m_width - 1, i) != black)
 				{
 					filled = true;
 					break;
@@ -1380,7 +1380,7 @@
 			// last run had ideal zoom - zoom a bit back and we should reach it.
 			if (filled and not lastfilled)
 			{
-				zoomNotch (false);
+				zoomNotch(false);
 				break;
 			}
 
@@ -1395,7 +1395,7 @@
 		lastfilled = filled;
 	}
 
-	setPicking (false);
+	setPicking(false);
 }
 
 // =============================================================================
@@ -1407,19 +1407,19 @@
 
 // =============================================================================
 //
-void GLRenderer::mouseDoubleClickEvent (QMouseEvent* ev)
+void GLRenderer::mouseDoubleClickEvent(QMouseEvent* ev)
 {
-	if (m_currentEditMode->mouseDoubleClicked (ev))
+	if (m_currentEditMode->mouseDoubleClicked(ev))
 		ev->accept();
 }
 
 // =============================================================================
 //
-LDOverlay* GLRenderer::findOverlayObject (ECamera cam)
+LDOverlay* GLRenderer::findOverlayObject(ECamera cam)
 {
 	for (LDObject* obj : document()->objects())
 	{
-		LDOverlay* overlay = dynamic_cast<LDOverlay*> (obj);
+		LDOverlay* overlay = dynamic_cast<LDOverlay*>(obj);
 
 		if (overlay and overlay->camera() == cam)
 			return overlay;
@@ -1440,7 +1440,7 @@
 			continue;
 
 		LDGLOverlay& meta = currentDocumentData().overlays[cam];
-		LDOverlay* ovlobj = findOverlayObject (cam);
+		LDOverlay* ovlobj = findOverlayObject(cam);
 
 		if (ovlobj == nullptr and meta.img)
 		{
@@ -1451,7 +1451,7 @@
 			(meta.img == nullptr or meta.fname != ovlobj->fileName()) and
 			not meta.invalid)
 		{
-			setupOverlay (cam, ovlobj->fileName(), ovlobj->x(),
+			setupOverlay(cam, ovlobj->fileName(), ovlobj->x(),
 				ovlobj->y(), ovlobj->width(), ovlobj->height());
 		}
 	}
@@ -1467,7 +1467,7 @@
 			continue;
 
 		LDGLOverlay& meta = currentDocumentData().overlays[cam];
-		LDOverlay* ovlobj = findOverlayObject (cam);
+		LDOverlay* ovlobj = findOverlayObject(cam);
 
 		if (meta.img == nullptr and ovlobj)
 		{
@@ -1491,14 +1491,14 @@
 			// this into the header, which is everything up to the first scemantic
 			// object. If we find another overlay object, place this object after
 			// the last one found. Otherwise, place it before the first schemantic
-			// object and put an empty object after it (though don't do this if
+			// object and put an empty object after it(though don't do this if
 			// there was no schemantic elements at all)
 			int i, lastOverlay = -1;
 			bool found = false;
 
 			for (i = 0; i < document()->getObjectCount(); ++i)
 			{
-				LDObject* obj = document()->getObject (i);
+				LDObject* obj = document()->getObject(i);
 
 				if (obj->isScemantic())
 				{
@@ -1511,24 +1511,24 @@
 			}
 
 			if (lastOverlay != -1)
-				document()->insertObj (lastOverlay + 1, ovlobj);
+				document()->insertObj(lastOverlay + 1, ovlobj);
 			else
 			{
-				document()->insertObj (i, ovlobj);
+				document()->insertObj(i, ovlobj);
 
 				if (found)
-					document()->insertObj (i + 1, LDSpawn<LDEmpty>());
+					document()->insertObj(i + 1, LDSpawn<LDEmpty>());
 			}
 		}
 
 		if (meta.img and ovlobj)
 		{
-			ovlobj->setCamera (cam);
-			ovlobj->setFileName (meta.fname);
-			ovlobj->setX (meta.ox);
-			ovlobj->setY (meta.oy);
-			ovlobj->setWidth (meta.lw);
-			ovlobj->setHeight (meta.lh);
+			ovlobj->setCamera(cam);
+			ovlobj->setFileName(meta.fname);
+			ovlobj->setX(meta.ox);
+			ovlobj->setY(meta.oy);
+			ovlobj->setWidth(meta.lw);
+			ovlobj->setHeight(meta.lh);
 		}
 	}
 
@@ -1553,50 +1553,50 @@
 	}
 	else
 	{
-		setPicking (true);
+		setPicking(true);
 		drawGLScene();
-		setPicking (false);
+		setPicking(false);
 
 		unsigned char pixel[4];
-		glReadPixels (m_mousePosition.x(), m_height - m_mousePosition.y(), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel[0]);
+		glReadPixels(m_mousePosition.x(), m_height - m_mousePosition.y(), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel[0]);
 		newIndex = pixel[0] * 0x10000 | pixel[1] * 0x100 | pixel[2];
 	}
 
 	if (newIndex != (oldObject ? oldObject->id() : 0))
 	{
 		if (newIndex != 0)
-			newObject = LDObject::fromID (newIndex);
+			newObject = LDObject::fromID(newIndex);
 
 		m_objectAtCursor = newObject;
 
 		if (oldObject)
-			compileObject (oldObject);
+			compileObject(oldObject);
 
 		if (newObject)
-			compileObject (newObject);
+			compileObject(newObject);
 	}
 
 	update();
 }
 
-void GLRenderer::dragEnterEvent (QDragEnterEvent* ev)
+void GLRenderer::dragEnterEvent(QDragEnterEvent* ev)
 {
 	if (m_window and ev->source() == m_window->getPrimitivesTree() and m_window->getPrimitivesTree()->currentItem())
 		ev->acceptProposedAction();
 }
 
-void GLRenderer::dropEvent (QDropEvent* ev)
+void GLRenderer::dropEvent(QDropEvent* ev)
 {
 	if (m_window and ev->source() == m_window->getPrimitivesTree())
 	{
-		PrimitiveTreeItem* item = static_cast<PrimitiveTreeItem*> (m_window->getPrimitivesTree()->currentItem());
+		PrimitiveTreeItem* item = static_cast<PrimitiveTreeItem*>(m_window->getPrimitivesTree()->currentItem());
 		QString primitiveName = item->primitive()->name;
 		LDSubfileReference* ref = LDSpawn<LDSubfileReference>();
-		ref->setColor (MainColor);
-		ref->setFileInfo (m_documents->getDocumentByName (primitiveName));
-		ref->setPosition (Origin);
-		ref->setTransform (IdentityMatrix);
-		currentDocument()->insertObj (m_window->suggestInsertPoint(), ref);
+		ref->setColor(MainColor);
+		ref->setFileInfo(m_documents->getDocumentByName(primitiveName));
+		ref->setPosition(Origin);
+		ref->setTransform(IdentityMatrix);
+		currentDocument()->insertObj(m_window->suggestInsertPoint(), ref);
 		ref->select();
 		m_window->buildObjectList();
 		m_window->renderer()->refresh();
@@ -1609,7 +1609,7 @@
 	return m_position3D;
 }
 
-const LDFixedCamera& GLRenderer::getFixedCamera (ECamera cam) const
+const LDFixedCamera& GLRenderer::getFixedCamera(ECamera cam) const
 {
 	return g_FixedCameras[cam];
 }
@@ -1655,7 +1655,7 @@
 	return *document()->glData();
 }
 
-double& GLRenderer::rotation (Axis ax)
+double& GLRenderer::rotation(Axis ax)
 {
 	return
 		(ax == X) ? currentDocumentData().rotationX :
@@ -1663,13 +1663,13 @@
 					currentDocumentData().rotationZ;
 }
 
-double& GLRenderer::panning (Axis ax)
+double& GLRenderer::panning(Axis ax)
 {
 	return (ax == X) ? currentDocumentData().panX[camera()] :
 		currentDocumentData().panY[camera()];
 }
 
-double GLRenderer::panning (Axis ax) const
+double GLRenderer::panning(Axis ax) const
 {
 	return (ax == X) ? currentDocumentData().panX[camera()] :
 		currentDocumentData().panY[camera()];
--- a/src/glRenderer.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/glRenderer.h	Thu Jan 04 19:44:26 2018 +0200
@@ -78,11 +78,11 @@
 	bool			needZoomToFit;
 
 	LDGLData() :
-		rotationX (0.0),
-		rotationY (0.0),
-		rotationZ (0.0),
-		init (false),
-		needZoomToFit (true)
+		rotationX(0.0),
+		rotationY(0.0),
+		rotationZ(0.0),
+		init(false),
+		needZoomToFit(true)
 	{
 		for (int i = 0; i < 7; ++i)
 		{
@@ -114,7 +114,7 @@
 	EFirstCamera = ETopCamera
 };
 
-MAKE_ITERABLE_ENUM (ECamera)
+MAKE_ITERABLE_ENUM(ECamera)
 
 //
 // CameraIcon::image is a heap-allocated QPixmap because otherwise it gets
@@ -136,31 +136,31 @@
 	Q_OBJECT
 
 public:
-	GLRenderer (QWidget* parent = nullptr);
+	GLRenderer(QWidget* parent = nullptr);
 	~GLRenderer();
 
 	ECamera camera() const;
-	QString cameraName (ECamera camera) const;
+	QString cameraName(ECamera camera) const;
 	QByteArray capturePixels();
 	void clearOverlay();
-	void compileObject (LDObject* obj);
+	void compileObject(LDObject* obj);
 	GLCompiler* compiler() const;
-	Vertex convert2dTo3d (const QPoint& pos2d, bool snap) const;
-	QPoint convert3dTo2d (const Vertex& pos3d);
+	Vertex convert2dTo3d(const QPoint& pos2d, bool snap) const;
+	QPoint convert3dTo2d(const Vertex& pos3d);
 	QString currentCameraName() const;
 	EditModeType currentEditModeType() const;
 	int depthNegateFactor() const;
 	LDDocument* document() const;
-	void drawBlip (QPainter& painter, QPointF pos, QColor color = QColor (64, 192, 0)) const;
-	void drawBlipCoordinates (QPainter& painter, const Vertex& pos3d);
-	void drawBlipCoordinates (QPainter& painter, const Vertex& pos3d, QPointF pos);
+	void drawBlip(QPainter& painter, QPointF pos, QColor color = QColor(64, 192, 0)) const;
+	void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d);
+	void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d, QPointF pos);
 	void drawGLScene();
-	void forgetObject (LDObject* obj);
-	Axis getCameraAxis (bool y, ECamera camid = (ECamera) -1);
+	void forgetObject(LDObject* obj);
+	Axis getCameraAxis(bool y, ECamera camid = (ECamera) -1);
 	double getDepthValue() const;
-	const LDFixedCamera& getFixedCamera (ECamera cam) const;
-	LDGLOverlay& getOverlay (int newcam);
-	void getRelativeAxes (Axis& relX, Axis& relY) const;
+	const LDFixedCamera& getFixedCamera(ECamera cam) const;
+	LDGLOverlay& getOverlay(int newcam);
+	void getRelativeAxes(Axis& relX, Axis& relY) const;
 	Axis getRelativeZ() const;
 	void hardRefresh();
 	void highlightCursorObject();
@@ -176,40 +176,40 @@
 	QPointF const& mousePositionF() const;
 	void needZoomToFit();
 	LDObject* objectAtCursor() const;
-	void pick (int mouseX, int mouseY, bool additive);
-	void pick (QRect const& range, bool additive);
-	LDObject* pickOneObject (int mouseX, int mouseY);
+	void pick(int mouseX, int mouseY, bool additive);
+	void pick(QRect const& range, bool additive);
+	LDObject* pickOneObject(int mouseX, int mouseY);
 	Vertex const& position3D() const;
 	void refresh();
 	void resetAllAngles();
 	void resetAngles();
 	void setBackground();
-	void setCamera (const ECamera cam);
-	void setDepthValue (double depth);
-	void setDocument (LDDocument* document);
-	void setDrawOnly (bool value);
-	void setEditMode (EditModeType type);
-	void setPicking (bool a);
-	bool setupOverlay (ECamera cam, QString file, int x, int y, int w, int h);
+	void setCamera(const ECamera cam);
+	void setDepthValue(double depth);
+	void setDocument(LDDocument* document);
+	void setDrawOnly(bool value);
+	void setEditMode(EditModeType type);
+	void setPicking(bool a);
+	bool setupOverlay(ECamera cam, QString file, int x, int y, int w, int h);
 	QPen textPen() const;
 	void updateOverlayObjects();
-	void zoomNotch (bool inward);
+	void zoomNotch(bool inward);
 
 protected:
-	void contextMenuEvent (QContextMenuEvent* ev);
-	void dragEnterEvent (QDragEnterEvent* ev);
-	void dropEvent (QDropEvent* ev);
+	void contextMenuEvent(QContextMenuEvent* ev);
+	void dragEnterEvent(QDragEnterEvent* ev);
+	void dropEvent(QDropEvent* ev);
 	void initializeGL();
-	void keyPressEvent (QKeyEvent* ev);
-	void keyReleaseEvent (QKeyEvent* ev);
-	void leaveEvent (QEvent* ev);
-	void mouseDoubleClickEvent (QMouseEvent* ev);
-	void mousePressEvent (QMouseEvent* ev);
-	void mouseMoveEvent (QMouseEvent* ev);
-	void mouseReleaseEvent (QMouseEvent* ev);
-	void paintEvent (QPaintEvent* ev);
-	void resizeGL (int w, int h);
-	void wheelEvent (QWheelEvent* ev);
+	void keyPressEvent(QKeyEvent* ev);
+	void keyReleaseEvent(QKeyEvent* ev);
+	void leaveEvent(QEvent* ev);
+	void mouseDoubleClickEvent(QMouseEvent* ev);
+	void mousePressEvent(QMouseEvent* ev);
+	void mouseMoveEvent(QMouseEvent* ev);
+	void mouseReleaseEvent(QMouseEvent* ev);
+	void paintEvent(QPaintEvent* ev);
+	void resizeGL(int w, int h);
+	void wheelEvent(QWheelEvent* ev);
 
 private:
 	MessageManager* m_messageLog;
@@ -248,22 +248,22 @@
 	GLuint m_axesColorVbo;
 
 	void calcCameraIcons();
-	void clampAngle (double& angle) const;
+	void clampAngle(double& angle) const;
 	LDGLData& currentDocumentData() const;
-	void drawVbos (SurfaceVboType surface, ComplementVboType colors, GLenum type);
+	void drawVbos(SurfaceVboType surface, ComplementVboType colors, GLenum type);
 	void doMakeCurrent();
-	LDOverlay* findOverlayObject (ECamera cam);
-	double& panning (Axis ax);
-	double panning (Axis ax) const;
-	double& rotation (Axis ax);
+	LDOverlay* findOverlayObject(ECamera cam);
+	double& panning(Axis ax);
+	double panning(Axis ax) const;
+	double& rotation(Axis ax);
 	double& zoom();
 	void zoomToFit();
 	void zoomAllToFit();
 
 	template<typename... Args>
-	QString format (QString fmtstr, Args... args)
+	QString format(QString fmtstr, Args... args)
 	{
-		return ::format (fmtstr, args...);
+		return ::format(fmtstr, args...);
 	}
 
 private slots:
--- a/src/glShared.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/glShared.h	Thu Jan 04 19:44:26 2018 +0200
@@ -68,8 +68,8 @@
 	NumVbos = NumSurfaceVbos * NumVboComplements
 };
 
-MAKE_ITERABLE_ENUM (SurfaceVboType)
-MAKE_ITERABLE_ENUM (ComplementVboType)
+MAKE_ITERABLE_ENUM(SurfaceVboType)
+MAKE_ITERABLE_ENUM(ComplementVboType)
 
 #ifndef USE_QT5
 // Placeholder QOpenGLFunctions for Qt 4.x support
@@ -86,9 +86,9 @@
 using GLsizei = int;
 using GLenum = unsigned int;
 using GLuint = unsigned int;
-void glBindBuffer (GLenum, GLuint);
-void glGenBuffers (GLuint, GLuint*);
-void glDeleteBuffers (GLuint, GLuint*);
-void glBufferData (GLuint, GLuint, void*, GLuint);
-void glBufferSubData (GLenum, GLint, GLsizei, void*);
+void glBindBuffer(GLenum, GLuint);
+void glGenBuffers(GLuint, GLuint*);
+void glDeleteBuffers(GLuint, GLuint*);
+void glBufferData(GLuint, GLuint, void*, GLuint);
+void glBufferSubData(GLenum, GLint, GLsizei, void*);
 #endif
--- a/src/guiutilities.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/guiutilities.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -23,36 +23,36 @@
 #include "ldDocument.h"
 #include "mainwindow.h"
 
-GuiUtilities::GuiUtilities (QObject* parent) :
-	QObject (parent),
-	HierarchyElement (parent) {}
+GuiUtilities::GuiUtilities(QObject* parent) :
+	QObject(parent),
+	HierarchyElement(parent) {}
 
-QIcon GuiUtilities::makeColorIcon (LDColor ldcolor, int size)
+QIcon GuiUtilities::makeColorIcon(LDColor ldcolor, int size)
 {
 	// Create an image object and link a painter to it.
-	QImage img (size, size, QImage::Format_ARGB32);
-	QPainter painter (&img);
+	QImage img(size, size, QImage::Format_ARGB32);
+	QPainter painter(&img);
 	QColor color = ldcolor.faceColor();
 
 	if (ldcolor == MainColor)
 	{
 		// Use the user preferences for main color here
 		color = config.mainColor();
-		color.setAlphaF (config.mainColorAlpha());
+		color.setAlphaF(config.mainColorAlpha());
 	}
 
 	// Paint the icon border
-	painter.fillRect (QRect (0, 0, size, size), ldcolor.edgeColor());
+	painter.fillRect(QRect(0, 0, size, size), ldcolor.edgeColor());
 
 	// Paint the checkerboard background, visible with translucent icons
-	painter.drawPixmap (QRect (1, 1, size - 2, size - 2), GetIcon ("checkerboard"), QRect (0, 0, 8, 8));
+	painter.drawPixmap(QRect(1, 1, size - 2, size - 2), GetIcon("checkerboard"), QRect(0, 0, 8, 8));
 
 	// Paint the color above the checkerboard
-	painter.fillRect (QRect (1, 1, size - 2, size - 2), color);
-	return QIcon (QPixmap::fromImage (img));
+	painter.fillRect(QRect(1, 1, size - 2, size - 2), color);
+	return QIcon(QPixmap::fromImage(img));
 }
 
-void GuiUtilities::fillUsedColorsToComboBox (QComboBox* box)
+void GuiUtilities::fillUsedColorsToComboBox(QComboBox* box)
 {
 	QMap<LDColor, int> counts;
 
@@ -61,7 +61,7 @@
 		if (not obj->isColored() or not obj->color().isValid())
 			continue;
 
-		if (not counts.contains (obj->color()))
+		if (not counts.contains(obj->color()))
 			counts[obj->color()] = 1;
 		else
 			counts[obj->color()] += 1;
@@ -70,25 +70,25 @@
 	box->clear();
 	int row = 0;
 
-	QMapIterator<LDColor, int> it (counts);
+	QMapIterator<LDColor, int> it(counts);
 	while (it.hasNext())
 	{
 		it.next();
-		QIcon ico = makeColorIcon (it.key(), 16);
-		box->addItem (ico, format ("[%1] %2 (%3 object%4)",
-			it.key(), it.key().name(), it.value(), plural (it.value())));
-		box->setItemData (row, it.key().index());
+		QIcon ico = makeColorIcon(it.key(), 16);
+		box->addItem(ico, format("[%1] %2(%3 object%4)",
+			it.key(), it.key().name(), it.value(), plural(it.value())));
+		box->setItemData(row, it.key().index());
 		++row;
 	}
 }
 
 QColor GuiUtilities::mainColorRepresentation()
 {
-	QColor col (config.mainColor());
+	QColor col(config.mainColor());
 
 	if (not col.isValid())
-		return QColor (0, 0, 0);
+		return QColor(0, 0, 0);
 
-	col.setAlpha (config.mainColorAlpha() * 255.f);
+	col.setAlpha(config.mainColorAlpha() * 255.f);
 	return col;
 }
--- a/src/guiutilities.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/guiutilities.h	Thu Jan 04 19:44:26 2018 +0200
@@ -24,9 +24,9 @@
 {
 	Q_OBJECT
 public:
-	explicit GuiUtilities (QObject* parent);
+	explicit GuiUtilities(QObject* parent);
 
-	QIcon makeColorIcon (LDColor ldcolor, int size);
-	void fillUsedColorsToComboBox (class QComboBox* box);
+	QIcon makeColorIcon(LDColor ldcolor, int size);
+	void fillUsedColorsToComboBox(class QComboBox* box);
 	QColor mainColorRepresentation();
 };
--- a/src/hierarchyelement.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/hierarchyelement.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -22,21 +22,21 @@
 #include "mainwindow.h"
 #include "guiutilities.h"
 
-HierarchyElement::HierarchyElement (QObject* parent) :
-	m_window (nullptr)
+HierarchyElement::HierarchyElement(QObject* parent) :
+	m_window(nullptr)
 {
 	if (parent)
 	{
 		while (parent->parent())
 			parent = parent->parent();
 
-		m_window = qobject_cast<MainWindow*> (parent);
+		m_window = qobject_cast<MainWindow*>(parent);
 	}
 
 	if (m_window == nullptr)
 	{
 		m_window = g_win;
-		print ("WARNING: Hierarchy element instance %p should be in the hierarchy of a "
+		print("WARNING: Hierarchy element instance %p should be in the hierarchy of a "
 			"MainWindow but isn't.\n", this);
 	}
 
--- a/src/hierarchyelement.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/hierarchyelement.h	Thu Jan 04 19:44:26 2018 +0200
@@ -33,7 +33,7 @@
 class HierarchyElement
 {
 public:
-	HierarchyElement (QObject* parent);
+	HierarchyElement(QObject* parent);
 
 	const LDObjectList& selectedObjects();
 	LDDocument* currentDocument();
--- a/src/ldDocument.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ldDocument.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -34,19 +34,19 @@
 #include "dialogs/openprogressdialog.h"
 #include "documentmanager.h"
 
-LDDocument::LDDocument (DocumentManager* parent) :
-	QObject (parent),
-	HierarchyElement (parent),
-	m_history (new EditHistory (this)),
-	m_isCache (true),
-	m_verticesOutdated (true),
-	m_needVertexMerge (true),
-	m_beingDestroyed (false),
-	m_gldata (new LDGLData),
-	m_manager (parent)
+LDDocument::LDDocument(DocumentManager* parent) :
+	QObject(parent),
+	HierarchyElement(parent),
+	m_history(new EditHistory(this)),
+	m_isCache(true),
+	m_verticesOutdated(true),
+	m_needVertexMerge(true),
+	m_beingDestroyed(false),
+	m_gldata(new LDGLData),
+	m_manager(parent)
 {
-	setSavePosition (-1);
-	setTabIndex (-1);
+	setSavePosition(-1);
+	setTabIndex(-1);
 	m_needsReCache = true;
 }
 
@@ -66,7 +66,7 @@
 	return m_name;
 }
 
-void LDDocument::setName (QString value)
+void LDDocument::setName(QString value)
 {
 	m_name = value;
 }
@@ -86,7 +86,7 @@
 	return m_fullPath;
 }
 
-void LDDocument::setFullPath (QString value)
+void LDDocument::setFullPath(QString value)
 {
 	m_fullPath = value;
 }
@@ -96,7 +96,7 @@
 	return m_tabIndex;
 }
 
-void LDDocument::setTabIndex (int value)
+void LDDocument::setTabIndex(int value)
 {
 	m_tabIndex = value;
 }
@@ -111,7 +111,7 @@
 	return m_savePosition;
 }
 
-void LDDocument::setSavePosition (long value)
+void LDDocument::setSavePosition(long value)
 {
 	m_savePosition = value;
 }
@@ -121,7 +121,7 @@
 	return m_defaultName;
 }
 
-void LDDocument::setDefaultName (QString value)
+void LDDocument::setDefaultName(QString value)
 {
 	m_defaultName = value;
 }
@@ -131,11 +131,11 @@
 	if (m_isCache)
 	{
 		m_isCache = false;
-		print ("Opened %1", name());
+		print("Opened %1", name());
 
 		// Cache files are not compiled by the GL renderer. Now that this file is open for editing, it needs to be
 		// compiled.
-		m_window->renderer()->compiler()->compileDocument (this);
+		m_window->renderer()->compiler()->compileDocument(this);
 		m_window->updateDocumentList();
 	}
 }
@@ -165,9 +165,9 @@
 	history()->clear();
 }
 
-void LDDocument::addToHistory (AbstractHistoryEntry* entry)
+void LDDocument::addToHistory(AbstractHistoryEntry* entry)
 {
-	history()->add (entry);
+	history()->add(entry);
 }
 
 void LDDocument::close()
@@ -175,10 +175,10 @@
 	if (not isCache())
 	{
 		m_isCache = true;
-		print ("Closed %1", name());
+		print("Closed %1", name());
 		m_window->updateDocumentList();
 
-		// If the current document just became implicit (i.e. user closed it), we need to get a new one to show.
+		// If the current document just became implicit(i.e. user closed it), we need to get a new one to show.
 		if (currentDocument() == this)
 			m_window->currentDocumentClosed();
 	}
@@ -196,38 +196,38 @@
 bool LDDocument::isSafeToClose()
 {
 	using msgbox = QMessageBox;
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
 	// If we have unsaved changes, warn and give the option of saving.
 	if (hasUnsavedChanges())
 	{
-		QString message = format (tr ("There are unsaved changes to %1. Should it be saved?"), getDisplayName());
+		QString message = format(tr("There are unsaved changes to %1. Should it be saved?"), getDisplayName());
 
-		int button = msgbox::question (m_window, QObject::tr ("Unsaved Changes"), message,
+		int button = msgbox::question(m_window, QObject::tr("Unsaved Changes"), message,
 			(msgbox::Yes | msgbox::No | msgbox::Cancel), msgbox::Cancel);
 
-		switch (button)
+		switch(button)
 		{
 			case msgbox::Yes:
 			{
 				// If we don't have a file path yet, we have to ask the user for one.
 				if (name().length() == 0)
 				{
-					QString newpath = QFileDialog::getSaveFileName (m_window, QObject::tr ("Save As"),
-						name(), QObject::tr ("LDraw files (*.dat *.ldr)"));
+					QString newpath = QFileDialog::getSaveFileName(m_window, QObject::tr("Save As"),
+						name(), QObject::tr("LDraw files(*.dat *.ldr)"));
 
 					if (newpath.length() == 0)
 						return false;
 
-					setName (newpath);
+					setName(newpath);
 				}
 
 				if (not save())
 				{
-					message = format (QObject::tr ("Failed to save %1 (%2)\nDo you still want to close?"),
-						name(), strerror (errno));
+					message = format(QObject::tr("Failed to save %1(%2)\nDo you still want to close?"),
+						name(), strerror(errno));
 
-					if (msgbox::critical (m_window, QObject::tr ("Save Failure"), message,
+					if (msgbox::critical(m_window, QObject::tr("Save Failure"), message,
 						(msgbox::Yes | msgbox::No), msgbox::No) == msgbox::No)
 					{
 						return false;
@@ -249,7 +249,7 @@
 
 // =============================================================================
 //
-bool LDDocument::save (QString path, int64* sizeptr)
+bool LDDocument::save(QString path, int64* sizeptr)
 {
 	if (isCache())
 		return false;
@@ -258,16 +258,16 @@
 		path = fullPath();
 
 	// If the second object in the list holds the file name, update that now.
-	LDObject* nameObject = getObject (1);
+	LDObject* nameObject = getObject(1);
 
 	if (nameObject and nameObject->type() == OBJ_Comment)
 	{
-		LDComment* nameComment = static_cast<LDComment*> (nameObject);
+		LDComment* nameComment = static_cast<LDComment*>(nameObject);
 
-		if (nameComment->text().left (6) == "Name: ")
+		if (nameComment->text().left(6) == "Name: ")
 		{
-			QString newname = shortenName (path);
-			nameComment->setText (format ("Name: %1", newname));
+			QString newname = shortenName(path);
+			nameComment->setText(format("Name: %1", newname));
 			m_window->buildObjectList();
 		}
 	}
@@ -280,26 +280,26 @@
 	// 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);
+		QByteArray subdata((obj->asText() + "\r\n").toUtf8());
+		data.append(subdata);
 
 		if (sizeptr)
 			*sizeptr += subdata.size();
 	}
 
-	QFile f (path);
+	QFile f(path);
 
-	if (not f.open (QIODevice::WriteOnly))
+	if (not f.open(QIODevice::WriteOnly))
 		return false;
 
-	f.write (data);
+	f.write(data);
 	f.close();
 
 	// We have successfully saved, update the save position now.
-	setSavePosition (history()->position());
-	setFullPath (path);
-	setName (shortenName (path));
-	m_window->updateDocumentListItem (this);
+	setSavePosition(history()->position());
+	setFullPath(path);
+	setName(shortenName(path));
+	m_window->updateDocumentListItem(this);
 	m_window->updateTitle();
 	return true;
 }
@@ -309,69 +309,69 @@
 void LDDocument::clear()
 {
 	for (LDObject* obj : objects())
-		forgetObject (obj);
+		forgetObject(obj);
 }
 
 // =============================================================================
 //
-static void CheckTokenCount (const QStringList& tokens, int num)
+static void CheckTokenCount(const QStringList& tokens, int num)
 {
 	if (tokens.size() != num)
-		throw QString (format ("Bad amount of tokens, expected %1, got %2", num, tokens.size()));
+		throw QString(format("Bad amount of tokens, expected %1, got %2", num, tokens.size()));
 }
 
 // =============================================================================
 //
-static void CheckTokenNumbers (const QStringList& tokens, int min, int max)
+static void CheckTokenNumbers(const QStringList& tokens, int min, int max)
 {
 	bool ok;
-	QRegExp scientificRegex ("\\-?[0-9]+\\.[0-9]+e\\-[0-9]+");
+	QRegExp scientificRegex("\\-?[0-9]+\\.[0-9]+e\\-[0-9]+");
 
 	for (int i = min; i <= max; ++i)
 	{
 		// Check for floating point
-		tokens[i].toDouble (&ok);
+		tokens[i].toDouble(&ok);
 		if (ok)
 			return;
 
 		// Check hex
-		if (tokens[i].startsWith ("0x"))
+		if (tokens[i].startsWith("0x"))
 		{
-			tokens[i].mid (2).toInt (&ok, 16);
+			tokens[i].mid(2).toInt(&ok, 16);
 
 			if (ok)
 				return;
 		}
 
 		// Check scientific notation, e.g. 7.99361e-15
-		if (scientificRegex.exactMatch (tokens[i]))
+		if (scientificRegex.exactMatch(tokens[i]))
 			return;
 
-		throw QString (format ("Token #%1 was `%2`, expected a number (matched length: %3)",
+		throw QString(format("Token #%1 was `%2`, expected a number(matched length: %3)",
 			(i + 1), tokens[i], scientificRegex.matchedLength()));
 	}
 }
 
 // =============================================================================
 //
-static Vertex ParseVertex (QStringList& s, const int n)
+static Vertex ParseVertex(QStringList& s, const int n)
 {
 	Vertex v;
-	v.apply ([&] (Axis ax, double& a) { a = s[n + ax].toDouble(); });
+	v.apply([&](Axis ax, double& a) { a = s[n + ax].toDouble(); });
 	return v;
 }
 
-static int32 StringToNumber (QString a, bool* ok = nullptr)
+static int32 StringToNumber(QString a, bool* ok = nullptr)
 {
 	int base = 10;
 
-	if (a.startsWith ("0x"))
+	if (a.startsWith("0x"))
 	{
-		a.remove (0, 2);
+		a.remove(0, 2);
 		base = 16;
 	}
 
-	return a.toLong (ok, base);
+	return a.toLong(ok, base);
 }
 
 // =============================================================================
@@ -379,11 +379,11 @@
 // code and returns the object parsed from it. parseLine never returns null,
 // the object will be LDError if it could not be parsed properly.
 // =============================================================================
-LDObject* ParseLine (QString line)
+LDObject* ParseLine(QString line)
 {
 	try
 	{
-		QStringList tokens = line.split (" ", QString::SkipEmptyParts);
+		QStringList tokens = line.split(" ", QString::SkipEmptyParts);
 
 		if (tokens.size() <= 0)
 		{
@@ -392,36 +392,36 @@
 		}
 
 		if (tokens[0].length() != 1 or not tokens[0][0].isDigit())
-			throw QString ("Illogical line code");
+			throw QString("Illogical line code");
 
 		int num = tokens[0][0].digitValue();
 
-		switch (num)
+		switch(num)
 		{
 			case 0:
 			{
 				// Comment
-				QString commentText (line.mid (line.indexOf ("0") + 2));
-				QString commentTextSimplified (commentText.simplified());
+				QString commentText(line.mid(line.indexOf("0") + 2));
+				QString commentTextSimplified(commentText.simplified());
 
 				// Handle BFC statements
 				if (tokens.size() > 2 and tokens[1] == "BFC")
 				{
-					for_enum (BfcStatement, i)
+					for_enum(BfcStatement, i)
 					{
-						if (commentTextSimplified == format ("BFC %1", LDBfc::statementToString (i)))
-							return LDSpawn<LDBfc> (i);
+						if (commentTextSimplified == format("BFC %1", LDBfc::statementToString(i)))
+							return LDSpawn<LDBfc>(i);
 					}
 
 					// MLCAD is notorious for stuffing these statements in parts it
 					// creates. The above block only handles valid statements, so we
 					// need to handle MLCAD-style invertnext, clip and noclip separately.
 					if (commentTextSimplified == "BFC CERTIFY INVERTNEXT")
-						return LDSpawn<LDBfc> (BfcStatement::InvertNext);
+						return LDSpawn<LDBfc>(BfcStatement::InvertNext);
 					else if (commentTextSimplified == "BFC CERTIFY CLIP")
-						return LDSpawn<LDBfc> (BfcStatement::Clip);
+						return LDSpawn<LDBfc>(BfcStatement::Clip);
 					else if (commentTextSimplified == "BFC CERTIFY NOCLIP")
-						return LDSpawn<LDBfc> (BfcStatement::NoClip);
+						return LDSpawn<LDBfc>(BfcStatement::NoClip);
 				}
 
 				if (tokens.size() > 2 and tokens[1] == "!LDFORGE")
@@ -429,27 +429,27 @@
 					// Handle LDForge-specific types, they're embedded into comments too
 					if (tokens[2] == "OVERLAY")
 					{
-						CheckTokenCount (tokens, 9);
-						CheckTokenNumbers (tokens, 5, 8);
+						CheckTokenCount(tokens, 9);
+						CheckTokenNumbers(tokens, 5, 8);
 
 						LDOverlay* obj = LDSpawn<LDOverlay>();
-						obj->setFileName (tokens[3]);
-						obj->setCamera (tokens[4].toLong());
-						obj->setX (tokens[5].toLong());
-						obj->setY (tokens[6].toLong());
-						obj->setWidth (tokens[7].toLong());
-						obj->setHeight (tokens[8].toLong());
+						obj->setFileName(tokens[3]);
+						obj->setCamera(tokens[4].toLong());
+						obj->setX(tokens[5].toLong());
+						obj->setY(tokens[6].toLong());
+						obj->setWidth(tokens[7].toLong());
+						obj->setHeight(tokens[8].toLong());
 						return obj;
 					}
 					else if (tokens[2] == "BEZIER_CURVE")
 					{
-						CheckTokenCount (tokens, 16);
-						CheckTokenNumbers (tokens, 3, 15);
+						CheckTokenCount(tokens, 16);
+						CheckTokenNumbers(tokens, 3, 15);
 						LDBezierCurve* obj = LDSpawn<LDBezierCurve>();
-						obj->setColor (StringToNumber (tokens[3]));
+						obj->setColor(StringToNumber(tokens[3]));
 
 						for (int i = 0; i < 4; ++i)
-							obj->setVertex (i, ParseVertex (tokens, 4 + (i * 3)));
+							obj->setVertex(i, ParseVertex(tokens, 4 +(i * 3)));
 
 						return obj;
 					}
@@ -457,66 +457,66 @@
 
 				// Just a regular comment:
 				LDComment* obj = LDSpawn<LDComment>();
-				obj->setText (commentText);
+				obj->setText(commentText);
 				return obj;
 			}
 
 			case 1:
 			{
 				// Subfile
-				CheckTokenCount (tokens, 15);
-				CheckTokenNumbers (tokens, 1, 13);
-				LDDocument* document = g_win->documents()->getDocumentByName (tokens[14]);
+				CheckTokenCount(tokens, 15);
+				CheckTokenNumbers(tokens, 1, 13);
+				LDDocument* document = g_win->documents()->getDocumentByName(tokens[14]);
 
 				// If we cannot open the file, mark it an error. Note we cannot use LDParseError
 				// here because the error object needs the document reference.
 				if (not document)
 				{
-					LDError* obj = LDSpawn<LDError> (line, format ("Could not open %1", tokens[14]));
-					obj->setFileReferenced (tokens[14]);
+					LDError* obj = LDSpawn<LDError>(line, format("Could not open %1", tokens[14]));
+					obj->setFileReferenced(tokens[14]);
 					return obj;
 				}
 
 				LDSubfileReference* obj = LDSpawn<LDSubfileReference>();
-				obj->setColor (StringToNumber (tokens[1]));
-				obj->setPosition (ParseVertex (tokens, 2));  // 2 - 4
+				obj->setColor(StringToNumber(tokens[1]));
+				obj->setPosition(ParseVertex(tokens, 2));  // 2 - 4
 
 				Matrix transform;
 
 				for (int i = 0; i < 9; ++i)
 					transform[i] = tokens[i + 5].toDouble(); // 5 - 13
 
-				obj->setTransform (transform);
-				obj->setFileInfo (document);
+				obj->setTransform(transform);
+				obj->setFileInfo(document);
 				return obj;
 			}
 
 			case 2:
 			{
-				CheckTokenCount (tokens, 8);
-				CheckTokenNumbers (tokens, 1, 7);
+				CheckTokenCount(tokens, 8);
+				CheckTokenNumbers(tokens, 1, 7);
 
 				// Line
-				LDLine* obj (LDSpawn<LDLine>());
-				obj->setColor (StringToNumber (tokens[1]));
+				LDLine* obj(LDSpawn<LDLine>());
+				obj->setColor(StringToNumber(tokens[1]));
 
 				for (int i = 0; i < 2; ++i)
-					obj->setVertex (i, ParseVertex (tokens, 2 + (i * 3)));   // 2 - 7
+					obj->setVertex(i, ParseVertex(tokens, 2 +(i * 3)));   // 2 - 7
 
 				return obj;
 			}
 
 			case 3:
 			{
-				CheckTokenCount (tokens, 11);
-				CheckTokenNumbers (tokens, 1, 10);
+				CheckTokenCount(tokens, 11);
+				CheckTokenNumbers(tokens, 1, 10);
 
 				// Triangle
-				LDTriangle* obj (LDSpawn<LDTriangle>());
-				obj->setColor (StringToNumber (tokens[1]));
+				LDTriangle* obj(LDSpawn<LDTriangle>());
+				obj->setColor(StringToNumber(tokens[1]));
 
 				for (int i = 0; i < 3; ++i)
-					obj->setVertex (i, ParseVertex (tokens, 2 + (i * 3)));   // 2 - 10
+					obj->setVertex(i, ParseVertex(tokens, 2 +(i * 3)));   // 2 - 10
 
 				return obj;
 			}
@@ -524,8 +524,8 @@
 			case 4:
 			case 5:
 			{
-				CheckTokenCount (tokens, 14);
-				CheckTokenNumbers (tokens, 1, 13);
+				CheckTokenCount(tokens, 14);
+				CheckTokenNumbers(tokens, 1, 13);
 
 				// Quadrilateral / Conditional line
 				LDObject* obj;
@@ -535,22 +535,22 @@
 				else
 					obj = LDSpawn<LDCondLine>();
 
-				obj->setColor (StringToNumber (tokens[1]));
+				obj->setColor(StringToNumber(tokens[1]));
 
 				for (int i = 0; i < 4; ++i)
-					obj->setVertex (i, ParseVertex (tokens, 2 + (i * 3)));   // 2 - 13
+					obj->setVertex(i, ParseVertex(tokens, 2 +(i * 3)));   // 2 - 13
 
 				return obj;
 			}
 
 			default:
-				throw QString ("Unknown line code number");
+				throw QString("Unknown line code number");
 		}
 	}
-	catch (QString& e)
+	catch(QString& e)
 	{
 		// Strange line we couldn't parse
-		return LDSpawn<LDError> (line, e);
+		return LDSpawn<LDError>(line, e);
 	}
 }
 
@@ -558,31 +558,31 @@
 //
 void LDDocument::reloadAllSubfiles()
 {
-	print ("Reloading subfiles of %1", getDisplayName());
+	print("Reloading subfiles of %1", getDisplayName());
 
 	// Go through all objects in the current file and reload the subfiles
 	for (LDObject* obj : objects())
 	{
 		if (obj->type() == OBJ_SubfileReference)
 		{
-			LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
-			LDDocument* fileInfo = m_documents->getDocumentByName (ref->fileInfo()->name());
+			LDSubfileReference* ref = static_cast<LDSubfileReference*>(obj);
+			LDDocument* fileInfo = m_documents->getDocumentByName(ref->fileInfo()->name());
 
 			if (fileInfo)
 			{
-				ref->setFileInfo (fileInfo);
+				ref->setFileInfo(fileInfo);
 			}
 			else
 			{
-				ref->replace (LDSpawn<LDError> (ref->asText(),
-					format ("Could not open %1", ref->fileInfo()->name())));
+				ref->replace(LDSpawn<LDError>(ref->asText(),
+					format("Could not open %1", ref->fileInfo()->name())));
 			}
 		}
 
 		// 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 (static_cast<LDError*> (obj)->contents()));
+			obj->replace(ParseLine(static_cast<LDError*>(obj)->contents()));
 	}
 
 	m_needsReCache = true;
@@ -593,61 +593,61 @@
 
 // =============================================================================
 //
-int LDDocument::addObject (LDObject* obj)
+int LDDocument::addObject(LDObject* obj)
 {
-	history()->add (new AddHistoryEntry (objects().size(), obj));
+	history()->add(new AddHistoryEntry(objects().size(), obj));
 	m_objects << obj;
-	addKnownVertices (obj);
-	obj->setDocument (this);
-	m_window->renderer()->compileObject (obj);
+	addKnownVertices(obj);
+	obj->setDocument(this);
+	m_window->renderer()->compileObject(obj);
 	return getObjectCount() - 1;
 }
 
 // =============================================================================
 //
-void LDDocument::addObjects (const LDObjectList& objs)
+void LDDocument::addObjects(const LDObjectList& objs)
 {
 	for (LDObject* obj : objs)
 	{
 		if (obj)
-			addObject (obj);
+			addObject(obj);
 	}
 }
 
 // =============================================================================
 //
-void LDDocument::insertObj (int pos, LDObject* obj)
+void LDDocument::insertObj(int pos, LDObject* obj)
 {
-	history()->add (new AddHistoryEntry (pos, obj));
-	m_objects.insert (pos, obj);
-	obj->setDocument (this);
-	m_window->renderer()->compileObject (obj);
+	history()->add(new AddHistoryEntry(pos, obj));
+	m_objects.insert(pos, obj);
+	obj->setDocument(this);
+	m_window->renderer()->compileObject(obj);
 	
 
 #ifdef DEBUG
 	if (not isCache())
-		dprint ("Inserted object #%1 (%2) at %3\n", obj->id(), obj->typeName(), pos);
+		dprint("Inserted object #%1(%2) at %3\n", obj->id(), obj->typeName(), pos);
 #endif
 }
 
 // =============================================================================
 //
-void LDDocument::addKnownVertices (LDObject* obj)
+void LDDocument::addKnownVertices(LDObject* obj)
 {
-	auto it = m_objectVertices.find (obj);
+	auto it = m_objectVertices.find(obj);
 
 	if (it == m_objectVertices.end())
-		it = m_objectVertices.insert (obj, QVector<Vertex>());
+		it = m_objectVertices.insert(obj, QVector<Vertex>());
 	else
 		it->clear();
 
-	obj->getVertices (*it);
+	obj->getVertices(*it);
 	needVertexMerge();
 }
 
 // =============================================================================
 //
-void LDDocument::forgetObject (LDObject* obj)
+void LDDocument::forgetObject(LDObject* obj)
 {
 	int idx = obj->lineNumber();
 
@@ -657,18 +657,18 @@
 
 		if (not isCache() and not m_beingDestroyed)
 		{
-			history()->add (new DelHistoryEntry (idx, obj));
-			m_objectVertices.remove (obj);
+			history()->add(new DelHistoryEntry(idx, obj));
+			m_objectVertices.remove(obj);
 		}
 
-		m_objects.removeAt (idx);
-		obj->setDocument (nullptr);
+		m_objects.removeAt(idx);
+		obj->setDocument(nullptr);
 	}
 }
 
 // =============================================================================
 //
-void LDDocument::setObject (int idx, LDObject* obj)
+void LDDocument::setObject(int idx, LDObject* obj)
 {
 	if (idx < 0 or idx >= m_objects.size())
 		return;
@@ -676,24 +676,24 @@
 	// Mark this change to history
 	if (not m_history->isIgnoring())
 	{
-		QString oldcode = getObject (idx)->asText();
+		QString oldcode = getObject(idx)->asText();
 		QString newcode = obj->asText();
-		m_history->add (new EditHistoryEntry (idx, oldcode, newcode));
+		m_history->add(new EditHistoryEntry(idx, oldcode, newcode));
 	}
 
-	m_objectVertices.remove (m_objects[idx]);
+	m_objectVertices.remove(m_objects[idx]);
 	m_objects[idx]->deselect();
-	m_objects[idx]->setDocument (nullptr);
-	obj->setDocument (this);
-	addKnownVertices (obj);
-	m_window->renderer()->compileObject (obj);
+	m_objects[idx]->setDocument(nullptr);
+	obj->setDocument(this);
+	addKnownVertices(obj);
+	m_window->renderer()->compileObject(obj);
 	m_objects[idx] = obj;
 	needVertexMerge();
 }
 
 // =============================================================================
 //
-LDObject* LDDocument::getObject (int pos) const
+LDObject* LDDocument::getObject(int pos) const
 {
 	if (pos < m_objects.size())
 		return m_objects[pos];
@@ -725,7 +725,7 @@
 	if (not defaultName().isEmpty())
 		return "[" + defaultName() + "]";
 
-	return QObject::tr ("untitled");
+	return QObject::tr("untitled");
 }
 
 // =============================================================================
@@ -736,12 +736,12 @@
 	{
 		m_vertices.clear();
 
-		for (LDObject* obj : inlineContents (true, true))
+		for (LDObject* obj : inlineContents(true, true))
 		{
 			if (obj->type() == OBJ_SubfileReference)
 			{
-				print ("Warning: unable to inline %1 into %2",
-					static_cast<LDSubfileReference*> (obj)->fileInfo()->getDisplayName(),
+				print("Warning: unable to inline %1 into %2",
+					static_cast<LDSubfileReference*>(obj)->fileInfo()->getDisplayName(),
 					getDisplayName());
 				continue;
 			}
@@ -762,8 +762,8 @@
 	{
 		m_objectVertices.clear();
 
-		for (LDObject* obj : inlineContents (true, false))
-			addKnownVertices (obj);
+		for (LDObject* obj : inlineContents(true, false))
+			addKnownVertices(obj);
 
 		mergeVertices();
 		m_verticesOutdated = false;
@@ -782,7 +782,7 @@
 	for (QVector<Vertex> const& verts : m_objectVertices)
 		m_vertices << verts;
 
-	removeDuplicates (m_vertices);
+	removeDuplicates(m_vertices);
 	m_needVertexMerge = false;
 }
 
@@ -796,11 +796,11 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-LDObjectList LDDocument::inlineContents (bool deep, bool renderinline)
+LDObjectList LDDocument::inlineContents(bool deep, bool renderinline)
 {
 	LDObjectList objs;
 
-	if (m_manager->preInline (this, objs, deep, renderinline))
+	if (m_manager->preInline(this, objs, deep, renderinline))
 		return objs; // Manager dealt with this inline
 
 	for (LDObject* obj : objects())
@@ -813,7 +813,7 @@
 		// just add it into the objects normally. Yay, recursion!
 		if (deep == true and obj->type() == OBJ_SubfileReference)
 		{
-			for (LDObject* otherobj : static_cast<LDSubfileReference*> (obj)->inlineContents (deep, renderinline))
+			for (LDObject* otherobj : static_cast<LDSubfileReference*>(obj)->inlineContents(deep, renderinline))
 				objs << otherobj;
 		}
 		else
@@ -825,23 +825,23 @@
 
 // =============================================================================
 //
-void LDDocument::addToSelection (LDObject* obj) // [protected]
+void LDDocument::addToSelection(LDObject* obj) // [protected]
 {
 	if (obj->isSelected() and obj->document() == this)
 	{
 		m_sel << obj;
-		m_window->renderer()->compileObject (obj);
+		m_window->renderer()->compileObject(obj);
 	}
 }
 
 // =============================================================================
 //
-void LDDocument::removeFromSelection (LDObject* obj) // [protected]
+void LDDocument::removeFromSelection(LDObject* obj) // [protected]
 {
 	if (not obj->isSelected() and obj->document() == this)
 	{
-		m_sel.removeOne (obj);
-		m_window->renderer()->compileObject (obj);
+		m_sel.removeOne(obj);
+		m_window->renderer()->compileObject(obj);
 	}
 }
 
@@ -852,7 +852,7 @@
 	for (LDObject* obj : m_sel)
 	{
 		obj->deselect();
-		m_window->renderer()->compileObject (obj);
+		m_window->renderer()->compileObject(obj);
 	}
 
 	m_sel.clear();
@@ -867,28 +867,28 @@
 
 // =============================================================================
 //
-void LDDocument::swapObjects (LDObject* one, LDObject* other)
+void LDDocument::swapObjects(LDObject* one, LDObject* other)
 {
-	int a = m_objects.indexOf (one);
-	int b = m_objects.indexOf (other);
+	int a = m_objects.indexOf(one);
+	int b = m_objects.indexOf(other);
 
 	if (a != b and a != -1 and b != -1)
 	{
 		m_objects[b] = one;
 		m_objects[a] = other;
-		addToHistory (new SwapHistoryEntry (one->id(), other->id()));
+		addToHistory(new SwapHistoryEntry(one->id(), other->id()));
 	}
 }
 
 // =============================================================================
 //
-QString LDDocument::shortenName (QString a) // [static]
+QString LDDocument::shortenName(QString a) // [static]
 {
-	QString shortname = Basename (a);
-	QString topdirname = Basename (Dirname (a));
+	QString shortname = Basename(a);
+	QString topdirname = Basename(Dirname(a));
 
-	if (g_specialSubdirectories.contains (topdirname))
-		shortname.prepend (topdirname + "\\");
+	if (g_specialSubdirectories.contains(topdirname))
+		shortname.prepend(topdirname + "\\");
 
 	return shortname;
 }
--- a/src/ldDocument.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ldDocument.h	Thu Jan 04 19:44:26 2018 +0200
@@ -34,7 +34,7 @@
 // subfile caching.
 //
 // A document is implicit when they are opened automatically for caching purposes
-// and are hidden from the user. User-opened files are explicit (not implicit).
+// and are hidden from the user. User-opened files are explicit(not implicit).
 //
 // The default name is a placeholder, initially suggested name for a file. The
 // primitive generator uses this to give initial names to primitives.
@@ -44,34 +44,34 @@
 	Q_OBJECT
 
 public:
-	LDDocument (DocumentManager* parent);
+	LDDocument(DocumentManager* parent);
 	~LDDocument();
 
 	void addHistoryStep();
-	void addKnownVertices (LDObject* obj);
-	int addObject (LDObject* obj);
-	void addObjects (const LDObjectList& objs);
-	void addToHistory (AbstractHistoryEntry* entry);
-	void addToSelection (LDObject* obj);
+	void addKnownVertices(LDObject* obj);
+	int addObject(LDObject* obj);
+	void addObjects(const LDObjectList& objs);
+	void addToHistory(AbstractHistoryEntry* entry);
+	void addToSelection(LDObject* obj);
 	void clear();
 	void clearHistory();
 	void clearSelection();
 	void close();
 	QString defaultName() const;
-	void forgetObject (LDObject* obj);
+	void forgetObject(LDObject* obj);
 	QString fullPath();
 	QString getDisplayName();
-	LDObject* getObject (int pos) const;
+	LDObject* getObject(int pos) const;
 	int getObjectCount() const;
 	const LDObjectList& getSelection() const;
 	LDGLData* glData();
 	bool hasUnsavedChanges() const;
 	EditHistory* history() const;
 	void initializeCachedData();
-	LDObjectList inlineContents (bool deep, bool renderinline);
+	LDObjectList inlineContents(bool deep, bool renderinline);
 	QList<LDPolygon> inlinePolygons();
 	const QVector<Vertex>& inlineVertices();
-	void insertObj (int pos, LDObject* obj);
+	void insertObj(int pos, LDObject* obj);
 	bool isCache() const;
 	bool isSafeToClose();
 	void mergeVertices();
@@ -83,22 +83,22 @@
 	void redo();
 	void redoVertices();
 	void reloadAllSubfiles();
-	void removeFromSelection (LDObject* obj);
-	bool save (QString path = "", int64* sizeptr = nullptr);
+	void removeFromSelection(LDObject* obj);
+	bool save(QString path = "", int64* sizeptr = nullptr);
 	long savePosition() const;
-	void setDefaultName (QString value);
-	void setFullPath (QString value);
-	void setImplicit (bool value);
-	void setName (QString value);
-	void setObject (int idx, LDObject* obj);
-	void setSavePosition (long value);
-	void setTabIndex (int value);
-	void swapObjects (LDObject* one, LDObject* other);
+	void setDefaultName(QString value);
+	void setFullPath(QString value);
+	void setImplicit(bool value);
+	void setName(QString value);
+	void setObject(int idx, LDObject* obj);
+	void setSavePosition(long value);
+	void setTabIndex(int value);
+	void swapObjects(LDObject* one, LDObject* other);
 	int tabIndex() const;
 	void undo();
-	void vertexChanged (const Vertex& a, const Vertex& b);
+	void vertexChanged(const Vertex& a, const Vertex& b);
 
-	static QString shortenName (QString a); // Turns a full path into a relative path
+	static QString shortenName(QString a); // Turns a full path into a relative path
 
 private:
 	QString m_name;
@@ -122,4 +122,4 @@
 };
 
 // Parses a string line containing an LDraw object and returns the object parsed.
-LDObject* ParseLine (QString line);
+LDObject* ParseLine(QString line);
--- a/src/ldObject.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ldObject.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -27,9 +27,9 @@
 #include "colors.h"
 #include "glCompiler.h"
 
-ConfigOption (QString DefaultName = "")
-ConfigOption (QString DefaultUser = "")
-ConfigOption (bool UseCaLicense = true)
+ConfigOption(QString DefaultName = "")
+ConfigOption(QString DefaultUser = "")
+ConfigOption(bool UseCaLicense = true)
 
 // List of all LDObjects
 QMap<int32, LDObject*> g_allObjects;
@@ -37,22 +37,22 @@
 enum { MAX_LDOBJECT_IDS = (1 << 24) };
 
 #define LDOBJ_DEFAULT_CTOR(T,BASE) \
-	T :: T (LDDocument* document) : \
-		BASE (document) {}
+	T :: T(LDDocument* document) : \
+		BASE(document) {}
 
 // =============================================================================
 // LDObject constructors
 //
-LDObject::LDObject (LDDocument* document) :
-	m_isHidden (false),
-	m_isSelected (false),
-	m_isDestroyed (false),
-	m_document (nullptr)
+LDObject::LDObject(LDDocument* document) :
+	m_isHidden(false),
+	m_isSelected(false),
+	m_isDestroyed(false),
+	m_document(nullptr)
 {
 	if (document)
-		document->addObject (this);
+		document->addObject(this);
 
-	memset (m_coords, 0, sizeof m_coords);
+	memset(m_coords, 0, sizeof m_coords);
 
 	// Let's hope that nobody goes to create 17 million objects anytime soon...
 	static int32 nextId = 1; // 0 shalt be null
@@ -64,41 +64,41 @@
 	if (m_id != 0)
 		g_allObjects[m_id] = this;
 
-	m_randomColor = QColor::fromHsv (rand() % 360, rand() % 256, rand() % 96 + 128);
+	m_randomColor = QColor::fromHsv(rand() % 360, rand() % 256, rand() % 96 + 128);
 }
 
-LDSubfileReference::LDSubfileReference (LDDocument* document) :
-	LDMatrixObject (document) {}
+LDSubfileReference::LDSubfileReference(LDDocument* document) :
+	LDMatrixObject(document) {}
 
-LDOBJ_DEFAULT_CTOR (LDEmpty, LDObject)
-LDOBJ_DEFAULT_CTOR (LDError, LDObject)
-LDOBJ_DEFAULT_CTOR (LDLine, LDObject)
-LDOBJ_DEFAULT_CTOR (LDTriangle, LDObject)
-LDOBJ_DEFAULT_CTOR (LDCondLine, LDLine)
-LDOBJ_DEFAULT_CTOR (LDQuad, LDObject)
-LDOBJ_DEFAULT_CTOR (LDOverlay, LDObject)
-LDOBJ_DEFAULT_CTOR (LDBfc, LDObject)
-LDOBJ_DEFAULT_CTOR (LDComment, LDObject)
-LDOBJ_DEFAULT_CTOR (LDBezierCurve, LDObject)
+LDOBJ_DEFAULT_CTOR(LDEmpty, LDObject)
+LDOBJ_DEFAULT_CTOR(LDError, LDObject)
+LDOBJ_DEFAULT_CTOR(LDLine, LDObject)
+LDOBJ_DEFAULT_CTOR(LDTriangle, LDObject)
+LDOBJ_DEFAULT_CTOR(LDCondLine, LDLine)
+LDOBJ_DEFAULT_CTOR(LDQuad, LDObject)
+LDOBJ_DEFAULT_CTOR(LDOverlay, LDObject)
+LDOBJ_DEFAULT_CTOR(LDBfc, LDObject)
+LDOBJ_DEFAULT_CTOR(LDComment, LDObject)
+LDOBJ_DEFAULT_CTOR(LDBezierCurve, LDObject)
 
 LDObject::~LDObject()
 {
 	if (not m_isDestroyed)
-		print ("Warning: Object #%1 (%2) was not destroyed before being deleted\n", id(), this);
+		print("Warning: Object #%1(%2) was not destroyed before being deleted\n", id(), this);
 }
 
 // =============================================================================
 //
 QString LDComment::asText() const
 {
-	return format ("0 %1", text());
+	return format("0 %1", text());
 }
 
 // =============================================================================
 //
 QString LDSubfileReference::asText() const
 {
-	QString val = format ("1 %1 %2 ", color(), position());
+	QString val = format("1 %1 %2 ", color(), position());
 	val += transform().toString();
 	val += ' ';
 	val += fileInfo()->name();
@@ -109,10 +109,10 @@
 //
 QString LDLine::asText() const
 {
-	QString val = format ("2 %1", color());
+	QString val = format("2 %1", color());
 
 	for (int i = 0; i < 2; ++i)
-		val += format (" %1", vertex (i));
+		val += format(" %1", vertex(i));
 
 	return val;
 }
@@ -121,10 +121,10 @@
 //
 QString LDTriangle::asText() const
 {
-	QString val = format ("3 %1", color());
+	QString val = format("3 %1", color());
 
 	for (int i = 0; i < 3; ++i)
-		val += format (" %1", vertex (i));
+		val += format(" %1", vertex(i));
 
 	return val;
 }
@@ -133,10 +133,10 @@
 //
 QString LDQuad::asText() const
 {
-	QString val = format ("4 %1", color());
+	QString val = format("4 %1", color());
 
 	for (int i = 0; i < 4; ++i)
-		val += format (" %1", vertex (i));
+		val += format(" %1", vertex(i));
 
 	return val;
 }
@@ -145,22 +145,22 @@
 //
 QString LDCondLine::asText() const
 {
-	QString val = format ("5 %1", color());
+	QString val = format("5 %1", color());
 	
 	// Add the coordinates
 	for (int i = 0; i < 4; ++i)
-		val += format (" %1", vertex (i));
+		val += format(" %1", vertex(i));
 
 	return val;
 }
 
 QString LDBezierCurve::asText() const
 {
-	QString result = format ("0 !LDFORGE BEZIER_CURVE %1", color());
+	QString result = format("0 !LDFORGE BEZIER_CURVE %1", color());
 
 	// Add the coordinates
 	for (int i = 0; i < 4; ++i)
-		result += format (" %1", vertex (i));
+		result += format(" %1", vertex(i));
 
 	return result;
 }
@@ -183,7 +183,7 @@
 //
 QString LDBfc::asText() const
 {
-	return format ("0 BFC %1", statementToString());
+	return format("0 BFC %1", statementToString());
 }
 
 // =============================================================================
@@ -196,12 +196,12 @@
 	// |   |  ==>  | /    / |
 	// |   |       |/    /  |
 	// 1---2       1    1---2
-	LDTriangle* tri1 (new LDTriangle (vertex (0), vertex (1), vertex (3)));
-	LDTriangle* tri2 (new LDTriangle (vertex (1), vertex (2), vertex (3)));
+	LDTriangle* tri1(new LDTriangle(vertex(0), vertex(1), vertex(3)));
+	LDTriangle* tri2(new LDTriangle(vertex(1), vertex(2), vertex(3)));
 
 	// The triangles also inherit the quad's color
-	tri1->setColor (color());
-	tri2->setColor (color());
+	tri1->setColor(color());
+	tri2->setColor(color());
 
 	return {tri1, tri2};
 }
@@ -210,30 +210,30 @@
 //
 // Replace this LDObject with another LDObject. Object is deleted in the process.
 //
-void LDObject::replace (LDObject* other)
+void LDObject::replace(LDObject* other)
 {
 	int idx = lineNumber();
 
 	if (idx != -1)
 	{
 		// Replace the instance of the old object with the new object
-		document()->setObject (idx, other);
+		document()->setObject(idx, other);
 
 		// Remove the old object
 		destroy();
 	}
 }
 
-void LDObject::replace (const LDObjectList& others)
+void LDObject::replace(const LDObjectList& others)
 {
 	int idx = lineNumber();
 
 	if (idx != -1 and not others.isEmpty())
 	{
 		for (int i = 1; i < others.size(); ++i)
-			document()->insertObj (idx + i, others[i]);
+			document()->insertObj(idx + i, others[i]);
 
-		document()->setObject (idx, others[0]);
+		document()->setObject(idx, others[0]);
 		destroy();
 	}
 }
@@ -242,63 +242,63 @@
 //
 // Swap this object with another.
 //
-void LDObject::swap (LDObject* other)
+void LDObject::swap(LDObject* other)
 {
 	if (document() == other->document())
-		document()->swapObjects (this, other);
+		document()->swapObjects(this, other);
 }
 
 // =============================================================================
 //
-LDLine::LDLine (Vertex v1, Vertex v2, LDDocument* document) :
-	LDObject (document)
+LDLine::LDLine(Vertex v1, Vertex v2, LDDocument* document) :
+	LDObject(document)
 {
-	setVertex (0, v1);
-	setVertex (1, v2);
+	setVertex(0, v1);
+	setVertex(1, v2);
 }
 
 // =============================================================================
 //
-LDTriangle::LDTriangle (const Vertex& v1, const Vertex& v2, const Vertex& v3, LDDocument* document) :
-	LDObject (document)
+LDTriangle::LDTriangle(const Vertex& v1, const Vertex& v2, const Vertex& v3, LDDocument* document) :
+	LDObject(document)
 {
-	setVertex (0, v1);
-	setVertex (1, v2);
-	setVertex (2, v3);
+	setVertex(0, v1);
+	setVertex(1, v2);
+	setVertex(2, v3);
 }
 
 // =============================================================================
 //
-LDQuad::LDQuad (const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, LDDocument* document) :
-	LDObject (document)
+LDQuad::LDQuad(const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, LDDocument* document) :
+	LDObject(document)
 {
-	setVertex (0, v1);
-	setVertex (1, v2);
-	setVertex (2, v3);
-	setVertex (3, v4);
+	setVertex(0, v1);
+	setVertex(1, v2);
+	setVertex(2, v3);
+	setVertex(3, v4);
 }
 
 // =============================================================================
 //
-LDCondLine::LDCondLine (const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, LDDocument* document) :
-	LDLine (document)
+LDCondLine::LDCondLine(const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, LDDocument* document) :
+	LDLine(document)
 {
-	setVertex (0, v0);
-	setVertex (1, v1);
-	setVertex (2, v2);
-	setVertex (3, v3);
+	setVertex(0, v0);
+	setVertex(1, v1);
+	setVertex(2, v2);
+	setVertex(3, v3);
 }
 
 // =============================================================================
 //
 LDBezierCurve::LDBezierCurve(const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3,
 	LDDocument* document) :
-	LDObject (document)
+	LDObject(document)
 {
-	setVertex (0, v0);
-	setVertex (1, v1);
-	setVertex (2, v2);
-	setVertex (3, v3);
+	setVertex(0, v0);
+	setVertex(1, v1);
+	setVertex(2, v2);
+	setVertex(3, v3);
 }
 
 // =============================================================================
@@ -311,21 +311,21 @@
 
 	// If this object was associated to a file, remove it off it now
 	if (document())
-		document()->forgetObject (this);
+		document()->forgetObject(this);
 
 	// Delete the GL lists
 	if (g_win)
-		g_win->renderer()->forgetObject (this);
+		g_win->renderer()->forgetObject(this);
 
 	// Remove this object from the list of LDObjects
-	g_allObjects.erase (g_allObjects.find (id()));
+	g_allObjects.erase(g_allObjects.find(id()));
 	m_isDestroyed = true;
 	delete this;
 }
 
 // =============================================================================
 //
-void LDObject::setDocument (LDDocument* document)
+void LDObject::setDocument(LDDocument* document)
 {
 	m_document = document;
 
@@ -335,9 +335,9 @@
 
 // =============================================================================
 //
-static void TransformObject (LDObject* obj, Matrix transform, Vertex pos, LDColor parentcolor)
+static void TransformObject(LDObject* obj, Matrix transform, Vertex pos, LDColor parentcolor)
 {
-	switch (obj->type())
+	switch(obj->type())
 	{
 	case OBJ_Line:
 	case OBJ_CondLine:
@@ -345,20 +345,20 @@
 	case OBJ_Quad:
 		for (int i = 0; i < obj->numVertices(); ++i)
 		{
-			Vertex v = obj->vertex (i);
-			v.transform (transform, pos);
-			obj->setVertex (i, v);
+			Vertex v = obj->vertex(i);
+			v.transform(transform, pos);
+			obj->setVertex(i, v);
 		}
 		break;
 
 	case OBJ_SubfileReference:
 		{
-			LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
+			LDSubfileReference* ref = static_cast<LDSubfileReference*>(obj);
 			Matrix newMatrix = transform * ref->transform();
 			Vertex newpos = ref->position();
-			newpos.transform (transform, pos);
-			ref->setPosition (newpos);
-			ref->setTransform (newMatrix);
+			newpos.transform(transform, pos);
+			ref->setPosition(newpos);
+			ref->setTransform(newMatrix);
 		}
 		break;
 
@@ -367,18 +367,18 @@
 	}
 
 	if (obj->color() == MainColor)
-		obj->setColor (parentcolor);
+		obj->setColor(parentcolor);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-LDObjectList LDSubfileReference::inlineContents (bool deep, bool render)
+LDObjectList LDSubfileReference::inlineContents(bool deep, bool render)
 {
-	LDObjectList objs = fileInfo()->inlineContents (deep, render);
+	LDObjectList objs = fileInfo()->inlineContents(deep, render);
 
 	// Transform the objects
 	for (LDObject* obj : objs)
-		TransformObject (obj, transform(), position(), color());
+		TransformObject(obj, transform(), position(), color());
 
 	return objs;
 }
@@ -389,9 +389,9 @@
 {
 	LDObjectType ot = type();
 	int num = (ot == OBJ_Line)		? 2
-			: (ot == OBJ_Triangle)	? 3
-			: (ot == OBJ_Quad)		? 4
-			: (ot == OBJ_CondLine)	? 5
+			:(ot == OBJ_Triangle)	? 3
+			:(ot == OBJ_Quad)		? 4
+			:(ot == OBJ_CondLine)	? 5
 			: 0;
 
 	if (num == 0)
@@ -403,7 +403,7 @@
 	data->color = color().index();
 
 	for (int i = 0; i < data->numVertices(); ++i)
-		data->vertices[i] = vertex (i);
+		data->vertices[i] = vertex(i);
 
 	return data;
 }
@@ -417,7 +417,7 @@
 	for (LDPolygon& entry : data)
 	{
 		for (int i = 0; i < entry.numVertices(); ++i)
-			entry.vertices[i].transform (transform(), position());
+			entry.vertices[i].transform(transform(), position());
 	}
 
 	return data;
@@ -425,7 +425,7 @@
 
 // =============================================================================
 //
-// Index (i.e. line number) of this object
+// Index(i.e. line number) of this object
 //
 int LDObject::lineNumber() const
 {
@@ -433,7 +433,7 @@
 	{
 		for (int i = 0; i < document()->getObjectCount(); ++i)
 		{
-			if (document()->getObject (i) == this)
+			if (document()->getObject(i) == this)
 				return i;
 		}
 	}
@@ -443,13 +443,13 @@
 
 // =============================================================================
 //
-void LDObject::moveObjects (LDObjectList objs, const bool up)
+void LDObject::moveObjects(LDObjectList objs, const bool up)
 {
 	if (objs.isEmpty())
 		return;
 
 	// If we move down, we need to iterate the array in reverse order.
-	long const start = up ? 0 : (objs.size() - 1);
+	long const start = up ? 0 :(objs.size() - 1);
 	long const end = up ? objs.size() : -1;
 	long const incr = up ? 1 : -1;
 	LDObjectList objsToCompile;
@@ -460,9 +460,9 @@
 		LDObject* obj = objs[i];
 
 		long const idx = obj->lineNumber();
-		long const target = idx + (up ? -1 : 1);
+		long const target = idx +(up ? -1 : 1);
 
-		if ((up and idx == 0) or (not up and idx == (long) file->objects().size() - 1l))
+		if ((up and idx == 0) or(not up and idx == (long) file->objects().size() - 1l))
 		{
 			// One of the objects hit the extrema. If this happens, this should be the first
 			// object to be iterated on. Thus, nothing has changed yet and it's safe to just
@@ -471,33 +471,33 @@
 		}
 
 		objsToCompile << obj;
-		objsToCompile << file->getObject (target);
+		objsToCompile << file->getObject(target);
 
-		obj->swap (file->getObject (target));
+		obj->swap(file->getObject(target));
 	}
 
-	removeDuplicates (objsToCompile);
+	removeDuplicates(objsToCompile);
 
 	// The objects need to be recompiled, otherwise their pick lists are left with
 	// the wrong index colors which messes up selection.
 	for (LDObject* obj : objsToCompile)
-		g_win->renderer()->compileObject (obj);
+		g_win->renderer()->compileObject(obj);
 }
 
 // =============================================================================
 //
 // Get type name by enumerator
 //
-QString LDObject::typeName (LDObjectType type)
+QString LDObject::typeName(LDObjectType type)
 {
-	return LDObject::getDefault (type)->typeName();
+	return LDObject::getDefault(type)->typeName();
 }
 
 // =============================================================================
 //
 // Get a description of a list of LDObjects
 //
-QString LDObject::describeObjects (const LDObjectList& objs)
+QString LDObject::describeObjects(const LDObjectList& objs)
 {
 	QString text;
 
@@ -520,8 +520,8 @@
 		if (not text.isEmpty())
 			text += ", ";
 
-		QString noun = format ("%1%2", typeName (objType), plural (count));
-		text += format ("%1 %2", count, noun);
+		QString noun = format("%1%2", typeName(objType), plural(count));
+		text += format("%1 %2", count, noun);
 	}
 
 	return text;
@@ -538,7 +538,7 @@
 	if (idx == -1 or idx == document()->getObjectCount() - 1)
 		return nullptr;
 
-	return document()->getObject (idx + 1);
+	return document()->getObject(idx + 1);
 }
 
 // =============================================================================
@@ -552,20 +552,20 @@
 	if (idx <= 0)
 		return nullptr;
 
-	return document()->getObject (idx - 1);
+	return document()->getObject(idx - 1);
 }
 
 // =============================================================================
 //
 // Is the previous object INVERTNEXT?
 //
-bool LDObject::previousIsInvertnext (LDBfc*& ptr)
+bool LDObject::previousIsInvertnext(LDBfc*& ptr)
 {
 	LDObject* prev = previous();
 
-	if (prev and prev->type() == OBJ_Bfc and static_cast<LDBfc*> (prev)->statement() == BfcStatement::InvertNext)
+	if (prev and prev->type() == OBJ_Bfc and static_cast<LDBfc*>(prev)->statement() == BfcStatement::InvertNext)
 	{
-		ptr = static_cast<LDBfc*> (prev);
+		ptr = static_cast<LDBfc*>(prev);
 		return true;
 	}
 
@@ -576,17 +576,17 @@
 //
 // Moves this object using the given vertex as a movement List
 //
-void LDObject::move (Vertex vect)
+void LDObject::move(Vertex vect)
 {
 	if (hasMatrix())
 	{
-		LDMatrixObject* mo = static_cast<LDMatrixObject*> (this);
-		mo->setPosition (mo->position() + vect);
+		LDMatrixObject* mo = static_cast<LDMatrixObject*>(this);
+		mo->setPosition(mo->position() + vect);
 	}
 	else
 	{
 		for (int i = 0; i < numVertices(); ++i)
-			setVertex (i, vertex (i) + vect);
+			setVertex(i, vertex(i) + vect);
 	}
 }
 
@@ -595,7 +595,7 @@
 	return m_isHidden;
 }
 
-void LDObject::setHidden (bool value)
+void LDObject::setHidden(bool value)
 {
 	m_isHidden = value;
 }
@@ -634,9 +634,9 @@
 //
 // Returns a default-constructed LDObject by the given type
 //
-LDObject* LDObject::getDefault (const LDObjectType type)
+LDObject* LDObject::getDefault(const LDObjectType type)
 {
-	switch (type)
+	switch(type)
 	{
 	case OBJ_Comment:		return LDSpawn<LDComment>();
 	case OBJ_Bfc:			return LDSpawn<LDBfc>();
@@ -668,9 +668,9 @@
 {
 	// Triangle goes 0 -> 1 -> 2, reversed: 0 -> 2 -> 1.
 	// Thus, we swap 1 and 2.
-	Vertex tmp = vertex (1);
-	setVertex (1, vertex (2));
-	setVertex (2, tmp);
+	Vertex tmp = vertex(1);
+	setVertex(1, vertex(2));
+	setVertex(2, tmp);
 
 	return;
 }
@@ -682,9 +682,9 @@
 	// Quad:     0 -> 1 -> 2 -> 3
 	// reversed: 0 -> 3 -> 2 -> 1
 	// Thus, we swap 1 and 3.
-	Vertex tmp = vertex (1);
-	setVertex (1, vertex (3));
-	setVertex (3, tmp);
+	Vertex tmp = vertex(1);
+	setVertex(1, vertex(3));
+	setVertex(3, tmp);
 }
 
 // =============================================================================
@@ -695,22 +695,22 @@
 		return;
 
 	// Check whether subfile is flat
-	int axisSet = (1 << X) | (1 << Y) | (1 << Z);
-	LDObjectList objs = fileInfo()->inlineContents (true, false);
+	int axisSet = (1 << X) |(1 << Y) |(1 << Z);
+	LDObjectList objs = fileInfo()->inlineContents(true, false);
 
 	for (LDObject* obj : objs)
 	{
 		for (int i = 0; i < obj->numVertices(); ++i)
 		{
-			Vertex const& vrt = obj->vertex (i);
+			Vertex const& vrt = obj->vertex(i);
 
-			if (axisSet & (1 << X) and vrt.x() != 0.0)
+			if (axisSet &(1 << X) and vrt.x() != 0.0)
 				axisSet &= ~(1 << X);
 
-			if (axisSet & (1 << Y) and vrt.y() != 0.0)
+			if (axisSet &(1 << Y) and vrt.y() != 0.0)
 				axisSet &= ~(1 << Y);
 
-			if (axisSet & (1 << Z) and vrt.z() != 0.0)
+			if (axisSet &(1 << Z) and vrt.z() != 0.0)
 				axisSet &= ~(1 << Z);
 		}
 
@@ -724,16 +724,16 @@
 		// Let's flip it.
 		Matrix matrixModifier = IdentityMatrix;
 
-		if (axisSet & (1 << X))
+		if (axisSet &(1 << X))
 			matrixModifier[0] = -1;
 
-		if (axisSet & (1 << Y))
+		if (axisSet &(1 << Y))
 			matrixModifier[4] = -1;
 
-		if (axisSet & (1 << Z))
+		if (axisSet &(1 << Z))
 			matrixModifier[8] = -1;
 
-		setTransform (transform() * matrixModifier);
+		setTransform(transform() * matrixModifier);
 		return;
 	}
 
@@ -742,7 +742,7 @@
 
 	if (idx > 0)
 	{
-		LDBfc* bfc = dynamic_cast<LDBfc*> (previous());
+		LDBfc* bfc = dynamic_cast<LDBfc*>(previous());
 
 		if (bfc and bfc->statement() == BfcStatement::InvertNext)
 		{
@@ -753,7 +753,7 @@
 	}
 
 	// Not inverted, thus prefix it with a new invertnext.
-	document()->insertObj (idx, new LDBfc (BfcStatement::InvertNext));
+	document()->insertObj(idx, new LDBfc(BfcStatement::InvertNext));
 }
 
 // =============================================================================
@@ -761,9 +761,9 @@
 void LDLine::invert()
 {
 	// For lines, we swap the vertices.
-	Vertex tmp = vertex (0);
-	setVertex (0, vertex (1));
-	setVertex (1, tmp);
+	Vertex tmp = vertex(0);
+	setVertex(0, vertex(1));
+	setVertex(1, tmp);
 }
 
 // =============================================================================
@@ -771,9 +771,9 @@
 void LDCondLine::invert()
 {
 	// I don't think that a conditional line's control points need to be swapped, do they?
-	Vertex tmp = vertex (0);
-	setVertex (0, vertex (1));
-	setVertex (1, tmp);
+	Vertex tmp = vertex(0);
+	setVertex(0, vertex(1));
+	setVertex(1, tmp);
 }
 
 // =============================================================================
@@ -781,12 +781,12 @@
 void LDBezierCurve::invert()
 {
 	// A Bézier curve's control points probably need to be, though.
-	Vertex tmp = vertex (1);
-	setVertex (1, vertex (0));
-	setVertex (0, tmp);
-	tmp = vertex (3);
-	setVertex (3, vertex (2));
-	setVertex (2, tmp);
+	Vertex tmp = vertex(1);
+	setVertex(1, vertex(0));
+	setVertex(0, tmp);
+	tmp = vertex(3);
+	setVertex(3, vertex(2));
+	setVertex(2, tmp);
 }
 
 // =============================================================================
@@ -796,18 +796,18 @@
 	LDLine* replacement = new LDLine;
 
 	for (int i = 0; i < replacement->numVertices(); ++i)
-		replacement->setVertex (i, vertex (i));
+		replacement->setVertex(i, vertex(i));
 
-	replacement->setColor (color());
-	replace (replacement);
+	replacement->setColor(color());
+	replace(replacement);
 	return replacement;
 }
 
 // =============================================================================
 //
-LDObject* LDObject::fromID (int id)
+LDObject* LDObject::fromID(int id)
 {
-	auto it = g_allObjects.find (id);
+	auto it = g_allObjects.find(id);
 
 	if (it != g_allObjects.end())
 		return *it;
@@ -819,7 +819,7 @@
 //
 QString LDOverlay::asText() const
 {
-	return format ("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6",
+	return format("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6",
 		fileName(), camera(), x(), y(), width(), height());
 }
 
@@ -832,14 +832,14 @@
 // makes history stuff work out of the box.
 //
 template<typename T>
-static void changeProperty (LDObject* obj, T* ptr, const T& val)
+static void changeProperty(LDObject* obj, T* ptr, const T& val)
 {
 	int idx;
 
 	if (*ptr == val)
 		return;
 
-	if (obj->document() and (idx = obj->lineNumber()) != -1)
+	if (obj->document() and(idx = obj->lineNumber()) != -1)
 	{
 		QString before = obj->asText();
 		*ptr = val;
@@ -847,8 +847,8 @@
 
 		if (before != after)
 		{
-			obj->document()->addToHistory (new EditHistoryEntry (idx, before, after));
-			g_win->renderer()->compileObject (obj);
+			obj->document()->addToHistory(new EditHistoryEntry(idx, before, after));
+			g_win->renderer()->compileObject(obj);
 			g_win->currentDocument()->redoVertices();
 		}
 	}
@@ -860,16 +860,16 @@
 
 // =============================================================================
 //
-void LDObject::setColor (LDColor color)
+void LDObject::setColor(LDColor color)
 {
-	changeProperty (this, &m_color, color);
+	changeProperty(this, &m_color, color);
 }
 
 // =============================================================================
 //
 // Get a vertex by index
 //
-const Vertex& LDObject::vertex (int i) const
+const Vertex& LDObject::vertex(int i) const
 {
 	return m_coords[i];
 }
@@ -878,32 +878,32 @@
 //
 // Set a vertex to the given value
 //
-void LDObject::setVertex (int i, const Vertex& vert)
+void LDObject::setVertex(int i, const Vertex& vert)
 {
-	changeProperty (this, &m_coords[i], vert);
+	changeProperty(this, &m_coords[i], vert);
 }
 
-LDMatrixObject::LDMatrixObject (LDDocument* document) :
-	LDObject (document),
-	m_position (Origin) {}
+LDMatrixObject::LDMatrixObject(LDDocument* document) :
+	LDObject(document),
+	m_position(Origin) {}
 
-LDMatrixObject::LDMatrixObject (const Matrix& transform, const Vertex& pos, LDDocument* document) :
-	LDObject (document),
-	m_position (pos),
-	m_transform (transform) {}
+LDMatrixObject::LDMatrixObject(const Matrix& transform, const Vertex& pos, LDDocument* document) :
+	LDObject(document),
+	m_position(pos),
+	m_transform(transform) {}
 
-void LDMatrixObject::setCoordinate (const Axis ax, double value)
+void LDMatrixObject::setCoordinate(const Axis ax, double value)
 {
 	Vertex v = position();
 
-	switch (ax)
+	switch(ax)
 	{
-		case X: v.setX (value); break;
-		case Y: v.setY (value); break;
-		case Z: v.setZ (value); break;
+		case X: v.setX(value); break;
+		case Y: v.setY(value); break;
+		case Z: v.setZ(value); break;
 	}
 
-	setPosition (v);
+	setPosition(v);
 }
 
 const Vertex& LDMatrixObject::position() const
@@ -913,9 +913,9 @@
 
 // =============================================================================
 //
-void LDMatrixObject::setPosition (const Vertex& a)
+void LDMatrixObject::setPosition(const Vertex& a)
 {
-	changeProperty (this, &m_position, a);
+	changeProperty(this, &m_position, a);
 }
 
 // =============================================================================
@@ -925,15 +925,15 @@
 	return m_transform;
 }
 
-void LDMatrixObject::setTransform (const Matrix& val)
+void LDMatrixObject::setTransform(const Matrix& val)
 {
-	changeProperty (this, &m_transform, val);
+	changeProperty(this, &m_transform, val);
 }
 
-LDError::LDError (QString contents, QString reason, LDDocument* document) :
-	LDObject (document),
-	m_contents (contents),
-	m_reason (reason) {}
+LDError::LDError(QString contents, QString reason, LDDocument* document) :
+	LDObject(document),
+	m_contents(contents),
+	m_reason(reason) {}
 
 QString LDError::reason() const
 {
@@ -950,45 +950,45 @@
 	return m_fileReferenced;
 }
 
-void LDError::setFileReferenced (QString value)
+void LDError::setFileReferenced(QString value)
 {
 	m_fileReferenced = value;
 }
 
-LDComment::LDComment (QString text, LDDocument* document) :
-	LDObject (document),
-	m_text (text) {}
+LDComment::LDComment(QString text, LDDocument* document) :
+	LDObject(document),
+	m_text(text) {}
 
 QString LDComment::text() const
 {
 	return m_text;
 }
 
-void LDComment::setText (QString value)
+void LDComment::setText(QString value)
 {
-	changeProperty (this, &m_text, value);
+	changeProperty(this, &m_text, value);
 }
 
-LDBfc::LDBfc (const BfcStatement type, LDDocument* document) :
-	LDObject (document),
-	m_statement (type) {}
+LDBfc::LDBfc(const BfcStatement type, LDDocument* document) :
+	LDObject(document),
+	m_statement(type) {}
 
 BfcStatement LDBfc::statement() const
 {
 	return m_statement;
 }
 
-void LDBfc::setStatement (BfcStatement value)
+void LDBfc::setStatement(BfcStatement value)
 {
 	m_statement = value;
 }
 
 QString LDBfc::statementToString() const
 {
-	return LDBfc::statementToString (statement());
+	return LDBfc::statementToString(statement());
 }
 
-QString LDBfc::statementToString (BfcStatement statement)
+QString LDBfc::statementToString(BfcStatement statement)
 {
 	static const char* statementStrings[] =
 	{
@@ -1004,8 +1004,8 @@
 		"NOCLIP",
 	};
 
-	if ((int) statement >= 0 and (int) statement < countof (statementStrings))
-		return QString::fromLatin1 (statementStrings[(int) statement]);
+	if ((int) statement >= 0 and(int) statement < countof(statementStrings))
+		return QString::fromLatin1(statementStrings[(int) statement]);
 	else
 		return "";
 }
@@ -1015,7 +1015,7 @@
 	return m_camera;
 }
 
-void LDOverlay::setCamera (int value)
+void LDOverlay::setCamera(int value)
 {
 	m_camera = value;
 }
@@ -1025,7 +1025,7 @@
 	return m_x;
 }
 
-void LDOverlay::setX (int value)
+void LDOverlay::setX(int value)
 {
 	m_x = value;
 }
@@ -1035,7 +1035,7 @@
 	return m_y;
 }
 
-void LDOverlay::setY (int value)
+void LDOverlay::setY(int value)
 {
 	m_y = value;
 }
@@ -1045,7 +1045,7 @@
 	return m_width;
 }
 
-void LDOverlay::setWidth (int value)
+void LDOverlay::setWidth(int value)
 {
 	m_width = value;
 }
@@ -1055,7 +1055,7 @@
 	return m_height;
 }
 
-void LDOverlay::setHeight (int value)
+void LDOverlay::setHeight(int value)
 {
 	m_height = value;
 }
@@ -1065,57 +1065,57 @@
 	return m_fileName;
 }
 
-void LDOverlay::setFileName (QString value)
+void LDOverlay::setFileName(QString value)
 {
 	m_fileName = value;
 }
 
-Vertex LDBezierCurve::pointAt (qreal t) const
+Vertex LDBezierCurve::pointAt(qreal t) const
 {
 	if (t >= 0.0 and t <= 1.0)
 	{
 		Vertex result;
-		result += pow (1.0 - t, 3) * vertex (0);
-		result += (3 * pow (1.0 - t, 2) * t) * vertex (2);
-		result += (3 * (1.0 - t) * pow (t, 2)) * vertex (3);
-		result += pow (t, 3) * vertex (1);
+		result += pow(1.0 - t, 3) * vertex(0);
+		result += (3 * pow(1.0 - t, 2) * t) * vertex(2);
+		result += (3 *(1.0 - t) * pow(t, 2)) * vertex(3);
+		result += pow(t, 3) * vertex(1);
 		return result;
 	}
 	else
 		return Vertex();
 }
 
-LDObjectList LDBezierCurve::rasterize (int segments)
+LDObjectList LDBezierCurve::rasterize(int segments)
 {
 	if (segments == 0)
 		segments = gridBezierCurveSegments();
 
-	QVector<LDPolygon> polygons = rasterizePolygons (segments);
+	QVector<LDPolygon> polygons = rasterizePolygons(segments);
 	LDObjectList result;
 
 	for (LDPolygon& poly : polygons)
 	{
-		LDLine* line = LDSpawn<LDLine> (poly.vertices[0], poly.vertices[1]);
-		line->setColor (poly.color);
+		LDLine* line = LDSpawn<LDLine>(poly.vertices[0], poly.vertices[1]);
+		line->setColor(poly.color);
 		result << line;
 	}
 
 	return result;
 }
 
-QVector<LDPolygon> LDBezierCurve::rasterizePolygons (int segments)
+QVector<LDPolygon> LDBezierCurve::rasterizePolygons(int segments)
 {
 	if (segments == 0)
 		segments = gridBezierCurveSegments();
 
 	QVector<LDPolygon> result;
 	QVector<Vertex> parms;
-	parms.append (pointAt (0.0));
+	parms.append(pointAt(0.0));
 
 	for (int i = 1; i < segments; ++i)
-		parms.append (pointAt (double (i) / segments));
+		parms.append(pointAt(double(i) / segments));
 
-	parms.append (pointAt (1.0));
+	parms.append(pointAt(1.0));
 	LDPolygon poly;
 	poly.color = color().index();
 	poly.id = id();
@@ -1140,7 +1140,7 @@
 	if (not isSelected() and document())
 	{
 		m_isSelected = true;
-		document()->addToSelection (this);
+		document()->addToSelection(this);
 	}
 }
 
@@ -1153,12 +1153,12 @@
 	if (isSelected() and document())
 	{
 		m_isSelected = false;
-		document()->removeFromSelection (this);
+		document()->removeFromSelection(this);
 
 		// If this object is inverted with INVERTNEXT, deselect the INVERTNEXT as well.
 		LDBfc* invertnext;
 
-		if (previousIsInvertnext (invertnext))
+		if (previousIsInvertnext(invertnext))
 			invertnext->deselect();
 	}
 }
@@ -1174,7 +1174,7 @@
 //
 LDObject* LDObject::createCopy() const
 {
-	LDObject* copy = ParseLine (asText());
+	LDObject* copy = ParseLine(asText());
 	return copy;
 }
 
@@ -1185,11 +1185,11 @@
 	return m_fileInfo;
 }
 
-void LDSubfileReference::setFileInfo (LDDocument* document)
+void LDSubfileReference::setFileInfo(LDDocument* document)
 {
-	changeProperty (this, &m_fileInfo, document);
+	changeProperty(this, &m_fileInfo, document);
 
-	// If it's an immediate subfile reference (i.e. this subfile is in an opened document), we need to pre-compile the
+	// If it's an immediate subfile reference(i.e. this subfile is in an opened document), we need to pre-compile the
 	// GL polygons for the document if they don't exist already.
 	if (document and
 		document->isCache() == false and
@@ -1199,13 +1199,13 @@
 	}
 };
 
-void LDObject::getVertices (QVector<Vertex>& verts) const
+void LDObject::getVertices(QVector<Vertex>& verts) const
 {
 	for (int i = 0; i < numVertices(); ++i)
-		verts << vertex (i);
+		verts << vertex(i);
 }
 
-void LDSubfileReference::getVertices (QVector<Vertex>& verts) const
+void LDSubfileReference::getVertices(QVector<Vertex>& verts) const
 {
 	verts << fileInfo()->inlineVertices();
 }
\ No newline at end of file
--- a/src/ldObject.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ldObject.h	Thu Jan 04 19:44:26 2018 +0200
@@ -26,7 +26,7 @@
 #define LDOBJ(T)												\
 public:															\
 	static constexpr LDObjectType SubclassType = OBJ_##T;		\
-	LD##T (LDDocument* document = nullptr);						\
+	LD##T(LDDocument* document = nullptr);						\
 																\
 	virtual LDObjectType type() const override					\
 	{															\
@@ -39,8 +39,8 @@
 #define LDOBJ_NAME(N)          public: virtual QString typeName() const override { return #N; }
 #define LDOBJ_VERTICES(V)      public: virtual int numVertices() const override { return V; }
 #define LDOBJ_SETCOLORED(V)    public: virtual bool isColored() const override { return V; }
-#define LDOBJ_COLORED          LDOBJ_SETCOLORED (true)
-#define LDOBJ_UNCOLORED        LDOBJ_SETCOLORED (false) LDOBJ_DEFAULTCOLOR (MainColor)
+#define LDOBJ_COLORED          LDOBJ_SETCOLORED(true)
+#define LDOBJ_UNCOLORED        LDOBJ_SETCOLORED(false) LDOBJ_DEFAULTCOLOR(MainColor)
 #define LDOBJ_DEFAULTCOLOR(V)  public: virtual LDColor defaultColor() const override { return (V); }
 
 #define LDOBJ_CUSTOM_SCEMANTIC public: virtual bool isScemantic() const override
@@ -48,8 +48,8 @@
 #define LDOBJ_NON_SCEMANTIC    LDOBJ_CUSTOM_SCEMANTIC { return false; }
 
 #define LDOBJ_SETMATRIX(V)     public: virtual bool hasMatrix() const override { return V; }
-#define LDOBJ_HAS_MATRIX       LDOBJ_SETMATRIX (true)
-#define LDOBJ_NO_MATRIX        LDOBJ_SETMATRIX (false)
+#define LDOBJ_HAS_MATRIX       LDOBJ_SETMATRIX(true)
+#define LDOBJ_NO_MATRIX        LDOBJ_SETMATRIX(false)
 
 class QListWidgetItem;
 class LDSubfileReference;
@@ -78,7 +78,7 @@
 	OBJ_FirstType = OBJ_SubfileReference
 };
 
-MAKE_ITERABLE_ENUM (LDObjectType)
+MAKE_ITERABLE_ENUM(LDObjectType)
 
 //
 // LDObject
@@ -91,7 +91,7 @@
 class LDObject
 {
 public:
-	LDObject (LDDocument* document = nullptr);
+	LDObject(LDDocument* document = nullptr);
 
 	virtual QString asText() const = 0; // This object as LDraw code
 	LDColor color() const;
@@ -101,40 +101,40 @@
 	void destroy();
 	LDDocument* document() const;
 	LDPolygon* getPolygon();
-	virtual void getVertices (QVector<Vertex>& verts) const;
-	virtual bool hasMatrix() const = 0; // Does this object have a matrix and position? (see LDMatrixObject)
+	virtual void getVertices(QVector<Vertex>& verts) const;
+	virtual bool hasMatrix() const = 0; // Does this object have a matrix and position?(see LDMatrixObject)
 	qint32 id() const;
-	virtual void invert() = 0; // Inverts this object (winding is reversed)
+	virtual void invert() = 0; // Inverts this object(winding is reversed)
 	virtual bool isColored() const = 0;
 	bool isDestroyed() const;
 	bool isHidden() const;
 	virtual bool isScemantic() const = 0; // Does this object have meaning in the part model?
 	bool isSelected() const;
 	int lineNumber() const;
-	void move (Vertex vect);
+	void move(Vertex vect);
 	LDObject* next() const;
 	virtual int numVertices() const = 0;
 	LDObject* previous() const;
-	bool previousIsInvertnext (LDBfc*& ptr);
+	bool previousIsInvertnext(LDBfc*& ptr);
 	QColor randomColor() const;
-	void replace (LDObject* other);
-	void replace (const LDObjectList& others);
+	void replace(LDObject* other);
+	void replace(const LDObjectList& others);
 	void select();
-	void setColor (LDColor color);
-	void setDocument (LDDocument* document);
-	void setHidden (bool value);
-	void setVertex (int i, const Vertex& vert);
-	void swap (LDObject* other);
+	void setColor(LDColor color);
+	void setDocument(LDDocument* document);
+	void setHidden(bool value);
+	void setVertex(int i, const Vertex& vert);
+	void swap(LDObject* other);
 	LDObject* topLevelParent();
 	virtual LDObjectType type() const = 0;
 	virtual QString typeName() const = 0;
-	const Vertex& vertex (int i) const;
+	const Vertex& vertex(int i) const;
 
-	static QString describeObjects (const LDObjectList& objs);
-	static LDObject* fromID (int id);
-	static LDObject* getDefault (const LDObjectType type);
-	static void moveObjects (LDObjectList objs, const bool up); // TODO: move this to LDDocument?
-	static QString typeName (LDObjectType type);
+	static QString describeObjects(const LDObjectList& objs);
+	static LDObject* fromID(int id);
+	static LDObject* getDefault(const LDObjectType type);
+	static void moveObjects(LDObjectList objs, const bool up); // TODO: move this to LDDocument?
+	static QString typeName(LDObjectType type);
 
 protected:
 	virtual ~LDObject();
@@ -152,16 +152,16 @@
 };
 
 template<typename T, typename... Args>
-T* LDSpawn (Args... args)
+T* LDSpawn(Args... args)
 {
-	static_assert (std::is_base_of<LDObject, T>::value,
+	static_assert(std::is_base_of<LDObject, T>::value,
 		"spawn may only be used with LDObject-derivatives");
-	T* result = new T (args..., nullptr);
+	T* result = new T(args..., nullptr);
 
 	// Set default color. Relying on virtual functions, this cannot be done in the c-tor.
 	// TODO: store -1 as the default color
 	if (result->isColored())
-		result->setColor (result->defaultColor());
+		result->setColor(result->defaultColor());
 
 	return result;
 }
@@ -181,14 +181,14 @@
 	Vertex m_position;
 
 public:
-	LDMatrixObject (LDDocument* document = nullptr);
-	LDMatrixObject (const Matrix& transform, const Vertex& pos, LDDocument* document = nullptr);
+	LDMatrixObject(LDDocument* document = nullptr);
+	LDMatrixObject(const Matrix& transform, const Vertex& pos, LDDocument* document = nullptr);
 
 	const Vertex& position() const;
-	void setCoordinate (const Axis ax, double value);
-	void setPosition (const Vertex& a);
+	void setCoordinate(const Axis ax, double value);
+	void setPosition(const Vertex& a);
 	const Matrix& transform() const;
-	void setTransform (const Matrix& value);
+	void setTransform(const Matrix& value);
 
 private:
 	Matrix m_transform;
@@ -197,24 +197,24 @@
 //
 //
 // Represents a line in the LDraw file that could not be properly parsed. It is
-// represented by a (!) ERROR in the code view. It exists for the purpose of
+// represented by a(!) ERROR in the code view. It exists for the purpose of
 // allowing garbage lines be debugged and corrected within LDForge.
 //
 class LDError : public LDObject
 {
-	LDOBJ (Error)
-	LDOBJ_NAME (error)
-	LDOBJ_VERTICES (0)
+	LDOBJ(Error)
+	LDOBJ_NAME(error)
+	LDOBJ_VERTICES(0)
 	LDOBJ_UNCOLORED
 	LDOBJ_SCEMANTIC
 	LDOBJ_NO_MATRIX
 
 public:
-	LDError (QString contents, QString reason, LDDocument* document = nullptr);
+	LDError(QString contents, QString reason, LDDocument* document = nullptr);
 	QString reason() const;
 	QString contents() const;
 	QString fileReferenced() const;
-	void setFileReferenced (QString value);
+	void setFileReferenced(QString value);
 
 private:
 	QString m_fileReferenced; // If this error was caused by inability to open a file, what file was that?
@@ -228,9 +228,9 @@
 //
 class LDEmpty : public LDObject
 {
-	LDOBJ (Empty)
-	LDOBJ_NAME (empty)
-	LDOBJ_VERTICES (0)
+	LDOBJ(Empty)
+	LDOBJ_NAME(empty)
+	LDOBJ_VERTICES(0)
 	LDOBJ_UNCOLORED
 	LDOBJ_NON_SCEMANTIC
 	LDOBJ_NO_MATRIX
@@ -242,17 +242,17 @@
 //
 class LDComment : public LDObject
 {
-	LDOBJ (Comment)
-	LDOBJ_NAME (comment)
-	LDOBJ_VERTICES (0)
+	LDOBJ(Comment)
+	LDOBJ_NAME(comment)
+	LDOBJ_VERTICES(0)
 	LDOBJ_UNCOLORED
 	LDOBJ_NON_SCEMANTIC
 	LDOBJ_NO_MATRIX
 
 public:
-	LDComment (QString text, LDDocument* document = nullptr);
+	LDComment(QString text, LDDocument* document = nullptr);
 	QString text() const;
-	void setText (QString value);
+	void setText(QString value);
 
 private:
 	QString m_text;
@@ -282,21 +282,21 @@
 class LDBfc : public LDObject
 {
 public:
-	LDOBJ (Bfc)
-	LDOBJ_NAME (bfc)
-	LDOBJ_VERTICES (0)
+	LDOBJ(Bfc)
+	LDOBJ_NAME(bfc)
+	LDOBJ_VERTICES(0)
 	LDOBJ_UNCOLORED
 	LDOBJ_CUSTOM_SCEMANTIC { return (statement() == BfcStatement::InvertNext); }
 	LDOBJ_NO_MATRIX
 
 public:
-	LDBfc (const BfcStatement type, LDDocument* document = nullptr);
+	LDBfc(const BfcStatement type, LDDocument* document = nullptr);
 
 	BfcStatement statement() const;
-	void setStatement (BfcStatement value);
+	void setStatement(BfcStatement value);
 	QString statementToString() const;
 
-	static QString statementToString (BfcStatement statement);
+	static QString statementToString(BfcStatement statement);
 
 private:
 	BfcStatement m_statement;
@@ -309,21 +309,21 @@
 //
 class LDSubfileReference : public LDMatrixObject
 {
-	LDOBJ (SubfileReference)
-	LDOBJ_NAME (subfilereference)
-	LDOBJ_VERTICES (0)
+	LDOBJ(SubfileReference)
+	LDOBJ_NAME(subfilereference)
+	LDOBJ_VERTICES(0)
 	LDOBJ_COLORED
-	LDOBJ_DEFAULTCOLOR (MainColor)
+	LDOBJ_DEFAULTCOLOR(MainColor)
 	LDOBJ_SCEMANTIC
 	LDOBJ_HAS_MATRIX
 
 public:
 	// Inlines this subfile.
 	LDDocument* fileInfo() const;
-	virtual void getVertices (QVector<Vertex>& verts) const override;
-	LDObjectList inlineContents (bool deep, bool render);
+	virtual void getVertices(QVector<Vertex>& verts) const override;
+	LDObjectList inlineContents(bool deep, bool render);
 	QList<LDPolygon> inlinePolygons();
-	void setFileInfo (LDDocument* fileInfo);
+	void setFileInfo(LDDocument* fileInfo);
 
 private:
 	LDDocument* m_fileInfo;
@@ -336,16 +336,16 @@
 //
 class LDLine : public LDObject
 {
-	LDOBJ (Line)
-	LDOBJ_NAME (line)
-	LDOBJ_VERTICES (2)
+	LDOBJ(Line)
+	LDOBJ_NAME(line)
+	LDOBJ_VERTICES(2)
 	LDOBJ_COLORED
-	LDOBJ_DEFAULTCOLOR (EdgeColor)
+	LDOBJ_DEFAULTCOLOR(EdgeColor)
 	LDOBJ_SCEMANTIC
 	LDOBJ_NO_MATRIX
 
 public:
-	LDLine (Vertex v1, Vertex v2, LDDocument* document = nullptr);
+	LDLine(Vertex v1, Vertex v2, LDDocument* document = nullptr);
 };
 
 //
@@ -355,16 +355,16 @@
 //
 class LDCondLine : public LDLine
 {
-	LDOBJ (CondLine)
-	LDOBJ_NAME (condline)
-	LDOBJ_VERTICES (4)
+	LDOBJ(CondLine)
+	LDOBJ_NAME(condline)
+	LDOBJ_VERTICES(4)
 	LDOBJ_COLORED
-	LDOBJ_DEFAULTCOLOR (EdgeColor)
+	LDOBJ_DEFAULTCOLOR(EdgeColor)
 	LDOBJ_SCEMANTIC
 	LDOBJ_NO_MATRIX
 
 public:
-	LDCondLine (const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, LDDocument* document = nullptr);
+	LDCondLine(const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, LDDocument* document = nullptr);
 	LDLine* toEdgeLine();
 };
 
@@ -377,16 +377,16 @@
 //
 class LDTriangle : public LDObject
 {
-	LDOBJ (Triangle)
-	LDOBJ_NAME (triangle)
-	LDOBJ_VERTICES (3)
+	LDOBJ(Triangle)
+	LDOBJ_NAME(triangle)
+	LDOBJ_VERTICES(3)
 	LDOBJ_COLORED
-	LDOBJ_DEFAULTCOLOR (MainColor)
+	LDOBJ_DEFAULTCOLOR(MainColor)
 	LDOBJ_SCEMANTIC
 	LDOBJ_NO_MATRIX
 
 public:
-	LDTriangle (Vertex const& v1, Vertex const& v2, Vertex const& v3, LDDocument* document = nullptr);
+	LDTriangle(Vertex const& v1, Vertex const& v2, Vertex const& v3, LDDocument* document = nullptr);
 };
 
 //
@@ -397,16 +397,16 @@
 //
 class LDQuad : public LDObject
 {
-	LDOBJ (Quad)
-	LDOBJ_NAME (quad)
-	LDOBJ_VERTICES (4)
+	LDOBJ(Quad)
+	LDOBJ_NAME(quad)
+	LDOBJ_VERTICES(4)
 	LDOBJ_COLORED
-	LDOBJ_DEFAULTCOLOR (MainColor)
+	LDOBJ_DEFAULTCOLOR(MainColor)
 	LDOBJ_SCEMANTIC
 	LDOBJ_NO_MATRIX
 
 public:
-	LDQuad (const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, LDDocument* document = nullptr);
+	LDQuad(const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, LDDocument* document = nullptr);
 
 	// Split this quad into two triangles
 	QList<LDTriangle*> splitToTriangles();
@@ -419,9 +419,9 @@
 //
 class LDOverlay : public LDObject
 {
-	LDOBJ (Overlay)
-	LDOBJ_NAME (overlay)
-	LDOBJ_VERTICES (0)
+	LDOBJ(Overlay)
+	LDOBJ_NAME(overlay)
+	LDOBJ_VERTICES(0)
 	LDOBJ_UNCOLORED
 	LDOBJ_NON_SCEMANTIC
 	LDOBJ_NO_MATRIX
@@ -430,12 +430,12 @@
 	int camera() const;
 	QString fileName() const;
 	int height() const;
-	void setCamera (int value);
-	void setFileName (QString value);
-	void setHeight (int value);
-	void setWidth (int value);
-	void setX (int value);
-	void setY (int value);
+	void setCamera(int value);
+	void setFileName(QString value);
+	void setHeight(int value);
+	void setWidth(int value);
+	void setX(int value);
+	void setY(int value);
 	int width() const;
 	int x() const;
 	int y() const;
@@ -451,24 +451,24 @@
 
 class LDBezierCurve : public LDObject
 {
-	LDOBJ (BezierCurve)
-	LDOBJ_NAME (beziercurve)
-	LDOBJ_VERTICES (4)
+	LDOBJ(BezierCurve)
+	LDOBJ_NAME(beziercurve)
+	LDOBJ_VERTICES(4)
 	LDOBJ_COLORED
-	LDOBJ_DEFAULTCOLOR (EdgeColor)
+	LDOBJ_DEFAULTCOLOR(EdgeColor)
 	LDOBJ_SCEMANTIC
 	LDOBJ_NO_MATRIX
 
 public:
-	LDBezierCurve (const Vertex& v0, const Vertex& v1,
+	LDBezierCurve(const Vertex& v0, const Vertex& v1,
 		const Vertex& v2, const Vertex& v3, LDDocument* document = nullptr);
-	Vertex pointAt (qreal t) const;
-	LDObjectList rasterize (int segments = 0);
-	QVector<LDPolygon> rasterizePolygons (int segments = 0);
+	Vertex pointAt(qreal t) const;
+	LDObjectList rasterize(int segments = 0);
+	QVector<LDPolygon> rasterizePolygons(int segments = 0);
 };
 
 // Other common LDraw stuff
-static const QString CALicenseText ("!LICENSE Redistributable under CCAL version 2.0 : "
+static const QString CALicenseText("!LICENSE Redistributable under CCAL version 2.0 : "
 	"see CAreadme.txt");
 
 enum
--- a/src/ldObjectMath.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ldObjectMath.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -22,36 +22,36 @@
 
 // =============================================================================
 //
-static void RotateVertex (Vertex& v, const Vertex& rotpoint, const Matrix& transformer)
+static void RotateVertex(Vertex& v, const Vertex& rotpoint, const Matrix& transformer)
 {
 	v -= rotpoint;
-	v.transform (transformer, Origin);
+	v.transform(transformer, Origin);
 	v += rotpoint;
 }
 
 // =============================================================================
 //
-void RotateObjects (const int l, const int m, const int n, double angle, LDObjectList const& objects)
+void RotateObjects(const int l, const int m, const int n, double angle, LDObjectList const& objects)
 {
 	QList<Vertex*> queue;
-	const Vertex rotpoint = GetRotationPoint (objects);
-	const double cosangle = cos (angle),
-				 sinangle = sin (angle);
+	const Vertex rotpoint = GetRotationPoint(objects);
+	const double cosangle = cos(angle),
+				 sinangle = sin(angle);
 
 	// ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2
-	Matrix transform (
+	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
@@ -61,22 +61,22 @@
 		{
 			for (int i = 0; i < obj->numVertices(); ++i)
 			{
-				Vertex v = obj->vertex (i);
-				RotateVertex (v, rotpoint, transform);
-				obj->setVertex (i, v);
+				Vertex v = obj->vertex(i);
+				RotateVertex(v, rotpoint, transform);
+				obj->setVertex(i, v);
 			}
 		}
 		else if (obj->hasMatrix())
 		{
-			LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
+			LDMatrixObject* mo = dynamic_cast<LDMatrixObject*>(obj);
 
 			// Transform the position
 			Vertex v = mo->position();
-			RotateVertex (v, rotpoint, transform);
-			mo->setPosition (v);
+			RotateVertex(v, rotpoint, transform);
+			mo->setPosition(v);
 
 			// Transform the matrix
-			mo->setTransform (transform * mo->transform());
+			mo->setTransform(transform * mo->transform());
 		}
 	}
 }
--- a/src/ldObjectMath.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ldObjectMath.h	Thu Jan 04 19:44:26 2018 +0200
@@ -19,5 +19,5 @@
 #pragma once
 #include "main.h"
 
-void RotateObjects (const int l, const int m, const int n,
+void RotateObjects(const int l, const int m, const int n,
 	double angle, LDObjectList const& objects);
--- a/src/ldobjectiterator.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ldobjectiterator.h	Thu Jan 04 19:44:26 2018 +0200
@@ -24,16 +24,16 @@
 class LDObjectIterator
 {
 public:
-	LDObjectIterator (LDDocument* doc) :
-		m_list (doc->objects()),
-		m_i (-1)
+	LDObjectIterator(LDDocument* doc) :
+		m_list(doc->objects()),
+		m_i(-1)
 	{
 		seekTillValid();
 	}
 
-	LDObjectIterator (const LDObjectList& objs) :
-		m_list (objs),
-		m_i (-1)
+	LDObjectIterator(const LDObjectList& objs) :
+		m_list(objs),
+		m_i(-1)
 	{
 		seekTillValid();
 	}
@@ -45,7 +45,7 @@
 
 	T* get() const
 	{
-		return static_cast<T*> (m_list[m_i]);
+		return static_cast<T*>(m_list[m_i]);
 	}
 
 	bool isValid() const
@@ -53,7 +53,7 @@
 		return not outOfBounds() and get()->type() == T::SubclassType;
 	}
 
-	void seek (int i)
+	void seek(int i)
 	{
 		m_i = i;
 	}
@@ -90,7 +90,7 @@
 		seekTillValid();
 	}
 
-	void operator++ (int)
+	void operator++(int)
 	{
 		seekTillValid(); 
 	}
@@ -100,7 +100,7 @@
 		rewindTillValid();
 	}
 
-	void operator-- (int)
+	void operator--(int)
 	{
 		rewindTillValid();
 	}
@@ -116,11 +116,11 @@
 };
 
 template<typename T, typename R>
-QVector<T*> filterByType (const R& stuff)
+QVector<T*> filterByType(const R& stuff)
 {
 	QVector<T*> result;
 
-	for (LDObjectIterator<T> it (stuff); it.isValid(); ++it)
+	for (LDObjectIterator<T> it(stuff); it.isValid(); ++it)
 		result << it;
 
 	return result;
--- a/src/ldpaths.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ldpaths.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -21,36 +21,36 @@
 #include "mainwindow.h"
 #include "dialogs/ldrawpathdialog.h"
 
-ConfigOption (QString LDrawPath)
+ConfigOption(QString LDrawPath)
 
-LDPaths::LDPaths (QObject* parent) :
-	QObject (parent),
-	m_dialog (nullptr) {}
+LDPaths::LDPaths(QObject* parent) :
+	QObject(parent),
+	m_dialog(nullptr) {}
 
 void LDPaths::checkPaths()
 {
 	QString pathconfig = config.lDrawPath();
 
-	if (not configurePaths (pathconfig))
+	if (not configurePaths(pathconfig))
 	{
-		m_dialog = new LDrawPathDialog (pathconfig, false);
-		connect (m_dialog, SIGNAL (pathChanged(QString)), this, SLOT (configurePaths (QString)));
+		m_dialog = new LDrawPathDialog(pathconfig, false);
+		connect(m_dialog, SIGNAL(pathChanged(QString)), this, SLOT(configurePaths(QString)));
 
 		if (not m_dialog->exec())
-			exit (1);
+			exit(1);
 		else
-			config.setLDrawPath (m_dialog->path());
+			config.setLDrawPath(m_dialog->path());
 	}
 }
 
-bool LDPaths::isValid (const QDir& dir) const
+bool LDPaths::isValid(const QDir& dir) const
 {
 	if (dir.exists())
 	{
 		if (dir.isReadable())
 		{
 			QStringList mustHave = { "LDConfig.ldr", "parts", "p" };
-			QStringList contents = dir.entryList (mustHave);
+			QStringList contents = dir.entryList(mustHave);
 	
 			if (contents.size() == mustHave.size())
 				m_error = "";
@@ -66,21 +66,21 @@
 	return m_error.isEmpty();
 }
 
-bool LDPaths::configurePaths (QString path)
+bool LDPaths::configurePaths(QString path)
 {
-	QDir dir (path);
-	bool ok = isValid (dir);
+	QDir dir(path);
+	bool ok = isValid(dir);
 
 	if (ok)
 	{
 		baseDir() = dir;
-		ldConfigPath() = format ("%1" DIRSLASH "LDConfig.ldr", path);
-		partsDir() = QDir (path + DIRSLASH "parts");
-		primitivesDir() = QDir (path + DIRSLASH "p");
+		ldConfigPath() = format("%1" DIRSLASH "LDConfig.ldr", path);
+		partsDir() = QDir(path + DIRSLASH "parts");
+		primitivesDir() = QDir(path + DIRSLASH "p");
 	}
 
 	if (m_dialog)
-		m_dialog->setStatusText (m_error.isEmpty() ? "OK" : m_error, ok);
+		m_dialog->setStatusText(m_error.isEmpty() ? "OK" : m_error, ok);
 
 	return ok;
 }
--- a/src/ldpaths.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ldpaths.h	Thu Jan 04 19:44:26 2018 +0200
@@ -27,9 +27,9 @@
 	Q_OBJECT
 
 public:
-	LDPaths (QObject* parent = nullptr);
+	LDPaths(QObject* parent = nullptr);
 	void checkPaths();
-	bool isValid (const class QDir& path) const;
+	bool isValid(const class QDir& path) const;
 
 	static QDir& baseDir();
 	static QString& ldConfigPath();
@@ -37,7 +37,7 @@
 	static QDir& partsDir();
 
 public slots:
-	bool configurePaths (QString path);
+	bool configurePaths(QString path);
 
 private:
 	mutable QString m_error;
--- a/src/macros.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/macros.h	Thu Jan 04 19:44:26 2018 +0200
@@ -24,8 +24,8 @@
 #endif
 
 template <typename T, size_t N>
-char (&countofHelper (T(&)[N]))[N];
-#define countof(x) ((int) sizeof (countofHelper(x)))
+char(&countofHelper(T(&)[N]))[N];
+#define countof(x)((int) sizeof(countofHelper(x)))
 
 #define DEFINE_CLASS(SELF, SUPER) \
 public: \
@@ -40,16 +40,16 @@
 # define DIRSLASH_CHAR '/'
 #endif // WIN32
 
-#define dvalof(A) dprint ("value of '%1' = %2\n", #A, A)
-#define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z}))
+#define dvalof(A) dprint("value of '%1' = %2\n", #A, A)
+#define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis>({X, Y, Z}))
 
 #define MAKE_ITERABLE_ENUM(T) \
-	inline T operator++ (T& a) { a = (T) ((int) a + 1); return a; } \
-	inline T operator-- (T& a) { a = (T) ((int) a - 1); return a; } \
-	inline T operator++ (T& a, int) { T result = a; a = (T) ((int) a + 1); return result; } \
-	inline T operator-- (T& a, int) { T result = a; a = (T) ((int) a - 1); return result; }
+	inline T operator++(T& a) { a = (T)((int) a + 1); return a; } \
+	inline T operator--(T& a) { a = (T)((int) a - 1); return a; } \
+	inline T operator++(T& a, int) { T result = a; a = (T)((int) a + 1); return result; } \
+	inline T operator--(T& a, int) { T result = a; a = (T)((int) a - 1); return result; }
 
-#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 # define USE_QT5
 #endif
 
@@ -57,11 +57,11 @@
 #define FOR_ENUM_NAME(LINE) FOR_ENUM_NAME_HELPER(LINE)
 
 #define for_enum(ENUM, NAME) \
-	for (std::underlying_type<ENUM>::type FOR_ENUM_NAME (__LINE__) = \
-		std::underlying_type<ENUM>::type (ENUM::FirstValue); \
-		FOR_ENUM_NAME (__LINE__) < std::underlying_type<ENUM>::type (ENUM::NumValues); \
-		++FOR_ENUM_NAME (__LINE__)) \
-	for (ENUM NAME = ENUM (FOR_ENUM_NAME (__LINE__)); NAME != ENUM::NumValues; \
+	for (std::underlying_type<ENUM>::type FOR_ENUM_NAME(__LINE__) = \
+		std::underlying_type<ENUM>::type(ENUM::FirstValue); \
+		FOR_ENUM_NAME(__LINE__) < std::underlying_type<ENUM>::type(ENUM::NumValues); \
+		++FOR_ENUM_NAME(__LINE__)) \
+	for (ENUM NAME = ENUM(FOR_ENUM_NAME(__LINE__)); NAME != ENUM::NumValues; \
 		NAME = ENUM::NumValues)
 
 #define ConfigOption(...)
--- a/src/main.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/main.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -36,18 +36,18 @@
 
 MainWindow* g_win = nullptr;
 ConfigurationValueBag config;
-const Vertex Origin (0.0f, 0.0f, 0.0f);
-const Matrix IdentityMatrix ({1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f});
+const Vertex Origin(0.0f, 0.0f, 0.0f);
+const Matrix IdentityMatrix({1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f});
 
-ConfigOption (bool FirstStart = true)
+ConfigOption(bool FirstStart = true)
 
 // =============================================================================
 //
-int main (int argc, char* argv[])
+int main(int argc, char* argv[])
 {
-	QApplication app (argc, argv);
-	app.setOrganizationName (APPNAME);
-	app.setApplicationName (APPNAME);
+	QApplication app(argc, argv);
+	app.setOrganizationName(APPNAME);
+	app.setApplicationName(APPNAME);
 
 	LDPaths* paths = new LDPaths;
 	paths->checkPaths();
@@ -61,7 +61,7 @@
 
 	// Process the command line
 	for (int arg = 1; arg < argc; ++arg)
-		win->documents()->openMainModel (QString::fromLocal8Bit (argv[arg]));
+		win->documents()->openMainModel(QString::fromLocal8Bit(argv[arg]));
 
 	return app.exec();
 }
--- a/src/mainwindow.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/mainwindow.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -57,56 +57,56 @@
 #include "documentmanager.h"
 #include "ldobjectiterator.h"
 
-ConfigOption (bool ColorizeObjectsList = true)
-ConfigOption (QString QuickColorToolbar = "4:25:14:27:2:3:11:1:22:|:0:72:71:15")
-ConfigOption (bool ListImplicitFiles = false)
-ConfigOption (QStringList HiddenToolbars)
+ConfigOption(bool ColorizeObjectsList = true)
+ConfigOption(QString QuickColorToolbar = "4:25:14:27:2:3:11:1:22:|:0:72:71:15")
+ConfigOption(bool ListImplicitFiles = false)
+ConfigOption(QStringList HiddenToolbars)
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-MainWindow::MainWindow (QWidget* parent, Qt::WindowFlags flags) :
-	QMainWindow (parent, flags),
-	m_guiUtilities (new GuiUtilities (this)),
-	ui (*new Ui_MainWindow),
-	m_externalPrograms (nullptr),
-	m_settings (makeSettings (this)),
-	m_documents (new DocumentManager (this)),
-	m_currentDocument (nullptr),
-	m_isSelectionLocked (false)
+MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) :
+	QMainWindow(parent, flags),
+	m_guiUtilities(new GuiUtilities(this)),
+	ui(*new Ui_MainWindow),
+	m_externalPrograms(nullptr),
+	m_settings(makeSettings(this)),
+	m_documents(new DocumentManager(this)),
+	m_currentDocument(nullptr),
+	m_isSelectionLocked(false)
 {
 	g_win = this;
-	ui.setupUi (this);
+	ui.setupUi(this);
 	m_updatingTabs = false;
-	m_renderer = new GLRenderer (this);
+	m_renderer = new GLRenderer(this);
 	m_tabs = new QTabBar;
-	m_tabs->setTabsClosable (true);
-	ui.verticalLayout->insertWidget (0, m_tabs);
+	m_tabs->setTabsClosable(true);
+	ui.verticalLayout->insertWidget(0, m_tabs);
 
 	createBlankDocument();
-	m_renderer->setDocument (m_currentDocument);
+	m_renderer->setDocument(m_currentDocument);
 
 	// Stuff the renderer into its frame
-	QVBoxLayout* rendererLayout = new QVBoxLayout (ui.rendererFrame);
-	rendererLayout->addWidget (renderer());
+	QVBoxLayout* rendererLayout = new QVBoxLayout(ui.rendererFrame);
+	rendererLayout->addWidget(renderer());
 
-	connect (ui.objectList, SIGNAL (itemSelectionChanged()), this, SLOT (selectionChanged()));
-	connect (ui.objectList, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (objectListDoubleClicked (QListWidgetItem*)));
-	connect (m_tabs, SIGNAL (currentChanged(int)), this, SLOT (tabSelected()));
-	connect (m_tabs, SIGNAL (tabCloseRequested (int)), this, SLOT (closeTab (int)));
+	connect(ui.objectList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
+	connect(ui.objectList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(objectListDoubleClicked(QListWidgetItem*)));
+	connect(m_tabs, SIGNAL(currentChanged(int)), this, SLOT(tabSelected()));
+	connect(m_tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
 
 	if (ActivePrimitiveScanner())
-		connect (ActivePrimitiveScanner(), SIGNAL (workDone()), this, SLOT (updatePrimitives()));
+		connect(ActivePrimitiveScanner(), SIGNAL(workDone()), this, SLOT(updatePrimitives()));
 	else
 		updatePrimitives();
 
 	m_quickColors = LoadQuickColorList();
-	setStatusBar (new QStatusBar);
+	setStatusBar(new QStatusBar);
 	updateActions();
 
 	// Connect all actions and save default sequences
-	applyToActions ([&](QAction* act)
+	applyToActions([&](QAction* act)
 	{
-		connect (act, SIGNAL (triggered()), this, SLOT (actionTriggered()));
+		connect(act, SIGNAL(triggered()), this, SLOT(actionTriggered()));
 		m_defaultShortcuts[act] = act->shortcut();
 	});
 
@@ -116,45 +116,45 @@
 	updateColorToolbar();
 	updateTitle();
 	loadShortcuts();
-	setMinimumSize (300, 200);
-	connect (qApp, SIGNAL (aboutToQuit()), this, SLOT (doLastSecondCleanup()));
-	connect (ui.ringToolHiRes, SIGNAL (clicked (bool)), this, SLOT (ringToolHiResClicked (bool)));
-	connect (ui.ringToolSegments, SIGNAL (valueChanged (int)),
-		this, SLOT (circleToolSegmentsChanged()));
+	setMinimumSize(300, 200);
+	connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(doLastSecondCleanup()));
+	connect(ui.ringToolHiRes, SIGNAL(clicked(bool)), this, SLOT(ringToolHiResClicked(bool)));
+	connect(ui.ringToolSegments, SIGNAL(valueChanged(int)),
+		this, SLOT(circleToolSegmentsChanged()));
 	circleToolSegmentsChanged(); // invoke it manually for initial label text
 
 	// Examine the toolsets and make a dictionary of tools
-	m_toolsets = Toolset::createToolsets (this);
+	m_toolsets = Toolset::createToolsets(this);
 
 	QStringList ignore;
 	for (int i = 0; i < Toolset::staticMetaObject.methodCount(); ++i)
 	{
-		QMetaMethod method = Toolset::staticMetaObject.method (i);
-		ignore.append (QString::fromUtf8 (method.name()));
+		QMetaMethod method = Toolset::staticMetaObject.method(i);
+		ignore.append(QString::fromUtf8(method.name()));
 	}
 
 	for (Toolset* toolset : m_toolsets)
 	{
 		const QMetaObject* meta = toolset->metaObject();
 
-		if (qobject_cast<ExtProgramToolset*> (toolset))
-			m_externalPrograms = static_cast<ExtProgramToolset*> (toolset);
+		if (qobject_cast<ExtProgramToolset*>(toolset))
+			m_externalPrograms = static_cast<ExtProgramToolset*>(toolset);
 
 		for (int i = 0; i < meta->methodCount(); ++i)
 		{
 			ToolInfo info;
-			info.method = meta->method (i);
+			info.method = meta->method(i);
 			info.object = toolset;
-			QString methodName = QString::fromUtf8 (info.method.name());
+			QString methodName = QString::fromUtf8(info.method.name());
 
-			if (ignore.contains (methodName))
+			if (ignore.contains(methodName))
 				continue; // The method was inherited from base classes
 
-			QString actionName = "action" + methodName.left (1).toUpper() + methodName.mid (1);
-			QAction* action = findChild<QAction*> (actionName);
+			QString actionName = "action" + methodName.left(1).toUpper() + methodName.mid(1);
+			QAction* action = findChild<QAction*>(actionName);
 
 			if (action == nullptr)
-				print ("No action for %1::%2 (looked for %3)\n", meta->className(), methodName, actionName);
+				print("No action for %1::%2(looked for %3)\n", meta->className(), methodName, actionName);
 			else
 				m_toolmap[action] = info;
 		}
@@ -162,7 +162,7 @@
 
 	for (QVariant const& toolbarname : config.hiddenToolbars())
 	{
-		QToolBar* toolbar = findChild<QToolBar*> (toolbarname.toString());
+		QToolBar* toolbar = findChild<QToolBar*>(toolbarname.toString());
 
 		if (toolbar)
 			toolbar->hide();
@@ -172,9 +172,9 @@
 	// them to the profile tab, it's the most important form to fill in.
 	if (config.firstStart())
 	{
-		ConfigDialog* dialog = new ConfigDialog (this, ConfigDialog::ProfileTab);
+		ConfigDialog* dialog = new ConfigDialog(this, ConfigDialog::ProfileTab);
 		dialog->show();
-		config.setFirstStart (false);
+		config.setFirstStart(false);
 	}
 }
 
@@ -189,17 +189,17 @@
 {
 	// Get the name of the sender object and use it to compose the slot name,
 	// then invoke this slot to call the action.
-	QAction* action = qobject_cast<QAction*> (sender());
+	QAction* action = qobject_cast<QAction*>(sender());
 
 	if (action)
 	{
-		if (m_toolmap.contains (action))
+		if (m_toolmap.contains(action))
 		{
 			const ToolInfo& info = m_toolmap[action];
-			info.method.invoke (info.object, Qt::DirectConnection);
+			info.method.invoke(info.object, Qt::DirectConnection);
 		}
 		else
-			print ("No tool info for %1!\n", action->objectName());
+			print("No tool info for %1!\n", action->objectName());
 	}
 
 	endAction();
@@ -210,7 +210,7 @@
 void MainWindow::endAction()
 {
 	m_currentDocument->addHistoryStep();
-	updateDocumentListItem (m_currentDocument);
+	updateDocumentListItem(m_currentDocument);
 	refresh();
 }
 
@@ -237,10 +237,10 @@
 	for (const QVariant& it : config.recentFiles())
 	{
 		QString file = it.toString();
-		QAction* recent = new QAction (GetIcon ("open-recent"), file, this);
+		QAction* recent = new QAction(GetIcon("open-recent"), file, this);
 
-		connect (recent, SIGNAL (triggered()), this, SLOT (recentFileClicked()));
-		ui.menuOpenRecent->insertAction (first, recent);
+		connect(recent, SIGNAL(triggered()), this, SLOT(recentFileClicked()));
+		ui.menuOpenRecent->insertAction(first, recent);
 		m_recentFiles << recent;
 		first = recent;
 	}
@@ -252,7 +252,7 @@
 {
 	QList<ColorToolbarItem> colors;
 
-	for (QString colorname : config.quickColorToolbar().split (":"))
+	for (QString colorname : config.quickColorToolbar().split(":"))
 	{
 		if (colorname == "|")
 			colors << ColorToolbarItem::makeSeparator();
@@ -261,7 +261,7 @@
 			LDColor color = colorname.toInt();
 
 			if (color.isValid())
-				colors << ColorToolbarItem (color, nullptr);
+				colors << ColorToolbarItem(color, nullptr);
 		}
 	}
 
@@ -274,7 +274,7 @@
 {
 	m_colorButtons.clear();
 	ui.toolBarColors->clear();
-	ui.toolBarColors->addAction (ui.actionUncolor);
+	ui.toolBarColors->addAction(ui.actionUncolor);
 	ui.toolBarColors->addSeparator();
 
 	for (ColorToolbarItem& entry : m_quickColors)
@@ -286,15 +286,15 @@
 		else
 		{
 			QToolButton* colorButton = new QToolButton;
-			colorButton->setIcon (m_guiUtilities->makeColorIcon (entry.color(), 16));
-			colorButton->setIconSize (QSize (16, 16));
-			colorButton->setToolTip (entry.color().name());
+			colorButton->setIcon(m_guiUtilities->makeColorIcon(entry.color(), 16));
+			colorButton->setIconSize(QSize(16, 16));
+			colorButton->setToolTip(entry.color().name());
 
-			connect (colorButton, SIGNAL (clicked()), this, SLOT (quickColorClicked()));
-			ui.toolBarColors->addWidget (colorButton);
+			connect(colorButton, SIGNAL(clicked()), this, SLOT(quickColorClicked()));
+			ui.toolBarColors->addWidget(colorButton);
 			m_colorButtons << colorButton;
 
-			entry.setToolButton (colorButton);
+			entry.setToolButton(colorButton);
 		}
 	}
 
@@ -307,20 +307,20 @@
 {
 	// Ensure that the current grid - and only the current grid - is selected.
 	int grid = config.grid();
-	ui.actionGridCoarse->setChecked (grid == Grid::Coarse);
-	ui.actionGridMedium->setChecked (grid == Grid::Medium);
-	ui.actionGridFine->setChecked (grid == Grid::Fine);
+	ui.actionGridCoarse->setChecked(grid == Grid::Coarse);
+	ui.actionGridMedium->setChecked(grid == Grid::Medium);
+	ui.actionGridFine->setChecked(grid == Grid::Fine);
 
 	// Recompile all Bézier curves, the changing grid affects their precision.
-	for (LDObjectIterator<LDBezierCurve> it (m_currentDocument); it.isValid(); ++it)
-		renderer()->compileObject (it);
+	for (LDObjectIterator<LDBezierCurve> it(m_currentDocument); it.isValid(); ++it)
+		renderer()->compileObject(it);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
 void MainWindow::updateTitle()
 {
-	QString title = format (APPNAME " " VERSION_STRING);
+	QString title = format(APPNAME " " VERSION_STRING);
 
 	// Append our current file if we have one
 	if (m_currentDocument)
@@ -329,11 +329,11 @@
 		title += m_currentDocument->getDisplayName();
 
 		if (m_currentDocument->getObjectCount() > 0 and
-			m_currentDocument->getObject (0)->type() == OBJ_Comment)
+			m_currentDocument->getObject(0)->type() == OBJ_Comment)
 		{
 			// Append title
-			LDComment* comm = static_cast <LDComment*> (m_currentDocument->getObject (0));
-			title += format (": %1", comm->text());
+			LDComment* comm = static_cast <LDComment*>(m_currentDocument->getObject(0));
+			title += format(": %1", comm->text());
 		}
 
 		if (m_currentDocument->hasUnsavedChanges())
@@ -346,10 +346,10 @@
 	title += " [pre-release build]";
 #endif // DEBUG
 
-	if (strlen (commitTimeString()))
-		title += format (" (%1)", QString::fromUtf8 (commitTimeString()));
+	if (strlen(commitTimeString()))
+		title += format("(%1)", QString::fromUtf8(commitTimeString()));
 
-	setWindowTitle (title);
+	setWindowTitle(title);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -383,7 +383,7 @@
 	m_objectsInList.clear();
 
 	for (int i = 0; i < ui.objectList->count(); ++i)
-		delete ui.objectList->item (i);
+		delete ui.objectList->item(i);
 
 	ui.objectList->clear();
 
@@ -391,15 +391,15 @@
 	{
 		QString descr;
 
-		switch (obj->type())
+		switch(obj->type())
 		{
 			case OBJ_Comment:
 			{
-				descr = static_cast<LDComment*> (obj)->text();
+				descr = static_cast<LDComment*>(obj)->text();
 
 				// Remove leading whitespace
 				while (descr[0] == ' ')
-					descr.remove (0, 1);
+					descr.remove(0, 1);
 
 				break;
 			}
@@ -418,25 +418,25 @@
 					if (i != 0)
 						descr += ", ";
 
-					descr += obj->vertex (i).toString (true);
+					descr += obj->vertex(i).toString(true);
 				}
 				break;
 			}
 
 			case OBJ_Error:
 			{
-				descr = format ("ERROR: %1", obj->asText());
+				descr = format("ERROR: %1", obj->asText());
 				break;
 			}
 
 			case OBJ_SubfileReference:
 			{
-				LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
+				LDSubfileReference* ref = static_cast<LDSubfileReference*>(obj);
 
-				descr = format ("%1 %2, (", ref->fileInfo()->getDisplayName(), ref->position().toString (true));
+				descr = format("%1 %2,(", ref->fileInfo()->getDisplayName(), ref->position().toString(true));
 
 				for (int i = 0; i < 9; ++i)
-					descr += format ("%1%2", ref->transform()[i], (i != 8) ? " " : "");
+					descr += format("%1%2", ref->transform()[i],(i != 8) ? " " : "");
 
 				descr += ')';
 				break;
@@ -444,15 +444,15 @@
 
 			case OBJ_Bfc:
 			{
-				descr = static_cast<LDBfc*> (obj)->statementToString();
+				descr = static_cast<LDBfc*>(obj)->statementToString();
 				break;
 			}
 
 			case OBJ_Overlay:
 			{
-				LDOverlay* ovl = static_cast<LDOverlay*> (obj);
-				descr = format ("[%1] %2 (%3, %4), %5 x %6", renderer()->cameraName ((ECamera) ovl->camera()),
-					Basename (ovl->fileName()), ovl->x(), ovl->y(),
+				LDOverlay* ovl = static_cast<LDOverlay*>(obj);
+				descr = format("[%1] %2(%3, %4), %5 x %6", renderer()->cameraName((ECamera) ovl->camera()),
+					Basename(ovl->fileName()), ovl->x(), ovl->y(),
 					ovl->width(), ovl->height());
 				break;
 			}
@@ -464,22 +464,22 @@
 			}
 		}
 
-		QListWidgetItem* item = new QListWidgetItem (descr);
-		item->setIcon (GetIcon (obj->typeName()));
+		QListWidgetItem* item = new QListWidgetItem(descr);
+		item->setIcon(GetIcon(obj->typeName()));
 
 		// Use italic font if hidden
 		if (obj->isHidden())
 		{
 			QFont font = item->font();
-			font.setItalic (true);
-			item->setFont (font);
+			font.setItalic(true);
+			item->setFont(font);
 		}
 
 		// Color gibberish orange on red so it stands out.
 		if (obj->type() == OBJ_Error)
 		{
-			item->setBackground (QColor ("#AA0000"));
-			item->setForeground (QColor ("#FFAA00"));
+			item->setBackground(QColor("#AA0000"));
+			item->setForeground(QColor("#FFAA00"));
 		}
 		else if (config.colorizeObjectsList()
 			and obj->isColored()
@@ -488,11 +488,11 @@
 			and obj->color() != EdgeColor)
 		{
 			// If the object isn't in the main or edge color, draw this list entry in that color.
-			item->setForeground (obj->color().faceColor());
+			item->setForeground(obj->color().faceColor());
 		}
 
-		m_objectsInList.insert (obj, item);
-		ui.objectList->insertItem (ui.objectList->count(), item);
+		m_objectsInList.insert(obj, item);
+		ui.objectList->insertItem(ui.objectList->count(), item);
 	}
 
 	m_isSelectionLocked = false;
@@ -510,7 +510,7 @@
 		return;
 
 	LDObject* obj = selectedObjects().first();
-	ui.objectList->scrollToItem (m_objectsInList[obj]);
+	ui.objectList->scrollToItem(m_objectsInList[obj]);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -538,16 +538,16 @@
 		}
 	}
 
-	// The select() method calls may have selected additional items (i.e. invertnexts)
+	// The select() method calls may have selected additional items(i.e. invertnexts)
 	// Update it all now.
 	updateSelection();
 
 	// Update the GL renderer
 	LDObjectList compound = priorSelection + selectedObjects();
-	removeDuplicates (compound);
+	removeDuplicates(compound);
 
 	for (LDObject* obj : compound)
-		renderer()->compileObject (obj);
+		renderer()->compileObject(obj);
 
 	renderer()->update();
 }
@@ -556,15 +556,15 @@
 //
 void MainWindow::recentFileClicked()
 {
-	QAction* qAct = static_cast<QAction*> (sender());
-	documents()->openMainModel (qAct->text());
+	QAction* qAct = static_cast<QAction*>(sender());
+	documents()->openMainModel(qAct->text());
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
 void MainWindow::quickColorClicked()
 {
-	QToolButton* button = static_cast<QToolButton*> (sender());
+	QToolButton* button = static_cast<QToolButton*>(sender());
 	LDColor color = LDColor::nullColor();
 
 	for (const ColorToolbarItem& entry : m_quickColors)
@@ -584,8 +584,8 @@
 		if (not obj->isColored())
 			continue; // uncolored object
 
-		obj->setColor (color);
-		renderer()->compileObject (obj);
+		obj->setColor(color);
+		renderer()->compileObject(obj);
 	}
 
 	endAction();
@@ -635,12 +635,12 @@
 
 	for (LDObject* obj : selectedObjects())
 	{
-		QListWidgetItem** itempointer = m_objectsInList.find (obj);
+		QListWidgetItem** itempointer = m_objectsInList.find(obj);
 
 		if (not itempointer)
 			continue;
 
-		int row = ui.objectList->row (*itempointer);
+		int row = ui.objectList->row(*itempointer);
 
 		if (top == -1)
 		{
@@ -650,8 +650,8 @@
 		{
 			if (row != bottom + 1)
 			{
-				itemselect.select (ui.objectList->model()->index (top, 0),
-					ui.objectList->model()->index (bottom, 0));
+				itemselect.select(ui.objectList->model()->index(top, 0),
+					ui.objectList->model()->index(bottom, 0));
 				top = -1;
 			}
 
@@ -661,18 +661,18 @@
 
 	if (top != -1)
 	{
-		itemselect.select (ui.objectList->model()->index (top, 0),
-			ui.objectList->model()->index (bottom, 0));
+		itemselect.select(ui.objectList->model()->index(top, 0),
+			ui.objectList->model()->index(bottom, 0));
 	}
 
 	// Select multiple objects at once for performance reasons
-	ui.objectList->selectionModel()->select (itemselect, QItemSelectionModel::ClearAndSelect);
+	ui.objectList->selectionModel()->select(itemselect, QItemSelectionModel::ClearAndSelect);
 	m_isSelectionLocked = false;
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-// Returns the uniform selected color (i.e. 4 if everything selected is red), -1 if there is no such consensus.
+// Returns the uniform selected color(i.e. 4 if everything selected is red), -1 if there is no such consensus.
 //
 LDColor MainWindow::getUniformSelectedColor()
 {
@@ -695,7 +695,7 @@
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void MainWindow::closeEvent (QCloseEvent* ev)
+void MainWindow::closeEvent(QCloseEvent* ev)
 {
 	// Check whether it's safe to close all files.
 	if (not m_documents->isSafeToCloseAll())
@@ -714,14 +714,14 @@
 	}
 
 	// Save the configuration before leaving.
-	config.setHiddenToolbars (hiddenToolbars);
+	config.setHiddenToolbars(hiddenToolbars);
 	syncSettings();
 	ev->accept();
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void MainWindow::spawnContextMenu (const QPoint pos)
+void MainWindow::spawnContextMenu(const QPoint pos)
 {
 	const bool single = (selectedObjects().size() == 1);
 	LDObject* singleObj = single ? selectedObjects().first() : nullptr;
@@ -741,53 +741,53 @@
 
 	if (single and singleObj->type() != OBJ_Empty)
 	{
-		contextMenu->addAction (ui.actionEdit);
+		contextMenu->addAction(ui.actionEdit);
 		contextMenu->addSeparator();
 	}
 
-	contextMenu->addAction (ui.actionCut);
-	contextMenu->addAction (ui.actionCopy);
-	contextMenu->addAction (ui.actionPaste);
-	contextMenu->addAction (ui.actionRemove);
+	contextMenu->addAction(ui.actionCut);
+	contextMenu->addAction(ui.actionCopy);
+	contextMenu->addAction(ui.actionPaste);
+	contextMenu->addAction(ui.actionRemove);
 	contextMenu->addSeparator();
-	contextMenu->addAction (ui.actionSetColor);
+	contextMenu->addAction(ui.actionSetColor);
 
 	if (single)
-		contextMenu->addAction (ui.actionEditRaw);
+		contextMenu->addAction(ui.actionEditRaw);
 
-	contextMenu->addAction (ui.actionMakeBorders);
-	contextMenu->addAction (ui.actionSetOverlay);
-	contextMenu->addAction (ui.actionClearOverlay);
+	contextMenu->addAction(ui.actionMakeBorders);
+	contextMenu->addAction(ui.actionSetOverlay);
+	contextMenu->addAction(ui.actionClearOverlay);
 
 	if (hasSubfiles)
 	{
 		contextMenu->addSeparator();
-		contextMenu->addAction (ui.actionOpenSubfiles);
+		contextMenu->addAction(ui.actionOpenSubfiles);
 	}
 
 	contextMenu->addSeparator();
-	contextMenu->addAction (ui.actionModeSelect);
-	contextMenu->addAction (ui.actionModeDraw);
-	contextMenu->addAction (ui.actionModeCircle);
+	contextMenu->addAction(ui.actionModeSelect);
+	contextMenu->addAction(ui.actionModeDraw);
+	contextMenu->addAction(ui.actionModeCircle);
 
 	if (not selectedObjects().isEmpty())
 	{
 		contextMenu->addSeparator();
-		contextMenu->addAction (ui.actionSubfileSelection);
+		contextMenu->addAction(ui.actionSubfileSelection);
 	}
 
 	if (renderer()->camera() != EFreeCamera)
 	{
 		contextMenu->addSeparator();
-		contextMenu->addAction (ui.actionSetDrawDepth);
+		contextMenu->addAction(ui.actionSetDrawDepth);
 	}
 
-	contextMenu->exec (pos);
+	contextMenu->exec(pos);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void MainWindow::deleteByColor (LDColor color)
+void MainWindow::deleteByColor(LDColor color)
 {
 	LDObjectList objs;
 
@@ -808,26 +808,26 @@
 void MainWindow::updateEditModeActions()
 {
 	const EditModeType mode = renderer()->currentEditModeType();
-	ui.actionModeSelect->setChecked (mode == EditModeType::Select);
-	ui.actionModeDraw->setChecked (mode == EditModeType::Draw);
-	ui.actionModeRectangle->setChecked (mode == EditModeType::Rectangle);
-	ui.actionModeCircle->setChecked (mode == EditModeType::Circle);
-	ui.actionModeMagicWand->setChecked (mode == EditModeType::MagicWand);
-	ui.actionModeLinePath->setChecked (mode == EditModeType::LinePath);
-	ui.actionModeCurve->setChecked (mode == EditModeType::Curve);
+	ui.actionModeSelect->setChecked(mode == EditModeType::Select);
+	ui.actionModeDraw->setChecked(mode == EditModeType::Draw);
+	ui.actionModeRectangle->setChecked(mode == EditModeType::Rectangle);
+	ui.actionModeCircle->setChecked(mode == EditModeType::Circle);
+	ui.actionModeMagicWand->setChecked(mode == EditModeType::MagicWand);
+	ui.actionModeLinePath->setChecked(mode == EditModeType::LinePath);
+	ui.actionModeCurve->setChecked(mode == EditModeType::Curve);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void MainWindow::objectListDoubleClicked (QListWidgetItem* listitem)
+void MainWindow::objectListDoubleClicked(QListWidgetItem* listitem)
 {
-	LDObject* object = m_objectsInList.reverseLookup (listitem);
-	AddObjectDialog::staticDialog (object->type(), object);
+	LDObject* object = m_objectsInList.reverseLookup(listitem);
+	AddObjectDialog::staticDialog(object->type(), object);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-bool MainWindow::save (LDDocument* doc, bool saveAs)
+bool MainWindow::save(LDDocument* doc, bool saveAs)
 {
 	if (doc->isCache())
 		return false;
@@ -844,9 +844,9 @@
 		else if (not doc->name().isEmpty())
 			name = doc->name();
 
-		name.replace ("\\", "/");
-		path = QFileDialog::getSaveFileName (this, tr ("Save As"),
-			name, tr ("LDraw files (*.dat *.ldr)"));
+		name.replace("\\", "/");
+		path = QFileDialog::getSaveFileName(this, tr("Save As"),
+			name, tr("LDraw files(*.dat *.ldr)"));
 
 		if (path.isEmpty())
 		{
@@ -855,75 +855,75 @@
 		}
 	}
 
-	if (doc->save (path, &savesize))
+	if (doc->save(path, &savesize))
 	{
 		if (doc == m_currentDocument)
 			updateTitle();
 
-		print ("Saved to %1 (%2)", path, MakePrettyFileSize (savesize));
+		print("Saved to %1(%2)", path, MakePrettyFileSize(savesize));
 
 		// Add it to recent files
-		m_documents->addRecentFile (path);
+		m_documents->addRecentFile(path);
 		return true;
 	}
 
-	QString message = format (tr ("Failed to save to %1: %2"), path, strerror (errno));
+	QString message = format(tr("Failed to save to %1: %2"), path, strerror(errno));
 
 	// Tell the user the save failed, and give the option for saving as with it.
-	QMessageBox dlg (QMessageBox::Critical, tr ("Save Failure"), message, QMessageBox::Close, this);
+	QMessageBox dlg(QMessageBox::Critical, tr("Save Failure"), message, QMessageBox::Close, this);
 
 	// Add a save-as button
-	QPushButton* saveAsBtn = new QPushButton (tr ("Save As"));
-	saveAsBtn->setIcon (GetIcon ("file-save-as"));
-	dlg.addButton (saveAsBtn, QMessageBox::ActionRole);
-	dlg.setDefaultButton (QMessageBox::Close);
+	QPushButton* saveAsBtn = new QPushButton(tr("Save As"));
+	saveAsBtn->setIcon(GetIcon("file-save-as"));
+	dlg.addButton(saveAsBtn, QMessageBox::ActionRole);
+	dlg.setDefaultButton(QMessageBox::Close);
 	dlg.exec();
 
 	if (dlg.clickedButton() == saveAsBtn)
-		return save (doc, true); // yay recursion!
+		return save(doc, true); // yay recursion!
 
 	return false;
 }
 
 // Adds a message to the renderer's message manager.
-void MainWindow::addMessage (QString msg)
+void MainWindow::addMessage(QString msg)
 {
-	m_renderer->messageLog()->addLine (msg);
+	m_renderer->messageLog()->addLine(msg);
 }
 
 // ============================================================================
-void ObjectList::contextMenuEvent (QContextMenuEvent* ev)
+void ObjectList::contextMenuEvent(QContextMenuEvent* ev)
 {
-	g_win->spawnContextMenu (ev->globalPos());
+	g_win->spawnContextMenu(ev->globalPos());
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-QPixmap GetIcon (QString iconName)
+QPixmap GetIcon(QString iconName)
 {
-	return (QPixmap (format (":/icons/%1.png", iconName)));
+	return (QPixmap(format(":/icons/%1.png", iconName)));
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-bool Confirm (const QString& message)
+bool Confirm(const QString& message)
 {
-	return Confirm (MainWindow::tr ("Confirm"), message);
+	return Confirm(MainWindow::tr("Confirm"), message);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-bool Confirm (const QString& title, const QString& message)
+bool Confirm(const QString& title, const QString& message)
 {
-	return QMessageBox::question (g_win, title, message,
+	return QMessageBox::question(g_win, title, message,
 		(QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes;
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void Critical (const QString& message)
+void Critical(const QString& message)
 {
-	QMessageBox::critical (g_win, MainWindow::tr ("Error"), message,
+	QMessageBox::critical(g_win, MainWindow::tr("Error"), message,
 		(QMessageBox::Close), QMessageBox::Close);
 }
 
@@ -934,7 +934,7 @@
 	m_updatingTabs = true;
 
 	while (m_tabs->count() > 0)
-		m_tabs->removeTab (0);
+		m_tabs->removeTab(0);
 
 	for (LDDocument* document : m_documents->allDocuments())
 	{
@@ -942,8 +942,8 @@
 		{
 			// Add an item to the list for this file and store the tab index
 			// in the document so we can find documents by tab index.
-			document->setTabIndex (m_tabs->addTab (""));
-			updateDocumentListItem (document);
+			document->setTabIndex(m_tabs->addTab(""));
+			updateDocumentListItem(document);
 		}
 	}
 
@@ -954,7 +954,7 @@
 //
 // Update the given document's tab. If no such tab exists, the document list is rebuilt.
 //
-void MainWindow::updateDocumentListItem (LDDocument* doc)
+void MainWindow::updateDocumentListItem(LDDocument* doc)
 {
 	bool oldUpdatingTabs = m_updatingTabs;
 	m_updatingTabs = true;
@@ -970,13 +970,13 @@
 	// If this is the current file, it also needs to be the selected item on
 	// the list.
 	if (doc == m_currentDocument)
-		m_tabs->setCurrentIndex (doc->tabIndex());
+		m_tabs->setCurrentIndex(doc->tabIndex());
 
-	m_tabs->setTabText (doc->tabIndex(), doc->getDisplayName());
+	m_tabs->setTabText(doc->tabIndex(), doc->getDisplayName());
 
 	// If the document.has unsaved changes, draw a little icon next to it to mark that.
-	m_tabs->setTabIcon (doc->tabIndex(), doc->hasUnsavedChanges() ? GetIcon ("file-save") : QIcon());
-	m_tabs->setTabData (doc->tabIndex(), doc->name());
+	m_tabs->setTabIcon(doc->tabIndex(), doc->hasUnsavedChanges() ? GetIcon("file-save") : QIcon());
+	m_tabs->setTabData(doc->tabIndex(), doc->name());
 	m_updatingTabs = oldUpdatingTabs;
 }
 
@@ -1004,7 +1004,7 @@
 	}
 
 	if (switchee and switchee != m_currentDocument)
-		changeDocument (switchee);
+		changeDocument(switchee);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -1018,7 +1018,7 @@
 	LDDocument* f = getm_currentDocument;
 
 for (LDObject* obj : *f)
-		ui.objectList->addItem (obj->qObjListEntry);
+		ui.objectList->addItem(obj->qObjListEntry);
 
 #endif
 
@@ -1036,18 +1036,18 @@
 	{
 		EditHistory* his = m_currentDocument->history();
 		int pos = his->position();
-		ui.actionUndo->setEnabled (pos != -1);
-		ui.actionRedo->setEnabled (pos < (long) his->size() - 1);
+		ui.actionUndo->setEnabled(pos != -1);
+		ui.actionRedo->setEnabled(pos <(long) his->size() - 1);
 	}
 
-	ui.actionWireframe->setChecked (config.drawWireframe());
-	ui.actionAxes->setChecked (config.drawAxes());
-	ui.actionBfcView->setChecked (config.bfcRedGreenView());
-	ui.actionRandomColors->setChecked (config.randomColors());
-	ui.actionDrawAngles->setChecked (config.drawAngles());
-	ui.actionDrawSurfaces->setChecked (config.drawSurfaces());
-	ui.actionDrawEdgeLines->setChecked (config.drawEdgeLines());
-	ui.actionDrawConditionalLines->setChecked (config.drawConditionalLines());
+	ui.actionWireframe->setChecked(config.drawWireframe());
+	ui.actionAxes->setChecked(config.drawAxes());
+	ui.actionBfcView->setChecked(config.bfcRedGreenView());
+	ui.actionRandomColors->setChecked(config.randomColors());
+	ui.actionDrawAngles->setChecked(config.drawAngles());
+	ui.actionDrawSurfaces->setChecked(config.drawSurfaces());
+	ui.actionDrawEdgeLines->setChecked(config.drawEdgeLines());
+	ui.actionDrawConditionalLines->setChecked(config.drawConditionalLines());
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -1059,7 +1059,7 @@
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void MainWindow::setQuickColors (const QList<ColorToolbarItem>& colors)
+void MainWindow::setQuickColors(const QList<ColorToolbarItem>& colors)
 {
 	m_quickColors = colors;
 	updateColorToolbar();
@@ -1069,14 +1069,14 @@
 //
 void MainWindow::updatePrimitives()
 {
-	populatePrimitivesTree (ui.primitives);
+	populatePrimitivesTree(ui.primitives);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void MainWindow::closeTab (int tabindex)
+void MainWindow::closeTab(int tabindex)
 {
-	LDDocument* doc = m_documents->findDocumentByName (m_tabs->tabData (tabindex).toString());
+	LDDocument* doc = m_documents->findDocumentByName(m_tabs->tabData(tabindex).toString());
 
 	if (doc)
 		doc->close();
@@ -1096,8 +1096,8 @@
 {
 	for (QAction* act : findChildren<QAction*>())
 	{
-		QKeySequence seq = m_settings->value ("shortcut_" + act->objectName(), act->shortcut()).value<QKeySequence>();
-		act->setShortcut (seq);
+		QKeySequence seq = m_settings->value("shortcut_" + act->objectName(), act->shortcut()).value<QKeySequence>();
+		act->setShortcut(seq);
 	}
 }
 
@@ -1105,25 +1105,25 @@
 //
 void MainWindow::saveShortcuts()
 {
-	applyToActions ([&](QAction* act)
+	applyToActions([&](QAction* act)
 	{
 		QString const key = "shortcut_" + act->objectName();
 
 		if (m_defaultShortcuts[act] != act->shortcut())
-			m_settings->setValue (key, act->shortcut());
+			m_settings->setValue(key, act->shortcut());
 		else
-			m_settings->remove (key);
+			m_settings->remove(key);
 	});
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void MainWindow::applyToActions (std::function<void(QAction*)> function)
+void MainWindow::applyToActions(std::function<void(QAction*)> function)
 {
 	for (QAction* act : findChildren<QAction*>())
 	{
 		if (not act->objectName().isEmpty())
-			function (act);
+			function(act);
 	}
 }
 
@@ -1136,7 +1136,7 @@
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-QKeySequence MainWindow::defaultShortcut (QAction* act)
+QKeySequence MainWindow::defaultShortcut(QAction* act)
 {
 	return m_defaultShortcuts[act];
 }
@@ -1157,17 +1157,17 @@
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void MainWindow::ringToolHiResClicked (bool checked)
+void MainWindow::ringToolHiResClicked(bool checked)
 {
 	if (checked)
 	{
-		ui.ringToolSegments->setMaximum (HighResolution);
-		ui.ringToolSegments->setValue (ui.ringToolSegments->value() * 3);
+		ui.ringToolSegments->setMaximum(HighResolution);
+		ui.ringToolSegments->setValue(ui.ringToolSegments->value() * 3);
 	}
 	else
 	{
-		ui.ringToolSegments->setValue (ui.ringToolSegments->value() / 3);
-		ui.ringToolSegments->setMaximum (LowResolution);
+		ui.ringToolSegments->setValue(ui.ringToolSegments->value() / 3);
+		ui.ringToolSegments->setMaximum(LowResolution);
 	}
 }
 
@@ -1175,20 +1175,20 @@
 //
 void MainWindow::circleToolSegmentsChanged()
 {
-	int numerator (ui.ringToolSegments->value());
-	int denominator (ui.ringToolHiRes->isChecked() ? HighResolution : LowResolution);
-	Simplify (numerator, denominator);
-	ui.ringToolSegmentsLabel->setText (format ("%1 / %2", numerator, denominator));
+	int numerator(ui.ringToolSegments->value());
+	int denominator(ui.ringToolHiRes->isChecked() ? HighResolution : LowResolution);
+	Simplify(numerator, denominator);
+	ui.ringToolSegmentsLabel->setText(format("%1 / %2", numerator, denominator));
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
 // Accessor to the settings object
 //
-QSettings* makeSettings (QObject* parent)
+QSettings* makeSettings(QObject* parent)
 {
 	QString path = qApp->applicationDirPath() + "/" UNIXNAME ".ini";
-	return new QSettings (path, QSettings::IniFormat, parent);
+	return new QSettings(path, QSettings::IniFormat, parent);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -1200,9 +1200,9 @@
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-QVariant MainWindow::getConfigValue (QString name)
+QVariant MainWindow::getConfigValue(QString name)
 {
-	QVariant value = m_settings->value (name, config.defaultValueByName (name));
+	QVariant value = m_settings->value(name, config.defaultValueByName(name));
 	return value;
 }
 
@@ -1212,8 +1212,8 @@
 {
 	// Create a new anonymous file and set it to our current
 	LDDocument* f = newDocument();
-	f->setName ("");
-	changeDocument (f);
+	f->setName("");
+	changeDocument(f);
 	closeInitialDocument();
 	doFullRefresh();
 	updateActions();
@@ -1221,12 +1221,12 @@
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-LDDocument* MainWindow::newDocument (bool cache)
+LDDocument* MainWindow::newDocument(bool cache)
 {
 	LDDocument* document = m_documents->createNew();
-	connect (document->history(), SIGNAL (undone()), this, SLOT (historyTraversed()));
-	connect (document->history(), SIGNAL (redone()), this, SLOT (historyTraversed()));
-	connect (document->history(), SIGNAL (stepAdded()), this, SLOT (updateActions()));
+	connect(document->history(), SIGNAL(undone()), this, SLOT(historyTraversed()));
+	connect(document->history(), SIGNAL(redone()), this, SLOT(historyTraversed()));
+	connect(document->history(), SIGNAL(stepAdded()), this, SLOT(updateActions()));
 
 	if (not cache)
 		document->openForEditing();
@@ -1245,7 +1245,7 @@
 //
 // TODO: document may be null, this shouldn't be the case
 //
-void MainWindow::changeDocument (LDDocument* document)
+void MainWindow::changeDocument(LDDocument* document)
 {
 	// Implicit files were loaded for caching purposes and may never be switched to.
 	if (document and document->isCache())
@@ -1256,12 +1256,12 @@
 	if (document)
 	{
 		// A ton of stuff needs to be updated
-		updateDocumentListItem (document);
+		updateDocumentListItem(document);
 		buildObjectList();
 		updateTitle();
-		m_renderer->setDocument (document);
+		m_renderer->setDocument(document);
 		m_renderer->compiler()->needMerge();
-		print ("Changed document to %1", document->getDisplayName());
+		print("Changed document to %1", document->getDisplayName());
 	}
 }
 
@@ -1300,7 +1300,7 @@
 	{
 		if (doc != old and not doc->isCache())
 		{
-			changeDocument (doc);
+			changeDocument(doc);
 			break;
 		}
 	}
@@ -1324,13 +1324,13 @@
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-ColorToolbarItem::ColorToolbarItem (LDColor color, QToolButton* toolButton) :
-	m_color (color),
-	m_toolButton (toolButton) {}
+ColorToolbarItem::ColorToolbarItem(LDColor color, QToolButton* toolButton) :
+	m_color(color),
+	m_toolButton(toolButton) {}
 
 ColorToolbarItem ColorToolbarItem::makeSeparator()
 {
-	return ColorToolbarItem (LDColor::nullColor(), nullptr);
+	return ColorToolbarItem(LDColor::nullColor(), nullptr);
 }
 
 bool ColorToolbarItem::isSeparator() const
@@ -1343,7 +1343,7 @@
 	return m_color;
 }
 
-void ColorToolbarItem::setColor (LDColor color)
+void ColorToolbarItem::setColor(LDColor color)
 {
 	m_color = color;
 }
@@ -1353,46 +1353,46 @@
 	return m_toolButton;
 }
 
-void ColorToolbarItem::setToolButton (QToolButton* value)
+void ColorToolbarItem::setToolButton(QToolButton* value)
 {
 	m_toolButton = value;
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void populatePrimitivesTree (QTreeWidget* tw, QString const& selectByDefault)
+void populatePrimitivesTree(QTreeWidget* tw, QString const& selectByDefault)
 {
 	tw->clear();
 
 	for (PrimitiveCategory* cat : g_PrimitiveCategories)
 	{
-		PrimitiveTreeItem* parentItem = new PrimitiveTreeItem (tw, nullptr);
-		parentItem->setText (0, cat->name());
+		PrimitiveTreeItem* parentItem = new PrimitiveTreeItem(tw, nullptr);
+		parentItem->setText(0, cat->name());
 		QList<QTreeWidgetItem*> subfileItems;
 
 		for (Primitive& prim : cat->prims)
 		{
-			PrimitiveTreeItem* item = new PrimitiveTreeItem (parentItem, &prim);
-			item->setText (0, format ("%1 - %2", prim.name, prim.title));
+			PrimitiveTreeItem* item = new PrimitiveTreeItem(parentItem, &prim);
+			item->setText(0, format("%1 - %2", prim.name, prim.title));
 			subfileItems << item;
 
 			// If this primitive is the one the current object points to,
 			// select it by default
 			if (selectByDefault == prim.name)
-				tw->setCurrentItem (item);
+				tw->setCurrentItem(item);
 		}
 
-		tw->addTopLevelItem (parentItem);
+		tw->addTopLevelItem(parentItem);
 	}
 }
 
-PrimitiveTreeItem::PrimitiveTreeItem (QTreeWidgetItem* parent, Primitive* info) :
-	QTreeWidgetItem (parent),
-	m_primitive (info) {}
+PrimitiveTreeItem::PrimitiveTreeItem(QTreeWidgetItem* parent, Primitive* info) :
+	QTreeWidgetItem(parent),
+	m_primitive(info) {}
 
-PrimitiveTreeItem::PrimitiveTreeItem (QTreeWidget* parent, Primitive* info) :
-	QTreeWidgetItem (parent),
-	m_primitive (info) {}
+PrimitiveTreeItem::PrimitiveTreeItem(QTreeWidget* parent, Primitive* info) :
+	QTreeWidgetItem(parent),
+	m_primitive(info) {}
 
 Primitive* PrimitiveTreeItem::primitive() const
 {
--- a/src/mainwindow.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/mainwindow.h	Thu Jan 04 19:44:26 2018 +0200
@@ -41,11 +41,11 @@
 class ColorToolbarItem
 {
 public:
-	ColorToolbarItem (LDColor color, QToolButton* toolButton);
+	ColorToolbarItem(LDColor color, QToolButton* toolButton);
 	LDColor color() const;
 	bool isSeparator() const;
-	void setColor (LDColor color);
-	void setToolButton (QToolButton* value);
+	void setColor(LDColor color);
+	void setToolButton(QToolButton* value);
 	QToolButton* toolButton() const;
 
 	static ColorToolbarItem makeSeparator();
@@ -61,7 +61,7 @@
 	Q_OBJECT
 
 protected:
-	void contextMenuEvent (QContextMenuEvent* ev);
+	void contextMenuEvent(QContextMenuEvent* ev);
 };
 
 // LDForge's main GUI class.
@@ -70,48 +70,48 @@
 	Q_OBJECT
 
 public:
-	explicit MainWindow (QWidget* parent = nullptr, Qt::WindowFlags flags = 0);
+	explicit MainWindow(QWidget* parent = nullptr, Qt::WindowFlags flags = 0);
 	~MainWindow();
 
-	void addMessage (QString msg);
-	void applyToActions (std::function<void(QAction*)> function);
+	void addMessage(QString msg);
+	void applyToActions(std::function<void(QAction*)> function);
 	void buildObjectList();
-	void changeDocument (LDDocument* f);
+	void changeDocument(LDDocument* f);
 	void closeInitialDocument();
 	void createBlankDocument();
 	LDDocument* currentDocument();
 	void currentDocumentClosed();
-	QKeySequence defaultShortcut (QAction* act);
-	void deleteByColor (LDColor color);
+	QKeySequence defaultShortcut(QAction* act);
+	void deleteByColor(LDColor color);
 	int deleteSelection();
 	DocumentManager* documents() { return m_documents; }
 	void doFullRefresh();
 	void endAction();
 	class ExtProgramToolset* externalPrograms();
-	QVariant getConfigValue (QString name);
+	QVariant getConfigValue(QString name);
 	QTreeWidget* getPrimitivesTree() const;
 	class QSettings* getSettings() { return m_settings; }
 	LDColor getUniformSelectedColor();
 	class GuiUtilities* guiUtilities();
 	void loadShortcuts();
-	LDDocument* newDocument (bool cache = false);
+	LDDocument* newDocument(bool cache = false);
 	GLRenderer* renderer();
 	void refresh();
 	void refreshObjectList();
 	bool ringToolHiRes() const;
 	int ringToolSegments() const;
-	bool save (LDDocument* doc, bool saveAs);
+	bool save(LDDocument* doc, bool saveAs);
 	void saveShortcuts();
 	void scrollToSelection();
 	const LDObjectList& selectedObjects();
-	void setQuickColors (const QList<ColorToolbarItem>& colors);
-	void spawnContextMenu (const QPoint pos);
+	void setQuickColors(const QList<ColorToolbarItem>& colors);
+	void spawnContextMenu(const QPoint pos);
 	int suggestInsertPoint();
 	void syncSettings();
 	Q_SLOT void updateActions();
 	void updateColorToolbar();
 	void updateDocumentList();
-	void updateDocumentListItem (LDDocument* doc);
+	void updateDocumentListItem(LDDocument* doc);
 	void updateEditModeActions();
 	void updateGridToolBar();
 	void updateRecentFilesMenu();
@@ -121,14 +121,14 @@
 public slots:
 	void actionTriggered();
 	void circleToolSegmentsChanged();
-	void closeTab (int tabindex);
+	void closeTab(int tabindex);
 	void historyTraversed();
-	void ringToolHiResClicked (bool clicked);
+	void ringToolHiResClicked(bool clicked);
 	void tabSelected();
 	void updatePrimitives();
 
 protected:
-	void closeEvent (QCloseEvent* ev);
+	void closeEvent(QCloseEvent* ev);
 
 private:
 	struct ToolInfo { QMetaMethod method; Toolset* object; };
@@ -157,7 +157,7 @@
 	void recentFileClicked();
 	void quickColorClicked();
 	void doLastSecondCleanup();
-	void objectListDoubleClicked (QListWidgetItem* listitem);
+	void objectListDoubleClicked(QListWidgetItem* listitem);
 };
 
 // Pointer to the instance of MainWindow.
@@ -165,26 +165,26 @@
 extern MainWindow* g_win;
 
 // Get an icon by name from the resources directory.
-QPixmap GetIcon (QString iconName);
+QPixmap GetIcon(QString iconName);
 
 // Returns a list of quick colors based on the configuration entry.
 QList<ColorToolbarItem> LoadQuickColorList();
 
 // Asks the user a yes/no question with the given message and the given window title.
 // Returns true if the user answered yes, false if no.
-bool Confirm (const QString& title, const QString& message); // Generic confirm prompt
+bool Confirm(const QString& title, const QString& message); // Generic confirm prompt
 
 // An overload of confirm(), this asks the user a yes/no question with the given message.
 // Returns true if the user answered yes, false if no.
-bool Confirm (const QString& message);
+bool Confirm(const QString& message);
 
 // Displays an error prompt with the given message
-void Critical (const QString& message);
+void Critical(const QString& message);
 
 // Takes in pairs of radio buttons and respective values and finds the first selected one.
 // Returns returns the value of the first found radio button that was checked by the user.
 template<class T>
-T RadioSwitch (const T& defval, QList<Pair<QRadioButton*, T>> haystack)
+T RadioSwitch(const T& defval, QList<Pair<QRadioButton*, T>> haystack)
 {
 	for (Pair<QRadioButton*, const T&> i : haystack)
 	{
@@ -198,13 +198,13 @@
 // Takes in pairs of radio buttons and respective values and checks the first found radio button whose respsective value
 // matches expr have the given value.
 template<class T>
-void RadioDefault (const T& expr, QList<Pair<QRadioButton*, T>> haystack)
+void RadioDefault(const T& expr, QList<Pair<QRadioButton*, T>> haystack)
 {
 	for (Pair<QRadioButton*, const T&> i : haystack)
 	{
 		if (i.second == expr)
 		{
-			i.first->setChecked (true);
+			i.first->setChecked(true);
 			return;
 		}
 	}
@@ -213,13 +213,13 @@
 class PrimitiveTreeItem : public QTreeWidgetItem
 {
 public:
-	PrimitiveTreeItem (QTreeWidgetItem* parent, Primitive* info);
-	PrimitiveTreeItem (QTreeWidget* parent, Primitive* info);
+	PrimitiveTreeItem(QTreeWidgetItem* parent, Primitive* info);
+	PrimitiveTreeItem(QTreeWidget* parent, Primitive* info);
 	Primitive* primitive() const;
 
 private:
 	Primitive* m_primitive;
 };
 
-void populatePrimitivesTree (QTreeWidget* tw, const QString& selectByDefault = QString());
-QSettings* makeSettings (QObject* parent = nullptr);
+void populatePrimitivesTree(QTreeWidget* tw, const QString& selectByDefault = QString());
+QSettings* makeSettings(QObject* parent = nullptr);
--- a/src/mainwindow.ui	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/mainwindow.ui	Thu Jan 04 19:44:26 2018 +0200
@@ -1625,7 +1625,7 @@
     <string>Draw s&amp;urfaces</string>
    </property>
    <property name="toolTip">
-    <string>Render surfaces (i.e. quads and triangles) on the viewport.</string>
+    <string>Render surfaces(i.e. quads and triangles) on the viewport.</string>
    </property>
   </action>
   <action name="actionDrawEdgeLines">
--- a/src/messageLog.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/messageLog.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -31,28 +31,28 @@
 
 // -------------------------------------------------------------------------------------------------
 //
-MessageManager::MessageManager (QObject* parent) :
-	QObject (parent)
+MessageManager::MessageManager(QObject* parent) :
+	QObject(parent)
 {
 	m_ticker = new QTimer;
-	m_ticker->start (100);
-	connect (m_ticker, SIGNAL (timeout()), this, SLOT (tick()));
+	m_ticker->start(100);
+	connect(m_ticker, SIGNAL(timeout()), this, SLOT(tick()));
 }
 
 // -------------------------------------------------------------------------------------------------
 //
-MessageManager::Line::Line (QString text) :
-	text (text),
-	alpha (1.0f),
-	expiry (QDateTime::currentDateTime().addMSecs (ExpireTime)) {}
+MessageManager::Line::Line(QString text) :
+	text(text),
+	alpha(1.0f),
+	expiry(QDateTime::currentDateTime().addMSecs(ExpireTime)) {}
 
 // -------------------------------------------------------------------------------------------------
 //
-bool MessageManager::Line::update (bool& changed)
+bool MessageManager::Line::update(bool& changed)
 {
 	changed = false;
 	QDateTime now = QDateTime::currentDateTime();
-	int msec = now.msecsTo (expiry);
+	int msec = now.msecsTo(expiry);
 
 	if (now >= expiry)
 	{
@@ -64,7 +64,7 @@
 	if (msec <= FadeTime)
 	{
 		// Message line has not expired but is fading out
-		alpha = ( (float) msec) / FadeTime;
+		alpha = ((float) msec) / FadeTime;
 		changed = true;
 	}
 
@@ -75,13 +75,13 @@
 //
 //	Add a line to the message manager.
 //
-void MessageManager::addLine (QString line)
+void MessageManager::addLine(QString line)
 {
 	// If there's too many entries, pop the excess out
 	while (m_lines.size() >= MaxMessages)
 		m_lines.removeFirst();
 
-	m_lines << Line (line);
+	m_lines << Line(line);
 
 	// Update the renderer view
 	if (renderer())
@@ -104,8 +104,8 @@
 	{
 		bool lineChanged;
 
-		if (not m_lines[i].update (lineChanged))
-			m_lines.removeAt (i--);
+		if (not m_lines[i].update(lineChanged))
+			m_lines.removeAt(i--);
 
 		changed |= lineChanged;
 	}
@@ -126,21 +126,21 @@
 	return m_renderer;
 }
 
-void MessageManager::setRenderer (GLRenderer* renderer)
+void MessageManager::setRenderer(GLRenderer* renderer)
 {
 	m_renderer = renderer;
 }
 
 // =============================================================================
 //
-void printToLog (const QString& msg)
+void printToLog(const QString& msg)
 {
-	for (QString& a : msg.split ("\n", QString::SkipEmptyParts))
+	for (QString& a : msg.split("\n", QString::SkipEmptyParts))
 	{
 		if (g_win)
-			g_win->addMessage (a);
+			g_win->addMessage(a);
 
 		// Also print it to stdout
-		fprint (stdout, "%1\n", a);
+		fprint(stdout, "%1\n", a);
 	}
 }
--- a/src/messageLog.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/messageLog.h	Thu Jan 04 19:44:26 2018 +0200
@@ -46,7 +46,7 @@
 	{
 	public:
 		// Constructs a line with the given \c text
-		Line (QString text);
+		Line(QString text);
 
 		// Check this line's expiry and update alpha accordingly. @changed
 		// is updated to whether the line has somehow changed since the
@@ -54,7 +54,7 @@
 		//
 		// Returns true if the line is to still stick around, false if it
 		// expired.
-		bool update (bool& changed);
+		bool update(bool& changed);
 
 		QString text;
 		float alpha;
@@ -62,16 +62,16 @@
 	};
 
 	// Constructs the message manager.
-	explicit MessageManager (QObject* parent = nullptr);
+	explicit MessageManager(QObject* parent = nullptr);
 
 	// Adds a line with the given \c text to the message manager.
-	void addLine (QString line);
+	void addLine(QString line);
 
 	// Returns all active lines in the message manager.
 	const QList<Line>& getLines() const;
 
 	GLRenderer* renderer() const;
-	void setRenderer (GLRenderer* renderer);
+	void setRenderer(GLRenderer* renderer);
 
 private:
 	QList<Line> m_lines;
--- a/src/miscallenous.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/miscallenous.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -85,22 +85,22 @@
 //
 // Grid stuff
 //
-ConfigOption (int Grid = 1)
-ConfigOption (float GridCoarseCoordinateSnap = 5.0f)
-ConfigOption (float GridCoarseAngleSnap = 45.0f)
-ConfigOption (float GridCoarseBezierCurveSegments = 8)
-ConfigOption (float GridMediumCoordinateSnap = 1.0f)
-ConfigOption (float GridMediumAngleSnap = 22.5f)
-ConfigOption (float GridMediumBezierCurveSegments = 16)
-ConfigOption (float GridFineCoordinateSnap = 0.1f)
-ConfigOption (float GridFineAngleSnap = 7.5f)
-ConfigOption (float GridFineBezierCurveSegments = 32)
-ConfigOption (int RotationPointType = 0)
-ConfigOption (Vertex CustomRotationPoint = Origin)
+ConfigOption(int Grid = 1)
+ConfigOption(float GridCoarseCoordinateSnap = 5.0f)
+ConfigOption(float GridCoarseAngleSnap = 45.0f)
+ConfigOption(float GridCoarseBezierCurveSegments = 8)
+ConfigOption(float GridMediumCoordinateSnap = 1.0f)
+ConfigOption(float GridMediumAngleSnap = 22.5f)
+ConfigOption(float GridMediumBezierCurveSegments = 16)
+ConfigOption(float GridFineCoordinateSnap = 0.1f)
+ConfigOption(float GridFineAngleSnap = 7.5f)
+ConfigOption(float GridFineBezierCurveSegments = 32)
+ConfigOption(int RotationPointType = 0)
+ConfigOption(Vertex CustomRotationPoint = Origin)
 
 float gridCoordinateSnap()
 {
-	switch (config.grid())
+	switch(config.grid())
 	{
 	case Grid::Coarse: return config.gridCoarseCoordinateSnap();
 	case Grid::Medium: return config.gridMediumCoordinateSnap();
@@ -112,7 +112,7 @@
 
 float gridAngleSnap()
 {
-	switch (config.grid())
+	switch(config.grid())
 	{
 	case Grid::Coarse: return config.gridCoarseAngleSnap();
 	case Grid::Medium: return config.gridMediumAngleSnap();
@@ -124,7 +124,7 @@
 
 float gridBezierCurveSegments()
 {
-	switch (config.grid())
+	switch(config.grid())
 	{
 	default:
 	case Grid::Coarse: return config.gridCoarseBezierCurveSegments();
@@ -137,13 +137,13 @@
 //
 // Snap the given coordinate value on the current grid's given axis.
 //
-double Grid::Snap (double value, const Grid::Config type)
+double Grid::Snap(double value, const Grid::Config type)
 {
 	double snapvalue = (type == Coordinate) ? gridCoordinateSnap() : gridAngleSnap();
-	double mult = floor (qAbs<double> (value / snapvalue));
+	double mult = floor(qAbs<double>(value / snapvalue));
 	double out = mult * snapvalue;
 
-	if (qAbs (value) - (mult * snapvalue) > snapvalue / 2)
+	if (qAbs(value) -(mult * snapvalue) > snapvalue / 2)
 		out += snapvalue;
 
 	if (value < 0)
@@ -154,7 +154,7 @@
 
 // =============================================================================
 //
-void Simplify (int& numer, int& denom)
+void Simplify(int& numer, int& denom)
 {
 	bool repeat;
 
@@ -162,14 +162,14 @@
 	{
 		repeat = false;
 
-		for (int x = 0; x < countof (PrimeNumbers); x++)
+		for (int x = 0; x < countof(PrimeNumbers); x++)
 		{
 			int const prime = PrimeNumbers[x];
 
 			if (numer < prime and denom < prime)
 				break;
 
-			if ((numer % prime == 0) and (denom % prime == 0))
+			if ((numer % prime == 0) and(denom % prime == 0))
 			{
 				numer /= prime;
 				denom /= prime;
@@ -182,9 +182,9 @@
 
 // =============================================================================
 //
-Vertex GetRotationPoint (const LDObjectList& objs)
+Vertex GetRotationPoint(const LDObjectList& objs)
 {
-	switch (RotationPoint (config.rotationPointType()))
+	switch(RotationPoint(config.rotationPointType()))
 	{
 	case RotationPoint::ObjectOrigin:
 		{
@@ -194,7 +194,7 @@
 			for (LDObject* obj : objs)
 			{
 				if (obj->hasMatrix())
-					box << static_cast<LDMatrixObject*> (obj)->position();
+					box << static_cast<LDMatrixObject*>(obj)->position();
 				else
 					box << obj;
 			}
@@ -221,20 +221,20 @@
 {
 	QDialog* dlg = new QDialog;
 	Ui::RotPointUI ui;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
-	switch (RotationPoint (config.rotationPointType()))
+	switch(RotationPoint(config.rotationPointType()))
 	{
 	case RotationPoint::ObjectOrigin:
-		ui.objectPoint->setChecked (true);
+		ui.objectPoint->setChecked(true);
 		break;
 
 	case RotationPoint::WorldOrigin:
-		ui.worldPoint->setChecked (true);
+		ui.worldPoint->setChecked(true);
 		break;
 
 	case RotationPoint::CustomPoint:
-		ui.customPoint->setChecked (true);
+		ui.customPoint->setChecked(true);
 		break;
 
 	case RotationPoint::NumValues:
@@ -242,39 +242,39 @@
 	}
 
 	Vertex custompoint = config.customRotationPoint();
-	ui.customX->setValue (custompoint.x());
-	ui.customY->setValue (custompoint.y());
-	ui.customZ->setValue (custompoint.z());
+	ui.customX->setValue(custompoint.x());
+	ui.customY->setValue(custompoint.y());
+	ui.customZ->setValue(custompoint.z());
 
 	if (not dlg->exec())
 		return;
 
-	config.setRotationPointType (int (
+	config.setRotationPointType(int(
 		(ui.objectPoint->isChecked()) ? RotationPoint::ObjectOrigin :
 		(ui.worldPoint->isChecked())  ? RotationPoint::WorldOrigin :
 		RotationPoint::CustomPoint));
 
-	custompoint.setX (ui.customX->value());
-	custompoint.setY (ui.customY->value());
-	custompoint.setZ (ui.customZ->value());
-	config.setCustomRotationPoint (custompoint);
+	custompoint.setX(ui.customX->value());
+	custompoint.setY(ui.customY->value());
+	custompoint.setZ(ui.customZ->value());
+	config.setCustomRotationPoint(custompoint);
 }
 
 // =============================================================================
 //
-QString Join (QList<StringFormatArg> vals, QString delim)
+QString Join(QList<StringFormatArg> vals, QString delim)
 {
 	QStringList list;
 
 	for (const StringFormatArg& arg : vals)
 		list << arg.text();
 
-	return list.join (delim);
+	return list.join(delim);
 }
 
 // =============================================================================
 //
-void RoundToDecimals (double& a, int decimals)
+void RoundToDecimals(double& a, int decimals)
 {
 	static const long e10[] =
 	{
@@ -290,31 +290,31 @@
 		1000000000l,
 	};
 
-	if (decimals >= 0 and decimals < countof (e10))
-		a = round (a * e10[decimals]) / e10[decimals];
+	if (decimals >= 0 and decimals < countof(e10))
+		a = round(a * e10[decimals]) / e10[decimals];
 }
 
 // =============================================================================
 //
-void ApplyToMatrix (Matrix& a, ApplyToMatrixFunction func)
+void ApplyToMatrix(Matrix& a, ApplyToMatrixFunction func)
 {
 	for (int i = 0; i < 9; ++i)
-		func (i, a[i]);
+		func(i, a[i]);
 }
 
 // =============================================================================
 //
-void ApplyToMatrix (const Matrix& a, ApplyToMatrixConstFunction func)
+void ApplyToMatrix(const Matrix& a, ApplyToMatrixConstFunction func)
 {
 	for (int i = 0; i < 9; ++i)
-		func (i, a[i]);
+		func(i, a[i]);
 }
 
 // =============================================================================
 //
-double GetCoordinateOf (const Vertex& a, Axis ax)
+double GetCoordinateOf(const Vertex& a, Axis ax)
 {
-	switch (ax)
+	switch(ax)
 	{
 		case X: return a.x();
 		case Y: return a.y();
@@ -327,14 +327,14 @@
 
 // =============================================================================
 //
-QString MakePrettyFileSize (qint64 size)
+QString MakePrettyFileSize(qint64 size)
 {
 	if (size < 1024LL)
-		return QString::number (size) + " bytes";
-	else if (size < (1024LL * 1024LL))
-		return QString::number (double (size) / 1024LL, 'f', 1) + " Kb";
-	else if (size < (1024LL * 1024LL * 1024LL))
-		return QString::number (double (size) / (1024LL * 1024LL), 'f', 1) + " Mb";
+		return QString::number(size) + " bytes";
+	else if (size <(1024LL * 1024LL))
+		return QString::number(double(size) / 1024LL, 'f', 1) + " Kb";
+	else if (size <(1024LL * 1024LL * 1024LL))
+		return QString::number(double(size) /(1024LL * 1024LL), 'f', 1) + " Mb";
 	else
-		return QString::number (double (size) / (1024LL * 1024LL * 1024LL), 'f', 1) + " Gb";
+		return QString::number(double(size) /(1024LL * 1024LL * 1024LL), 'f', 1) + " Gb";
 }
--- a/src/miscallenous.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/miscallenous.h	Thu Jan 04 19:44:26 2018 +0200
@@ -27,19 +27,19 @@
 class QAction;
 
 // Simplifies the given fraction.
-void Simplify (int& numer, int& denom);
+void Simplify(int& numer, int& denom);
 
-using ApplyToMatrixFunction = std::function<void (int, double&)>;
-using ApplyToMatrixConstFunction = std::function<void (int, double)>;
+using ApplyToMatrixFunction = std::function<void(int, double&)>;
+using ApplyToMatrixConstFunction = std::function<void(int, double)>;
 
-void RoundToDecimals (double& a, int decimals);
-void ApplyToMatrix (Matrix& a, ApplyToMatrixFunction func);
-void ApplyToMatrix (const Matrix& a, ApplyToMatrixConstFunction func);
+void RoundToDecimals(double& a, int decimals);
+void ApplyToMatrix(Matrix& a, ApplyToMatrixFunction func);
+void ApplyToMatrix(const Matrix& a, ApplyToMatrixConstFunction func);
 
-double GetCoordinateOf (const Vertex& a, Axis ax);
-QString MakePrettyFileSize (qint64 size);
+double GetCoordinateOf(const Vertex& a, Axis ax);
+QString MakePrettyFileSize(qint64 size);
 
-QString Join (QList<StringFormatArg> vals, QString delim = " ");
+QString Join(QList<StringFormatArg> vals, QString delim = " ");
 
 // Grid stuff
 float gridCoordinateSnap();
@@ -55,7 +55,7 @@
 	NumValues
 };
 
-Vertex GetRotationPoint (const LDObjectList& objs);
+Vertex GetRotationPoint(const LDObjectList& objs);
 void ConfigureRotationPoint();
 
 // =============================================================================
@@ -74,5 +74,5 @@
 		Angle
 	};
 
-	double Snap (double value, const Grid::Config type);
+	double Snap(double value, const Grid::Config type);
 }
--- a/src/partdownloader.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/partdownloader.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -30,31 +30,31 @@
 #include "glRenderer.h"
 #include "documentmanager.h"
 
-ConfigOption (QString DownloadFilePath)
-ConfigOption (bool GuessDownloadPaths = true)
-ConfigOption (bool AutoCloseDownloadDialog = true)
+ConfigOption(QString DownloadFilePath)
+ConfigOption(bool GuessDownloadPaths = true)
+ConfigOption(bool AutoCloseDownloadDialog = true)
 
 const char* g_unofficialLibraryURL = "http://ldraw.org/library/unofficial/";
 
-PartDownloader::PartDownloader (QWidget* parent) :
-	QDialog (parent),
-	HierarchyElement (parent),
-	ui (*new Ui_PartDownloader),
-	m_source (SourceType (0))
+PartDownloader::PartDownloader(QWidget* parent) :
+	QDialog(parent),
+	HierarchyElement(parent),
+	ui(*new Ui_PartDownloader),
+	m_source(SourceType(0))
 {
-	ui.setupUi (this);
+	ui.setupUi(this);
 
 #ifdef USE_QT5
-	ui.progressTable->horizontalHeader()->setSectionResizeMode (QHeaderView::Stretch);
+	ui.progressTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
 #else
-	ui.progressTable->horizontalHeader()->setResizeMode (PartLabelColumn, QHeaderView::Stretch);
+	ui.progressTable->horizontalHeader()->setResizeMode(PartLabelColumn, QHeaderView::Stretch);
 #endif
 
-	m_downloadButton = new QPushButton (tr ("Download"));
-	ui.buttonBox->addButton (m_downloadButton, QDialogButtonBox::ActionRole);
-	button (Abort)->setEnabled (false);
-	connect (ui.source, SIGNAL (currentIndexChanged (int)), this, SLOT (sourceChanged (int)));
-	connect (ui.buttonBox, SIGNAL (clicked (QAbstractButton*)), this, SLOT (buttonClicked (QAbstractButton*)));
+	m_downloadButton = new QPushButton(tr("Download"));
+	ui.buttonBox->addButton(m_downloadButton, QDialogButtonBox::ActionRole);
+	button(Abort)->setEnabled(false);
+	connect(ui.source, SIGNAL(currentIndexChanged(int)), this, SLOT(sourceChanged(int)));
+	connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
 }
 
 PartDownloader::~PartDownloader()
@@ -66,15 +66,15 @@
 {
 	QString path = downloadPath();
 
-	if (path.isEmpty() or not QDir (path).exists())
+	if (path.isEmpty() or not QDir(path).exists())
 	{
 		QMessageBox::information(this, "Notice", "Please input a path for files to download.");
-		path = QFileDialog::getExistingDirectory (this, "Path for downloaded files:");
+		path = QFileDialog::getExistingDirectory(this, "Path for downloaded files:");
 
 		if (path.isEmpty())
 			reject();
 		else
-			config.setDownloadFilePath (path);
+			config.setDownloadFilePath(path);
 	}
 }
 
@@ -82,12 +82,12 @@
 {
 	QString destination;
 
-	switch (sourceType())
+	switch(sourceType())
 	{
 	case PartsTracker:
 		destination = ui.filename->text();
-		modifyDestination (destination);
-		ui.filename->setText (destination);
+		modifyDestination(destination);
+		ui.filename->setText(destination);
 		return g_unofficialLibraryURL + destination;
 
 	case CustomURL:
@@ -98,7 +98,7 @@
 	return "";
 }
 
-void PartDownloader::modifyDestination (QString& dest) const
+void PartDownloader::modifyDestination(QString& dest) const
 {
 	dest = dest.simplified();
 
@@ -107,29 +107,29 @@
 		return;
 
 	// Ensure .dat extension
-	if (dest.right (4) != ".dat")
+	if (dest.right(4) != ".dat")
 	{
 		// Remove the existing extension, if any. It may be we're here over a
 		// typo in the .dat extension.
-		const int dotpos = dest.lastIndexOf (".");
+		const int dotpos = dest.lastIndexOf(".");
 
-		if ((dotpos != -1) and (dotpos >= dest.length() - 4))
-			dest.chop (dest.length() - dotpos);
+		if ((dotpos != -1) and(dotpos >= dest.length() - 4))
+			dest.chop(dest.length() - dotpos);
 
 		dest += ".dat";
 	}
 
 	// If the part starts with s\ or s/, then use parts/s/. Same goes with
 	// 48\ and p/48/.
-	if (isOneOf (dest.left (2), "s\\", "s/"))
+	if (isOneOf(dest.left(2), "s\\", "s/"))
 	{
-		dest.remove (0, 2);
-		dest.prepend ("parts/s/");
+		dest.remove(0, 2);
+		dest.prepend("parts/s/");
 	}
-	else if (isOneOf (dest.left (3), "48\\", "48/"))
+	else if (isOneOf(dest.left(3), "48\\", "48/"))
 	{
-		dest.remove (0, 3);
-		dest.prepend ("p/48/");
+		dest.remove(0, 3);
+		dest.prepend("p/48/");
 	}
 
 	/* Try determine where to put this part. We have four directories:
@@ -137,12 +137,12 @@
 	   either parts/ or p/, we need to add it automatically. Part files
 	   are numbers wit a possible u prefix for parts with unknown number
 	   which can be followed by any of:
-	   - c** (composites)
-	   - d** (formed stickers)
-	   - p** (patterns)
+	   - c**(composites)
+	   - d**(formed stickers)
+	   - p**(patterns)
 	   - a lowercase alphabetic letter for variants
 
-	   Subfiles (usually) have an s** prefix, in which case we use parts/s/.
+	   Subfiles(usually) have an s** prefix, in which case we use parts/s/.
 	   Note that the regex starts with a '^' so it won't catch already fully
 	   given part file names. */
 	QString partRegex = "^u?[0-9]+(c[0-9][0-9]+)*(d[0-9][0-9]+)*[a-z]?(p[0-9a-z][0-9a-z]+)*";
@@ -151,12 +151,12 @@
 	partRegex += "\\.dat$";
 	subpartRegex += "\\.dat$";
 
-	if (QRegExp (subpartRegex).exactMatch (dest))
-		dest.prepend ("parts/s/");
-	else if (QRegExp (partRegex).exactMatch (dest))
-		dest.prepend ("parts/");
-	else if (not dest.startsWith ("parts/") and not dest.startsWith ("p/"))
-		dest.prepend ("p/");
+	if (QRegExp(subpartRegex).exactMatch(dest))
+		dest.prepend("parts/s/");
+	else if (QRegExp(partRegex).exactMatch(dest))
+		dest.prepend("parts/");
+	else if (not dest.startsWith("parts/") and not dest.startsWith("p/"))
+		dest.prepend("p/");
 }
 
 PartDownloader::SourceType PartDownloader::sourceType() const
@@ -164,86 +164,86 @@
 	return m_source;
 }
 
-void PartDownloader::setSourceType (SourceType src)
+void PartDownloader::setSourceType(SourceType src)
 {
 	m_source = src;
-	ui.source->setCurrentIndex (int (src));
+	ui.source->setCurrentIndex(int(src));
 }
 
-void PartDownloader::sourceChanged (int i)
+void PartDownloader::sourceChanged(int i)
 {
 	if (i == CustomURL)
-		ui.fileNameLabel->setText (tr ("URL:"));
+		ui.fileNameLabel->setText(tr("URL:"));
 	else
-		ui.fileNameLabel->setText (tr ("File name:"));
+		ui.fileNameLabel->setText(tr("File name:"));
 
-	m_source = SourceType (i);
+	m_source = SourceType(i);
 }
 
-void PartDownloader::buttonClicked (QAbstractButton* btn)
+void PartDownloader::buttonClicked(QAbstractButton* btn)
 {
-	if (btn == button (Close))
+	if (btn == button(Close))
 	{
 		reject();
 	}
-	else if (btn == button (Abort))
+	else if (btn == button(Abort))
 	{
 		m_isAborted = true;
 
 		for (PartDownloadRequest* req : m_requests)
 			req->abort();
 	}
-	else if (btn == button (Download))
+	else if (btn == button(Download))
 	{
 		QString dest = ui.filename->text();
-		setPrimaryFile (nullptr);
+		setPrimaryFile(nullptr);
 		m_isAborted = false;
 
 		if (sourceType() == CustomURL)
-			dest = Basename (url());
+			dest = Basename(url());
 
-		modifyDestination (dest);
+		modifyDestination(dest);
 
-		if (QFile::exists (downloadPath() + DIRSLASH + dest))
+		if (QFile::exists(downloadPath() + DIRSLASH + dest))
 		{
-			const QString overwritemsg = format (tr ("%1 already exists in download directory. Overwrite?"), dest);
-			if (not Confirm (tr ("Overwrite?"), overwritemsg))
+			const QString overwritemsg = format(tr("%1 already exists in download directory. Overwrite?"), dest);
+			if (not Confirm(tr("Overwrite?"), overwritemsg))
 				return;
 		}
 
-		downloadFile (dest, url(), true);
+		downloadFile(dest, url(), true);
 	}
 }
 
-void PartDownloader::downloadFile (QString dest, QString url, bool primary)
+void PartDownloader::downloadFile(QString dest, QString url, bool primary)
 {
 	int row = ui.progressTable->rowCount();
 
 	// Don't download files repeadetly.
-	if (m_filesToDownload.indexOf (dest) != -1)
+	if (m_filesToDownload.indexOf(dest) != -1)
 		return;
 
-	print ("Downloading %1 from %2\n", dest, url);
-	modifyDestination (dest);
-	PartDownloadRequest* req = new PartDownloadRequest (url, dest, primary, this);
+	print("Downloading %1 from %2\n", dest, url);
+	modifyDestination(dest);
+	PartDownloadRequest* req = new PartDownloadRequest(url, dest, primary, this);
 	m_filesToDownload << dest;
 	m_requests << req;
-	ui.progressTable->insertRow (row);
-	req->setTableRow (row);
+	ui.progressTable->insertRow(row);
+	req->setTableRow(row);
 	req->updateToTable();
-	m_downloadButton->setEnabled (false);
-	ui.progressTable->setEnabled (true);
-	ui.filename->setEnabled (false);
-	ui.source->setEnabled (false);
-	button (Close)->setEnabled (false);
-	button (Abort)->setEnabled (true);
-	button (Download)->setEnabled (false);
+	m_downloadButton->setEnabled(false);
+	ui.progressTable->setEnabled(true);
+	ui.filename->setEnabled(false);
+	ui.source->setEnabled(false);
+	button(Close)->setEnabled(false);
+	button(Abort)->setEnabled(true);
+	button(Download)->setEnabled(false);
 }
 
-void PartDownloader::downloadFromPartsTracker (QString file)
+void PartDownloader::downloadFromPartsTracker(QString file)
 {
-	modifyDestination (file);
-	downloadFile (file, g_unofficialLibraryURL + file, false);
+	modifyDestination(file);
+	downloadFile(file, g_unofficialLibraryURL + file, false);
 }
 
 void PartDownloader::checkIfFinished()
@@ -279,29 +279,29 @@
 	else
 	{
 		// Allow the prompt be closed now.
-		button (Abort)->setEnabled (false);
-		button (Close)->setEnabled (true);
+		button(Abort)->setEnabled(false);
+		button(Close)->setEnabled(true);
 	}
 }
 
-QPushButton* PartDownloader::button (PartDownloader::Button i)
+QPushButton* PartDownloader::button(PartDownloader::Button i)
 {
-	switch (i)
+	switch(i)
 	{
 		case Download:
 			return m_downloadButton;
 
 		case Abort:
-			return qobject_cast<QPushButton*> (ui.buttonBox->button (QDialogButtonBox::Abort));
+			return qobject_cast<QPushButton*>(ui.buttonBox->button(QDialogButtonBox::Abort));
 
 		case Close:
-			return qobject_cast<QPushButton*> (ui.buttonBox->button (QDialogButtonBox::Close));
+			return qobject_cast<QPushButton*>(ui.buttonBox->button(QDialogButtonBox::Close));
 	}
 
 	return nullptr;
 }
 
-void PartDownloader::addFile (LDDocument* f)
+void PartDownloader::addFile(LDDocument* f)
 {
 	m_files << f;
 }
@@ -316,7 +316,7 @@
 	return m_primaryFile;
 }
 
-void PartDownloader::setPrimaryFile (LDDocument* document)
+void PartDownloader::setPrimaryFile(LDDocument* document)
 {
 	m_primaryFile = document;
 }
@@ -326,7 +326,7 @@
 	QString path = config.downloadFilePath();
 
 	if (DIRSLASH[0] != '/')
-		path.replace (DIRSLASH, "/");
+		path.replace(DIRSLASH, "/");
 
 	return path;
 }
--- a/src/partdownloader.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/partdownloader.h	Thu Jan 04 19:44:26 2018 +0200
@@ -57,24 +57,24 @@
 
 	using RequestList = QList<PartDownloadRequest*>;
 
-	explicit PartDownloader (QWidget* parent = nullptr);
+	explicit PartDownloader(QWidget* parent = nullptr);
 	virtual ~PartDownloader();
 
-	void addFile (LDDocument* f);
-	QPushButton* button (Button i);
-	Q_SLOT void buttonClicked (QAbstractButton* btn);
+	void addFile(LDDocument* f);
+	QPushButton* button(Button i);
+	Q_SLOT void buttonClicked(QAbstractButton* btn);
 	Q_SLOT void checkIfFinished();
 	void checkValidPath();
-	void downloadFile (QString dest, QString url, bool primary);
-	void downloadFromPartsTracker (QString file);
+	void downloadFile(QString dest, QString url, bool primary);
+	void downloadFromPartsTracker(QString file);
 	QString downloadPath();
 	bool isAborted() const;
-	void modifyDestination (QString& dest) const;
+	void modifyDestination(QString& dest) const;
 	LDDocument* primaryFile() const;
 	class QTableWidget* progressTable() const;
-	void setPrimaryFile (LDDocument* document);
-	void setSourceType (SourceType src);
-	Q_SLOT void sourceChanged (int i);
+	void setPrimaryFile(LDDocument* document);
+	void setSourceType(SourceType src);
+	Q_SLOT void sourceChanged(int i);
 	SourceType sourceType() const;
 	QString url();
 
--- a/src/partdownloadrequest.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/partdownloadrequest.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -28,36 +28,36 @@
 #include "mainwindow.h"
 #include "documentmanager.h"
 
-PartDownloadRequest::PartDownloadRequest (QString url, QString dest, bool primary, PartDownloader* parent) :
-	QObject (parent),
-	HierarchyElement (parent),
-	m_state (State::Requesting),
-	m_prompt (parent),
-	m_url (url),
-	m_destination (dest),
-	m_filePath (parent->downloadPath() + DIRSLASH + dest),
-	m_networkManager (new QNetworkAccessManager),
-	m_isFirstUpdate (true),
-	m_isPrimary (primary),
-	m_filePointer (nullptr)
+PartDownloadRequest::PartDownloadRequest(QString url, QString dest, bool primary, PartDownloader* parent) :
+	QObject(parent),
+	HierarchyElement(parent),
+	m_state(State::Requesting),
+	m_prompt(parent),
+	m_url(url),
+	m_destination(dest),
+	m_filePath(parent->downloadPath() + DIRSLASH + dest),
+	m_networkManager(new QNetworkAccessManager),
+	m_isFirstUpdate(true),
+	m_isPrimary(primary),
+	m_filePointer(nullptr)
 {
 	// Make sure that we have a valid destination.
-	QString dirpath = Dirname (filePath());
-	QDir dir (dirpath);
+	QString dirpath = Dirname(filePath());
+	QDir dir(dirpath);
 
 	if (not dir.exists())
 	{
-		print ("Creating %1...\n", dirpath);
+		print("Creating %1...\n", dirpath);
 
-		if (not dir.mkpath (dirpath))
-			Critical (format (tr ("Couldn't create the directory %1!"), dirpath));
+		if (not dir.mkpath(dirpath))
+			Critical(format(tr("Couldn't create the directory %1!"), dirpath));
 	}
 
-	m_networkReply = m_networkManager->get (QNetworkRequest (QUrl (url)));
-	connect (networkReply(), SIGNAL (finished()), this, SLOT (downloadFinished()));
-	connect (networkReply(), SIGNAL (readyRead()), this, SLOT (readFromNetworkReply()));
-	connect (networkReply(), SIGNAL (downloadProgress (qint64, qint64)),
-		this, SLOT (updateDownloadProgress (qint64, qint64)));
+	m_networkReply = m_networkManager->get(QNetworkRequest(QUrl(url)));
+	connect(networkReply(), SIGNAL(finished()), this, SLOT(downloadFinished()));
+	connect(networkReply(), SIGNAL(readyRead()), this, SLOT(readFromNetworkReply()));
+	connect(networkReply(), SIGNAL(downloadProgress(qint64, qint64)),
+		this, SLOT(updateDownloadProgress(qint64, qint64)));
 }
 
 PartDownloadRequest::~PartDownloadRequest() {}
@@ -72,7 +72,7 @@
 	return m_tableRow;
 }
 
-void PartDownloadRequest::setTableRow (int value)
+void PartDownloadRequest::setTableRow(int value)
 {
 	m_tableRow = value;
 }
@@ -126,22 +126,22 @@
 {
 	QTableWidget* table = prompt()->progressTable();
 
-	switch (m_state)
+	switch(m_state)
 	{
 	case State::Requesting:
 	case State::Downloading:
 		{
-			QWidget* cellwidget = table->cellWidget (tableRow(), PartDownloader::ProgressColumn);
-			QProgressBar* progressBar = qobject_cast<QProgressBar*> (cellwidget);
+			QWidget* cellwidget = table->cellWidget(tableRow(), PartDownloader::ProgressColumn);
+			QProgressBar* progressBar = qobject_cast<QProgressBar*>(cellwidget);
 
 			if (not progressBar)
 			{
 				progressBar = new QProgressBar;
-				table->setCellWidget (tableRow(), PartDownloader::ProgressColumn, progressBar);
+				table->setCellWidget(tableRow(), PartDownloader::ProgressColumn, progressBar);
 			}
 
-			progressBar->setRange (0, numBytesTotal());
-			progressBar->setValue (numBytesRead());
+			progressBar->setRange(0, numBytesTotal());
+			progressBar->setValue(numBytesRead());
 		}
 		break;
 
@@ -152,24 +152,24 @@
 				? "<b><span style=\"color: #080\">FINISHED</span></b>"
 				: "<b><span style=\"color: #800\">FAILED</span></b>";
 
-			QLabel* lb = new QLabel (text);
-			lb->setAlignment (Qt::AlignCenter);
-			table->setCellWidget (tableRow(), PartDownloader::ProgressColumn, lb);
+			QLabel* lb = new QLabel(text);
+			lb->setAlignment(Qt::AlignCenter);
+			table->setCellWidget(tableRow(), PartDownloader::ProgressColumn, lb);
 		}
 		break;
 	}
 
-	QLabel* label = qobject_cast<QLabel*> (table->cellWidget (tableRow(), PartDownloader::PartLabelColumn));
+	QLabel* label = qobject_cast<QLabel*>(table->cellWidget(tableRow(), PartDownloader::PartLabelColumn));
 
 	if (isFirstUpdate())
 	{
-		label = new QLabel (format ("<b>%1</b>", destination()), table);
-		table->setCellWidget (tableRow(), PartDownloader::PartLabelColumn, label);
+		label = new QLabel(format("<b>%1</b>", destination()), table);
+		table->setCellWidget(tableRow(), PartDownloader::PartLabelColumn, label);
 	}
 
 	// Make sure that the cell is big enough to contain the label
-	if (table->columnWidth (PartDownloader::PartLabelColumn) < label->width())
-		table->setColumnWidth (PartDownloader::PartLabelColumn, label->width());
+	if (table->columnWidth(PartDownloader::PartLabelColumn) < label->width())
+		table->setColumnWidth(PartDownloader::PartLabelColumn, label->width());
 
 	m_isFirstUpdate = false;
 }
@@ -179,9 +179,9 @@
 	if (networkReply()->error() != QNetworkReply::NoError)
 	{
 		if (isPrimary() and not prompt()->isAborted())
-			Critical (networkReply()->errorString());
+			Critical(networkReply()->errorString());
 
-		print ("Unable to download %1: %2\n", destination(), networkReply()->errorString());
+		print("Unable to download %1: %2\n", destination(), networkReply()->errorString());
 		m_state = State::Failed;
 	}
 	else if (m_state != State::Failed)
@@ -199,7 +199,7 @@
 		m_filePointer = nullptr;
 
 		if (m_state == State::Failed)
-			QFile::remove (filePath());
+			QFile::remove(filePath());
 	}
 
 	if (m_state != State::Finished)
@@ -209,7 +209,7 @@
 	}
 
 	// Try to load this file now.
-	LDDocument* document = m_documents->openDocument (filePath(), false, not isPrimary());
+	LDDocument* document = m_documents->openDocument(filePath(), false, not isPrimary());
 
 	if (document == nullptr)
 		return;
@@ -220,27 +220,27 @@
 	// it resolves dependencies.
 	for (LDObject* obj : document->objects())
 	{
-		LDError* err = dynamic_cast<LDError*> (obj);
+		LDError* err = dynamic_cast<LDError*>(obj);
 
 		if (err == nullptr or err->fileReferenced().isEmpty())
 			continue;
 
 		QString dest = err->fileReferenced();
-		prompt()->downloadFromPartsTracker (dest);
+		prompt()->downloadFromPartsTracker(dest);
 	}
 
-	prompt()->addFile (document);
+	prompt()->addFile(document);
 
 	if (isPrimary())
 	{
-		m_documents->addRecentFile (filePath());
-		prompt()->setPrimaryFile (document);
+		m_documents->addRecentFile(filePath());
+		prompt()->setPrimaryFile(document);
 	}
 
 	prompt()->checkIfFinished();
 }
 
-void PartDownloadRequest::updateDownloadProgress (int64 recv, int64 total)
+void PartDownloadRequest::updateDownloadProgress(int64 recv, int64 total)
 {
 	m_numBytesRead = recv;
 	m_numBytesTotal = total;
@@ -255,14 +255,14 @@
 
 	if (m_filePointer == nullptr)
 	{
-		m_filePath.replace ("\\", "/");
+		m_filePath.replace("\\", "/");
 
 		// We have already asked the user whether we can overwrite so we're good to go here.
-		m_filePointer = new QFile (filePath().toLocal8Bit());
+		m_filePointer = new QFile(filePath().toLocal8Bit());
 
-		if (not m_filePointer->open (QIODevice::WriteOnly))
+		if (not m_filePointer->open(QIODevice::WriteOnly))
 		{
-			Critical (format (tr ("Couldn't open %1 for writing: %2"), filePath(), strerror (errno)));
+			Critical(format(tr("Couldn't open %1 for writing: %2"), filePath(), strerror(errno)));
 			m_state = State::Failed;
 			networkReply()->abort();
 			updateToTable();
@@ -271,12 +271,12 @@
 		}
 	}
 
-	m_filePointer->write (networkReply()->readAll());
+	m_filePointer->write(networkReply()->readAll());
 }
 
 bool PartDownloadRequest::isFinished() const
 {
-	return isOneOf (m_state, State::Finished, State::Failed);
+	return isOneOf(m_state, State::Finished, State::Failed);
 }
 
 void PartDownloadRequest::abort()
--- a/src/partdownloadrequest.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/partdownloadrequest.h	Thu Jan 04 19:44:26 2018 +0200
@@ -35,7 +35,7 @@
 		Failed,
 	};
 
-	explicit PartDownloadRequest (QString url, QString dest, bool primary, PartDownloader* parent);
+	explicit PartDownloadRequest(QString url, QString dest, bool primary, PartDownloader* parent);
 	virtual ~PartDownloadRequest();
 
 	Q_SLOT void abort();
@@ -51,9 +51,9 @@
 	qint64 numBytesTotal() const;
 	PartDownloader* prompt() const;
 	Q_SLOT void readFromNetworkReply();
-	void setTableRow (int value);
+	void setTableRow(int value);
 	int tableRow() const;
-	Q_SLOT void updateDownloadProgress (qint64 recv, qint64 total);
+	Q_SLOT void updateDownloadProgress(qint64 recv, qint64 total);
 	void updateToTable();
 	QString url() const;
 
--- a/src/primitives.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/primitives.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -58,9 +58,9 @@
 void LoadPrimitives()
 {
 	// Try to load prims.cfg
-	QFile conf (getPrimitivesCfgPath());
+	QFile conf(getPrimitivesCfgPath());
 
-	if (not conf.open (QIODevice::ReadOnly))
+	if (not conf.open(QIODevice::ReadOnly))
 	{
 		// No prims.cfg, build it
 		PrimitiveScanner::start();
@@ -71,38 +71,38 @@
 		{
 			QString line = conf.readLine();
 
-			if (line.endsWith ("\n"))
-				line.chop (1);
+			if (line.endsWith("\n"))
+				line.chop(1);
 
-			if (line.endsWith ("\r"))
-				line.chop (1);
+			if (line.endsWith("\r"))
+				line.chop(1);
 
-			int space = line.indexOf (" ");
+			int space = line.indexOf(" ");
 
 			if (space == -1)
 				continue;
 
 			Primitive info;
-			info.name = line.left (space);
-			info.title = line.mid (space + 1);
+			info.name = line.left(space);
+			info.title = line.mid(space + 1);
 			g_primitives << info;
 		}
 
 		PrimitiveCategory::populateCategories();
-		print ("%1 primitives loaded.\n", g_primitives.size());
+		print("%1 primitives loaded.\n", g_primitives.size());
 	}
 }
 
 // =============================================================================
 //
-static void GetRecursiveFilenames (QDir dir, QList<QString>& fnames)
+static void GetRecursiveFilenames(QDir dir, QList<QString>& fnames)
 {
-	QFileInfoList flist = dir.entryInfoList (QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
+	QFileInfoList flist = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
 
 	for (const QFileInfo& info : flist)
 	{
 		if (info.isDir())
-			GetRecursiveFilenames (QDir (info.absoluteFilePath()), fnames);
+			GetRecursiveFilenames(QDir(info.absoluteFilePath()), fnames);
 		else
 			fnames << info.absoluteFilePath();
 	}
@@ -110,16 +110,16 @@
 
 // =============================================================================
 //
-PrimitiveScanner::PrimitiveScanner (QObject* parent) :
-	QObject (parent),
-	m_i (0)
+PrimitiveScanner::PrimitiveScanner(QObject* parent) :
+	QObject(parent),
+	m_i(0)
 {
 	g_activeScanner = this;
 	QDir dir = LDPaths::primitivesDir();
 	m_baselen = dir.absolutePath().length();
-	GetRecursiveFilenames (dir, m_files);
-	emit starting (m_files.size());
-	print ("Scanning primitives...");
+	GetRecursiveFilenames(dir, m_files);
+	emit starting(m_files.size());
+	print("Scanning primitives...");
 }
 
 // =============================================================================
@@ -133,30 +133,30 @@
 //
 void PrimitiveScanner::work()
 {
-	int j = qMin (m_i + 100, m_files.size());
+	int j = qMin(m_i + 100, m_files.size());
 
 	for (; m_i < j; ++m_i)
 	{
 		QString fname = m_files[m_i];
-		QFile f (fname);
+		QFile f(fname);
 
-		if (not f.open (QIODevice::ReadOnly))
+		if (not f.open(QIODevice::ReadOnly))
 			continue;
 
 		Primitive info;
-		info.name = fname.mid (m_baselen + 1);  // make full path relative
-		info.name.replace ('/', '\\');  // use DOS backslashes, they're expected
+		info.name = fname.mid(m_baselen + 1);  // make full path relative
+		info.name.replace('/', '\\');  // use DOS backslashes, they're expected
 		info.category = nullptr;
 		QByteArray titledata = f.readLine();
 
 		if (titledata != QByteArray())
-			info.title = QString::fromUtf8 (titledata);
+			info.title = QString::fromUtf8(titledata);
 
 		info.title = info.title.simplified();
 
-		if (Q_LIKELY (info.title[0] == '0'))
+		if (Q_LIKELY(info.title[0] == '0'))
 		{
-			info.title.remove (0, 1);  // remove 0
+			info.title.remove(0, 1);  // remove 0
 			info.title = info.title.simplified();
 		}
 
@@ -167,22 +167,22 @@
 	{
 		// Done with primitives, now save to a config file
 		QString path = getPrimitivesCfgPath();
-		QFile conf (path);
+		QFile conf(path);
 
-		if (not conf.open (QIODevice::WriteOnly | QIODevice::Text))
-			Critical (format ("Couldn't write primitive list %1: %2",
+		if (not conf.open(QIODevice::WriteOnly | QIODevice::Text))
+			Critical(format("Couldn't write primitive list %1: %2",
 				path, conf.errorString()));
 		else
 		{
 			for (Primitive& info : m_prims)
-				fprint (conf, "%1 %2\r\n", info.name, info.title);
+				fprint(conf, "%1 %2\r\n", info.name, info.title);
 
 			conf.close();
 		}
 
 		g_primitives = m_prims;
 		PrimitiveCategory::populateCategories();
-		print ("%1 primitives scanned", g_primitives.size());
+		print("%1 primitives scanned", g_primitives.size());
 		g_activeScanner = nullptr;
 		emit workDone();
 		deleteLater();
@@ -190,8 +190,8 @@
 	else
 	{
 		// Defer to event loop, pick up the work later
-		emit update (m_i);
-		QMetaObject::invokeMethod (this, "work", Qt::QueuedConnection);
+		emit update(m_i);
+		QMetaObject::invokeMethod(this, "work", Qt::QueuedConnection);
 	}
 }
 
@@ -209,9 +209,9 @@
 
 // =============================================================================
 //
-PrimitiveCategory::PrimitiveCategory (QString name, QObject* parent) :
-	QObject (parent),
-	m_name (name) {}
+PrimitiveCategory::PrimitiveCategory(QString name, QObject* parent) :
+	QObject(parent),
+	m_name(name) {}
 
 // =============================================================================
 //
@@ -233,18 +233,18 @@
 		{
 			for (RegexEntry& entry : cat->regexes)
 			{
-				switch (entry.type)
+				switch(entry.type)
 				{
 					case EFilenameRegex:
 					{
 						// f-regex, check against filename
-						matched = entry.regex.exactMatch (prim.name);
+						matched = entry.regex.exactMatch(prim.name);
 					} break;
 
 					case ETitleRegex:
 					{
 						// t-regex, check against title
-						matched = entry.regex.exactMatch (prim.title);
+						matched = entry.regex.exactMatch(prim.title);
 					} break;
 				}
 
@@ -270,7 +270,7 @@
 
 	// Sort the categories. Note that we do this here because we need the existing
 	// order for regex matching.
-	qSort (g_PrimitiveCategories.begin(), g_PrimitiveCategories.end(),
+	qSort(g_PrimitiveCategories.begin(), g_PrimitiveCategories.end(),
 		[](PrimitiveCategory* const& a, PrimitiveCategory* const& b) -> bool
 		{
 			return a->name() < b->name();
@@ -286,11 +286,11 @@
 
 	g_PrimitiveCategories.clear();
 	QString path = ":/data/primitive-categories.cfg";
-	QFile f (path);
+	QFile f(path);
 
-	if (not f.open (QIODevice::ReadOnly))
+	if (not f.open(QIODevice::ReadOnly))
 	{
-		Critical (format (QObject::tr ("Failed to open primitive categories: %1"), f.errorString()));
+		Critical(format(QObject::tr("Failed to open primitive categories: %1"), f.errorString()));
 		return;
 	}
 
@@ -301,22 +301,22 @@
 		QString line = f.readLine();
 		int colon;
 
-		if (line.endsWith ("\n"))
-			line.chop (1);
+		if (line.endsWith("\n"))
+			line.chop(1);
 
 		if (line.length() == 0 or line[0] == '#')
 			continue;
 
-		if ((colon = line.indexOf (":")) == -1)
+		if ((colon = line.indexOf(":")) == -1)
 		{
 			if (cat and cat->isValidToInclude())
 				g_PrimitiveCategories << cat;
 
-			cat = new PrimitiveCategory (line);
+			cat = new PrimitiveCategory(line);
 		}
 		else if (cat)
 		{
-			QString cmd = line.left (colon);
+			QString cmd = line.left(colon);
 			RegexType type = EFilenameRegex;
 
 			if (cmd == "f")
@@ -325,16 +325,16 @@
 				type = ETitleRegex;
 			else
 			{
-				print (tr ("Warning: unknown command \"%1\" on line \"%2\""), cmd, line);
+				print(tr("Warning: unknown command \"%1\" on line \"%2\""), cmd, line);
 				continue;
 			}
 
-			QRegExp regex (line.mid (colon + 1));
+			QRegExp regex(line.mid(colon + 1));
 			RegexEntry entry = { regex, type };
 			cat->regexes << entry;
 		}
 		else
-			print ("Warning: Rules given before the first category name");
+			print("Warning: Rules given before the first category name");
 	}
 
 	if (cat->isValidToInclude())
@@ -343,7 +343,7 @@
 	// Add a category for unmatched primitives.
 	// Note: if this function is called the second time, g_unmatched has been
 	// deleted at the beginning of the function and is dangling at this point.
-	g_unmatched = new PrimitiveCategory (tr ("Other"));
+	g_unmatched = new PrimitiveCategory(tr("Other"));
 	g_PrimitiveCategories << g_unmatched;
 	f.close();
 }
@@ -354,7 +354,7 @@
 {
 	if (regexes.isEmpty())
 	{
-		print (tr ("Warning: category \"%1\" left without patterns"), name());
+		print(tr("Warning: category \"%1\" left without patterns"), name());
 		deleteLater();
 		return false;
 	}
@@ -376,35 +376,35 @@
 
 // =============================================================================
 //
-static double GetRadialPoint (int i, int divs, double (*func) (double))
+static double GetRadialPoint(int i, int divs, double(*func)(double))
 {
-	return (*func) ((i * 2 * Pi) / divs);
+	return (*func)((i * 2 * Pi) / divs);
 }
 
 // =============================================================================
 //
-void MakeCircle (int segs, int divs, double radius, QList<QLineF>& lines)
+void MakeCircle(int segs, int divs, double radius, QList<QLineF>& lines)
 {
 	for (int i = 0; i < segs; ++i)
 	{
-		double x0 = radius * GetRadialPoint (i, divs, cos),
-			x1 = radius * GetRadialPoint (i + 1, divs, cos),
-			z0 = radius * GetRadialPoint (i, divs, sin),
-			z1 = radius * GetRadialPoint (i + 1, divs, sin);
+		double x0 = radius * GetRadialPoint(i, divs, cos),
+			x1 = radius * GetRadialPoint(i + 1, divs, cos),
+			z0 = radius * GetRadialPoint(i, divs, sin),
+			z1 = radius * GetRadialPoint(i + 1, divs, sin);
 
-		lines << QLineF (QPointF (x0, z0), QPointF (x1, z1));
+		lines << QLineF(QPointF(x0, z0), QPointF(x1, z1));
 	}
 }
 
 // =============================================================================
 //
-LDObjectList MakePrimitive (PrimitiveType type, int segs, int divs, int num)
+LDObjectList MakePrimitive(PrimitiveType type, int segs, int divs, int num)
 {
 	LDObjectList objs;
 	QList<int> condLineSegs;
 	QList<QLineF> circle;
 
-	MakeCircle (segs, divs, 1, circle);
+	MakeCircle(segs, divs, 1, circle);
 
 	for (int i = 0; i < segs; ++i)
 	{
@@ -413,17 +413,17 @@
 				   z0 = circle[i].y1(),
 				   z1 = circle[i].y2();
 
-		switch (type)
+		switch(type)
 		{
 			case Circle:
 			{
-				Vertex v0 (x0, 0.0f, z0),
-				  v1 (x1, 0.0f, z1);
+				Vertex v0(x0, 0.0f, z0),
+				  v1(x1, 0.0f, z1);
 
-				LDLine* line (LDSpawn<LDLine>());
-				line->setVertex (0, v0);
-				line->setVertex (1, v1);
-				line->setColor (EdgeColor);
+				LDLine* line(LDSpawn<LDLine>());
+				line->setVertex(0, v0);
+				line->setVertex(1, v1);
+				line->setColor(EdgeColor);
 				objs << line;
 			} break;
 
@@ -446,10 +446,10 @@
 				}
 				else
 				{
-					x2 = x1 * (num + 1);
-					x3 = x0 * (num + 1);
-					z2 = z1 * (num + 1);
-					z3 = z0 * (num + 1);
+					x2 = x1 *(num + 1);
+					x3 = x0 *(num + 1);
+					z2 = z1 *(num + 1);
+					z3 = z0 *(num + 1);
 
 					x0 *= num;
 					x1 *= num;
@@ -465,13 +465,13 @@
 					}
 				}
 
-				Vertex v0 (x0, y0, z0),
-					   v1 (x1, y1, z1),
-					   v2 (x2, y2, z2),
-					   v3 (x3, y3, z3);
+				Vertex v0(x0, y0, z0),
+					   v1(x1, y1, z1),
+					   v2(x2, y2, z2),
+					   v3(x3, y3, z3);
 
-				LDQuad* quad (LDSpawn<LDQuad> (v0, v1, v2, v3));
-				quad->setColor (MainColor);
+				LDQuad* quad(LDSpawn<LDQuad>(v0, v1, v2, v3));
+				quad->setColor(MainColor);
 
 				if (type == Cylinder)
 					quad->invert();
@@ -495,17 +495,17 @@
 					z2 = (z0 >= 0.0f) ? 1.0f : -1.0f;
 				}
 
-				Vertex v0 (x0, 0.0f, z0),
-					   v1 (x1, 0.0f, z1),
-					   v2 (x2, 0.0f, z2);
+				Vertex v0(x0, 0.0f, z0),
+					   v1(x1, 0.0f, z1),
+					   v2(x2, 0.0f, z2);
 
 				// Disc negatives need to go the other way around, otherwise
 				// they'll end up upside-down.
-				LDTriangle* seg (LDSpawn<LDTriangle>());
-				seg->setColor (MainColor);
-				seg->setVertex (type == Disc ? 0 : 2, v0);
-				seg->setVertex (1, v1);
-				seg->setVertex (type == Disc ? 2 : 0, v2);
+				LDTriangle* seg(LDSpawn<LDTriangle>());
+				seg->setColor(MainColor);
+				seg->setVertex(type == Disc ? 0 : 2, v0);
+				seg->setVertex(1, v1);
+				seg->setVertex(type == Disc ? 2 : 0, v2);
 				objs << seg;
 			} break;
 		}
@@ -518,29 +518,29 @@
 
 	for (int i : condLineSegs)
 	{
-		Vertex v0 (GetRadialPoint (i, divs, cos), 0.0f, GetRadialPoint (i, divs, sin)),
+		Vertex v0(GetRadialPoint(i, divs, cos), 0.0f, GetRadialPoint(i, divs, sin)),
 		  v1,
-		  v2 (GetRadialPoint (i + 1, divs, cos), 0.0f, GetRadialPoint (i + 1, divs, sin)),
-		  v3 (GetRadialPoint (i - 1, divs, cos), 0.0f, GetRadialPoint (i - 1, divs, sin));
+		  v2(GetRadialPoint(i + 1, divs, cos), 0.0f, GetRadialPoint(i + 1, divs, sin)),
+		  v3(GetRadialPoint(i - 1, divs, cos), 0.0f, GetRadialPoint(i - 1, divs, sin));
 
 		if (type == Cylinder)
 		{
-			v1 = Vertex (v0[X], 1.0f, v0[Z]);
+			v1 = Vertex(v0[X], 1.0f, v0[Z]);
 		}
 		else if (type == Cone)
 		{
-			v1 = Vertex (v0[X] * (num + 1), 0.0f, v0[Z] * (num + 1));
-			v0.setX (v0.x() * num);
-			v0.setY (1.0);
-			v0.setZ (v0.z() * num);
+			v1 = Vertex(v0[X] *(num + 1), 0.0f, v0[Z] *(num + 1));
+			v0.setX(v0.x() * num);
+			v0.setY(1.0);
+			v0.setZ(v0.z() * num);
 		}
 
 		LDCondLine* line = (LDSpawn<LDCondLine>());
-		line->setColor (EdgeColor);
-		line->setVertex (0, v0);
-		line->setVertex (1, v1);
-		line->setVertex (2, v2);
-		line->setVertex (3, v3);
+		line->setColor(EdgeColor);
+		line->setVertex(0, v0);
+		line->setVertex(1, v1);
+		line->setVertex(2, v2);
+		line->setVertex(3, v3);
 		objs << line;
 	}
 
@@ -549,7 +549,7 @@
 
 // =============================================================================
 //
-static QString PrimitiveTypeName (PrimitiveType type)
+static QString PrimitiveTypeName(PrimitiveType type)
 {
 	// Not translated as primitives are in English.
 	return type == Circle   ? "Circle" :
@@ -561,13 +561,13 @@
 
 // =============================================================================
 //
-QString MakeRadialFileName (PrimitiveType type, int segs, int divs, int num)
+QString MakeRadialFileName(PrimitiveType type, int segs, int divs, int num)
 {
 	int numer = segs,
 			denom = divs;
 
 	// Simplify the fractional part, but the denominator must be at least 4.
-	Simplify (numer, denom);
+	Simplify(numer, denom);
 
 	if (denom < 4)
 	{
@@ -577,15 +577,15 @@
 	}
 
 	// Compose some general information: prefix, fraction, root, ring number
-	QString prefix = (divs == LowResolution) ? "" : format ("%1/", divs);
-	QString frac = format ("%1-%2", numer, denom);
+	QString prefix = (divs == LowResolution) ? "" : format("%1/", divs);
+	QString frac = format("%1-%2", numer, denom);
 	QString root = g_radialNameRoots[type];
-	QString numstr = (type == Ring or type == Cone) ? format ("%1", num) : "";
+	QString numstr = (type == Ring or type == Cone) ? format("%1", num) : "";
 
-	// Truncate the root if necessary (7-16rin4.dat for instance).
+	// Truncate the root if necessary(7-16rin4.dat for instance).
 	// However, always keep the root at least 2 characters.
 	int extra = (frac.length() + numstr.length() + root.length()) - 8;
-	root.chop (qBound (0, extra, 2));
+	root.chop(qBound(0, extra, 2));
 
 	// Stick them all together and return the result.
 	return prefix + frac + root + numstr + ".dat";
@@ -593,15 +593,15 @@
 
 // =============================================================================
 //
-LDDocument* GeneratePrimitive (PrimitiveType type, int segs, int divs, int num)
+LDDocument* GeneratePrimitive(PrimitiveType type, int segs, int divs, int num)
 {
 	// Make the description
-	QString frac = QString::number ((float) segs / divs);
-	QString name = MakeRadialFileName (type, segs, divs, num);
+	QString frac = QString::number((float) segs / divs);
+	QString name = MakeRadialFileName(type, segs, divs, num);
 	QString descr;
 
 	// Ensure that there's decimals, even if they're 0.
-	if (frac.indexOf (".") == -1)
+	if (frac.indexOf(".") == -1)
 		frac += ".0";
 
 	if (type == Ring or type == Cone)
@@ -610,17 +610,17 @@
 			(num < 10) ? "  " :
 			(num < 100) ? " "  : "";
 
-		descr = format ("%1 %2%3 x %4", PrimitiveTypeName (type), spacing, num, frac);
+		descr = format("%1 %2%3 x %4", PrimitiveTypeName(type), spacing, num, frac);
 	}
 	else
-		descr = format ("%1 %2", PrimitiveTypeName (type), frac);
+		descr = format("%1 %2", PrimitiveTypeName(type), frac);
 
 	// Prepend "Hi-Res" if 48/ primitive.
 	if (divs == HighResolution)
-		descr.insert (0, "Hi-Res ");
+		descr.insert(0, "Hi-Res ");
 
 	LDDocument* document = g_win->newDocument();
-	document->setDefaultName (name);
+	document->setDefaultName(name);
 
 	QString author = APPNAME;
 	QString license = "";
@@ -628,50 +628,50 @@
 	if (not config.defaultName().isEmpty())
 	{
 		license = PreferredLicenseText();
-		author = format ("%1 [%2]", config.defaultName(), config.defaultUser());
+		author = format("%1 [%2]", config.defaultName(), config.defaultUser());
 	}
 
 	LDObjectList objs;
 
-	objs << LDSpawn<LDComment> (descr)
-		 << LDSpawn<LDComment> (format ("Name: %1", name))
-		 << LDSpawn<LDComment> (format ("Author: %1", author))
-		 << LDSpawn<LDComment> (format ("!LDRAW_ORG Unofficial_%1Primitive",
+	objs << LDSpawn<LDComment>(descr)
+		 << LDSpawn<LDComment>(format("Name: %1", name))
+		 << LDSpawn<LDComment>(format("Author: %1", author))
+		 << LDSpawn<LDComment>(format("!LDRAW_ORG Unofficial_%1Primitive",
 									  divs == HighResolution ?  "48_" : ""))
-		 << LDSpawn<LDComment> (license)
+		 << LDSpawn<LDComment>(license)
 		 << LDSpawn<LDEmpty>()
-		 << LDSpawn<LDBfc> (BfcStatement::CertifyCCW)
+		 << LDSpawn<LDBfc>(BfcStatement::CertifyCCW)
 		 << LDSpawn<LDEmpty>();
 
 	document->openForEditing();
-	document->history()->setIgnoring (false);
-	document->addObjects (objs);
-	document->addObjects (MakePrimitive (type, segs, divs, num));
+	document->history()->setIgnoring(false);
+	document->addObjects(objs);
+	document->addObjects(MakePrimitive(type, segs, divs, num));
 	document->addHistoryStep();
 	return document;
 }
 
 // =============================================================================
 //
-LDDocument* GetPrimitive (PrimitiveType type, int segs, int divs, int num)
+LDDocument* GetPrimitive(PrimitiveType type, int segs, int divs, int num)
 {
-	QString name = MakeRadialFileName (type, segs, divs, num);
-	LDDocument* f = g_win->documents()->getDocumentByName (name);
+	QString name = MakeRadialFileName(type, segs, divs, num);
+	LDDocument* f = g_win->documents()->getDocumentByName(name);
 
 	if (f)
 		return f;
 
-	return GeneratePrimitive (type, segs, divs, num);
+	return GeneratePrimitive(type, segs, divs, num);
 }
 
 // =============================================================================
 //
-PrimitivePrompt::PrimitivePrompt (QWidget* parent, Qt::WindowFlags f) :
-	QDialog (parent, f)
+PrimitivePrompt::PrimitivePrompt(QWidget* parent, Qt::WindowFlags f) :
+	QDialog(parent, f)
 {
 	ui = new Ui_MakePrimUI;
-	ui->setupUi (this);
-	connect (ui->cb_hires, SIGNAL (toggled (bool)), this, SLOT (hiResToggled (bool)));
+	ui->setupUi(this);
+	connect(ui->cb_hires, SIGNAL(toggled(bool)), this, SLOT(hiResToggled(bool)));
 }
 
 // =============================================================================
@@ -683,12 +683,12 @@
 
 // =============================================================================
 //
-void PrimitivePrompt::hiResToggled (bool on)
+void PrimitivePrompt::hiResToggled(bool on)
 {
-	ui->sb_segs->setMaximum (on ? HighResolution : LowResolution);
+	ui->sb_segs->setMaximum(on ? HighResolution : LowResolution);
 
 	// If the current value is 16 and we switch to hi-res, default the
 	// spinbox to 48.
 	if (on and ui->sb_segs->value() == LowResolution)
-		ui->sb_segs->setValue (HighResolution);
+		ui->sb_segs->setValue(HighResolution);
 }
--- a/src/primitives.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/primitives.h	Thu Jan 04 19:44:26 2018 +0200
@@ -53,7 +53,7 @@
 	QList<RegexEntry> regexes;
 	QList<Primitive> prims;
 
-	explicit PrimitiveCategory (QString name, QObject* parent = 0);
+	explicit PrimitiveCategory(QString name, QObject* parent = 0);
 	bool isValidToInclude();
 	QString name() const;
 
@@ -73,7 +73,7 @@
 	Q_OBJECT
 
 public:
-	explicit			PrimitiveScanner (QObject* parent = 0);
+	explicit			PrimitiveScanner(QObject* parent = 0);
 	virtual				~PrimitiveScanner();
 	static void			start();
 
@@ -81,9 +81,9 @@
 	void				work();
 
 signals:
-	void				starting (int num);
+	void				starting(int num);
 	void				workDone();
-	void				update (int i);
+	void				update(int i);
 
 private:
 	QList<Primitive>	m_prims;
@@ -112,19 +112,19 @@
 	Q_OBJECT
 
 public:
-	explicit PrimitivePrompt (QWidget* parent = nullptr, Qt::WindowFlags f = 0);
+	explicit PrimitivePrompt(QWidget* parent = nullptr, Qt::WindowFlags f = 0);
 	virtual ~PrimitivePrompt();
 	Ui_MakePrimUI* ui;
 
 public slots:
-	void hiResToggled (bool on);
+	void hiResToggled(bool on);
 };
 
-void MakeCircle (int segs, int divs, double radius, QList<QLineF>& lines);
-LDDocument* GeneratePrimitive (PrimitiveType type, int segs, int divs, int num);
+void MakeCircle(int segs, int divs, double radius, QList<QLineF>& lines);
+LDDocument* GeneratePrimitive(PrimitiveType type, int segs, int divs, int num);
 
 // Gets a primitive by the given specs. If the primitive cannot be found, it will
 // be automatically generated.
-LDDocument* GetPrimitive (PrimitiveType type, int segs, int divs, int num);
+LDDocument* GetPrimitive(PrimitiveType type, int segs, int divs, int num);
 
-QString MakeRadialFileName (PrimitiveType type, int segs, int divs, int num);
+QString MakeRadialFileName(PrimitiveType type, int segs, int divs, int num);
--- a/src/radioGroup.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/radioGroup.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -30,28 +30,28 @@
 
 // =============================================================================
 //
-RadioGroup::RadioGroup (const QString& title, QWidget* parent) : QGroupBox (title, parent)
+RadioGroup::RadioGroup(const QString& title, QWidget* parent) : QGroupBox(title, parent)
 {
-	init (Qt::Vertical);
+	init(Qt::Vertical);
 }
 
 // =============================================================================
 //
-QBoxLayout::Direction makeDirection (Qt::Orientation orient, bool invert = false)
+QBoxLayout::Direction makeDirection(Qt::Orientation orient, bool invert = false)
 {
 	return (orient == (invert ? Qt::Vertical : Qt::Horizontal)) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom;
 }
 
 // =============================================================================
 //
-bool RadioGroup::isChecked (int n) const
+bool RadioGroup::isChecked(int n) const
 {
 	return m_buttonGroup->checkedId() == n;
 }
 
 // =============================================================================
 //
-void RadioGroup::init (Qt::Orientation orient)
+void RadioGroup::init(Qt::Orientation orient)
 {
 	m_vert = orient == Qt::Vertical;
 
@@ -59,81 +59,81 @@
 	m_oldId = m_curId = 0;
 	m_coreLayout = nullptr;
 
-	m_coreLayout = new QBoxLayout ( (orient == Qt::Vertical) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
-	setLayout (m_coreLayout);
+	m_coreLayout = new QBoxLayout((orient == Qt::Vertical) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
+	setLayout(m_coreLayout);
 
 	// Init the first row with a break
 	rowBreak();
 
-	connect (m_buttonGroup, SIGNAL (buttonPressed (int)), this, SLOT (slot_buttonPressed (int)));
-	connect (m_buttonGroup, SIGNAL (buttonReleased (int)), this, SLOT (slot_buttonReleased (int)));
+	connect(m_buttonGroup, SIGNAL(buttonPressed(int)), this, SLOT(slot_buttonPressed(int)));
+	connect(m_buttonGroup, SIGNAL(buttonReleased(int)), this, SLOT(slot_buttonReleased(int)));
 }
 
 // =============================================================================
 //
-RadioGroup::RadioGroup (const QString& title, QList<char const*> entries, int const defaultId, const Qt::Orientation orient, QWidget* parent) :
-		QGroupBox (title, parent),
-		m_defId (defaultId)
+RadioGroup::RadioGroup(const QString& title, QList<char const*> entries, int const defaultId, const Qt::Orientation orient, QWidget* parent) :
+		QGroupBox(title, parent),
+		m_defId(defaultId)
 {
-	init (orient);
+	init(orient);
 	m_oldId = m_defId;
 
 	for (const char* entry : entries)
-		addButton (entry);
+		addButton(entry);
 }
 
 // =============================================================================
 //
 void RadioGroup::rowBreak()
 {
-	QBoxLayout* newLayout = new QBoxLayout (m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
+	QBoxLayout* newLayout = new QBoxLayout(m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
 	m_currentLayout = newLayout;
 	m_layouts << newLayout;
 
-	m_coreLayout->addLayout (newLayout);
+	m_coreLayout->addLayout(newLayout);
 }
 
 // =============================================================================
 //
-void RadioGroup::addButton (QString entry)
+void RadioGroup::addButton(QString entry)
 {
-	QRadioButton* button = new QRadioButton (entry);
-	addButton (button);
+	QRadioButton* button = new QRadioButton(entry);
+	addButton(button);
 }
 
 // =============================================================================
 //
-void RadioGroup::addButton (QRadioButton* button)
+void RadioGroup::addButton(QRadioButton* button)
 {
 	bool const selectThis = (m_curId == m_defId);
 
 	m_objects << button;
-	m_buttonGroup->addButton (button, m_curId++);
-	m_currentLayout->addWidget (button);
+	m_buttonGroup->addButton(button, m_curId++);
+	m_currentLayout->addWidget(button);
 
 	if (selectThis)
-		button->setChecked (true);
+		button->setChecked(true);
 }
 
 // =============================================================================
 //
-RadioGroup& RadioGroup::operator<< (QRadioButton* button)
+RadioGroup& RadioGroup::operator<<(QRadioButton* button)
 {
-	addButton (button);
+	addButton(button);
 	return *this;
 }
 
 // =============================================================================
 //
-RadioGroup& RadioGroup::operator<< (const char* entry)
+RadioGroup& RadioGroup::operator<<(const char* entry)
 {
-	addButton (entry);
+	addButton(entry);
 	return *this;
 }
 
 // =============================================================================
 //
-void RadioGroup::setCurrentRow (int row)
+void RadioGroup::setCurrentRow(int row)
 {
 	m_currentLayout = m_layouts[row];
 }
@@ -147,36 +147,36 @@
 
 // =============================================================================
 //
-void RadioGroup::setValue (int val)
+void RadioGroup::setValue(int val)
 {
-	m_buttonGroup->button (val)->setChecked (true);
+	m_buttonGroup->button(val)->setChecked(true);
 }
 
 // =============================================================================
 //
-QRadioButton* RadioGroup::operator[] (int n) const
+QRadioButton* RadioGroup::operator[](int n) const
 {
 	return m_objects[n];
 }
 
 // =============================================================================
 //
-void RadioGroup::slot_buttonPressed (int btn)
+void RadioGroup::slot_buttonPressed(int btn)
 {
-	emit buttonPressed (btn);
+	emit buttonPressed(btn);
 
 	m_oldId = m_buttonGroup->checkedId();
 }
 
 // =============================================================================
 //
-void RadioGroup::slot_buttonReleased (int btn)
+void RadioGroup::slot_buttonReleased(int btn)
 {
-	emit buttonReleased (btn);
+	emit buttonReleased(btn);
 	int newid = m_buttonGroup->checkedId();
 
 	if (m_oldId != newid)
-		emit valueChanged (newid);
+		emit valueChanged(newid);
 }
 
 // =============================================================================
--- a/src/radioGroup.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/radioGroup.h	Thu Jan 04 19:44:26 2018 +0200
@@ -41,37 +41,37 @@
 
 	explicit RadioGroup()
 	{
-		init (Qt::Vertical);
+		init(Qt::Vertical);
 	}
 
-	explicit RadioGroup (QWidget* parent = nullptr) : QGroupBox (parent)
+	explicit RadioGroup(QWidget* parent = nullptr) : QGroupBox(parent)
 	{
-		init (Qt::Vertical);
+		init(Qt::Vertical);
 	}
 
-	explicit RadioGroup (const QString& title, QWidget* parent = nullptr);
-	explicit RadioGroup (const QString& title, QList<char const*> entries, int const defaultId,
+	explicit RadioGroup(const QString& title, QWidget* parent = nullptr);
+	explicit RadioGroup(const QString& title, QList<char const*> entries, int const defaultId,
 		const Qt::Orientation orient = Qt::Vertical, QWidget* parent = nullptr);
 
 	void            addButton	(QString entry);
 	void            addButton	(QRadioButton* button);
 	Iterator        begin();
 	Iterator        end();
-	void            init (Qt::Orientation orient);
-	bool            isChecked (int n) const;
+	void            init(Qt::Orientation orient);
+	bool            isChecked(int n) const;
 	void            rowBreak();
-	void            setCurrentRow (int row);
-	void            setValue (int val);
+	void            setCurrentRow(int row);
+	void            setValue(int val);
 	int             value() const;
 
-	QRadioButton*   operator[] (int n) const;
-	RadioGroup&     operator<< (QRadioButton* button);
-	RadioGroup&     operator<< (const char* entry);
+	QRadioButton*   operator[](int n) const;
+	RadioGroup&     operator<<(QRadioButton* button);
+	RadioGroup&     operator<<(const char* entry);
 
 signals:
-	void buttonPressed (int btn);
-	void buttonReleased (int btn);
-	void valueChanged (int val);
+	void buttonPressed(int btn);
+	void buttonReleased(int btn);
+	void valueChanged(int val);
 
 private:
 	QList<QRadioButton*> m_objects;
@@ -82,9 +82,9 @@
 	int m_curId, m_defId, m_oldId;
 	QButtonGroup* m_buttonGroup;
 
-	Q_DISABLE_COPY (RadioGroup)
+	Q_DISABLE_COPY(RadioGroup)
 
 private slots:
-	void slot_buttonPressed (int btn);
-	void slot_buttonReleased (int btn);
+	void slot_buttonPressed(int btn);
+	void slot_buttonReleased(int btn);
 };
--- a/src/ringFinder.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ringFinder.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -25,7 +25,7 @@
 
 // =============================================================================
 //
-bool RingFinder::findRingsRecursor (double r0, double r1, Solution& currentSolution)
+bool RingFinder::findRingsRecursor(double r0, double r1, Solution& currentSolution)
 {
 	// Don't recurse too deep.
 	if (m_stack >= 5 or r1 < r0)
@@ -36,25 +36,25 @@
 	double num = r0 / scale;
 
 	// If the ring number is integral, we have found a fitting ring to r0 -> r1!
-	if (isInteger (num))
+	if (isInteger(num))
 	{
 		Component cmp;
 		cmp.scale = scale;
-		cmp.num = (int) round (num);
-		currentSolution.addComponent (cmp);
+		cmp.num = (int) round(num);
+		currentSolution.addComponent(cmp);
 
 		// If we're still at the first recursion, this is the only
 		// ring and there's nothing left to do. Guess we found the winner.
 		if (m_stack == 0)
 		{
-			m_solutions.push_back (currentSolution);
+			m_solutions.push_back(currentSolution);
 			return true;
 		}
 	}
 	else
 	{
 		// Try find solutions by splitting the ring in various positions.
-		if (isZero (r1 - r0))
+		if (isZero(r1 - r0))
 			return false;
 
 		double interval;
@@ -77,7 +77,7 @@
 			Solution sol = currentSolution;
 
 			m_stack++;
-			bool res = findRingsRecursor (r0, r, sol) and findRingsRecursor (r, r1, sol);
+			bool res = findRingsRecursor(r0, r, sol) and findRingsRecursor(r, r1, sol);
 			m_stack--;
 
 			if (res)
@@ -90,7 +90,7 @@
 				// Accept the solution to this segment by setting currentSolution to sol, and
 				// return true to continue processing.
 				if (m_stack == 0)
-					m_solutions.push_back (sol);
+					m_solutions.push_back(sol);
 				else
 				{
 					currentSolution = sol;
@@ -107,8 +107,8 @@
 
 //
 // This is the main algorithm of the ring finder. It tries to use math
-// to find the one ring between r0 and r1. If it fails (the ring number
-// is non-integral), it finds an intermediate radius (ceil of the ring
+// to find the one ring between r0 and r1. If it fails(the ring number
+// is non-integral), it finds an intermediate radius(ceil of the ring
 // number times scale) and splits the radius at this point, calling this
 // function again to try find the rings between r0 - r and r - r1.
 //
@@ -116,7 +116,7 @@
 // r0 or r == r1, there is no hope of finding the rings, at least with
 // this algorithm, as it would fall into an infinite recursion.
 //
-bool RingFinder::findRings (double r0, double r1)
+bool RingFinder::findRings(double r0, double r1)
 {
 	m_solutions.clear();
 	Solution sol;
@@ -124,23 +124,23 @@
 	// If we're dealing with fractional radii, try upscale them into integral
 	// ones. This should yield in more reliable and more optimized results.
 	// For instance, using r0=1.5, r1=3.5 causes the algorithm to fail but
-	// r0=3, r1=7 (scaled up by 2) yields a 2-component solution. We can then
+	// r0=3, r1=7(scaled up by 2) yields a 2-component solution. We can then
 	// downscale the radii back by dividing the scale fields of the solution
 	// components.
 	double scale = 1.0;
 
-	if (not isZero (scale = r0 - floor (r0)) or not isZero (scale = r1 - floor (r1)))
+	if (not isZero(scale = r0 - floor(r0)) or not isZero(scale = r1 - floor(r1)))
 	{
 		double r0f = r0 / scale;
 		double r1f = r1 / scale;
 
-		if (isInteger (r0f) and isInteger (r1f))
+		if (isInteger(r0f) and isInteger(r1f))
 		{
 			r0 = r0f;
 			r1 = r1f;
 		}
 		// If the numbers are both at most one-decimal fractions, we can use a scale of 10
-		else if (isInteger (r0 * 10) and isInteger (r1 * 10))
+		else if (isInteger(r0 * 10) and isInteger(r1 * 10))
 		{
 			scale = 0.1;
 			r0 *= 10;
@@ -153,13 +153,13 @@
 	}
 
 	// Recurse in and try find solutions.
-	findRingsRecursor (r0, r1, sol);
+	findRingsRecursor(r0, r1, sol);
 
 	// If we had upscaled our radii, downscale back now.
 	if (scale != 1.0)
 	{
 		for (Solution& sol : m_solutions)
-			sol.scaleComponents (scale);
+			sol.scaleComponents(scale);
 	}
 
 	// Compare the solutions and find the best one. The solution class has an operator>
@@ -168,7 +168,7 @@
 
 	for (Solution const& sol : m_solutions)
 	{
-		if (m_bestSolution == nullptr or sol.isSuperiorTo (m_bestSolution))
+		if (m_bestSolution == nullptr or sol.isSuperiorTo(m_bestSolution))
 			m_bestSolution = &sol;
 	}
 
@@ -188,7 +188,7 @@
 // The solution which is found superior to every other solution
 // will be the one returned by RingFinder::bestSolution().
 //
-bool RingFinder::Solution::isSuperiorTo (const Solution* other) const
+bool RingFinder::Solution::isSuperiorTo(const Solution* other) const
 {
 	// If one solution has less components than the other one, it is definitely
 	// better.
@@ -203,8 +203,8 @@
 
 	for (int i = 0; i < getComponents().size(); ++i)
 	{
-		maxA = qMax (getComponents()[i].num, maxA);
-		maxB = qMax (other->getComponents()[i].num, maxB);
+		maxA = qMax(getComponents()[i].num, maxA);
+		maxB = qMax(other->getComponents()[i].num, maxB);
 	}
 
 	if (maxA != maxB)
@@ -216,7 +216,7 @@
 	return true;
 }
 
-void RingFinder::Solution::scaleComponents (double scale)
+void RingFinder::Solution::scaleComponents(double scale)
 {
 	for (Component& cmp : m_components)
 		cmp.scale *= scale;
--- a/src/ringFinder.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/ringFinder.h	Thu Jan 04 19:44:26 2018 +0200
@@ -39,10 +39,10 @@
 	class Solution
 	{
 	public:
-		inline void addComponent (const Component& a);
+		inline void addComponent(const Component& a);
 		inline const QVector<Component>& getComponents() const;
-		void scaleComponents (double scale);
-		bool isSuperiorTo (const Solution* other) const;
+		void scaleComponents(double scale);
+		bool isSuperiorTo(const Solution* other) const;
 
 	private:
 		QVector<Component> m_components;
@@ -52,14 +52,14 @@
 
 	inline const QVector<Solution>& allSolutions() const;
 	inline const Solution* bestSolution() const;
-	bool findRings (double r0, double r1);
+	bool findRings(double r0, double r1);
 
 private:
 	QVector<Solution> m_solutions;
 	const Solution*   m_bestSolution;
 	int               m_stack;
 
-	bool findRingsRecursor (double r0, double r1, Solution& currentSolution);
+	bool findRingsRecursor(double r0, double r1, Solution& currentSolution);
 };
 
 //
@@ -73,9 +73,9 @@
 //
 // Adds a component to a solution
 //
-inline void RingFinder::Solution::addComponent (const Component& a)
+inline void RingFinder::Solution::addComponent(const Component& a)
 {
-	m_components.push_back (a);
+	m_components.push_back(a);
 }
 
 //
--- a/src/toolsets/algorithmtoolset.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/algorithmtoolset.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -39,12 +39,12 @@
 #include "ui_addhistoryline.h"
 #include "algorithmtoolset.h"
 
-ConfigOption (int RoundPositionPrecision = 3)
-ConfigOption (int RoundMatrixPrecision = 4)
-ConfigOption (int SplitLinesSegments = 5)
+ConfigOption(int RoundPositionPrecision = 3)
+ConfigOption(int RoundMatrixPrecision = 4)
+ConfigOption(int SplitLinesSegments = 5)
 
-AlgorithmToolset::AlgorithmToolset (MainWindow* parent) :
-	Toolset (parent)
+AlgorithmToolset::AlgorithmToolset(MainWindow* parent) :
+	Toolset(parent)
 {
 }
 
@@ -52,7 +52,7 @@
 {
 	int num = 0;
 
-	for (LDObjectIterator<LDQuad> it (selectedObjects()); it.isValid(); ++it)
+	for (LDObjectIterator<LDQuad> it(selectedObjects()); it.isValid(); ++it)
 	{
 		// Find the index of this quad
 		int index = it->lineNumber();
@@ -64,12 +64,12 @@
 
 		// Replace the quad with the first triangle and add the second triangle
 		// after the first one.
-		currentDocument()->setObject (index, triangles[0]);
-		currentDocument()->insertObj (index + 1, triangles[1]);
+		currentDocument()->setObject(index, triangles[0]);
+		currentDocument()->insertObj(index + 1, triangles[1]);
 		num++;
 	}
 
-	print ("%1 quadrilaterals split", num);
+	print("%1 quadrilaterals split", num);
 }
 
 void AlgorithmToolset::editRaw()
@@ -81,11 +81,11 @@
 	QDialog* dlg = new QDialog;
 	Ui::EditRawUI ui;
 
-	ui.setupUi (dlg);
-	ui.code->setText (obj->asText());
+	ui.setupUi(dlg);
+	ui.code->setText(obj->asText());
 
 	if (obj->type() == OBJ_Error)
-		ui.errorDescription->setText (static_cast<LDError*> (obj)->reason());
+		ui.errorDescription->setText(static_cast<LDError*>(obj)->reason());
 	else
 	{
 		ui.errorDescription->hide();
@@ -96,8 +96,8 @@
 		return;
 
 	// Reinterpret it from the text of the input field
-	LDObject* newobj = ParseLine (ui.code->text());
-	obj->replace (newobj);
+	LDObject* newobj = ParseLine(ui.code->text());
+	obj->replace(newobj);
 }
 
 void AlgorithmToolset::makeBorders()
@@ -116,87 +116,87 @@
 
 		if (type == OBJ_Quad)
 		{
-			LDQuad* 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));
-			lines[3] = LDSpawn<LDLine> (quad->vertex (3), quad->vertex (0));
+			LDQuad* 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));
+			lines[3] = LDSpawn<LDLine>(quad->vertex(3), quad->vertex(0));
 		}
 		else
 		{
-			LDTriangle* 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));
+			LDTriangle* 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));
 			lines[3] = nullptr;
 		}
 
-		for (int i = 0; i < countof (lines); ++i)
+		for (int i = 0; i < countof(lines); ++i)
 		{
 			if (lines[i] == nullptr)
 				continue;
 
 			long idx = obj->lineNumber() + i + 1;
-			currentDocument()->insertObj (idx, lines[i]);
+			currentDocument()->insertObj(idx, lines[i]);
 			++num;
 		}
 	}
 
-	print (tr ("Added %1 border lines"), num);
+	print(tr("Added %1 border lines"), num);
 }
 
 void AlgorithmToolset::roundCoordinates()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 	int num = 0;
 
 	for (LDObject* obj : selectedObjects())
 	{
-		LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
+		LDMatrixObject* mo = dynamic_cast<LDMatrixObject*>(obj);
 
 		if (mo)
 		{
 			Vertex v = mo->position();
 			Matrix t = mo->transform();
 
-			v.apply ([&](Axis, double& a)
+			v.apply([&](Axis, double& a)
 			{
-				RoundToDecimals (a, config.roundPositionPrecision());
+				RoundToDecimals(a, config.roundPositionPrecision());
 			});
 
-			ApplyToMatrix (t, [&](int, double& a)
+			ApplyToMatrix(t, [&](int, double& a)
 			{
-				RoundToDecimals (a, config.roundMatrixPrecision());
+				RoundToDecimals(a, config.roundMatrixPrecision());
 			});
 
-			mo->setPosition (v);
-			mo->setTransform (t);
+			mo->setPosition(v);
+			mo->setTransform(t);
 			num += 12;
 		}
 		else
 		{
 			for (int i = 0; i < obj->numVertices(); ++i)
 			{
-				Vertex v = obj->vertex (i);
-				v.apply ([&](Axis, double& a)
+				Vertex v = obj->vertex(i);
+				v.apply([&](Axis, double& a)
 				{
-					RoundToDecimals (a, config.roundPositionPrecision());
+					RoundToDecimals(a, config.roundPositionPrecision());
 				});
-				obj->setVertex (i, v);
+				obj->setVertex(i, v);
 				num += 3;
 			}
 		}
 	}
 
-	print (tr ("Rounded %1 values"), num);
+	print(tr("Rounded %1 values"), num);
 	m_window->refreshObjectList();
 }
 
 void AlgorithmToolset::replaceCoordinates()
 {
-	QDialog* dlg = new QDialog (m_window);
+	QDialog* dlg = new QDialog(m_window);
 	Ui::ReplaceCoordsUI ui;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
 	if (not dlg->exec())
 		return;
@@ -217,11 +217,11 @@
 	{
 		for (int i = 0; i < obj->numVertices(); ++i)
 		{
-			Vertex v = obj->vertex (i);
+			Vertex v = obj->vertex(i);
 
-			v.apply ([&](Axis ax, double& coord)
+			v.apply([&](Axis ax, double& coord)
 			{
-				if (not sel.contains (ax) or
+				if (not sel.contains(ax) or
 					(not any and coord != search))
 				{
 					return;
@@ -234,18 +234,18 @@
 				num++;
 			});
 
-			obj->setVertex (i, v);
+			obj->setVertex(i, v);
 		}
 	}
 
-	print (tr ("Altered %1 values"), num);
+	print(tr("Altered %1 values"), num);
 }
 
 void AlgorithmToolset::flip()
 {
 	QDialog* dlg = new QDialog;
 	Ui::FlipUI ui;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
 	if (not dlg->exec())
 		return;
@@ -258,7 +258,7 @@
 
 	for (LDObject* obj : selectedObjects())
 	{
-        LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
+        LDMatrixObject* mo = dynamic_cast<LDMatrixObject*>(obj);
 
 		if (mo)
 		{
@@ -283,24 +283,24 @@
             }
             mo->setTransform(transformationMatrix);
             Vertex position = mo->position();
-			position.apply ([&](Axis ax, double& a)
+			position.apply([&](Axis ax, double& a)
 			{
-				if (sel.contains (ax))
+				if (sel.contains(ax))
 					a = -a;
 			});
             mo->setPosition(position);
         }
 		for (int i = 0; i < obj->numVertices(); ++i)
 		{
-			Vertex v = obj->vertex (i);
+			Vertex v = obj->vertex(i);
 
-			v.apply ([&](Axis ax, double& a)
+			v.apply([&](Axis ax, double& a)
 			{
-				if (sel.contains (ax))
+				if (sel.contains(ax))
 					a = -a;
 			});
 
-			obj->setVertex (i, v);
+			obj->setVertex(i, v);
 		}
 		if (not mo and sel.size() % 2 == 1)
             obj->invert();
@@ -311,16 +311,16 @@
 {
 	int num = 0;
 
-	for (LDObjectIterator<LDCondLine> it (selectedObjects()); it.isValid(); ++it)
+	for (LDObjectIterator<LDCondLine> it(selectedObjects()); it.isValid(); ++it)
 	{
 		it->toEdgeLine();
 		++num;
 	}
 
-	print (tr ("Converted %1 conditional lines"), num);
+	print(tr("Converted %1 conditional lines"), num);
 }
 
-bool AlgorithmToolset::isColorUsed (LDColor color)
+bool AlgorithmToolset::isColorUsed(LDColor color)
 {
 	for (LDObject* obj : currentDocument()->objects())
 	{
@@ -337,13 +337,13 @@
 
 	for (color = 0; color.isLDConfigColor(); ++color)
 	{
-		if (color.isValid() and not isColorUsed (color))
+		if (color.isValid() and not isColorUsed(color))
 			break;
 	}
 
 	if (not color.isLDConfigColor())
 	{
-		print (tr ("Cannot auto-color: all colors are in use!"));
+		print(tr("Cannot auto-color: all colors are in use!"));
 		return;
 	}
 
@@ -352,10 +352,10 @@
 		if (not obj->isColored())
 			continue;
 
-		obj->setColor (color);
+		obj->setColor(color);
 	}
 
-	print (tr ("Auto-colored: new color is [%1] %2"), color.index(), color.name());
+	print(tr("Auto-colored: new color is [%1] %2"), color.index(), color.name());
 }
 
 void AlgorithmToolset::addHistoryLine()
@@ -366,28 +366,28 @@
 
 	QDialog* dlg = new QDialog;
 	Ui_AddHistoryLine* ui = new Ui_AddHistoryLine;
-	ui->setupUi (dlg);
-	ui->m_username->setText (config.defaultUser());
-	ui->m_date->setDate (QDate::currentDate());
+	ui->setupUi(dlg);
+	ui->m_username->setText(config.defaultUser());
+	ui->m_date->setDate(QDate::currentDate());
 	ui->m_comment->setFocus();
 
 	if (not dlg->exec())
 		return;
 
 	// Create the comment object based on input
-	LDComment* comment = new LDComment (format ("!HISTORY %1 [%2] %3",
-		ui->m_date->date().toString ("yyyy-MM-dd"),
+	LDComment* comment = new LDComment(format("!HISTORY %1 [%2] %3",
+		ui->m_date->date().toString("yyyy-MM-dd"),
 		ui->m_username->text(),
 		ui->m_comment->text()));
 
 	// Find a spot to place the new comment
-	for (obj = currentDocument()->getObject (0);
+	for (obj = currentDocument()->getObject(0);
 		obj and obj->next() and not obj->next()->isScemantic();
 		obj = obj->next())
 	{
-		LDComment* comment = dynamic_cast<LDComment*> (obj);
+		LDComment* comment = dynamic_cast<LDComment*>(obj);
 
-		if (comment and comment->text().startsWith ("!HISTORY "))
+		if (comment and comment->text().startsWith("!HISTORY "))
 			ishistory = true;
 
 		if (prevIsHistory and not ishistory)
@@ -397,12 +397,12 @@
 	}
 
 	int idx = obj ? obj->lineNumber() : 0;
-	currentDocument()->insertObj (idx++, comment);
+	currentDocument()->insertObj(idx++, comment);
 
 	// If we're adding a history line right before a scemantic object, pad it
 	// an empty line
 	if (obj and obj->next() and obj->next()->isScemantic())
-		currentDocument()->insertObj (idx, new LDEmpty);
+		currentDocument()->insertObj(idx, new LDEmpty);
 
 	m_window->buildObjectList();
 	delete ui;
@@ -411,17 +411,17 @@
 void AlgorithmToolset::splitLines()
 {
 	bool ok;
-	int segments = QInputDialog::getInt (m_window, APPNAME, "Amount of segments:",
+	int segments = QInputDialog::getInt(m_window, APPNAME, "Amount of segments:",
 		config.splitLinesSegments(), 0, std::numeric_limits<int>::max(), 1, &ok);
 
 	if (not ok)
 		return;
 
-	config.setSplitLinesSegments (segments);
+	config.setSplitLinesSegments(segments);
 
 	for (LDObject* obj : selectedObjects())
 	{
-		if (not isOneOf (obj->type(), OBJ_Line, OBJ_CondLine))
+		if (not isOneOf(obj->type(), OBJ_Line, OBJ_CondLine))
 			continue;
 
 		QVector<LDObject*> newsegs;
@@ -431,22 +431,22 @@
 			LDObject* segment;
 			Vertex v0, v1;
 
-			v0.apply ([&](Axis ax, double& a)
+			v0.apply([&](Axis ax, double& a)
 			{
-				double len = obj->vertex (1)[ax] - obj->vertex (0)[ax];
-				a = (obj->vertex (0)[ax] + ((len * i) / segments));
+				double len = obj->vertex(1)[ax] - obj->vertex(0)[ax];
+				a = (obj->vertex(0)[ax] +((len * i) / segments));
 			});
 
-			v1.apply ([&](Axis ax, double& a)
+			v1.apply([&](Axis ax, double& a)
 			{
-				double len = obj->vertex (1)[ax] - obj->vertex (0)[ax];
-				a = (obj->vertex (0)[ax] + ((len * (i + 1)) / segments));
+				double len = obj->vertex(1)[ax] - obj->vertex(0)[ax];
+				a = (obj->vertex(0)[ax] +((len *(i + 1)) / segments));
 			});
 
 			if (obj->type() == OBJ_Line)
-				segment = LDSpawn<LDLine> (v0, v1);
+				segment = LDSpawn<LDLine>(v0, v1);
 			else
-				segment = LDSpawn<LDCondLine> (v0, v1, obj->vertex (2), obj->vertex (3));
+				segment = LDSpawn<LDCondLine>(v0, v1, obj->vertex(2), obj->vertex(3));
 
 			newsegs << segment;
 		}
@@ -454,7 +454,7 @@
 		int ln = obj->lineNumber();
 
 		for (LDObject* seg : newsegs)
-			currentDocument()->insertObj (ln++, seg);
+			currentDocument()->insertObj(ln++, seg);
 
 		obj->destroy();
 	}
@@ -468,31 +468,31 @@
 	if (selectedObjects().size() == 0)
 		return;
 
-	QString			parentpath (currentDocument()->fullPath());
+	QString			parentpath(currentDocument()->fullPath());
 
 	// BFC type of the new subfile - it shall inherit the BFC type of the parent document
-	BfcStatement	bfctype (BfcStatement::NoCertify);
+	BfcStatement	bfctype(BfcStatement::NoCertify);
 
 	// Dirname of the new subfile
-	QString			subdirname (Dirname (parentpath));
+	QString			subdirname(Dirname(parentpath));
 
 	// Title of the new subfile
 	QString			subtitle;
 
 	// Comment containing the title of the parent document
-	LDComment*	titleobj = dynamic_cast<LDComment*> (currentDocument()->getObject (0));
+	LDComment*	titleobj = dynamic_cast<LDComment*>(currentDocument()->getObject(0));
 
 	// License text for the subfile
-	QString			license (PreferredLicenseText());
+	QString			license(PreferredLicenseText());
 
-	// LDraw code body of the new subfile (i.e. code of the selection)
+	// LDraw code body of the new subfile(i.e. code of the selection)
 	QStringList		code;
 
 	// Full path of the subfile to be
 	QString			fullsubname;
 
 	// Where to insert the subfile reference?
-	int				refidx (selectedObjects()[0]->lineNumber());
+	int				refidx(selectedObjects()[0]->lineNumber());
 
 	// Determine title of subfile
 	if (titleobj)
@@ -501,24 +501,24 @@
 		subtitle = "~subfile";
 
 	// Remove duplicate tildes
-	while (subtitle.startsWith ("~~"))
-		subtitle.remove (0, 1);
+	while (subtitle.startsWith("~~"))
+		subtitle.remove(0, 1);
 
 	// If this the parent document isn't already in s/, we need to stuff it into
 	// a subdirectory named s/. Ensure it exists!
-	QString topdirname = Basename (Dirname (currentDocument()->fullPath()));
+	QString topdirname = Basename(Dirname(currentDocument()->fullPath()));
 
 	if (topdirname != "s")
 	{
 		QString desiredPath = subdirname + "/s";
-		QString title = tr ("Create subfile directory?");
-		QString text = format (tr ("The directory <b>%1</b> is suggested for "
+		QString title = tr("Create subfile directory?");
+		QString text = format(tr("The directory <b>%1</b> is suggested for "
 			"subfiles. This directory does not exist, create it?"), desiredPath);
 
-		if (QDir (desiredPath).exists() or Confirm (title, text))
+		if (QDir(desiredPath).exists() or Confirm(title, text))
 		{
 			subdirname = desiredPath;
-			QDir().mkpath (subdirname);
+			QDir().mkpath(subdirname);
 		}
 		else
 			return;
@@ -528,14 +528,14 @@
 	if (not parentpath.isEmpty())
 	{
 		// Chop existing '.dat' suffix
-		if (parentpath.endsWith (".dat"))
-			parentpath.chop (4);
+		if (parentpath.endsWith(".dat"))
+			parentpath.chop(4);
 
 		// Remove the s?? suffix if it's there, otherwise we'll get filenames
 		// like s01s01.dat when subfiling subfiles.
-		QRegExp subfilesuffix ("s[0-9][0-9]$");
-		if (subfilesuffix.indexIn (parentpath) != -1)
-			parentpath.chop (subfilesuffix.matchedLength());
+		QRegExp subfilesuffix("s[0-9][0-9]$");
+		if (subfilesuffix.indexIn(parentpath) != -1)
+			parentpath.chop(subfilesuffix.matchedLength());
 
 		int subidx = 1;
 		QString digits;
@@ -544,21 +544,21 @@
 		// until we find a name which isn't already taken.
 		do
 		{
-			digits.setNum (subidx++);
+			digits.setNum(subidx++);
 
 			// pad it with a zero
 			if (digits.length() == 1)
-				digits.prepend ("0");
+				digits.prepend("0");
 
-			fullsubname = subdirname + "/" + Basename (parentpath) + "s" + digits + ".dat";
-		} while (m_documents->findDocumentByName ("s\\" + Basename (fullsubname)) or QFile (fullsubname).exists());
+			fullsubname = subdirname + "/" + Basename(parentpath) + "s" + digits + ".dat";
+		} while (m_documents->findDocumentByName("s\\" + Basename(fullsubname)) or QFile(fullsubname).exists());
 	}
 
 	// Determine the BFC winding type used in the main document - it is to
 	// be carried over to the subfile.
-	for (LDObjectIterator<LDBfc> it (currentDocument()); it.isValid(); ++it)
+	for (LDObjectIterator<LDBfc> it(currentDocument()); it.isValid(); ++it)
 	{
-		if (isOneOf (it->statement(), BfcStatement::CertifyCCW, BfcStatement::CertifyCW, BfcStatement::NoCertify))
+		if (isOneOf(it->statement(), BfcStatement::CertifyCCW, BfcStatement::CertifyCW, BfcStatement::NoCertify))
 		{
 			bfctype = it->statement();
 			break;
@@ -572,33 +572,33 @@
 	// Create the new subfile document
 	LDDocument* doc = m_window->newDocument();
 	doc->openForEditing();
-	doc->setFullPath (fullsubname);
-	doc->setName (LDDocument::shortenName (fullsubname));
+	doc->setFullPath(fullsubname);
+	doc->setName(LDDocument::shortenName(fullsubname));
 
 	LDObjectList objs;
-	objs << LDSpawn<LDComment> (subtitle);
-	objs << LDSpawn<LDComment> ("Name: "); // This gets filled in when the subfile is saved
-	objs << LDSpawn<LDComment> (format ("Author: %1 [%2]", config.defaultName(), config.defaultUser()));
-	objs << LDSpawn<LDComment> ("!LDRAW_ORG Unofficial_Subpart");
+	objs << LDSpawn<LDComment>(subtitle);
+	objs << LDSpawn<LDComment>("Name: "); // This gets filled in when the subfile is saved
+	objs << LDSpawn<LDComment>(format("Author: %1 [%2]", config.defaultName(), config.defaultUser()));
+	objs << LDSpawn<LDComment>("!LDRAW_ORG Unofficial_Subpart");
 
 	if (not license.isEmpty())
-		objs << LDSpawn<LDComment> (license);
+		objs << LDSpawn<LDComment>(license);
 
 	objs << LDSpawn<LDEmpty>();
-	objs << LDSpawn<LDBfc> (bfctype);
+	objs << LDSpawn<LDBfc>(bfctype);
 	objs << LDSpawn<LDEmpty>();
 
-	doc->addObjects (objs);
+	doc->addObjects(objs);
 
 	// Add the actual subfile code to the new document
 	for (QString line : code)
 	{
-		LDObject* obj = ParseLine (line);
-		doc->addObject (obj);
+		LDObject* obj = ParseLine(line);
+		doc->addObject(obj);
 	}
 
 	// Try save it
-	if (m_window->save (doc, true))
+	if (m_window->save(doc, true))
 	{
 		// Save was successful. Delete the original selection now from the
 		// main document.
@@ -607,11 +607,11 @@
 
 		// Add a reference to the new subfile to where the selection was
 		LDSubfileReference* ref = LDSpawn<LDSubfileReference>();
-		ref->setColor (MainColor);
-		ref->setFileInfo (doc);
-		ref->setPosition (Origin);
-		ref->setTransform (IdentityMatrix);
-		currentDocument()->insertObj (refidx, ref);
+		ref->setColor(MainColor);
+		ref->setFileInfo(doc);
+		ref->setPosition(Origin);
+		ref->setTransform(IdentityMatrix);
+		currentDocument()->insertObj(refidx, ref);
 
 		// Refresh stuff
 		m_window->updateDocumentList();
--- a/src/toolsets/algorithmtoolset.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/algorithmtoolset.h	Thu Jan 04 19:44:26 2018 +0200
@@ -23,7 +23,7 @@
 {
 	Q_OBJECT
 public:
-	explicit AlgorithmToolset (MainWindow* parent);
+	explicit AlgorithmToolset(MainWindow* parent);
 
 	Q_INVOKABLE void addHistoryLine();
 	Q_INVOKABLE void autocolor();
@@ -38,5 +38,5 @@
 	Q_INVOKABLE void subfileSelection();
 
 private:
-	bool isColorUsed (class LDColor color);
+	bool isColorUsed(class LDColor color);
 };
\ No newline at end of file
--- a/src/toolsets/basictoolset.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/basictoolset.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -31,8 +31,8 @@
 #include "../dialogs/colorselector.h"
 #include "basictoolset.h"
 
-BasicToolset::BasicToolset (MainWindow *parent) :
-	Toolset (parent) {}
+BasicToolset::BasicToolset(MainWindow *parent) :
+	Toolset(parent) {}
 
 int BasicToolset::copyToClipboard()
 {
@@ -50,7 +50,7 @@
 		++count;
 	}
 
-	qApp->clipboard()->setText (data);
+	qApp->clipboard()->setText(data);
 	return count;
 }
 
@@ -58,13 +58,13 @@
 {
 	int num = copyToClipboard();
 	m_window->deleteSelection();
-	print (tr ("%1 objects cut"), num);
+	print(tr("%1 objects cut"), num);
 }
 
 void BasicToolset::copy()
 {
 	int num = copyToClipboard();
-	print (tr ("%1 objects copied"), num);
+	print(tr("%1 objects copied"), num);
 }
 
 void BasicToolset::paste()
@@ -74,15 +74,15 @@
 	currentDocument()->clearSelection();
 	int num = 0;
 
-	for (QString line : clipboardText.split ("\n"))
+	for (QString line : clipboardText.split("\n"))
 	{
-		LDObject* pasted = ParseLine (line);
-		currentDocument()->insertObj (idx++, pasted);
+		LDObject* pasted = ParseLine(line);
+		currentDocument()->insertObj(idx++, pasted);
 		pasted->select();
 		++num;
 	}
 
-	print (tr ("%1 objects pasted"), num);
+	print(tr("%1 objects pasted"), num);
 	m_window->refresh();
 	m_window->scrollToSelection();
 }
@@ -90,12 +90,12 @@
 void BasicToolset::remove()
 {
 	int num = m_window->deleteSelection();
-	print (tr ("%1 objects deleted"), num);
+	print(tr("%1 objects deleted"), num);
 }
 
-void BasicToolset::doInline (bool deep)
+void BasicToolset::doInline(bool deep)
 {
-	for (LDSubfileReference* ref : filterByType<LDSubfileReference> (selectedObjects()))
+	for (LDSubfileReference* ref : filterByType<LDSubfileReference>(selectedObjects()))
 	{
 		// Get the index of the subfile so we know where to insert the
 		// inlined contents.
@@ -103,15 +103,15 @@
 
 		if (idx != -1)
 		{
-			LDObjectList objs = ref->inlineContents (deep, false);
+			LDObjectList objs = ref->inlineContents(deep, false);
 	
 			// Merge in the inlined objects
 			for (LDObject* inlineobj : objs)
 			{
 				QString line = inlineobj->asText();
 				inlineobj->destroy();
-				LDObject* newobj = ParseLine (line);
-				currentDocument()->insertObj (idx++, newobj);
+				LDObject* newobj = ParseLine(line);
+				currentDocument()->insertObj(idx++, newobj);
 				newobj->select();
 			}
 	
@@ -120,18 +120,18 @@
 		}
 	}
 
-	for (LDBezierCurve* curve : filterByType<LDBezierCurve> (selectedObjects()))
-		curve->replace (curve->rasterize());
+	for (LDBezierCurve* curve : filterByType<LDBezierCurve>(selectedObjects()))
+		curve->replace(curve->rasterize());
 }
 
 void BasicToolset::inlineShallow()
 {
-	doInline (false);
+	doInline(false);
 }
 
 void BasicToolset::inlineDeep()
 {
-	doInline (true);
+	doInline(true);
 }
 
 void BasicToolset::undo()
@@ -153,11 +153,11 @@
 		if (not obj->isColored())
 			continue;
 
-		obj->setColor (obj->defaultColor());
+		obj->setColor(obj->defaultColor());
 		num++;
 	}
 
-	print (tr ("%1 objects uncolored"), num);
+	print(tr("%1 objects uncolored"), num);
 }
 
 void BasicToolset::insertRaw()
@@ -167,25 +167,25 @@
 	QDialog* const dlg = new QDialog;
 	QVBoxLayout* const layout = new QVBoxLayout;
 	QTextEdit* const inputbox = new QTextEdit;
-	QDialogButtonBox* const buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+	QDialogButtonBox* const buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
 
-	layout->addWidget (inputbox);
-	layout->addWidget (buttons);
-	dlg->setLayout (layout);
-	dlg->setWindowTitle (APPNAME " - Insert Raw");
-	dlg->connect (buttons, SIGNAL (accepted()), dlg, SLOT (accept()));
-	dlg->connect (buttons, SIGNAL (rejected()), dlg, SLOT (reject()));
+	layout->addWidget(inputbox);
+	layout->addWidget(buttons);
+	dlg->setLayout(layout);
+	dlg->setWindowTitle(APPNAME " - Insert Raw");
+	dlg->connect(buttons, SIGNAL(accepted()), dlg, SLOT(accept()));
+	dlg->connect(buttons, SIGNAL(rejected()), dlg, SLOT(reject()));
 
 	if (dlg->exec() == QDialog::Rejected)
 		return;
 
 	currentDocument()->clearSelection();
 
-	for (QString line : QString (inputbox->toPlainText()).split ("\n"))
+	for (QString line : QString(inputbox->toPlainText()).split("\n"))
 	{
-		LDObject* obj = ParseLine (line);
+		LDObject* obj = ParseLine(line);
 
-		currentDocument()->insertObj (idx, obj);
+		currentDocument()->insertObj(idx, obj);
 		obj->select();
 		idx++;
 	}
@@ -207,12 +207,12 @@
 	LDColor defaultcol = m_window->getUniformSelectedColor();
 
 	// Show the dialog to the user now and ask for a color.
-	if (ColorSelector::selectColor (m_window, color, defaultcol))
+	if (ColorSelector::selectColor(m_window, color, defaultcol))
 	{
 		for (LDObject* obj : objs)
 		{
 			if (obj->isColored())
-				obj->setColor (color);
+				obj->setColor(color);
 		}
 	}
 }
@@ -225,37 +225,37 @@
 
 void BasicToolset::newSubfile()
 {
-	AddObjectDialog::staticDialog (OBJ_SubfileReference, nullptr);
+	AddObjectDialog::staticDialog(OBJ_SubfileReference, nullptr);
 }
 
 void BasicToolset::newLine()
 {
-	AddObjectDialog::staticDialog (OBJ_Line, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Line, nullptr);
 }
 
 void BasicToolset::newTriangle()
 {
-	AddObjectDialog::staticDialog (OBJ_Triangle, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Triangle, nullptr);
 }
 
 void BasicToolset::newQuadrilateral()
 {
-	AddObjectDialog::staticDialog (OBJ_Quad, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Quad, nullptr);
 }
 
 void BasicToolset::newConditionalLine()
 {
-	AddObjectDialog::staticDialog (OBJ_CondLine, nullptr);
+	AddObjectDialog::staticDialog(OBJ_CondLine, nullptr);
 }
 
 void BasicToolset::newComment()
 {
-	AddObjectDialog::staticDialog (OBJ_Comment, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Comment, nullptr);
 }
 
 void BasicToolset::newBFC()
 {
-	AddObjectDialog::staticDialog (OBJ_Bfc, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Bfc, nullptr);
 }
 
 void BasicToolset::edit()
@@ -264,40 +264,40 @@
 		return;
 
 	LDObject* obj = selectedObjects().first();
-	AddObjectDialog::staticDialog (obj->type(), obj);
+	AddObjectDialog::staticDialog(obj->type(), obj);
 }
 
 void BasicToolset::modeSelect()
 {
-	m_window->renderer()->setEditMode (EditModeType::Select);
+	m_window->renderer()->setEditMode(EditModeType::Select);
 }
 
 void BasicToolset::modeCurve()
 {
-	m_window->renderer()->setEditMode (EditModeType::Curve);
+	m_window->renderer()->setEditMode(EditModeType::Curve);
 }
 
 void BasicToolset::modeDraw()
 {
-	m_window->renderer()->setEditMode (EditModeType::Draw);
+	m_window->renderer()->setEditMode(EditModeType::Draw);
 }
 
 void BasicToolset::modeRectangle()
 {
-	m_window->renderer()->setEditMode (EditModeType::Rectangle);
+	m_window->renderer()->setEditMode(EditModeType::Rectangle);
 }
 
 void BasicToolset::modeCircle()
 {
-	m_window->renderer()->setEditMode (EditModeType::Circle);
+	m_window->renderer()->setEditMode(EditModeType::Circle);
 }
 
 void BasicToolset::modeMagicWand()
 {
- 	m_window->renderer()->setEditMode (EditModeType::MagicWand);
+ 	m_window->renderer()->setEditMode(EditModeType::MagicWand);
 }
 
 void BasicToolset::modeLinePath()
 {
-	m_window->renderer()->setEditMode (EditModeType::LinePath);
+	m_window->renderer()->setEditMode(EditModeType::LinePath);
 }
\ No newline at end of file
--- a/src/toolsets/basictoolset.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/basictoolset.h	Thu Jan 04 19:44:26 2018 +0200
@@ -24,7 +24,7 @@
 	Q_OBJECT
 
 public:
-	BasicToolset (MainWindow *parent);
+	BasicToolset(MainWindow *parent);
 
 	Q_INVOKABLE void copy();
 	Q_INVOKABLE void cut();
@@ -56,5 +56,5 @@
 
 private:
 	int copyToClipboard();
-	void doInline (bool deep);
+	void doInline(bool deep);
 };
--- a/src/toolsets/extprogramtoolset.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/extprogramtoolset.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -45,21 +45,21 @@
 
 // =============================================================================
 //
-ConfigOption (QString IsecalcPath)
-ConfigOption (QString IntersectorPath)
-ConfigOption (QString CovererPath)
-ConfigOption (QString RectifierPath)
-ConfigOption (QString YtruderPath)
-ConfigOption (QString Edger2Path)
-ConfigOption (bool IsecalcUsesWine = false)
-ConfigOption (bool IntersectorUsesWine = false)
-ConfigOption (bool CovererUsesWine = false)
-ConfigOption (bool YtruderUsesWine = false)
-ConfigOption (bool RectifierUsesWine = false)
-ConfigOption (bool Edger2UsesWine = false)
+ConfigOption(QString IsecalcPath)
+ConfigOption(QString IntersectorPath)
+ConfigOption(QString CovererPath)
+ConfigOption(QString RectifierPath)
+ConfigOption(QString YtruderPath)
+ConfigOption(QString Edger2Path)
+ConfigOption(bool IsecalcUsesWine = false)
+ConfigOption(bool IntersectorUsesWine = false)
+ConfigOption(bool CovererUsesWine = false)
+ConfigOption(bool YtruderUsesWine = false)
+ConfigOption(bool RectifierUsesWine = false)
+ConfigOption(bool Edger2UsesWine = false)
 
-ExtProgramToolset::ExtProgramToolset (MainWindow* parent) :
-	Toolset (parent)
+ExtProgramToolset::ExtProgramToolset(MainWindow* parent) :
+	Toolset(parent)
 {
 	extProgramInfo[Isecalc].name = "Isecalc";
 	extProgramInfo[Intersector].name = "Intersector";
@@ -69,7 +69,7 @@
 	extProgramInfo[Edger2].name = "Edger2";
 }
 
-bool ExtProgramToolset::makeTempFile (QTemporaryFile& tmp, QString& fname)
+bool ExtProgramToolset::makeTempFile(QTemporaryFile& tmp, QString& fname)
 {
 	if (not tmp.open())
 		return false;
@@ -79,52 +79,52 @@
 	return true;
 }
 
-bool ExtProgramToolset::programUsesWine (ExtProgramType program)
+bool ExtProgramToolset::programUsesWine(ExtProgramType program)
 {
 #ifndef Q_OS_WIN32
-	return getWineSetting (program);
+	return getWineSetting(program);
 #else
 	return false;
 #endif
 }
 
-bool ExtProgramToolset::getWineSetting (ExtProgramType program)
+bool ExtProgramToolset::getWineSetting(ExtProgramType program)
 {
-	return m_window->getConfigValue (externalProgramName (program) + "UsesWine").toBool();
+	return m_window->getConfigValue(externalProgramName(program) + "UsesWine").toBool();
 }
 
-QString ExtProgramToolset::getPathSetting (ExtProgramType program)
+QString ExtProgramToolset::getPathSetting(ExtProgramType program)
 {
-	return m_window->getConfigValue (externalProgramName (program) + "Path").toString();
+	return m_window->getConfigValue(externalProgramName(program) + "Path").toString();
 }
 
-void ExtProgramToolset::setPathSetting (ExtProgramType program, QString value)
+void ExtProgramToolset::setPathSetting(ExtProgramType program, QString value)
 {
-	m_window->getSettings()->setValue (externalProgramName (program) + "Path", QVariant::fromValue (value));
+	m_window->getSettings()->setValue(externalProgramName(program) + "Path", QVariant::fromValue(value));
 }
 
-void ExtProgramToolset::setWineSetting (ExtProgramType program, bool value)
+void ExtProgramToolset::setWineSetting(ExtProgramType program, bool value)
 {
-	m_window->getSettings()->setValue (externalProgramName (program) + "UsesWine", QVariant::fromValue (value));
+	m_window->getSettings()->setValue(externalProgramName(program) + "UsesWine", QVariant::fromValue(value));
 }
 
-QString ExtProgramToolset::externalProgramName (ExtProgramType program)
+QString ExtProgramToolset::externalProgramName(ExtProgramType program)
 {
 	return extProgramInfo[program].name;
 }
 
-bool ExtProgramToolset::checkExtProgramPath (ExtProgramType program)
+bool ExtProgramToolset::checkExtProgramPath(ExtProgramType program)
 {
-	QString path = getPathSetting (program);
+	QString path = getPathSetting(program);
 
 	if (not path.isEmpty())
 		return true;
 
-	ExtProgPathPrompt* dialog = new ExtProgPathPrompt (externalProgramName (program));
+	ExtProgPathPrompt* dialog = new ExtProgPathPrompt(externalProgramName(program));
 
 	if (dialog->exec() and not dialog->getPath().isEmpty())
 	{
-		setPathSetting (program, dialog->getPath());
+		setPathSetting(program, dialog->getPath());
 		return true;
 	}
 
@@ -133,28 +133,28 @@
 
 // =============================================================================
 //
-QString ExtProgramToolset::errorCodeString (ExtProgramType program, QProcess& process)
+QString ExtProgramToolset::errorCodeString(ExtProgramType program, QProcess& process)
 {
-	switch (process.error())
+	switch(process.error())
 	{
 	case QProcess::FailedToStart:
-		if (programUsesWine (program))
-			return tr ("Program failed to start, make sure that Wine is installed and check your permissions.");
+		if (programUsesWine(program))
+			return tr("Program failed to start, make sure that Wine is installed and check your permissions.");
 
-		return tr ("Program failed to start, %1check your permissions");
+		return tr("Program failed to start, %1check your permissions");
 
 	case QProcess::Crashed:
-		return tr ("Crashed.");
+		return tr("Crashed.");
 
 	case QProcess::WriteError:
 	case QProcess::ReadError:
-		return tr ("I/O error.");
+		return tr("I/O error.");
 
 	case QProcess::UnknownError:
-		return tr ("Unknown error");
+		return tr("Unknown error");
 
 	case QProcess::Timedout:
-		return tr ("Timed out (30 seconds)");
+		return tr("Timed out(30 seconds)");
 	}
 
 	return "";
@@ -162,64 +162,64 @@
 
 // =============================================================================
 //
-void ExtProgramToolset::writeObjects (const LDObjectList& objects, QFile& f)
+void ExtProgramToolset::writeObjects(const LDObjectList& objects, QFile& f)
 {
 	for (LDObject* obj : objects)
 	{
 		if (obj->type() == OBJ_SubfileReference)
 		{
-			LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj);
-			LDObjectList objs = ref->inlineContents (true, false);
-			writeObjects (objs, f);
+			LDSubfileReference* ref = static_cast<LDSubfileReference*>(obj);
+			LDObjectList objs = ref->inlineContents(true, false);
+			writeObjects(objs, f);
 
 			for (LDObject* obj : objs)
 				obj->destroy();
 		}
 		else if (obj->type() == OBJ_BezierCurve)
 		{
-			LDBezierCurve* curve = static_cast<LDBezierCurve*> (obj);
+			LDBezierCurve* curve = static_cast<LDBezierCurve*>(obj);
 			LDObjectList objs = curve->rasterize();
-			writeObjects (objs, f);
+			writeObjects(objs, f);
 
 			for (LDObject* obj : objs)
 				obj->destroy();
 		}
 		else
-			f.write ((obj->asText() + "\r\n").toUtf8());
+			f.write((obj->asText() + "\r\n").toUtf8());
 	}
 }
 
 // =============================================================================
 //
-void ExtProgramToolset::writeObjects (const LDObjectList& objects, QString fname)
+void ExtProgramToolset::writeObjects(const LDObjectList& objects, QString fname)
 {
 	// Write the input file
-	QFile f (fname);
+	QFile f(fname);
 
-	if (not f.open (QIODevice::WriteOnly | QIODevice::Text))
+	if (not f.open(QIODevice::WriteOnly | QIODevice::Text))
 	{
-		Critical (format ("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString()));
+		Critical(format("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString()));
 		return;
 	}
 
-	writeObjects (objects, f);
+	writeObjects(objects, f);
 	f.close();
 
 #ifdef DEBUG
-	QFile::copy (fname, "debug_lastInput");
+	QFile::copy(fname, "debug_lastInput");
 #endif
 }
 
 // =============================================================================
 //
-void ExtProgramToolset::writeSelection (QString fname)
+void ExtProgramToolset::writeSelection(QString fname)
 {
-	writeObjects (selectedObjects(), fname);
+	writeObjects(selectedObjects(), fname);
 }
 
 // =============================================================================
 //
-void ExtProgramToolset::writeColorGroup (LDColor color, QString fname)
+void ExtProgramToolset::writeColorGroup(LDColor color, QString fname)
 {
 	LDObjectList objects;
 
@@ -231,26 +231,26 @@
 		objects << obj;
 	}
 
-	writeObjects (objects, fname);
+	writeObjects(objects, fname);
 }
 
 // =============================================================================
 //
-bool ExtProgramToolset::runExtProgram (ExtProgramType program, QString argvstr)
+bool ExtProgramToolset::runExtProgram(ExtProgramType program, QString argvstr)
 {
-	QString path = getPathSetting (program);
+	QString path = getPathSetting(program);
 	QTemporaryFile input;
-	QStringList argv = argvstr.split (" ", QString::SkipEmptyParts);
+	QStringList argv = argvstr.split(" ", QString::SkipEmptyParts);
 
 #ifndef Q_OS_WIN32
-	if (programUsesWine (program))
+	if (programUsesWine(program))
 	{
-		argv.insert (0, path);
+		argv.insert(0, path);
 		path = "wine";
 	}
 #endif // Q_OS_WIN32
 
-	print ("Running command: %1 %2\n", path, argv.join (" "));
+	print("Running command: %1 %2\n", path, argv.join(" "));
 
 	if (not input.open())
 		return false;
@@ -258,18 +258,18 @@
 	QProcess process;
 
 	// Begin!
-	process.setStandardInputFile (input.fileName());
-	process.start (path, argv);
+	process.setStandardInputFile(input.fileName());
+	process.start(path, argv);
 
 	if (not process.waitForStarted())
 	{
-		Critical (format ("Couldn't start %1: %2\n", externalProgramName (program),
-			errorCodeString (program, process)));
+		Critical(format("Couldn't start %1: %2\n", externalProgramName(program),
+			errorCodeString(program, process)));
 		return false;
 	}
 
 	// Write an enter, the utility tools all expect one
-	input.write ("\n");
+	input.write("\n");
 
 	// Wait while it runs
 	process.waitForFinished();
@@ -277,28 +277,28 @@
 	QString err = "";
 
 	if (process.exitStatus() != QProcess::NormalExit)
-		err = errorCodeString (program, process);
+		err = errorCodeString(program, process);
 
 	// Check the return code
 	if (process.exitCode() != 0)
-		err = format ("Program exited abnormally (return code %1).",  process.exitCode());
+		err = format("Program exited abnormally(return code %1).",  process.exitCode());
 
 	if (not err.isEmpty())
 	{
-		Critical (format ("%1 failed: %2\n", externalProgramName (program), err));
-		QString filename ("externalProgramOutput.txt");
-		QFile file (filename);
+		Critical(format("%1 failed: %2\n", externalProgramName(program), err));
+		QString filename("externalProgramOutput.txt");
+		QFile file(filename);
 
-		if (file.open (QIODevice::WriteOnly | QIODevice::Text))
+		if (file.open(QIODevice::WriteOnly | QIODevice::Text))
 		{
-			file.write (process.readAllStandardOutput());
-			file.write (process.readAllStandardError());
-			print ("Wrote output and error logs to %1", QFileInfo (file).absoluteFilePath());
+			file.write(process.readAllStandardOutput());
+			file.write(process.readAllStandardError());
+			print("Wrote output and error logs to %1", QFileInfo(file).absoluteFilePath());
 		}
 		else
 		{
-			print ("Couldn't open %1 for writing: %2",
-				QFileInfo (filename).absoluteFilePath(), file.errorString());
+			print("Couldn't open %1 for writing: %2",
+				QFileInfo(filename).absoluteFilePath(), file.errorString());
 		}
 
 		return false;
@@ -309,31 +309,31 @@
 
 // =============================================================================
 //
-void ExtProgramToolset::insertOutput (QString fname, bool replace, QList<LDColor> colorsToReplace)
+void ExtProgramToolset::insertOutput(QString fname, bool replace, QList<LDColor> colorsToReplace)
 {
 #ifdef DEBUG
-	QFile::copy (fname, "./debug_lastOutput");
+	QFile::copy(fname, "./debug_lastOutput");
 #endif
 
 	// Read the output file
-	QFile f (fname);
+	QFile f(fname);
 
-	if (not f.open (QIODevice::ReadOnly))
+	if (not f.open(QIODevice::ReadOnly))
 	{
-		Critical (format ("Couldn't open temporary file %1 for reading.\n", fname));
+		Critical(format("Couldn't open temporary file %1 for reading.\n", fname));
 		return;
 	}
 
 	// TODO: I don't like how I need to go to the document manager to load objects from a file...
 	// We're not loading this as a document so it shouldn't be necessary.
-	LDObjectList objs = m_documents->loadFileContents (&f, nullptr, nullptr);
+	LDObjectList objs = m_documents->loadFileContents(&f, nullptr, nullptr);
 
 	// If we replace the objects, delete the selection now.
 	if (replace)
 		m_window->deleteSelection();
 
 	for (LDColor color : colorsToReplace)
-		m_window->deleteByColor (color);
+		m_window->deleteByColor(color);
 
 	// Insert the new objects
 	currentDocument()->clearSelection();
@@ -346,7 +346,7 @@
 			continue;
 		}
 
-		currentDocument()->addObject (obj);
+		currentDocument()->addObject(obj);
 		obj->select();
 	}
 
@@ -358,14 +358,14 @@
 // =============================================================================
 void ExtProgramToolset::ytruder()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Ytruder))
+	if (not checkExtProgramPath(Ytruder))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::YtruderUI ui;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
 	if (not dlg->exec())
 		return;
@@ -387,14 +387,14 @@
 	QString inDATName, outDATName;
 
 	// Make temp files for the input and output files
-	if (not makeTempFile (indat, inDATName) or not makeTempFile (outdat, outDATName))
+	if (not makeTempFile(indat, inDATName) or not makeTempFile(outdat, outDATName))
 		return;
 
 	// Compose the command-line arguments
-	QString argv = Join (
+	QString argv = Join(
 	{
-		(axis == X) ? "-x" : (axis == Y) ? "-y" : "-z",
-		(mode == Distance) ? "-d" : (mode == Symmetry) ? "-s" : (mode == Projection) ? "-p" : "-r",
+		(axis == X) ? "-x" :(axis == Y) ? "-y" : "-z",
+		(mode == Distance) ? "-d" :(mode == Symmetry) ? "-s" :(mode == Projection) ? "-p" : "-r",
 		depth,
 		"-a",
 		condAngle,
@@ -402,12 +402,12 @@
 		outDATName
 	});
 
-	writeSelection (inDATName);
+	writeSelection(inDATName);
 
-	if (not runExtProgram (Ytruder, argv))
+	if (not runExtProgram(Ytruder, argv))
 		return;
 
-	insertOutput (outDATName, false, {});
+	insertOutput(outDATName, false, {});
 }
 
 // =============================================================================
@@ -415,14 +415,14 @@
 // =============================================================================
 void ExtProgramToolset::rectifier()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Rectifier))
+	if (not checkExtProgramPath(Rectifier))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::RectifierUI ui;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
 	if (not dlg->exec())
 		return;
@@ -431,11 +431,11 @@
 	QString inDATName, outDATName;
 
 	// Make temp files for the input and output files
-	if (not makeTempFile (indat, inDATName) or not makeTempFile (outdat, outDATName))
+	if (not makeTempFile(indat, inDATName) or not makeTempFile(outdat, outDATName))
 		return;
 
 	// Compose arguments
-	QString argv = Join (
+	QString argv = Join(
 	{
 		(not ui.cb_condense->isChecked()) ? "-q" : "",
 		(not ui.cb_subst->isChecked()) ? "-r" : "",
@@ -447,12 +447,12 @@
 		outDATName
 	});
 
-	writeSelection (inDATName);
+	writeSelection(inDATName);
 
-	if (not runExtProgram (Rectifier, argv))
+	if (not runExtProgram(Rectifier, argv))
 		return;
 
-	insertOutput (outDATName, true, {});
+	insertOutput(outDATName, true, {});
 }
 
 // =============================================================================
@@ -460,19 +460,19 @@
 // =============================================================================
 void ExtProgramToolset::intersector()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Intersector))
+	if (not checkExtProgramPath(Intersector))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::IntersectorUI ui;
-	ui.setupUi (dlg);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_incol);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_cutcol);
-	ui.cb_repeat->setWhatsThis ("If this is set, " APPNAME " runs Intersector a second time with inverse files to cut "
+	ui.setupUi(dlg);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_incol);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_cutcol);
+	ui.cb_repeat->setWhatsThis("If this is set, " APPNAME " runs Intersector a second time with inverse files to cut "
 								" the cutter group with the input group. Both groups are cut by the intersection.");
-	ui.cb_edges->setWhatsThis ("Makes " APPNAME " try run Isecalc to create edgelines for the intersection.");
+	ui.cb_edges->setWhatsThis("Makes " APPNAME " try run Isecalc to create edgelines for the intersection.");
 
 	LDColor inCol, cutCol;
 	const bool repeatInverse = ui.cb_repeat->isChecked();
@@ -482,12 +482,12 @@
 		if (not dlg->exec())
 			return;
 
-		inCol = ui.cmb_incol->itemData (ui.cmb_incol->currentIndex()).toInt();
-		cutCol = ui.cmb_cutcol->itemData (ui.cmb_cutcol->currentIndex()).toInt();
+		inCol = ui.cmb_incol->itemData(ui.cmb_incol->currentIndex()).toInt();
+		cutCol = ui.cmb_cutcol->itemData(ui.cmb_cutcol->currentIndex()).toInt();
 
 		if (inCol == cutCol)
 		{
-			Critical ("Cannot use the same color group for both input and cutter!");
+			Critical("Cannot use the same color group for both input and cutter!");
 			continue;
 		}
 
@@ -499,20 +499,20 @@
 	// cutdat = cutter group file
 	// outdat = primary output
 	// outdat2 = inverse output
-	// edgesdat = edges output (isecalc)
+	// edgesdat = edges output(isecalc)
 	QTemporaryFile indat, cutdat, outdat, outdat2, edgesdat;
 	QString inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName;
 
-	if (not makeTempFile (indat, inDATName) or
-		not makeTempFile (cutdat, cutDATName) or
-		not makeTempFile (outdat, outDATName) or
-		not makeTempFile (outdat2, outDAT2Name) or
-		not makeTempFile (edgesdat, edgesDATName))
+	if (not makeTempFile(indat, inDATName) or
+		not makeTempFile(cutdat, cutDATName) or
+		not makeTempFile(outdat, outDATName) or
+		not makeTempFile(outdat2, outDAT2Name) or
+		not makeTempFile(edgesdat, edgesDATName))
 	{
 		return;
 	}
 
-	QString parms = Join (
+	QString parms = Join(
 	{
 		(ui.cb_colorize->isChecked()) ? "-c" : "",
 		(ui.cb_nocondense->isChecked()) ? "-t" : "",
@@ -520,7 +520,7 @@
 		ui.dsb_prescale->value()
 	});
 
-	QString argv_normal = Join (
+	QString argv_normal = Join(
 	{
 		parms,
 		inDATName,
@@ -528,7 +528,7 @@
 		outDATName
 	});
 
-	QString argv_inverse = Join (
+	QString argv_inverse = Join(
 	{
 		parms,
 		cutDATName,
@@ -536,22 +536,22 @@
 		outDAT2Name
 	});
 
-	writeColorGroup (inCol, inDATName);
-	writeColorGroup (cutCol, cutDATName);
+	writeColorGroup(inCol, inDATName);
+	writeColorGroup(cutCol, cutDATName);
 
-	if (not runExtProgram (Intersector, argv_normal))
+	if (not runExtProgram(Intersector, argv_normal))
 		return;
 
-	insertOutput (outDATName, false, {inCol});
+	insertOutput(outDATName, false, {inCol});
 
-	if (repeatInverse and runExtProgram (Intersector, argv_inverse))
-		insertOutput (outDAT2Name, false, {cutCol});
+	if (repeatInverse and runExtProgram(Intersector, argv_inverse))
+		insertOutput(outDAT2Name, false, {cutCol});
 
 	if (ui.cb_edges->isChecked()
-		and checkExtProgramPath (Isecalc)
-		and runExtProgram (Isecalc, Join ({inDATName, cutDATName, edgesDATName})))
+		and checkExtProgramPath(Isecalc)
+		and runExtProgram(Isecalc, Join({inDATName, cutDATName, edgesDATName})))
 	{
-		insertOutput (edgesDATName, false, {});
+		insertOutput(edgesDATName, false, {});
 	}
 }
 
@@ -559,16 +559,16 @@
 //
 void ExtProgramToolset::coverer()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Coverer))
+	if (not checkExtProgramPath(Coverer))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::CovererUI ui;
-	ui.setupUi (dlg);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col1);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col2);
+	ui.setupUi(dlg);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_col1);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_col2);
 
 	LDColor in1Col, in2Col;
 
@@ -577,12 +577,12 @@
 		if (not dlg->exec())
 			return;
 
-		in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt();
-		in2Col = ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt();
+		in1Col = ui.cmb_col1->itemData(ui.cmb_col1->currentIndex()).toInt();
+		in2Col = ui.cmb_col2->itemData(ui.cmb_col2->currentIndex()).toInt();
 
 		if (in1Col == in2Col)
 		{
-			Critical ("Cannot use the same color group for both inputs!");
+			Critical("Cannot use the same color group for both inputs!");
 			continue;
 		}
 
@@ -592,48 +592,48 @@
 	QTemporaryFile in1dat, in2dat, outdat;
 	QString in1DATName, in2DATName, outDATName;
 
-	if (not makeTempFile (in1dat, in1DATName) or
-		not makeTempFile (in2dat, in2DATName) or
-		not makeTempFile (outdat, outDATName))
+	if (not makeTempFile(in1dat, in1DATName) or
+		not makeTempFile(in2dat, in2DATName) or
+		not makeTempFile(outdat, outDATName))
 	{
 		return;
 	}
 
-	QString argv = Join (
+	QString argv = Join(
 	{
 		(ui.cb_oldsweep->isChecked() ? "-s" : ""),
 		(ui.cb_reverse->isChecked() ? "-r" : ""),
-		(ui.dsb_segsplit->value() != 0 ? format ("-l %1", ui.dsb_segsplit->value()) : ""),
-		(ui.sb_bias->value() != 0 ? format ("-s %1", ui.sb_bias->value()) : ""),
+		(ui.dsb_segsplit->value() != 0 ? format("-l %1", ui.dsb_segsplit->value()) : ""),
+		(ui.sb_bias->value() != 0 ? format("-s %1", ui.sb_bias->value()) : ""),
 		in1DATName,
 		in2DATName,
 		outDATName
 	});
 
-	writeColorGroup (in1Col, in1DATName);
-	writeColorGroup (in2Col, in2DATName);
+	writeColorGroup(in1Col, in1DATName);
+	writeColorGroup(in2Col, in2DATName);
 
-	if (not runExtProgram (Coverer, argv))
+	if (not runExtProgram(Coverer, argv))
 		return;
 
-	insertOutput (outDATName, false, {});
+	insertOutput(outDATName, false, {});
 }
 
 // =============================================================================
 //
 void ExtProgramToolset::isecalc()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Isecalc))
+	if (not checkExtProgramPath(Isecalc))
 		return;
 
 	Ui::IsecalcUI ui;
 	QDialog* dlg = new QDialog;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col1);
-	guiUtilities()->fillUsedColorsToComboBox (ui.cmb_col2);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_col1);
+	guiUtilities()->fillUsedColorsToComboBox(ui.cmb_col2);
 
 	LDColor in1Col, in2Col;
 
@@ -643,12 +643,12 @@
 		if (not dlg->exec())
 			return;
 
-		in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt();
-		in2Col = ui.cmb_col2->itemData (ui.cmb_col2->currentIndex()).toInt();
+		in1Col = ui.cmb_col1->itemData(ui.cmb_col1->currentIndex()).toInt();
+		in2Col = ui.cmb_col2->itemData(ui.cmb_col2->currentIndex()).toInt();
 
 		if (in1Col == in2Col)
 		{
-			Critical ("Cannot use the same color group for both input and cutter!");
+			Critical("Cannot use the same color group for both input and cutter!");
 			continue;
 		}
 
@@ -658,38 +658,38 @@
 	QTemporaryFile in1dat, in2dat, outdat;
 	QString in1DATName, in2DATName, outDATName;
 
-	if (not makeTempFile (in1dat, in1DATName) or
-		not makeTempFile (in2dat, in2DATName) or
-		not makeTempFile (outdat, outDATName))
+	if (not makeTempFile(in1dat, in1DATName) or
+		not makeTempFile(in2dat, in2DATName) or
+		not makeTempFile(outdat, outDATName))
 	{
 		return;
 	}
 
-	QString argv = Join (
+	QString argv = Join(
 	{
 		in1DATName,
 		in2DATName,
 		outDATName
 	});
 
-	writeColorGroup (in1Col, in1DATName);
-	writeColorGroup (in2Col, in2DATName);
-	runExtProgram (Isecalc, argv);
-	insertOutput (outDATName, false, {});
+	writeColorGroup(in1Col, in1DATName);
+	writeColorGroup(in2Col, in2DATName);
+	runExtProgram(Isecalc, argv);
+	insertOutput(outDATName, false, {});
 }
 
 // =============================================================================
 //
 void ExtProgramToolset::edger2()
 {
-	setlocale (LC_ALL, "C");
+	setlocale(LC_ALL, "C");
 
-	if (not checkExtProgramPath (Edger2))
+	if (not checkExtProgramPath(Edger2))
 		return;
 
 	QDialog* dlg = new QDialog;
 	Ui::Edger2Dialog ui;
-	ui.setupUi (dlg);
+	ui.setupUi(dlg);
 
 	if (not dlg->exec())
 		return;
@@ -697,32 +697,32 @@
 	QTemporaryFile in, out;
 	QString inName, outName;
 
-	if (not makeTempFile (in, inName) or not makeTempFile (out, outName))
+	if (not makeTempFile(in, inName) or not makeTempFile(out, outName))
 		return;
 
 	int unmatched = ui.unmatched->currentIndex();
 
-	QString argv = Join (
+	QString argv = Join(
 	{
-		format ("-p %1", ui.precision->value()),
-		format ("-af %1", ui.flatAngle->value()),
-		format ("-ac %1", ui.condAngle->value()),
-		format ("-ae %1", ui.edgeAngle->value()),
+		format("-p %1", ui.precision->value()),
+		format("-af %1", ui.flatAngle->value()),
+		format("-ac %1", ui.condAngle->value()),
+		format("-ae %1", ui.edgeAngle->value()),
 		ui.delLines->isChecked()     ? "-de" : "",
 		ui.delCondLines->isChecked() ? "-dc" : "",
 		ui.colored->isChecked()      ? "-c" : "",
 		ui.bfc->isChecked()          ? "-b" : "",
 		ui.convex->isChecked()       ? "-cx" : "",
 		ui.concave->isChecked()      ? "-cv" : "",
-		unmatched == 0 ? "-u+" : (unmatched == 2 ? "-u-" : ""),
+		unmatched == 0 ? "-u+" :(unmatched == 2 ? "-u-" : ""),
 		inName,
 		outName,
 	});
 
-	writeSelection (inName);
+	writeSelection(inName);
 
-	if (not runExtProgram (Edger2, argv))
+	if (not runExtProgram(Edger2, argv))
 		return;
 
-	insertOutput (outName, true, {});
+	insertOutput(outName, true, {});
 }
--- a/src/toolsets/extprogramtoolset.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/extprogramtoolset.h	Thu Jan 04 19:44:26 2018 +0200
@@ -41,7 +41,7 @@
 	Q_OBJECT
 
 public:
-	ExtProgramToolset (MainWindow* parent);
+	ExtProgramToolset(MainWindow* parent);
 
 	Q_INVOKABLE void coverer();
 	Q_INVOKABLE void edger2();
@@ -50,23 +50,23 @@
 	Q_INVOKABLE void rectifier();
 	Q_INVOKABLE void ytruder();
 	
-	bool programUsesWine (ExtProgramType program);
-	QString externalProgramName (ExtProgramType program);
-	QString getPathSetting (ExtProgramType program);
-	bool getWineSetting (ExtProgramType program);
-	void setPathSetting (ExtProgramType program, QString value);
-	void setWineSetting (ExtProgramType program, bool value);
+	bool programUsesWine(ExtProgramType program);
+	QString externalProgramName(ExtProgramType program);
+	QString getPathSetting(ExtProgramType program);
+	bool getWineSetting(ExtProgramType program);
+	void setPathSetting(ExtProgramType program, QString value);
+	void setWineSetting(ExtProgramType program, bool value);
 
 private:
 	bool checkExtProgramPath(ExtProgramType program);
-	bool makeTempFile (class QTemporaryFile& tmp, QString& fname);
-	bool runExtProgram (ExtProgramType prog, QString argvstr);
-	QString errorCodeString (ExtProgramType program, class QProcess& process);
-	void insertOutput (QString fname, bool replace, QList<LDColor> colorsToReplace);
-	void writeColorGroup (LDColor color, QString fname);
-	void writeObjects (const LDObjectList& objects, QFile& f);
-	void writeObjects (const LDObjectList& objects, QString fname);
-	void writeSelection (QString fname);
+	bool makeTempFile(class QTemporaryFile& tmp, QString& fname);
+	bool runExtProgram(ExtProgramType prog, QString argvstr);
+	QString errorCodeString(ExtProgramType program, class QProcess& process);
+	void insertOutput(QString fname, bool replace, QList<LDColor> colorsToReplace);
+	void writeColorGroup(LDColor color, QString fname);
+	void writeObjects(const LDObjectList& objects, QFile& f);
+	void writeObjects(const LDObjectList& objects, QString fname);
+	void writeSelection(QString fname);
 
 	ExtProgramInfo extProgramInfo[NumExternalPrograms];
 };
--- a/src/toolsets/filetoolset.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/filetoolset.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -31,17 +31,17 @@
 #include "filetoolset.h"
 #include "ui_makeprim.h"
 
-FileToolset::FileToolset (MainWindow* parent) :
-	Toolset (parent) {}
+FileToolset::FileToolset(MainWindow* parent) :
+	Toolset(parent) {}
 
 void FileToolset::newPart()
 {
-	NewPartDialog* dlg = new NewPartDialog (m_window);
+	NewPartDialog* dlg = new NewPartDialog(m_window);
 
 	if (dlg->exec() == QDialog::Accepted)
 	{
 		m_window->createBlankDocument();
-		dlg->fillHeader (currentDocument());
+		dlg->fillHeader(currentDocument());
 		m_window->doFullRefresh();
 	}
 }
@@ -53,28 +53,28 @@
 
 void FileToolset::open()
 {
-	QString name = QFileDialog::getOpenFileName (m_window, "Open File", "", "LDraw files (*.dat *.ldr)");
+	QString name = QFileDialog::getOpenFileName(m_window, "Open File", "", "LDraw files(*.dat *.ldr)");
 
 	if (name.isEmpty())
 		return;
 
-	m_documents->openMainModel (name);
+	m_documents->openMainModel(name);
 }
 
 void FileToolset::save()
 {
-	m_window->save (currentDocument(), false);
+	m_window->save(currentDocument(), false);
 }
 
 void FileToolset::saveAs()
 {
-	m_window->save (currentDocument(), true);
+	m_window->save(currentDocument(), true);
 }
 
 void FileToolset::saveAll()
 {
 	for (LDDocument* file : m_documents->allDocuments())
-		m_window->save (file, false);
+		m_window->save(file, false);
 }
 
 void FileToolset::close()
@@ -93,20 +93,20 @@
 
 void FileToolset::settings()
 {
-	(new ConfigDialog (m_window))->exec();
+	(new ConfigDialog(m_window))->exec();
 }
 
 void FileToolset::setLDrawPath()
 {
-	LDrawPathDialog* dialog = new LDrawPathDialog (config.lDrawPath(), true);
+	LDrawPathDialog* dialog = new LDrawPathDialog(config.lDrawPath(), true);
 
 	if (dialog->exec())
-		config.setLDrawPath (dialog->path());
+		config.setLDrawPath(dialog->path());
 }
 
 void FileToolset::exit()
 {
-	::exit (EXIT_SUCCESS);
+	::exit(EXIT_SUCCESS);
 }
 
 void FileToolset::insertFrom()
@@ -117,24 +117,24 @@
 	if (not fname.length())
 		return;
 
-	QFile f (fname);
+	QFile f(fname);
 
-	if (not f.open (QIODevice::ReadOnly))
+	if (not f.open(QIODevice::ReadOnly))
 	{
-		Critical (format ("Couldn't open %1 (%2)", fname, f.errorString()));
+		Critical(format("Couldn't open %1(%2)", fname, f.errorString()));
 		return;
 	}
 
 	// TODO: shouldn't need to go to the document manager to parse a file
-	LDObjectList objs = m_documents->loadFileContents (&f, nullptr, nullptr);
+	LDObjectList objs = m_documents->loadFileContents(&f, nullptr, nullptr);
 
 	currentDocument()->clearSelection();
 
 	for (LDObject* obj : objs)
 	{
-		currentDocument()->insertObj (idx, obj);
+		currentDocument()->insertObj(idx, obj);
 		obj->select();
-		m_window->renderer()->compileObject (obj);
+		m_window->renderer()->compileObject(obj);
 
 		idx++;
 	}
@@ -153,11 +153,11 @@
 	if (fname.length() == 0)
 		return;
 
-	QFile file (fname);
+	QFile file(fname);
 
-	if (not file.open (QIODevice::WriteOnly | QIODevice::Text))
+	if (not file.open(QIODevice::WriteOnly | QIODevice::Text))
 	{
-		Critical (format ("Unable to open %1 for writing (%2)", fname, file.errorString()));
+		Critical(format("Unable to open %1 for writing(%2)", fname, file.errorString()));
 		return;
 	}
 
@@ -165,8 +165,8 @@
 	{
 		QString contents = obj->asText();
 		QByteArray data = contents.toUtf8();
-		file.write (data, data.size());
-		file.write ("\r\n", 2);
+		file.write(data, data.size());
+		file.write("\r\n", 2);
 	}
 }
 
@@ -179,7 +179,7 @@
 {
 	for (LDObject* obj : selectedObjects())
 	{
-		LDSubfileReference* ref = dynamic_cast<LDSubfileReference*> (obj);
+		LDSubfileReference* ref = dynamic_cast<LDSubfileReference*>(obj);
 
 		if (ref and ref->fileInfo()->isCache())
 			ref->fileInfo()->openForEditing();
@@ -188,10 +188,10 @@
 
 void FileToolset::downloadFrom()
 {
-	PartDownloader* dialog = new PartDownloader (m_window);
-	connect (dialog, &PartDownloader::primaryFileDownloaded, [&]()
+	PartDownloader* dialog = new PartDownloader(m_window);
+	connect(dialog, &PartDownloader::primaryFileDownloaded, [&]()
 	{
-		m_window->changeDocument (dialog->primaryFile());
+		m_window->changeDocument(dialog->primaryFile());
 		m_window->doFullRefresh();
 		m_window->renderer()->resetAngles();
 	});
@@ -200,7 +200,7 @@
 
 void FileToolset::makePrimitive()
 {
-	PrimitivePrompt* dlg = new PrimitivePrompt (m_window);
+	PrimitivePrompt* dlg = new PrimitivePrompt(m_window);
 
 	if (not dlg->exec())
 		return;
@@ -215,9 +215,9 @@
 		dlg->ui->rb_ndisc->isChecked()    ? DiscNeg :
 		dlg->ui->rb_ring->isChecked()     ? Ring : Cone;
 
-	LDDocument* f = GeneratePrimitive (type, segs, divs, num);
+	LDDocument* f = GeneratePrimitive(type, segs, divs, num);
 	f->openForEditing();
-	m_window->save (f, false);
+	m_window->save(f, false);
 }
 
 // These are not exactly file tools but I don't want to make another toolset just for 3 very small actions
@@ -233,5 +233,5 @@
 
 void FileToolset::aboutQt()
 {
-	QMessageBox::aboutQt (m_window);
+	QMessageBox::aboutQt(m_window);
 }
\ No newline at end of file
--- a/src/toolsets/filetoolset.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/filetoolset.h	Thu Jan 04 19:44:26 2018 +0200
@@ -24,7 +24,7 @@
 	Q_OBJECT
 
 public:
-	FileToolset (class MainWindow* parent);
+	FileToolset(class MainWindow* parent);
 
 	Q_INVOKABLE void about();
 	Q_INVOKABLE void aboutQt();
--- a/src/toolsets/movetoolset.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/movetoolset.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -22,81 +22,81 @@
 #include "../mainwindow.h"
 #include "movetoolset.h"
 
-MoveToolset::MoveToolset (MainWindow* parent) :
-	Toolset (parent) {}
+MoveToolset::MoveToolset(MainWindow* parent) :
+	Toolset(parent) {}
 
-void MoveToolset::moveSelection (bool up)
+void MoveToolset::moveSelection(bool up)
 {
 	LDObjectList objs = selectedObjects();
-	LDObject::moveObjects (objs, up);
+	LDObject::moveObjects(objs, up);
 	m_window->buildObjectList();
 }
 
 void MoveToolset::moveUp()
 {
-	moveSelection (true);
+	moveSelection(true);
 }
 
 void MoveToolset::moveDown()
 {
-	moveSelection (false);
+	moveSelection(false);
 }
 
 void MoveToolset::gridCoarse()
 {
-	config.setGrid (Grid::Coarse);
+	config.setGrid(Grid::Coarse);
 	m_window->updateGridToolBar();
 }
 
 void MoveToolset::gridMedium()
 {
-	config.setGrid (Grid::Medium);
+	config.setGrid(Grid::Medium);
 	m_window->updateGridToolBar();
 }
 
 void MoveToolset::gridFine()
 {
-	config.setGrid (Grid::Fine);
+	config.setGrid(Grid::Fine);
 	m_window->updateGridToolBar();
 }
 
-void MoveToolset::moveObjects (Vertex vect)
+void MoveToolset::moveObjects(Vertex vect)
 {
 	// Apply the grid values
 	vect *= gridCoordinateSnap();
 
 	for (LDObject* obj : selectedObjects())
-		obj->move (vect);
+		obj->move(vect);
 }
 
 void MoveToolset::moveXNeg()
 {
-	moveObjects ({-1, 0, 0});
+	moveObjects({-1, 0, 0});
 }
 
 void MoveToolset::moveYNeg()
 {
-	moveObjects ({0, -1, 0});
+	moveObjects({0, -1, 0});
 }
 
 void MoveToolset::moveZNeg()
 {
-	moveObjects ({0, 0, -1});
+	moveObjects({0, 0, -1});
 }
 
 void MoveToolset::moveXPos()
 {
-	moveObjects ({1, 0, 0});
+	moveObjects({1, 0, 0});
 }
 
 void MoveToolset::moveYPos()
 {
-	moveObjects ({0, 1, 0});
+	moveObjects({0, 1, 0});
 }
 
 void MoveToolset::moveZPos()
 {
-	moveObjects ({0, 0, 1});
+	moveObjects({0, 0, 1});
 }
 
 double MoveToolset::getRotateActionAngle()
@@ -106,32 +106,32 @@
 
 void MoveToolset::rotateXPos()
 {
-	RotateObjects (1, 0, 0, getRotateActionAngle(), selectedObjects());
+	RotateObjects(1, 0, 0, getRotateActionAngle(), selectedObjects());
 }
 
 void MoveToolset::rotateYPos()
 {
-	RotateObjects (0, 1, 0, getRotateActionAngle(), selectedObjects());
+	RotateObjects(0, 1, 0, getRotateActionAngle(), selectedObjects());
 }
 
 void MoveToolset::rotateZPos()
 {
-	RotateObjects (0, 0, 1, getRotateActionAngle(), selectedObjects());
+	RotateObjects(0, 0, 1, getRotateActionAngle(), selectedObjects());
 }
 
 void MoveToolset::rotateXNeg()
 {
-	RotateObjects (-1, 0, 0, getRotateActionAngle(), selectedObjects());
+	RotateObjects(-1, 0, 0, getRotateActionAngle(), selectedObjects());
 }
 
 void MoveToolset::rotateYNeg()
 {
-	RotateObjects (0, -1, 0, getRotateActionAngle(), selectedObjects());
+	RotateObjects(0, -1, 0, getRotateActionAngle(), selectedObjects());
 }
 
 void MoveToolset::rotateZNeg()
 {
-	RotateObjects (0, 0, -1, getRotateActionAngle(), selectedObjects());
+	RotateObjects(0, 0, -1, getRotateActionAngle(), selectedObjects());
 }
 
 void MoveToolset::configureRotationPoint()
--- a/src/toolsets/movetoolset.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/movetoolset.h	Thu Jan 04 19:44:26 2018 +0200
@@ -24,7 +24,7 @@
 	Q_OBJECT
 
 public:
-	explicit MoveToolset (MainWindow* parent);
+	explicit MoveToolset(MainWindow* parent);
 
 	Q_INVOKABLE void configureRotationPoint();
 	Q_INVOKABLE void gridCoarse();
@@ -46,7 +46,7 @@
 	Q_INVOKABLE void rotateZPos();
 
 private:
-	void moveSelection (bool up);
-	void moveObjects (Vertex vect);
+	void moveSelection(bool up);
+	void moveObjects(Vertex vect);
 	double getRotateActionAngle();
 };
--- a/src/toolsets/toolset.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/toolset.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -25,18 +25,18 @@
 #include "toolset.h"
 #include "viewtoolset.h"
 
-Toolset::Toolset (MainWindow* parent) :
-	QObject (parent),
-	HierarchyElement (parent) {}
+Toolset::Toolset(MainWindow* parent) :
+	QObject(parent),
+	HierarchyElement(parent) {}
 
-QVector<Toolset*> Toolset::createToolsets (MainWindow* parent)
+QVector<Toolset*> Toolset::createToolsets(MainWindow* parent)
 {
 	QVector<Toolset*> tools;
-	tools << new AlgorithmToolset (parent);
-	tools << new BasicToolset (parent);
-	tools << new ExtProgramToolset (parent);
-	tools << new FileToolset (parent);
-	tools << new MoveToolset (parent);
-	tools << new ViewToolset (parent);
+	tools << new AlgorithmToolset(parent);
+	tools << new BasicToolset(parent);
+	tools << new ExtProgramToolset(parent);
+	tools << new FileToolset(parent);
+	tools << new MoveToolset(parent);
+	tools << new ViewToolset(parent);
 	return tools;
 }
--- a/src/toolsets/toolset.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/toolset.h	Thu Jan 04 19:44:26 2018 +0200
@@ -26,7 +26,7 @@
 {
 	Q_OBJECT
 public:
-	Toolset (MainWindow* parent);
+	Toolset(MainWindow* parent);
 
-	static QVector<Toolset*> createToolsets (MainWindow* parent);
+	static QVector<Toolset*> createToolsets(MainWindow* parent);
 };
--- a/src/toolsets/viewtoolset.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/viewtoolset.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -29,8 +29,8 @@
 #include "../documentmanager.h"
 #include "viewtoolset.h"
 
-ViewToolset::ViewToolset (MainWindow *parent) :
-	Toolset (parent) {}
+ViewToolset::ViewToolset(MainWindow *parent) :
+	Toolset(parent) {}
 
 void ViewToolset::selectAll()
 {
@@ -51,12 +51,12 @@
 			colors << obj->color();
 	}
 
-	removeDuplicates (colors);
+	removeDuplicates(colors);
 	currentDocument()->clearSelection();
 
 	for (LDObject* obj : currentDocument()->objects())
 	{
-		if (colors.contains (obj->color()))
+		if (colors.contains(obj->color()))
 			obj->select();
 	}
 }
@@ -74,22 +74,22 @@
 		types << obj->type();
 
 		if (types.last() == OBJ_SubfileReference)
-			subfilenames << static_cast<LDSubfileReference*> (obj)->fileInfo()->name();
+			subfilenames << static_cast<LDSubfileReference*>(obj)->fileInfo()->name();
 	}
 
-	removeDuplicates (types);
-	removeDuplicates (subfilenames);
+	removeDuplicates(types);
+	removeDuplicates(subfilenames);
 	currentDocument()->clearSelection();
 
 	for (LDObject* obj : currentDocument()->objects())
 	{
 		LDObjectType type = obj->type();
 
-		if (not types.contains (type))
+		if (not types.contains(type))
 			continue;
 
 		// For subfiles, type check is not enough, we check the name of the document as well.
-		if (type == OBJ_SubfileReference and not subfilenames.contains (static_cast<LDSubfileReference*> (obj)->fileInfo()->name()))
+		if (type == OBJ_SubfileReference and not subfilenames.contains(static_cast<LDSubfileReference*>(obj)->fileInfo()->name()))
 			continue;
 
 		obj->select();
@@ -104,29 +104,29 @@
 
 void ViewToolset::screenshot()
 {
-	const char* imageformats = "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;"
-		"PPM images (*.ppm);;X11 Bitmaps (*.xbm);;X11 Pixmaps (*.xpm);;All Files (*.*)";
+	const char* imageformats = "PNG images(*.png);;JPG images(*.jpg);;BMP images(*.bmp);;"
+		"PPM images(*.ppm);;X11 Bitmaps(*.xbm);;X11 Pixmaps(*.xpm);;All Files(*.*)";
 	int width = m_window->renderer()->width();
 	int height = m_window->renderer()->height();
 	QByteArray capture = m_window->renderer()->capturePixels();
-	const uchar* imagedata = reinterpret_cast<const uchar*> (capture.constData());
+	const uchar* imagedata = reinterpret_cast<const uchar*>(capture.constData());
 	// GL and Qt formats have R and B swapped. Also, GL flips Y - correct it as well.
-	QImage image = QImage (imagedata, width, height, QImage::Format_ARGB32).rgbSwapped().mirrored();
-	QString root = Basename (currentDocument()->name());
+	QImage image = QImage(imagedata, width, height, QImage::Format_ARGB32).rgbSwapped().mirrored();
+	QString root = Basename(currentDocument()->name());
 
-	if (root.right (4) == ".dat")
-		root.chop (4);
+	if (root.right(4) == ".dat")
+		root.chop(4);
 
-	QString defaultname = (root.length() > 0) ? format ("%1.png", root) : "";
-	QString filename = QFileDialog::getSaveFileName (m_window, "Save Screencap", defaultname, imageformats);
+	QString defaultname = (root.length() > 0) ? format("%1.png", root) : "";
+	QString filename = QFileDialog::getSaveFileName(m_window, "Save Screencap", defaultname, imageformats);
 
-	if (not filename.isEmpty() and not image.save (filename))
-		Critical (format ("Couldn't open %1 for writing to save screencap: %2", filename, strerror (errno)));
+	if (not filename.isEmpty() and not image.save(filename))
+		Critical(format("Couldn't open %1 for writing to save screencap: %2", filename, strerror(errno)));
 }
 
 void ViewToolset::axes()
 {
-	config.setDrawAxes (not config.drawAxes());
+	config.setDrawAxes(not config.drawAxes());
 	m_window->updateActions();
 	m_window->renderer()->update();
 }
@@ -134,24 +134,24 @@
 void ViewToolset::visibilityToggle()
 {
 	for (LDObject* obj : selectedObjects())
-		obj->setHidden (not obj->isHidden());
+		obj->setHidden(not obj->isHidden());
 }
 
 void ViewToolset::visibilityHide()
 {
 	for (LDObject* obj : selectedObjects())
-		obj->setHidden (true);
+		obj->setHidden(true);
 }
 
 void ViewToolset::visibilityReveal()
 {
 	for (LDObject* obj : selectedObjects())
-		obj->setHidden (false);
+		obj->setHidden(false);
 }
 
 void ViewToolset::wireframe()
 {
-	config.setDrawWireframe (not config.drawWireframe());
+	config.setDrawWireframe(not config.drawWireframe());
 	m_window->renderer()->refresh();
 }
 
@@ -162,7 +162,7 @@
 	if (not dlg.exec())
 		return;
 
-	m_window->renderer()->setupOverlay ((ECamera) dlg.camera(), dlg.fpath(), dlg.ofsx(),
+	m_window->renderer()->setupOverlay((ECamera) dlg.camera(), dlg.fpath(), dlg.ofsx(),
 		dlg.ofsy(), dlg.lwidth(), dlg.lheight());
 }
 
@@ -173,7 +173,7 @@
 
 void ViewToolset::drawAngles()
 {
-	config.setDrawAngles (not config.drawAngles());
+	config.setDrawAngles(not config.drawAngles());
 	m_window->renderer()->refresh();
 }
 
@@ -183,12 +183,12 @@
 		return;
 
 	bool ok;
-	double depth = QInputDialog::getDouble (m_window, "Set Draw Depth",
-		format ("Depth value for %1:", m_window->renderer()->currentCameraName()),
+	double depth = QInputDialog::getDouble(m_window, "Set Draw Depth",
+		format("Depth value for %1:", m_window->renderer()->currentCameraName()),
 		m_window->renderer()->getDepthValue(), -10000.0f, 10000.0f, 3, &ok);
 
 	if (ok)
-		m_window->renderer()->setDepthValue (depth);
+		m_window->renderer()->setDepthValue(depth);
 }
 
 #if 0
@@ -197,41 +197,41 @@
 // these is an immense pain.
 void ViewToolset::testpic()
 {
-	LDDocument* file = getFile ("axle.dat");
-	setlocale (LC_ALL, "C");
+	LDDocument* file = getFile("axle.dat");
+	setlocale(LC_ALL, "C");
 
 	if (not file)
 	{
-		critical ("couldn't load axle.dat");
+		critical("couldn't load axle.dat");
 		return;
 	}
 
 	int w, h;
 
 	GLRenderer* rend = new GLRenderer;
-	rend->resize (64, 64);
-	rend->setAttribute (Qt::WA_DontShowOnScreen);
+	rend->resize(64, 64);
+	rend->setAttribute(Qt::WA_DontShowOnScreen);
 	rend->show();
-	rend->setFile (file);
-	rend->setDrawOnly (true);
+	rend->setFile(file);
+	rend->setDrawOnly(true);
 	rend->compileAllObjects();
 	rend->initGLData();
 	rend->drawGLScene();
 
-	uchar* imgdata = rend->screencap (w, h);
-	QImage img = imageFromScreencap (imgdata, w, h);
+	uchar* imgdata = rend->screencap(w, h);
+	QImage img = imageFromScreencap(imgdata, w, h);
 
 	if (img.isNull())
 	{
-		critical ("Failed to create the image!\n");
+		critical("Failed to create the image!\n");
 	}
 	else
 	{
 		QLabel* label = new QLabel;
 		QDialog* dlg = new QDialog;
-		label->setPixmap (QPixmap::fromImage (img));
-		QVBoxLayout* layout = new QVBoxLayout (dlg);
-		layout->addWidget (label);
+		label->setPixmap(QPixmap::fromImage(img));
+		QVBoxLayout* layout = new QVBoxLayout(dlg);
+		layout->addWidget(label);
 		dlg->exec();
 	}
 
@@ -242,10 +242,10 @@
 
 void ViewToolset::bfcView()
 {
-	config.setBfcRedGreenView (not config.bfcRedGreenView());
+	config.setBfcRedGreenView(not config.bfcRedGreenView());
 
 	if (config.bfcRedGreenView())
-		config.setRandomColors (false);
+		config.setRandomColors(false);
 
 	m_window->updateActions();
 	m_window->renderer()->refresh();
@@ -260,10 +260,10 @@
 	if (selectedObjects().size() == 1)
 		defval = selectedObjects()[0]->lineNumber();
 
-	int idx = QInputDialog::getInt (nullptr, "Go to line", "Go to line:", defval,
+	int idx = QInputDialog::getInt(nullptr, "Go to line", "Go to line:", defval,
 		1, currentDocument()->getObjectCount(), 1, &ok);
 
-	if (not ok or (obj = currentDocument()->getObject (idx - 1)) == nullptr)
+	if (not ok or(obj = currentDocument()->getObject(idx - 1)) == nullptr)
 		return;
 
 	currentDocument()->clearSelection();
@@ -273,10 +273,10 @@
 
 void ViewToolset::randomColors()
 {
-	config.setRandomColors (not config.randomColors());
+	config.setRandomColors(not config.randomColors());
 
 	if (config.randomColors())
-		config.setBfcRedGreenView (false);
+		config.setBfcRedGreenView(false);
 
 	m_window->updateActions();
 	m_window->renderer()->refresh();
@@ -284,18 +284,18 @@
 
 void ViewToolset::drawSurfaces()
 {
-	config.setDrawSurfaces (not config.drawSurfaces());
+	config.setDrawSurfaces(not config.drawSurfaces());
 	m_window->updateActions();
 }
 
 void ViewToolset::drawEdgeLines()
 {
-	config.setDrawEdgeLines (not config.drawEdgeLines());
+	config.setDrawEdgeLines(not config.drawEdgeLines());
 	m_window->updateActions();
 }
 
 void ViewToolset::drawConditionalLines()
 {
-	config.setDrawConditionalLines (not config.drawConditionalLines());
+	config.setDrawConditionalLines(not config.drawConditionalLines());
 	m_window->updateActions();
 }
\ No newline at end of file
--- a/src/toolsets/viewtoolset.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/viewtoolset.h	Thu Jan 04 19:44:26 2018 +0200
@@ -24,7 +24,7 @@
 	Q_OBJECT
 
 public:
-	ViewToolset (MainWindow* parent);
+	ViewToolset(MainWindow* parent);
 
 	Q_INVOKABLE void axes();
 	Q_INVOKABLE void bfcView();
--- a/src/version.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/version.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -25,7 +25,7 @@
 
 const char* fullVersionString()
 {
-#if BUILD_ID != BUILD_RELEASE and defined (HG_DATE_VERSION)
+#if BUILD_ID != BUILD_RELEASE and defined(HG_DATE_VERSION)
 	return VERSION_STRING "-" HG_DATE_VERSION;
 #else
 	return HG_DATE_VERSION;
@@ -40,7 +40,7 @@
 	if (buffer[0] == '\0')
 	{
 		time_t timestamp = HG_COMMIT_TIME;
-		strftime (buffer, sizeof buffer, "%d %b %Y", localtime (&timestamp));
+		strftime(buffer, sizeof buffer, "%d %b %Y", localtime(&timestamp));
 	}
 #endif
 
--- a/src/version.h	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/version.h	Thu Jan 04 19:44:26 2018 +0200
@@ -28,12 +28,12 @@
 #define VERSION_MINOR	4
 #define VERSION_PATCH	0
 
-#define VERSION_MAJOR_MINOR_STRING MACRO_TO_STRING (VERSION_MAJOR) "." MACRO_TO_STRING (VERSION_MINOR)
+#define VERSION_MAJOR_MINOR_STRING MACRO_TO_STRING(VERSION_MAJOR) "." MACRO_TO_STRING(VERSION_MINOR)
 
 #if VERSION_PATCH == 0
 # define VERSION_STRING VERSION_MAJOR_MINOR_STRING
 #else
-# define VERSION_STRING VERSION_MAJOR_MINOR_STRING "." MACRO_TO_STRING (VERSION_PATCH)
+# define VERSION_STRING VERSION_MAJOR_MINOR_STRING "." MACRO_TO_STRING(VERSION_PATCH)
 #endif
 
 //

mercurial