- reformatting

Tue, 07 Jan 2014 08:53:27 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 07 Jan 2014 08:53:27 +0200
changeset 603
47e7773c7841
parent 602
ac1744536b33
child 604
01bdac75994a

- reformatting

src/addObjectDialog.cc file | annotate | diff | comparison | revisions
src/addObjectDialog.h file | annotate | diff | comparison | revisions
src/colorSelectDialog.cc file | annotate | diff | comparison | revisions
src/colorSelectDialog.h file | annotate | diff | comparison | revisions
src/colors.cc file | annotate | diff | comparison | revisions
src/colors.h file | annotate | diff | comparison | revisions
src/config.cc file | annotate | diff | comparison | revisions
src/config.h file | annotate | diff | comparison | revisions
src/configDialog.cc file | annotate | diff | comparison | revisions
src/configDialog.h file | annotate | diff | comparison | revisions
src/crashcatcher.cc file | annotate | diff | comparison | revisions
src/dialogs.cc file | annotate | diff | comparison | revisions
src/dialogs.h file | annotate | diff | comparison | revisions
src/docs.cc file | annotate | diff | comparison | revisions
src/document.cc file | annotate | diff | comparison | revisions
src/document.h file | annotate | diff | comparison | revisions
src/download.cc file | annotate | diff | comparison | revisions
src/download.h file | annotate | diff | comparison | revisions
src/extprogs.cc file | annotate | diff | comparison | revisions
src/gldraw.cc file | annotate | diff | comparison | revisions
src/gldraw.h file | annotate | diff | comparison | revisions
src/gui.cc file | annotate | diff | comparison | revisions
src/gui.h file | annotate | diff | comparison | revisions
src/gui_actions.cc file | annotate | diff | comparison | revisions
src/gui_editactions.cc file | annotate | diff | comparison | revisions
src/history.cc file | annotate | diff | comparison | revisions
src/history.h file | annotate | diff | comparison | revisions
src/ldconfig.cc file | annotate | diff | comparison | revisions
src/ldconfig.h file | annotate | diff | comparison | revisions
src/ldtypes.cc file | annotate | diff | comparison | revisions
src/ldtypes.h file | annotate | diff | comparison | revisions
src/main.cc file | annotate | diff | comparison | revisions
src/main.h file | annotate | diff | comparison | revisions
src/messagelog.cc file | annotate | diff | comparison | revisions
src/messagelog.h file | annotate | diff | comparison | revisions
src/misc.cc file | annotate | diff | comparison | revisions
src/misc.h file | annotate | diff | comparison | revisions
src/misc/documentPointer.cc file | annotate | diff | comparison | revisions
src/misc/documentPointer.h file | annotate | diff | comparison | revisions
src/misc/ringFinder.cc file | annotate | diff | comparison | revisions
src/misc/ringFinder.h file | annotate | diff | comparison | revisions
src/primitives.cc file | annotate | diff | comparison | revisions
src/primitives.h file | annotate | diff | comparison | revisions
src/property.h file | annotate | diff | comparison | revisions
src/types.cc file | annotate | diff | comparison | revisions
src/types.h file | annotate | diff | comparison | revisions
src/widgets.cc file | annotate | diff | comparison | revisions
src/widgets.h file | annotate | diff | comparison | revisions
--- a/src/addObjectDialog.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/addObjectDialog.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -39,7 +39,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 class SubfileListItem : public QTreeWidgetItem
-{	PROPERTY (public,	Primitive*,	PrimitiveInfo, NO_OPS,	STOCK_WRITE)
+{
+	PROPERTY (public,	Primitive*,	PrimitiveInfo, NO_OPS,	STOCK_WRITE)
 
 	public:
 		SubfileListItem (QTreeWidgetItem* parent, Primitive* info) :
@@ -55,14 +56,17 @@
 // -----------------------------------------------------------------------------
 AddObjectDialog::AddObjectDialog (const LDObject::Type type, LDObject* obj, QWidget* parent) :
 	QDialog (parent)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 
 	int coordCount = 0;
 	str typeName = LDObject::typeName (type);
 
 	switch (type)
-	{	case LDObject::Comment:
-		{	le_comment = new QLineEdit;
+	{
+		case LDObject::Comment:
+		{
+			le_comment = new QLineEdit;
 
 			if (obj)
 				le_comment->setText (static_cast<LDComment*> (obj)->text);
@@ -71,27 +75,33 @@
 		} break;
 
 		case LDObject::Line:
-		{	coordCount = 6;
+		{
+			coordCount = 6;
 		} break;
 
 		case LDObject::Triangle:
-		{	coordCount = 9;
+		{
+			coordCount = 9;
 		} break;
 
 		case LDObject::Quad:
 		case LDObject::CondLine:
-		{	coordCount = 12;
+		{
+			coordCount = 12;
 		} break;
 
 		case LDObject::Vertex:
-		{	coordCount = 3;
+		{
+			coordCount = 3;
 		} break;
 
 		case LDObject::BFC:
-		{	rb_bfcType = new RadioGroup ("Statement", {}, 0, Qt::Vertical);
+		{
+			rb_bfcType = new RadioGroup ("Statement", {}, 0, Qt::Vertical);
 
 			for (int i = 0; i < LDBFC::NumStatements; ++i)
-			{	// Separate these in two columns
+			{
+				// Separate these in two columns
 				if (i == LDBFC::NumStatements / 2)
 					rb_bfcType->rowBreak();
 
@@ -103,17 +113,20 @@
 		} break;
 
 		case LDObject::Subfile:
-		{	coordCount = 3;
+		{
+			coordCount = 3;
 			tw_subfileList = new QTreeWidget();
 			tw_subfileList->setHeaderLabel (tr ("Primitives"));
 
 			for (PrimitiveCategory* cat : g_PrimitiveCategories)
-			{	SubfileListItem* parentItem = new SubfileListItem (tw_subfileList, null);
+			{
+				SubfileListItem* parentItem = new SubfileListItem (tw_subfileList, null);
 				parentItem->setText (0, cat->getName());
 				QList<QTreeWidgetItem*> subfileItems;
 
 				for (Primitive& prim : cat->prims)
-				{	SubfileListItem* item = new SubfileListItem (parentItem, &prim);
+				{
+					SubfileListItem* item = new SubfileListItem (parentItem, &prim);
 					item->setText (0, fmt ("%1 - %2", prim.name, prim.title));
 					subfileItems << item;
 
@@ -132,13 +145,15 @@
 			le_subfileName->setFocus();
 
 			if (obj)
-			{	LDSubfile* ref = static_cast<LDSubfile*> (obj);
+			{
+				LDSubfile* ref = static_cast<LDSubfile*> (obj);
 				le_subfileName->setText (ref->getFileInfo()->getName());
 			}
 		} break;
 
 		default:
-		{	critical (fmt ("Unhandled LDObject type %1 (%2) in AddObjectDialog", (int) type, typeName));
+		{
+			critical (fmt ("Unhandled LDObject type %1 (%2) in AddObjectDialog", (int) type, typeName));
 		} return;
 	}
 
@@ -150,7 +165,8 @@
 
 	// Show a color edit dialog for the types that actually use the color
 	if (defaults->isColored())
-	{	if (obj != null)
+	{
+		if (obj != null)
 			colnum = obj->getColor();
 		else
 			colnum = (type == LDObject::CondLine || type == LDObject::Line) ? edgecolor : maincolor;
@@ -161,7 +177,8 @@
 	}
 
 	for (int i = 0; i < coordCount; ++i)
-	{	dsb_coords[i] = new QDoubleSpinBox;
+	{
+		dsb_coords[i] = new QDoubleSpinBox;
 		dsb_coords[i]->setDecimals (5);
 		dsb_coords[i]->setMinimum (-10000.0);
 		dsb_coords[i]->setMaximum (10000.0);
@@ -171,14 +188,16 @@
 	layout->addWidget (lb_typeIcon, 0, 0);
 
 	switch (type)
-	{	case LDObject::Line:
+	{
+		case LDObject::Line:
 		case LDObject::CondLine:
 		case LDObject::Triangle:
 		case LDObject::Quad:
 
 			// Apply coordinates
 			if (obj)
-			{	for (int i = 0; i < coordCount / 3; ++i)
+			{
+				for (int i = 0; i < coordCount / 3; ++i)
 					for (int j = 0; j < 3; ++j)
 						dsb_coords[ (i * 3) + j]->setValue (obj->getVertex (i).coord (j));
 			}
@@ -204,7 +223,8 @@
 	}
 
 	if (defaults->hasMatrix())
-	{	LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
+	{
+		LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
 
 		QLabel* lb_matrix = new QLabel ("Matrix:");
 		le_matrix = new QLineEdit;
@@ -212,7 +232,8 @@
 		matrix defaultMatrix = g_identity;
 
 		if (mo)
-		{	for_axes (ax)
+		{
+			for_axes (ax)
 				dsb_coords[ax]->setValue (mo->getPosition()[ax]);
 
 			defaultMatrix = mo->getTransform();
@@ -227,7 +248,8 @@
 		layout->addWidget (pb_color, 1, 0);
 
 	if (coordCount > 0)
-	{	QGridLayout* const qCoordLayout = new QGridLayout;
+	{
+		QGridLayout* const qCoordLayout = new QGridLayout;
 
 		for (int i = 0; i < coordCount; ++i)
 			qCoordLayout->addWidget (dsb_coords[i], (i / 3), (i % 3));
@@ -249,7 +271,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void AddObjectDialog::setButtonBackground (QPushButton* button, int colnum)
-{	LDColor* col = getColor (colnum);
+{
+	LDColor* col = getColor (colnum);
 
 	button->setIcon (getIcon ("palette"));
 	button->setAutoFillBackground (true);
@@ -261,7 +284,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str AddObjectDialog::currentSubfileName()
-{	SubfileListItem* item = static_cast<SubfileListItem*> (tw_subfileList->currentItem());
+{
+	SubfileListItem* item = static_cast<SubfileListItem*> (tw_subfileList->currentItem());
 
 	if (item->getPrimitiveInfo() == null)
 		return ""; // selected a heading
@@ -272,14 +296,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void AddObjectDialog::slot_colorButtonClicked()
-{	ColorSelector::selectColor (colnum, colnum, this);
+{
+	ColorSelector::selectColor (colnum, colnum, this);
 	setButtonBackground (pb_color, colnum);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void AddObjectDialog::slot_subfileTypeChanged()
-{	str name = currentSubfileName();
+{
+	str name = currentSubfileName();
 
 	if (name.length() > 0)
 		le_subfileName->setText (name);
@@ -288,7 +314,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 template<class T> static T* initObj (LDObject*& obj)
-{	if (obj == null)
+{
+	if (obj == null)
 		obj = new T;
 
 	return static_cast<T*> (obj);
@@ -297,7 +324,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void AddObjectDialog::staticDialog (const LDObject::Type type, LDObject* obj)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 
 	// FIXME: Redirect to Edit Raw
 	if (obj && obj->getType() == LDObject::Error)
@@ -316,10 +344,12 @@
 		return;
 
 	if (type == LDObject::Subfile)
-	{	QStringList matrixstrvals = dlg.le_matrix->text().split (" ", QString::SkipEmptyParts);
+	{
+		QStringList matrixstrvals = dlg.le_matrix->text().split (" ", QString::SkipEmptyParts);
 
 		if (matrixstrvals.size() == 9)
-		{	double matrixvals[9];
+		{
+			double matrixvals[9];
 			int i = 0;
 
 			for (str val : matrixstrvals)
@@ -330,8 +360,10 @@
 	}
 
 	switch (type)
-	{	case LDObject::Comment:
-		{	LDComment* comm = initObj<LDComment> (obj);
+	{
+		case LDObject::Comment:
+		{
+			LDComment* comm = initObj<LDComment> (obj);
 			comm->text = dlg.le_comment->text();
 		}
 		break;
@@ -340,11 +372,13 @@
 		case LDObject::Triangle:
 		case LDObject::Quad:
 		case LDObject::CondLine:
-		{	if (!obj)
+		{
+			if (!obj)
 				obj = LDObject::getDefault (type);
 
 			for (int i = 0; i < obj->vertices(); ++i)
-			{	vertex v;
+			{
+				vertex v;
 
 				for_axes (ax)
 					v[ax] = dlg.dsb_coords[ (i * 3) + ax]->value();
@@ -354,12 +388,14 @@
 		} break;
 
 		case LDObject::BFC:
-		{	LDBFC* bfc = initObj<LDBFC> (obj);
+		{
+			LDBFC* bfc = initObj<LDBFC> (obj);
 			bfc->type = (LDBFC::Type) dlg.rb_bfcType->value();
 		} break;
 
 		case LDObject::Vertex:
-		{	LDVertex* vert = initObj<LDVertex> (obj);
+		{
+			LDVertex* vert = initObj<LDVertex> (obj);
 
 			for_axes (ax)
 				vert->pos[ax] = dlg.dsb_coords[ax]->value();
@@ -367,7 +403,8 @@
 		break;
 
 		case LDObject::Subfile:
-		{	str name = dlg.le_subfileName->text();
+		{
+			str name = dlg.le_subfileName->text();
 
 			if (name.length() == 0)
 				return; // no subfile filename
@@ -375,7 +412,8 @@
 			LDDocument* file = getDocument (name);
 
 			if (!file)
-			{	critical (fmt ("Couldn't open `%1': %2", name, strerror (errno)));
+			{
+				critical (fmt ("Couldn't open `%1': %2", name, strerror (errno)));
 				return;
 			}
 
@@ -397,7 +435,8 @@
 		obj->setColor (dlg.colnum);
 
 	if (newObject)
-	{	int idx = g_win->getInsertionPoint();
+	{
+		int idx = g_win->getInsertionPoint();
 		getCurrentDocument()->insertObj (idx, obj);
 	}
 
--- a/src/addObjectDialog.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/addObjectDialog.h	Tue Jan 07 08:53:27 2014 +0200
@@ -32,7 +32,8 @@
 class QDoubleSpinBox;
 
 class AddObjectDialog : public QDialog
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		AddObjectDialog (const LDObject::Type type, LDObject* obj, QWidget* parent = null);
--- a/src/colorSelectDialog.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/colorSelectDialog.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -42,7 +42,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 ColorSelector::ColorSelector (int defval, QWidget* parent) : QDialog (parent)
-{	// Remove the default color if it's invalid
+{
+	// Remove the default color if it's invalid
 	if (!getColor (defval))
 		defval = -1;
 
@@ -68,13 +69,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 ColorSelector::~ColorSelector()
-{	delete ui;
+{
+	delete ui;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ColorSelector::drawScene()
-{	const int numCols = g_numColumns;
+{
+	const int numCols = g_numColumns;
 	const int square = g_squareSize;
 	const int g_maxHeight = (numRows() * square);
 	QRect sceneRect (0, 0, viewportWidth(), g_maxHeight);
@@ -88,7 +91,8 @@
 	m_scene->clear();
 
 	for (int i = 0; i < MAX_COLORS; ++i)
-	{	LDColor* info = ::getColor (i);
+	{
+		LDColor* info = ::getColor (i);
 
 		if (!info)
 			continue;
@@ -100,7 +104,8 @@
 		QColor col = info->faceColor;
 
 		if (i == maincolor)
-		{	// Use the user preferences for main color here
+		{
+			// Use the user preferences for main color here
 			col = QColor (gl_maincolor);
 			col.setAlpha (gl_maincolor_alpha * 255.0f);
 		}
@@ -112,7 +117,8 @@
 		numtext->setPos (x, y);
 
 		if (getSelection() && i == getSelection()->index)
-		{	auto curspic = m_scene->addPixmap (getIcon ("colorcursor"));
+		{
+			auto curspic = m_scene->addPixmap (getIcon ("colorcursor"));
 			curspic->setPos (x, y);
 		}
 	}
@@ -121,20 +127,24 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int ColorSelector::numRows() const
-{	return (MAX_COLORS / g_numColumns);
+{
+	return (MAX_COLORS / g_numColumns);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 int ColorSelector::viewportWidth() const
-{	return g_numColumns * g_squareSize + 21;
+{
+	return g_numColumns * g_squareSize + 21;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ColorSelector::drawColorInfo()
-{	if (!getSelection())
-	{	ui->colorLabel->setText ("---");
+{
+	if (!getSelection())
+	{
+		ui->colorLabel->setText ("---");
 		return;
 	}
 
@@ -144,14 +154,17 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ColorSelector::resizeEvent (QResizeEvent* ev)
-{	// If this is the first resize, check if we need to scroll down to see the
+{
+	// If this is the first resize, check if we need to scroll down to see the
 	// currently selected color. We cannot do this in the constructor because the
 	// height is not set properly there.
 	if (m_firstResize)
-	{	int visibleColors = (ui->viewport->height() / g_squareSize) * g_numColumns;
+	{
+		int visibleColors = (ui->viewport->height() / g_squareSize) * g_numColumns;
 
 		if (getSelection() && getSelection()->index >= visibleColors)
-		{	int y = (getSelection()->index / g_numColumns) * g_squareSize;
+		{
+			int y = (getSelection()->index / g_numColumns) * g_squareSize;
 			ui->viewport->verticalScrollBar()->setValue (y);
 		}
 
@@ -165,7 +178,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ColorSelector::mousePressEvent (QMouseEvent* event)
-{	QPointF scenepos = ui->viewport->mapToScene (event->pos());
+{
+	QPointF scenepos = ui->viewport->mapToScene (event->pos());
 
 	int x = (scenepos.x() - (g_squareSize / 2)) / g_squareSize;
 	int y = (scenepos.y() - (g_squareSize / 2)) / g_squareSize;
@@ -184,10 +198,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool ColorSelector::selectColor (int& val, int defval, QWidget* parent)
-{	ColorSelector dlg (defval, parent);
+{
+	ColorSelector dlg (defval, parent);
 
 	if (dlg.exec() && dlg.getSelection() != null)
-	{	val = dlg.getSelection()->index;
+	{
+		val = dlg.getSelection()->index;
 		return true;
 	}
 
--- a/src/colorSelectDialog.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/colorSelectDialog.h	Tue Jan 07 08:53:27 2014 +0200
@@ -27,7 +27,8 @@
 class QGraphicsScene;
 
 class ColorSelector : public QDialog
-{	Q_OBJECT
+{
+	Q_OBJECT
 	PROPERTY (private,	LDColor*,	Selection,	NO_OPS,	STOCK_WRITE)
 
 	public:
--- a/src/colors.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/colors.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -34,7 +34,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void initColors()
-{	LDColor* col;
+{
+	LDColor* col;
 	log ("%1: initializing color information.\n", __func__);
 
 	// Always make sure there's 16 and 24 available. They're special like that.
@@ -53,7 +54,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDColor* getColor (int colnum)
-{	// Check bounds
+{
+	// Check bounds
 	if (colnum < 0 || colnum >= MAX_COLORS)
 		return null;
 
@@ -63,7 +65,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void setColor (int colnum, LDColor* col)
-{	if (colnum < 0 || colnum >= MAX_COLORS)
+{
+	if (colnum < 0 || colnum >= MAX_COLORS)
 		return;
 
 	g_LDColors[colnum] = col;
@@ -72,7 +75,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int luma (QColor& col)
-{	return (0.2126f * col.red()) +
+{
+	return (0.2126f * col.red()) +
 		   (0.7152f * col.green()) +
 		   (0.0722f * col.blue());
 }
--- a/src/colors.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/colors.h	Tue Jan 07 08:53:27 2014 +0200
@@ -25,7 +25,8 @@
 #define MAX_COLORS 512
 
 class LDColor
-{	public:
+{
+	public:
 		str name, hexcode;
 		QColor faceColor, edgeColor;
 		int index;
--- a/src/config.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/config.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -47,7 +47,8 @@
 // Get the QSettings object.
 // -----------------------------------------------------------------------------
 static QSettings* getSettingsObject()
-{	return new QSettings (UNIXNAME EXTENSION, QSettings::IniFormat);
+{
+	return new QSettings (UNIXNAME EXTENSION, QSettings::IniFormat);
 }
 
 Config::Config (str name) :
@@ -57,11 +58,13 @@
 // Load the configuration from file
 // -----------------------------------------------------------------------------
 bool Config::load()
-{	QSettings* settings = getSettingsObject();
+{
+	QSettings* settings = getSettingsObject();
 	log ("config::load: Loading configuration file from %1\n", settings->fileName());
 
 	for (Config* cfg : g_configPointers)
-	{	if (!cfg)
+	{
+		if (!cfg)
 			break;
 
 		QVariant val = settings->value (cfg->getName(), cfg->getDefaultAsVariant());
@@ -78,11 +81,13 @@
 // Save the configuration to disk
 // -----------------------------------------------------------------------------
 bool Config::save()
-{	QSettings* settings = getSettingsObject();
+{
+	QSettings* settings = getSettingsObject();
 	log ("Saving configuration to %1...\n", settings->fileName());
 
 	for (Config* cfg : g_configs)
-	{	if (!cfg->isDefault())
+	{
+		if (!cfg->isDefault())
 			settings->setValue (cfg->getName(), cfg->toVariant());
 		else
 			settings->remove (cfg->getName());
@@ -97,7 +102,8 @@
 // Reset configuration to defaults.
 // -----------------------------------------------------------------------------
 void Config::reset()
-{	for (Config* cfg : g_configs)
+{
+	for (Config* cfg : g_configs)
 		cfg->resetValue();
 }
 
@@ -105,14 +111,16 @@
 // Where is the configuration file located at?
 // -----------------------------------------------------------------------------
 str Config::filepath (str file)
-{	return Config::dirpath() + DIRSLASH + file;
+{
+	return Config::dirpath() + DIRSLASH + file;
 }
 
 // =============================================================================
 // Directory of the configuration file.
 // -----------------------------------------------------------------------------
 str Config::dirpath()
-{	QSettings* cfg = getSettingsObject();
+{
+	QSettings* cfg = getSettingsObject();
 	return dirname (cfg->fileName());
 }
 
@@ -122,7 +130,8 @@
 // variables we cannot assume that, therefore we need to use a C-style array here.
 // -----------------------------------------------------------------------------
 void Config::addToArray (Config* ptr)
-{	if (g_cfgPointerCursor == 0)
+{
+	if (g_cfgPointerCursor == 0)
 		memset (g_configPointers, 0, sizeof g_configPointers);
 
 	assert (g_cfgPointerCursor < MAX_CONFIG);
@@ -132,7 +141,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 template<class T> T* getConfigByName (str name, Config::Type type)
-{	auto it = g_configsByName.find (name);
+{
+	auto it = g_configsByName.find (name);
 
 	if (it == g_configsByName.end())
 		return null;
@@ -140,7 +150,8 @@
 	Config* cfg = it.value();
 
 	if (cfg->getType() != type)
-	{	fprint (stderr, "type of %1 is %2, not %3\n", name, cfg->getType(), type);
+	{
+		fprint (stderr, "type of %1 is %2, not %3\n", name, cfg->getType(), type);
 		abort();
 	}
 
@@ -150,9 +161,10 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 #undef IMPLEMENT_CONFIG
-#define IMPLEMENT_CONFIG(NAME) \
-	NAME##Config* NAME##Config::getByName (str name)		\
-	{	return getConfigByName<NAME##Config> (name, NAME);	\
+#define IMPLEMENT_CONFIG(NAME)								\
+	NAME##Config* NAME##Config::getByName (str name)			\
+	{														\
+		return getConfigByName<NAME##Config> (name, NAME);	\
 	}
 
 IMPLEMENT_CONFIG (Int)
--- a/src/config.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/config.h	Tue Jan 07 08:53:27 2014 +0200
@@ -41,11 +41,13 @@
 
 // =========================================================
 class Config
-{	PROPERTY (private, str, Name, STR_OPS, STOCK_WRITE)
+{
+	PROPERTY (private, str, Name, STR_OPS, STOCK_WRITE)
 
 	public:
 		enum Type
-		{	Int,
+		{
+			Int,
 			String,
 			Float,
 			Bool,
@@ -81,88 +83,104 @@
 };
 
 // =============================================================================
-#define IMPLEMENT_CONFIG(NAME)												\
-public:																				\
-	using ValueType = Config::NAME##Type;									\
-																						\
-	NAME##Config (ValueType* valueptr, str name, ValueType def) :	\
-		Config (name),																\
+#define IMPLEMENT_CONFIG(NAME)													\
+public:																			\
+	using ValueType = Config::NAME##Type;										\
+																				\
+	NAME##Config (ValueType* valueptr, str name, ValueType def) :				\
+		Config (name),															\
 		m_valueptr (valueptr),													\
 		m_default (def)															\
-	{	Config::addToArray (this);												\
+	{																			\
+		Config::addToArray (this);												\
 		*m_valueptr = def;														\
-	}																					\
-																						\
-	inline ValueType getValue() const										\
-	{	return *m_valueptr;														\
-	}																					\
-																						\
-	inline void setValue (ValueType val)									\
-	{	*m_valueptr = val;														\
-	}																					\
-																						\
-	virtual Config::Type getType() const									\
-	{	return Config::NAME;														\
-	}																					\
-																						\
+	}																			\
+																				\
+	inline ValueType getValue() const											\
+	{																			\
+		return *m_valueptr;														\
+	}																			\
+																				\
+	inline void setValue (ValueType val)											\
+	{																			\
+		*m_valueptr = val;														\
+	}																			\
+																				\
+	virtual Config::Type getType() const											\
+	{																			\
+		return Config::NAME;														\
+	}																			\
+																				\
 	virtual void resetValue()													\
-	{	*m_valueptr = m_default;												\
-	}																					\
-																						\
-	virtual const ValueType& getDefault() const							\
-	{	return m_default;															\
-	}																					\
-																						\
-	virtual bool isDefault() const											\
-	{	return *m_valueptr == m_default;										\
-	}																					\
-																						\
-	virtual void loadFromVariant (const QVariant& val)					\
-	{	*m_valueptr = val.value<ValueType>();								\
-	}																					\
-																						\
-	virtual QVariant toVariant() const										\
-	{	return QVariant::fromValue<ValueType> (*m_valueptr);			\
-	}																					\
-																						\
-	virtual QVariant getDefaultAsVariant() const							\
-	{	return QVariant::fromValue<ValueType> (m_default);				\
-	}																					\
-																						\
-	static NAME##Config* getByName (str name);							\
-																						\
-private:																				\
+	{																			\
+		*m_valueptr = m_default;												\
+	}																			\
+																				\
+	virtual const ValueType& getDefault() const									\
+	{																			\
+		return m_default;														\
+	}																			\
+																				\
+	virtual bool isDefault() const												\
+	{																			\
+		return *m_valueptr == m_default;											\
+	}																			\
+																				\
+	virtual void loadFromVariant (const QVariant& val)							\
+	{																			\
+		*m_valueptr = val.value<ValueType>();									\
+	}																			\
+																				\
+	virtual QVariant toVariant() const											\
+	{																			\
+		return QVariant::fromValue<ValueType> (*m_valueptr);						\
+	}																			\
+																				\
+	virtual QVariant getDefaultAsVariant() const									\
+	{																			\
+		return QVariant::fromValue<ValueType> (m_default);						\
+	}																			\
+																				\
+	static NAME##Config* getByName (str name);									\
+																				\
+private:																			\
 	ValueType*	m_valueptr;														\
 	ValueType	m_default;
 
 // =============================================================================
 class IntConfig : public Config
-{	IMPLEMENT_CONFIG (Int)
+{
+	IMPLEMENT_CONFIG (Int)
 };
 
 // =============================================================================
 class StringConfig : public Config
-{	IMPLEMENT_CONFIG (String)
+{
+	IMPLEMENT_CONFIG (String)
 };
 
 // =============================================================================
 class FloatConfig : public Config
-{	IMPLEMENT_CONFIG (Float)
+{
+	IMPLEMENT_CONFIG (Float)
 };
 
 // =============================================================================
 class BoolConfig : public Config
-{	IMPLEMENT_CONFIG (Bool)
+{
+	IMPLEMENT_CONFIG (Bool)
 };
 
 // =============================================================================
 class KeySequenceConfig : public Config
-{	IMPLEMENT_CONFIG (KeySequence)
+{
+	IMPLEMENT_CONFIG (KeySequence)
 };
 
 // =============================================================================
 class ListConfig : public Config
-{	IMPLEMENT_CONFIG (List)
+{
+	IMPLEMENT_CONFIG (List)
 };
 
 #endif // LDFORGE_CONFIG_H
--- a/src/configDialog.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/configDialog.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -115,7 +115,8 @@
 	int i = 0;
 
 	for (QAction* act : g_win->findChildren<QAction*>())
-	{	KeySequenceConfig* cfg = g_win->shortcutForAction (act);
+	{
+		KeySequenceConfig* cfg = g_win->shortcutForAction (act);
 
 		if (cfg)
 			addShortcut (*cfg, act, i);
@@ -165,13 +166,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 ConfigDialog::~ConfigDialog()
-{	delete ui;
+{
+	delete ui;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ConfigDialog::selectPage (int row)
-{	ui->m_pagelist->setCurrentRow (row);
+{
+	ui->m_pagelist->setCurrentRow (row);
 	ui->m_pages->setCurrentIndex (row);
 }
 
@@ -179,7 +182,8 @@
 // Adds a shortcut entry to the list of shortcuts.
 // -----------------------------------------------------------------------------
 void ConfigDialog::addShortcut (KeySequenceConfig& cfg, QAction* act, int& i)
-{	ShortcutListItem* item = new ShortcutListItem;
+{
+	ShortcutListItem* item = new ShortcutListItem;
 	item->setIcon (act->icon());
 	item->setKeyConfig (&cfg);
 	item->setAction (act);
@@ -197,7 +201,8 @@
 // Initializes the table of grid stuff
 // -----------------------------------------------------------------------------
 void ConfigDialog::initGrids()
-{	QGridLayout* gridlayout = new QGridLayout;
+{
+	QGridLayout* gridlayout = new QGridLayout;
 	QLabel* xlabel = new QLabel ("X"),
 	*ylabel = new QLabel ("Y"),
 	*zlabel = new QLabel ("Z"),
@@ -205,12 +210,14 @@
 	int i = 1;
 
 	for (QLabel* label : initlist<QLabel*> ({xlabel, ylabel, zlabel, anglabel}))
-	{	label->setAlignment (Qt::AlignCenter);
+	{
+		label->setAlignment (Qt::AlignCenter);
 		gridlayout->addWidget (label, 0, i++);
 	}
 
 	for (int i = 0; i < g_NumGrids; ++i)
-	{	// Icon
+	{
+		// Icon
 		lb_gridIcons[i] = new QLabel;
 		lb_gridIcons[i]->setPixmap (getIcon (fmt ("grid-%1", str (g_GridInfo[i].name).toLower())));
 
@@ -224,7 +231,8 @@
 
 		// Add the widgets
 		for (int j = 0; j < 4; ++j)
-		{	dsb_gridData[i][j] = new QDoubleSpinBox;
+		{
+			dsb_gridData[i][j] = new QDoubleSpinBox;
 
 			// Set the maximum angle
 			if (j == 3)
@@ -241,7 +249,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static struct LDExtProgInfo
-{	const str		name,
+{
+	const str		name,
 						iconname;
 	str* const		path;
 	QLineEdit*		input;
@@ -270,11 +279,13 @@
 // Initializes the stuff in the ext programs tab
 // -----------------------------------------------------------------------------
 void ConfigDialog::initExtProgs()
-{	QGridLayout* pathsLayout = new QGridLayout;
+{
+	QGridLayout* pathsLayout = new QGridLayout;
 	int row = 0;
 
 	for (LDExtProgInfo& info : g_LDExtProgInfo)
-	{	QLabel* icon = new QLabel,
+	{
+		QLabel* icon = new QLabel,
 		*progLabel = new QLabel (info.name);
 		QLineEdit* input = new QLineEdit;
 		QPushButton* setPathButton = new QPushButton;
@@ -309,7 +320,8 @@
 // Set the settings based on widget data.
 // -----------------------------------------------------------------------------
 void ConfigDialog::applySettings()
-{	// Apply configuration
+{
+	// Apply configuration
 	lv_colorize = ui->colorizeObjects->isChecked();
 	gl_colorbfc = ui->colorBFC->isChecked();
 	gl_blackedges = ui->blackEdges->isChecked();
@@ -340,7 +352,8 @@
 
 	// Ext program settings
 	for (const LDExtProgInfo& info : g_LDExtProgInfo)
-	{	*info.path = info.input->text();
+	{
+		*info.path = info.input->text();
 
 #ifndef _WIN32
 		*info.wine = info.wineBox->isChecked();
@@ -360,16 +373,20 @@
 // A dialog button was clicked
 // -----------------------------------------------------------------------------
 void ConfigDialog::buttonClicked (QAbstractButton* button)
-{	typedef QDialogButtonBox QDDB;
+{
+	typedef QDialogButtonBox QDDB;
 	QDialogButtonBox* dbb = ui->buttonBox;
 
 	if (button == dbb->button (QDDB::Ok))
-	{	applySettings();
+	{
+		applySettings();
 		accept();
 	} elif (button == dbb->button (QDDB::Apply))
-	{	applySettings();
+	{
+		applySettings();
 	} elif (button == dbb->button (QDDB::Cancel))
-	{	reject();
+	{
+		reject();
 	}
 }
 
@@ -377,28 +394,34 @@
 // Update the list of color toolbar items in the quick color tab.
 // -----------------------------------------------------------------------------
 void ConfigDialog::updateQuickColorList (LDQuickColor* sel)
-{	for (QListWidgetItem * item : quickColorItems)
+{
+	for (QListWidgetItem * item : quickColorItems)
 		delete item;
 
 	quickColorItems.clear();
 
 	// Init table items
 	for (LDQuickColor& entry : quickColors)
-	{	QListWidgetItem* item = new QListWidgetItem;
+	{
+		QListWidgetItem* item = new QListWidgetItem;
 
 		if (entry.isSeparator())
-		{	item->setText ("--------");
+		{
+			item->setText ("--------");
 			item->setIcon (getIcon ("empty"));
 		}
 		else
-		{	LDColor* col = entry.getColor();
+		{
+			LDColor* col = entry.getColor();
 
 			if (col == null)
-			{	item->setText ("[[unknown color]]");
+			{
+				item->setText ("[[unknown color]]");
 				item->setIcon (getIcon ("error"));
 			}
 			else
-			{	item->setText (col->name);
+			{
+				item->setText (col->name);
 				item->setIcon (makeColorIcon (col, 16));
 			}
 		}
@@ -407,7 +430,8 @@
 		quickColorItems << item;
 
 		if (sel && &entry == sel)
-		{	ui->quickColorList->setCurrentItem (item);
+		{
+			ui->quickColorList->setCurrentItem (item);
 			ui->quickColorList->scrollToItem (item);
 		}
 	}
@@ -417,12 +441,14 @@
 // Quick colors: add or edit button was clicked.
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_setColor()
-{	LDQuickColor* entry = null;
+{
+	LDQuickColor* entry = null;
 	QListWidgetItem* item = null;
 	const bool isNew = static_cast<QPushButton*> (sender()) == ui->quickColor_add;
 
 	if (isNew == false)
-	{	item = getSelectedQuickColor();
+	{
+		item = getSelectedQuickColor();
 
 		if (!item)
 			return;
@@ -443,7 +469,8 @@
 	if (entry)
 		entry->setColor (getColor (val));
 	else
-	{	LDQuickColor entry (getColor (val), null);
+	{
+		LDQuickColor entry (getColor (val), null);
 
 		item = getSelectedQuickColor();
 		int idx = (item) ? getItemRow (item, quickColorItems) + 1 : quickColorItems.size();
@@ -459,7 +486,8 @@
 // Remove a quick color
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_delColor()
-{	if (ui->quickColorList->selectedItems().isEmpty())
+{
+	if (ui->quickColorList->selectedItems().isEmpty())
 		return;
 
 	QListWidgetItem* item = ui->quickColorList->selectedItems() [0];
@@ -471,7 +499,8 @@
 // Move a quick color up/down
 // -----------------------------------------------------------------------------
 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;
@@ -494,7 +523,8 @@
 // Add a separator to quick colors
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_addColorSeparator()
-{	quickColors << LDQuickColor::getSeparator();
+{
+	quickColors << LDQuickColor::getSeparator();
 	updateQuickColorList (&quickColors[quickColors.size() - 1]);
 }
 
@@ -502,7 +532,8 @@
 // Clear all quick colors
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_clearColors()
-{	quickColors.clear();
+{
+	quickColors.clear();
 	updateQuickColorList();
 }
 
@@ -510,10 +541,12 @@
 // Pick a color and set the appropriate configuration option.
 // -----------------------------------------------------------------------------
 void ConfigDialog::pickColor (str& conf, QPushButton* button)
-{	QColor col = QColorDialog::getColor (QColor (conf));
+{
+	QColor col = QColorDialog::getColor (QColor (conf));
 
 	if (col.isValid())
-	{	int r = col.red(),
+	{
+		int r = col.red(),
 			g = col.green(),
 			b = col.blue();
 
@@ -527,26 +560,30 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_setGLBackground()
-{	pickColor (gl_bgcolor, ui->backgroundColorButton);
+{
+	pickColor (gl_bgcolor, ui->backgroundColorButton);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_setGLForeground()
-{	pickColor (gl_maincolor, ui->mainColorButton);
+{
+	pickColor (gl_maincolor, ui->mainColorButton);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_setGLSelectColor()
-{	pickColor (gl_selectcolor, ui->selColorButton);
+{
+	pickColor (gl_selectcolor, ui->selColorButton);
 }
 
 // =============================================================================
 // Sets background color of a given button.
 // -----------------------------------------------------------------------------
 void ConfigDialog::setButtonBackground (QPushButton* button, str value)
-{	button->setIcon (getIcon ("colorselect"));
+{
+	button->setIcon (getIcon ("colorselect"));
 	button->setAutoFillBackground (true);
 	button->setStyleSheet (fmt ("background-color: %1", value));
 }
@@ -555,10 +592,12 @@
 // Finds the given list widget item in the list of widget items given.
 // -----------------------------------------------------------------------------
 int ConfigDialog::getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack)
-{	int i = 0;
+{
+	int i = 0;
 
 	for (QListWidgetItem* it : haystack)
-	{	if (it == item)
+	{
+		if (it == item)
 			return i;
 
 		++i;
@@ -571,7 +610,8 @@
 // Which quick color is currently selected?
 // -----------------------------------------------------------------------------
 QListWidgetItem* ConfigDialog::getSelectedQuickColor()
-{	if (ui->quickColorList->selectedItems().isEmpty())
+{
+	if (ui->quickColorList->selectedItems().isEmpty())
 		return null;
 
 	return ui->quickColorList->selectedItems() [0];
@@ -581,7 +621,8 @@
 // Get the list of shortcuts selected
 // -----------------------------------------------------------------------------
 QList<ShortcutListItem*> ConfigDialog::getShortcutSelection()
-{	QList<ShortcutListItem*> out;
+{
+	QList<ShortcutListItem*> out;
 
 	for (QListWidgetItem* entry : ui->shortcutsList->selectedItems())
 		out << static_cast<ShortcutListItem*> (entry);
@@ -593,7 +634,8 @@
 // Edit the shortcut of a given action.
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_setShortcut()
-{	QList<ShortcutListItem*> sel = getShortcutSelection();
+{
+	QList<ShortcutListItem*> sel = getShortcutSelection();
 
 	if (sel.size() < 1)
 		return;
@@ -608,10 +650,12 @@
 // Reset a shortcut to defaults
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_resetShortcut()
-{	QList<ShortcutListItem*> sel = getShortcutSelection();
+{
+	QList<ShortcutListItem*> sel = getShortcutSelection();
 
 	for (ShortcutListItem* item : sel)
-	{	item->getKeyConfig()->reset();
+	{
+		item->getKeyConfig()->reset();
 		setShortcutText (item);
 	}
 }
@@ -620,10 +664,12 @@
 // Remove the shortcut of an action.
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_clearShortcut()
-{	QList<ShortcutListItem*> sel = getShortcutSelection();
+{
+	QList<ShortcutListItem*> sel = getShortcutSelection();
 
 	for (ShortcutListItem* item : sel)
-	{	item->getKeyConfig()->setValue (QKeySequence());
+	{
+		item->getKeyConfig()->setValue (QKeySequence());
 		setShortcutText (item);
 	}
 }
@@ -632,11 +678,14 @@
 // Set the path of an external program
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_setExtProgPath()
-{	const LDExtProgInfo* info = null;
+{
+	const LDExtProgInfo* info = null;
 
 	for (const LDExtProgInfo& it : g_LDExtProgInfo)
-	{	if (it.setPathButton == sender())
-		{	info = &it;
+	{
+		if (it.setPathButton == sender())
+		{
+			info = &it;
 			break;
 		}
 	}
@@ -654,7 +703,8 @@
 // '...' button pressed for the download path
 // -----------------------------------------------------------------------------
 void ConfigDialog::slot_findDownloadFolder()
-{	str dpath = QFileDialog::getExistingDirectory();
+{
+	str dpath = QFileDialog::getExistingDirectory();
 	ui->downloadPath->setText (dpath);
 }
 
@@ -662,7 +712,8 @@
 // Updates the text string for a given shortcut list item
 // -----------------------------------------------------------------------------
 void ConfigDialog::setShortcutText (ShortcutListItem* item)
-{	QAction* act = item->getAction();
+{
+	QAction* act = item->getAction();
 	str label = act->iconText();
 	str keybind = item->getKeyConfig()->getValue().toString();
 	item->setText (fmt ("%1 (%2)", label, keybind));
@@ -672,10 +723,12 @@
 // Gets the configuration string of the quick color toolbar
 // -----------------------------------------------------------------------------
 str ConfigDialog::quickColorString()
-{	str val;
+{
+	str val;
 
 	for (const LDQuickColor& entry : quickColors)
-	{	if (val.length() > 0)
+	{
+		if (val.length() > 0)
 			val += ':';
 
 		if (entry.isSeparator())
@@ -696,7 +749,8 @@
 // ===============================================================================================
 KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent, Qt::WindowFlags f) :
 	QDialog (parent, f), seq (seq)
-{	lb_output = new QLabel;
+{
+	lb_output = new QLabel;
 	IMPLEMENT_DIALOG_BUTTONS
 
 	setWhatsThis (tr ("Into this dialog you can input a key sequence for use as a "
@@ -714,7 +768,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool KeySequenceDialog::staticDialog (KeySequenceConfig* cfg, QWidget* parent)
-{	KeySequenceDialog dlg (cfg->getValue(), parent);
+{
+	KeySequenceDialog dlg (cfg->getValue(), parent);
 
 	if (dlg.exec() == false)
 		return false;
@@ -726,7 +781,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void KeySequenceDialog::updateOutput()
-{	str shortcut = seq.toString();
+{
+	str shortcut = seq.toString();
 
 	if (seq == QKeySequence())
 		shortcut = "&lt;empty&gt;";
@@ -738,6 +794,7 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void KeySequenceDialog::keyPressEvent (QKeyEvent* ev)
-{	seq = ev->key() + ev->modifiers();
+{
+	seq = ev->key() + ev->modifiers();
 	updateOutput();
 }
--- a/src/configDialog.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/configDialog.h	Tue Jan 07 08:53:27 2014 +0200
@@ -28,7 +28,8 @@
 
 // =============================================================================
 class ShortcutListItem : public QListWidgetItem
-{	PROPERTY (public,	KeySequenceConfig*,	KeyConfig,	NO_OPS,	STOCK_WRITE)
+{
+	PROPERTY (public,	KeySequenceConfig*,	KeyConfig,	NO_OPS,	STOCK_WRITE)
 	PROPERTY (public,	QAction*,				Action,		NO_OPS,	STOCK_WRITE)
 
 	public:
@@ -38,11 +39,13 @@
 
 // =============================================================================
 class ConfigDialog : public QDialog
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		enum Tab
-		{	InterfaceTab,
+		{
+			InterfaceTab,
 			ProfileTab,
 			ShortcutsTab,
 			QuickColorsTab,
@@ -99,7 +102,8 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 class KeySequenceDialog : public QDialog
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0);
--- a/src/crashcatcher.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/crashcatcher.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -46,10 +46,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static void handleCrash (int sig)
-{	printf ("%s: crashed with signal %d, launching gdb\n", __func__, sig);
+{
+	printf ("%s: crashed with signal %d, launching gdb\n", __func__, sig);
 
 	if (g_crashCatcherActive)
-	{	printf ("caught signal while crash catcher is active!\n");
+	{
+		printf ("caught signal while crash catcher is active!\n");
 		exit (149);
 	}
 
@@ -60,7 +62,8 @@
 	g_crashCatcherActive = true;
 
 	if (commandsFile.open())
-	{	commandsFile.write (fmt ("attach %1\n", pid).toLocal8Bit());
+	{
+		commandsFile.write (fmt ("attach %1\n", pid).toLocal8Bit());
 		commandsFile.write (str ("backtrace full\n").toLocal8Bit());
 		commandsFile.write (str ("detach\n").toLocal8Bit());
 		commandsFile.write (str ("quit").toLocal8Bit());
@@ -91,7 +94,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void initCrashCatcher()
-{	struct sigaction sighandler;
+{
+	struct sigaction sighandler;
 	sighandler.sa_handler = &handleCrash;
 	sighandler.sa_flags = 0;
 	sigemptyset (&sighandler.sa_mask);
@@ -110,7 +114,8 @@
 // Said prompt will embed the assertion failure information.
 // -----------------------------------------------------------------------------
 void assertionFailure (const char* file, int line, const char* funcname, const char* expr)
-{	str errmsg = fmt (
+{
+	str errmsg = fmt (
 		"<p><b>File</b>: <tt>%1</tt><br />"
 		"<b>Line</b>: <tt>%2</tt><br />"
 		"<b>Function:</b> <tt>%3</tt></p>"
--- a/src/dialogs.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/dialogs.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -51,11 +51,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 OverlayDialog::OverlayDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f)
-{	ui = new Ui_OverlayUI;
+{
+	ui = new Ui_OverlayUI;
 	ui->setupUi (this);
 
 	m_cameraArgs =
-	{	{ ui->top,    GL::ETopCamera },
+	{
+		{ ui->top,    GL::ETopCamera },
 		{ ui->bottom, GL::EBottomCamera },
 		{ ui->front,  GL::EFrontCamera },
 		{ ui->back,   GL::EBackCamera },
@@ -80,24 +82,28 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 OverlayDialog::~OverlayDialog()
-{	delete ui;
+{
+	delete ui;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void OverlayDialog::fillDefaults (int newcam)
-{	LDGLOverlay& info = g_win->R()->getOverlay (newcam);
+{
+	LDGLOverlay& info = g_win->R()->getOverlay (newcam);
 	radioDefault<int> (newcam, m_cameraArgs);
 
 	if (info.img != null)
-	{	ui->filename->setText (info.fname);
+	{
+		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->filename->setText ("");
 		ui->originX->setValue (0);
 		ui->originY->setValue (0);
 		ui->width->setValue (0.0f);
@@ -108,39 +114,48 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str OverlayDialog::fpath() const
-{	return ui->filename->text();
+{
+	return ui->filename->text();
 }
 
 int OverlayDialog::ofsx() const
-{	return ui->originX->value();
+{
+	return ui->originX->value();
 }
 
 int OverlayDialog::ofsy() const
-{	return ui->originY->value();
+{
+	return ui->originY->value();
 }
 
 double OverlayDialog::lwidth() const
-{	return ui->width->value();
+{
+	return ui->width->value();
 }
 
 double OverlayDialog::lheight() const
-{	return ui->height->value();
+{
+	return ui->height->value();
 }
 
 int OverlayDialog::camera() const
-{	return radioSwitch<int> (GL::ETopCamera, m_cameraArgs);
+{
+	return radioSwitch<int> (GL::ETopCamera, m_cameraArgs);
 }
 
 void OverlayDialog::slot_fpath()
-{	ui->filename->setText (QFileDialog::getOpenFileName (null, "Overlay image"));
+{
+	ui->filename->setText (QFileDialog::getOpenFileName (null, "Overlay image"));
 }
 
 void OverlayDialog::slot_help()
-{	showDocumentation (g_docs_overlays);
+{
+	showDocumentation (g_docs_overlays);
 }
 
 void OverlayDialog::slot_dimensionsChanged()
-{	bool enable = (ui->width->value() != 0) || (ui->height->value() != 0);
+{
+	bool enable = (ui->width->value() != 0) || (ui->height->value() != 0);
 	ui->buttonBox->button (QDialogButtonBox::Ok)->setEnabled (enable);
 }
 
@@ -149,14 +164,16 @@
 LDrawPathDialog::LDrawPathDialog (const bool validDefault, QWidget* parent, Qt::WindowFlags f) :
 	QDialog (parent, f),
 	m_validDefault (validDefault)
-{	ui = new Ui_LDPathUI;
+{
+	ui = new Ui_LDPathUI;
 	ui->setupUi (this);
 	ui->status->setText ("---");
 
 	if (validDefault)
 		ui->heading->hide();
 	else
-	{	cancelButton()->setText ("Exit");
+	{
+		cancelButton()->setText ("Exit");
 		cancelButton()->setIcon (getIcon ("exit"));
 	}
 
@@ -176,32 +193,39 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDrawPathDialog::~LDrawPathDialog()
-{	delete ui;
+{
+	delete ui;
 }
 
 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 (str path)
-{	ui->path->setText (path);
+{
+	ui->path->setText (path);
 }
 
 str LDrawPathDialog::filename() const
-{	return ui->path->text();
+{
+	return ui->path->text();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDrawPathDialog::slot_findPath()
-{	str newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
+{
+	str newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
 
 	if (newpath.length() > 0 && newpath != filename())
-	{	setPath (newpath);
+	{
+		setPath (newpath);
 		slot_tryConfigure();
 	}
 }
@@ -209,14 +233,17 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDrawPathDialog::slot_exit()
-{	exit (0);
+{
+	exit (0);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDrawPathDialog::slot_tryConfigure()
-{	if (LDPaths::tryConfigure (filename()) == false)
-	{	ui->status->setText (fmt ("<span style=\"color:#700; \">%1</span>", LDPaths::getError()));
+{
+	if (LDPaths::tryConfigure (filename()) == false)
+	{
+		ui->status->setText (fmt ("<span style=\"color:#700; \">%1</span>", LDPaths::getError()));
 		okButton()->setEnabled (false);
 		return;
 	}
@@ -228,14 +255,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDrawPathDialog::slot_accept()
-{	Config::save();
+{
+	Config::save();
 	accept();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 OpenProgressDialog::OpenProgressDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f)
-{	ui = new Ui_OpenProgressUI;
+{
+	ui = new Ui_OpenProgressUI;
 	ui->setupUi (this);
 	ui->progressText->setText ("Parsing...");
 	setNumLines (0);
@@ -245,13 +274,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 OpenProgressDialog::~OpenProgressDialog()
-{	delete ui;
+{
+	delete ui;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void OpenProgressDialog::setNumLines (int const& a)
-{	m_NumLines = a;
+{
+	m_NumLines = a;
 	ui->progressBar->setRange (0, getNumLines());
 	updateValues();
 }
@@ -259,14 +290,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void OpenProgressDialog::updateValues()
-{	ui->progressText->setText (fmt ("Parsing... %1 / %2", getProgress(), getNumLines()));
+{
+	ui->progressText->setText (fmt ("Parsing... %1 / %2", getProgress(), getNumLines()));
 	ui->progressBar->setValue (getProgress());
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void OpenProgressDialog::updateProgress (int progress)
-{	setProgress (progress);
+{
+	setProgress (progress);
 	updateValues();
 }
 
@@ -286,13 +319,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 ExtProgPathPrompt::~ExtProgPathPrompt()
-{	delete ui;
+{
+	delete ui;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ExtProgPathPrompt::findPath()
-{	str path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter);
+{
+	str path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter);
 
 	if (!path.isEmpty())
 		ui->m_path->setText (path);
@@ -301,14 +336,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str ExtProgPathPrompt::getPath() const
-{	return ui->m_path->text();
+{
+	return ui->m_path->text();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 AboutDialog::AboutDialog (QWidget* parent, Qt::WindowFlags f) :
 	QDialog (parent, f)
-{	Ui::AboutUI ui;
+{
+	Ui::AboutUI ui;
 	ui.setupUi (this);
 	ui.versionInfo->setText (APPNAME " " + fullVersionString());
 
@@ -324,13 +361,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void AboutDialog::slot_mail()
-{	QDesktopServices::openUrl (QUrl ("mailto:Santeri Piippo <arezey@gmail.com>?subject=LDForge"));
+{
+	QDesktopServices::openUrl (QUrl ("mailto:Santeri Piippo <arezey@gmail.com>?subject=LDForge"));
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void bombBox (const str& message)
-{	QDialog dlg (g_win);
+{
+	QDialog dlg (g_win);
 	Ui_BombBox ui;
 
 	ui.setupUi (&dlg);
--- a/src/dialogs.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/dialogs.h	Tue Jan 07 08:53:27 2014 +0200
@@ -41,7 +41,8 @@
 class Ui_OpenProgressUI;
 
 class OverlayDialog : public QDialog
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		explicit OverlayDialog (QWidget* parent = null, Qt::WindowFlags f = 0);
@@ -67,7 +68,8 @@
 
 // =============================================================================
 class LDrawPathDialog : public QDialog
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		explicit LDrawPathDialog (const bool validDefault, QWidget* parent = null, Qt::WindowFlags f = 0);
@@ -91,7 +93,8 @@
 
 // =============================================================================
 class OpenProgressDialog : public QDialog
-{	Q_OBJECT
+{
+	Q_OBJECT
 	PROPERTY (public,	int, Progress,	NUM_OPS,	STOCK_WRITE)
 	PROPERTY (public,	int, NumLines,	NUM_OPS,	CUSTOM_WRITE)
 
@@ -110,7 +113,8 @@
 
 // =============================================================================
 class ExtProgPathPrompt : public QDialog
-{		Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		explicit ExtProgPathPrompt (str progName, QWidget* parent = 0, Qt::WindowFlags f = 0);
@@ -126,7 +130,8 @@
 
 // =============================================================================
 class AboutDialog : public QDialog
-{		Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		AboutDialog (QWidget* parent = null, Qt::WindowFlags f = 0);
--- a/src/docs.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/docs.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -26,9 +26,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 class DocumentViewer : public QDialog
-{	public:
+{
+	public:
 		explicit DocumentViewer (QWidget* parent = null, Qt::WindowFlags f = 0) : QDialog (parent, f)
-		{	te_text = new QTextEdit (this);
+		{
+			te_text = new QTextEdit (this);
 			te_text->setMinimumSize (QSize (400, 300));
 			te_text->setReadOnly (true);
 
@@ -41,7 +43,8 @@
 		}
 
 		void setText (const char* text)
-		{	te_text->setText (text);
+		{
+			te_text->setText (text);
 		}
 
 	private:
@@ -66,7 +69,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void showDocumentation (const char* text)
-{	DocumentViewer dlg;
+{
+	DocumentViewer dlg;
 	dlg.setText (text);
 	dlg.exec();
 }
--- a/src/document.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/document.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -48,16 +48,20 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 namespace LDPaths
-{	static str pathError;
+{
+	static str pathError;
 
 	struct
-	{	str LDConfigPath;
+	{
+		str LDConfigPath;
 		str partsPath, primsPath;
 	} pathInfo;
 
 	void initPaths()
-	{	if (!tryConfigure (io_ldpath))
-		{	LDrawPathDialog dlg (false);
+	{
+		if (!tryConfigure (io_ldpath))
+		{
+			LDrawPathDialog dlg (false);
 
 			if (!dlg.exec())
 				exit (0);
@@ -67,10 +71,12 @@
 	}
 
 	bool tryConfigure (str path)
-	{	QDir dir;
+	{
+		QDir dir;
 
 		if (!dir.cd (path))
-		{	pathError = "Directory does not exist.";
+		{
+			pathError = "Directory does not exist.";
 			return false;
 		}
 
@@ -78,7 +84,8 @@
 		QStringList contents = dir.entryList (mustHave);
 
 		if (contents.size() != mustHave.size())
-		{	pathError = "Not an LDraw directory! Must<br />have LDConfig.ldr, parts/ and p/.";
+		{
+			pathError = "Not an LDraw directory! Must<br />have LDConfig.ldr, parts/ and p/.";
 			return false;
 		}
 
@@ -91,26 +98,31 @@
 
 	// Accessors
 	str getError()
-	{	return pathError;
+	{
+		return pathError;
 	}
 
 	str ldconfig()
-	{	return pathInfo.LDConfigPath;
+	{
+		return pathInfo.LDConfigPath;
 	}
 
 	str prims()
-	{	return pathInfo.primsPath;
+	{
+		return pathInfo.primsPath;
 	}
 
 	str parts()
-	{	return pathInfo.partsPath;
+	{
+		return pathInfo.partsPath;
 	}
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocument::LDDocument()
-{	setImplicit (true);
+{
+	setImplicit (true);
 	setSavePosition (-1);
 	setListItem (null);
 	setHistory (new History);
@@ -120,7 +132,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocument::~LDDocument()
-{	// Remove this file from the list of files. This MUST be done FIRST, otherwise
+{
+	// Remove this file from the list of files. This MUST be done FIRST, otherwise
 	// a ton of other functions will think this file is still valid when it is not!
 	g_loadedFiles.removeOne (this);
 
@@ -139,13 +152,16 @@
 	// If we just closed the current file, we need to set the current
 	// file as something else.
 	if (this == getCurrentDocument())
-	{	bool found = false;
+	{
+		bool found = false;
 
 		// Try find an explicitly loaded file - if we can't find one,
 		// we need to create a new file to switch to.
 		for (LDDocument* file : g_loadedFiles)
-		{	if (!file->isImplicit())
-			{	LDDocument::setCurrent (file);
+		{
+			if (!file->isImplicit())
+			{
+				LDDocument::setCurrent (file);
 				found = true;
 				break;
 			}
@@ -167,7 +183,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocument* findDocument (str name)
-{	for (LDDocument * file : g_loadedFiles)
+{
+	for (LDDocument * file : g_loadedFiles)
 		if (!file->getName().isEmpty() && file->getName() == name)
 			return file;
 
@@ -177,7 +194,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str dirname (str path)
-{	long lastpos = path.lastIndexOf (DIRSLASH);
+{
+	long lastpos = path.lastIndexOf (DIRSLASH);
 
 	if (lastpos > 0)
 		return path.left (lastpos);
@@ -193,7 +211,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str basename (str path)
-{	long lastpos = path.lastIndexOf (DIRSLASH);
+{
+	long lastpos = path.lastIndexOf (DIRSLASH);
 
 	if (lastpos != -1)
 		return path.mid (lastpos + 1);
@@ -204,7 +223,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 File* openLDrawFile (str relpath, bool subdirs)
-{	log ("Opening %1...\n", relpath);
+{
+	log ("Opening %1...\n", relpath);
 	File* f = new File;
 	str fullPath;
 
@@ -219,20 +239,24 @@
 	// in the immediate vicinity of a current model to override stock LDraw stuff.
 	str reltop = basename (dirname (relpath));
 	for (LDDocument* doc : g_loadedFiles)
-	{	if (doc->getFullPath().isEmpty())
+	{
+		if (doc->getFullPath().isEmpty())
 			continue;
 
 		str partpath = fmt ("%1/%2", dirname (doc->getFullPath()), relpath);
 
 		if (f->open (partpath, File::Read))
-		{	// ensure we don't mix subfiles and 48-primitives with non-subfiles and non-48
+		{
+			// ensure we don't mix subfiles and 48-primitives with non-subfiles and non-48
 			str proptop = basename (dirname (partpath));
 
 			bool bogus = false;
 
 			for (str s : g_specialSubdirectories)
-			{	if ((proptop == s && reltop != s) || (reltop == s && proptop != s))
-				{	bogus = true;
+			{
+				if ((proptop == s && reltop != s) || (reltop == s && proptop != s))
+				{
+					bogus = true;
 					break;
 				}
 			}
@@ -252,11 +276,14 @@
 		return f;
 
 	if (subdirs)
-	{	// Look in sub-directories: parts and p. Also look in net_downloadpath, since that's
+	{
+		// Look in sub-directories: parts and p. Also look in net_downloadpath, since that's
 		// where we download parts from the PT to.
 		for (const str& topdir : initlist<str> ({ io_ldpath, net_downloadpath }))
-		{	for (const str& subdir : initlist<str> ({ "parts", "p" }))
-			{	fullPath = fmt ("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relpath);
+		{
+			for (const str& subdir : initlist<str> ({ "parts", "p" }))
+			{
+				fullPath = fmt ("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relpath);
 
 				if (f->open (fullPath, File::Read))
 					return f;
@@ -273,12 +300,14 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDFileLoader::start()
-{	setDone (false);
+{
+	setDone (false);
 	setProgress (0);
 	setAborted (false);
 
 	if (isOnForeground())
-	{	g_aborted = false;
+	{
+		g_aborted = false;
 
 		// Show a progress dialog if we're loading the main document.here so we can
 		// show progress updates and keep the WM posted that we're still here.
@@ -303,9 +332,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDFileLoader::work (int i)
-{	// User wishes to abort, so stop here now.
+{
+	// User wishes to abort, so stop here now.
 	if (isAborted())
-	{	for (LDObject* obj : m_Objects)
+	{
+		for (LDObject* obj : m_Objects)
 			obj->deleteSelf();
 
 		m_Objects.clear();
@@ -317,7 +348,8 @@
 	int max = i + 300;
 
 	for (; i < max && i < (int) getLines().size(); ++i)
-	{	str line = getLines()[i];
+	{
+		str line = getLines()[i];
 
 		// Trim the trailing newline
 		QChar c;
@@ -329,7 +361,8 @@
 
 		// Check for parse errors and warn about tthem
 		if (obj->getType() == LDObject::Error)
-		{	log ("Couldn't parse line #%1: %2", getProgress() + 1, static_cast<LDError*> (obj)->reason);
+		{
+			log ("Couldn't parse line #%1: %2", getProgress() + 1, static_cast<LDError*> (obj)->reason);
 
 			if (getWarnings() != null)
 				(*getWarnings())++;
@@ -345,14 +378,16 @@
 
 	// If we're done now, tell the environment we're done and stop.
 	if (i >= ((int) getLines().size()) - 1)
-	{	emit workDone();
+	{
+		emit workDone();
 		setDone (true);
 		return;
 	}
 
 	// Otherwise, continue, by recursing back.
 	if (!isDone())
-	{	// If we have a dialog to show progress output to, we cannot just call
+	{
+		// If we have a dialog to show progress output to, we cannot just call
 		// work() again immediately as the dialog needs some processor cycles as
 		// well. Thus, take a detour through the event loop by using the
 		// meta-object system.
@@ -372,7 +407,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDFileLoader::abort()
-{	setAborted (true);
+{
+	setAborted (true);
 
 	if (isOnForeground())
 		g_aborted = true;
@@ -381,7 +417,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 QList<LDObject*> loadFileContents (File* f, int* numWarnings, bool* ok)
-{	QList<str> lines;
+{
+	QList<str> lines;
 	QList<LDObject*> objs;
 
 	if (numWarnings)
@@ -415,7 +452,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocument* openDocument (str path, bool search)
-{	// Convert the file name to lowercase since some parts contain uppercase
+{
+	// Convert the file name to lowercase since some parts contain uppercase
 	// file names. I'll assume here that the library will always use lowercase
 	// file names for the actual parts..
 	File* f;
@@ -423,10 +461,12 @@
 	if (search)
 		f = openLDrawFile (path.toLower(), true);
 	else
-	{	f = new File (path, File::Read);
+	{
+		f = new File (path, File::Read);
 
 		if (!*f)
-		{	delete f;
+		{
+			delete f;
 			return null;
 		}
 	}
@@ -449,7 +489,8 @@
 	delete f;
 
 	if (!ok)
-	{	g_loadedFiles.removeOne (load);
+	{
+		g_loadedFiles.removeOne (load);
 		delete load;
 		return null;
 	}
@@ -457,7 +498,8 @@
 	load->addObjects (objs);
 
 	if (g_loadingMainFile)
-	{	LDDocument::setCurrent (load);
+	{
+		LDDocument::setCurrent (load);
 		g_win->R()->setFile (load);
 		log (QObject::tr ("File %1 parsed successfully (%2 errors)."), path, numWarnings);
 	}
@@ -469,22 +511,27 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDDocument::isSafeToClose()
-{	typedef QMessageBox msgbox;
+{
+	typedef QMessageBox msgbox;
 	setlocale (LC_ALL, "C");
 
 	// If we have unsaved changes, warn and give the option of saving.
 	if (hasUnsavedChanges())
-	{	str message = fmt (tr ("There are unsaved changes to %1. Should it be saved?"),
+	{
+		str message = fmt (tr ("There are unsaved changes to %1. Should it be saved?"),
 			(getName().length() > 0) ? getName() : tr ("<anonymous>"));
 
 		int button = msgbox::question (g_win, tr ("Unsaved Changes"), message,
 			(msgbox::Yes | msgbox::No | msgbox::Cancel), msgbox::Cancel);
 
 		switch (button)
-		{	case msgbox::Yes:
-			{	// If we don't have a file path yet, we have to ask the user for one.
+		{
+			case msgbox::Yes:
+			{
+				// If we don't have a file path yet, we have to ask the user for one.
 				if (getName().length() == 0)
-				{	str newpath = QFileDialog::getSaveFileName (g_win, tr ("Save As"),
+				{
+					str newpath = QFileDialog::getSaveFileName (g_win, tr ("Save As"),
 						getCurrentDocument()->getName(), tr ("LDraw files (*.dat *.ldr)"));
 
 					if (newpath.length() == 0)
@@ -494,12 +541,14 @@
 				}
 
 				if (!save())
-				{	message = fmt (tr ("Failed to save %1 (%2)\nDo you still want to close?"),
+				{
+					message = fmt (tr ("Failed to save %1 (%2)\nDo you still want to close?"),
 						getName(), strerror (errno));
 
 					if (msgbox::critical (g_win, tr ("Save Failure"), message,
 						(msgbox::Yes | msgbox::No), msgbox::No) == msgbox::No)
-					{	return false;
+					{
+						return false;
 					}
 				}
 			} break;
@@ -518,7 +567,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void closeAll()
-{	// Remove all loaded files and the objects they contain
+{
+	// Remove all loaded files and the objects they contain
 	QList<LDDocument*> files = g_loadedFiles;
 
 	for (LDDocument* file : files)
@@ -528,7 +578,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void newFile()
-{	// Create a new anonymous file and set it to our current
+{
+	// Create a new anonymous file and set it to our current
 	LDDocument* f = new LDDocument;
 	f->setName ("");
 	f->setImplicit (false);
@@ -544,12 +595,14 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void addRecentFile (str path)
-{	auto& rfiles = io_recentfiles;
+{
+	auto& rfiles = io_recentfiles;
 	int idx = rfiles.indexOf (path);
 
 	// If this file already is in the list, pop it out.
 	if (idx != -1)
-	{	if (rfiles.size() == 1)
+	{
+		if (rfiles.size() == 1)
 			return; // only recent file - abort and do nothing
 
 		// Pop it out.
@@ -571,16 +624,19 @@
 // Open an LDraw file and set it as the main model
 // -----------------------------------------------------------------------------
 void openMainFile (str path)
-{	g_loadingMainFile = true;
+{
+	g_loadingMainFile = true;
 	LDDocument* file = openDocument (path, false);
 
 	if (!file)
-	{	// Loading failed, thus drop down to a new file since we
+	{
+		// Loading failed, thus drop down to a new file since we
 		// closed everything prior.
 		newFile();
 
 		if (!g_aborted)
-		{	// Tell the user loading failed.
+		{
+			// Tell the user loading failed.
 			setlocale (LC_ALL, "C");
 			critical (fmt (QObject::tr ("Failed to open %1: %2"), path, strerror (errno)));
 		}
@@ -607,7 +663,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDDocument::save (str savepath)
-{	if (!savepath.length())
+{
+	if (!savepath.length())
 		savepath = getName();
 
 	File f (savepath, File::Write);
@@ -621,10 +678,12 @@
 	LDObject* first = getObject (1);
 
 	if (!isImplicit() && first != null && first->getType() == LDObject::Comment)
-	{	fpathComment = static_cast<LDComment*> (first);
+	{
+		fpathComment = static_cast<LDComment*> (first);
 
 		if (fpathComment->text.left (6) == "Name: ")
-		{	str newname = shortenName (savepath);
+		{
+			str newname = shortenName (savepath);
 			fpathComment->text = fmt ("Name: %1", newname);
 			g_win->buildObjList();
 		}
@@ -651,34 +710,39 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 class LDParseError : public std::exception
-{	PROPERTY (private, str,	Error,	STR_OPS, STOCK_WRITE)
+{
+	PROPERTY (private, str,	Error,	STR_OPS, STOCK_WRITE)
 	PROPERTY (private, str,	Line,		STR_OPS,	STOCK_WRITE)
 
 	public:
 		LDParseError (str line, str a) : m_Error (a), m_Line (line) {}
 
 		const char* what() const throw()
-		{	return getError().toLocal8Bit().constData();
+		{
+			return getError().toLocal8Bit().constData();
 		}
 };
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void checkTokenCount (str line, const QStringList& tokens, int num)
-{	if (tokens.size() != num)
+{
+	if (tokens.size() != num)
 		throw LDParseError (line, fmt ("Bad amount of tokens, expected %1, got %2", num, tokens.size()));
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void checkTokenNumbers (str line, const QStringList& tokens, int min, int max)
-{	bool ok;
+{
+	bool ok;
 
 	// Check scientific notation, e.g. 7.99361e-15
 	QRegExp scient ("\\-?[0-9]+\\.[0-9]+e\\-[0-9]+");
 
 	for (int i = min; i <= max; ++i)
-	{	tokens[i].toDouble (&ok);
+	{
+		tokens[i].toDouble (&ok);
 
 		if (!ok && !scient.exactMatch (tokens[i]))
 			throw LDParseError (line, fmt ("Token #%1 was `%2`, expected a number (matched length: %3)", (i + 1), tokens[i], scient.matchedLength()));
@@ -688,7 +752,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static vertex parseVertex (QStringList& s, const int n)
-{	vertex v;
+{
+	vertex v;
 
 	for_axes (ax)
 		v[ax] = s[n + ax].toDouble();
@@ -702,11 +767,14 @@
 // the object will be LDError if it could not be parsed properly.
 // -----------------------------------------------------------------------------
 LDObject* parseLine (str line)
-{	try
-	{	QStringList tokens = line.split (" ", str::SkipEmptyParts);
+{
+	try
+	{
+		QStringList tokens = line.split (" ", str::SkipEmptyParts);
 
 		if (tokens.size() <= 0)
-		{	// Line was empty, or only consisted of whitespace
+		{
+			// Line was empty, or only consisted of whitespace
 			return new LDEmpty;
 		}
 
@@ -716,13 +784,16 @@
 		int num = tokens[0][0].digitValue();
 
 		switch (num)
-		{	case 0:
-			{	// Comment
+		{
+			case 0:
+			{
+				// Comment
 				str comm = line.mid (line.indexOf ("0") + 1).simplified();
 
 				// Handle BFC statements
 				if (tokens.size() > 2 && tokens[1] == "BFC")
-				{	for (int i = 0; i < LDBFC::NumStatements; ++i)
+				{
+					for (int i = 0; i < LDBFC::NumStatements; ++i)
 						if (comm == fmt ("BFC %1", LDBFC::statements [i]))
 							return new LDBFC ( (LDBFC::Type) i);
 
@@ -730,10 +801,12 @@
 					// creates. The above block only handles valid statements, so we
 					// need to handle MLCAD-style invertnext, clip and noclip separately.
 					struct
-					{	str			a;
+					{
+						str			a;
 						LDBFC::Type	b;
 					} BFCData[] =
-					{	{ "INVERTNEXT", LDBFC::InvertNext },
+					{
+						{ "INVERTNEXT", LDBFC::InvertNext },
 						{ "NOCLIP", LDBFC::NoClip },
 						{ "CLIP", LDBFC::Clip }
 					};
@@ -744,9 +817,11 @@
 				}
 
 				if (tokens.size() > 2 && tokens[1] == "!LDFORGE")
-				{	// Handle LDForge-specific types, they're embedded into comments too
+				{
+					// Handle LDForge-specific types, they're embedded into comments too
 					if (tokens[2] == "VERTEX")
-					{	// Vertex (0 !LDFORGE VERTEX)
+					{
+						// Vertex (0 !LDFORGE VERTEX)
 						checkTokenCount (line, tokens, 7);
 						checkTokenNumbers (line, tokens, 3, 6);
 
@@ -758,7 +833,8 @@
 
 						return obj;
 					} elif (tokens[2] == "OVERLAY")
-					{	checkTokenCount (line, tokens, 9);;
+					{
+						checkTokenCount (line, tokens, 9);;
 						checkTokenNumbers (line, tokens, 5, 8);
 
 						LDOverlay* obj = new LDOverlay;
@@ -779,7 +855,8 @@
 			}
 
 			case 1:
-			{	// Subfile
+			{
+				// Subfile
 				checkTokenCount (line, tokens, 15);
 				checkTokenNumbers (line, tokens, 1, 13);
 
@@ -793,7 +870,8 @@
 				// 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 (!load)
-				{	LDError* obj = new LDError (line, fmt ("Could not open %1", tokens[14]));
+				{
+					LDError* obj = new LDError (line, fmt ("Could not open %1", tokens[14]));
 					obj->setFileReferenced (tokens[14]);
 					return obj;
 				}
@@ -813,7 +891,8 @@
 			}
 
 			case 2:
-			{	checkTokenCount (line, tokens, 8);
+			{
+				checkTokenCount (line, tokens, 8);
 				checkTokenNumbers (line, tokens, 1, 7);
 
 				// Line
@@ -827,7 +906,8 @@
 			}
 
 			case 3:
-			{	checkTokenCount (line, tokens, 11);
+			{
+				checkTokenCount (line, tokens, 11);
 				checkTokenNumbers (line, tokens, 1, 10);
 
 				// Triangle
@@ -842,7 +922,8 @@
 
 			case 4:
 			case 5:
-			{	checkTokenCount (line, tokens, 14);
+			{
+				checkTokenCount (line, tokens, 14);
 				checkTokenNumbers (line, tokens, 1, 13);
 
 				// Quadrilateral / Conditional line
@@ -866,14 +947,16 @@
 		}
 	}
 	catch (LDParseError& e)
-	{	return new LDError (e.getLine(), e.getError());
+	{
+		return new LDError (e.getLine(), e.getError());
 	}
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocument* getDocument (str filename)
-{	// Try find the file in the list of loaded files
+{
+	// Try find the file in the list of loaded files
 	LDDocument* doc = findDocument (filename);
 
 	// If it's not loaded, try open it
@@ -886,7 +969,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void reloadAllSubfiles()
-{	if (!getCurrentDocument())
+{
+	if (!getCurrentDocument())
 		return;
 
 	g_loadedFiles.clear();
@@ -894,8 +978,10 @@
 
 	// Go through all objects in the current file and reload the subfiles
 	for (LDObject* obj : getCurrentDocument()->getObjects())
-	{	if (obj->getType() == LDObject::Subfile)
-		{	LDSubfile* ref = static_cast<LDSubfile*> (obj);
+	{
+		if (obj->getType() == LDObject::Subfile)
+		{
+			LDSubfile* ref = static_cast<LDSubfile*> (obj);
 			LDDocument* fileInfo = getDocument (ref->getFileInfo()->getName());
 
 			if (fileInfo)
@@ -914,7 +1000,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int LDDocument::addObject (LDObject* obj)
-{	getHistory()->add (new AddHistory (getObjects().size(), obj));
+{
+	getHistory()->add (new AddHistory (getObjects().size(), obj));
 	m_Objects << obj;
 
 	if (obj->getType() == LDObject::Vertex)
@@ -932,7 +1019,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::addObjects (const QList<LDObject*> objs)
-{	for (LDObject* obj : objs)
+{
+	for (LDObject* obj : objs)
 		if (obj)
 			addObject (obj);
 }
@@ -940,7 +1028,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::insertObj (int pos, LDObject* obj)
-{	getHistory()->add (new AddHistory (pos, obj));
+{
+	getHistory()->add (new AddHistory (pos, obj));
 	m_Objects.insert (pos, obj);
 	obj->setFile (this);
 
@@ -953,7 +1042,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::forgetObject (LDObject* obj)
-{	int idx = obj->getIndex();
+{
+	int idx = obj->getIndex();
 	obj->unselect();
 	assert (m_Objects[idx] == obj);
 
@@ -967,7 +1057,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool safeToCloseAll()
-{	for (LDDocument* f : g_loadedFiles)
+{
+	for (LDDocument* f : g_loadedFiles)
 		if (!f->isSafeToClose())
 			return false;
 
@@ -977,11 +1068,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::setObject (int idx, LDObject* obj)
-{	assert (idx >= 0 && idx < m_Objects.size());
+{
+	assert (idx >= 0 && idx < m_Objects.size());
 
 	// Mark this change to history
 	if (!m_History->isIgnoring())
-	{	str oldcode = getObject (idx)->raw();
+	{
+		str oldcode = getObject (idx)->raw();
 		str newcode = obj->raw();
 		*m_History << new EditHistory (idx, oldcode, newcode);
 	}
@@ -996,7 +1089,8 @@
 // Close all implicit files with no references
 // -----------------------------------------------------------------------------
 void LDDocument::closeUnused()
-{	for (LDDocument* file : g_loadedFiles)
+{
+	for (LDDocument* file : g_loadedFiles)
 		if (file->isImplicit() && file->numReferences() == 0)
 			delete file;
 }
@@ -1004,7 +1098,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDObject* LDDocument::getObject (int pos) const
-{	if (m_Objects.size() <= pos)
+{
+	if (m_Objects.size() <= pos)
 		return null;
 
 	return m_Objects[pos];
@@ -1013,19 +1108,22 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int LDDocument::getObjectCount() const
-{	return getObjects().size();
+{
+	return getObjects().size();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDDocument::hasUnsavedChanges() const
-{	return !isImplicit() && getHistory()->getPosition() != getSavePosition();
+{
+	return !isImplicit() && getHistory()->getPosition() != getSavePosition();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDDocument::getDisplayName()
-{	if (!getName().isEmpty())
+{
+	if (!getName().isEmpty())
 		return getName();
 
 	if (!getDefaultName().isEmpty())
@@ -1037,11 +1135,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 QList<LDObject*> LDDocument::inlineContents (LDSubfile::InlineFlags flags)
-{	// Possibly substitute with logoed studs:
+{
+	// Possibly substitute with logoed studs:
 	// stud.dat -> stud-logo.dat
 	// stud2.dat -> stud-logo2.dat
 	if (gl_logostuds && (flags & LDSubfile::RendererInline))
-	{	// Ensure logoed studs are loaded first
+	{
+		// Ensure logoed studs are loaded first
 		loadLogoedStuds();
 
 		if (getName() == "stud.dat" && g_logoedStud)
@@ -1057,15 +1157,18 @@
 
 	// If we have this cached, just create a copy of that
 	if (deep && getCache().size())
-	{	for (LDObject* obj : getCache())
+	{
+		for (LDObject* obj : getCache())
 			objs << obj->createCopy();
 	}
 	else
-	{	if (!deep)
+	{
+		if (!deep)
 			doCache = false;
 
 		for (LDObject* obj : getObjects())
-		{	// Skip those without scemantic meaning
+		{
+			// Skip those without scemantic meaning
 			if (!obj->isScemantic())
 				continue;
 
@@ -1073,14 +1176,16 @@
 			// just add it into the objects normally. Also, we only cache immediate
 			// subfiles and this is not one. Yay, recursion!
 			if (deep && obj->getType() == LDObject::Subfile)
-			{	LDSubfile* ref = static_cast<LDSubfile*> (obj);
+			{
+				LDSubfile* ref = static_cast<LDSubfile*> (obj);
 
 				// We only want to cache immediate subfiles, so shed the caching
 				// flag when recursing deeper in hierarchy.
 				QList<LDObject*> otherobjs = ref->inlineContents (flags & ~ (LDSubfile::CacheInline));
 
 				for (LDObject* otherobj : otherobjs)
-				{	// Cache this object, if desired
+				{
+					// Cache this object, if desired
 					if (doCache)
 						objcache << otherobj->createCopy();
 
@@ -1088,7 +1193,8 @@
 				}
 			}
 			else
-			{	if (doCache)
+			{
+				if (doCache)
 					objcache << obj->createCopy();
 
 				objs << obj->createCopy();
@@ -1105,7 +1211,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocument* LDDocument::current()
-{	return m_curdoc;
+{
+	return m_curdoc;
 }
 
 // =============================================================================
@@ -1115,7 +1222,8 @@
 // FIXME: f can be temporarily null. This probably should not be the case.
 // -----------------------------------------------------------------------------
 void LDDocument::setCurrent (LDDocument* f)
-{	// Implicit files were loaded for caching purposes and must never be set
+{
+	// Implicit files were loaded for caching purposes and must never be set
 	// current.
 	if (f && f->isImplicit())
 		return;
@@ -1123,7 +1231,8 @@
 	m_curdoc = f;
 
 	if (g_win && f)
-	{	// A ton of stuff needs to be updated
+	{
+		// A ton of stuff needs to be updated
 		g_win->updateDocumentListItem (f);
 		g_win->buildObjList();
 		g_win->updateTitle();
@@ -1137,7 +1246,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int LDDocument::countExplicitFiles()
-{	int count = 0;
+{
+	int count = 0;
 
 	for (LDDocument* f : g_loadedFiles)
 		if (f->isImplicit() == false)
@@ -1151,7 +1261,8 @@
 // a new file over it.
 // -----------------------------------------------------------------------------
 void LDDocument::closeInitialFile()
-{	if (
+{
+	if (
 		countExplicitFiles() == 2 &&
 		g_loadedFiles[0]->getName().isEmpty() &&
 		g_loadedFiles[1]->getName().isEmpty() == false &&
@@ -1163,7 +1274,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void loadLogoedStuds()
-{	if (g_logoedStud && g_logoedStud2)
+{
+	if (g_logoedStud && g_logoedStud2)
 		return;
 
 	delete g_logoedStud;
@@ -1178,7 +1290,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::addToSelection (LDObject* obj) // [protected]
-{	if (obj->isSelected())
+{
+	if (obj->isSelected())
 		return;
 
 	assert (obj->getFile() == this);
@@ -1189,7 +1302,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::removeFromSelection (LDObject* obj) // [protected]
-{	if (!obj->isSelected())
+{
+	if (!obj->isSelected())
 		return;
 
 	assert (obj->getFile() == this);
@@ -1200,7 +1314,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::clearSelection()
-{	for (LDObject* obj : m_sel)
+{
+	for (LDObject* obj : m_sel)
 		removeFromSelection (obj);
 
 	assert (m_sel.isEmpty());
@@ -1209,13 +1324,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 const QList<LDObject*>& LDDocument::getSelection() const
-{	return m_sel;
+{
+	return m_sel;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::swapObjects (LDObject* one, LDObject* other)
-{	int a = m_Objects.indexOf (one);
+{
+	int a = m_Objects.indexOf (one);
 	int b = m_Objects.indexOf (other);
 	assert (a != b && a != -1 && b != -1);
 	m_Objects[b] = one;
@@ -1226,7 +1343,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDDocument::shortenName (str a) // [static]
-{	str shortname = basename (a);
+{
+	str shortname = basename (a);
 	str topdirname = basename (dirname (a));
 
 	if (g_specialSubdirectories.contains (topdirname))
@@ -1238,13 +1356,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::addReference (LDDocumentPointer* ptr)
-{	m_refs << ptr;
+{
+	m_refs << ptr;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocument::removeReference (LDDocumentPointer* ptr)
-{	m_refs.removeOne (ptr);
+{
+	m_refs.removeOne (ptr);
 
 	if (m_refs.size() == 0)
 		invokeLater (closeUnused);
--- a/src/document.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/document.h	Tue Jan 07 08:53:27 2014 +0200
@@ -29,7 +29,8 @@
 class LDDocumentPointer;
 
 namespace LDPaths
-{	void initPaths();
+{
+	void initPaths();
 	bool tryConfigure (str path);
 
 	str ldconfig();
@@ -52,18 +53,19 @@
 // primitive generator uses this to give initial names to primitives.
 // =============================================================================
 class LDDocument : public QObject
-{	properties:
+{
+	properties:
 		Q_OBJECT
 		PROPERTY (private,	QList<LDObject*>,	Objects, 		NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	History*,			History,			NO_OPS,		STOCK_WRITE)
+		PROPERTY (private,	History*,			History,		NO_OPS,		STOCK_WRITE)
 		PROPERTY (private,	QList<LDObject*>,	Vertices,		NO_OPS,		STOCK_WRITE)
-		PROPERTY (public,		str,					Name,				STR_OPS,		STOCK_WRITE)
-		PROPERTY (public,		str,					FullPath,		STR_OPS,		STOCK_WRITE)
-		PROPERTY (public,		str,					DefaultName,	STR_OPS,		STOCK_WRITE)
-		PROPERTY (public,		bool,					Implicit,		BOOL_OPS,	STOCK_WRITE)
-		PROPERTY (public,		QList<LDObject*>,	Cache,			NO_OPS,		STOCK_WRITE)
-		PROPERTY (public,		long,					SavePosition,	NUM_OPS,		STOCK_WRITE)
-		PROPERTY (public,		QListWidgetItem*,	ListItem,		NO_OPS,		STOCK_WRITE)
+		PROPERTY (public,	str,				Name,			STR_OPS,	STOCK_WRITE)
+		PROPERTY (public,	str,				FullPath,		STR_OPS,	STOCK_WRITE)
+		PROPERTY (public,	str,				DefaultName,	STR_OPS,	STOCK_WRITE)
+		PROPERTY (public,	bool,				Implicit,		BOOL_OPS,	STOCK_WRITE)
+		PROPERTY (public,	QList<LDObject*>,	Cache,			NO_OPS,		STOCK_WRITE)
+		PROPERTY (public,	long,				SavePosition,	NUM_OPS,	STOCK_WRITE)
+		PROPERTY (public,	QListWidgetItem*,	ListItem,		NO_OPS,		STOCK_WRITE)
 
 	public:
 		LDDocument();
@@ -89,28 +91,34 @@
 		int numReferences() const { return m_refs.size(); }
 
 		inline LDDocument& operator<< (LDObject* obj)
-		{	addObject (obj);
+		{
+			addObject (obj);
 			return *this;
 		}
 
 		inline void addHistoryStep()
-		{	m_History->addStep();
+		{
+			m_History->addStep();
 		}
 
 		inline void undo()
-		{	m_History->undo();
+		{
+			m_History->undo();
 		}
 
 		inline void redo()
-		{	m_History->redo();
+		{
+			m_History->redo();
 		}
 
 		inline void clearHistory()
-		{	m_History->clear();
+		{
+			m_History->clear();
 		}
 
 		inline void addToHistory (AbstractHistoryEntry* entry)
-		{	*m_History << entry;
+		{
+			*m_History << entry;
 		}
 
 		static void closeUnused();
@@ -135,7 +143,8 @@
 };
 
 inline LDDocument* getCurrentDocument()
-{	return LDDocument::current();
+{
+	return LDDocument::current();
 }
 
 // Close all current loaded files and start off blank.
@@ -175,7 +184,8 @@
 extern QList<LDDocument*> g_loadedFiles;
 
 inline const QList<LDObject*>& selection()
-{	return getCurrentDocument()->getSelection();
+{
+	return getCurrentDocument()->getSelection();
 }
 
 void addRecentFile (str path);
@@ -195,7 +205,8 @@
 // event loop, allowing the program to maintain responsivity during loading.
 // =============================================================================
 class LDFileLoader : public QObject
-{	Q_OBJECT
+{
+	Q_OBJECT
 	PROPERTY (private,	QList<LDObject*>,	Objects,			NO_OPS,		STOCK_WRITE)
 	PROPERTY (private,	bool,					Done,				BOOL_OPS,	STOCK_WRITE)
 	PROPERTY (private,	int,					Progress,		NUM_OPS,		STOCK_WRITE)
--- a/src/download.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/download.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -40,10 +40,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloader::staticBegin()
-{	str path = getDownloadPath();
+{
+	str path = getDownloadPath();
 
 	if (path == "" || QDir (path).exists() == false)
-	{	critical (PartDownloader::tr ("You need to specify a valid path for "
+	{
+		critical (PartDownloader::tr ("You need to specify a valid path for "
 			"downloaded files in the configuration to download paths."));
 
 		(new ConfigDialog (ConfigDialog::DownloadTab, null))->exec();
@@ -57,7 +59,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str PartDownloader::getDownloadPath()
-{	str path = net_downloadpath;
+{
+	str path = net_downloadpath;
 
 #if DIRSLASH_CHAR != '/'
 	path.replace (DIRSLASH, "/");
@@ -69,7 +72,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 PartDownloader::PartDownloader (QWidget* parent) : QDialog (parent)
-{	setInterface (new Ui_DownloadFrom);
+{
+	setInterface (new Ui_DownloadFrom);
 	getInterface()->setupUi (this);
 	getInterface()->fname->setFocus();
 	getInterface()->progress->horizontalHeader()->setResizeMode (PartLabelColumn, QHeaderView::Stretch);
@@ -87,17 +91,20 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 PartDownloader::~PartDownloader()
-{	delete getInterface();
+{
+	delete getInterface();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 str PartDownloader::getURL() const
-{	const Source src = getSource();
+{
+	const Source src = getSource();
 	str dest;
 
 	switch (src)
-	{	case PartsTracker:
+	{
+		case PartsTracker:
 			dest = getInterface()->fname->text();
 			modifyDestination (dest);
 			return g_unofficialLibraryURL + dest;
@@ -113,7 +120,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloader::modifyDestination (str& dest) const
-{	dest = dest.simplified();
+{
+	dest = dest.simplified();
 
 	// If the user doesn't want us to guess, stop right here.
 	if (net_guesspaths == false)
@@ -121,7 +129,8 @@
 
 	// Ensure .dat extension
 	if (dest.right (4) != ".dat")
-	{	// Remove the existing extension, if any. It may be we're here over a
+	{
+		// Remove the existing extension, if any. It may be we're here over a
 		// typo in the .dat extension.
 		const int dotpos = dest.lastIndexOf (".");
 
@@ -134,10 +143,12 @@
 	// If the part starts with s\ or s/, then use parts/s/. Same goes with
 	// 48\ and p/48/.
 	if (dest.left (2) == "s\\" || dest.left (2) == "s/")
-	{	dest.remove (0, 2);
+	{
+		dest.remove (0, 2);
 		dest.prepend ("parts/s/");
 	} elif (dest.left (3) == "48\\" || dest.left (3) == "48/")
-	{	dest.remove (0, 3);
+	{
+		dest.remove (0, 3);
 		dest.prepend ("p/48/");
 	}
 
@@ -171,13 +182,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 PartDownloader::Source PartDownloader::getSource() const
-{	return (Source) getInterface()->source->currentIndex();
+{
+	return (Source) getInterface()->source->currentIndex();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloader::sourceChanged (int i)
-{	if (i == CustomURL)
+{
+	if (i == CustomURL)
 		getInterface()->fileNameLabel->setText (tr ("URL:"));
 	else
 		getInterface()->fileNameLabel->setText (tr ("File name:"));
@@ -186,17 +199,21 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloader::buttonClicked (QAbstractButton* btn)
-{	if (btn == getButton (Close))
-	{	reject();
+{
+	if (btn == getButton (Close))
+	{
+		reject();
 	}
 	elif (btn == getButton (Abort))
-	{	setAborted (true);
+	{
+		setAborted (true);
 
 		for (PartDownloadRequest* req : getRequests())
 			req->abort();
 	}
 	elif (btn == getButton (Download))
-	{	str dest = getInterface()->fname->text();
+	{
+		str dest = getInterface()->fname->text();
 		setPrimaryFile (null);
 		setAborted (false);
 
@@ -206,7 +223,8 @@
 		modifyDestination (dest);
 
 		if (QFile::exists (PartDownloader::getDownloadPath() + DIRSLASH + dest))
-		{	const str overwritemsg = fmt (tr ("%1 already exists in download directory. Overwrite?"), dest);
+		{
+			const str overwritemsg = fmt (tr ("%1 already exists in download directory. Overwrite?"), dest);
 			if (!confirm (tr ("Overwrite?"), overwritemsg))
 				return;
 		}
@@ -225,7 +243,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloader::downloadFile (str dest, str url, bool primary)
-{	const int row = getInterface()->progress->rowCount();
+{
+	const int row = getInterface()->progress->rowCount();
 
 	// Don't download files repeadetly.
 	if (getFilesToDownload().indexOf (dest) != -1)
@@ -245,11 +264,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloader::checkIfFinished()
-{	bool failed = isAborted();
+{
+	bool failed = isAborted();
 
 	// If there is some download still working, we're not finished.
 	for (PartDownloadRequest* req : getRequests())
-	{	if (!req->isFinished())
+	{
+		if (!req->isFinished())
 			return;
 
 		if (req->getState() == PartDownloadRequest::EFailed)
@@ -263,18 +284,21 @@
 
 	// Update everything now
 	if (getPrimaryFile())
-	{	LDDocument::setCurrent (getPrimaryFile());
+	{
+		LDDocument::setCurrent (getPrimaryFile());
 		reloadAllSubfiles();
 		g_win->doFullRefresh();
 		g_win->R()->resetAngles();
 	}
 
 	if (net_autoclose && !failed)
-	{	// Close automatically if desired.
+	{
+		// Close automatically if desired.
 		accept();
 	}
 	else
-	{	// Allow the prompt be closed now.
+	{
+		// Allow the prompt be closed now.
 		getButton (Abort)->setEnabled (false);
 		getButton (Close)->setEnabled (true);
 	}
@@ -283,8 +307,10 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 QPushButton* PartDownloader::getButton (PartDownloader::Button i)
-{	switch (i)
-	{	case Download:
+{
+	switch (i)
+	{
+		case Download:
 			return getDownloadButton();
 
 		case Abort:
@@ -317,7 +343,8 @@
 	QDir dir (dirpath);
 
 	if (!dir.exists())
-	{	log ("Creating %1...\n", dirpath);
+	{
+		log ("Creating %1...\n", dirpath);
 
 		if (!dir.mkpath (dirpath))
 			critical (fmt (tr ("Couldn't create the directory %1!"), dirpath));
@@ -337,18 +364,22 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloadRequest::updateToTable()
-{	const int		labelcol = PartDownloader::PartLabelColumn,
+{
+	const int		labelcol = PartDownloader::PartLabelColumn,
 						progcol = PartDownloader::ProgressColumn;
 	QTableWidget*	table = getPrompt()->getInterface()->progress;
 	QProgressBar*	prog;
 
 	switch (getState())
-	{	case ERequesting:
+	{
+		case ERequesting:
 		case EDownloading:
-		{	prog = qobject_cast<QProgressBar*> (table->cellWidget (getTableRow(), progcol));
+		{
+			prog = qobject_cast<QProgressBar*> (table->cellWidget (getTableRow(), progcol));
 
 			if (!prog)
-			{	prog = new QProgressBar;
+			{
+				prog = new QProgressBar;
 				table->setCellWidget (getTableRow(), progcol, prog);
 			}
 
@@ -358,7 +389,8 @@
 
 		case EFinished:
 		case EFailed:
-		{	const str text = (getState() == EFinished)
+		{
+			const str text = (getState() == EFinished)
 				? "<b><span style=\"color: #080\">FINISHED</span></b>"
 				: "<b><span style=\"color: #800\">FAILED</span></b>";
 
@@ -371,7 +403,8 @@
 	QLabel* lb = qobject_cast<QLabel*> (table->cellWidget (getTableRow(), labelcol));
 
 	if (isFirstUpdate())
-	{	lb = new QLabel (fmt ("<b>%1</b>", getDestinaton()), table);
+	{
+		lb = new QLabel (fmt ("<b>%1</b>", getDestinaton()), table);
 		table->setCellWidget (getTableRow(), labelcol, lb);
 	}
 
@@ -385,8 +418,10 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloadRequest::downloadFinished()
-{	if (getReply()->error() != QNetworkReply::NoError)
-	{	if (isPrimary() && !getPrompt()->isAborted())
+{
+	if (getReply()->error() != QNetworkReply::NoError)
+	{
+		if (isPrimary() && !getPrompt()->isAborted())
 			critical (getReply()->errorString());
 
 		setState (EFailed);
@@ -398,7 +433,8 @@
 	updateToTable();
 
 	if (getFilePointer())
-	{	getFilePointer()->close();
+	{
+		getFilePointer()->close();
 		delete getFilePointer();
 		setFilePointer (null);
 
@@ -407,7 +443,8 @@
 	}
 
 	if (getState() != EFinished)
-	{	getPrompt()->checkIfFinished();
+	{
+		getPrompt()->checkIfFinished();
 		return;
 	}
 
@@ -424,7 +461,8 @@
 	// This is why downloading a part may end up downloading multiple files, as
 	// it resolves dependencies.
 	for (LDObject* obj : f->getObjects())
-	{	LDError* err = dynamic_cast<LDError*> (obj);
+	{
+		LDError* err = dynamic_cast<LDError*> (obj);
 
 		if (!err || err->getFileReferenced().isEmpty())
 			continue;
@@ -435,7 +473,8 @@
 	}
 
 	if (isPrimary())
-	{	addRecentFile (getFilePath());
+	{
+		addRecentFile (getFilePath());
 		getPrompt()->setPrimaryFile (f);
 	}
 
@@ -445,7 +484,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloadRequest::downloadProgress (int64 recv, int64 total)
-{	setBytesRead (recv);
+{
+	setBytesRead (recv);
 	setBytesTotal (total);
 	setState (EDownloading);
 	updateToTable();
@@ -454,18 +494,21 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloadRequest::readyRead()
-{	if (getState() == EFailed)
+{
+	if (getState() == EFailed)
 		return;
 
 	if (getFilePointer() == null)
-	{	replaceInFilePath ("\\", "/");
+	{
+		replaceInFilePath ("\\", "/");
 
 		// We have already asked the user whether we can overwrite so we're good
 		// to go here.
 		setFilePointer (new QFile (getFilePath().toLocal8Bit()));
 
 		if (!getFilePointer()->open (QIODevice::WriteOnly))
-		{	critical (fmt (tr ("Couldn't open %1 for writing: %2"), getFilePath(), strerror (errno)));
+		{
+			critical (fmt (tr ("Couldn't open %1 for writing: %2"), getFilePath(), strerror (errno)));
 			setState (EFailed);
 			getReply()->abort();
 			updateToTable();
@@ -480,17 +523,20 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool PartDownloadRequest::isFinished() const
-{	return getState() == EFinished || getState() == EFailed;
+{
+	return getState() == EFinished || getState() == EFailed;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PartDownloadRequest::abort()
-{	getReply()->abort();
+{
+	getReply()->abort();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (DownloadFrom, 0)
-{	PartDownloader::staticBegin();
+{
+	PartDownloader::staticBegin();
 }
--- a/src/download.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/download.h	Tue Jan 07 08:53:27 2014 +0200
@@ -35,20 +35,24 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 class PartDownloader : public QDialog
-{	typedefs:
+{
+	typedefs:
 		enum Source
-		{	PartsTracker,
+		{
+			PartsTracker,
 			CustomURL,
 		};
 
 		enum Button
-		{	Download,
+		{
+			Download,
 			Abort,
 			Close
 		};
 
 		enum TableColumn
-		{	PartLabelColumn,
+		{
+			PartLabelColumn,
 			ProgressColumn,
 		};
 
@@ -56,38 +60,40 @@
 
 	properties:
 		Q_OBJECT
-		PROPERTY (public,		LDDocument*, 			PrimaryFile,		NO_OPS,		STOCK_WRITE)
-		PROPERTY (public,		bool,					Aborted,				BOOL_OPS,	STOCK_WRITE)
+		PROPERTY (public,	LDDocument*, 		PrimaryFile,		NO_OPS,		STOCK_WRITE)
+		PROPERTY (public,	bool,				Aborted,			BOOL_OPS,	STOCK_WRITE)
 		PROPERTY (private,	Ui_DownloadFrom*,	Interface,			NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	QStringList,		FilesToDownload,	LIST_OPS,	STOCK_WRITE)
+		PROPERTY (private,	QStringList,			FilesToDownload,		LIST_OPS,	STOCK_WRITE)
 		PROPERTY (private,	RequestList,		Requests,			LIST_OPS,	STOCK_WRITE)
-		PROPERTY (private,	QPushButton*,		DownloadButton,	NO_OPS,		STOCK_WRITE)
+		PROPERTY (private,	QPushButton*,		DownloadButton,		NO_OPS,		STOCK_WRITE)
 
-	public methods:
-		explicit			PartDownloader (QWidget* parent = null);
+	public:
+		explicit		PartDownloader (QWidget* parent = null);
 		virtual			~PartDownloader();
 
-		void				downloadFile (str dest, str url, bool primary);
-		QPushButton*	getButton (Button i);
+		void			downloadFile (str dest, str url, bool primary);
+		QPushButton*		getButton (Button i);
 		str				getURL() const;
 		Source			getSource() const;
-		void				modifyDestination (str& dest) const;
+		void			modifyDestination (str& dest) const;
 
 		static str		getDownloadPath();
 		static void		staticBegin();
 
 	public slots:
-		void				buttonClicked (QAbstractButton* btn);
-		void				checkIfFinished();
-		void				sourceChanged (int i);
+		void			buttonClicked (QAbstractButton* btn);
+		void			checkIfFinished();
+		void			sourceChanged (int i);
 };
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 class PartDownloadRequest : public QObject
-{	typedefs:
+{
+	typedefs:
 		enum EState
-		{	ERequesting,
+		{
+			ERequesting,
 			EDownloading,
 			EFinished,
 			EFailed,
@@ -95,21 +101,21 @@
 
 	properties:
 		Q_OBJECT
-		PROPERTY (public,		int,							TableRow,		NUM_OPS,		STOCK_WRITE)
-		PROPERTY (private,	EState,						State,			NO_OPS,		STOCK_WRITE)
+		PROPERTY (public,	int,						TableRow,		NUM_OPS,	STOCK_WRITE)
+		PROPERTY (private,	EState,					State,			NO_OPS,		STOCK_WRITE)
 		PROPERTY (private,	PartDownloader*,			Prompt,			NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	str,							URL,				STR_OPS,		STOCK_WRITE)
-		PROPERTY (private,	str,							Destinaton,		STR_OPS,		STOCK_WRITE)
-		PROPERTY (private,	str,							FilePath,		STR_OPS,		STOCK_WRITE)
-		PROPERTY (private,	QNetworkAccessManager*,	NAM,				NO_OPS,		STOCK_WRITE)
+		PROPERTY (private,	str,					URL,			STR_OPS,	STOCK_WRITE)
+		PROPERTY (private,	str,					Destinaton,		STR_OPS,	STOCK_WRITE)
+		PROPERTY (private,	str,					FilePath,		STR_OPS,	STOCK_WRITE)
+		PROPERTY (private,	QNetworkAccessManager*,	NAM,			NO_OPS,		STOCK_WRITE)
 		PROPERTY (private,	QNetworkReply*,			Reply,			NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	bool,							FirstUpdate,	BOOL_OPS,	STOCK_WRITE)
-		PROPERTY (private,	int64,						BytesRead,		NUM_OPS,		STOCK_WRITE)
-		PROPERTY (private,	int64,						BytesTotal,		NUM_OPS,		STOCK_WRITE)
-		PROPERTY (private,	bool,							Primary,			BOOL_OPS,	STOCK_WRITE)
-		PROPERTY (private,	QFile*,						FilePointer,	NO_OPS,		STOCK_WRITE)
+		PROPERTY (private,	bool,					FirstUpdate,	BOOL_OPS,	STOCK_WRITE)
+		PROPERTY (private,	int64,					BytesRead,		NUM_OPS,	STOCK_WRITE)
+		PROPERTY (private,	int64,					BytesTotal,		NUM_OPS,	STOCK_WRITE)
+		PROPERTY (private,	bool,					Primary,		BOOL_OPS,	STOCK_WRITE)
+		PROPERTY (private,	QFile*,					FilePointer,	NO_OPS,		STOCK_WRITE)
 
-	public methods:
+	public:
 		explicit PartDownloadRequest (str url, str dest, bool primary, PartDownloader* parent);
 		PartDownloadRequest (const PartDownloadRequest&) = delete;
 		virtual ~PartDownloadRequest();
--- a/src/extprogs.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/extprogs.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -40,7 +40,8 @@
 #include "dialogs.h"
 
 enum extprog
-{	Isecalc,
+{
+	Isecalc,
 	Intersector,
 	Coverer,
 	Ytruder,
@@ -58,7 +59,8 @@
 cfg (String, prog_edger2, "");
 
 str* const g_extProgPaths[] =
-{	&prog_isecalc,
+{
+	&prog_isecalc,
 	&prog_intersector,
 	&prog_coverer,
 	&prog_ytruder,
@@ -75,7 +77,8 @@
 cfg (Bool, prog_edger2_wine, false);
 
 bool* const g_extProgWine[] =
-{	&prog_isecalc_wine,
+{
+	&prog_isecalc_wine,
 	&prog_intersector_wine,
 	&prog_coverer_wine,
 	&prog_ytruder_wine,
@@ -85,7 +88,8 @@
 #endif // _WIN32
 
 const char* g_extProgNames[] =
-{	"Isecalc",
+{
+	"Isecalc",
 	"Intersector",
 	"Coverer",
 	"Ytruder",
@@ -96,7 +100,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static bool checkProgPath (const extprog prog)
-{	str& path = *g_extProgPaths[prog];
+{
+	str& path = *g_extProgPaths[prog];
 
 	if (path.length() > 0)
 		return true;
@@ -104,7 +109,8 @@
 	ExtProgPathPrompt* dlg = new ExtProgPathPrompt (g_extProgNames[prog]);
 
 	if (dlg->exec() && !dlg->getPath().isEmpty())
-	{	path = dlg->getPath();
+	{
+		path = dlg->getPath();
 		return true;
 	}
 
@@ -114,9 +120,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static str processErrorString (extprog prog, QProcess& proc)
-{	switch (proc.error())
-	{	case QProcess::FailedToStart:
-		{	str wineblurb;
+{
+	switch (proc.error())
+	{
+		case QProcess::FailedToStart:
+		{
+			str wineblurb;
 
 #ifndef _WIN32
 			if (*g_extProgWine[prog])
@@ -146,7 +155,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static bool mkTempFile (QTemporaryFile& tmp, str& fname)
-{	if (!tmp.open())
+{
+	if (!tmp.open())
 		return false;
 
 	fname = tmp.fileName();
@@ -157,9 +167,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static void writeObjects (const QList<LDObject*>& objects, File& f)
-{	for (LDObject* obj : objects)
-	{	if (obj->getType() == LDObject::Subfile)
-		{	LDSubfile* ref = static_cast<LDSubfile*> (obj);
+{
+	for (LDObject* obj : objects)
+	{
+		if (obj->getType() == LDObject::Subfile)
+		{
+			LDSubfile* ref = static_cast<LDSubfile*> (obj);
 			QList<LDObject*> objs = ref->inlineContents (LDSubfile::DeepInline);
 
 			writeObjects (objs, f);
@@ -175,11 +188,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static void writeObjects (const QList<LDObject*>& objects, str fname)
-{	// Write the input file
+{
+	// Write the input file
 	File f (fname, File::Write);
 
 	if (!f)
-	{	critical (fmt ("Couldn't open temporary file %1 for writing.\n", fname));
+	{
+		critical (fmt ("Couldn't open temporary file %1 for writing.\n", fname));
 		return;
 	}
 
@@ -194,16 +209,19 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void writeSelection (str fname)
-{	writeObjects (selection(), fname);
+{
+	writeObjects (selection(), fname);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void writeColorGroup (const int colnum, str fname)
-{	QList<LDObject*> objects;
+{
+	QList<LDObject*> objects;
 
 	for (LDObject* obj : getCurrentDocument()->getObjects())
-	{	if (obj->isColored() == false || obj->getColor() != colnum)
+	{
+		if (obj->isColored() == false || obj->getColor() != colnum)
 			continue;
 
 		objects << obj;
@@ -215,13 +233,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool runUtilityProcess (extprog prog, str path, str argvstr)
-{	QTemporaryFile input, output;
+{
+	QTemporaryFile input, output;
 	str inputname, outputname;
 	QStringList argv = argvstr.split (" ", QString::SkipEmptyParts);
 
 #ifndef _WIN32
 	if (*g_extProgWine[prog])
-	{	argv.insert (0, path);
+	{
+		argv.insert (0, path);
 		path = "wine";
 	}
 #endif // _WIN32
@@ -242,7 +262,8 @@
 	proc.start (path, argv);
 
 	if (!proc.waitForStarted())
-	{	critical (fmt ("Couldn't start %1: %2\n", g_extProgNames[prog], processErrorString (prog, proc)));
+	{
+		critical (fmt ("Couldn't start %1: %2\n", g_extProgNames[prog], processErrorString (prog, proc)));
 		return false;
 	}
 
@@ -262,7 +283,8 @@
 		err = fmt ("Program exited abnormally (return code %1).",  proc.exitCode());
 
 	if (!err.isEmpty())
-	{	critical (fmt ("%1 failed: %2\n", g_extProgNames[prog], err));
+	{
+		critical (fmt ("%1 failed: %2\n", g_extProgNames[prog], err));
 		return false;
 	}
 
@@ -281,7 +303,8 @@
 	File f (fname, File::Read);
 
 	if (!f)
-	{	critical (fmt ("Couldn't open temporary file %1 for reading.\n", fname));
+	{
+		critical (fmt ("Couldn't open temporary file %1 for reading.\n", fname));
 		return;
 	}
 
@@ -298,8 +321,10 @@
 	getCurrentDocument()->clearSelection();
 
 	for (LDObject * obj : objs)
-	{	if (!obj->isScemantic())
-		{	obj->deleteSelf();
+	{
+		if (!obj->isScemantic())
+		{
+			obj->deleteSelf();
 			continue;
 		}
 
@@ -314,7 +339,8 @@
 // Interface for Ytruder
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Ytruder, 0)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 
 	if (!checkProgPath (Ytruder))
 		return;
@@ -348,7 +374,8 @@
 
 	// Compose the command-line arguments
 	str argv = join (
-	{	(axis == X) ? "-x" : (axis == Y) ? "-y" : "-z",
+	{
+		(axis == X) ? "-x" : (axis == Y) ? "-y" : "-z",
 		(mode == Distance) ? "-d" : (mode == Symmetry) ? "-s" : (mode == Projection) ? "-p" : "-r",
 		depth,
 		"-a",
@@ -369,7 +396,8 @@
 // Rectifier interface
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Rectifier, 0)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 
 	if (!checkProgPath (Rectifier))
 		return;
@@ -390,7 +418,8 @@
 
 	// Compose arguments
 	str argv = join (
-	{	(!ui.cb_condense->isChecked()) ? "-q" : "",
+	{
+		(!ui.cb_condense->isChecked()) ? "-q" : "",
 		(!ui.cb_subst->isChecked()) ? "-r" : "",
 		(ui.cb_condlineCheck->isChecked()) ? "-a" : "",
 		(ui.cb_colorize->isChecked()) ? "-c" : "",
@@ -412,7 +441,8 @@
 // Intersector interface
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Intersector, 0)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 
 	if (!checkProgPath (Intersector))
 		return;
@@ -431,14 +461,16 @@
 	const bool repeatInverse = ui.cb_repeat->isChecked();
 
 	forever
-	{	if (!dlg->exec())
+	{
+		if (!dlg->exec())
 			return;
 
 		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;
 		}
 
@@ -457,25 +489,29 @@
 	if (!mkTempFile (indat, inDATName) || !mkTempFile (cutdat, cutDATName) ||
 			!mkTempFile (outdat, outDATName) || !mkTempFile (outdat2, outDAT2Name) ||
 			!mkTempFile (edgesdat, edgesDATName))
-	{	return;
+	{
+		return;
 	}
 
 	str parms = join (
-	{	(ui.cb_colorize->isChecked()) ? "-c" : "",
+	{
+		(ui.cb_colorize->isChecked()) ? "-c" : "",
 		(ui.cb_nocondense->isChecked()) ? "-t" : "",
 		"-s",
 		ui.dsb_prescale->value()
 	});
 
 	str argv_normal = join (
-	{	parms,
+	{
+		parms,
 		inDATName,
 		cutDATName,
 		outDATName
 	});
 
 	str argv_inverse = join (
-	{	parms,
+	{
+		parms,
 		cutDATName,
 		inDATName,
 		outDAT2Name
@@ -503,7 +539,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Coverer, 0)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 
 	if (!checkProgPath (Coverer))
 		return;
@@ -517,14 +554,16 @@
 	int in1Col, in2Col;
 
 	forever
-	{	if (!dlg->exec())
+	{
+		if (!dlg->exec())
 			return;
 
 		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;
 		}
 
@@ -538,7 +577,8 @@
 		return;
 
 	str argv = join (
-	{	(ui.cb_oldsweep->isChecked() ? "-s" : ""),
+	{
+		(ui.cb_oldsweep->isChecked() ? "-s" : ""),
 		(ui.cb_reverse->isChecked() ? "-r" : ""),
 		(ui.dsb_segsplit->value() != 0 ? fmt ("-l %1", ui.dsb_segsplit->value()) : ""),
 		(ui.sb_bias->value() != 0 ? fmt ("-s %1", ui.sb_bias->value()) : ""),
@@ -559,7 +599,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Isecalc, 0)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 
 	if (!checkProgPath (Isecalc))
 		return;
@@ -575,14 +616,16 @@
 
 	// Run the dialog and validate input
 	forever
-	{	if (!dlg->exec())
+	{
+		if (!dlg->exec())
 			return;
 
 		in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt(),
 		in2Col = ui.cmb_col1->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;
 		}
 
@@ -596,7 +639,8 @@
 		return;
 
 	str argv = join (
-	{	in1DATName,
+	{
+		in1DATName,
 		in2DATName,
 		outDATName
 	});
@@ -610,7 +654,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Edger2, 0)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 
 	if (!checkProgPath (Edger2))
 		return;
@@ -631,7 +676,8 @@
 	int unmatched = ui.unmatched->currentIndex();
 
 	str argv = join (
-	{	fmt ("-p %1", ui.precision->value()),
+	{
+		fmt ("-p %1", ui.precision->value()),
 		fmt ("-af %1", ui.flatAngle->value()),
 		fmt ("-ac %1", ui.condAngle->value()),
 		fmt ("-ae %1", ui.edgeAngle->value()),
--- a/src/gldraw.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/gldraw.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -41,7 +41,8 @@
 #include "moc_gldraw.cpp"
 
 static const LDFixedCameraInfo g_FixedCameras[6] =
-{	{{  1,  0, 0 }, X, Z, false, false },
+{
+	{{  1,  0, 0 }, X, Z, false, false },
 	{{  0,  0, 0 }, X, Y, false,  true },
 	{{  0,  1, 0 }, Z, Y,  true,  true },
 	{{ -1,  0, 0 }, X, Z, false,  true },
@@ -52,7 +53,8 @@
 // Matrix templates for circle drawing. 2 is substituted with
 // the scale value, 1 is inverted to -1 if needed.
 static const matrix g_circleDrawTransforms[3] =
-{	{ 2, 0, 0, 0, 1, 0, 0, 0, 2 },
+{
+	{ 2, 0, 0, 0, 1, 0, 0, 0, 2 },
 	{ 2, 0, 0, 0, 0, 2, 0, 1, 0 },
 	{ 0, 1, 0, 2, 0, 0, 0, 0, 2 },
 };
@@ -74,7 +76,8 @@
 
 // argh
 const char* g_CameraNames[7] =
-{	QT_TRANSLATE_NOOP ("GLRenderer",  "Top"),
+{
+	QT_TRANSLATE_NOOP ("GLRenderer",  "Top"),
 	QT_TRANSLATE_NOOP ("GLRenderer",  "Front"),
 	QT_TRANSLATE_NOOP ("GLRenderer",  "Left"),
 	QT_TRANSLATE_NOOP ("GLRenderer",  "Bottom"),
@@ -84,7 +87,8 @@
 };
 
 const GL::EFixedCamera g_Cameras[7] =
-{	GL::ETopCamera,
+{
+	GL::ETopCamera,
 	GL::EFrontCamera,
 	GL::ELeftCamera,
 	GL::EBottomCamera,
@@ -95,10 +99,12 @@
 
 // Definitions for visual axes, drawn on the screen
 const struct LDGLAxis
-{	const QColor col;
+{
+	const QColor col;
 	const vertex vert;
 } g_GLAxes[3] =
-{	{ QColor (255,   0,   0), vertex (10000, 0, 0) }, // X
+{
+	{ QColor (255,   0,   0), vertex (10000, 0, 0) }, // X
 	{ QColor (80,  192,   0), vertex (0, 10000, 0) }, // Y
 	{ QColor (0,   160, 192), vertex (0, 0, 10000) }, // Z
 };
@@ -109,7 +115,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 GLRenderer::GLRenderer (QWidget* parent) : QGLWidget (parent)
-{	m_Picking = m_rangepick = false;
+{
+	m_Picking = m_rangepick = false;
 	m_camera = (GL::EFixedCamera) gl_camera;
 	m_drawToolTip = false;
 	m_EditMode = ESelectMode;
@@ -131,7 +138,8 @@
 
 	// Init camera icons
 	for (const GL::EFixedCamera cam : g_Cameras)
-	{	str iconname = fmt ("camera-%1", tr (g_CameraNames[cam]).toLower());
+	{
+		str iconname = fmt ("camera-%1", tr (g_CameraNames[cam]).toLower());
 
 		CameraIcon* info = &m_cameraIcons[cam];
 		info->img = new QPixmap (getIcon (iconname));
@@ -139,7 +147,8 @@
 	}
 
 	for (int i = 0; i < 6; ++i)
-	{	m_overlays[i].img = null;
+	{
+		m_overlays[i].img = null;
 		m_depthValues[i] = 0.0f;
 	}
 
@@ -149,7 +158,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 GLRenderer::~GLRenderer()
-{	for (int i = 0; i < 6; ++i)
+{
+	for (int i = 0; i < 6; ++i)
 		delete m_overlays[i].img;
 
 	for (CameraIcon& info : m_cameraIcons)
@@ -161,10 +171,12 @@
 // cursor is pointing at the camera icon.
 // -----------------------------------------------------------------------------
 void GLRenderer::calcCameraIcons()
-{	int i = 0;
+{
+	int i = 0;
 
 	for (CameraIcon& info : m_cameraIcons)
-	{	// MATH
+	{
+		// MATH
 		const long x1 = (m_width - (info.cam != EFreeCamera ? 48 : 16)) + ((i % 3) * 16) - 1,
 			y1 = ((i / 3) * 16) + 1;
 
@@ -184,7 +196,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::initGLData()
-{	glEnable (GL_BLEND);
+{
+	glEnable (GL_BLEND);
 	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	glEnable (GL_POLYGON_OFFSET_FILL);
 	glPolygonOffset (1.0f, 1.0f);
@@ -194,12 +207,14 @@
 	glEnable (GL_MULTISAMPLE);
 
 	if (gl_aa)
-	{	glEnable (GL_LINE_SMOOTH);
+	{
+		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_LINE_SMOOTH);
 		glDisable (GL_POLYGON_SMOOTH);
 	}
 }
@@ -207,7 +222,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::resetAngles()
-{	rot (X) = 30.0f;
+{
+	rot (X) = 30.0f;
 	rot (Y) = 325.f;
 	pan (X) = pan (Y) = rot (Z) = 0.0f;
 	zoomToFit();
@@ -216,11 +232,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::resetAllAngles()
-{	/*
+{
+	/*
 	EFixedCamera oldcam = camera();
 
 	for (int i = 0; i < 7; ++i)
-	{	setCamera ((EFixedCamera) i);
+	{
+		setCamera ((EFixedCamera) i);
 		resetAngles();
 	}
 
@@ -232,7 +250,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::initializeGL()
-{	setBackground();
+{
+	setBackground();
 
 	glLineWidth (gl_linethickness);
 
@@ -245,7 +264,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 QColor GLRenderer::getMainColor()
-{	QColor col (gl_maincolor);
+{
+	QColor col (gl_maincolor);
 
 	if (!col.isValid())
 		return QColor (0, 0, 0);
@@ -257,7 +277,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::setBackground()
-{	QColor col (gl_bgcolor);
+{
+	QColor col (gl_bgcolor);
 
 	if (!col.isValid())
 		return;
@@ -272,13 +293,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::setObjectColor (LDObject* obj, const ListType list)
-{	QColor qcol;
+{
+	QColor qcol;
 
 	if (!obj->isColored())
 		return;
 
 	if (list == GL::PickList)
-	{	// Make the color by the object's ID if we're picking, so we can make the
+	{
+		// Make the color by the object's ID if we're picking, so we can make the
 		// ID again from the color we get from the picking results. Be sure to use
 		// the top level parent's index since we want a subfile's children point
 		// to the subfile itself.
@@ -298,23 +321,27 @@
 	if ((list == BFCFrontList || list == BFCBackList) &&
 		obj->getType() != LDObject::Line &&
 		obj->getType() != LDObject::CondLine)
-	{	if (list == GL::BFCFrontList)
+	{
+		if (list == GL::BFCFrontList)
 			qcol = QColor (40, 192, 0);
 		else
 			qcol = QColor (224, 0, 0);
 	}
 	else
-	{	if (obj->getColor() == maincolor)
+	{
+		if (obj->getColor() == maincolor)
 			qcol = getMainColor();
 		else
-		{	LDColor* col = getColor (obj->getColor());
+		{
+			LDColor* col = getColor (obj->getColor());
 
 			if (col)
 				qcol = col->faceColor;
 		}
 
 		if (obj->getColor() == edgecolor)
-		{	qcol = (m_darkbg == false) ? Qt::black : Qt::white;
+		{
+			qcol = (m_darkbg == false) ? Qt::black : Qt::white;
 			LDColor* col;
 
 			if (!gl_blackedges && obj->getParent() && (col = getColor (obj->getParent()->getColor())))
@@ -322,7 +349,8 @@
 		}
 
 		if (qcol.isValid() == false)
-		{	// The color was unknown. Use main color to make the object at least
+		{
+			// The color was unknown. Use main color to make the object at least
 			// not appear pitch-black.
 			if (obj->getColor() != edgecolor)
 				qcol = getMainColor();
@@ -344,7 +372,8 @@
 		 a = qcol.alpha();
 
 	if (obj->topLevelParent()->isSelected())
-	{	// Brighten it up for the select list.
+	{
+		// Brighten it up for the select list.
 		QColor selcolor (gl_selectcolor);
 		r = (r + selcolor.red()) / 2;
 		g = (g + selcolor.green()) / 2;
@@ -361,14 +390,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::refresh()
-{	update();
+{
+	update();
 	swapBuffers();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::hardRefresh()
-{	compileAllObjects();
+{
+	compileAllObjects();
 	refresh();
 
 	glLineWidth (gl_linethickness);
@@ -377,7 +408,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::resizeGL (int w, int h)
-{	m_width = w;
+{
+	m_width = w;
 	m_height = h;
 
 	calcCameraIcons();
@@ -392,7 +424,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::drawGLScene()
-{	if (getFile() == null)
+{
+	if (getFile() == null)
 		return;
 
 	if (gl_wireframe && !isPicking())
@@ -402,7 +435,8 @@
 	glEnable (GL_DEPTH_TEST);
 
 	if (m_camera != EFreeCamera)
-	{	glMatrixMode (GL_PROJECTION);
+	{
+		glMatrixMode (GL_PROJECTION);
 		glPushMatrix();
 
 		glLoadIdentity();
@@ -410,19 +444,22 @@
 		glTranslatef (pan (X), pan (Y), 0.0f);
 
 		if (m_camera != EFrontCamera && m_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]);
 		}
 
 		// Back camera needs to be handled differently
 		if (m_camera == GLRenderer::EBackCamera)
-		{	glRotatef (180.0f, 1.0f, 0.0f, 0.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();
 
@@ -436,10 +473,12 @@
 	const GL::ListType list = (!isDrawOnly() && isPicking()) ? PickList : NormalList;
 
 	if (gl_colorbfc && !isPicking() && !isDrawOnly())
-	{	glEnable (GL_CULL_FACE);
+	{
+		glEnable (GL_CULL_FACE);
 
 		for (LDObject* obj : getFile()->getObjects())
-		{	if (obj->isHidden())
+		{
+			if (obj->isHidden())
 				continue;
 
 			glCullFace (GL_BACK);
@@ -452,8 +491,10 @@
 		glDisable (GL_CULL_FACE);
 	}
 	else
-	{	for (LDObject* obj : getFile()->getObjects())
-		{	if (obj->isHidden())
+	{
+		for (LDObject* obj : getFile()->getObjects())
+		{
+			if (obj->isHidden())
 				continue;
 
 			glCallList (obj->glLists[list]);
@@ -474,7 +515,8 @@
 // is true, the 3D point will snap to the current grid.
 // -----------------------------------------------------------------------------
 vertex GLRenderer::coordconv2_3 (const QPoint& pos2d, bool snap) const
-{	assert (camera() != EFreeCamera);
+{
+	assert (camera() != EFreeCamera);
 
 	vertex pos3d;
 	const LDFixedCameraInfo* cam = &g_FixedCameras[m_camera];
@@ -488,7 +530,8 @@
 	double cy = (m_virtHeight - ((2 * pos2d.y() * m_virtHeight) / m_height) - pan (Y));
 
 	if (snap)
-	{	cx = Grid::snap (cx, (Grid::Config) axisX);
+	{
+		cx = Grid::snap (cx, (Grid::Config) axisX);
 		cy = Grid::snap (cy, (Grid::Config) axisY);
 	}
 
@@ -511,7 +554,8 @@
 // position. Don't ask me how this code manages to work, I don't even know.
 // -----------------------------------------------------------------------------
 QPoint GLRenderer::coordconv3_2 (const vertex& pos3d) const
-{	GLfloat m[16];
+{
+	GLfloat m[16];
 	const LDFixedCameraInfo* cam = &g_FixedCameras[m_camera];
 	const Axis axisX = cam->axisX;
 	const Axis axisY = cam->axisY;
@@ -538,7 +582,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::paintEvent (QPaintEvent* ev)
-{	Q_UNUSED (ev)
+{
+	Q_UNUSED (ev)
 
 	makeCurrent();
 	m_virtWidth = zoom();
@@ -558,11 +603,13 @@
 		return;
 
 	if (m_camera != EFreeCamera && !isPicking())
-	{	// Paint the overlay image if we have one
+	{
+		// Paint the overlay image if we have one
 		const LDGLOverlay& overlay = m_overlays[m_camera];
 
 		if (overlay.img != null)
-		{	QPoint v0 = coordconv3_2 (m_overlays[m_camera].v0),
+		{
+			QPoint v0 = coordconv3_2 (m_overlays[m_camera].v0),
 					   v1 = coordconv3_2 (m_overlays[m_camera].v1);
 
 			QRect targRect (v0.x(), v0.y(), abs (v1.x() - v0.x()), abs (v1.y() - v0.y())),
@@ -586,13 +633,15 @@
 
 		// Mode-specific rendering
 		if (getEditMode() == EDrawMode)
-		{	QPoint poly[4];
+		{
+			QPoint poly[4];
 			vertex poly3d[4];
 			int numverts = 4;
 
 			// Calculate polygon data
 			if (!m_rectdraw)
-			{	numverts = m_drawedVerts.size() + 1;
+			{
+				numverts = m_drawedVerts.size() + 1;
 				int i = 0;
 
 				for (vertex& vert : m_drawedVerts)
@@ -605,7 +654,8 @@
 					numverts = 4;
 			}
 			else
-			{	// Get vertex information from m_rectverts
+			{
+				// Get vertex information from m_rectverts
 				if (m_drawedVerts.size() > 0)
 					for (int i = 0; i < numverts; ++i)
 						poly3d[i] = m_rectverts[i];
@@ -618,14 +668,16 @@
 				poly[i] = coordconv3_2 (poly3d[i]);
 
 			if (numverts > 0)
-			{	// Draw the polygon-to-be
+			{
+				// Draw the polygon-to-be
 				paint.setPen (linepen);
 				paint.setBrush (polybrush);
 				paint.drawPolygon (poly, numverts);
 
 				// Draw vertex blips
 				for (int i = 0; i < numverts; ++i)
-				{	QPoint& blip = poly[i];
+				{
+					QPoint& blip = poly[i];
 					drawBlip (paint, blip);
 
 					// Draw their coordinates
@@ -634,21 +686,25 @@
 
 				// Draw line lenghts and angle info if appropriate
 				if (numverts >= 2)
-				{	int numlines = (m_drawedVerts.size() == 1) ? 1 : m_drawedVerts.size() + 1;
+				{
+					int numlines = (m_drawedVerts.size() == 1) ? 1 : m_drawedVerts.size() + 1;
 					paint.setPen (textpen);
 
 					for (int i = 0; i < numlines; ++i)
-					{	const int j = (i + 1 < numverts) ? i + 1 : 0;
+					{
+						const int j = (i + 1 < numverts) ? i + 1 : 0;
 						const int h = (i - 1 >= 0) ? i - 1 : numverts - 1;
 
 						if (gl_linelengths)
-						{	const str label = str::number (poly3d[i].distanceTo (poly3d[j]));
+						{
+							const str label = str::number (poly3d[i].distanceTo (poly3d[j]));
 							QPoint origin = QLineF (poly[i], poly[j]).pointAt (0.5).toPoint();
 							paint.drawText (origin, label);
 						}
 
 						if (gl_drawangles)
-						{	QLineF l0 (poly[h], poly[i]),
+						{
+							QLineF l0 (poly[h], poly[i]),
 								l1 (poly[i], poly[j]);
 
 							double angle = 180 - l0.angleTo (l1);
@@ -667,11 +723,13 @@
 			}
 		}
 		elif (getEditMode() == ECircleMode)
-		{	// If we have not specified the center point of the circle yet, preview it on the screen.
+		{
+			// If we have not specified the center point of the circle yet, preview it on the screen.
 			if (m_drawedVerts.isEmpty())
 				drawBlip (paint, coordconv3_2 (m_hoverpos));
 			else
-			{	QVector<vertex> verts, verts2;
+			{
+				QVector<vertex> verts, verts2;
 				const double dist0 = getCircleDrawDist (0),
 					dist1 = (m_drawedVerts.size() >= 2) ? getCircleDrawDist (1) : -1;
 				const int segs = lores;
@@ -683,13 +741,15 @@
 
 				// Calculate the preview positions of vertices
 				for (int i = 0; i < segs; ++i)
-				{	vertex v = g_origin;
+				{
+					vertex v = g_origin;
 					v[relX] = m_drawedVerts[0][relX] + (cos (i * angleUnit) * dist0);
 					v[relY] = m_drawedVerts[0][relY] + (sin (i * angleUnit) * dist0);
 					verts << v;
 
 					if (dist1 != -1)
-					{	v[relX] = m_drawedVerts[0][relX] + (cos (i * angleUnit) * dist1);
+					{
+						v[relX] = m_drawedVerts[0][relX] + (cos (i * angleUnit) * dist1);
 						v[relY] = m_drawedVerts[0][relY] + (sin (i * angleUnit) * dist1);
 						verts2 << v;
 					}
@@ -697,7 +757,8 @@
 
 				int i = 0;
 				for (const vertex& v : verts + verts2)
-				{	// Calculate the 2D point of the vertex
+				{
+					// Calculate the 2D point of the vertex
 					QPoint point = coordconv3_2 (v);
 
 					// Draw a green blip at where it is
@@ -743,7 +804,8 @@
 					paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y(), label);
 
 					if (m_drawedVerts.size() >= 2)
-					{	label = str::number (dist1);
+					{
+						label = str::number (dist1);
 						paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y() + metrics.height(), label);
 					}
 				}
@@ -753,14 +815,16 @@
 
 	// Camera icons
 	if (!isPicking())
-	{	// Draw a background for the selected camera
+	{
+		// 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);
 
 		// Draw the actual icons
 		for (CameraIcon& info : m_cameraIcons)
-		{	// Don't draw the free camera icon when in draw mode
+		{
+			// Don't draw the free camera icon when in draw mode
 			if (&info == &m_cameraIcons[GL::EFreeCamera] && getEditMode() != ESelectMode)
 				continue;
 
@@ -770,7 +834,8 @@
 		str fmtstr = tr ("%1 Camera");
 
 		// Draw a label for the current camera in the bottom left corner
-		{	const int margin = 4;
+		{
+			const int margin = 4;
 
 			str label;
 			label = fmt (fmtstr, tr (g_CameraNames[camera()]));
@@ -780,10 +845,12 @@
 
 		// Tool tips
 		if (m_drawToolTip)
-		{	if (m_cameraIcons[m_toolTipCamera].destRect.contains (m_pos) == false)
+		{
+			if (m_cameraIcons[m_toolTipCamera].destRect.contains (m_pos) == false)
 				m_drawToolTip = false;
 			else
-			{	str label = fmt (fmtstr, tr (g_CameraNames[m_toolTipCamera]));
+			{
+				str label = fmt (fmtstr, tr (g_CameraNames[m_toolTipCamera]));
 				QToolTip::showText (m_globalpos, label);
 			}
 		}
@@ -791,12 +858,14 @@
 
 	// Message log
 	if (getMessageLog())
-	{	int y = 0;
+	{
+		int y = 0;
 		const int margin = 2;
 		QColor penColor = textpen.color();
 
 		for (const MessageManager::Line& line : getMessageLog()->getLines())
-		{	penColor.setAlphaF (line.alpha);
+		{
+			penColor.setAlphaF (line.alpha);
 			paint.setPen (penColor);
 			paint.drawText (QPoint (margin, y + margin + metrics.ascent()), line.text);
 			y += metrics.height();
@@ -805,7 +874,8 @@
 
 	// If we're range-picking, draw a rectangle encompassing the selection area.
 	if (m_rangepick && !isPicking() && m_totalmove >= 10)
-	{	int x0 = m_rangeStart.x(),
+	{
+		int x0 = m_rangeStart.x(),
 			y0 = m_rangeStart.y(),
 			x1 = m_pos.x(),
 			y1 = m_pos.y();
@@ -823,7 +893,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::drawBlip (QPainter& paint, QPoint pos) const
-{	QPen pen = m_thinBorderPen;
+{
+	QPen pen = m_thinBorderPen;
 	const int blipsize = 8;
 	pen.setWidth (1);
 	paint.setPen (pen);
@@ -834,7 +905,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::compileAllObjects()
-{	if (!getFile())
+{
+	if (!getFile())
 		return;
 
 	// Compiling all is a big job, use a busy cursor
@@ -852,7 +924,8 @@
 	glBegin (GL_LINES);
 
 	for (const LDGLAxis& ax : g_GLAxes)
-	{	qglColor (ax.col);
+	{
+		qglColor (ax.col);
 		compileVertex (ax.vert);
 		compileVertex (-ax.vert);
 	}
@@ -866,7 +939,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::compileSubObject (LDObject* obj, const GLenum gltype)
-{	glBegin (gltype);
+{
+	glBegin (gltype);
 
 	const int numverts = (obj->getType() != LDObject::CondLine) ? obj->vertices() : 2;
 
@@ -883,18 +957,23 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::compileList (LDObject* obj, const GLRenderer::ListType list)
-{	setObjectColor (obj, list);
+{
+	setObjectColor (obj, list);
 
 	switch (obj->getType())
-	{	case LDObject::Line:
-		{	compileSubObject (obj, GL_LINES);
+	{
+		case LDObject::Line:
+		{
+			compileSubObject (obj, GL_LINES);
 		} break;
 
 		case LDObject::CondLine:
-		{	// Draw conditional lines with a dash pattern - however, use a full
+		{
+			// Draw conditional lines with a dash pattern - however, use a full
 			// line when drawing a pick list to make selecting them easier.
 			if (list != GL::PickList)
-			{	glLineStipple (1, 0x6666);
+			{
+				glLineStipple (1, 0x6666);
 				glEnable (GL_LINE_STIPPLE);
 			}
 
@@ -904,15 +983,18 @@
 		} break;
 
 		case LDObject::Triangle:
-		{	compileSubObject (obj, GL_TRIANGLES);
+		{
+			compileSubObject (obj, GL_TRIANGLES);
 		} break;
 
 		case LDObject::Quad:
-		{	compileSubObject (obj, GL_QUADS);
+		{
+			compileSubObject (obj, GL_QUADS);
 		} break;
 
 		case LDObject::Subfile:
-		{	LDSubfile* ref = static_cast<LDSubfile*> (obj);
+		{
+			LDSubfile* ref = static_cast<LDSubfile*> (obj);
 			QList<LDObject*> objs;
 
 			objs = ref->inlineContents (
@@ -930,7 +1012,8 @@
 				g_glInvert = !g_glInvert;
 
 			for (LDObject* obj : objs)
-			{	compileList (obj, list);
+			{
+				compileList (obj, list);
 				obj->deleteSelf();
 			}
 
@@ -945,13 +1028,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::compileVertex (const vertex& vrt)
-{	glVertex3d (vrt[X], -vrt[Y], -vrt[Z]);
+{
+	glVertex3d (vrt[X], -vrt[Y], -vrt[Z]);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::clampAngle (double& angle) const
-{	while (angle < 0)
+{
+	while (angle < 0)
 		angle += 360.0;
 
 	while (angle > 360.0)
@@ -961,11 +1046,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::addDrawnVertex (vertex pos)
-{	// If we picked an already-existing vertex, stop drawing
+{
+	// If we picked an already-existing vertex, stop drawing
 	if (getEditMode() == EDrawMode)
-	{	for (vertex& vert : m_drawedVerts)
-		{	if (vert == pos)
-			{	endDraw (true);
+	{
+		for (vertex& vert : m_drawedVerts)
+		{
+			if (vert == pos)
+			{
+				endDraw (true);
 				return;
 			}
 		}
@@ -977,7 +1066,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::mouseReleaseEvent (QMouseEvent* ev)
-{	const bool wasLeft = (m_lastButtons & Qt::LeftButton) && ! (ev->buttons() & Qt::LeftButton),
+{
+	const bool wasLeft = (m_lastButtons & Qt::LeftButton) && ! (ev->buttons() & Qt::LeftButton),
 				   wasRight = (m_lastButtons & Qt::RightButton) && ! (ev->buttons() & Qt::RightButton),
 				   wasMid = (m_lastButtons & Qt::MidButton) && ! (ev->buttons() & Qt::MidButton);
 
@@ -985,32 +1075,43 @@
 		m_panning = false;
 
 	if (wasLeft)
-	{	// Check if we selected a camera icon
+	{
+		// Check if we selected a camera icon
 		if (!m_rangepick)
-		{	for (CameraIcon & info : m_cameraIcons)
-			{	if (info.destRect.contains (ev->pos()))
-				{	setCamera (info.cam);
+		{
+			for (CameraIcon & info : m_cameraIcons)
+			{
+				if (info.destRect.contains (ev->pos()))
+				{
+					setCamera (info.cam);
 					goto end;
 				}
 			}
 		}
 
 		switch (getEditMode())
-		{	case EDrawMode:
-			{	if (m_rectdraw)
-				{	if (m_drawedVerts.size() == 2)
-					{	endDraw (true);
+		{
+			case EDrawMode:
+			{
+				if (m_rectdraw)
+				{
+					if (m_drawedVerts.size() == 2)
+					{
+						endDraw (true);
 						return;
 					}
 				} else
-				{	// If we have 4 verts, stop drawing.
+				{
+					// If we have 4 verts, stop drawing.
 					if (m_drawedVerts.size() >= 4)
-					{	endDraw (true);
+					{
+						endDraw (true);
 						return;
 					}
 
 					if (m_drawedVerts.isEmpty() && ev->modifiers() & Qt::ShiftModifier)
-					{	m_rectdraw = true;
+					{
+						m_rectdraw = true;
 						updateRectVerts();
 					}
 				}
@@ -1019,8 +1120,10 @@
 			} break;
 
 			case ECircleMode:
-			{	if (m_drawedVerts.size() == 3)
-				{	endDraw (true);
+			{
+				if (m_drawedVerts.size() == 3)
+				{
+					endDraw (true);
 					return;
 				}
 
@@ -1028,8 +1131,10 @@
 			} break;
 
 			case ESelectMode:
-			{	if (!isDrawOnly())
-				{	if (m_totalmove < 10)
+			{
+				if (!isDrawOnly())
+				{
+					if (m_totalmove < 10)
 						m_rangepick = false;
 
 					if (!m_rangepick)
@@ -1045,7 +1150,8 @@
 	}
 
 	if (wasMid && getEditMode() != ESelectMode && m_drawedVerts.size() < 4 && m_totalmove < 10)
-	{	// Find the closest vertex to our cursor
+	{
+		// Find the closest vertex to our cursor
 		double mindist = 1024.0f;
 		vertex closest;
 		bool valid = false;
@@ -1053,7 +1159,8 @@
 		QPoint curspos = coordconv3_2 (m_hoverpos);
 
 		for (const vertex& pos3d: m_knownVerts)
-		{	QPoint pos2d = coordconv3_2 (pos3d);
+		{
+			QPoint pos2d = coordconv3_2 (pos3d);
 
 			// Measure squared distance
 			const double dx = abs (pos2d.x() - curspos.x()),
@@ -1064,7 +1171,8 @@
 				continue; // too far away
 
 			if (distsq < mindist)
-			{	mindist = distsq;
+			{
+				mindist = distsq;
 				closest = pos3d;
 				valid = true;
 
@@ -1079,7 +1187,8 @@
 	}
 
 	if (wasRight && !m_drawedVerts.isEmpty())
-	{	// Remove the last vertex
+	{
+		// Remove the last vertex
 		m_drawedVerts.removeLast();
 
 		if (m_drawedVerts.isEmpty())
@@ -1094,10 +1203,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::mousePressEvent (QMouseEvent* ev)
-{	m_totalmove = 0;
+{
+	m_totalmove = 0;
 
 	if (ev->modifiers() & Qt::ControlModifier)
-	{	m_rangepick = true;
+	{
+		m_rangepick = true;
 		m_rangeStart.setX (ev->x());
 		m_rangeStart.setY (ev->y());
 		m_addpick = (m_keymods & Qt::AltModifier);
@@ -1111,7 +1222,8 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 void GLRenderer::mouseMoveEvent (QMouseEvent* ev)
-{	int dx = ev->x() - m_pos.x();
+{
+	int dx = ev->x() - m_pos.x();
 	int dy = ev->y() - m_pos.y();
 	m_totalmove += abs (dx) + abs (dy);
 
@@ -1120,11 +1232,13 @@
 			   shift = ev->modifiers() & Qt::ShiftModifier;
 
 	if (mid || (left && shift))
-	{	pan (X) += 0.03f * dx * (zoom() / 7.5f);
+	{
+		pan (X) += 0.03f * dx * (zoom() / 7.5f);
 		pan (Y) -= 0.03f * dy * (zoom() / 7.5f);
 		m_panning = true;
 	} elif (left && !m_rangepick && camera() == EFreeCamera)
-	{	rot (X) = rot (X) + dy;
+	{
+		rot (X) = rot (X) + dy;
 		rot (Y) = rot (Y) + dx;
 
 		clampAngle (rot (X));
@@ -1151,19 +1265,22 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::keyPressEvent (QKeyEvent* ev)
-{	m_keymods = ev->modifiers();
+{
+	m_keymods = ev->modifiers();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::keyReleaseEvent (QKeyEvent* ev)
-{	m_keymods = ev->modifiers();
+{
+	m_keymods = ev->modifiers();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::wheelEvent (QWheelEvent* ev)
-{	makeCurrent();
+{
+	makeCurrent();
 
 	zoomNotch (ev->delta() > 0);
 	zoom() = clamp (zoom(), 0.01, 10000.0);
@@ -1175,7 +1292,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::leaveEvent (QEvent* ev)
-{	(void) ev;
+{
+	(void) ev;
 	m_drawToolTip = false;
 	m_toolTipTimer->stop();
 	update();
@@ -1184,13 +1302,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::contextMenuEvent (QContextMenuEvent* ev)
-{	g_win->spawnContextMenu (ev->globalPos());
+{
+	g_win->spawnContextMenu (ev->globalPos());
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::setCamera (const GLRenderer::EFixedCamera cam)
-{	m_camera = cam;
+{
+	m_camera = cam;
 	gl_camera = (int) cam;
 	g_win->updateEditModeActions();
 }
@@ -1198,14 +1318,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::pick (int mouseX, int mouseY)
-{	makeCurrent();
+{
+	makeCurrent();
 
 	// Use particularly thick lines while picking ease up selecting lines.
 	glLineWidth (max<double> (gl_linethickness, 6.5f));
 
 	// Clear the selection if we do not wish to add to it.
 	if (!m_addpick)
-	{	QList<LDObject*> oldsel = selection();
+	{
+		QList<LDObject*> oldsel = selection();
 		getCurrentDocument()->clearSelection();
 
 		for (LDObject* obj : oldsel)
@@ -1226,11 +1348,13 @@
 	// Determine how big an area to read - with range picking, we pick by
 	// the area given, with single pixel picking, we use an 1 x 1 area.
 	if (m_rangepick)
-	{	x1 = m_rangeStart.x();
+	{
+		x1 = m_rangeStart.x();
 		y1 = m_rangeStart.y();
 	}
 	else
-	{	x1 = x0 + 1;
+	{
+		x1 = x0 + 1;
 		y1 = y0 + 1;
 	}
 
@@ -1261,7 +1385,8 @@
 
 	// Go through each pixel read and add them to the selection.
 	for (qint32 i = 0; i < numpixels; ++i)
-	{	qint32 idx =
+	{
+		qint32 idx =
 			(*(pixelptr + 0) * 0x10000) +
 			(*(pixelptr + 1) * 0x00100) +
 			(*(pixelptr + 2) * 0x00001);
@@ -1275,8 +1400,10 @@
 		// If this is an additive single pick and the object is currently selected,
 		// we remove it from selection instead.
 		if (!m_rangepick && m_addpick)
-		{	if (obj->isSelected())
-			{	obj->unselect();
+		{
+			if (obj->isSelected())
+			{
+				obj->unselect();
 				removedObj = obj;
 				break;
 			}
@@ -1311,17 +1438,21 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::setEditMode (EditMode const& a)
-{	m_EditMode = a;
+{
+	m_EditMode = a;
 
 	switch (a)
-	{	case ESelectMode:
-		{	unsetCursor();
+	{
+		case ESelectMode:
+		{
+			unsetCursor();
 			setContextMenuPolicy (Qt::DefaultContextMenu);
 		} break;
 
 		case EDrawMode:
 		case ECircleMode:
-		{	// Cannot draw into the free camera - use top instead.
+		{
+			// Cannot draw into the free camera - use top instead.
 			if (m_camera == EFreeCamera)
 				setCamera (ETopCamera);
 
@@ -1349,7 +1480,8 @@
 }
 
 void GLRenderer::setFile (LDDocument* const& a)
-{	m_File = a;
+{
+	m_File = a;
 
 	if (a != null)
 		initOverlaysFromObjects();
@@ -1358,10 +1490,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 matrix GLRenderer::getCircleDrawMatrix (double scale)
-{	matrix transform = g_circleDrawTransforms[camera() % 3];
+{
+	matrix transform = g_circleDrawTransforms[camera() % 3];
 
 	for (int i = 0; i < 9; ++i)
-	{	if (transform[i] == 2)
+	{
+		if (transform[i] == 2)
 			transform[i] = scale;
 		elif (transform[i] == 1 && camera() >= 3)
 			transform[i] = -1;
@@ -1373,16 +1507,20 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::endDraw (bool accept)
-{	(void) accept;
+{
+	(void) accept;
 
 	// Clean the selection and create the object
 	QList<vertex>& verts = m_drawedVerts;
 	QList<LDObject*> objs;
 
 	switch (getEditMode())
-	{	case EDrawMode:
-		{	if (m_rectdraw)
-			{	LDQuad* quad = new LDQuad;
+	{
+		case EDrawMode:
+		{
+			if (m_rectdraw)
+			{
+				LDQuad* quad = new LDQuad;
 
 				// Copy the vertices from m_rectverts
 				updateRectVerts();
@@ -1394,9 +1532,12 @@
 				objs << quad;
 			}
 			else
-			{	switch (verts.size())
-				{	case 1:
-					{	// 1 vertex - add a vertex object
+			{
+				switch (verts.size())
+				{
+					case 1:
+					{
+						// 1 vertex - add a vertex object
 						LDVertex* obj = new LDVertex;
 						obj->pos = verts[0];
 						obj->setColor (maincolor);
@@ -1404,7 +1545,8 @@
 					} break;
 
 					case 2:
-					{	// 2 verts - make a line
+					{
+						// 2 verts - make a line
 						LDLine* obj = new LDLine (verts[0], verts[1]);
 						obj->setColor (edgecolor);
 						objs << obj;
@@ -1412,7 +1554,8 @@
 
 					case 3:
 					case 4:
-					{	LDObject* obj = (verts.size() == 3) ?
+					{
+						LDObject* obj = (verts.size() == 3) ?
 							  static_cast<LDObject*> (new LDTriangle) :
 							  static_cast<LDObject*> (new LDQuad);
 
@@ -1428,7 +1571,8 @@
 		} break;
 
 		case ECircleMode:
-		{	const int segs = lores, divs = lores; // TODO: make customizable
+		{
+			const int segs = lores, divs = lores; // TODO: make customizable
 			double dist0 = getCircleDrawDist (0),
 				dist1 = getCircleDrawDist (1);
 			LDDocument* refFile = null;
@@ -1439,24 +1583,29 @@
 				std::swap<double> (dist0, dist1);
 
 			if (dist0 == dist1)
-			{	// If the radii are the same, there's no ring space to fill. Use a circle.
+			{
+				// If the radii are the same, there's no ring space to fill. Use a circle.
 				refFile = ::getDocument ("4-4edge.dat");
 				transform = getCircleDrawMatrix (dist0);
 				circleOrDisc = true;
 			}
 			elif (dist0 == 0 || dist1 == 0)
-			{	// If either radii is 0, use a disc.
+			{
+				// If either radii is 0, use a disc.
 				refFile = ::getDocument ("4-4disc.dat");
 				transform = getCircleDrawMatrix ((dist0 != 0) ? dist0 : dist1);
 				circleOrDisc = true;
 			}
 			elif (g_RingFinder (dist0, dist1))
-			{	// The ring finder found a solution, use that. Add the component rings to the file.
+			{
+				// The ring finder found a solution, use that. Add the component rings to the file.
 				for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents())
-				{	// Get a ref file for this primitive. If we cannot find it in the
+				{
+					// Get a ref file for this primitive. If we cannot find it in the
 					// LDraw library, generate it.
 					if ((refFile = ::getDocument (radialFileName (::Ring, lores, lores, cmp.num))) == null)
-					{	refFile = generatePrimitive (::Ring, lores, lores, cmp.num);
+					{
+						refFile = generatePrimitive (::Ring, lores, lores, cmp.num);
 						refFile->setImplicit (false);
 					}
 
@@ -1469,7 +1618,8 @@
 				}
 			}
 			else
-			{	// Ring finder failed, last resort: draw the ring with quads
+			{
+				// Ring finder failed, last resort: draw the ring with quads
 				QList<QLineF> c0, c1;
 				Axis relX, relY, relZ;
 				getRelativeAxes (relX, relY);
@@ -1487,7 +1637,8 @@
 				makeCircle (segs, divs, dist1, c1);
 
 				for (int i = 0; i < segs; ++i)
-				{	vertex v0, v1, v2, v3;
+				{
+					vertex v0, v1, v2, v3;
 					v0 = v1 = v2 = v3 = templ;
 					v0[relX] += c0[i].x1();
 					v0[relY] += c0[i].y1();
@@ -1510,7 +1661,8 @@
 			}
 
 			if (circleOrDisc)
-			{	LDSubfile* ref = new LDSubfile;
+			{
+				LDSubfile* ref = new LDSubfile;
 				ref->setFileInfo (refFile);
 				ref->setTransform (transform);
 				ref->setPosition (m_drawedVerts[0]);
@@ -1520,15 +1672,18 @@
 		} break;
 
 		case ESelectMode:
-		{	// this shouldn't happen
+		{
+			// this shouldn't happen
 			assert (false);
 			return;
 		} break;
 	}
 
 	if (objs.size() > 0)
-	{	for (LDObject* obj : objs)
-		{	getFile()->addObject (obj);
+	{
+		for (LDObject* obj : objs)
+		{
+			getFile()->addObject (obj);
 			compileObject (obj);
 		}
 
@@ -1543,7 +1698,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 double GLRenderer::getCircleDrawDist (int pos) const
-{	assert (m_drawedVerts.size() >= pos + 1);
+{
+	assert (m_drawedVerts.size() >= pos + 1);
 	const vertex& v1 = (m_drawedVerts.size() >= pos + 2) ? m_drawedVerts[pos + 1] : m_hoverpos;
 	Axis relX, relY;
 	getRelativeAxes (relX, relY);
@@ -1556,7 +1712,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::getRelativeAxes (Axis& relX, Axis& relY) const
-{	const LDFixedCameraInfo* cam = &g_FixedCameras[m_camera];
+{
+	const LDFixedCameraInfo* cam = &g_FixedCameras[m_camera];
 	relX = cam->axisX;
 	relY = cam->axisY;
 }
@@ -1564,17 +1721,21 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static QList<vertex> getVertices (LDObject* obj)
-{	QList<vertex> verts;
+{
+	QList<vertex> verts;
 
 	if (obj->vertices() >= 2)
-	{	for (int i = 0; i < obj->vertices(); ++i)
+	{
+		for (int i = 0; i < obj->vertices(); ++i)
 			verts << obj->getVertex (i);
 	} elif (obj->getType() == LDObject::Subfile)
-	{	LDSubfile* ref = static_cast<LDSubfile*> (obj);
+	{
+		LDSubfile* ref = static_cast<LDSubfile*> (obj);
 		QList<LDObject*> objs = ref->inlineContents (LDSubfile::DeepCacheInline);
 
 		for (LDObject* obj : objs)
-		{	verts << getVertices (obj);
+		{
+			verts << getVertices (obj);
 			obj->deleteSelf();
 		}
 	}
@@ -1585,10 +1746,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::compileObject (LDObject* obj)
-{	deleteLists (obj);
+{
+	deleteLists (obj);
 
 	for (const GL::ListType listType : g_glListTypes)
-	{	if (isDrawOnly() && listType != GL::NormalList)
+	{
+		if (isDrawOnly() && listType != GL::NormalList)
 			continue;
 
 		GLuint list = glGenLists (1);
@@ -1611,7 +1774,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 uchar* GLRenderer::getScreencap (int& w, int& h)
-{	w = m_width;
+{
+	w = m_width;
 	h = m_height;
 	uchar* cap = new uchar[4 * w * h];
 
@@ -1628,12 +1792,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::slot_toolTipTimer()
-{	// We come here if the cursor has stayed in one place for longer than a
+{
+	// We come here if the cursor has stayed in one place for longer than a
 	// a second. Check if we're holding it over a camera icon - if so, draw
 	// a tooltip.
 for (CameraIcon & icon : m_cameraIcons)
-	{	if (icon.destRect.contains (m_pos))
-		{	m_toolTipCamera = icon.cam;
+	{
+		if (icon.destRect.contains (m_pos))
+		{
+			m_toolTipCamera = icon.cam;
 			m_drawToolTip = true;
 			update();
 			break;
@@ -1644,7 +1811,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::deleteLists (LDObject* obj)
-{	// Delete the lists but only if they have been initialized
+{
+	// Delete the lists but only if they have been initialized
 	if (!obj->isGLInit())
 		return;
 
@@ -1657,7 +1825,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 Axis GLRenderer::getCameraAxis (bool y, GLRenderer::EFixedCamera camid)
-{	if (camid == (GL::EFixedCamera) - 1)
+{
+	if (camid == (GL::EFixedCamera) - 1)
 		camid = m_camera;
 
 	const LDFixedCameraInfo* cam = &g_FixedCameras[camid];
@@ -1667,11 +1836,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool GLRenderer::setupOverlay (EFixedCamera cam, str file, int x, int y, int w, int h)
-{	QImage* img = new QImage (QImage (file).convertToFormat (QImage::Format_ARGB32));
+{
+	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!"));
 		delete img;
 		return false;
 	}
@@ -1704,7 +1875,8 @@
 	// 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);
+		{
+			uint32 pixel = img->pixel (i, j);
 			img->setPixel (i, j, 0x80000000 | (pixel & 0x00FFFFFF));
 		}
 
@@ -1715,7 +1887,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::clearOverlay()
-{	if (camera() == EFreeCamera)
+{
+	if (camera() == EFreeCamera)
 		return;
 
 	LDGLOverlay& info = m_overlays[camera()];
@@ -1728,33 +1901,38 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::setDepthValue (double depth)
-{	assert (camera() < EFreeCamera);
+{
+	assert (camera() < EFreeCamera);
 	m_depthValues[camera()] = depth;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 double GLRenderer::getDepthValue() const
-{	assert (camera() < EFreeCamera);
+{
+	assert (camera() < EFreeCamera);
 	return m_depthValues[camera()];
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 const char* GLRenderer::getCameraName() const
-{	return g_CameraNames[camera()];
+{
+	return g_CameraNames[camera()];
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDGLOverlay& GLRenderer::getOverlay (int newcam)
-{	return m_overlays[newcam];
+{
+	return m_overlays[newcam];
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::zoomNotch (bool inward)
-{	if (zoom() > 15)
+{
+	if (zoom() > 15)
 		zoom() *= inward ? 0.833f : 1.2f;
 	else
 		zoom() += inward ? -1.2f : 1.2f;
@@ -1763,8 +1941,10 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::zoomToFit()
-{	if (getFile() == null || m_width == -1 || m_height == -1)
-	{	zoom() = 30.0f;
+{
+	if (getFile() == null || m_width == -1 || m_height == -1)
+	{
+		zoom() = 30.0f;
 		return;
 	}
 
@@ -1782,8 +1962,10 @@
 	setPicking (true);
 
 	for (;;)
-	{	if (zoom() > 10000.0 || zoom() < 0.0)
-		{	// Obviously, there's nothing to draw if we get here.
+	{
+		if (zoom() > 10000.0 || zoom() < 0.0)
+		{
+			// Obviously, there's nothing to draw if we get here.
 			// Default to 30.0f and break out.
 			zoom() = 30.0;
 			break;
@@ -1810,17 +1992,20 @@
 		delete[] cap;
 
 		if (firstrun)
-		{	// If this is the first run, we don't know enough to determine
+		{
+			// If this is the first run, we don't know enough to determine
 			// whether the zoom was to fit, so we mark in our knowledge so
 			// far and start over.
 			inward = !filled;
 			firstrun = false;
 		}
 		else
-		{	// If this run filled the screen and the last one did not, the
+		{
+			// If this run filled the screen and the last one did not, the
 			// last run had ideal zoom - zoom a bit back and we should reach it.
 			if (filled && !lastfilled)
-			{	zoomNotch (false);
+			{
+				zoomNotch (false);
 				break;
 			}
 
@@ -1842,11 +2027,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::zoomAllToFit()
-{	/*
+{
+	/*
 	EFixedCamera oldcam = camera();
 
 	for (int i = 0; i < 7; ++i)
-	{	setCamera ((EFixedCamera) i);
+	{
+		setCamera ((EFixedCamera) i);
 		zoomToFit();
 	}
 
@@ -1859,11 +2046,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::updateRectVerts()
-{	if (!m_rectdraw)
+{
+	if (!m_rectdraw)
 		return;
 
 	if (m_drawedVerts.isEmpty())
-	{	for (int i = 0; i < 4; ++i)
+	{
+		for (int i = 0; i < 4; ++i)
 			m_rectverts[i] = m_hoverpos;
 
 		return;
@@ -1892,7 +2081,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::mouseDoubleClickEvent (QMouseEvent* ev)
-{	if (!(ev->buttons() & Qt::LeftButton) || getEditMode() != ESelectMode)
+{
+	if (!(ev->buttons() & Qt::LeftButton) || getEditMode() != ESelectMode)
 		return;
 
 	pick (ev->x(), ev->y());
@@ -1909,11 +2099,14 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDOverlay* GLRenderer::findOverlayObject (EFixedCamera cam)
-{	LDOverlay* ovlobj = null;
+{
+	LDOverlay* ovlobj = null;
 
 	for (LDObject* obj : getFile()->getObjects())
-	{	if (obj->getType() == LDObject::Overlay && static_cast<LDOverlay*> (obj)->getCamera() == cam)
-		{	ovlobj = static_cast<LDOverlay*> (obj);
+	{
+		if (obj->getType() == LDObject::Overlay && static_cast<LDOverlay*> (obj)->getCamera() == cam)
+		{
+			ovlobj = static_cast<LDOverlay*> (obj);
 			break;
 		}
 	}
@@ -1926,15 +2119,18 @@
 // Read in overlays from the current file and update overlay info accordingly.
 // -----------------------------------------------------------------------------
 void GLRenderer::initOverlaysFromObjects()
-{	for (EFixedCamera cam : g_Cameras)
-	{	if (cam == EFreeCamera)
+{
+	for (EFixedCamera cam : g_Cameras)
+	{
+		if (cam == EFreeCamera)
 			continue;
 
 		LDGLOverlay& meta = m_overlays[cam];
 		LDOverlay* ovlobj = findOverlayObject (cam);
 
 		if (!ovlobj && meta.img)
-		{	delete meta.img;
+		{
+			delete meta.img;
 			meta.img = null;
 		} elif (ovlobj && (!meta.img || meta.fname != ovlobj->getFileName()))
 			setupOverlay (cam, ovlobj->getFileName(), ovlobj->getX(),
@@ -1945,15 +2141,18 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void GLRenderer::updateOverlayObjects()
-{	for (EFixedCamera cam : g_Cameras)
-	{	if (cam == EFreeCamera)
+{
+	for (EFixedCamera cam : g_Cameras)
+	{
+		if (cam == EFreeCamera)
 			continue;
 
 		LDGLOverlay& meta = m_overlays[cam];
 		LDOverlay* ovlobj = findOverlayObject (cam);
 
 		if (!meta.img && ovlobj)
-		{	// If this is the last overlay image, we need to remove the empty space after it as well.
+		{
+			// If this is the last overlay image, we need to remove the empty space after it as well.
 			LDObject* nextobj = ovlobj->next();
 
 			if (nextobj && nextobj->getType() == LDObject::Empty)
@@ -1963,7 +2162,8 @@
 			// not, remove the object.
 			ovlobj->deleteSelf();
 		} elif (meta.img && !ovlobj)
-		{	// Inverse case: image is there but the overlay object is
+		{
+			// Inverse case: image is there but the overlay object is
 			// not, thus create the object.
 			ovlobj = new LDOverlay;
 
@@ -1977,10 +2177,12 @@
 			bool found = false;
 
 			for (i = 0; i < getFile()->getObjectCount(); ++i)
-			{	LDObject* obj = getFile()->getObject (i);
+			{
+				LDObject* obj = getFile()->getObject (i);
 
 				if (obj->isScemantic())
-				{	found = true;
+				{
+					found = true;
 					break;
 				}
 
@@ -1991,7 +2193,8 @@
 			if (lastOverlay != -1)
 				getFile()->insertObj (lastOverlay + 1, ovlobj);
 			else
-			{	getFile()->insertObj (i, ovlobj);
+			{
+				getFile()->insertObj (i, ovlobj);
 
 				if (found)
 					getFile()->insertObj (i + 1, new LDEmpty);
@@ -1999,7 +2202,8 @@
 		}
 
 		if (meta.img && ovlobj)
-		{	ovlobj->setCamera (cam);
+		{
+			ovlobj->setCamera (cam);
 			ovlobj->setFileName (meta.fname);
 			ovlobj->setX (meta.ox);
 			ovlobj->setY (meta.oy);
--- a/src/gldraw.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/gldraw.h	Tue Jan 07 08:53:27 2014 +0200
@@ -33,14 +33,16 @@
 class QTimer;
 
 enum EditMode
-{	ESelectMode,
+{
+	ESelectMode,
 	EDrawMode,
 	ECircleMode,
 };
 
 // Meta for overlays
 struct LDGLOverlay
-{	vertex	v0,
+{
+	vertex	v0,
 				v1;
 	int		ox,
 				oy;
@@ -51,7 +53,8 @@
 };
 
 struct LDFixedCameraInfo
-{	const char glrotate[3];
+{
+	const char glrotate[3];
 	const Axis axisX, axisY;
 	const bool negX, negY;
 };
@@ -64,9 +67,11 @@
 // g_win->R()
 // =============================================================================
 class GLRenderer : public QGLWidget
-{	typedefs:
+{
+	typedefs:
 		enum EFixedCamera
-		{	ETopCamera,
+		{
+			ETopCamera,
 			EFrontCamera,
 			ELeftCamera,
 			EBottomCamera,
@@ -76,7 +81,8 @@
 		};
 
 		enum ListType
-		{	NormalList,
+		{
+			NormalList,
 			PickList,
 			BFCFrontList,
 			BFCBackList
@@ -86,7 +92,8 @@
 		// initialized before program gets to main() and constructs a QApplication
 		// and Qt doesn't like that.
 		struct CameraIcon
-		{	QPixmap*			img;
+		{
+			QPixmap*			img;
 			QRect				srcRect,
 								destRect,
 								selRect;
@@ -101,12 +108,13 @@
 		PROPERTY (public,		LDDocument*,		File,			NO_OPS,		CUSTOM_WRITE)
 		PROPERTY (public,		EditMode,			EditMode,	NO_OPS,		CUSTOM_WRITE)
 
-	public methods:
+	public:
 		GLRenderer (QWidget* parent = null);
 		~GLRenderer();
 
 		inline EFixedCamera camera() const
-		{	return m_camera;
+		{
+			return m_camera;
 		}
 
 		void           clearOverlay();
@@ -137,7 +145,7 @@
 
 		static void    deleteLists (LDObject* obj);
 
-	protected methods:
+	protected:
 		void           contextMenuEvent (QContextMenuEvent* ev);
 		void           initializeGL();
 		void           keyPressEvent (QKeyEvent* ev);
@@ -154,36 +162,36 @@
 	private:
 		CameraIcon					m_cameraIcons[7];
 		QTimer*						m_toolTipTimer;
-		Qt::MouseButtons			m_lastButtons;
-		Qt::KeyboardModifiers	m_keymods;
+		Qt::MouseButtons				m_lastButtons;
+		Qt::KeyboardModifiers		m_keymods;
 		vertex						m_hoverpos;
 		double						m_virtWidth,
-										m_virtHeight,
-										m_rotX[7],
-										m_rotY[7],
-										m_rotZ[7],
-										m_panX[7],
-										m_panY[7],
-										m_zoom[7];
-		bool							m_darkbg,
-										m_rangepick,
-										m_addpick,
-										m_drawToolTip,
-										m_screencap,
-										m_panning;
+									m_virtHeight,
+									m_rotX[7],
+									m_rotY[7],
+									m_rotZ[7],
+									m_panX[7],
+									m_panY[7],
+									m_zoom[7];
+		bool						m_darkbg,
+									m_rangepick,
+									m_addpick,
+									m_drawToolTip,
+									m_screencap,
+									m_panning;
 		QPoint						m_pos,
-										m_globalpos,
-										m_rangeStart;
-		QPen							m_thickBorderPen,
-										m_thinBorderPen;
+									m_globalpos,
+									m_rangeStart;
+		QPen						m_thickBorderPen,
+									m_thinBorderPen;
 		EFixedCamera				m_camera,
-										m_toolTipCamera;
+									m_toolTipCamera;
 		GLuint						m_axeslist;
 		int							m_width,
-										m_height,
-										m_totalmove;
+									m_height,
+									m_totalmove;
 		QList<vertex>				m_drawedVerts;
-		bool							m_rectdraw;
+		bool						m_rectdraw;
 		vertex						m_rectverts[4];
 		QColor						m_bgcolor;
 		double						m_depthValues[6];
@@ -229,7 +237,8 @@
 
 		// Get a rotation value
 		inline double& rot (Axis ax)
-		{	return
+		{
+			return
 				(ax == X) ? m_rotX[camera()] :
 				(ax == Y) ? m_rotY[camera()] :
 				            m_rotZ[camera()];
@@ -237,17 +246,20 @@
 
 		// Get a panning value
 		inline double& pan (Axis ax)
-		{	return (ax == X) ? m_panX[camera()] : m_panY[camera()];
+		{
+			return (ax == X) ? m_panX[camera()] : m_panY[camera()];
 		}
 
 		// Same except const (can be used in const methods)
 		inline const double& pan (Axis ax) const
-		{	return (ax == X) ? m_panX[camera()] : m_panY[camera()];
+		{
+			return (ax == X) ? m_panX[camera()] : m_panY[camera()];
 		}
 
 		// Get the zoom value
 		inline double& zoom()
-		{	return m_zoom[camera()];
+		{
+			return m_zoom[camera()];
 		}
 
 	private slots:
@@ -258,7 +270,8 @@
 typedef GLRenderer GL;
 
 static const GLRenderer::ListType g_glListTypes[] =
-{	GL::NormalList,
+{
+	GL::NormalList,
 	GL::PickList,
 	GL::BFCFrontList,
 	GL::BFCBackList,
--- a/src/gui.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/gui.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -67,7 +67,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 ForgeWindow::ForgeWindow()
-{	g_win = this;
+{
+	g_win = this;
 	m_renderer = new GLRenderer;
 
 	ui = new Ui_LDForgeUI;
@@ -122,15 +123,18 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 KeySequenceConfig* ForgeWindow::shortcutForAction (QAction* act)
-{	str keycfgname = fmt ("key_%1", act->objectName());
+{
+	str keycfgname = fmt ("key_%1", act->objectName());
 	return KeySequenceConfig::getByName (keycfgname);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::updateActionShortcuts()
-{	for (QAction* act : findChildren<QAction*>())
-	{	KeySequenceConfig* cfg = shortcutForAction (act);
+{
+	for (QAction* act : findChildren<QAction*>())
+	{
+		KeySequenceConfig* cfg = shortcutForAction (act);
 
 		if (cfg)
 			act->setShortcut (cfg->getValue());
@@ -140,7 +144,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::slot_action()
-{	// Get the name of the sender object and use it to compose the slot name.
+{
+	// Get the name of the sender object and use it to compose the slot name.
 	str methodName = fmt ("slot_%1", sender()->objectName());
 
 #ifdef DEBUG
@@ -155,7 +160,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::endAction()
-{	// Add a step in the history now.
+{
+	// Add a step in the history now.
 	getCurrentDocument()->addHistoryStep();
 
 	// Update the list item of the current file - we may need to draw an icon
@@ -166,14 +172,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::slot_lastSecondCleanup()
-{	delete m_renderer;
+{
+	delete m_renderer;
 	delete ui;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::updateRecentFilesMenu()
-{	// First, clear any items in the recent files menu
+{
+	// First, clear any items in the recent files menu
 for (QAction * recent : m_recentFiles)
 		delete recent;
 
@@ -182,7 +190,8 @@
 	QAction* first = null;
 
 	for (const QVariant& it : io_recentfiles)
-	{	str file = it.toString();
+	{
+		str file = it.toString();
 		QAction* recent = new QAction (getIcon ("open-recent"), file, this);
 
 		connect (recent, SIGNAL (triggered()), this, SLOT (slot_recentFile()));
@@ -195,13 +204,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 QList<LDQuickColor> quickColorsFromConfig()
-{	QList<LDQuickColor> colors;
+{
+	QList<LDQuickColor> colors;
 
 	for (str colorname : gui_colortoolbar.split (":"))
-	{	if (colorname == "|")
+	{
+		if (colorname == "|")
 			colors << LDQuickColor::getSeparator();
 		else
-		{	LDColor* col = getColor (colorname.toLong());
+		{
+			LDColor* col = getColor (colorname.toLong());
 
 			if (col != null)
 				colors << LDQuickColor (col, null);
@@ -214,14 +226,17 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::updateToolBars()
-{	m_colorButtons.clear();
+{
+	m_colorButtons.clear();
 	ui->colorToolbar->clear();
 
 	for (LDQuickColor& entry : m_quickColors)
-	{	if (entry.isSeparator())
+	{
+		if (entry.isSeparator())
 			ui->colorToolbar->addSeparator();
 		else
-		{	QToolButton* colorButton = new QToolButton;
+		{
+			QToolButton* colorButton = new QToolButton;
 			colorButton->setIcon (makeColorIcon (entry.getColor(), 22));
 			colorButton->setIconSize (QSize (22, 22));
 			colorButton->setToolTip (entry.getColor()->name);
@@ -240,7 +255,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::updateGridToolBar()
-{	// Ensure that the current grid - and only the current grid - is selected.
+{
+	// Ensure that the current grid - and only the current grid - is selected.
 	ui->actionGridCoarse->setChecked (grid == Grid::Coarse);
 	ui->actionGridMedium->setChecked (grid == Grid::Medium);
 	ui->actionGridFine->setChecked (grid == Grid::Fine);
@@ -249,18 +265,21 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::updateTitle()
-{	str title = fmt (APPNAME " %1", fullVersionString());
+{
+	str title = fmt (APPNAME " %1", fullVersionString());
 
 	// Append our current file if we have one
 	if (getCurrentDocument())
-	{	if (getCurrentDocument()->getName().length() > 0)
+	{
+		if (getCurrentDocument()->getName().length() > 0)
 			title += fmt (": %1", basename (getCurrentDocument()->getName()));
 		else
 			title += fmt (": <anonymous>");
 
 		if (getCurrentDocument()->getObjectCount() > 0 &&
 				getCurrentDocument()->getObject (0)->getType() == LDObject::Comment)
-		{	// Append title
+		{
+			// Append title
 			LDComment* comm = static_cast<LDComment*> (getCurrentDocument()->getObject (0));
 			title += fmt (": %1", comm->text);
 		}
@@ -281,7 +300,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int ForgeWindow::deleteSelection()
-{	if (selection().isEmpty())
+{
+	if (selection().isEmpty())
 		return 0;
 
 	QList<LDObject*> selCopy = selection();
@@ -297,7 +317,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::buildObjList()
-{	if (!getCurrentDocument())
+{
+	if (!getCurrentDocument())
 		return;
 
 	// Lock the selection while we do this so that refreshing the object list
@@ -311,11 +332,14 @@
 	ui->objectList->clear();
 
 	for (LDObject* obj : getCurrentDocument()->getObjects())
-	{	str descr;
+	{
+		str descr;
 
 		switch (obj->getType())
-		{	case LDObject::Comment:
-			{	descr = static_cast<LDComment*> (obj)->text;
+		{
+			case LDObject::Comment:
+			{
+				descr = static_cast<LDComment*> (obj)->text;
 
 				// Remove leading whitespace
 				while (descr[0] == ' ')
@@ -329,8 +353,10 @@
 			case LDObject::Triangle:
 			case LDObject::Quad:
 			case LDObject::CondLine:
-			{	for (int i = 0; i < obj->vertices(); ++i)
-				{	if (i != 0)
+			{
+				for (int i = 0; i < obj->vertices(); ++i)
+				{
+					if (i != 0)
 						descr += ", ";
 
 					descr += obj->getVertex (i).stringRep (true);
@@ -338,15 +364,18 @@
 			} break;
 
 			case LDObject::Error:
-			{	descr = fmt ("ERROR: %1", obj->raw());
+			{
+				descr = fmt ("ERROR: %1", obj->raw());
 			} break;
 
 			case LDObject::Vertex:
-			{	descr = static_cast<LDVertex*> (obj)->pos.stringRep (true);
+			{
+				descr = static_cast<LDVertex*> (obj)->pos.stringRep (true);
 			} break;
 
 			case LDObject::Subfile:
-			{	LDSubfile* ref = static_cast<LDSubfile*> (obj);
+			{
+				LDSubfile* ref = static_cast<LDSubfile*> (obj);
 
 				descr = fmt ("%1 %2, (", ref->getFileInfo()->getDisplayName(), ref->getPosition().stringRep (true));
 
@@ -357,11 +386,13 @@
 			} break;
 
 			case LDObject::BFC:
-			{	descr = LDBFC::statements[static_cast<LDBFC*> (obj)->type];
+			{
+				descr = LDBFC::statements[static_cast<LDBFC*> (obj)->type];
 			} break;
 
 			case LDObject::Overlay:
-			{	LDOverlay* ovl = static_cast<LDOverlay*> (obj);
+			{
+				LDOverlay* ovl = static_cast<LDOverlay*> (obj);
 				descr = fmt ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->getCamera()],
 					basename (ovl->getFileName()), ovl->getX(), ovl->getY(),
 					ovl->getWidth(), ovl->getHeight());
@@ -369,7 +400,8 @@
 			break;
 
 			default:
-			{	descr = obj->getTypeName();
+			{
+				descr = obj->getTypeName();
 			} break;
 		}
 
@@ -378,18 +410,21 @@
 
 		// Use italic font if hidden
 		if (obj->isHidden())
-		{	QFont font = item->font();
+		{
+			QFont font = item->font();
 			font.setItalic (true);
 			item->setFont (font);
 		}
 
 		// Color gibberish orange on red so it stands out.
 		if (obj->getType() == LDObject::Error)
-		{	item->setBackground (QColor ("#AA0000"));
+		{
+			item->setBackground (QColor ("#AA0000"));
 			item->setForeground (QColor ("#FFAA00"));
 		}
 		elif (lv_colorize && obj->isColored() && obj->getColor() != maincolor && obj->getColor() != edgecolor)
-		{	// If the object isn't in the main or edge color, draw this
+		{
+			// If the object isn't in the main or edge color, draw this
 			// list entry in said color.
 			LDColor* col = getColor (obj->getColor());
 
@@ -409,7 +444,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::scrollToSelection()
-{	if (selection().isEmpty())
+{
+	if (selection().isEmpty())
 		return;
 
 	LDObject* obj = selection().last();
@@ -419,7 +455,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::slot_selectionChanged()
-{	if (g_isSelectionLocked == true || getCurrentDocument() == null)
+{
+	if (g_isSelectionLocked == true || getCurrentDocument() == null)
 		return;
 
 	// Update the shared selection array, though don't do this if this was
@@ -435,9 +472,12 @@
 	const QList<QListWidgetItem*> items = ui->objectList->selectedItems();
 
 	for (LDObject* obj : getCurrentDocument()->getObjects())
-	{	for (QListWidgetItem* item : items)
-		{	if (item == obj->qObjListEntry)
-			{	obj->select();
+	{
+		for (QListWidgetItem* item : items)
+		{
+			if (item == obj->qObjListEntry)
+			{
+				obj->select();
 				break;
 			}
 		}
@@ -456,19 +496,23 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::slot_recentFile()
-{	QAction* qAct = static_cast<QAction*> (sender());
+{
+	QAction* qAct = static_cast<QAction*> (sender());
 	openMainFile (qAct->text());
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::slot_quickColor()
-{	QToolButton* button = static_cast<QToolButton*> (sender());
+{
+	QToolButton* button = static_cast<QToolButton*> (sender());
 	LDColor* col = null;
 
 	for (const LDQuickColor & entry : m_quickColors)
-	{	if (entry.getToolButton() == button)
-		{	col = entry.getColor();
+	{
+		if (entry.getToolButton() == button)
+		{
+			col = entry.getColor();
 			break;
 		}
 	}
@@ -479,7 +523,8 @@
 	int newColor = col->index;
 
 	for (LDObject* obj : selection())
-	{	if (obj->isColored() == false)
+	{
+		if (obj->isColored() == false)
 			continue; // uncolored object
 
 		obj->setColor (newColor);
@@ -493,7 +538,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int ForgeWindow::getInsertionPoint()
-{	// If we have a selection, put the item after it.
+{
+	// If we have a selection, put the item after it.
 	if (!selection().isEmpty())
 		return selection().last()->getIndex() + 1;
 
@@ -504,21 +550,24 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::doFullRefresh()
-{	buildObjList();
+{
+	buildObjList();
 	m_renderer->hardRefresh();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::refresh()
-{	buildObjList();
+{
+	buildObjList();
 	m_renderer->update();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::updateSelection()
-{	g_isSelectionLocked = true;
+{
+	g_isSelectionLocked = true;
 
 	for (LDObject* obj : getCurrentDocument()->getObjects())
 		obj->setSelected (false);
@@ -526,7 +575,8 @@
 	ui->objectList->clearSelection();
 
 	for (LDObject* obj : selection())
-	{	if (obj->qObjListEntry == null)
+	{
+		if (obj->qObjListEntry == null)
 			continue;
 
 		obj->qObjListEntry->setSelected (true);
@@ -540,10 +590,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int ForgeWindow::getSelectedColor()
-{	int result = -1;
+{
+	int result = -1;
 
 	for (LDObject* obj : selection())
-	{	if (obj->isColored() == false)
+	{
+		if (obj->isColored() == false)
 			continue; // doesn't use color
 
 		if (result != -1 && obj->getColor() != result)
@@ -559,10 +611,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDObject::Type ForgeWindow::getUniformSelectedType()
-{	LDObject::Type result = LDObject::Unidentified;
+{
+	LDObject::Type result = LDObject::Unidentified;
 
 	for (LDObject* obj : selection())
-	{	if (result != LDObject::Unidentified && obj->getColor() != result)
+	{
+		if (result != LDObject::Unidentified && obj->getColor() != result)
 			return LDObject::Unidentified;
 
 		if (result == LDObject::Unidentified)
@@ -575,9 +629,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::closeEvent (QCloseEvent* ev)
-{	// Check whether it's safe to close all files.
+{
+	// Check whether it's safe to close all files.
 	if (!safeToCloseAll())
-	{	ev->ignore();
+	{
+		ev->ignore();
 		return;
 	}
 
@@ -591,13 +647,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::spawnContextMenu (const QPoint pos)
-{	const bool single = (selection().size() == 1);
+{
+	const bool single = (selection().size() == 1);
 	LDObject* singleObj = (single) ? selection()[0] : null;
 
 	QMenu* contextMenu = new QMenu;
 
 	if (single && singleObj->getType() != LDObject::Empty)
-	{	contextMenu->addAction (ui->actionEdit);
+	{
+		contextMenu->addAction (ui->actionEdit);
 		contextMenu->addSeparator();
 	}
 
@@ -619,12 +677,14 @@
 	contextMenu->addAction (ui->actionModeCircle);
 
 	if (selection().size() > 0)
-	{	contextMenu->addSeparator();
+	{
+		contextMenu->addSeparator();
 		contextMenu->addAction (ui->actionSubfileSelection);
 	}
 
 	if (R()->camera() != GL::EFreeCamera)
-	{	contextMenu->addSeparator();
+	{
+		contextMenu->addSeparator();
 		contextMenu->addAction (ui->actionSetDrawDepth);
 	}
 
@@ -635,17 +695,20 @@
 // TODO: what the heh?
 // -----------------------------------------------------------------------------
 void ForgeWindow::deleteObjects (QList<LDObject*> objs)
-{	for (LDObject* obj : objs)
+{
+	for (LDObject* obj : objs)
 		obj->deleteSelf();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::deleteByColor (const int colnum)
-{	QList<LDObject*> objs;
+{
+	QList<LDObject*> objs;
 
 	for (LDObject* obj : getCurrentDocument()->getObjects())
-	{	if (!obj->isColored() || obj->getColor() != colnum)
+	{
+		if (!obj->isColored() || obj->getColor() != colnum)
 			continue;
 
 		objs << obj;
@@ -657,7 +720,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::updateEditModeActions()
-{	const EditMode mode = R()->getEditMode();
+{
+	const EditMode mode = R()->getEditMode();
 	ui->actionModeSelect->setChecked (mode == ESelectMode);
 	ui->actionModeDraw->setChecked (mode == EDrawMode);
 	ui->actionModeCircle->setChecked (mode == ECircleMode);
@@ -666,11 +730,14 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::slot_editObject (QListWidgetItem* listitem)
-{	LDObject* obj = null;
+{
+	LDObject* obj = null;
 
 	for (LDObject* it : getCurrentDocument()->getObjects())
-	{	if (it->qObjListEntry == listitem)
-		{	obj = it;
+	{
+		if (it->qObjListEntry == listitem)
+		{
+			obj = it;
 			break;
 		}
 	}
@@ -682,7 +749,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::primitiveLoaderStart (int max)
-{	m_primLoaderWidget->show();
+{
+	m_primLoaderWidget->show();
 	m_primLoaderBar->setRange (0, max);
 	m_primLoaderBar->setValue (0);
 	m_primLoaderBar->setFormat ("%p%");
@@ -691,13 +759,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::primitiveLoaderUpdate (int prog)
-{	m_primLoaderBar->setValue (prog);
+{
+	m_primLoaderBar->setValue (prog);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::primitiveLoaderEnd()
-{	QTimer* hidetimer = new QTimer;
+{
+	QTimer* hidetimer = new QTimer;
 	connect (hidetimer, SIGNAL (timeout()), m_primLoaderWidget, SLOT (hide()));
 	hidetimer->setSingleShot (true);
 	hidetimer->start (1500);
@@ -709,10 +779,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool ForgeWindow::save (LDDocument* f, bool saveAs)
-{	str path = f->getFullPath();
+{
+	str path = f->getFullPath();
 
 	if (saveAs || path.isEmpty())
-	{	str name = f->getDefaultName();
+	{
+		str name = f->getDefaultName();
 
 		if (!f->getFullPath().isEmpty()) 
 			name = f->getFullPath();
@@ -724,13 +796,15 @@
 			name, tr ("LDraw files (*.dat *.ldr)"));
 
 		if (path.isEmpty())
-		{	// User didn't give a file name, abort.
+		{
+			// User didn't give a file name, abort.
 			return false;
 		}
 	}
 
 	if (f->save (path))
-	{	if (f == getCurrentDocument())
+	{
+		if (f == getCurrentDocument())
 			updateTitle();
 
 		log ("Saved to %1.", path);
@@ -759,45 +833,53 @@
 }
 
 void ForgeWindow::addMessage (str msg)
-{	m_msglog->addLine (msg);
+{
+	m_msglog->addLine (msg);
 }
 
 // ============================================================================
 void ObjectList::contextMenuEvent (QContextMenuEvent* ev)
-{	g_win->spawnContextMenu (ev->globalPos());
+{
+	g_win->spawnContextMenu (ev->globalPos());
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 QPixmap getIcon (str iconName)
-{	return (QPixmap (fmt (":/icons/%1.png", iconName)));
+{
+	return (QPixmap (fmt (":/icons/%1.png", iconName)));
 }
 
 // =============================================================================
 bool confirm (str msg)
-{	return confirm (ForgeWindow::tr ("Confirm"), msg);
+{
+	return confirm (ForgeWindow::tr ("Confirm"), msg);
 }
 
 bool confirm (str title, str msg)
-{	return QMessageBox::question (g_win, title, msg,
+{
+	return QMessageBox::question (g_win, title, msg,
 		(QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes;
 }
 
 // =============================================================================
 void critical (str msg)
-{	QMessageBox::critical (g_win, ForgeWindow::tr ("Error"), msg,
+{
+	QMessageBox::critical (g_win, ForgeWindow::tr ("Error"), msg,
 		(QMessageBox::Close), QMessageBox::Close);
 }
 
 // =============================================================================
 QIcon makeColorIcon (LDColor* colinfo, const int size)
-{	// Create an image object and link a painter to it.
+{
+	// Create an image object and link a painter to it.
 	QImage img (size, size, QImage::Format_ARGB32);
 	QPainter paint (&img);
 	QColor col = colinfo->faceColor;
 
 	if (colinfo->index == maincolor)
-	{	// Use the user preferences for main color here
+	{
+		// Use the user preferences for main color here
 		col = gl_maincolor;
 		col.setAlphaF (gl_maincolor_alpha);
 	}
@@ -815,10 +897,12 @@
 
 // =============================================================================
 void makeColorComboBox (QComboBox* box)
-{	std::map<int, int> counts;
+{
+	std::map<int, int> counts;
 
 	for (LDObject* obj : getCurrentDocument()->getObjects())
-	{	if (!obj->isColored())
+	{
+		if (!obj->isColored())
 			continue;
 
 		if (counts.find (obj->getColor()) == counts.end())
@@ -831,7 +915,8 @@
 	int row = 0;
 
 	for (const auto& pair : counts)
-	{	LDColor* col = getColor (pair.first);
+	{
+		LDColor* col = getColor (pair.first);
 		assert (col != null);
 
 		QIcon ico = makeColorIcon (col, 16);
@@ -844,18 +929,22 @@
 }
 
 void ForgeWindow::setStatusBarText (str text)
-{	statusBar()->showMessage (text);
+{
+	statusBar()->showMessage (text);
 }
 
 Ui_LDForgeUI* ForgeWindow::getInterface() const
-{	return ui;
+{
+	return ui;
 }
 
 void ForgeWindow::updateDocumentList()
-{	ui->fileList->clear();
+{
+	ui->fileList->clear();
 
 	for (LDDocument* f : g_loadedFiles)
-	{	// Don't list implicit files unless explicitly desired.
+	{
+		// Don't list implicit files unless explicitly desired.
 		if (f->isImplicit() && !gui_implicitfiles)
 			continue;
 
@@ -869,8 +958,10 @@
 }
 
 void ForgeWindow::updateDocumentListItem (LDDocument* f)
-{	if (f->getListItem() == null)
-	{	// We don't have a list item for this file, so the list either doesn't
+{
+	if (f->getListItem() == null)
+	{
+		// We don't have a list item for this file, so the list either doesn't
 		// exist yet or is out of date. Build the list now.
 		updateDocumentList();
 		return;
@@ -896,13 +987,16 @@
 // A file is selected from the list of files on the left of the screen. Find out
 // which file was picked and change to it.
 void ForgeWindow::changeCurrentFile()
-{	LDDocument* f = null;
+{
+	LDDocument* f = null;
 	QListWidgetItem* item = ui->fileList->currentItem();
 
 	// Find the file pointer of the item that was selected.
 	for (LDDocument* it : g_loadedFiles)
-	{	if (it->getListItem() == item)
-		{	f = it;
+	{
+		if (it->getListItem() == item)
+		{
+			f = it;
 			break;
 		}
 	}
@@ -930,7 +1024,8 @@
 }
 
 void ForgeWindow::updateActions()
-{	History* his = getCurrentDocument()->getHistory();
+{
+	History* his = getCurrentDocument()->getHistory();
 	int pos = his->getPosition();
 	ui->actionUndo->setEnabled (pos != -1);
 	ui->actionRedo->setEnabled (pos < (long) his->getSize() - 1);
@@ -940,7 +1035,8 @@
 }
 
 QImage imageFromScreencap (uchar* data, int w, int h)
-{	// GL and Qt formats have R and B swapped. Also, GL flips Y - correct it as well.
+{
+	// GL and Qt formats have R and B swapped. Also, GL flips Y - correct it as well.
 	return QImage (data, w, h, QImage::Format_ARGB32).rgbSwapped().mirrored();
 }
 
@@ -951,9 +1047,11 @@
 	m_ToolButton (toolButton) {}
 
 LDQuickColor LDQuickColor::getSeparator()
-{	return LDQuickColor (null, null);
+{
+	return LDQuickColor (null, null);
 }
 
 bool LDQuickColor::isSeparator() const
-{	return getColor() == null;
+{
+	return getColor() == null;
 }
--- a/src/gui.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/gui.h	Tue Jan 07 08:53:27 2014 +0200
@@ -58,7 +58,8 @@
 
 // =============================================================================
 class LDQuickColor
-{	PROPERTY (public,	LDColor*,		Color,		NO_OPS,	STOCK_WRITE)
+{
+	PROPERTY (public,	LDColor*,		Color,		NO_OPS,	STOCK_WRITE)
 	PROPERTY (public,	QToolButton*,	ToolButton,	NO_OPS,	STOCK_WRITE)
 
 	public:
@@ -74,7 +75,8 @@
 // Object list class for ForgeWindow
 // =============================================================================
 class ObjectList : public QListWidget
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	protected:
 		void contextMenuEvent (QContextMenuEvent* ev);
@@ -88,7 +90,8 @@
 // Large and in charge.
 // =============================================================================
 class ForgeWindow : public QMainWindow
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	typedefs:
 		using ActionMethodType = void (ForgeWindow::*)();
@@ -118,11 +121,13 @@
 		void updateActions();
 
 		inline GLRenderer* R()
-		{	return m_renderer;
+		{
+			return m_renderer;
 		}
 
 		inline void setQuickColors (QList<LDQuickColor>& colors)
-		{	m_quickColors = colors;
+		{
+			m_quickColors = colors;
 		}
 
 		void setStatusBarText (str text);
@@ -280,7 +285,8 @@
 // =============================================================================
 template<class T>
 T radioSwitch (const T& defval, QList<pair<QRadioButton*, T>> haystack)
-{	for (pair<QRadioButton*, const T&> i : haystack)
+{
+	for (pair<QRadioButton*, const T&> i : haystack)
 		if (i.first->isChecked())
 			return i.second;
 
@@ -294,9 +300,12 @@
 // =============================================================================
 template<class T>
 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);
+{
+	for (pair<QRadioButton*, const T&> i : haystack)
+	{
+		if (i.second == expr)
+		{
+			i.first->setChecked (true);
 			return;
 		}
 	}
--- a/src/gui_actions.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/gui_actions.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -47,7 +47,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (New, CTRL_SHIFT (N))
-{	QDialog* dlg = new QDialog (g_win);
+{
+	QDialog* dlg = new QDialog (g_win);
 	Ui::NewPartUI ui;
 	ui.setupUi (dlg);
 
@@ -59,7 +60,8 @@
 	ui.le_author->setText (authortext);
 
 	switch (ld_defaultlicense)
-	{	case 0:
+	{
+		case 0:
 			ui.rb_license_ca->setChecked (true);
 			break;
 
@@ -91,7 +93,8 @@
 		ui.rb_license_nonca->isChecked() ? NonCALicense : "";
 
 	getCurrentDocument()->addObjects (
-	{	new LDComment (ui.le_title->text()),
+	{
+		new LDComment (ui.le_title->text()),
 		new LDComment ("Name: <untitled>.dat"),
 		new LDComment (fmt ("Author: %1", ui.le_author->text())),
 		new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")),
@@ -107,13 +110,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (NewFile, CTRL (N))
-{	newFile();
+{
+	newFile();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Open, CTRL (O))
-{	str name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)");
+{
+	str name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)");
 
 	if (name.length() == 0)
 		return;
@@ -124,20 +129,24 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Save, CTRL (S))
-{	save (getCurrentDocument(), false);
+{
+	save (getCurrentDocument(), false);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SaveAs, CTRL_SHIFT (S))
-{	save (getCurrentDocument(), true);
+{
+	save (getCurrentDocument(), true);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SaveAll, CTRL (L))
-{	for (LDDocument* file : g_loadedFiles)
-	{	if (file->isImplicit())
+{
+	for (LDDocument* file : g_loadedFiles)
+	{
+		if (file->isImplicit())
 			continue;
 
 		save (file, false);
@@ -147,7 +156,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Close, CTRL (W))
-{	if (!getCurrentDocument()->isSafeToClose())
+{
+	if (!getCurrentDocument()->isSafeToClose())
 		return;
 
 	delete getCurrentDocument();
@@ -156,7 +166,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (CloseAll, 0)
-{	if (!safeToCloseAll())
+{
+	if (!safeToCloseAll())
 		return;
 
 	closeAll();
@@ -165,73 +176,85 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Settings, 0)
-{	(new ConfigDialog)->exec();
+{
+	(new ConfigDialog)->exec();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SetLDrawPath, 0)
-{	(new LDrawPathDialog (true))->exec();
+{
+	(new LDrawPathDialog (true))->exec();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Exit, CTRL (Q))
-{	exit (0);
+{
+	exit (0);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (NewSubfile, 0)
-{	AddObjectDialog::staticDialog (LDObject::Subfile, null);
+{
+	AddObjectDialog::staticDialog (LDObject::Subfile, null);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (NewLine, 0)
-{	AddObjectDialog::staticDialog (LDObject::Line, null);
+{
+	AddObjectDialog::staticDialog (LDObject::Line, null);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (NewTriangle, 0)
-{	AddObjectDialog::staticDialog (LDObject::Triangle, null);
+{
+	AddObjectDialog::staticDialog (LDObject::Triangle, null);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (NewQuad, 0)
-{	AddObjectDialog::staticDialog (LDObject::Quad, null);
+{
+	AddObjectDialog::staticDialog (LDObject::Quad, null);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (NewCLine, 0)
-{	AddObjectDialog::staticDialog (LDObject::CondLine, null);
+{
+	AddObjectDialog::staticDialog (LDObject::CondLine, null);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (NewComment, 0)
-{	AddObjectDialog::staticDialog (LDObject::Comment, null);
+{
+	AddObjectDialog::staticDialog (LDObject::Comment, null);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (NewBFC, 0)
-{	AddObjectDialog::staticDialog (LDObject::BFC, null);
+{
+	AddObjectDialog::staticDialog (LDObject::BFC, null);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (NewVertex, 0)
-{	AddObjectDialog::staticDialog (LDObject::Vertex, null);
+{
+	AddObjectDialog::staticDialog (LDObject::Vertex, null);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Edit, 0)
-{	if (selection().size() != 1)
+{
+	if (selection().size() != 1)
 		return;
 
 	LDObject* obj = selection() [0];
@@ -247,19 +270,22 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (About, 0)
-{	AboutDialog().exec();
+{
+	AboutDialog().exec();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (AboutQt, 0)
-{	QMessageBox::aboutQt (g_win);
+{
+	QMessageBox::aboutQt (g_win);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SelectAll, CTRL (A))
-{	for (LDObject* obj : getCurrentDocument()->getObjects())
+{
+	for (LDObject* obj : getCurrentDocument()->getObjects())
 		obj->select();
 
 	updateSelection();
@@ -268,7 +294,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SelectByColor, CTRL_SHIFT (A))
-{	int colnum = getSelectedColor();
+{
+	int colnum = getSelectedColor();
 
 	if (colnum == -1)
 		return; // no consensus on color
@@ -285,7 +312,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SelectByType, 0)
-{	if (selection().isEmpty())
+{
+	if (selection().isEmpty())
 		return;
 
 	LDObject::Type type = getUniformSelectedType();
@@ -298,7 +326,8 @@
 	str refName;
 
 	if (type == LDObject::Subfile)
-	{	refName = static_cast<LDSubfile*> (selection()[0])->getFileInfo()->getName();
+	{
+		refName = static_cast<LDSubfile*> (selection()[0])->getFileInfo()->getName();
 
 		for (LDObject* obj : selection())
 			if (static_cast<LDSubfile*> (obj)->getFileInfo()->getName() != refName)
@@ -308,7 +337,8 @@
 	getCurrentDocument()->clearSelection();
 
 	for (LDObject* obj : getCurrentDocument()->getObjects())
-	{	if (obj->getType() != type)
+	{
+		if (obj->getType() != type)
 			continue;
 
 		if (type == LDObject::Subfile && static_cast<LDSubfile*> (obj)->getFileInfo()->getName() != refName)
@@ -323,31 +353,36 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (GridCoarse, 0)
-{	grid = Grid::Coarse;
+{
+	grid = Grid::Coarse;
 	updateGridToolBar();
 }
 
 DEFINE_ACTION (GridMedium, 0)
-{	grid = Grid::Medium;
+{
+	grid = Grid::Medium;
 	updateGridToolBar();
 }
 
 DEFINE_ACTION (GridFine, 0)
-{	grid = Grid::Fine;
+{
+	grid = Grid::Fine;
 	updateGridToolBar();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (ResetView, CTRL (0))
-{	R()->resetAngles();
+{
+	R()->resetAngles();
 	R()->update();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (InsertFrom, 0)
-{	str fname = QFileDialog::getOpenFileName();
+{
+	str fname = QFileDialog::getOpenFileName();
 	int idx = getInsertionPoint();
 
 	if (!fname.length())
@@ -356,7 +391,8 @@
 	File f (fname, File::Read);
 
 	if (!f)
-	{	critical (fmt ("Couldn't open %1 (%2)", fname, strerror (errno)));
+	{
+		critical (fmt ("Couldn't open %1 (%2)", fname, strerror (errno)));
 		return;
 	}
 
@@ -365,7 +401,8 @@
 	getCurrentDocument()->clearSelection();
 
 	for (LDObject* obj : objs)
-	{	getCurrentDocument()->insertObj (idx, obj);
+	{
+		getCurrentDocument()->insertObj (idx, obj);
 		obj->select();
 		R()->compileObject (obj);
 
@@ -379,7 +416,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (ExportTo, 0)
-{	if (selection().isEmpty())
+{
+	if (selection().isEmpty())
 		return;
 
 	str fname = QFileDialog::getSaveFileName();
@@ -390,12 +428,14 @@
 	QFile file (fname);
 
 	if (!file.open (QIODevice::WriteOnly | QIODevice::Text))
-	{	critical (fmt ("Unable to open %1 for writing (%2)", fname, strerror (errno)));
+	{
+		critical (fmt ("Unable to open %1 for writing (%2)", fname, strerror (errno)));
 		return;
 	}
 
 	for (LDObject* obj : selection())
-	{	str contents = obj->raw();
+	{
+		str contents = obj->raw();
 		QByteArray data = contents.toUtf8();
 		file.write (data, data.size());
 		file.write ("\r\n", 2);
@@ -405,7 +445,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (InsertRaw, 0)
-{	int idx = getInsertionPoint();
+{
+	int idx = getInsertionPoint();
 
 	QDialog* const dlg = new QDialog;
 	QVBoxLayout* const layout = new QVBoxLayout;
@@ -425,7 +466,8 @@
 	getCurrentDocument()->clearSelection();
 
 	for (str line : str (te_edit->toPlainText()).split ("\n"))
-	{	LDObject* obj = parseLine (line);
+	{
+		LDObject* obj = parseLine (line);
 
 		getCurrentDocument()->insertObj (idx, obj);
 		obj->select();
@@ -440,7 +482,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Screenshot, 0)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 
 	int w, h;
 	uchar* imgdata = R()->getScreencap (w, h);
@@ -465,7 +508,8 @@
 // -----------------------------------------------------------------------------
 extern_cfg (Bool, gl_axes);
 DEFINE_ACTION (Axes, 0)
-{	gl_axes = !gl_axes;
+{
+	gl_axes = !gl_axes;
 	updateActions();
 	R()->update();
 }
@@ -473,7 +517,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (VisibilityToggle, 0)
-{	for (LDObject* obj : selection())
+{
+	for (LDObject* obj : selection())
 		obj->toggleHidden();
 
 	refresh();
@@ -482,7 +527,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (VisibilityHide, 0)
-{	for (LDObject* obj : selection())
+{
+	for (LDObject* obj : selection())
 		obj->setHidden (true);
 
 	refresh();
@@ -491,7 +537,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (VisibilityReveal, 0)
-{	for (LDObject* obj : selection())
+{
+	for (LDObject* obj : selection())
 	obj->setHidden (false);
 	refresh();
 }
@@ -499,14 +546,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Wireframe, 0)
-{	gl_wireframe = !gl_wireframe;
+{
+	gl_wireframe = !gl_wireframe;
 	R()->refresh();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SetOverlay,  0)
-{	OverlayDialog dlg;
+{
+	OverlayDialog dlg;
 
 	if (!dlg.exec())
 		return;
@@ -518,38 +567,44 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (ClearOverlay, 0)
-{	R()->clearOverlay();
+{
+	R()->clearOverlay();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (ModeSelect, CTRL (1))
-{	R()->setEditMode (ESelectMode);
+{
+	R()->setEditMode (ESelectMode);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (ModeDraw, CTRL (2))
-{	R()->setEditMode (EDrawMode);
+{
+	R()->setEditMode (EDrawMode);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (ModeCircle, CTRL (3))
-{	R()->setEditMode (ECircleMode);
+{
+	R()->setEditMode (ECircleMode);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (DrawAngles, 0)
-{	gl_drawangles = !gl_drawangles;
+{
+	gl_drawangles = !gl_drawangles;
 	R()->refresh();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SetDrawDepth, 0)
-{	if (R()->camera() == GL::EFreeCamera)
+{
+	if (R()->camera() == GL::EFreeCamera)
 		return;
 
 	bool ok;
@@ -566,11 +621,13 @@
 // but I can't figure how to generate these pictures properly. Multi-threading
 // these is an immense pain.
 DEFINE_ACTION (testpic, "Test picture", "", "", (0))
-{	LDDocument* file = getFile ("axle.dat");
+{
+	LDDocument* file = getFile ("axle.dat");
 	setlocale (LC_ALL, "C");
 
 	if (!file)
-	{	critical ("couldn't load axle.dat");
+	{
+		critical ("couldn't load axle.dat");
 		return;
 	}
 
@@ -590,10 +647,12 @@
 	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;
+	{
+		QLabel* label = new QLabel;
 		QDialog* dlg = new QDialog;
 		label->setPixmap (QPixmap::fromImage (img));
 		QVBoxLayout* layout = new QVBoxLayout (dlg);
@@ -609,13 +668,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (ScanPrimitives, 0)
-{	PrimitiveLister::start();
+{
+	PrimitiveLister::start();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (BFCView, SHIFT (B))
-{	gl_colorbfc = !gl_colorbfc;
+{
+	gl_colorbfc = !gl_colorbfc;
 	updateActions();
 	R()->refresh();
 }
@@ -623,7 +684,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (JumpTo, CTRL (G))
-{	bool ok;
+{
+	bool ok;
 	int defval = 0;
 	LDObject* obj;
 
@@ -644,7 +706,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SubfileSelection, 0)
-{	if (selection().size() == 0)
+{
+	if (selection().size() == 0)
 		return;
 
 	str			parentpath = getCurrentDocument()->getFullPath();
@@ -688,20 +751,23 @@
 	str topdirname = basename (dirname (getCurrentDocument()->getFullPath()));
 
 	if (topdirname != "s")
-	{	str desiredPath = subdirname + "/s";
+	{
+		str desiredPath = subdirname + "/s";
 		str title = tr ("Create subfile directory?");
 		str text = fmt (tr ("The directory <b>%1</b> is suggested for "
 			"subfiles. This directory does not exist, create it?"), desiredPath);
 
 		if (QDir (desiredPath).exists() || confirm (title, text))
-		{	subdirname = desiredPath;
+		{
+			subdirname = desiredPath;
 			QDir().mkpath (subdirname);
 		}
 	}
 
 	// Determine the body of the name of the subfile
 	if (!parentpath.isEmpty())
-	{	if (parentpath.endsWith (".dat"))
+	{
+		if (parentpath.endsWith (".dat"))
 			parentpath.chop (4);
 
 		// Remove the s?? suffix if it's there, otherwise we'll get filenames
@@ -716,7 +782,8 @@
 		str testfname;
 
 		do
-		{	digits.setNum (subidx++);
+		{
+			digits.setNum (subidx++);
 
 			// pad it with a zero
 			if (digits.length() == 1)
@@ -729,7 +796,8 @@
 	// Determine the BFC winding type used in the main document - it is to
 	// be carried over to the subfile.
 	for (LDObject* obj : getCurrentDocument()->getObjects())
-	{	LDBFC* bfc = dynamic_cast<LDBFC*> (obj);
+	{
+		LDBFC* bfc = dynamic_cast<LDBFC*> (obj);
 
 		if (!bfc)
 			continue;
@@ -737,7 +805,8 @@
 		LDBFC::Type a = bfc->type;
 
 		if (a == LDBFC::CertifyCCW || a == LDBFC::CertifyCW || a == LDBFC::NoCertify)
-		{	bfctype = a;
+		{
+			bfctype = a;
 			break;
 		}
 	}
@@ -752,7 +821,8 @@
 	doc->setFullPath (fullsubname);
 	doc->setName (LDDocument::shortenName (fullsubname));
 	doc->addObjects (
-	{	new LDComment (subtitle),
+	{
+		new LDComment (subtitle),
 		new LDComment ("Name: "),
 		new LDComment (fmt ("Author: %1 [%2]", ld_defaultname, ld_defaultuser)),
 		new LDComment (fmt ("!LDRAW_ORG Unofficial_Subpart")),
@@ -764,13 +834,15 @@
 
 	// Add the actual subfile code to the new document
 	for (str line : code)
-	{	LDObject* obj = parseLine (line);
+	{
+		LDObject* obj = parseLine (line);
 		doc->addObject (obj);
 	}
 
 	// Try save it
 	if (save (doc, true))
-	{	// Remove the selection now
+	{
+		// Remove the selection now
 		for (LDObject* obj : selection())
 			obj->deleteSelf();
 
@@ -794,7 +866,8 @@
 		doFullRefresh();
 	}
 	else
-	{	// Failed to save.
+	{
+		// Failed to save.
 		delete doc;
 	}
 }
\ No newline at end of file
--- a/src/gui_editactions.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/gui_editactions.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -41,7 +41,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static int copyToClipboard()
-{	QList<LDObject*> objs = selection();
+{
+	QList<LDObject*> objs = selection();
 	int num = 0;
 
 	// Clear the clipboard first.
@@ -51,7 +52,8 @@
 	str data;
 
 	for (LDObject* obj : objs)
-	{	if (data.length() > 0)
+	{
+		if (data.length() > 0)
 			data += "\n";
 
 		data += obj->raw();
@@ -65,7 +67,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Cut, CTRL (X))
-{	int num = copyToClipboard();
+{
+	int num = copyToClipboard();
 	deleteSelection();
 	log (tr ("%1 objects cut"), num);
 }
@@ -73,20 +76,23 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Copy, CTRL (C))
-{	int num = copyToClipboard();
+{
+	int num = copyToClipboard();
 	log (tr ("%1 objects copied"), num);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Paste, CTRL (V))
-{	const str clipboardText = qApp->clipboard()->text();
+{
+	const str clipboardText = qApp->clipboard()->text();
 	int idx = getInsertionPoint();
 	getCurrentDocument()->clearSelection();
 	int num = 0;
 
 	for (str line : clipboardText.split ("\n"))
-	{	LDObject* pasted = parseLine (line);
+	{
+		LDObject* pasted = parseLine (line);
 		getCurrentDocument()->insertObj (idx++, pasted);
 		pasted->select();
 		R()->compileObject (pasted);
@@ -101,17 +107,20 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Delete, KEY (Delete))
-{	int num = deleteSelection();
+{
+	int num = deleteSelection();
 	log (tr ("%1 objects deleted"), num);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 static void doInline (bool deep)
-{	QList<LDObject*> sel = selection();
+{
+	QList<LDObject*> sel = selection();
 
 	for (LDObject* obj : sel)
-	{	// Get the index of the subfile so we know where to insert the
+	{
+		// Get the index of the subfile so we know where to insert the
 		// inlined contents.
 		long idx = obj->getIndex();
 
@@ -131,7 +140,8 @@
 
 		// Merge in the inlined objects
 		for (LDObject * inlineobj : objs)
-		{	str line = inlineobj->raw();
+		{
+			str line = inlineobj->raw();
 			inlineobj->deleteSelf();
 			LDObject* newobj = parseLine (line);
 			getCurrentDocument()->insertObj (idx++, newobj);
@@ -147,21 +157,25 @@
 }
 
 DEFINE_ACTION (Inline, CTRL (I))
-{	doInline (false);
+{
+	doInline (false);
 }
 
 DEFINE_ACTION (InlineDeep, CTRL_SHIFT (I))
-{	doInline (true);
+{
+	doInline (true);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SplitQuads, 0)
-{	QList<LDObject*> objs = selection();
+{
+	QList<LDObject*> objs = selection();
 	int num = 0;
 
 	for (LDObject* obj : objs)
-	{	if (obj->getType() != LDObject::Quad)
+	{
+		if (obj->getType() != LDObject::Quad)
 			continue;
 
 		// Find the index of this quad
@@ -193,7 +207,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (EditRaw, KEY (F9))
-{	if (selection().size() != 1)
+{
+	if (selection().size() != 1)
 		return;
 
 	LDObject* obj = selection()[0];
@@ -206,7 +221,8 @@
 	if (obj->getType() == LDObject::Error)
 		ui.errorDescription->setText (static_cast<LDError*> (obj)->reason);
 	else
-	{	ui.errorDescription->hide();
+	{
+		ui.errorDescription->hide();
 		ui.errorIcon->hide();
 	}
 
@@ -227,7 +243,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (SetColor, KEY (C))
-{	if (selection().isEmpty())
+{
+	if (selection().isEmpty())
 		return;
 
 	int colnum;
@@ -241,8 +258,10 @@
 
 	// Show the dialog to the user now and ask for a color.
 	if (ColorSelector::selectColor (colnum, defcol, g_win))
-	{	for (LDObject* obj : objs)
-		{	if (obj->isColored() == false)
+	{
+		for (LDObject* obj : objs)
+		{
+			if (obj->isColored() == false)
 				continue;
 
 			obj->setColor (colnum);
@@ -256,11 +275,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Borders, CTRL_SHIFT (B))
-{	QList<LDObject*> objs = selection();
+{
+	QList<LDObject*> objs = selection();
 	int num = 0;
 
 	for (LDObject* obj : objs)
-	{	const LDObject::Type type = obj->getType();
+	{
+		const LDObject::Type type = obj->getType();
 		if (type != LDObject::Quad && type != LDObject::Triangle)
 			continue;
 
@@ -268,7 +289,8 @@
 		LDLine* lines[4];
 
 		if (type == LDObject::Quad)
-		{	numLines = 4;
+		{
+			numLines = 4;
 
 			LDQuad* quad = static_cast<LDQuad*> (obj);
 			lines[0] = new LDLine (quad->getVertex (0), quad->getVertex (1));
@@ -277,7 +299,8 @@
 			lines[3] = new LDLine (quad->getVertex (3), quad->getVertex (0));
 		}
 		else
-		{	numLines = 3;
+		{
+			numLines = 3;
 
 			LDTriangle* tri = static_cast<LDTriangle*> (obj);
 			lines[0] = new LDLine (tri->getVertex (0), tri->getVertex (1));
@@ -286,7 +309,8 @@
 		}
 
 		for (int i = 0; i < numLines; ++i)
-		{	long idx = obj->getIndex() + i + 1;
+		{
+			long idx = obj->getIndex() + i + 1;
 
 			lines[i]->setColor (edgecolor);
 			getCurrentDocument()->insertObj (idx, lines[i]);
@@ -303,16 +327,19 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (CornerVerts, 0)
-{	int num = 0;
+{
+	int num = 0;
 
 	for (LDObject* obj : selection())
-	{	if (obj->vertices() < 2)
+	{
+		if (obj->vertices() < 2)
 			continue;
 
 		int idx = obj->getIndex();
 
 		for (int i = 0; i < obj->vertices(); ++i)
-		{	LDVertex* vert = new LDVertex;
+		{
+			LDVertex* vert = new LDVertex;
 			vert->pos = obj->getVertex (i);
 			vert->setColor (obj->getColor());
 
@@ -329,7 +356,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static void doMoveSelection (const bool up)
-{	QList<LDObject*> objs = selection();
+{
+	QList<LDObject*> objs = selection();
 	LDObject::moveObjects (objs, up);
 	g_win->buildObjList();
 }
@@ -337,33 +365,39 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (MoveUp, KEY (PageUp))
-{	doMoveSelection (true);
+{
+	doMoveSelection (true);
 }
 
 DEFINE_ACTION (MoveDown, KEY (PageDown))
-{	doMoveSelection (false);
+{
+	doMoveSelection (false);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Undo, CTRL (Z))
-{	getCurrentDocument()->undo();
+{
+	getCurrentDocument()->undo();
 }
 
 DEFINE_ACTION (Redo, CTRL_SHIFT (Z))
-{	getCurrentDocument()->redo();
+{
+	getCurrentDocument()->redo();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void doMoveObjects (vertex vect)
-{	// Apply the grid values
+{
+	// Apply the grid values
 	vect[X] *= *currentGrid().confs[Grid::X];
 	vect[Y] *= *currentGrid().confs[Grid::Y];
 	vect[Z] *= *currentGrid().confs[Grid::Z];
 
 	for (LDObject* obj : selection())
-	{	obj->move (vect);
+	{
+		obj->move (vect);
 		g_win->R()->compileObject (obj);
 	}
 
@@ -373,36 +407,44 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (MoveXNeg, KEY (Left))
-{	doMoveObjects ({ -1, 0, 0});
+{
+	doMoveObjects ({ -1, 0, 0});
 }
 
 DEFINE_ACTION (MoveYNeg, KEY (Home))
-{	doMoveObjects ({0, -1, 0});
+{
+	doMoveObjects ({0, -1, 0});
 }
 
 DEFINE_ACTION (MoveZNeg, KEY (Down))
-{	doMoveObjects ({0, 0, -1});
+{
+	doMoveObjects ({0, 0, -1});
 }
 
 DEFINE_ACTION (MoveXPos, KEY (Right))
-{	doMoveObjects ({1, 0, 0});
+{
+	doMoveObjects ({1, 0, 0});
 }
 
 DEFINE_ACTION (MoveYPos, KEY (End))
-{	doMoveObjects ({0, 1, 0});
+{
+	doMoveObjects ({0, 1, 0});
 }
 
 DEFINE_ACTION (MoveZPos, KEY (Up))
-{	doMoveObjects ({0, 0, 1});
+{
+	doMoveObjects ({0, 0, 1});
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Invert, CTRL_SHIFT (W))
-{	QList<LDObject*> sel = selection();
+{
+	QList<LDObject*> sel = selection();
 
 	for (LDObject* obj : sel)
-	{	obj->invert();
+	{
+		obj->invert();
 		R()->compileObject (obj);
 	}
 
@@ -412,7 +454,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static void rotateVertex (vertex& v, const vertex& rotpoint, const matrix& transform)
-{	v.move (-rotpoint);
+{
+	v.move (-rotpoint);
 	v.transform (transform, g_origin);
 	v.move (rotpoint);
 }
@@ -420,7 +463,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static void doRotate (const int l, const int m, const int n)
-{	QList<LDObject*> sel = selection();
+{
+	QList<LDObject*> sel = selection();
 	QList<vertex*> queue;
 	const vertex rotpoint = rotPoint (sel);
 	const double angle = (pi * *currentGrid().confs[Grid::Angle]) / 180,
@@ -429,7 +473,8 @@
 
 	// ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2
 	matrix transform (
-	{	(l* l * (1 - cosangle)) + cosangle,
+	{
+		(l* l * (1 - cosangle)) + cosangle,
 		(m* l * (1 - cosangle)) - (n* sinangle),
 		(n* l * (1 - cosangle)) + (m* sinangle),
 
@@ -444,14 +489,18 @@
 
 	// Apply the above matrix to everything
 	for (LDObject* obj : sel)
-	{	if (obj->vertices())
-		{	for (int i = 0; i < obj->vertices(); ++i)
-			{	vertex v = obj->getVertex (i);
+	{
+		if (obj->vertices())
+		{
+			for (int i = 0; i < obj->vertices(); ++i)
+			{
+				vertex v = obj->getVertex (i);
 				rotateVertex (v, rotpoint, transform);
 				obj->setVertex (i, v);
 			}
 		} elif (obj->hasMatrix())
-		{	LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
+		{
+			LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
 
 			// Transform the position
 			/*
@@ -463,7 +512,8 @@
 			// Transform the matrix
 			mo->setTransform (transform * mo->getTransform());
 		} elif (obj->getType() == LDObject::Vertex)
-		{	LDVertex* vert = static_cast<LDVertex*> (obj);
+		{
+			LDVertex* vert = static_cast<LDVertex*> (obj);
 			vertex v = vert->pos;
 			rotateVertex (v, rotpoint, transform);
 			vert->pos = v;
@@ -478,39 +528,49 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (RotateXPos, CTRL (Right))
-{	doRotate (1, 0, 0);
+{
+	doRotate (1, 0, 0);
 }
 DEFINE_ACTION (RotateYPos, CTRL (End))
-{	doRotate (0, 1, 0);
+{
+	doRotate (0, 1, 0);
 }
 DEFINE_ACTION (RotateZPos, CTRL (Up))
-{	doRotate (0, 0, 1);
+{
+	doRotate (0, 0, 1);
 }
 DEFINE_ACTION (RotateXNeg, CTRL (Left))
-{	doRotate (-1, 0, 0);
+{
+	doRotate (-1, 0, 0);
 }
 DEFINE_ACTION (RotateYNeg, CTRL (Home))
-{	doRotate (0, -1, 0);
+{
+	doRotate (0, -1, 0);
 }
 DEFINE_ACTION (RotateZNeg, CTRL (Down))
-{	doRotate (0, 0, -1);
+{
+	doRotate (0, 0, -1);
 }
 
 DEFINE_ACTION (RotationPoint, (0))
-{	configRotationPoint();
+{
+	configRotationPoint();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (RoundCoordinates, 0)
-{	setlocale (LC_ALL, "C");
+{
+	setlocale (LC_ALL, "C");
 	int num = 0;
 
 	for (LDObject* obj : selection())
-	{	LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
+	{
+		LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
 
 		if (mo != null)
-		{	vertex v = mo->getPosition();
+		{
+			vertex v = mo->getPosition();
 			matrix t = mo->getTransform();
 
 			for_axes (ax)
@@ -526,8 +586,10 @@
 			num += 10;
 		}
 		else
-		{	for (int i = 0; i < obj->vertices(); ++i)
-			{	vertex v = obj->getVertex (i);
+		{
+			for (int i = 0; i < obj->vertices(); ++i)
+			{
+				vertex v = obj->getVertex (i);
 
 				for_axes (ax)
 					roundToDecimals (v[ax], 3);
@@ -547,10 +609,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Uncolorize, 0)
-{	int num = 0;
+{
+	int num = 0;
 
 	for (LDObject* obj : selection())
-	{	if (obj->isColored() == false)
+	{
+		if (obj->isColored() == false)
 			continue;
 
 		int col = maincolor;
@@ -570,7 +634,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (ReplaceCoords, CTRL (R))
-{	QDialog* dlg = new QDialog (g_win);
+{
+	QDialog* dlg = new QDialog (g_win);
 	Ui::ReplaceCoordsUI ui;
 	ui.setupUi (dlg);
 
@@ -590,14 +655,18 @@
 	if (ui.z->isChecked()) sel << Z;
 
 	for (LDObject* obj : selection())
-	{	for (int i = 0; i < obj->vertices(); ++i)
-		{	vertex v = obj->getVertex (i);
+	{
+		for (int i = 0; i < obj->vertices(); ++i)
+		{
+			vertex v = obj->getVertex (i);
 
 			for (Axis ax : sel)
-			{	double& coord = v[ax];
+			{
+				double& coord = v[ax];
 
 				if (any || coord == search)
-				{	if (!rel)
+				{
+					if (!rel)
 						coord = 0;
 
 					coord += replacement;
@@ -617,7 +686,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Flip, CTRL_SHIFT (F))
-{	QDialog* dlg = new QDialog;
+{
+	QDialog* dlg = new QDialog;
 	Ui::FlipUI ui;
 	ui.setupUi (dlg);
 
@@ -631,8 +701,10 @@
 	if (ui.z->isChecked()) sel << Z;
 
 	for (LDObject* obj : selection())
-	{	for (int i = 0; i < obj->vertices(); ++i)
-		{	vertex v = obj->getVertex (i);
+	{
+		for (int i = 0; i < obj->vertices(); ++i)
+		{
+			vertex v = obj->getVertex (i);
 
 			for (Axis ax : sel)
 				v[ax] *= -1;
@@ -648,11 +720,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Demote, 0)
-{	QList<LDObject*> sel = selection();
+{
+	QList<LDObject*> sel = selection();
 	int num = 0;
 
 	for (LDObject* obj : sel)
-	{	if (obj->getType() != LDObject::CondLine)
+	{
+		if (obj->getType() != LDObject::CondLine)
 			continue;
 
 		LDLine* repl = static_cast<LDCondLine*> (obj)->demote();
@@ -667,7 +741,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static bool isColorUsed (int colnum)
-{	for (LDObject* obj : getCurrentDocument()->getObjects())
+{
+	for (LDObject* obj : getCurrentDocument()->getObjects())
 		if (obj->isColored() && obj->getColor() == colnum)
 			return true;
 
@@ -677,18 +752,21 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (Autocolor, 0)
-{	int colnum = 0;
+{
+	int colnum = 0;
 
 	while (colnum < MAX_COLORS && (getColor (colnum) == null || isColorUsed (colnum)))
 		colnum++;
 
 	if (colnum >= MAX_COLORS)
-	{	log (tr ("Cannot auto-color: all colors are in use!"));
+	{
+		log (tr ("Cannot auto-color: all colors are in use!"));
 		return;
 	}
 
 	for (LDObject* obj : selection())
-	{	if (obj->isColored() == false)
+	{
+		if (obj->isColored() == false)
 			continue;
 
 		obj->setColor (colnum);
@@ -702,7 +780,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (AddHistoryLine, 0)
-{	LDObject* obj;
+{
+	LDObject* obj;
 	bool ishistory = false,
 		 prevIsHistory = false;
 
@@ -730,13 +809,15 @@
 		obj && obj->next() && !obj->next()->isScemantic();
 		obj = obj->next()
 	)
-	{	LDComment* comm = dynamic_cast<LDComment*> (obj);
+	{
+		LDComment* comm = dynamic_cast<LDComment*> (obj);
 
 		if (comm && comm->text.startsWith ("!HISTORY "))
 			ishistory = true;
 
 		if (prevIsHistory && !ishistory)
-		{	// Last line was history, this isn't, thus insert the new history
+		{
+			// Last line was history, this isn't, thus insert the new history
 			// line here.
 			break;
 		}
--- a/src/history.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/history.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -31,7 +31,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void History::undo()
-{	if (m_changesets.isEmpty() || getPosition() == -1)
+{
+	if (m_changesets.isEmpty() || getPosition() == -1)
 		return;
 
 	// Don't take the changes done here as actual edits to the document
@@ -41,7 +42,8 @@
 
 	// Iterate the list in reverse and undo all actions
 	for (int i = set.size() - 1; i >= 0; --i)
-	{	AbstractHistoryEntry* change = set[i];
+	{
+		AbstractHistoryEntry* change = set[i];
 		change->undo();
 	}
 
@@ -55,7 +57,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void History::redo()
-{	if (getPosition() == m_changesets.size())
+{
+	if (getPosition() == m_changesets.size())
 		return;
 
 	setIgnoring (true);
@@ -75,7 +78,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void History::clear()
-{	for (Changeset set : m_changesets)
+{
+	for (Changeset set : m_changesets)
 		for (AbstractHistoryEntry* change : set)
 			delete change;
 
@@ -86,11 +90,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void History::addStep()
-{	if (m_currentChangeset.isEmpty())
+{
+	if (m_currentChangeset.isEmpty())
 		return;
 
 	while (getPosition() < getSize() - 1)
-	{	Changeset last = m_changesets.last();
+	{
+		Changeset last = m_changesets.last();
 
 		for (AbstractHistoryEntry* entry : last)
 			delete entry;
@@ -108,8 +114,10 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void History::add (AbstractHistoryEntry* entry)
-{	if (isIgnoring())
-	{	delete entry;
+{
+	if (isIgnoring())
+	{
+		delete entry;
 		return;
 	}
 
@@ -121,14 +129,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void AddHistory::undo() const
-{	LDObject* obj = getParent()->getFile()->getObject (getIndex());
+{
+	LDObject* obj = getParent()->getFile()->getObject (getIndex());
 	obj->deleteSelf();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void AddHistory::redo() const
-{	LDObject* obj = parseLine (getCode());
+{
+	LDObject* obj = parseLine (getCode());
 	getParent()->getFile()->insertObj (getIndex(), obj);
 	g_win->R()->compileObject (obj);
 }
@@ -143,7 +153,8 @@
 // heh
 // -----------------------------------------------------------------------------
 void DelHistory::undo() const
-{	LDObject* obj = parseLine (getCode());
+{
+	LDObject* obj = parseLine (getCode());
 	getParent()->getFile()->insertObj (getIndex(), obj);
 	g_win->R()->compileObject (obj);
 }
@@ -151,14 +162,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void DelHistory::redo() const
-{	LDObject* obj = getParent()->getFile()->getObject (getIndex());
+{
+	LDObject* obj = getParent()->getFile()->getObject (getIndex());
 	obj->deleteSelf();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void EditHistory::undo() const
-{	LDObject* obj = getCurrentDocument()->getObject (getIndex());
+{
+	LDObject* obj = getCurrentDocument()->getObject (getIndex());
 	LDObject* newobj = parseLine (getOldCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
@@ -167,7 +180,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void EditHistory::redo() const
-{	LDObject* obj = getCurrentDocument()->getObject (getIndex());
+{
+	LDObject* obj = getCurrentDocument()->getObject (getIndex());
 	LDObject* newobj = parseLine (getNewCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
@@ -176,9 +190,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void SwapHistory::undo() const
-{	LDObject::fromID (a)->swap (LDObject::fromID (b));
+{
+	LDObject::fromID (a)->swap (LDObject::fromID (b));
 }
 
 void SwapHistory::redo() const
-{	undo(); // :v
+{
+	undo(); // :v
 }
\ No newline at end of file
--- a/src/history.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/history.h	Tue Jan 07 08:53:27 2014 +0200
@@ -33,15 +33,17 @@
 
 // =============================================================================
 class History
-{	PROPERTY (private,	int,				Position,	NUM_OPS,		STOCK_WRITE)
-	PROPERTY (public,		LDDocument*,	File,			NO_OPS,		STOCK_WRITE)
-	PROPERTY (public,		bool,				Ignoring,	BOOL_OPS,	STOCK_WRITE)
+{
+	PROPERTY (private,	int,				Position,	NUM_OPS,		STOCK_WRITE)
+	PROPERTY (public,	LDDocument*,	File,		NO_OPS,		STOCK_WRITE)
+	PROPERTY (public,	bool,			Ignoring,	BOOL_OPS,	STOCK_WRITE)
 
 	public:
 		typedef QList<AbstractHistoryEntry*> Changeset;
 
 		enum Type
-		{	Del,
+		{
+			Del,
 			Edit,
 			Add,
 			Move,
@@ -57,16 +59,19 @@
 		void add (AbstractHistoryEntry* entry);
 
 		inline long getSize() const
-		{	return m_changesets.size();
+		{
+			return m_changesets.size();
 		}
 
 		inline History& operator<< (AbstractHistoryEntry* entry)
-		{	add (entry);
+		{
+			add (entry);
 			return *this;
 		}
 
 		inline const Changeset& getChangeset (long pos) const
-		{	return m_changesets[pos];
+		{
+			return m_changesets[pos];
 		}
 
 	private:
@@ -78,7 +83,8 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 class AbstractHistoryEntry
-{	PROPERTY (public,	History*,	Parent,	NO_OPS,	STOCK_WRITE)
+{
+	PROPERTY (public,	History*,	Parent,	NO_OPS,	STOCK_WRITE)
 
 	public:
 		virtual ~AbstractHistoryEntry() {}
@@ -86,11 +92,13 @@
 		virtual void redo() const {}
 
 		virtual History::Type getType() const
-		{	return (History::Type) 0;
+		{
+			return (History::Type) 0;
 		}
 
 		virtual const char* getTypeName() const
-		{	return "";
+		{
+			return "";
 		}
 };
 
@@ -98,7 +106,8 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 class DelHistory : public AbstractHistoryEntry
-{	PROPERTY (private,	int,	Index,	NO_OPS,	STOCK_WRITE)
+{
+	PROPERTY (private,	int,	Index,	NO_OPS,	STOCK_WRITE)
 	PROPERTY (private,	str,	Code,		NO_OPS,	STOCK_WRITE)
 
 	public:
@@ -110,7 +119,8 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 class EditHistory : public AbstractHistoryEntry
-{	PROPERTY (private,	int, Index,		NO_OPS,	STOCK_WRITE)
+{
+	PROPERTY (private,	int, Index,		NO_OPS,	STOCK_WRITE)
 	PROPERTY (private,	str, OldCode,	NO_OPS,	STOCK_WRITE)
 	PROPERTY (private,	str, NewCode,	NO_OPS,	STOCK_WRITE)
 
@@ -127,7 +137,8 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 class AddHistory : public AbstractHistoryEntry
-{	PROPERTY (private,	int,	Index,	NO_OPS,	STOCK_WRITE)
+{
+	PROPERTY (private,	int,	Index,	NO_OPS,	STOCK_WRITE)
 	PROPERTY (private,	str,	Code,		NO_OPS,	STOCK_WRITE)
 
 	public:
@@ -142,7 +153,8 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 class MoveHistory : public AbstractHistoryEntry
-{	public:
+{
+	public:
 		IMPLEMENT_HISTORY_TYPE (Move)
 
 		QList<int> indices;
@@ -157,7 +169,8 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 class SwapHistory : public AbstractHistoryEntry
-{	public:
+{
+	public:
 		IMPLEMENT_HISTORY_TYPE (Swap)
 
 		SwapHistory (int a, int b) :
--- a/src/ldconfig.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/ldconfig.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -26,7 +26,8 @@
 // Helper function for parseLDConfig
 // -----------------------------------------------------------------------------
 static bool parseLDConfigTag (LDConfigParser& pars, char const* tag, str& val)
-{	int pos;
+{
+	int pos;
 
 	// Try find the token and get its position
 	if (!pars.findToken (pos, tag, 1))
@@ -39,17 +40,20 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void parseLDConfig()
-{	File* f = openLDrawFile ("LDConfig.ldr", false);
+{
+	File* f = openLDrawFile ("LDConfig.ldr", false);
 
 	if (!f)
-	{	critical (fmt (QObject::tr ("Unable to open LDConfig.ldr for parsing: %1"),
+	{
+		critical (fmt (QObject::tr ("Unable to open LDConfig.ldr for parsing: %1"),
 			strerror (errno)));
 		return;
 	}
 
 	// Read in the lines
 	for (str line : *f)
-	{	if (line.length() == 0 || line[0] != '0')
+	{
+		if (line.length() == 0 || line[0] != '0')
 			continue; // empty or illogical
 
 		line.remove ('\r');
@@ -113,26 +117,30 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDConfigParser::LDConfigParser (str inText, char sep)
-{	m_tokens = inText.split (sep, QString::SkipEmptyParts);
+{
+	m_tokens = inText.split (sep, QString::SkipEmptyParts);
 	m_pos = -1;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDConfigParser::isAtBeginning()
-{	return m_pos == -1;
+{
+	return m_pos == -1;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDConfigParser::isAtEnd()
-{	return m_pos == m_tokens.size() - 1;
+{
+	return m_pos == m_tokens.size() - 1;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDConfigParser::getToken (str& val, const int pos)
-{	if (pos >= m_tokens.size())
+{
+	if (pos >= m_tokens.size())
 		return false;
 
 	val = m_tokens[pos];
@@ -142,21 +150,26 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDConfigParser::getNextToken (str& val)
-{	return getToken (val, ++m_pos);
+{
+	return getToken (val, ++m_pos);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDConfigParser::peekNextToken (str& val)
-{	return getToken (val, m_pos + 1);
+{
+	return getToken (val, m_pos + 1);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDConfigParser::findToken (int& result, char const* needle, int args)
-{	for (int i = 0; i < (m_tokens.size() - args); ++i)
-	{	if (m_tokens[i] == needle)
-		{	result = i;
+{
+	for (int i = 0; i < (m_tokens.size() - args); ++i)
+	{
+		if (m_tokens[i] == needle)
+		{
+			result = i;
 			return true;
 		}
 	}
@@ -167,25 +180,29 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDConfigParser::rewind()
-{	m_pos = -1;
+{
+	m_pos = -1;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDConfigParser::seek (int amount, bool rel)
-{	m_pos = (rel ? m_pos : 0) + amount;
+{
+	m_pos = (rel ? m_pos : 0) + amount;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 int LDConfigParser::getSize()
-{	return m_tokens.size();
+{
+	return m_tokens.size();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool LDConfigParser::tokenCompare (int inPos, const char* sOther)
-{	str tok;
+{
+	str tok;
 
 	if (!getToken (tok, inPos))
 		return false;
--- a/src/ldconfig.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/ldconfig.h	Tue Jan 07 08:53:27 2014 +0200
@@ -28,7 +28,8 @@
 // String parsing utility for parsing ldconfig.ldr
 // =============================================================================
 class LDConfigParser
-{	public:
+{
+	public:
 		LDConfigParser (str inText, char sep);
 
 		bool isAtEnd();
@@ -42,8 +43,9 @@
 		void seek (int amount, bool rel);
 		bool tokenCompare (int inPos, const char* sOther);
 
-		str operator[] (const int idx)
-		{	return m_tokens[idx];
+		inline str operator[] (const int idx)
+		{
+			return m_tokens[idx];
 		}
 
 	private:
--- a/src/ldtypes.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/ldtypes.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -1,11 +1,11 @@
 /*
  *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013, 2014 Santeri Piippo
+ *  Copyright( C) 2013, 2014 Santeri Piippo
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
+ * ( at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,9 +25,9 @@
 #include "gldraw.h"
 #include "colors.h"
 
-cfg (String, ld_defaultname, "");
-cfg (String, ld_defaultuser, "");
-cfg (Int, ld_defaultlicense, 0);
+cfg( String, ld_defaultname, "");
+cfg( String, ld_defaultuser, "");
+cfg( Int, ld_defaultlicense, 0);
 
 // List of all LDObjects
 static QList<LDObject*> g_LDObjects;
@@ -36,13 +36,14 @@
 // LDObject constructors
 // -----------------------------------------------------------------------------
 LDObject::LDObject() :
-	m_Hidden (false),
-	m_Selected (false),
-	m_Parent (null),
-	m_File (null),
-	m_GLInit (false),
-	qObjListEntry (null)
-{	memset (m_coords, 0, sizeof m_coords);
+	m_Hidden( false),
+	m_Selected( false),
+	m_Parent( null),
+	m_File( null),
+	m_GLInit( false),
+	qObjListEntry( null)
+{
+	memset( m_coords, 0, sizeof m_coords);
 	chooseID();
 	g_LDObjects << this;
 }
@@ -50,16 +51,18 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDObject::chooseID()
-{	int32 id = 1; // 0 shalt be null
+{
+	int32 id = 1; // 0 shalt be null
 
-	for (LDObject* obj : g_LDObjects)
-	{	assert (obj != this);
+	for( LDObject* obj : g_LDObjects)
+	{
+		assert( obj != this);
 
-		if (obj->getID() >= id)
+		if( obj->getID() >= id)
 			id = obj->getID() + 1;
 	}
 
-	setID (id);
+	setID( id);
 }
 
 // =============================================================================
@@ -68,35 +71,42 @@
 // These exist only to satisfy the linker.
 // -----------------------------------------------------------------------------
 LDObject::Type LDObject::getType() const
-{	return LDObject::Unidentified;
+{
+	return LDObject::Unidentified;
 }
 
 bool LDObject::hasMatrix() const
-{	return false;
+{
+	return false;
 }
 
 bool LDObject::isColored() const
-{	return false;
+{
+	return false;
 }
 
 bool LDObject::isScemantic() const
-{	return false;
+{
+	return false;
 }
 
 str LDObject::getTypeName() const
-{	return "";
+{
+	return "";
 }
 
 int LDObject::vertices() const
-{	return 0;
+{
+	return 0;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDObject::setVertexCoord (int i, Axis ax, double value)
-{	vertex v = getVertex (i);
+void LDObject::setVertexCoord( int i, Axis ax, double value)
+{
+	vertex v = getVertex( i);
 	v[ax] = value;
-	setVertex (i, v);
+	setVertex( i, v);
 }
 
 LDError::LDError() {}
@@ -104,13 +114,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDComment::raw() const
-{	return fmt ("0 %1", text);
+{
+	return fmt( "0 %1", text);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDSubfile::raw() const
-{	str val = fmt ("1 %1 %2 ", getColor(), getPosition());
+{
+	str val = fmt( "1 %1 %2 ", getColor(), getPosition());
 	val += getTransform().stringRep();
 	val += ' ';
 	val += getFileInfo()->getName();
@@ -120,10 +132,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDLine::raw() const
-{	str val = fmt ("2 %1", getColor());
+{
+	str val = fmt( "2 %1", getColor());
 
-	for (int i = 0; i < 2; ++i)
-		val += fmt (" %1", getVertex (i));
+	for( int i = 0; i < 2; ++i)
+		val += fmt( " %1", getVertex( i));
 
 	return val;
 }
@@ -131,10 +144,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDTriangle::raw() const
-{	str val = fmt ("3 %1", getColor());
+{
+	str val = fmt( "3 %1", getColor());
 
-	for (int i = 0; i < 3; ++i)
-		val += fmt (" %1", getVertex (i));
+	for( int i = 0; i < 3; ++i)
+		val += fmt( " %1", getVertex( i));
 
 	return val;
 }
@@ -142,10 +156,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDQuad::raw() const
-{	str val = fmt ("4 %1", getColor());
+{
+	str val = fmt( "4 %1", getColor());
 
-	for (int i = 0; i < 4; ++i)
-		val += fmt (" %1", getVertex (i));
+	for( int i = 0; i < 4; ++i)
+		val += fmt( " %1", getVertex( i));
 
 	return val;
 }
@@ -153,11 +168,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDCondLine::raw() const
-{	str val = fmt ("5 %1", getColor());
+{
+	str val = fmt( "5 %1", getColor());
 
 	// Add the coordinates
-	for (int i = 0; i < 4; ++i)
-		val += fmt (" %1", getVertex (i));
+	for( int i = 0; i < 4; ++i)
+		val += fmt( " %1", getVertex( i));
 
 	return val;
 }
@@ -165,25 +181,29 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDError::raw() const
-{	return contents;
+{
+	return contents;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDVertex::raw() const
-{	return fmt ("0 !LDFORGE VERTEX %1 %2", getColor(), pos);
+{
+	return fmt( "0 !LDFORGE VERTEX %1 %2", getColor(), pos);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDEmpty::raw() const
-{	return "";
+{
+	return "";
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 const char* LDBFC::statements[] =
-{	"CERTIFY CCW",
+{
+	"CERTIFY CCW",
 	"CCW",
 	"CERTIFY CW",
 	"CW",
@@ -196,24 +216,26 @@
 };
 
 str LDBFC::raw() const
-{	return fmt ("0 BFC %1", LDBFC::statements[type]);
+{
+	return fmt( "0 BFC %1", LDBFC::statements[type]);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 QList<LDTriangle*> LDQuad::splitToTriangles()
-{	// Create the two triangles based on this quadrilateral:
+{
+	// Create the two triangles based on this quadrilateral:
 	// 0---3       0---3    3
 	// |   |       |  /    /|
 	// |   |  ==>  | /    / |
 	// |   |       |/    /  |
 	// 1---2       1    1---2
-	LDTriangle* tri1 = new LDTriangle (getVertex (0), getVertex (1), getVertex (3));
-	LDTriangle* tri2 = new LDTriangle (getVertex (1), getVertex (2), getVertex (3));
+	LDTriangle* tri1 = new LDTriangle( getVertex( 0), getVertex( 1), getVertex( 3));
+	LDTriangle* tri2 = new LDTriangle( getVertex( 1), getVertex( 2), getVertex( 3));
 
 	// The triangles also inherit the quad's color
-	tri1->setColor (getColor());
-	tri2->setColor (getColor());
+	tri1->setColor( getColor());
+	tri2->setColor( getColor());
 
 	QList<LDTriangle*> triangles;
 	triangles << tri1;
@@ -223,12 +245,13 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDObject::replace (LDObject* other)
-{	long idx = getIndex();
-	assert (idx != -1);
+void LDObject::replace( LDObject* other)
+{
+	long idx = getIndex();
+	assert( idx != -1);
 
 	// Replace the instance of the old object with the new object
-	getFile()->setObject (idx, other);
+	getFile()->setObject( idx, other);
 
 	// Remove the old object
 	deleteSelf();
@@ -236,25 +259,28 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDObject::swap (LDObject* other)
-{	assert (getFile() == other->getFile());
-	getFile()->swapObjects (this, other);
+void LDObject::swap( LDObject* other)
+{
+	assert( getFile() == other->getFile());
+	getFile()->swapObjects( this, other);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-LDLine::LDLine (vertex v1, vertex v2)
-{	setVertex (0, v1);
-	setVertex (1, v2);
+LDLine::LDLine( vertex v1, vertex v2)
+{
+	setVertex( 0, v1);
+	setVertex( 1, v2);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-LDQuad::LDQuad (const vertex& v0, const vertex& v1, const vertex& v2, const vertex& v3)
-{	setVertex (0, v0);
-	setVertex (1, v1);
-	setVertex (2, v2);
-	setVertex (3, v3);
+LDQuad::LDQuad( const vertex& v0, const vertex& v1, const vertex& v2, const vertex& v3)
+{
+	setVertex( 0, v0);
+	setVertex( 1, v1);
+	setVertex( 2, v2);
+	setVertex( 3, v3);
 }
 
 // =============================================================================
@@ -268,48 +294,53 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDObject::deleteSelf()
-{	// If this object was selected, unselect it now
-	if (isSelected())
+{
+	// If this object was selected, unselect it now
+	if( isSelected())
 		unselect();
 
 	// If this object was associated to a file, remove it off it now
-	if (getFile())
-		getFile()->forgetObject (this);
+	if( getFile())
+		getFile()->forgetObject( this);
 
 	// Delete the GL lists
-	GL::deleteLists (this);
+	GL::deleteLists( this);
 
 	// Remove this object from the list of LDObjects
-	g_LDObjects.removeOne (this);
+	g_LDObjects.removeOne( this);
 
 	delete this;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-static void transformObject (LDObject* obj, matrix transform, vertex pos, int parentcolor)
-{	switch (obj->getType())
-	{	case LDObject::Line:
+static void transformObject( LDObject* obj, matrix transform, vertex pos, int parentcolor)
+{
+	switch( obj->getType())
+	{
+		case LDObject::Line:
 		case LDObject::CondLine:
 		case LDObject::Triangle:
 		case LDObject::Quad:
 
-			for (int i = 0; i < obj->vertices(); ++i)
-			{	vertex v = obj->getVertex (i);
-				v.transform (transform, pos);
-				obj->setVertex (i, v);
+			for( int i = 0; i < obj->vertices(); ++i)
+			{
+				vertex v = obj->getVertex( i);
+				v.transform( transform, pos);
+				obj->setVertex( i, v);
 			}
 
 			break;
 
 		case LDObject::Subfile:
-		{	LDSubfile* ref = static_cast<LDSubfile*> (obj);
+		{
+			LDSubfile* ref = static_cast<LDSubfile*>( obj);
 			matrix newMatrix = transform * ref->getTransform();
 			vertex newpos = ref->getPosition();
 
-			newpos.transform (transform, pos);
-			ref->setPosition (newpos);
-			ref->setTransform (newMatrix);
+			newpos.transform( transform, pos);
+			ref->setPosition( newpos);
+			ref->setTransform( newMatrix);
 		}
 		break;
 
@@ -317,20 +348,22 @@
 			break;
 	}
 
-	if (obj->getColor() == maincolor)
-		obj->setColor (parentcolor);
+	if( obj->getColor() == maincolor)
+		obj->setColor( parentcolor);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-QList<LDObject*> LDSubfile::inlineContents (InlineFlags flags)
-{	QList<LDObject*> objs = getFileInfo()->inlineContents (flags);
+QList<LDObject*> LDSubfile::inlineContents( InlineFlags flags)
+{
+	QList<LDObject*> objs = getFileInfo()->inlineContents( flags);
 
 	// Transform the objects
-	for (LDObject* obj : objs)
-	{	// Set the parent now so we know what inlined the object.
-		obj->setParent (this);
-		transformObject (obj, getTransform(), getPosition(), getColor());
+	for( LDObject* obj : objs)
+	{
+		// Set the parent now so we know what inlined the object.
+		obj->setParent( this);
+		transformObject( obj, getTransform(), getPosition(), getColor());
 	}
 
 	return objs;
@@ -339,10 +372,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 long LDObject::getIndex() const
-{	assert (getFile() != null);
+{
+	assert( getFile() != null);
 
-	for (int i = 0; i < getFile()->getObjectCount(); ++i)
-		if (getFile()->getObject (i) == this)
+	for( int i = 0; i < getFile()->getObjectCount(); ++i)
+		if( getFile()->getObject( i) == this)
 			return i;
 
 	return -1;
@@ -350,49 +384,53 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDObject::moveObjects (QList<LDObject*> objs, const bool up)
-{	if (objs.isEmpty())
+void LDObject::moveObjects( QList<LDObject*> objs, const bool up)
+{
+	if( objs.isEmpty())
 		return;
 
 	// If we move down, we need to iterate the array in reverse order.
-	const long start = up ? 0 : (objs.size() - 1);
+	const long start = up ? 0 :( objs.size() - 1);
 	const long end = up ? objs.size() : -1;
 	const long incr = up ? 1 : -1;
 	QList<LDObject*> objsToCompile;
 	LDDocument* file = objs[0]->getFile();
 
-	for (long i = start; i != end; i += incr)
-	{	LDObject* obj = objs[i];
+	for( long i = start; i != end; i += incr)
+	{
+		LDObject* obj = objs[i];
 
 		const long idx = obj->getIndex(),
-				   target = idx + (up ? -1 : 1);
+				   target = idx +( up ? -1 : 1);
 
-		if ( (up && idx == 0) || (!up && idx == (long) (file->getObjects().size() - 1)))
-		{	// One of the objects hit the extrema. If this happens, this should be the first
+		if( ( up && idx == 0) ||( !up && idx ==( long)( file->getObjects().size() - 1)))
+		{
+			// 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
 			// abort the entire operation.
-			assert (i == start);
+			assert( i == start);
 			return;
 		}
 
 		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->R()->compileObject (obj);
+	for( LDObject* obj : objsToCompile)
+		g_win->R()->compileObject( obj);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-str LDObject::typeName (LDObject::Type type)
-{	LDObject* obj = LDObject::getDefault (type);
+str LDObject::typeName( LDObject::Type type)
+{
+	LDObject* obj = LDObject::getDefault( type);
 	str name = obj->getTypeName();
 	obj->deleteSelf();
 	return name;
@@ -400,34 +438,36 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-str LDObject::describeObjects (const QList<LDObject*>& objs)
-{	bool firstDetails = true;
+str LDObject::describeObjects( const QList<LDObject*>& objs)
+{
+	bool firstDetails = true;
 	str text = "";
 
-	if (objs.isEmpty())
+	if( objs.isEmpty())
 		return "nothing"; // :)
 
-	for (long i = 0; i < LDObject::NumTypes; ++i)
-	{	LDObject::Type objType = (LDObject::Type) i;
+	for( long i = 0; i < LDObject::NumTypes; ++i)
+	{
+		LDObject::Type objType =( LDObject::Type) i;
 		int count = 0;
 
-		for (LDObject * obj : objs)
-			if (obj->getType() == objType)
+		for( LDObject * obj : objs)
+			if( obj->getType() == objType)
 				count++;
 
-		if (count == 0)
+		if( count == 0)
 			continue;
 
-		if (!firstDetails)
+		if( !firstDetails)
 			text += ", ";
 
-		str noun = fmt ("%1%2", typeName (objType), plural (count));
+		str noun = fmt( "%1%2", typeName( objType), plural( count));
 
 		// Plural of "vertex" is "vertices", correct that
-		if (objType == LDObject::Vertex && count != 1)
+		if( objType == LDObject::Vertex && count != 1)
 			noun = "vertices";
 
-		text += fmt ("%1 %2", count, noun);
+		text += fmt( "%1 %2", count, noun);
 		firstDetails = false;
 	}
 
@@ -437,12 +477,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDObject* LDObject::topLevelParent()
-{	if (!getParent())
+{
+	if( !getParent())
 		return this;
 
 	LDObject* it = this;
 
-	while (it->getParent())
+	while( it->getParent())
 		it = it->getParent();
 
 	return it;
@@ -451,63 +492,70 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDObject* LDObject::next() const
-{	long idx = getIndex();
-	assert (idx != -1);
+{
+	long idx = getIndex();
+	assert( idx != -1);
 
-	if (idx == (long) getFile()->getObjectCount() - 1)
+	if( idx ==( long) getFile()->getObjectCount() - 1)
 		return null;
 
-	return getFile()->getObject (idx + 1);
+	return getFile()->getObject( idx + 1);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDObject* LDObject::prev() const
-{	long idx = getIndex();
-	assert (idx != -1);
+{
+	long idx = getIndex();
+	assert( idx != -1);
 
-	if (idx == 0)
+	if( idx == 0)
 		return null;
 
-	return getFile()->getObject (idx - 1);
+	return getFile()->getObject( idx - 1);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDObject::move (vertex vect)
-{	if (hasMatrix())
-	{	LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (this);
-		mo->setPosition (mo->getPosition() + vect);
+void LDObject::move( vertex vect)
+{
+	if( hasMatrix())
+	{
+		LDMatrixObject* mo = dynamic_cast<LDMatrixObject*>( this);
+		mo->setPosition( mo->getPosition() + vect);
 	}
-	elif (getType() == LDObject::Vertex)
-	{	// ugh
-		static_cast<LDVertex*> (this)->pos += vect;
+	elif( getType() == LDObject::Vertex)
+	{
+		// ugh
+		static_cast<LDVertex*>( this)->pos += vect;
 	}
 	else
-	{	for (int i = 0; i < vertices(); ++i)
-			setVertex (i, getVertex (i) + vect);
+	{
+		for( int i = 0; i < vertices(); ++i)
+			setVertex( i, getVertex( i) + vect);
 	}
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 #define CHECK_FOR_OBJ(N) \
-	if (type == LDObject::N) \
+	if( type == LDObject::N) \
 		return new LD##N;
 
-LDObject* LDObject::getDefault (const LDObject::Type type)
-{	CHECK_FOR_OBJ (Comment)
-	CHECK_FOR_OBJ (BFC)
-	CHECK_FOR_OBJ (Line)
-	CHECK_FOR_OBJ (CondLine)
-	CHECK_FOR_OBJ (Subfile)
-	CHECK_FOR_OBJ (Triangle)
-	CHECK_FOR_OBJ (Quad)
-	CHECK_FOR_OBJ (Empty)
-	CHECK_FOR_OBJ (BFC)
-	CHECK_FOR_OBJ (Error)
-	CHECK_FOR_OBJ (Vertex)
-	CHECK_FOR_OBJ (Overlay)
+LDObject* LDObject::getDefault( const LDObject::Type type)
+{
+	CHECK_FOR_OBJ( Comment)
+	CHECK_FOR_OBJ( BFC)
+	CHECK_FOR_OBJ( Line)
+	CHECK_FOR_OBJ( CondLine)
+	CHECK_FOR_OBJ( Subfile)
+	CHECK_FOR_OBJ( Triangle)
+	CHECK_FOR_OBJ( Quad)
+	CHECK_FOR_OBJ( Empty)
+	CHECK_FOR_OBJ( BFC)
+	CHECK_FOR_OBJ( Error)
+	CHECK_FOR_OBJ( Vertex)
+	CHECK_FOR_OBJ( Overlay)
 	return null;
 }
 
@@ -522,11 +570,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDTriangle::invert()
-{	// Triangle goes 0 -> 1 -> 2, reversed: 0 -> 2 -> 1.
+{
+	// Triangle goes 0 -> 1 -> 2, reversed: 0 -> 2 -> 1.
 	// Thus, we swap 1 and 2.
-	vertex tmp = getVertex (1);
-	setVertex (1, getVertex (2));
-	setVertex (2, tmp);
+	vertex tmp = getVertex( 1);
+	setVertex( 1, getVertex( 2));
+	setVertex( 2, tmp);
 
 	return;
 }
@@ -534,18 +583,20 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDQuad::invert()
-{	// Quad: 0 -> 1 -> 2 -> 3
+{
+	// Quad: 0 -> 1 -> 2 -> 3
 	// rev:  0 -> 3 -> 2 -> 1
 	// Thus, we swap 1 and 3.
-	vertex tmp = getVertex (1);
-	setVertex (1, getVertex (3));
-	setVertex (3, tmp);
+	vertex tmp = getVertex( 1);
+	setVertex( 1, getVertex( 3));
+	setVertex( 3, tmp);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDSubfile::invert()
-{	// Subfiles are inverted when they're prefixed with
+{
+	// Subfiles are inverted when they're prefixed with
 	// a BFC INVERTNEXT statement. Thus we need to toggle this status.
 	// For flat primitives it's sufficient that the determinant is
 	// flipped but I don't have a method for checking flatness yet.
@@ -553,37 +604,42 @@
 
 	int idx = getIndex();
 
-	if (idx > 0)
-	{	LDBFC* bfc = dynamic_cast<LDBFC*> (prev());
+	if( idx > 0)
+	{
+		LDBFC* bfc = dynamic_cast<LDBFC*>( prev());
 
-		if (bfc && bfc->type == LDBFC::InvertNext)
-		{	// This is prefixed with an invertnext, thus remove it.
+		if( bfc && bfc->type == LDBFC::InvertNext)
+		{
+			// This is prefixed with an invertnext, thus remove it.
 			bfc->deleteSelf();
 			return;
 		}
 	}
 
 	// Not inverted, thus prefix it with a new invertnext.
-	LDBFC* bfc = new LDBFC (LDBFC::InvertNext);
-	getFile()->insertObj (idx, bfc);
+	LDBFC* bfc = new LDBFC( LDBFC::InvertNext);
+	getFile()->insertObj( idx, bfc);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-static void invertLine (LDObject* line)
-{	// For lines, we swap the vertices. I don't think that a
+static void invertLine( LDObject* line)
+{
+	// For lines, we swap the vertices. I don't think that a
 	// cond-line's control points need to be swapped, do they?
-	vertex tmp = line->getVertex (0);
-	line->setVertex (0, line->getVertex (1));
-	line->setVertex (1, tmp);
+	vertex tmp = line->getVertex( 0);
+	line->setVertex( 0, line->getVertex( 1));
+	line->setVertex( 1, tmp);
 }
 
 void LDLine::invert()
-{	invertLine (this);
+{
+	invertLine( this);
 }
 
 void LDCondLine::invert()
-{	invertLine (this);
+{
+	invertLine( this);
 }
 
 void LDVertex::invert() {}
@@ -591,22 +647,24 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDLine* LDCondLine::demote()
-{	LDLine* repl = new LDLine;
+{
+	LDLine* repl = new LDLine;
 
-	for (int i = 0; i < repl->vertices(); ++i)
-		repl->setVertex (i, getVertex (i));
+	for( int i = 0; i < repl->vertices(); ++i)
+		repl->setVertex( i, getVertex( i));
 
-	repl->setColor (getColor());
+	repl->setColor( getColor());
 
-	replace (repl);
+	replace( repl);
 	return repl;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-LDObject* LDObject::fromID (int id)
-{	for (LDObject* obj : g_LDObjects)
-		if (obj->getID() == id)
+LDObject* LDObject::fromID( int id)
+{
+	for( LDObject* obj : g_LDObjects)
+		if( obj->getID() == id)
 			return obj;
 
 	return null;
@@ -615,7 +673,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str LDOverlay::raw() const
-{	return fmt ("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6",
+{
+	return fmt( "0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6",
 		getFileName(), getCamera(), getX(), getY(), getWidth(), getHeight());
 }
 
@@ -626,19 +685,21 @@
 // It takes care of history management so we can capture low-level changes, this
 // makes history stuff work out of the box.
 // -----------------------------------------------------------------------------
-template<class T> static void changeProperty (LDObject* obj, T* ptr, const T& val)
-{	long idx;
+template<class T> static void changeProperty( LDObject* obj, T* ptr, const T& val)
+{
+	long idx;
 
-	if (*ptr == val)
+	if( *ptr == val)
 		return;
 
-	if (obj->getFile() && (idx = obj->getIndex()) != -1)
-	{	str before = obj->raw();
+	if( obj->getFile() &&( idx = obj->getIndex()) != -1)
+	{
+		str before = obj->raw();
 		*ptr = val;
 		str after = obj->raw();
 
-		if (before != after)
-			obj->getFile()->addToHistory (new EditHistory (idx, before, after));
+		if( before != after)
+			obj->getFile()->addToHistory( new EditHistory( idx, before, after));
 	}
 	else
 		*ptr = val;
@@ -646,43 +707,50 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDObject::setColor (const int& val)
-{	changeProperty (this, &m_Color, val);
+void LDObject::setColor( const int& val)
+{
+	changeProperty( this, &m_Color, val);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-const vertex& LDObject::getVertex (int i) const
-{	return m_coords[i]->data();
+const vertex& LDObject::getVertex( int i) const
+{
+	return m_coords[i]->data();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDObject::setVertex (int i, const vertex& vert)
-{	changeProperty (this, &m_coords[i], LDSharedVertex::getSharedVertex (vert));
+void LDObject::setVertex( int i, const vertex& vert)
+{
+	changeProperty( this, &m_coords[i], LDSharedVertex::getSharedVertex( vert));
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDMatrixObject::setPosition (const vertex& a)
-{	changeProperty (getLinkPointer(), &m_Position, LDSharedVertex::getSharedVertex (a));
+void LDMatrixObject::setPosition( const vertex& a)
+{
+	changeProperty( getLinkPointer(), &m_Position, LDSharedVertex::getSharedVertex( a));
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDMatrixObject::setTransform (const matrix& val)
-{	changeProperty (getLinkPointer(), &m_Transform, val);
+void LDMatrixObject::setTransform( const matrix& val)
+{
+	changeProperty( getLinkPointer(), &m_Transform, val);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 static QMap<vertex, LDSharedVertex*> g_sharedVerts;
 
-LDSharedVertex* LDSharedVertex::getSharedVertex (const vertex& a)
-{	auto it = g_sharedVerts.find (a);
+LDSharedVertex* LDSharedVertex::getSharedVertex( const vertex& a)
+{
+	auto it = g_sharedVerts.find( a);
 
-	if (it == g_sharedVerts.end())
-	{	LDSharedVertex* v = new LDSharedVertex (a);
+	if( it == g_sharedVerts.end())
+	{
+		LDSharedVertex* v = new LDSharedVertex( a);
 		g_sharedVerts[a] = v;
 		return v;
 	}
@@ -692,17 +760,20 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDSharedVertex::addRef (LDObject* a)
-{	m_refs << a;
+void LDSharedVertex::addRef( LDObject* a)
+{
+	m_refs << a;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void LDSharedVertex::delRef (LDObject* a)
-{	m_refs.removeOne (a);
+void LDSharedVertex::delRef( LDObject* a)
+{
+	m_refs.removeOne( a);
 
-	if (m_refs.empty())
-	{	g_sharedVerts.remove (m_data);
+	if( m_refs.empty())
+	{
+		g_sharedVerts.remove( m_data);
 		delete this;
 	}
 }
@@ -710,30 +781,36 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDObject::select()
-{	if (!getFile())
-	{	log ("Warning: Object #%1 cannot be selected as it is not assigned a file!\n", getID());
+{
+	if( !getFile())
+	{
+		log( "Warning: Object #%1 cannot be selected as it is not assigned a file!\n", getID());
 		return;
 	}
 
-	getFile()->addToSelection (this);
+	getFile()->addToSelection( this);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDObject::unselect()
-{	if (!getFile())
-	{	log ("Warning: Object #%1 cannot be unselected as it is not assigned a file!\n", getID());
+{
+	if( !getFile())
+	{
+		log( "Warning: Object #%1 cannot be unselected as it is not assigned a file!\n", getID());
 		return;
 	}
 
-	getFile()->removeFromSelection (this);
+	getFile()->removeFromSelection( this);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-str getLicenseText (int id)
-{	switch (id)
-	{	case 0:
+str getLicenseText( int id)
+{
+	switch( id)
+	{
+		case 0:
 			return CALicense;
 
 		case 1:
@@ -743,46 +820,51 @@
 			return "";
 	}
 
-	assert (false);
+	assert( false);
 	return "";
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDObject* LDObject::createCopy() const
-{	/*
+{
+	/*
 	LDObject* copy = clone();
-	copy->setFile (null);
-	copy->setGLInit (false);
+	copy->setFile( null);
+	copy->setGLInit( false);
 	copy->chooseID();
-	copy->setSelected (false);
+	copy->setSelected( false);
 	*/
 
 	/*
-	LDObject* copy = getDefault (getType());
-	copy->setColor (getColor());
+	LDObject* copy = getDefault( getType());
+	copy->setColor( getColor());
 
-	if (hasMatrix())
-	{	LDMatrixObject* copyMo = static_cast<LDMatrixObject*> (copy);
-		const LDMatrixObject* mo = static_cast<const LDMatrixObject*> (this);
-		copyMo->setPosition (mo->getPosition());
-		copyMo->setTransform (mo->getTransform());
+	if( hasMatrix())
+	{
+		LDMatrixObject* copyMo = static_cast<LDMatrixObject*>( copy);
+		const LDMatrixObject* mo = static_cast<const LDMatrixObject*>( this);
+		copyMo->setPosition( mo->getPosition());
+		copyMo->setTransform( mo->getTransform());
 	}
 	else
-	{	for (int i = 0; i < vertices(); ++i)
-			copy->setVertex (getVertex (i));
+	{
+		for( int i = 0; i < vertices(); ++i)
+			copy->setVertex( getVertex( i));
 	}
 
-	switch (getType())
-	{	case Subfile:
-		{	LDSubfile* copyRef = static_cast<LDSubfile*> (copy);
-			const LDSubfile* ref = static_cast<const LDSubfile*> (this);
+	switch( getType())
+	{
+		case Subfile:
+		{
+			LDSubfile* copyRef = static_cast<LDSubfile*>( copy);
+			const LDSubfile* ref = static_cast<const LDSubfile*>( this);
 
-			copyRef->setFileInfo (ref->getFileInfo());
+			copyRef->setFileInfo( ref->getFileInfo());
 		}
 	}
 	*/
 
-	LDObject* copy = parseLine (raw());
+	LDObject* copy = parseLine( raw());
 	return copy;
 }
\ No newline at end of file
--- a/src/ldtypes.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/ldtypes.h	Tue Jan 07 08:53:27 2014 +0200
@@ -23,16 +23,19 @@
 #include "types.h"
 #include "misc/documentPointer.h"
 
-#define LDOBJ(T) \
-protected: \
-	virtual LD##T* clone() override { \
-		return new LD##T (*this); \
-	} \
-public: \
-	virtual LDObject::Type getType() const override { \
-		return LDObject::T; \
-	} \
-	virtual str raw() const override; \
+#define LDOBJ(T)										\
+protected:												\
+	virtual LD##T* clone() override						\
+	{													\
+		return new LD##T (*this);						\
+	}													\
+														\
+public:													\
+	virtual LDObject::Type getType() const override		\
+	{													\
+		return LDObject::T;								\
+	}													\
+	virtual str raw() const override;					\
 	virtual void invert() override;
 
 #define LDOBJ_NAME(N)          virtual str getTypeName() const override { return #N; }
@@ -63,18 +66,20 @@
 // sub-classes based on this enumerator.
 // =============================================================================
 class LDObject
-{	PROPERTY (public,		bool,				Hidden,		BOOL_OPS,	STOCK_WRITE)
-	PROPERTY (public,		bool,				Selected,	BOOL_OPS,	STOCK_WRITE)
+{
+	PROPERTY (public,		bool,			Hidden,		BOOL_OPS,	STOCK_WRITE)
+	PROPERTY (public,		bool,			Selected,	BOOL_OPS,	STOCK_WRITE)
 	PROPERTY (public,		LDObject*,		Parent,		NO_OPS,		STOCK_WRITE)
-	PROPERTY (public,		LDDocument*,	File,			NO_OPS,		STOCK_WRITE) // TODO: rename~
-	PROPERTY	(private,	int32,			ID,			NUM_OPS,		STOCK_WRITE)
-	PROPERTY (public,		int,				Color,		NUM_OPS,		CUSTOM_WRITE)
-	PROPERTY (public,		bool,				GLInit,		BOOL_OPS,	STOCK_WRITE)
+	PROPERTY (public,		LDDocument*,	File,		NO_OPS,		STOCK_WRITE) // TODO: rename~
+	PROPERTY (private,		int,				ID,			NUM_OPS,	STOCK_WRITE)
+	PROPERTY (public,		int,				Color,		NUM_OPS,	CUSTOM_WRITE)
+	PROPERTY (public,		bool,			GLInit,		BOOL_OPS,	STOCK_WRITE)
 
 	public:
 		// Object type codes. Codes are sorted in order of significance.
 		enum Type
-		{	Subfile,        // Object represents a sub-file reference
+		{
+			Subfile,        // Object represents a sub-file reference
 			Quad,           // Object represents a quadrilateral
 			Triangle,       // Object represents a triangle
 			Line,           // Object represents a line
@@ -199,13 +204,16 @@
 // For use as coordinates of LDObjects. Keeps count of references.
 // -----------------------------------------------------------------------------
 class LDSharedVertex
-{	public:
+{
+	public:
 		inline const vertex& data() const
-		{	return m_data;
+		{
+			return m_data;
 		}
 
 		inline operator const vertex&() const
-		{	return m_data;
+		{
+			return m_data;
 		}
 
 		void addRef (LDObject* a);
@@ -237,7 +245,8 @@
 // this class distinct in case I get new extension ideas. :)
 // =============================================================================
 class LDMatrixObject
-{	PROPERTY (public,	LDObject*,			LinkPointer,	NO_OPS,	STOCK_WRITE)
+{
+	PROPERTY (public,	LDObject*,			LinkPointer,	NO_OPS,	STOCK_WRITE)
 	PROPERTY (public,	matrix,				Transform,		NO_OPS,	CUSTOM_WRITE)
 
 	public:
@@ -249,11 +258,13 @@
 			m_Position (LDSharedVertex::getSharedVertex (pos)) {}
 
 		inline const vertex& getPosition() const
-		{	return m_Position->data();
+		{
+			return m_Position->data();
 		}
 
 		void setCoordinate (const Axis ax, double value)
-		{	vertex v = getPosition();
+		{
+			vertex v = getPosition();
 			v[ax] = value;
 			setPosition (v);
 		}
@@ -273,7 +284,8 @@
 // zContent contains the contents of the unparsable line.
 // =============================================================================
 class LDError : public LDObject
-{	LDOBJ (Error)
+{
+	LDOBJ (Error)
 	LDOBJ_NAME (error)
 	LDOBJ_VERTICES (0)
 	LDOBJ_UNCOLORED
@@ -298,7 +310,8 @@
 // Represents an empty line in the LDraw code file.
 // =============================================================================
 class LDEmpty : public LDObject
-{	LDOBJ (Empty)
+{
+	LDOBJ (Empty)
 	LDOBJ_NAME (empty)
 	LDOBJ_VERTICES (0)
 	LDOBJ_UNCOLORED
@@ -313,7 +326,8 @@
 // the text of the comment.
 // =============================================================================
 class LDComment : public LDObject
-{	LDOBJ (Comment)
+{
+	LDOBJ (Comment)
 	LDOBJ_NAME (comment)
 	LDOBJ_VERTICES (0)
 	LDOBJ_UNCOLORED
@@ -334,9 +348,11 @@
 // of this statement.
 // =============================================================================
 class LDBFC : public LDObject
-{	public:
+{
+	public:
 		enum Type
-		{	CertifyCCW,
+		{
+			CertifyCCW,
 			CCW,
 			CertifyCW,
 			CW,
@@ -372,7 +388,8 @@
 // Represents a single code-1 subfile reference.
 // =============================================================================
 class LDSubfile : public LDObject, public LDMatrixObject
-{	LDOBJ (Subfile)
+{
+	LDOBJ (Subfile)
 	LDOBJ_NAME (subfile)
 	LDOBJ_VERTICES (0)
 	LDOBJ_COLORED
@@ -382,7 +399,8 @@
 
 	public:
 		enum InlineFlag
-		{	DeepInline     = (1 << 0),
+		{
+			DeepInline     = (1 << 0),
 			CacheInline    = (1 << 1),
 			RendererInline = (1 << 2),
 
@@ -392,7 +410,8 @@
 		Q_DECLARE_FLAGS (InlineFlags, InlineFlag)
 
 		LDSubfile()
-		{	setLinkPointer (this);
+		{
+			setLinkPointer (this);
 		}
 
 		// Inlines this subfile. Note that return type is an array of heap-allocated
@@ -413,7 +432,8 @@
 // set.
 // =============================================================================
 class LDLine : public LDObject
-{	LDOBJ (Line)
+{
+	LDOBJ (Line)
 	LDOBJ_NAME (line)
 	LDOBJ_VERTICES (2)
 	LDOBJ_COLORED
@@ -432,7 +452,8 @@
 // inherited from LDLine, c0 and c1 are the control points of this line.
 // =============================================================================
 class LDCondLine : public LDLine
-{	LDOBJ (CondLine)
+{
+	LDOBJ (CondLine)
 	LDOBJ_NAME (condline)
 	LDOBJ_VERTICES (4)
 	LDOBJ_COLORED
@@ -452,7 +473,8 @@
 // triangle is colored with.
 // =============================================================================
 class LDTriangle : public LDObject
-{	LDOBJ (Triangle)
+{
+	LDOBJ (Triangle)
 	LDOBJ_NAME (triangle)
 	LDOBJ_VERTICES (3)
 	LDOBJ_COLORED
@@ -462,7 +484,8 @@
 	public:
 		LDTriangle() {}
 		LDTriangle (vertex v0, vertex v1, vertex v2)
-		{	setVertex (0, v0);
+		{
+			setVertex (0, v0);
 			setVertex (1, v1);
 			setVertex (2, v2);
 		}
@@ -475,7 +498,8 @@
 // of the quad, dColor is the color used for the quad.
 // =============================================================================
 class LDQuad : public LDObject
-{	LDOBJ (Quad)
+{
+	LDOBJ (Quad)
 	LDOBJ_NAME (quad)
 	LDOBJ_VERTICES (4)
 	LDOBJ_COLORED
@@ -499,7 +523,8 @@
 // finished parts.
 // =============================================================================
 class LDVertex : public LDObject
-{	LDOBJ (Vertex)
+{
+	LDOBJ (Vertex)
 	LDOBJ_NAME (vertex)
 	LDOBJ_VERTICES (0) // TODO: move pos to vaCoords[0]
 	LDOBJ_COLORED
@@ -519,7 +544,8 @@
 // information.
 // =============================================================================
 class LDOverlay : public LDObject
-{	LDOBJ (Overlay)
+{
+	LDOBJ (Overlay)
 	LDOBJ_NAME (overlay)
 	LDOBJ_VERTICES (0)
 	LDOBJ_UNCOLORED
--- a/src/main.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/main.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -48,7 +48,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int main (int argc, char* argv[])
-{	QApplication app (argc, argv);
+{
+	QApplication app (argc, argv);
 	app.setOrganizationName (APPNAME);
 	app.setApplicationName (APPNAME);
 	g_app = &app;
@@ -58,7 +59,8 @@
 
 	// Load or create the configuration
 	if (!Config::load())
-	{	log ("Creating configuration file...\n");
+	{
+		log ("Creating configuration file...\n");
 
 		if (Config::save())
 			log ("Configuration file successfully created.\n");
@@ -75,7 +77,8 @@
 	// If this is the first start, get the user to configuration. Especially point
 	// them to the profile tab, it's the most important form to fill in.
 	if (firststart)
-	{	(new ConfigDialog (ConfigDialog::ProfileTab))->exec();
+	{
+		(new ConfigDialog (ConfigDialog::ProfileTab))->exec();
 		firststart = false;
 		Config::save();
 	}
@@ -87,7 +90,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void doPrint (File& f, initlist<StringFormatArg> args)
-{	str msg = DoFormat (args);
+{
+	str msg = DoFormat (args);
 	f.write (msg.toUtf8());
 	f.flush();
 }
@@ -95,7 +99,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void doPrint (FILE* fp, initlist<StringFormatArg> args)
-{	str msg = DoFormat (args);
+{
+	str msg = DoFormat (args);
 	fwrite (msg.toStdString().c_str(), 1, msg.length(), fp);
 	fflush (fp);
 }
@@ -103,7 +108,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 QString versionString()
-{	if (g_versionString.length() == 0)
+{
+	if (g_versionString.length() == 0)
 	{
 #if VERSION_PATCH == 0
 		g_versionString = fmt ("%1.%2", VERSION_MAJOR, VERSION_MINOR);
--- a/src/main.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/main.h	Tue Jan 07 08:53:27 2014 +0200
@@ -124,15 +124,8 @@
 
 #define properties private
 #define typedefs public
-#define methods
 #define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z}))
 
-#ifndef IN_IDE_PARSER
-#define NORETURN [noreturn]
-#else
-#define NORETURN
-#endif
-
 // -----------------------------------------------------------------------------
 #ifdef IN_IDE_PARSER // KDevelop workarounds:
 # error IN_IDE_PARSER is defined (this code is only for KDevelop workarounds)
--- a/src/messagelog.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/messagelog.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -31,7 +31,8 @@
 // -----------------------------------------------------------------------------
 MessageManager::MessageManager (QObject* parent) :
 			QObject (parent)
-{	m_ticker = new QTimer;
+{
+	m_ticker = new QTimer;
 	m_ticker->start (100);
 	connect (m_ticker, SIGNAL (timeout()), this, SLOT (tick()));
 }
@@ -49,18 +50,21 @@
 // whether the line has somehow changed since the last update.
 // -----------------------------------------------------------------------------
 bool MessageManager::Line::update (bool& changed)
-{	changed = false;
+{
+	changed = false;
 	QDateTime now = QDateTime::currentDateTime();
 	int msec = now.msecsTo (expiry);
 
 	if (now >= expiry)
-	{	// Message line has expired
+	{
+		// Message line has expired
 		changed = true;
 		return false;
 	}
 
 	if (msec <= g_fadeTime)
-	{	// Message line has not expired but is fading out
+	{
+		// Message line has not expired but is fading out
 		alpha = ( (float) msec) / g_fadeTime;
 		changed = true;
 	}
@@ -72,7 +76,8 @@
 // Add a line to the message manager.
 // -----------------------------------------------------------------------------
 void MessageManager::addLine (str line)
-{	// If there's too many entries, pop the excess out
+{
+	// If there's too many entries, pop the excess out
 	while (m_lines.size() >= g_maxMessages)
 		m_lines.removeFirst();
 
@@ -88,13 +93,15 @@
 // redrawn if something changed.
 // -----------------------------------------------------------------------------
 void MessageManager::tick()
-{	if (m_lines.isEmpty())
+{
+	if (m_lines.isEmpty())
 		return;
 
 	bool changed = false;
 
 	for (int i = 0; i < m_lines.size(); ++i)
-	{	bool lineChanged;
+	{
+		bool lineChanged;
 
 		if (!m_lines[i].update (lineChanged))
 			m_lines.removeAt (i--);
@@ -109,7 +116,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 const QList<MessageManager::Line>& MessageManager::getLines() const
-{	return m_lines;
+{
+	return m_lines;
 }
 
 // =============================================================================
@@ -117,10 +125,12 @@
 // the main message manager.
 // -----------------------------------------------------------------------------
 void DoLog (std::initializer_list<StringFormatArg> args)
-{	const str msg = DoFormat (args);
+{
+	const str msg = DoFormat (args);
 
 	for (str& a : msg.split ("\n", QString::SkipEmptyParts))
-	{	if (g_win)
+	{
+		if (g_win)
 			g_win->addMessage (a);
 
 		// Also print it to stdout
--- a/src/messagelog.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/messagelog.h	Tue Jan 07 08:53:27 2014 +0200
@@ -38,13 +38,15 @@
  * repainting.
  */
 class MessageManager : public QObject
-{	Q_OBJECT
+{
+	Q_OBJECT
 	PROPERTY (public,	GLRenderer*,	Renderer,	NO_OPS,	STOCK_WRITE)
 
 	public:
 		// Single line of the message log.
 		class Line
-		{	public:
+		{
+			public:
 				Line (str text);
 				bool update (bool& changed);
 
--- a/src/misc.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/misc.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -32,7 +32,8 @@
 
 // Prime number table.
 const int g_primes[NUM_PRIMES] =
-{	2,    3,    5,    7,   11,   13,   17,   19,   23,   29,
+{
+	2,    3,    5,    7,   11,   13,   17,   19,   23,   29,
 	31,   37,   41,   43,   47,   53,   59,   61,   67,   71,
 	73,   79,   83,   89,   97,  101,  103,  107,  109,  113,
 	127,  131,  137,  139,  149,  151,  157,  163,  167,  173,
@@ -85,7 +86,8 @@
 };
 
 static const int32 g_e10[] =
-{	1,
+{
+	1,
 	10,
 	100,
 	1000,
@@ -119,7 +121,8 @@
 cfg (Float,	edit_rotpoint_z, 		0.0f);
 
 const gridinfo g_GridInfo[3] =
-{	{ "Coarse", { &grid_coarse_x, &grid_coarse_y, &grid_coarse_z, &grid_coarse_angle }},
+{
+	{ "Coarse", { &grid_coarse_x, &grid_coarse_y, &grid_coarse_z, &grid_coarse_angle }},
 	{ "Medium", { &grid_medium_x, &grid_medium_y, &grid_medium_z, &grid_medium_angle }},
 	{ "Fine",   { &grid_fine_x,   &grid_fine_y,   &grid_fine_z,   &grid_fine_angle   }}
 };
@@ -128,7 +131,8 @@
 // Snap the given coordinate value on the current grid's given axis.
 // -----------------------------------------------------------------------------
 double Grid::snap (double in, const Grid::Config axis)
-{	const double gridval = *currentGrid().confs[axis];
+{
+	const double gridval = *currentGrid().confs[axis];
 	const long mult = abs (in / gridval);
 	const bool neg = (in < 0);
 	double out = mult * gridval;
@@ -145,10 +149,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool numeric (const str& tok)
-{	bool gotDot = false;
+{
+	bool gotDot = false;
 
 	for (int i = 0; i < tok.length(); ++i)
-	{	const QChar c = tok[i];
+	{
+		const QChar c = tok[i];
 
 		// Allow leading hyphen for negatives
 		if (i == 0 && c == '-')
@@ -156,7 +162,8 @@
 
 		// Check for decimal point
 		if (!gotDot && c == '.')
-		{	gotDot = true;
+		{
+			gotDot = true;
 			continue;
 		}
 
@@ -174,19 +181,23 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void simplify (int& numer, int& denom)
-{	bool repeat;
+{
+	bool repeat;
 
 	do
-	{	repeat = false;
+	{
+		repeat = false;
 
 		for (int x = 0; x < NUM_PRIMES; x++)
-		{	const int prime = g_primes[NUM_PRIMES - x - 1];
+		{
+			const int prime = g_primes[NUM_PRIMES - x - 1];
 
 			if (numer <= prime || denom <= prime)
 				continue;
 
 			if ( (numer % prime == 0) && (denom % prime == 0))
-			{	numer /= prime;
+			{
+				numer /= prime;
 				denom /= prime;
 				repeat = true;
 				break;
@@ -199,11 +210,14 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 vertex rotPoint (const QList<LDObject*>& objs)
-{	LDBoundingBox box;
+{
+	LDBoundingBox box;
 
 	switch (edit_rotpoint)
-	{	case ObjectOrigin:
-		{	// Calculate center vertex
+	{
+		case ObjectOrigin:
+		{
+			// Calculate center vertex
 			for (LDObject* obj : objs)
 				if (obj->hasMatrix())
 					box << dynamic_cast<LDMatrixObject*> (obj)->getPosition();
@@ -214,11 +228,13 @@
 		}
 
 		case WorldOrigin:
-		{	return g_origin;
+		{
+			return g_origin;
 		}
 
 		case CustomPoint:
-		{	return vertex (edit_rotpoint_x, edit_rotpoint_y, edit_rotpoint_z);
+		{
+			return vertex (edit_rotpoint_x, edit_rotpoint_y, edit_rotpoint_z);
 		}
 	}
 
@@ -228,12 +244,14 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void configRotationPoint()
-{	QDialog* dlg = new QDialog;
+{
+	QDialog* dlg = new QDialog;
 	Ui::RotPointUI ui;
 	ui.setupUi (dlg);
 
 	switch (edit_rotpoint)
-	{	case ObjectOrigin:
+	{
+		case ObjectOrigin:
 			ui.objectPoint->setChecked (true);
 			break;
 
@@ -266,7 +284,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str join (initlist<StringFormatArg> vals, str delim)
-{	QStringList list;
+{
+	QStringList list;
 
 	for (const StringFormatArg& arg : vals)
 		list << arg.value();
@@ -277,7 +296,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void roundToDecimals (double& a, int decimals)
-{	assert (decimals >= 0 && decimals < (signed) (sizeof g_e10 / sizeof *g_e10));
+{
+	assert (decimals >= 0 && decimals < (signed) (sizeof g_e10 / sizeof *g_e10));
 	a = round (a * g_e10[decimals]) / g_e10[decimals];
 }
 
@@ -286,23 +306,27 @@
 InvokationDeferer* g_invokationDeferer = new InvokationDeferer();
 
 InvokationDeferer::InvokationDeferer (QObject* parent) : QObject (parent)
-{	connect (this, SIGNAL (functionAdded()), this, SLOT (invokeFunctions()),
+{
+	connect (this, SIGNAL (functionAdded()), this, SLOT (invokeFunctions()),
 		Qt::QueuedConnection);
 }
 
 void InvokationDeferer::addFunctionCall (InvokationDeferer::FunctionType func)
-{	m_funcs << func;
+{
+	m_funcs << func;
 	removeDuplicates (m_funcs);
 	emit functionAdded();
 }
 
 void InvokationDeferer::invokeFunctions()
-{	for (FunctionType func : m_funcs)
+{
+	for (FunctionType func : m_funcs)
 		(*func)();
 
 	m_funcs.clear();
 }
 
 void invokeLater (InvokationDeferer::FunctionType func)
-{	g_invokationDeferer->addFunctionCall (func);
+{
+	g_invokationDeferer->addFunctionCall (func);
 }
\ No newline at end of file
--- a/src/misc.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/misc.h	Tue Jan 07 08:53:27 2014 +0200
@@ -45,7 +45,8 @@
 
 // Grid stuff
 struct gridinfo
-{	const char* const name;
+{
+	const char* const name;
 	float* const confs[4];
 };
 
@@ -54,12 +55,14 @@
 extern const gridinfo g_GridInfo[3];
 
 inline const gridinfo& currentGrid()
-{	return g_GridInfo[grid];
+{
+	return g_GridInfo[grid];
 }
 
 // =============================================================================
 enum RotationPoint
-{	ObjectOrigin,
+{
+	ObjectOrigin,
 	WorldOrigin,
 	CustomPoint
 };
@@ -69,14 +72,17 @@
 
 // =============================================================================
 namespace Grid
-{	enum Type
-	{	Coarse,
+{
+	enum Type
+	{
+		Coarse,
 		Medium,
 		Fine
 	};
 
 	enum Config
-	{	X,
+	{
+		X,
 		Y,
 		Z,
 		Angle
@@ -87,7 +93,8 @@
 
 // -----------------------------------------------------------------------------
 class InvokationDeferer : public QObject
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		using FunctionType = void(*)();
@@ -110,40 +117,48 @@
 // -----------------------------------------------------------------------------
 // Plural expression
 template<class T> static inline const char* plural (T n)
-{	return (n != 1) ? "s" : "";
+{
+	return (n != 1) ? "s" : "";
 }
 
 // -----------------------------------------------------------------------------
 // Templated clamp
 template<class T> static inline T clamp (T a, T min, T max)
-{	return (a > max) ? max : (a < min) ? min : a;
+{
+	return (a > max) ? max : (a < min) ? min : a;
 }
 
 // Templated minimum
 template<class T> static inline T min (T a, T b)
-{	return (a < b) ? a : b;
+{
+	return (a < b) ? a : b;
 }
 
 // Templated maximum
 template<class T> static inline T max (T a, T b)
-{	return (a > b) ? a : b;
+{
+	return (a > b) ? a : b;
 }
 
 // Templated absolute value
 template<class T> static inline T abs (T a)
-{	return (a >= 0) ? a : -a;
+{
+	return (a >= 0) ? a : -a;
 }
 
 template<class T> inline bool isZero (T a)
-{	return abs<T> (a) < 0.0001;
+{
+	return abs<T> (a) < 0.0001;
 }
 
 template<class T> inline bool isInteger (T a)
-{	return isZero (a - (int) a);
+{
+	return isZero (a - (int) a);
 }
 
 template<class T> void removeDuplicates (QList<T>& a)
-{	std::sort (a.begin(), a.end());
+{
+	std::sort (a.begin(), a.end());
 	a.erase (std::unique (a.begin(), a.end()), a.end());
 }
 
--- a/src/misc/documentPointer.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/misc/documentPointer.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -26,41 +26,48 @@
 // -----------------------------------------------------------------------------
 LDDocumentPointer::LDDocumentPointer (LDDocument* ptr) :
 	m_Pointer (ptr)
-{	addReference ();
+{
+	addReference ();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocumentPointer::LDDocumentPointer (const LDDocumentPointer& other) :
 	m_Pointer (other.getPointer())
-{	addReference ();
+{
+	addReference ();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocumentPointer::~LDDocumentPointer()
-{	removeReference();
+{
+	removeReference();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocumentPointer::addReference()
-{	if (getPointer() != null)
+{
+	if (getPointer() != null)
 		getPointer()->addReference (this);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDDocumentPointer::removeReference()
-{	if (getPointer() != null)
+{
+	if (getPointer() != null)
 		getPointer()->removeReference (this);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocumentPointer& LDDocumentPointer::operator= (LDDocument* ptr)
-{	if (ptr != getPointer())
-	{	removeReference();
+{
+	if (ptr != getPointer())
+	{
+		removeReference();
 		setPointer (ptr);
 		addReference();
 	}
--- a/src/misc/documentPointer.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/misc/documentPointer.h	Tue Jan 07 08:53:27 2014 +0200
@@ -24,7 +24,8 @@
 class LDDocument;
 
 class LDDocumentPointer
-{	PROPERTY (private, LDDocument*, Pointer, NO_OPS, STOCK_WRITE)
+{
+	PROPERTY (private, LDDocument*, Pointer, NO_OPS, STOCK_WRITE)
 
 	public:
 		LDDocumentPointer();
@@ -33,16 +34,19 @@
 		~LDDocumentPointer();
 		LDDocumentPointer& operator= (LDDocument* ptr);
 
-		LDDocumentPointer& operator= (LDDocumentPointer& other)
-		{	return operator= (other.getPointer());
+		inline LDDocumentPointer& operator= (LDDocumentPointer& other)
+		{
+			return operator= (other.getPointer());
 		}
 
-		LDDocument* operator->() const
-		{	return getPointer();
+		inline LDDocument* operator->() const
+		{
+			return getPointer();
 		}
 
-		operator LDDocument*() const
-		{	return getPointer();
+		inline operator LDDocument*() const
+		{
+			return getPointer();
 		}
 
 	private:
--- a/src/misc/ringFinder.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/misc/ringFinder.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -33,7 +33,8 @@
 // as it would fall into an infinite recursion.
 // -----------------------------------------------------------------------------
 bool RingFinder::findRingsRecursor (double r0, double r1, Solution& currentSolution)
-{	// Don't recurse too deep.
+{
+	// Don't recurse too deep.
 	if (m_stack >= 5)
 		return false;
 
@@ -44,7 +45,8 @@
 
 	// If the ring number is integral, we have found a fitting ring to r0 -> r1!
 	if (isInteger (num))
-	{	Component cmp;
+	{
+		Component cmp;
 		cmp.scale = scale;
 		cmp.num = (int) round (num);
 		currentSolution.addComponent (cmp);
@@ -52,12 +54,14 @@
 		// 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.
+	{
+		// Try find solutions by splitting the ring in various positions.
 		if (isZero (r1 - r0))
 			return false;
 
@@ -77,14 +81,16 @@
 
 		// Now go through possible splits and try find rings for both segments.
 		for (double r = r0 + interval; r < r1; r += interval)
-		{	Solution sol = currentSolution;
+		{
+			Solution sol = currentSolution;
 
 			m_stack++;
 			bool res = findRingsRecursor (r0, r, sol) && findRingsRecursor (r, r1, sol);
 			m_stack--;
 
 			if (res)
-			{	// We succeeded in finding radii for this segment. If the stack is 0, this
+			{
+				// We succeeded in finding radii for this segment. If the stack is 0, this
 				// is the first recursion to this function. Thus there are no more ring segments
 				// to process and we can add the solution.
 				//
@@ -94,7 +100,8 @@
 				if (m_stack == 0)
 					m_solutions.push_back (sol);
 				else
-				{	currentSolution = sol;
+				{
+					currentSolution = sol;
 					return true;
 				}
 			}
@@ -111,7 +118,8 @@
 // for the solution that was presented.
 // -----------------------------------------------------------------------------
 bool RingFinder::findRings (double r0, double r1)
-{	m_solutions.clear();
+{
+	m_solutions.clear();
 	Solution sol;
 
 	// Recurse in and try find solutions.
@@ -122,7 +130,8 @@
 	m_bestSolution = null;
 
 	for (QVector<Solution>::iterator solp = m_solutions.begin(); solp != m_solutions.end(); ++solp)
-	{	const Solution& sol = *solp;
+	{
+		const Solution& sol = *solp;
 
 		if (m_bestSolution == null || sol > *m_bestSolution)
 			m_bestSolution = &sol;
@@ -134,7 +143,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool RingFinder::Solution::operator> (const RingFinder::Solution& other) const
-{	// If this solution has less components than the other one, this one
+{
+	// If this solution has less components than the other one, this one
 	// is definitely better.
 	if (getComponents().size() < other.getComponents().size())
 		return true;
@@ -150,7 +160,8 @@
 		maxB = 0;
 
 	for (int i = 0; i < getComponents().size(); ++i)
-	{	maxA = max (getComponents()[i].num, maxA);
+	{
+		maxA = max (getComponents()[i].num, maxA);
 		maxB = max (other.getComponents()[i].num, maxB);
 	}
 
--- a/src/misc/ringFinder.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/misc/ringFinder.h	Tue Jan 07 08:53:27 2014 +0200
@@ -27,22 +27,27 @@
 // Provides an algorithm for finding a solution of rings between radii r0 and r1.
 // =============================================================================
 class RingFinder
-{	public:
+{
+	public:
 		struct Component
-		{	int num;
+		{
+			int num;
 			double scale;
 		};
 
 		class Solution
-		{	public:
+		{
+			public:
 				// Components of this solution
 				inline const QVector<Component>& getComponents() const
-				{	return m_components;
+				{
+					return m_components;
 				}
 
 				// Add a component to this solution
 				inline void addComponent (const Component& a)
-				{	m_components.push_back (a);
+				{
+					m_components.push_back (a);
 				}
 
 				// Compare solutions
@@ -56,15 +61,18 @@
 		bool findRings (double r0, double r1);
 
 		inline const Solution* bestSolution()
-		{	return m_bestSolution;
+		{
+			return m_bestSolution;
 		}
 
 		inline const QVector<Solution>& allSolutions() const
-		{	return m_solutions;
+		{
+			return m_solutions;
 		}
 
 		inline bool operator() (double r0, double r1)
-		{	return findRings (r0, r1);
+		{
+			return findRings (r0, r1);
 		}
 
 	private:
--- a/src/primitives.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/primitives.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -37,7 +37,8 @@
 extern_cfg (Int, ld_defaultlicense);
 
 static const str g_radialNameRoots[] =
-{	"edge",
+{
+	"edge",
 	"cyli",
 	"disc",
 	"ndis",
@@ -46,26 +47,31 @@
 };
 
 PrimitiveLister* getPrimitiveLister()
-{	return g_activePrimLister;
+{
+	return g_activePrimLister;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void loadPrimitives()
-{	log ("Loading primitives...\n");
+{
+	log ("Loading primitives...\n");
 	PrimitiveCategory::loadCategories();
 
 	// Try to load prims.cfg
 	File conf (Config::filepath ("prims.cfg"), File::Read);
 
 	if (!conf)
-	{	// No prims.cfg, build it
+	{
+		// No prims.cfg, build it
 		PrimitiveLister::start();
 	}
 	else
-	{	// Read primitives from prims.cfg
+	{
+		// Read primitives from prims.cfg
 		for (str line : conf)
-		{	int space = line.indexOf (" ");
+		{
+			int space = line.indexOf (" ");
 
 			if (space == -1)
 				continue;
@@ -83,10 +89,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static void recursiveGetFilenames (QDir dir, QList<str>& fnames)
-{	QFileInfoList flist = dir.entryInfoList();
+{
+	QFileInfoList flist = dir.entryInfoList();
 
 	for (const QFileInfo & info : flist)
-	{	if (info.fileName() == "." || info.fileName() == "..")
+	{
+		if (info.fileName() == "." || info.fileName() == "..")
 			continue; // skip . and ..
 
 		if (info.isDir())
@@ -101,7 +109,8 @@
 PrimitiveLister::PrimitiveLister (QObject* parent) :
 	QObject (parent),
 	m_i (0)
-{	g_activePrimLister = this;
+{
+	g_activePrimLister = this;
 	QDir dir (LDPaths::prims());
 	assert (dir.exists());
 	m_baselen = dir.absolutePath().length();
@@ -112,17 +121,20 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 PrimitiveLister::~PrimitiveLister()
-{	g_activePrimLister = null;
+{
+	g_activePrimLister = null;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PrimitiveLister::work()
-{	int j = min (m_i + 300, m_files.size());
+{
+	int j = min (m_i + 300, m_files.size());
 	log ("PrimitiveLister::work: %1 -> %2\n", m_i, j);
 
 	for (; m_i < j; ++m_i)
-	{	str fname = m_files[m_i];
+	{
+		str fname = m_files[m_i];
 		File f (fname, File::Read);
 		Primitive info;
 		info.name = fname.mid (m_baselen + 1);  // make full path relative
@@ -135,7 +147,8 @@
 		info.title = info.title.simplified();
 
 		if (info.title[0] == '0')
-		{	info.title.remove (0, 1);  // remove 0
+		{
+			info.title.remove (0, 1);  // remove 0
 			info.title = info.title.simplified();
 		}
 
@@ -143,7 +156,8 @@
 	}
 
 	if (m_i == m_files.size())
-	{	// Done with primitives, now save to a config file
+	{
+		// Done with primitives, now save to a config file
 		File conf (Config::filepath ("prims.cfg"), File::Write);
 
 		for (Primitive& info : m_prims)
@@ -159,7 +173,8 @@
 		deleteLater();
 	}
 	else
-	{	// Defer to event loop, pick up the work later
+	{
+		// Defer to event loop, pick up the work later
 		emit update (m_i);
 		QMetaObject::invokeMethod (this, "work", Qt::QueuedConnection);
 	}
@@ -168,7 +183,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PrimitiveLister::start()
-{	if (g_activePrimLister)
+{
+	if (g_activePrimLister)
 		return;
 
 	PrimitiveLister* lister = new PrimitiveLister;
@@ -189,32 +205,40 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PrimitiveCategory::populateCategories()
-{	for (PrimitiveCategory* cat : g_PrimitiveCategories)
+{
+	for (PrimitiveCategory* cat : g_PrimitiveCategories)
 		cat->prims.clear();
 
 
 	for (Primitive& prim : g_primitives)
-	{	bool matched = false;
+	{
+		bool matched = false;
 		prim.cat = null;
 
 		// Go over the categories and their regexes, if and when there's a match,
 		// the primitive's category is set to the category the regex beloings to.
 		for (PrimitiveCategory* cat : g_PrimitiveCategories)
-		{	for (RegexEntry& entry : cat->regexes)
-			{	switch (entry.type)
-				{	case EFilenameRegex:
-					{	// f-regex, check against filename
+		{
+			for (RegexEntry& entry : cat->regexes)
+			{
+				switch (entry.type)
+				{
+					case EFilenameRegex:
+					{
+						// f-regex, check against filename
 						matched = entry.regex.exactMatch (prim.name);
 					} break;
 
 					case ETitleRegex:
-					{	// t-regex, check against title
+					{
+						// t-regex, check against title
 						matched = entry.regex.exactMatch (prim.title);
 					} break;
 				}
 
 				if (matched)
-				{	prim.cat = cat;
+				{
+					prim.cat = cat;
 					break;
 				}
 			}
@@ -236,7 +260,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PrimitiveCategory::loadCategories()
-{	for (PrimitiveCategory* cat : g_PrimitiveCategories)
+{
+	for (PrimitiveCategory* cat : g_PrimitiveCategories)
 		delete cat;
 
 	g_PrimitiveCategories.clear();
@@ -246,27 +271,32 @@
 		f.open (":/data/primitive-categories.cfg", File::Read);
 
 	if (!f)
-	{	critical (QObject::tr ("Failed to open primitive categories!"));
+	{
+		critical (QObject::tr ("Failed to open primitive categories!"));
 		return;
 	}
 
 	if (f)
-	{	PrimitiveCategory* cat = null;
+	{
+		PrimitiveCategory* cat = null;
 
 		for (str line : f)
-		{	int colon;
+		{
+			int colon;
 
 			if (line.length() == 0 || line[0] == '#')
 				continue;
 
 			if ((colon = line.indexOf (":")) == -1)
-			{	if (cat && cat->isValidToInclude())
+			{
+				if (cat && cat->isValidToInclude())
 					g_PrimitiveCategories << cat;
 
 				cat = new PrimitiveCategory (line);
 			}
 			elif (cat != null)
-			{	str cmd = line.left (colon);
+			{
+				str cmd = line.left (colon);
 				ERegexType type = EFilenameRegex;
 
 				if (cmd == "f")
@@ -274,7 +304,8 @@
 				elif (cmd == "t")
 					type = ETitleRegex;
 				else
-				{	log (tr ("Warning: unknown command \"%1\" on line \"%2\""), cmd, line);
+				{
+					log (tr ("Warning: unknown command \"%1\" on line \"%2\""), cmd, line);
 					continue;
 				}
 
@@ -300,8 +331,10 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool PrimitiveCategory::isValidToInclude()
-{	if (regexes.size() == 0)
-	{	log (tr ("Warning: category \"%1\" left without patterns"), getName());
+{
+	if (regexes.size() == 0)
+	{
+		log (tr ("Warning: category \"%1\" left without patterns"), getName());
 		deleteLater();
 		return false;
 	}
@@ -312,20 +345,24 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool isPrimitiveLoaderBusy()
-{	return g_activePrimLister != null;
+{
+	return g_activePrimLister != null;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 static double radialPoint (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)
-{	for (int i = 0; i < segs; ++i)
-	{	double x0 = radius * radialPoint (i, divs, cos),
+{
+	for (int i = 0; i < segs; ++i)
+	{
+		double x0 = radius * radialPoint (i, divs, cos),
 			x1 = radius * radialPoint (i + 1, divs, cos),
 			z0 = radius * radialPoint (i, divs, sin),
 			z1 = radius * radialPoint (i + 1, divs, sin);
@@ -337,21 +374,25 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 QList<LDObject*> makePrimitive (PrimitiveType type, int segs, int divs, int num)
-{	QList<LDObject*> objs;
+{
+	QList<LDObject*> objs;
 	QList<int> condLineSegs;
 	QList<QLineF> circle;
 
 	makeCircle (segs, divs, 1, circle);
 
 	for (int i = 0; i < segs; ++i)
-	{	double x0 = circle[i].x1(),
+	{
+		double x0 = circle[i].x1(),
 				   x1 = circle[i].x2(),
 				   z0 = circle[i].y1(),
 				   z1 = circle[i].y2();
 
 		switch (type)
-		{	case Circle:
-			{	vertex v0 (x0, 0.0f, z0),
+		{
+			case Circle:
+			{
+				vertex v0 (x0, 0.0f, z0),
 				  v1 (x1, 0.0f, z1);
 
 				LDLine* line = new LDLine;
@@ -364,11 +405,13 @@
 			case Cylinder:
 			case Ring:
 			case Cone:
-			{	double x2, x3, z2, z3;
+			{
+				double x2, x3, z2, z3;
 				double y0, y1, y2, y3;
 
 				if (type == Cylinder)
-				{	x2 = x1;
+				{
+					x2 = x1;
 					x3 = x0;
 					z2 = z1;
 					z3 = z0;
@@ -377,7 +420,8 @@
 					y2 = y3 = 1.0f;
 				}
 				else
-				{	x2 = x1 * (num + 1);
+				{
+					x2 = x1 * (num + 1);
 					x3 = x0 * (num + 1);
 					z2 = z1 * (num + 1);
 					z3 = z0 * (num + 1);
@@ -390,7 +434,8 @@
 					if (type == Ring)
 						y0 = y1 = y2 = y3 = 0.0f;
 					else
-					{	y0 = y1 = 1.0f;
+					{
+						y0 = y1 = 1.0f;
 						y2 = y3 = 0.0f;
 					}
 				}
@@ -418,12 +463,14 @@
 
 			case Disc:
 			case DiscNeg:
-			{	double x2, z2;
+			{
+				double x2, z2;
 
 				if (type == Disc)
 					x2 = z2 = 0.0f;
 				else
-				{	x2 = (x0 >= 0.0f) ? 1.0f : -1.0f;
+				{
+					x2 = (x0 >= 0.0f) ? 1.0f : -1.0f;
 					z2 = (z0 >= 0.0f) ? 1.0f : -1.0f;
 				}
 
@@ -449,7 +496,8 @@
 		condLineSegs << segs;
 
 	for (int i : condLineSegs)
-	{	vertex v0 (radialPoint (i, divs, cos), 0.0f, radialPoint (i, divs, sin)),
+	{
+		vertex v0 (radialPoint (i, divs, cos), 0.0f, radialPoint (i, divs, sin)),
 		  v1,
 		  v2 (radialPoint (i + 1, divs, cos), 0.0f, radialPoint (i + 1, divs, sin)),
 		  v3 (radialPoint (i - 1, divs, cos), 0.0f, radialPoint (i - 1, divs, sin));
@@ -457,7 +505,8 @@
 		if (type == Cylinder)
 			v1 = vertex (v0[X], 1.0f, v0[Z]);
 		elif (type == Cone)
-		{	v1 = vertex (v0[X] * (num + 1), 0.0f, v0[Z] * (num + 1));
+		{
+			v1 = vertex (v0[X] * (num + 1), 0.0f, v0[Z] * (num + 1));
 			v0[X] *= num;
 			v0[Y] = 1.0f;
 			v0[Z] *= num;
@@ -478,7 +527,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 static str primitiveTypeName (PrimitiveType type)
-{	// Not translated as primitives are in English.
+{
+	// Not translated as primitives are in English.
 	return type == Circle   ? "Circle" :
 		   type == Cylinder ? "Cylinder" :
 		   type == Disc     ? "Disc" :
@@ -489,14 +539,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str radialFileName (PrimitiveType type, int segs, int divs, int num)
-{	int numer = segs,
+{
+	int numer = segs,
 			denom = divs;
 
 	// Simplify the fractional part, but the denominator must be at least 4.
 	simplify (numer, denom);
 
 	if (denom < 4)
-	{	const int factor = 4 / denom;
+	{
+		const int factor = 4 / denom;
 		numer *= factor;
 		denom *= factor;
 	}
@@ -519,7 +571,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocument* generatePrimitive (PrimitiveType type, int segs, int divs, int num)
-{	// Make the description
+{
+	// Make the description
 	str frac = str::number ((float) segs / divs);
 	str name = radialFileName (type, segs, divs, num);
 	str descr;
@@ -529,7 +582,8 @@
 		frac += ".0";
 
 	if (type == Ring || type == Cone)
-	{	str spacing =
+	{
+		str spacing =
 			(num < 10) ? "  " :
 			(num < 100) ? " "  : "";
 
@@ -549,12 +603,14 @@
 	str license = "";
 
 	if (ld_defaultname.isEmpty() == false)
-	{	license = getLicenseText (ld_defaultlicense);
+	{
+		license = getLicenseText (ld_defaultlicense);
 		author = fmt ("%1 [%2]", ld_defaultname, ld_defaultuser);
 	}
 
 	f->addObjects (
-	{	new LDComment (descr),
+	{
+		new LDComment (descr),
 		new LDComment (fmt ("Name: %1", name)),
 		new LDComment (fmt ("Author: %1", author)),
 		new LDComment (fmt ("!LDRAW_ORG Unofficial_%1Primitive", divs == hires ? "48_" : "")),
@@ -571,7 +627,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDDocument* getPrimitive (PrimitiveType type, int segs, int divs, int num)
-{	str name = radialFileName (type, segs, divs, num);
+{
+	str name = radialFileName (type, segs, divs, num);
 	LDDocument* f = getDocument (name);
 
 	if (f != null)
@@ -584,7 +641,8 @@
 // -----------------------------------------------------------------------------
 PrimitivePrompt::PrimitivePrompt (QWidget* parent, Qt::WindowFlags f) :
 	QDialog (parent, f)
-{	ui = new Ui_MakePrimUI;
+{
+	ui = new Ui_MakePrimUI;
 	ui->setupUi (this);
 	connect (ui->cb_hires, SIGNAL (toggled (bool)), this, SLOT (hiResToggled (bool)));
 }
@@ -592,13 +650,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 PrimitivePrompt::~PrimitivePrompt()
-{	delete ui;
+{
+	delete ui;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void PrimitivePrompt::hiResToggled (bool on)
-{	ui->sb_segs->setMaximum (on ? hires : lores);
+{
+	ui->sb_segs->setMaximum (on ? hires : lores);
 
 	// If the current value is 16 and we switch to hi-res, default the
 	// spinbox to 48.
@@ -609,7 +669,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 DEFINE_ACTION (MakePrimitive, 0)
-{	PrimitivePrompt* dlg = new PrimitivePrompt (g_win);
+{
+	PrimitivePrompt* dlg = new PrimitivePrompt (g_win);
 
 	if (!dlg->exec())
 		return;
--- a/src/primitives.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/primitives.h	Tue Jan 07 08:53:27 2014 +0200
@@ -28,22 +28,26 @@
 class Ui_MakePrimUI;
 class PrimitiveCategory;
 struct Primitive
-{	str name, title;
+{
+	str name, title;
 	PrimitiveCategory* cat;
 };
 
 class PrimitiveCategory : public QObject
-{	Q_OBJECT
+{
+	Q_OBJECT
 	PROPERTY (public,	str,	Name,	STR_OPS,	STOCK_WRITE)
 
 	public:
 		enum ERegexType
-		{	EFilenameRegex,
+		{
+			EFilenameRegex,
 			ETitleRegex
 		};
 
 		struct RegexEntry
-		{	QRegExp		regex;
+		{
+			QRegExp		regex;
 			ERegexType	type;
 		};
 
@@ -66,7 +70,8 @@
 // builds an index of them.
 // =============================================================================
 class PrimitiveLister : public QObject
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		explicit PrimitiveLister (QObject* parent = 0);
@@ -94,7 +99,8 @@
 PrimitiveLister* getPrimitiveLister();
 
 enum PrimitiveType
-{	Circle,
+{
+	Circle,
 	Cylinder,
 	Disc,
 	DiscNeg,
@@ -104,7 +110,8 @@
 
 // =============================================================================
 class PrimitivePrompt : public QDialog
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		explicit PrimitivePrompt (QWidget* parent = null, Qt::WindowFlags f = 0);
--- a/src/property.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/property.h	Tue Jan 07 08:53:27 2014 +0200
@@ -19,16 +19,17 @@
 #ifndef LDFORGE_PROPERTY_H
 #define LDFORGE_PROPERTY_H
 
-#define PROPERTY( ACCESS, TYPE, NAME, OPS, WRITETYPE )		\
-	private:																	\
-		TYPE m_##NAME;														\
-																				\
-	public:																	\
+#define PROPERTY( ACCESS, TYPE, NAME, OPS, WRITETYPE )			\
+	private:														\
+		TYPE m_##NAME;											\
+																\
+	public:														\
 		inline TYPE const& GET_READ_METHOD( NAME, OPS ) const	\
-		{	return m_##NAME; 												\
-		}																		\
-																				\
-	ACCESS:																	\
+		{														\
+			return m_##NAME; 									\
+		}														\
+																\
+	ACCESS:														\
 		DEFINE_WRITE_METHOD_##WRITETYPE( TYPE, NAME )			\
 		DEFINE_PROPERTY_##OPS( TYPE, NAME )
 
@@ -42,66 +43,76 @@
 #define GET_READ_METHOD_LIST_OPS( NAME ) get##NAME()
 
 #define DEFINE_WRITE_METHOD_STOCK_WRITE( TYPE, NAME )	\
-		inline void set##NAME( TYPE const& NAME##_ )		\
-		{	m_##NAME = NAME##_;									\
+		inline void set##NAME( TYPE const& NAME##_ )	\
+		{												\
+			m_##NAME = NAME##_;							\
 		}
 
 #define DEFINE_WRITE_METHOD_CUSTOM_WRITE( TYPE, NAME )	\
-		void set##NAME( TYPE const& NAME##_ );					\
+		void set##NAME( TYPE const& NAME##_ );			\
 
 #define DEFINE_WITH_CB( NAME ) void NAME##Changed();
 #define DEFINE_NO_CB( NAME )
 
 #define DEFINE_PROPERTY_NO_OPS( TYPE, NAME )
 
-#define DEFINE_PROPERTY_STR_OPS( TYPE, NAME )	\
-		void append##NAME( TYPE a )					\
-		{	TYPE tmp( m_##NAME );						\
-			tmp.append( a );								\
-			set##NAME( tmp );								\
-		}														\
-																\
+#define DEFINE_PROPERTY_STR_OPS( TYPE, NAME )			\
+		void append##NAME( TYPE a )						\
+		{												\
+			TYPE tmp( m_##NAME );						\
+			tmp.append( a );							\
+			set##NAME( tmp );							\
+		}												\
+														\
 		void prepend##NAME( TYPE a )					\
-		{	TYPE tmp( m_##NAME );						\
-			tmp.prepend( a );								\
-			set##NAME( tmp );								\
-		}														\
-																\
-		void replaceIn##NAME( TYPE a, TYPE b )		\
-		{	TYPE tmp( m_##NAME );						\
-			tmp.replace( a, b );							\
-			set##NAME( tmp );								\
+		{												\
+			TYPE tmp( m_##NAME );						\
+			tmp.prepend( a );							\
+			set##NAME( tmp );							\
+		}												\
+														\
+		void replaceIn##NAME( TYPE a, TYPE b )			\
+		{												\
+			TYPE tmp( m_##NAME );						\
+			tmp.replace( a, b );						\
+			set##NAME( tmp );							\
 		}
 
-#define DEFINE_PROPERTY_NUM_OPS( TYPE, NAME )	\
-		inline void increase##NAME( TYPE a = 1 )	\
-		{	set##NAME( m_##NAME + a );					\
-		}														\
-																\
-		inline void decrease##NAME( TYPE a = 1 )	\
-		{	set##NAME( m_##NAME - a );					\
+#define DEFINE_PROPERTY_NUM_OPS( TYPE, NAME )			\
+		inline void increase##NAME( TYPE a = 1 )			\
+		{												\
+			set##NAME( m_##NAME + a );					\
+		}												\
+														\
+		inline void decrease##NAME( TYPE a = 1 )		\
+		{												\
+			set##NAME( m_##NAME - a );					\
 		}
 
-#define DEFINE_PROPERTY_BOOL_OPS( TYPE, NAME )	\
-		inline void toggle##NAME()						\
-		{	set##NAME( !m_##NAME );						\
+#define DEFINE_PROPERTY_BOOL_OPS( TYPE, NAME )				\
+		inline void toggle##NAME()							\
+		{													\
+			set##NAME( !m_##NAME );							\
 		}
 
 #define DEFINE_PROPERTY_LIST_OPS( TYPE, NAME )				\
 		void pushTo##NAME( const TYPE::value_type& a )		\
-		{	TYPE tmp( m_##NAME );									\
-			tmp.push_back( a );										\
-			set##NAME( tmp );											\
-		}																	\
-																			\
+		{													\
+			TYPE tmp( m_##NAME );							\
+			tmp.push_back( a );								\
+			set##NAME( tmp );								\
+		}													\
+															\
 		void removeFrom##NAME( const TYPE::value_type& a )	\
-		{	TYPE tmp( m_##NAME );									\
-			tmp.removeOne( a );										\
-			set##NAME( tmp );											\
-		}																	\
-																			\
-		inline void clear##NAME()									\
-		{	set##NAME( TYPE() );										\
+		{													\
+			TYPE tmp( m_##NAME );							\
+			tmp.removeOne( a );								\
+			set##NAME( tmp );								\
+		}													\
+															\
+		inline void clear##NAME()							\
+		{													\
+			set##NAME( TYPE() );							\
 		}
 
 #endif // LDFORGE_PROPERTY_H
\ No newline at end of file
--- a/src/types.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/types.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -30,7 +30,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str DoFormat (QList<StringFormatArg> args)
-{	assert (args.size() >= 1);
+{
+	assert (args.size() >= 1);
 	str text = args[0].value();
 
 	for (uchar i = 1; i < args.size(); ++i)
@@ -42,7 +43,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 vertex::vertex (double x, double y, double z)
-{	m_coords[X] = x;
+{
+	m_coords[X] = x;
 	m_coords[Y] = y;
 	m_coords[Z] = z;
 }
@@ -50,14 +52,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void vertex::move (const vertex& other)
-{	for_axes (ax)
+{
+	for_axes (ax)
 		m_coords[ax] += other[ax];
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 double vertex::distanceTo (const vertex& other) const
-{	double dx = abs (x() - other.x());
+{
+	double dx = abs (x() - other.x());
 	double dy = abs (y() - other.y());
 	double dz = abs (z() - other.z());
 	return sqrt ((dx * dx) + (dy * dy) + (dz * dz));
@@ -66,7 +70,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 vertex vertex::midpoint (const vertex& other)
-{	vertex mid;
+{
+	vertex mid;
 
 	for_axes (ax)
 		mid[ax] = (m_coords[ax] + other[ax]) / 2;
@@ -77,7 +82,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str vertex::stringRep (bool mangled) const
-{	str fmtstr = "%1 %2 %3";
+{
+	str fmtstr = "%1 %2 %3";
 
 	if (mangled)
 		fmtstr = "(%1, %2, %3)";
@@ -88,7 +94,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void vertex::transform (matrix matr, vertex pos)
-{	double x2 = (matr[0] * x()) + (matr[1] * y()) + (matr[2] * z()) + pos[X];
+{
+	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];
 
@@ -100,37 +107,44 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 vertex vertex::operator-() const
-{	return vertex (-m_coords[X], -m_coords[Y], -m_coords[Z]);
+{
+	return vertex (-m_coords[X], -m_coords[Y], -m_coords[Z]);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool vertex::operator!= (const vertex& other) const
-{	return !operator== (other);
+{
+	return !operator== (other);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 double& vertex::operator[] (const Axis ax)
-{	return coord ( (int) ax);
+{
+	return coord ( (int) ax);
 }
 
 const double& vertex::operator[] (const Axis ax) const
-{	return coord ( (int) ax);
+{
+	return coord ( (int) ax);
 }
 
 double& vertex::operator[] (const int ax)
-{	return coord (ax);
+{
+	return coord (ax);
 }
 
 const double& vertex::operator[] (const int ax) const
-{	return coord (ax);
+{
+	return coord (ax);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool vertex::operator== (const vertex& other) const
-{	return coord (X) == other[X] &&
+{
+	return coord (X) == other[X] &&
 		   coord (Y) == other[Y] &&
 		   coord (Z) == other[Z];
 }
@@ -138,7 +152,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 vertex& vertex::operator/= (const double d)
-{	for_axes (ax)
+{
+	for_axes (ax)
 		m_coords[ax] /= d;
 
 	return *this;
@@ -147,21 +162,24 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 vertex vertex::operator/ (const double d) const
-{	vertex other (*this);
+{
+	vertex other (*this);
 	return other /= d;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 vertex& vertex::operator+= (const vertex& other)
-{	move (other);
+{
+	move (other);
 	return *this;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 vertex vertex::operator+ (const vertex& other) const
-{	vertex newvert (*this);
+{
+	vertex newvert (*this);
 	newvert.move (other);
 	return newvert;
 }
@@ -169,7 +187,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 int vertex::operator< (const vertex& other) const
-{	if (operator== (other))
+{
+	if (operator== (other))
 		return false;
 
 	if (coord (X) < other[X])
@@ -190,29 +209,34 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 matrix::matrix (double vals[])
-{	for (int i = 0; i < 9; ++i)
+{
+	for (int i = 0; i < 9; ++i)
 		m_vals[i] = vals[i];
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 matrix::matrix (double fillval)
-{	for (int i = 0; i < 9; ++i)
+{
+	for (int i = 0; i < 9; ++i)
 		m_vals[i] = fillval;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 matrix::matrix (initlist<double> vals)
-{	assert (vals.size() == 9);
+{
+	assert (vals.size() == 9);
 	memcpy (&m_vals[0], & (*vals.begin()), sizeof m_vals);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void matrix::puts() const
-{	for (int i = 0; i < 3; ++i)
-	{	for (int j = 0; j < 3; ++j)
+{
+	for (int i = 0; i < 3; ++i)
+	{
+		for (int j = 0; j < 3; ++j)
 			log ("%1\t", m_vals[ (i * 3) + j]);
 
 		log ("\n");
@@ -222,10 +246,12 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 str matrix::stringRep() const
-{	str val;
+{
+	str val;
 
 	for (int i = 0; i < 9; ++i)
-	{	if (i > 0)
+	{
+		if (i > 0)
 			val += ' ';
 
 		val += str::number (m_vals[i]);
@@ -237,13 +263,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void matrix::zero()
-{	memset (&m_vals[0], 0, sizeof m_vals);
+{
+	memset (&m_vals[0], 0, sizeof m_vals);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 matrix matrix::mult (matrix other) const
-{	matrix val;
+{
+	matrix val;
 	val.zero();
 
 	for (int i = 0; i < 3; ++i)
@@ -257,14 +285,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 matrix& matrix::operator= (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;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 double matrix::getDeterminant() const
-{	return (val (0) * val (4) * val (8)) +
+{
+	return (val (0) * val (4) * val (8)) +
 		   (val (1) * val (5) * val (6)) +
 		   (val (2) * val (3) * val (7)) -
 		   (val (2) * val (4) * val (6)) -
@@ -275,7 +305,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool matrix::operator== (const matrix& other) const
-{	for (int i = 0; i < 9; ++i)
+{
+	for (int i = 0; i < 9; ++i)
 		if (val (i) != other[i])
 			return false;
 
@@ -285,69 +316,84 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 StringFormatArg::StringFormatArg (const str& v)
-{	m_val = v;
+{
+	m_val = v;
 }
 
 StringFormatArg::StringFormatArg (const char& v)
-{	m_val = v;
+{
+	m_val = v;
 }
 
 StringFormatArg::StringFormatArg (const uchar& v)
-{	m_val = v;
+{
+	m_val = v;
 }
 
 StringFormatArg::StringFormatArg (const QChar& v)
-{	m_val = v;
+{
+	m_val = v;
 }
 
 StringFormatArg::StringFormatArg (const float& v)
-{	m_val = str::number (v);
+{
+	m_val = str::number (v);
 }
 
 StringFormatArg::StringFormatArg (const double& v)
-{	m_val = str::number (v);
+{
+	m_val = str::number (v);
 }
 
 StringFormatArg::StringFormatArg (const vertex& v)
-{	m_val = v.stringRep (false);
+{
+	m_val = v.stringRep (false);
 }
 
 StringFormatArg::StringFormatArg (const matrix& v)
-{	m_val = v.stringRep();
+{
+	m_val = v.stringRep();
 }
 
 StringFormatArg::StringFormatArg (const char* v)
-{	m_val = v;
+{
+	m_val = v;
 }
 
 StringFormatArg::StringFormatArg (const void* v)
-{	m_val.sprintf ("%p", v);
+{
+	m_val.sprintf ("%p", v);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 File::File()
-{	// Make a null file
+{
+	// Make a null file
 	m_file = null;
 	m_textstream = null;
 }
 
 File::File (str path, OpenType rtype)
-{	m_file = null;
+{
+	m_file = null;
 	m_path = path;
 	open (path, rtype);
 }
 
 File::File (FILE* fp, OpenType rtype)
-{	m_file = null;
+{
+	m_file = null;
 	open (fp, rtype);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 File::~File()
-{	if (m_file)
-	{	m_file->close();
+{
+	if (m_file)
+	{
+		m_file->close();
 		delete m_file;
 
 		if (m_textstream)
@@ -358,11 +404,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool File::open (FILE* fp, OpenType rtype)
-{	return open ("", rtype, fp);
+{
+	return open ("", rtype, fp);
 }
 
 bool File::open (str path, OpenType rtype, FILE* fp)
-{	close();
+{
+	close();
 
 	if (!m_file)
 		m_file = new QFile;
@@ -381,7 +429,8 @@
 		result = m_file->open (mode);
 
 	if (result)
-	{	m_textstream = new QTextStream (m_file);
+	{
+		m_textstream = new QTextStream (m_file);
 		m_path = path;
 		return true;
 	}
@@ -394,23 +443,27 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 File::iterator File::begin()
-{	return iterator (this);
+{
+	return iterator (this);
 }
 
 File::iterator& File::end()
-{	return m_endIterator;
+{
+	return m_endIterator;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void File::write (str msg)
-{	m_file->write (msg.toUtf8(), msg.length());
+{
+	m_file->write (msg.toUtf8(), msg.length());
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool File::readLine (str& line)
-{	if (!m_textstream || m_textstream->atEnd())
+{
+	if (!m_textstream || m_textstream->atEnd())
 		return false;
 
 	line = m_textstream->readLine();
@@ -420,31 +473,36 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool File::atEnd() const
-{	assert (m_textstream != null);
+{
+	assert (m_textstream != null);
 	return m_textstream->atEnd();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool File::isNull() const
-{	return m_file == null;
+{
+	return m_file == null;
 }
 
 bool File::operator!() const
-{	return isNull();
+{
+	return isNull();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void File::close()
-{	if (!m_file)
+{
+	if (!m_file)
 		return;
 
 	delete m_file;
 	m_file = null;
 
 	if (m_textstream)
-	{	delete m_textstream;
+	{
+		delete m_textstream;
 		m_textstream = null;
 	}
 }
@@ -452,62 +510,72 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool File::flush()
-{	return m_file->flush();
+{
+	return m_file->flush();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 File::operator bool() const
-{	return !isNull();
+{
+	return !isNull();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void File::rewind()
-{	m_file->seek (0);
+{
+	m_file->seek (0);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 File::iterator::iterator (File* f) : m_file (f)
-{	operator++();
+{
+	operator++();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void File::iterator::operator++()
-{	m_gotdata = m_file->readLine (m_text);
+{
+	m_gotdata = m_file->readLine (m_text);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 str File::iterator::operator*()
-{	return m_text;
+{
+	return m_text;
 }
 
 // =============================================================================
 // The prime contestant for the weirdest operator== 2013 award?
 // -----------------------------------------------------------------------------
 bool File::iterator::operator== (File::iterator& other)
-{	return (other.m_file == null && !m_gotdata);
+{
+	return (other.m_file == null && !m_gotdata);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool File::iterator::operator!= (File::iterator& other)
-{	return !operator== (other);
+{
+	return !operator== (other);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDBoundingBox::LDBoundingBox()
-{	reset();
+{
+	reset();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDBoundingBox::calculate()
-{	reset();
+{
+	reset();
 
 	if (!getCurrentDocument())
 		return;
@@ -519,21 +587,26 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDBoundingBox::calcObject (LDObject* obj)
-{	switch (obj->getType())
-	{	case LDObject::Line:
+{
+	switch (obj->getType())
+	{
+		case LDObject::Line:
 		case LDObject::Triangle:
 		case LDObject::Quad:
 		case LDObject::CondLine:
-		{	for (int i = 0; i < obj->vertices(); ++i)
+		{
+			for (int i = 0; i < obj->vertices(); ++i)
 				calcVertex (obj->getVertex (i));
 		} break;
 
 		case LDObject::Subfile:
-		{	LDSubfile* ref = static_cast<LDSubfile*> (obj);
+		{
+			LDSubfile* ref = static_cast<LDSubfile*> (obj);
 			QList<LDObject*> objs = ref->inlineContents (LDSubfile::DeepCacheInline);
 
 			for (LDObject * obj : objs)
-			{	calcObject (obj);
+			{
+				calcObject (obj);
 				obj->deleteSelf();
 			}
 		}
@@ -547,22 +620,26 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDBoundingBox& LDBoundingBox::operator<< (const vertex& v)
-{	calcVertex (v);
+{
+	calcVertex (v);
 	return *this;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 LDBoundingBox& LDBoundingBox::operator<< (LDObject* obj)
-{	calcObject (obj);
+{
+	calcObject (obj);
 	return *this;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDBoundingBox::calcVertex (const vertex& v)
-{	for_axes (ax)
-	{	if (v[ax] < m_Vertex0[ax])
+{
+	for_axes (ax)
+	{
+		if (v[ax] < m_Vertex0[ax])
 			m_Vertex0[ax] = v[ax];
 
 		if (v[ax] > m_Vertex1[ax])
@@ -575,7 +652,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDBoundingBox::reset()
-{	m_Vertex0[X] = m_Vertex0[Y] = m_Vertex0[Z] = 0x7FFFFFFF;
+{
+	m_Vertex0[X] = m_Vertex0[Y] = m_Vertex0[Z] = 0x7FFFFFFF;
 	m_Vertex1[X] = m_Vertex1[Y] = m_Vertex1[Z] = 0xFFFFFFFF;
 
 	setEmpty (true);
@@ -584,13 +662,15 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 double LDBoundingBox::size() const
-{	double xscale = (m_Vertex0[X] - m_Vertex1[X]);
+{
+	double xscale = (m_Vertex0[X] - m_Vertex1[X]);
 	double yscale = (m_Vertex0[Y] - m_Vertex1[Y]);
 	double zscale = (m_Vertex0[Z] - m_Vertex1[Z]);
 	double size = zscale;
 
 	if (xscale > yscale)
-	{	if (xscale > zscale)
+	{
+		if (xscale > zscale)
 			size = xscale;
 	}
 	elif (yscale > zscale)
@@ -605,7 +685,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 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/types.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/types.h	Tue Jan 07 08:53:27 2014 +0200
@@ -46,7 +46,8 @@
 using pair = std::pair<T, R>;
 
 enum Axis
-{	X,
+{
+	X,
 	Y,
 	Z
 };
@@ -59,7 +60,8 @@
 // A mathematical 3 x 3 matrix
 // =============================================================================
 class matrix
-{	public:
+{
+	public:
 		matrix() {}
 		matrix (initlist<double> vals);
 		matrix (double fillval);
@@ -73,23 +75,28 @@
 		matrix&			operator= (matrix other);
 
 		inline double& val (int idx)
-		{	return m_vals[idx];
+		{
+			return m_vals[idx];
 		}
 
 		inline const double& val (int idx) const
-		{	return m_vals[idx];
+		{
+			return m_vals[idx];
 		}
 
 		inline matrix operator* (matrix other) const
-		{	return mult (other);
+		{
+			return mult (other);
 		}
 
 		inline double& operator[] (int idx)
-		{	return val (idx);
+		{
+			return val (idx);
 		}
 
 		inline const double& operator[] (int idx) const
-		{	return val (idx);
+		{
+			return val (idx);
 		}
 
 		bool operator== (const matrix& other) const;
@@ -107,7 +114,8 @@
 // LDVertex, which is a vertex used in an LDraw part file.
 // =============================================================================
 class vertex
-{	public:
+{
+	public:
 		vertex() {}
 		vertex (double x, double y, double z);
 
@@ -131,35 +139,43 @@
 		const double&	operator[] (const int ax) const;
 
 		inline double& coord (int n)
-		{	return m_coords[n];
+		{
+			return m_coords[n];
 		}
 
 		inline const double& coord (int n) const
-		{	return m_coords[n];
+		{
+			return m_coords[n];
 		}
 
 		inline double& x()
-		{	return m_coords[X];
+		{
+			return m_coords[X];
 		}
 
 		inline const double& x() const
-		{	return m_coords[X];
+		{
+			return m_coords[X];
 		}
 
 		inline double& y()
-		{	return m_coords[Y];
+		{
+			return m_coords[Y];
 		}
 
 		inline const double& y() const
-		{	return m_coords[Y];
+		{
+			return m_coords[Y];
 		}
 
 		inline double& z()
-		{	return m_coords[Z];
+		{
+			return m_coords[Z];
 		}
 
 		inline const double& z() const
-		{	return m_coords[Z];
+		{
+			return m_coords[Z];
 		}
 
 	private:
@@ -175,7 +191,8 @@
 // Used as the argument type to the formatting functions, hence its name.
 // =============================================================================
 class StringFormatArg
-{	public:
+{
+	public:
 		StringFormatArg (const str& v);
 		StringFormatArg (const char& v);
 		StringFormatArg (const uchar& v);
@@ -203,12 +220,14 @@
 		StringFormatArg (const void* v);
 
 		template<class T> StringFormatArg (const QList<T>& v)
-		{	m_val = "{ ";
+		{
+			m_val = "{ ";
 
 			int i = 0;
 
 			for (const T& it : v)
-			{	if (i++)
+			{
+				if (i++)
 					m_val += ", ";
 
 				StringFormatArg arg (it);
@@ -222,7 +241,8 @@
 		}
 
 		str value() const
-		{	return m_val;
+		{
+			return m_val;
 		}
 	private:
 		str m_val;
@@ -236,10 +256,12 @@
 // A file interface with simple interface and support for range-for-loops.
 // =============================================================================
 class File
-{	private:
+{
+	private:
 		// Iterator class to enable range-for-loop support. Rough hack.. don't use directly!
 		class iterator
-		{	public:
+		{
+			public:
 				iterator() : m_file (null) {} // end iterator has m_file == null
 				iterator (File* f);
 				void operator++();
@@ -255,7 +277,8 @@
 
 	public:
 		enum OpenType
-		{	Read,
+		{
+			Read,
 			Write,
 			Append
 		};
@@ -296,7 +319,8 @@
 // v0 is the minimum vertex, v1 is the maximum vertex.
 // =============================================================================
 class LDBoundingBox
-{	PROPERTY (private,	bool,		Empty,	BOOL_OPS,	STOCK_WRITE)
+{
+	PROPERTY (private,	bool,		Empty,	BOOL_OPS,	STOCK_WRITE)
 	PROPERTY (private,	vertex,	Vertex0,	NO_OPS,		STOCK_WRITE)
 	PROPERTY (private,	vertex,	Vertex1,	NO_OPS,		STOCK_WRITE)
 
--- a/src/widgets.cc	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/widgets.cc	Tue Jan 07 08:53:27 2014 +0200
@@ -32,25 +32,29 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 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)
-{	return (orient == (invert ? Qt::Vertical : Qt::Horizontal)) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom;
+{
+	return (orient == (invert ? Qt::Vertical : Qt::Horizontal)) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 bool RadioGroup::isChecked (int n) const
-{	return m_buttonGroup->checkedId() == n;
+{
+	return m_buttonGroup->checkedId() == n;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void RadioGroup::init (Qt::Orientation orient)
-{	m_vert = orient == Qt::Vertical;
+{
+	m_vert = orient == Qt::Vertical;
 
 	m_buttonGroup = new QButtonGroup;
 	m_oldId = m_curId = 0;
@@ -71,7 +75,8 @@
 RadioGroup::RadioGroup (const QString& title, initlist<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)
@@ -81,7 +86,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 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;
 
@@ -91,14 +97,16 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void RadioGroup::addButton (const char* entry)
-{	QRadioButton* button = new QRadioButton (entry);
+{
+	QRadioButton* button = new QRadioButton (entry);
 	addButton (button);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void RadioGroup::addButton (QRadioButton* button)
-{	bool const selectThis = (m_curId == m_defId);
+{
+	bool const selectThis = (m_curId == m_defId);
 
 	m_objects << button;
 	m_buttonGroup->addButton (button, m_curId++);
@@ -111,45 +119,52 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 RadioGroup& RadioGroup::operator<< (QRadioButton* button)
-{	addButton (button);
+{
+	addButton (button);
 	return *this;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 RadioGroup& RadioGroup::operator<< (const char* entry)
-{	addButton (entry);
+{
+	addButton (entry);
 	return *this;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void RadioGroup::setCurrentRow (int row)
-{	m_currentLayout = m_layouts[row];
+{
+	m_currentLayout = m_layouts[row];
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 int RadioGroup::value() const
-{	return m_buttonGroup->checkedId();
+{
+	return m_buttonGroup->checkedId();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void RadioGroup::setValue (int val)
-{	m_buttonGroup->button (val)->setChecked (true);
+{
+	m_buttonGroup->button (val)->setChecked (true);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 QRadioButton* RadioGroup::operator[] (int n) const
-{	return m_objects[n];
+{
+	return m_objects[n];
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 void RadioGroup::slot_buttonPressed (int btn)
-{	emit buttonPressed (btn);
+{
+	emit buttonPressed (btn);
 
 	m_oldId = m_buttonGroup->checkedId();
 }
@@ -157,7 +172,8 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void RadioGroup::slot_buttonReleased (int btn)
-{	emit buttonReleased (btn);
+{
+	emit buttonReleased (btn);
 	int newid = m_buttonGroup->checkedId();
 
 	if (m_oldId != newid)
@@ -167,11 +183,13 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 RadioGroup::Iterator RadioGroup::begin()
-{	return m_objects.begin();
+{
+	return m_objects.begin();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 RadioGroup::Iterator RadioGroup::end()
-{	return m_objects.end();
+{
+	return m_objects.end();
 }
--- a/src/widgets.h	Tue Jan 07 08:26:15 2014 +0200
+++ b/src/widgets.h	Tue Jan 07 08:53:27 2014 +0200
@@ -37,17 +37,20 @@
 // Convenience widget - is a groupbox of radio buttons.
 // =============================================================================
 class RadioGroup : public QGroupBox
-{	Q_OBJECT
+{
+	Q_OBJECT
 
 	public:
 		typedef QList<QRadioButton*>::Iterator Iterator;
 
 		explicit RadioGroup()
-		{	init (Qt::Vertical);
+		{
+			init (Qt::Vertical);
 		}
 
 		explicit RadioGroup (QWidget* parent = null) : QGroupBox (parent)
-		{	init (Qt::Vertical);
+		{
+			init (Qt::Vertical);
 		}
 
 		explicit RadioGroup (const QString& title, QWidget* parent = null);

mercurial