style cleanup - it should be all unified now

Fri, 02 Aug 2013 16:33:30 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Fri, 02 Aug 2013 16:33:30 +0300
changeset 421
7d26db0be944
parent 420
8d6af951b611
child 422
00eedf400f72

style cleanup - it should be all unified now

src/aboutDialog.cpp file | annotate | diff | comparison | revisions
src/aboutDialog.h file | annotate | diff | comparison | revisions
src/addObjectDialog.cpp file | annotate | diff | comparison | revisions
src/addObjectDialog.h file | annotate | diff | comparison | revisions
src/colorSelectDialog.cpp file | annotate | diff | comparison | revisions
src/colorSelectDialog.h file | annotate | diff | comparison | revisions
src/colors.cpp file | annotate | diff | comparison | revisions
src/colors.h file | annotate | diff | comparison | revisions
src/common.h file | annotate | diff | comparison | revisions
src/config.cpp file | annotate | diff | comparison | revisions
src/config.h file | annotate | diff | comparison | revisions
src/configDialog.cpp file | annotate | diff | comparison | revisions
src/configDialog.h file | annotate | diff | comparison | revisions
src/dialogs.cpp file | annotate | diff | comparison | revisions
src/dialogs.h file | annotate | diff | comparison | revisions
src/docs.cpp file | annotate | diff | comparison | revisions
src/extprogs.cpp file | annotate | diff | comparison | revisions
src/file.cpp file | annotate | diff | comparison | revisions
src/gldraw.cpp file | annotate | diff | comparison | revisions
src/gldraw.h file | annotate | diff | comparison | revisions
src/gui.cpp file | annotate | diff | comparison | revisions
src/gui_actions.cpp file | annotate | diff | comparison | revisions
src/gui_editactions.cpp file | annotate | diff | comparison | revisions
src/history.cpp file | annotate | diff | comparison | revisions
src/history.h file | annotate | diff | comparison | revisions
src/labeledwidget.h file | annotate | diff | comparison | revisions
src/ldconfig.cpp file | annotate | diff | comparison | revisions
src/ldconfig.h file | annotate | diff | comparison | revisions
src/ldtypes.cpp file | annotate | diff | comparison | revisions
src/ldtypes.h file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
src/messagelog.cpp file | annotate | diff | comparison | revisions
src/messagelog.h file | annotate | diff | comparison | revisions
src/misc.cpp file | annotate | diff | comparison | revisions
src/misc.h file | annotate | diff | comparison | revisions
src/primitives.cpp file | annotate | diff | comparison | revisions
src/primitives.h file | annotate | diff | comparison | revisions
src/types.cpp file | annotate | diff | comparison | revisions
src/types.h file | annotate | diff | comparison | revisions
src/widgets.cpp file | annotate | diff | comparison | revisions
src/widgets.h file | annotate | diff | comparison | revisions
--- a/src/aboutDialog.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/aboutDialog.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -23,25 +23,24 @@
 #include "ui_about.h"
 #include "gui.h"
 
-AboutDialog::AboutDialog( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f )
-{
+AboutDialog::AboutDialog (QWidget* parent, Qt::WindowFlags f) :
+	QDialog (parent, f) {
+	
 	Ui::AboutUI ui;
-	ui.setupUi( this );
-	
-	ui.versionInfo->setText( fmt( tr( "LDForge %1" ), fullVersionString() ));
+	ui.setupUi (this);
+	ui.versionInfo->setText (fmt (tr ("LDForge %1"), fullVersionString()));
 	
 	QPushButton* mailButton = new QPushButton;
-	mailButton->setText( "Contact" );
-	mailButton->setIcon( getIcon( "mail" ));
-	ui.buttonBox->addButton( static_cast<QAbstractButton*>( mailButton ), QDialogButtonBox::HelpRole );
-	connect( ui.buttonBox, SIGNAL( helpRequested() ), this, SLOT( slot_mail() ));
+	mailButton->setText ("Contact");
+	mailButton->setIcon (getIcon ("mail"));
+	ui.buttonBox->addButton (static_cast<QAbstractButton*> (mailButton), QDialogButtonBox::HelpRole);
+	connect (ui.buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_mail()));
 	
-	setWindowTitle( "About " APPNAME );
+	setWindowTitle ("About " APPNAME);
 }
 
-void AboutDialog::slot_mail()
-{
-	QDesktopServices::openUrl( QUrl( "mailto:Santeri Piippo <arezey@gmail.com>?subject=LDForge" ));
+void AboutDialog::slot_mail() {
+	QDesktopServices::openUrl (QUrl ("mailto:Santeri Piippo <arezey@gmail.com>?subject=LDForge"));
 }
 
 #include "build/moc_aboutDialog.cpp"
\ No newline at end of file
--- a/src/aboutDialog.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/aboutDialog.h	Fri Aug 02 16:33:30 2013 +0300
@@ -25,15 +25,14 @@
 
 class QPushButton;
 
-class AboutDialog : public QDialog
-{
+class AboutDialog : public QDialog {
 	Q_OBJECT
 	
 public:
-	AboutDialog( QWidget* parent = null, Qt::WindowFlags f = 0 );
+	AboutDialog (QWidget* parent = null, Qt::WindowFlags f = 0);
 	
 private slots:
 	void slot_mail();
 };
 
-#endif // ZZ_ABOUTDIALOG_H
+#endif // ZZ_ABOUTDIALOG_H
\ No newline at end of file
--- a/src/addObjectDialog.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/addObjectDialog.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -52,7 +52,7 @@
 	setlocale (LC_ALL, "C");
 	
 	short coordCount = 0;
-	str typeName = LDObject::typeName( type );
+	str typeName = LDObject::typeName (type);
 	
 	switch (type) {
 	case LDObject::Comment:
@@ -104,12 +104,12 @@
 			while (primitiveLoaderBusy())
 				;
 			
-			tw_subfileList = new QTreeWidget ();
+			tw_subfileList = new QTreeWidget();
 			tw_subfileList->setHeaderLabel (tr ("Primitives"));
 			
 			for (PrimitiveCategory& cat : g_PrimitiveCategories) {
 				SubfileListItem* parentItem = new SubfileListItem (tw_subfileList, null);
-				parentItem->setText (0, cat.name ());
+				parentItem->setText (0, cat.name());
 				QList<QTreeWidgetItem*> subfileItems;
 				
 				for (Primitive& prim : cat.prims) {
@@ -119,21 +119,21 @@
 					
 					// If this primitive is the one the current object points to,
 					// select it by default
-					if (obj && static_cast<LDSubfileObject*> (obj)->fileInfo ()->name () == prim.name)
+					if (obj && static_cast<LDSubfileObject*> (obj)->fileInfo()->name() == prim.name)
 						tw_subfileList->setCurrentItem (item);
 				}
 				
 				tw_subfileList->addTopLevelItem (parentItem);
 			}
 			
-			connect (tw_subfileList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_subfileTypeChanged ()));
+			connect (tw_subfileList, SIGNAL (itemSelectionChanged()), this, SLOT (slot_subfileTypeChanged()));
 			lb_subfileName = new QLabel ("File:");
 			le_subfileName = new QLineEdit;
-			le_subfileName->setFocus ();
+			le_subfileName->setFocus();
 			
 			if (obj) {
 				LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj);
-				le_subfileName->setText (ref->fileInfo ()->name ());
+				le_subfileName->setText (ref->fileInfo()->name());
 			}
 			break;
 		}
@@ -150,15 +150,15 @@
 	lb_typeIcon->setPixmap (icon);
 	
 	// Show a color edit dialog for the types that actually use the color
-	if (defaults->isColored ()) {
+	if (defaults->isColored()) {
 		if (obj != null)
-			colnum = obj->color ();
+			colnum = obj->color();
 		else
 			colnum = (type == LDObject::CondLine || type == LDObject::Line) ? edgecolor : maincolor;
 		
 		pb_color = new QPushButton;
 		setButtonBackground (pb_color, colnum);
-		connect (pb_color, SIGNAL (clicked ()), this, SLOT (slot_colorButtonClicked ()));
+		connect (pb_color, SIGNAL (clicked()), this, SLOT (slot_colorButtonClicked()));
 	}
 	
 	for (short i = 0; i < coordCount; ++i) {
@@ -202,7 +202,7 @@
 		break;
 	}
 	
-	if (defaults->hasMatrix ()) {
+	if (defaults->hasMatrix()) {
 		LDMatrixObject* mo = obj ? dynamic_cast<LDMatrixObject*> (obj) : null;
 		
 		QLabel* lb_matrix = new QLabel ("Matrix:");
@@ -212,17 +212,17 @@
 		
 		if (mo) {
 			for (const Axis ax : g_Axes)
-				dsb_coords[ax]->setValue (mo->position ()[ax]);
+				dsb_coords[ax]->setValue (mo->position()[ax]);
 			
-			defaultMatrix = mo->transform ();
+			defaultMatrix = mo->transform();
 		}
 		
-		le_matrix->setText (defaultMatrix.stringRep ());
+		le_matrix->setText (defaultMatrix.stringRep());
 		layout->addWidget (lb_matrix, 4, 1);
 		layout->addWidget (le_matrix, 4, 2, 1, 3);
 	}
 	
-	if (defaults->isColored ())
+	if (defaults->isColored())
 		layout->addWidget (pb_color, 1, 0);
 	
 	if (coordCount > 0) {
@@ -249,31 +249,31 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 void AddObjectDialog::setButtonBackground (QPushButton* button, short colnum) {
-	LDColor* col = getColor ( colnum );
+	LDColor* col = getColor (colnum);
 	
 	button->setIcon (getIcon ("palette"));
 	button->setAutoFillBackground (true);
 	
-	if( col )
+	if (col)
 		button->setStyleSheet (fmt ("background-color: %1", col->hexcode));
 }
 
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-str AddObjectDialog::currentSubfileName () {
-	SubfileListItem* item = static_cast<SubfileListItem*> (tw_subfileList->currentItem ());
+str AddObjectDialog::currentSubfileName() {
+	SubfileListItem* item = static_cast<SubfileListItem*> (tw_subfileList->currentItem());
 	
-	if (item->primInfo () == null)
+	if (item->primInfo() == null)
 		return ""; // selected a heading
 	
-	return item->primInfo ()->name;
+	return item->primInfo()->name;
 }
 
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-void AddObjectDialog::slot_colorButtonClicked () {
+void AddObjectDialog::slot_colorButtonClicked() {
 	ColorSelector::getColor (colnum, colnum, this);
 	setButtonBackground (pb_color, colnum);
 }
@@ -281,10 +281,10 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-void AddObjectDialog::slot_subfileTypeChanged () {
-	str name = currentSubfileName ();
+void AddObjectDialog::slot_subfileTypeChanged() {
+	str name = currentSubfileName();
 	
-	if (name.length () > 0)
+	if (name.length() > 0)
 		le_subfileName->setText (name);
 }
 
@@ -302,31 +302,32 @@
 void AddObjectDialog::staticDialog (const LDObject::Type type, LDObject* obj) {
 	setlocale (LC_ALL, "C");
 	
-	if (obj && obj->getType () == LDObject::Error)
+	// FIXME: Redirect to Edit Raw
+	if (obj && obj->getType() == LDObject::Error)
 		return;
 	
 	if (type == LDObject::Empty)
 		return; // Nothing to edit with empties
 	
 	const bool newObject = (obj == null);
+	matrix transform = g_identity;
 	AddObjectDialog dlg (type, obj);
 	
 	if (obj)
-		assert (obj->getType () == type);
+		assert (obj->getType() == type);
 	
-	if (dlg.exec () == false)
+	if (dlg.exec() == false)
 		return;
 	
-	matrix transform = g_identity;
-	if( type == LDObject::Subfile ) {
-		List<str> matrixstrvals = container_cast<QStringList, List<str>> (str (dlg.le_matrix->text ()).split (" "));
+	if (type == LDObject::Subfile) {
+		List<str> matrixstrvals = container_cast<QStringList, List<str>> (str (dlg.le_matrix->text()).split (" "));
 		
-		if (matrixstrvals.size () == 9) {
+		if (matrixstrvals.size() == 9) {
 			double matrixvals[9];
 			int i = 0;
 			
 			for (str val : matrixstrvals)
-				matrixvals[i++] = val.toFloat ();
+				matrixvals[i++] = val.toFloat();
 			
 			transform = matrix (matrixvals);
 		}
@@ -336,7 +337,7 @@
 	case LDObject::Comment:
 		{
 			LDCommentObject* comm = initObj<LDCommentObject> (obj);
-			comm->text = dlg.le_comment->text ();
+			comm->text = dlg.le_comment->text();
 		}
 		break;
 	
@@ -347,10 +348,10 @@
 		if (!obj)
 			obj = LDObject::getDefault (type);
 		
-		for (short i = 0; i < obj->vertices (); ++i) {
+		for (short i = 0; i < obj->vertices(); ++i) {
 			vertex v;
 			for (const Axis ax : g_Axes)
-				v[ax] = dlg.dsb_coords[(i * 3) + ax]->value ();
+				v[ax] = dlg.dsb_coords[(i * 3) + ax]->value();
 			
 			obj->setVertex (i, v);
 		}
@@ -359,7 +360,7 @@
 	case LDObject::BFC:
 		{
 			LDBFCObject* bfc = initObj<LDBFCObject> (obj);
-			bfc->type = (LDBFCObject::Type) dlg.rb_bfcType->value ();
+			bfc->type = (LDBFCObject::Type) dlg.rb_bfcType->value();
 		}
 		break;
 	
@@ -368,14 +369,14 @@
 			LDVertexObject* vert = initObj<LDVertexObject> (obj);
 			
 			for (const Axis ax : g_Axes)
-				vert->pos[ax] = dlg.dsb_coords[ax]->value ();
+				vert->pos[ax] = dlg.dsb_coords[ax]->value();
 		}
 		break;
 	
 	case LDObject::Subfile:
 		{
-			str name = dlg.le_subfileName->text ();
-			if (name.length () == 0)
+			str name = dlg.le_subfileName->text();
+			if (name.length() == 0)
 				return; // no subfile filename
 			
 			LDFile* file = getFile (name);
@@ -387,7 +388,7 @@
 			LDSubfileObject* ref = initObj<LDSubfileObject> (obj);
 			
 			for (const Axis ax : g_Axes)
-				ref->setCoordinate (ax, dlg.dsb_coords[ax]->value ());
+				ref->setCoordinate (ax, dlg.dsb_coords[ax]->value());
 			
 			ref->setTransform (transform);
 			ref->setFileInfo (file);
@@ -398,15 +399,15 @@
 		break;
 	}
 	
-	if (obj->isColored ())
+	if (obj->isColored())
 		obj->setColor (dlg.colnum);
 	
 	if (newObject) {
-		ulong idx = g_win->getInsertionPoint ();
+		ulong idx = g_win->getInsertionPoint();
 		LDFile::current()->insertObj (idx, obj);
 	}
 	
-	g_win->fullRefresh ();
+	g_win->fullRefresh();
 }
 
 #include "build/moc_addObjectDialog.cpp"
\ No newline at end of file
--- a/src/addObjectDialog.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/addObjectDialog.h	Fri Aug 02 16:33:30 2013 +0300
@@ -60,13 +60,13 @@
 	
 private:
 	void setButtonBackground (QPushButton* button, short color);
-	str currentSubfileName ();
+	str currentSubfileName();
 	
 	short colnum;
 	
 private slots:
-	void slot_colorButtonClicked ();
-	void slot_subfileTypeChanged ();
+	void slot_colorButtonClicked();
+	void slot_subfileTypeChanged();
 };
 
 #endif // ZZ_ADDOBJECTDIALOG_H
\ No newline at end of file
--- a/src/colorSelectDialog.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/colorSelectDialog.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -162,6 +162,7 @@
 		m_firstResize = false;
 	}
 	
+	(void) ev;
 	drawScene();
 }
 
@@ -171,8 +172,8 @@
 void ColorSelector::mousePressEvent (QMouseEvent* event) {
 	QPointF scenepos = ui->viewport->mapToScene (event->pos());
 	
-	ulong x = ( (ulong) scenepos.x() - (g_squareSize / 2)) / g_squareSize;
-	ulong y = ( (ulong) scenepos.y() - (g_squareSize / 2)) / g_squareSize;
+	ulong x = ((ulong) scenepos.x() - (g_squareSize / 2)) / g_squareSize;
+	ulong y = ((ulong) scenepos.y() - (g_squareSize / 2)) / g_squareSize;
 	ulong idx = (y * g_numColumns) + x;
 	
 	LDColor* col = ::getColor (idx);
--- a/src/colorSelectDialog.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/colorSelectDialog.h	Fri Aug 02 16:33:30 2013 +0300
@@ -26,19 +26,18 @@
 class Ui_ColorSelUI;
 class QGraphicsScene;
 
-class ColorSelector : public QDialog
-{
+class ColorSelector : public QDialog {
 	Q_OBJECT
-	READ_PROPERTY( LDColor*, sel, setSelection )
+	READ_PROPERTY (LDColor*, sel, setSelection)
 	
 public:
-	explicit ColorSelector( short defval = -1, QWidget* parent = null );
+	explicit ColorSelector (short defval = -1, QWidget* parent = null);
 	virtual ~ColorSelector();
-	static bool getColor( short& val, short defval = -1, QWidget* parent = null );
+	static bool getColor (short& val, short defval = -1, QWidget* parent = null);
 	
 protected:
-	void mousePressEvent( QMouseEvent* event );
-	void resizeEvent( QResizeEvent* ev );
+	void mousePressEvent (QMouseEvent* event);
+	void resizeEvent (QResizeEvent* ev);
 	
 private:
 	Ui_ColorSelUI* ui;
@@ -51,4 +50,4 @@
 	void drawColorInfo();
 };
 
-#endif // COLORSELECTOR_H
+#endif // COLORSELECTOR_H
\ No newline at end of file
--- a/src/colors.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/colors.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -27,9 +27,8 @@
 static LDColor* g_LDColors[MAX_COLORS];
 
 void initColors() {
-	print( "%1: initializing color information.\n", __func__ );
-	
 	LDColor* col;
+	print ("%1: initializing color information.\n", __func__);
 	
 	// Always make sure there's 16 and 24 available. They're special like that.
 	col = new LDColor;
@@ -48,9 +47,9 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-LDColor* getColor( short colnum ) {
+LDColor* getColor (short colnum) {
 	// Check bounds
-	if( colnum < 0 || colnum >= MAX_COLORS )
+	if (colnum < 0 || colnum >= MAX_COLORS)
 		return null;
 	
 	return g_LDColors[colnum];
@@ -58,17 +57,16 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void setColor( short colnum, LDColor* col ) {
-	if( colnum < 0 || colnum >= MAX_COLORS )
+void setColor (short colnum, LDColor* col) {
+	if (colnum < 0 || colnum >= MAX_COLORS)
 		return;
 	
 	g_LDColors[colnum] = col;
 }
 
 // =============================================================================
-uchar luma( QColor& col )
-{
-	return ( 0.2126f * col.red()) +
-	       ( 0.7152f * col.green()) +
-	       ( 0.0722f * col.blue() );
+uchar luma (QColor& col) {
+	return (0.2126f * col.red()) +
+	       (0.7152f * col.green()) +
+	       (0.0722f * col.blue());
 }
\ No newline at end of file
--- a/src/colors.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/colors.h	Fri Aug 02 16:33:30 2013 +0300
@@ -36,7 +36,7 @@
 
 // Safely gets a color with the given number or null if no such color.
 LDColor* getColor (short colnum);
-void setColor( short colnum, LDColor* col );
+void setColor (short colnum, LDColor* col);
 
 // Main and edge color identifiers
 static const short maincolor = 16;
--- a/src/common.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/common.h	Fri Aug 02 16:33:30 2013 +0300
@@ -61,9 +61,9 @@
 void doDevf (const char* func, const char* fmtstr, ...);
 
 // Version string identifier
-const char* versionString ();
-const char* versionMoniker ();
-const char* fullVersionString ();
+const char* versionString();
+const char* versionMoniker();
+const char* fullVersionString();
 
 // Null pointer
 static const std::nullptr_t null = nullptr;
@@ -91,7 +91,7 @@
 #define PROP_NAME(GET) m_##GET
 
 #define READ_ACCESSOR(T, GET) \
-	T const& GET () const
+	T const& GET() const
 
 #define SET_ACCESSOR(T, SET) \
 	void SET (T val)
@@ -133,13 +133,13 @@
 
 // Property whose set accessor is a public slot
 // TODO: make this replace PROPERTY
-#define SLOT_PROPERTY( T, GET, SET ) \
+#define SLOT_PROPERTY (T, GET, SET) \
 private: \
-	T PROP_NAME( GET ); \
+	T PROP_NAME (GET); \
 public: \
-	READ_ACCESSOR( T, GET ) { return PROP_NAME (GET); } \
+	READ_ACCESSOR (T, GET) { return PROP_NAME (GET); } \
 public slots: \
-	SET_ACCESSOR( T, SET ) { PROP_NAME (GET) = val; }
+	SET_ACCESSOR (T, SET) { PROP_NAME (GET) = val; }
 
 #ifdef null
 #undef null
--- a/src/config.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/config.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -30,86 +30,79 @@
 
 // =============================================================================
 // Load the configuration from file
-bool config::load()
-{
-	print( "config::load: Loading configuration file...\n" );
-	print( "config::load: Path to configuration is %1\n", filepath() );
-	
+bool config::load() {
+	print ("config::load: Loading configuration file...\n");
+	print ("config::load: Path to configuration is %1\n", filepath());
+
 	// Locale must be disabled for atof
-	setlocale( LC_NUMERIC, "C" );
-	
-	File f( filepath(), File::Read );
+	setlocale (LC_NUMERIC, "C");
+
+	File f (filepath(), File::Read);
 	int ln = 0;
-	
-	if( !f )
+
+	if (!f)
 		return false;
-	
+
 	// Read the values.
-	for( str line : f )
-	{
+for (str line : f) {
 		ln++;
-		
-		if( line.isEmpty() || line[0] == '#' )
+
+		if (line.isEmpty() || line[0] == '#')
 			continue; // Empty line or comment.
-		
+
 		// Find the equals sign.
-		int equals = line.indexOf( '=' );
+		int equals = line.indexOf ('=');
 		
-		if( equals == -1 )
-		{
-			fprint( stderr, "couldn't find `=` sign in entry `%1`\n", line );
+		if (equals == -1) {
+			fprint (stderr, "couldn't find `=` sign in entry `%1`\n", line);
 			continue;
 		}
 		
-		str entry = line.left( equals );
-		str valstring = line.right( line.length() - equals - 1 );
+		str entry = line.left (equals);
+		str valstring = line.right (line.length() - equals - 1);
 		
 		// Find the config entry for this.
 		config* cfg = null;
 		
-		for( config* i : g_configPointers )
-		{
-			if( !i )
+		for (config* i : g_configPointers) {
+			if (!i)
 				break;
 			
-			if( entry == i->name )
+			if (entry == i->name)
 				cfg = i;
 		}
 		
-		if( !cfg )
-		{
-			fprint( stderr, "unknown config `%1`\n", entry );
+		if (!cfg) {
+			fprint (stderr, "unknown config `%1`\n", entry);
 			continue;
 		}
 		
-		switch( cfg->getType() )
-		{
+		switch (cfg->getType()) {
 		case Type_int:
-			static_cast<intconfig*>( cfg )->value = valstring.toInt();
+			static_cast<intconfig*> (cfg)->value = valstring.toInt();
 			break;
 		
 		case Type_str:
-			static_cast<strconfig*>( cfg )->value = valstring;
+			static_cast<strconfig*> (cfg)->value = valstring;
 			break;
 		
 		case Type_float:
-			static_cast<floatconfig*>( cfg )->value = valstring.toFloat();
+			static_cast<floatconfig*> (cfg)->value = valstring.toFloat();
 			break;
 		
-		case Type_bool:
-		{
-			bool& val = static_cast<boolconfig*>( cfg )->value;
+		case Type_bool: {
+			bool& val = static_cast<boolconfig*> (cfg)->value;
 			
-			if( valstring.toUpper() == "TRUE" || valstring == "1" )
+			if (valstring.toUpper() == "TRUE" || valstring == "1")
 				val = true;
-			elif( valstring.toUpper() == "FALSE" || valstring == "0" )
+			elif (valstring.toUpper() == "FALSE" || valstring == "0")
 				val = false;
 			
 			break;
 		}
 		
 		case Type_keyseq:
-			static_cast<keyseqconfig*>( cfg )->value = keyseq::fromString( valstring );
+			static_cast<keyseqconfig*> (cfg)->value = keyseq::fromString (valstring);
 			break;
 		
 		default:
@@ -121,70 +114,63 @@
 	return true;
 }
 
-extern_cfg( str, io_ldpath );
+extern_cfg (str, io_ldpath);
 
 // =============================================================================
 // Save the configuration to disk
-bool config::save()
-{
+bool config::save() {
 	// The function will write floats, disable the locale now so that they
 	// are written properly.
-	setlocale( LC_NUMERIC, "C" );
+	setlocale (LC_NUMERIC, "C");
 	
 	// If the directory doesn't exist, create it now.
-	if( QDir( dirpath() ).exists() == false )
-	{
-		fprint( stderr, "Creating config path %1...\n", dirpath() );
+	if (QDir (dirpath()).exists() == false) {
+		fprint (stderr, "Creating config path %1...\n", dirpath());
 		
-		if( !QDir().mkpath( dirpath() ))
-		{
-			critical( "Failed to create the configuration directory. Configuration cannot be saved!\n" );
+		if (!QDir().mkpath (dirpath())) {
+			critical ("Failed to create the configuration directory. Configuration cannot be saved!\n");
 			return false;
 		}
 	}
 	
-	File f( filepath(), File::Write );
-	print( "writing cfg to %1\n", filepath() );
+	File f (filepath(), File::Write);
+	print ("writing cfg to %1\n", filepath());
 	
-	if( !f )
-	{
-		critical( fmt( QObject::tr( "Cannot save configuration, cannot open %1 for writing: %2\n" ),
-			filepath(), strerror( errno )) );
+	if (!f) {
+		critical (fmt (QObject::tr ("Cannot save configuration, cannot open %1 for writing: %2\n"),
+			filepath(), strerror (errno)));
 		return false;
 	}
 	
-	fprint( f, "# Configuration file for " APPNAME "\n" );
+	fprint (f, "# Configuration file for " APPNAME "\n");
+	str valstring;
 	
-	for( config * cfg : g_configPointers )
-	{
-		if( !cfg )
+	for (config* cfg : g_configPointers) {
+		if (!cfg)
 			break;
 		
-		if( cfg->isDefault() )
+		if (cfg->isDefault())
 			continue;
 		
-		str valstring;
-		
-		switch( cfg->getType() )
-		{
+		switch (cfg->getType()) {
 		case Type_int:
-			valstring = fmt( "%1", static_cast<intconfig*>( cfg )->value );
+			valstring = fmt ("%1", static_cast<intconfig*> (cfg)->value);
 			break;
 		
 		case Type_str:
-			valstring = static_cast<strconfig*>( cfg )->value;
+			valstring = static_cast<strconfig*> (cfg)->value;
 			break;
 		
 		case Type_float:
-			valstring = fmt( "%1", static_cast<floatconfig*>( cfg )->value );
+			valstring = fmt ("%1", static_cast<floatconfig*> (cfg)->value);
 			break;
 		
 		case Type_bool:
-			valstring = ( static_cast<boolconfig*>( cfg )->value ) ? "true" : "false";
+			valstring = (static_cast<boolconfig*> (cfg)->value) ? "true" : "false";
 			break;
 		
 		case Type_keyseq:
-			valstring = static_cast<keyseqconfig*>( cfg )->value.toString();
+			valstring = static_cast<keyseqconfig*> (cfg)->value.toString();
 			break;
 		
 		default:
@@ -192,7 +178,7 @@
 		}
 		
 		// Write the entry now.
-		fprint( f, "%1=%2\n", cfg->name, valstring );
+		fprint (f, "%1=%2\n", cfg->name, valstring);
 	}
 	
 	f.close();
@@ -200,11 +186,9 @@
 }
 
 // =============================================================================
-void config::reset()
-{
-	for( config * cfg : g_configPointers )
-	{
-		if( !cfg )
+void config::reset() {
+	for (config* cfg : g_configPointers) {
+		if (!cfg)
 			break;
 		
 		cfg->resetValue();
@@ -212,29 +196,25 @@
 }
 
 // =============================================================================
-str config::filepath()
-{
-	str path = fmt( "%1%2.cfg", dirpath(),
-		str( APPNAME ).toLower() );
+str config::filepath() {
+	str path = fmt ("%1%2.cfg", dirpath(), str (APPNAME).toLower());
 	return path;
 }
 
 // =============================================================================
-str config::dirpath()
-{
+str config::dirpath() {
 #ifndef _WIN32
-	return fmt( "%1" DIRSLASH ".%2" DIRSLASH,
-				QDir::homePath(), str( APPNAME ).toLower() );
+	return fmt ("%1" DIRSLASH ".%2" DIRSLASH,
+		QDir::homePath(), str (APPNAME).toLower());
 #else
-	return fmt( "%1" DIRSLASH APPNAME DIRSLASH, QDir::homePath() );
+	return fmt ("%1" DIRSLASH APPNAME DIRSLASH, QDir::homePath());
 #endif // _WIN32
 }
 
-void addConfig( config* ptr )
-{
-	if( g_cfgPointerCursor == 0 )
-		memset( g_configPointers, 0, sizeof g_configPointers );
+void addConfig (config* ptr) {
+	if (g_cfgPointerCursor == 0)
+		memset (g_configPointers, 0, sizeof g_configPointers);
 	
-	assert( g_cfgPointerCursor < MAX_CONFIG );
+	assert (g_cfgPointerCursor < MAX_CONFIG);
 	g_configPointers[g_cfgPointerCursor++] = ptr;
-}
+}
\ No newline at end of file
--- a/src/config.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/config.h	Fri Aug 02 16:33:30 2013 +0300
@@ -31,15 +31,13 @@
 #define MAX_INI_LINE 512
 #define MAX_CONFIG 512
 
-#define cfg( T, NAME, DEFAULT ) T##config NAME (DEFAULT, #NAME)
-#define extern_cfg( T, NAME )   extern T##config NAME
+#define cfg(T, NAME, DEFAULT) T##config NAME (DEFAULT, #NAME)
+#define extern_cfg(T, NAME)   extern T##config NAME
 
 // =========================================================
-class config
-{
+class config {
 public:
-	enum Type
-	{
+	enum Type {
 		Type_none,
 		Type_int,
 		Type_str,
@@ -50,14 +48,12 @@
 
 	const char* name;
 
-	virtual Type getType() const
-	{
+	virtual Type getType() const {
 		return Type_none;
 	}
 
 	virtual void resetValue() {}
-	virtual bool isDefault() const
-	{
+	virtual bool isDefault() const {
 		return false;
 	}
 
@@ -69,165 +65,149 @@
 	static str filepath();
 };
 
-void addConfig( config* ptr );
+void addConfig (config* ptr);
 
 // =============================================================================
-#define DEFINE_UNARY_OPERATOR( T, OP ) \
-	T operator OP() \
-	{ \
+#define DEFINE_UNARY_OPERATOR(T, OP) \
+	T operator OP() { \
 		return OP value; \
 	} \
-
-#define DEFINE_BINARY_OPERATOR( T, OP ) \
-	T operator OP( const T other ) \
-	{ \
+	 
+#define DEFINE_BINARY_OPERATOR(T, OP) \
+	T operator OP (const T other) { \
 		return value OP other; \
 	} \
-
-#define DEFINE_ASSIGN_OPERATOR( T, OP ) \
-	T& operator OP( const T other ) \
-	{ \
+	 
+#define DEFINE_ASSIGN_OPERATOR(T, OP) \
+	T& operator OP (const T other) { \
 		return value OP other; \
 	} \
-
-#define DEFINE_COMPARE_OPERATOR( T, OP ) \
-	bool operator OP( const T other ) \
-	{ \
+	 
+#define DEFINE_COMPARE_OPERATOR(T, OP) \
+	bool operator OP (const T other) { \
 		return value OP other; \
 	} \
-
-#define DEFINE_CAST_OPERATOR( T ) \
-	operator T() \
-	{ \
+	 
+#define DEFINE_CAST_OPERATOR(T) \
+	operator T() { \
 		return (T) value; \
 	} \
 	 
-#define DEFINE_ALL_COMPARE_OPERATORS( T ) \
-	DEFINE_COMPARE_OPERATOR( T, == ) \
-	DEFINE_COMPARE_OPERATOR( T, != ) \
-	DEFINE_COMPARE_OPERATOR( T, > ) \
-	DEFINE_COMPARE_OPERATOR( T, < ) \
-	DEFINE_COMPARE_OPERATOR( T, >= ) \
-	DEFINE_COMPARE_OPERATOR( T, <= ) \
+#define DEFINE_ALL_COMPARE_OPERATORS(T) \
+	DEFINE_COMPARE_OPERATOR (T, ==) \
+	DEFINE_COMPARE_OPERATOR (T, !=) \
+	DEFINE_COMPARE_OPERATOR (T, >) \
+	DEFINE_COMPARE_OPERATOR (T, <) \
+	DEFINE_COMPARE_OPERATOR (T, >=) \
+	DEFINE_COMPARE_OPERATOR (T, <=) \
 	 
-#define DEFINE_INCREMENT_OPERATORS( T ) \
+#define DEFINE_INCREMENT_OPERATORS(T) \
 	T operator++() { return ++value; } \
 	T operator++(int) { return value++; } \
 	T operator--() { return --value; } \
 	T operator--(int) { return value--; }
 
-#define CONFIGTYPE( T ) \
+#define CONFIGTYPE(T) \
 	class T##config : public config
 
-#define IMPLEMENT_CONFIG( T ) \
+#define IMPLEMENT_CONFIG(T) \
 	T value, defval; \
 	\
-	T##config (T _defval, const char* _name) \
-	{ \
+	T##config (T _defval, const char* _name) { \
 		value = defval = _defval; \
 		name = _name; \
-		addConfig( this ); \
+		addConfig (this); \
 	} \
-	operator const T&() const \
-	{ \
+	operator const T&() const { \
 		return value; \
 	} \
-	config::Type getType() const override \
-	{ \
+	config::Type getType() const override { \
 		return config::Type_##T; \
 	} \
-	virtual void resetValue() \
-	{ \
+	virtual void resetValue() { \
 		value = defval; \
 	} \
-	virtual bool isDefault() const \
-	{ \
+	virtual bool isDefault() const { \
 		return value == defval; \
 	}
 
 // =============================================================================
-CONFIGTYPE( int )
-{
+CONFIGTYPE (int) {
 public:
-	IMPLEMENT_CONFIG( int )
-	DEFINE_ALL_COMPARE_OPERATORS( int )
-	DEFINE_INCREMENT_OPERATORS( int )
-	DEFINE_BINARY_OPERATOR( int, + )
-	DEFINE_BINARY_OPERATOR( int, - )
-	DEFINE_BINARY_OPERATOR( int, * )
-	DEFINE_BINARY_OPERATOR( int, / )
-	DEFINE_BINARY_OPERATOR( int, % )
-	DEFINE_BINARY_OPERATOR( int, ^ )
-	DEFINE_BINARY_OPERATOR( int, | )
-	DEFINE_BINARY_OPERATOR( int, & )
-	DEFINE_BINARY_OPERATOR( int, >> )
-	DEFINE_BINARY_OPERATOR( int, << )
-	DEFINE_UNARY_OPERATOR( int, ! )
-	DEFINE_UNARY_OPERATOR( int, ~ )
-	DEFINE_UNARY_OPERATOR( int, - )
-	DEFINE_UNARY_OPERATOR( int, + )
-	DEFINE_ASSIGN_OPERATOR( int, = )
-	DEFINE_ASSIGN_OPERATOR( int, += )
-	DEFINE_ASSIGN_OPERATOR( int, -= )
-	DEFINE_ASSIGN_OPERATOR( int, *= )
-	DEFINE_ASSIGN_OPERATOR( int, /= )
-	DEFINE_ASSIGN_OPERATOR( int, %= )
-	DEFINE_ASSIGN_OPERATOR( int, >>= )
-	DEFINE_ASSIGN_OPERATOR( int, <<= )
+	IMPLEMENT_CONFIG (int)
+	DEFINE_ALL_COMPARE_OPERATORS (int)
+	DEFINE_INCREMENT_OPERATORS (int)
+	DEFINE_BINARY_OPERATOR (int, +)
+	DEFINE_BINARY_OPERATOR (int, -)
+	DEFINE_BINARY_OPERATOR (int, *)
+	DEFINE_BINARY_OPERATOR (int, /)
+	DEFINE_BINARY_OPERATOR (int, %)
+	DEFINE_BINARY_OPERATOR (int, ^)
+	DEFINE_BINARY_OPERATOR (int, |)
+	DEFINE_BINARY_OPERATOR (int, &)
+	DEFINE_BINARY_OPERATOR (int, >>)
+	DEFINE_BINARY_OPERATOR (int, <<)
+	DEFINE_UNARY_OPERATOR (int, !)
+	DEFINE_UNARY_OPERATOR (int, ~)
+	DEFINE_UNARY_OPERATOR (int, -)
+	DEFINE_UNARY_OPERATOR (int, +)
+	DEFINE_ASSIGN_OPERATOR (int, =)
+	DEFINE_ASSIGN_OPERATOR (int, +=)
+	DEFINE_ASSIGN_OPERATOR (int, -=)
+	DEFINE_ASSIGN_OPERATOR (int, *=)
+	DEFINE_ASSIGN_OPERATOR (int, /=)
+	DEFINE_ASSIGN_OPERATOR (int, %=)
+	DEFINE_ASSIGN_OPERATOR (int, >>=)
+	DEFINE_ASSIGN_OPERATOR (int, <<=)
 };
 
 // =============================================================================
-CONFIGTYPE( str )
-{
+CONFIGTYPE (str) {
 public:
-	IMPLEMENT_CONFIG( str )
+	IMPLEMENT_CONFIG (str)
 
-	DEFINE_COMPARE_OPERATOR( str, == )
-	DEFINE_COMPARE_OPERATOR( str, != )
-	DEFINE_ASSIGN_OPERATOR( str, = )
-	DEFINE_ASSIGN_OPERATOR( str, += )
+	DEFINE_COMPARE_OPERATOR (str, ==)
+	DEFINE_COMPARE_OPERATOR (str, !=)
+	DEFINE_ASSIGN_OPERATOR (str, =)
+	DEFINE_ASSIGN_OPERATOR (str, +=)
 	
-	qchar operator[]( int n )
-	{
+	qchar operator[] (int n) {
 		return value[n];
 	}
 };
 
 // =============================================================================
-CONFIGTYPE( float )
-{
+CONFIGTYPE (float) {
 public:
-	IMPLEMENT_CONFIG( float )
-	DEFINE_ALL_COMPARE_OPERATORS( float )
-	DEFINE_INCREMENT_OPERATORS( float )
-	DEFINE_BINARY_OPERATOR( float, + )
-	DEFINE_BINARY_OPERATOR( float, - )
-	DEFINE_BINARY_OPERATOR( float, * )
-	DEFINE_UNARY_OPERATOR( float, ! )
-	DEFINE_ASSIGN_OPERATOR( float, = )
-	DEFINE_ASSIGN_OPERATOR( float, += )
-	DEFINE_ASSIGN_OPERATOR( float, -= )
-	DEFINE_ASSIGN_OPERATOR( float, *= )
+	IMPLEMENT_CONFIG (float)
+	DEFINE_ALL_COMPARE_OPERATORS (float)
+	DEFINE_INCREMENT_OPERATORS (float)
+	DEFINE_BINARY_OPERATOR (float, +)
+	DEFINE_BINARY_OPERATOR (float, -)
+	DEFINE_BINARY_OPERATOR (float, *)
+	DEFINE_UNARY_OPERATOR (float, !)
+	DEFINE_ASSIGN_OPERATOR (float, =)
+	DEFINE_ASSIGN_OPERATOR (float, +=)
+	DEFINE_ASSIGN_OPERATOR (float, -=)
+	DEFINE_ASSIGN_OPERATOR (float, *=)
 };
 
 // =============================================================================
-CONFIGTYPE( bool )
-{
+CONFIGTYPE (bool) {
 public:
-	IMPLEMENT_CONFIG( bool )
-	DEFINE_ALL_COMPARE_OPERATORS( bool )
-	DEFINE_ASSIGN_OPERATOR( bool, = )
+	IMPLEMENT_CONFIG (bool)
+	DEFINE_ALL_COMPARE_OPERATORS (bool)
+	DEFINE_ASSIGN_OPERATOR (bool, =)
 };
 
 // =============================================================================
 typedef QKeySequence keyseq;
 
-CONFIGTYPE( keyseq )
-{
+CONFIGTYPE (keyseq) {
 public:
-	IMPLEMENT_CONFIG( keyseq )
-	DEFINE_ALL_COMPARE_OPERATORS( keyseq )
-	DEFINE_ASSIGN_OPERATOR( keyseq, = )
+	IMPLEMENT_CONFIG (keyseq)
+	DEFINE_ALL_COMPARE_OPERATORS (keyseq)
+	DEFINE_ASSIGN_OPERATOR (keyseq, =)
 };
 
-#endif // CONFIG_H
+#endif // CONFIG_H
\ No newline at end of file
--- a/src/configDialog.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/configDialog.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -55,7 +55,7 @@
 // =============================================================================
 ConfigDialog::ConfigDialog (ForgeWindow* parent) : QDialog (parent) {
 	ui = new Ui_ConfigUI;
-	ui->setupUi( this );
+	ui->setupUi (this);
 	
 	initMainTab();
 	initShortcutsTab();
@@ -84,9 +84,8 @@
 	connect (ui->mainColorButton, SIGNAL (clicked()),
 		this, SLOT (slot_setGLForeground()));
 	
-	ui->mainColorAlpha->setValue( gl_maincolor_alpha * 10.0f );
-	
 	// Sliders
+	ui->mainColorAlpha->setValue (gl_maincolor_alpha * 10.0f);
 	ui->lineThickness->setValue (gl_linethickness);
 	
 	// Checkboxes
@@ -106,7 +105,7 @@
 #define act(N) addShortcut (key_##N, ACTION(N), i);
 #include "actions.h"
 	
-	ui->shortcutsList->setSortingEnabled( true );
+	ui->shortcutsList->setSortingEnabled (true);
 	ui->shortcutsList->sortItems();
 	
 	connect (ui->shortcut_set, SIGNAL (clicked()), this, SLOT (slot_setShortcut()));
@@ -156,7 +155,7 @@
 		*anglabel = new QLabel ("Angle");
 	short i = 1;
 	
-	for (QLabel * label : initlist<QLabel*> ( { xlabel, ylabel, zlabel, anglabel })) {
+	for (QLabel* label : initlist<QLabel*> ({ xlabel, ylabel, zlabel, anglabel })) {
 		label->setAlignment (Qt::AlignCenter);
 		gridlayout->addWidget (label, 0, i++);
 	}
@@ -264,7 +263,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-void ConfigDialog::updateQuickColorList( LDQuickColor* sel ) {
+void ConfigDialog::updateQuickColorList (LDQuickColor* sel) {
 	for (QListWidgetItem* item : quickColorItems)
 		delete item;
 	
@@ -449,8 +448,8 @@
 {
 	QList<ShortcutListItem*> out;
 	
-	for( QListWidgetItem * entry : ui->shortcutsList->selectedItems() )
-		out << static_cast<ShortcutListItem*>( entry );
+	for (QListWidgetItem* entry : ui->shortcutsList->selectedItems())
+		out << static_cast<ShortcutListItem*> (entry);
 	
 	return out;
 }
--- a/src/configDialog.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/configDialog.h	Fri Aug 02 16:33:30 2013 +0300
@@ -27,19 +27,17 @@
 class QDoubleSpinBox;
 
 // =============================================================================
-class ShortcutListItem : public QListWidgetItem
-{
+class ShortcutListItem : public QListWidgetItem {
 	PROPERTY (keyseqconfig*, keyConfig, setKeyConfig)
 	PROPERTY (QAction*, action, setAction)
 	
 public:
-	explicit ShortcutListItem( QListWidget* view = null, int type = Type ) :
-		QListWidgetItem( view, type ) {}
+	explicit ShortcutListItem (QListWidget* view = null, int type = Type) :
+		QListWidgetItem (view, type) {}
 };
 
 // =============================================================================
-class ConfigDialog : public QDialog
-{
+class ConfigDialog : public QDialog {
 	Q_OBJECT
 	
 public:
@@ -51,7 +49,7 @@
 	
 	List<LDQuickColor> quickColors;
 	QDoubleSpinBox* dsb_gridData[3][4];
-
+	
 private:
 	Ui_ConfigUI* ui;
 	QLabel* lb_gridLabels[3];
@@ -64,15 +62,15 @@
 	void initGridTab();
 	void initExtProgTab();
 	void addShortcut (keyseqconfig& cfg, QAction* act, ulong& i);
-	void setButtonBackground( QPushButton* button, str value );
-	void pickColor( strconfig& cfg, QPushButton* button );
-	void updateQuickColorList( LDQuickColor* sel = null );
+	void setButtonBackground (QPushButton* button, str value);
+	void pickColor (strconfig& cfg, QPushButton* button);
+	void updateQuickColorList (LDQuickColor* sel = null);
 	void setShortcutText (ShortcutListItem* item);
-	int getItemRow( QListWidgetItem* item, List<QListWidgetItem*>& haystack );
+	int getItemRow (QListWidgetItem* item, List<QListWidgetItem*>& haystack);
 	str quickColorString();
 	QListWidgetItem* getSelectedQuickColor();
 	QList<ShortcutListItem*> getShortcutSelection();
-
+	
 private slots:
 	void slot_setGLBackground();
 	void slot_setGLForeground();
@@ -90,23 +88,22 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-class KeySequenceDialog : public QDialog
-{
+class KeySequenceDialog : public QDialog {
 	Q_OBJECT
 
 public:
-	explicit KeySequenceDialog( QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0 );
-	static bool staticDialog( keyseqconfig* cfg, QWidget* parent = null );
-
+	explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0);
+	static bool staticDialog (keyseqconfig* cfg, QWidget* parent = null);
+	
 	QLabel* lb_output;
 	QDialogButtonBox* bbx_buttons;
 	QKeySequence seq;
-
+	
 private:
 	void updateOutput();
-
+	
 private slots:
-	virtual void keyPressEvent( QKeyEvent* ev ) override;
+	virtual void keyPressEvent (QKeyEvent* ev) override;
 };
 
-#endif // CONFIGDIALOG_H
+#endif // CONFIGDIALOG_H
\ No newline at end of file
--- a/src/dialogs.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/dialogs.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -1,17 +1,17 @@
 /*
  *  LDForge: LDraw parts authoring CAD
  *  Copyright (C) 2013 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.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -42,10 +42,9 @@
 extern_cfg (str, io_ldpath);
 
 // =============================================================================
-OverlayDialog::OverlayDialog( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f )
-{
+OverlayDialog::OverlayDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
 	ui = new Ui_OverlayUI;
-	ui->setupUi( this );
+	ui->setupUi (this);
 	
 	m_cameraArgs = {
 		{ ui->top,    GL::Top },
@@ -58,215 +57,185 @@
 	
 	GL::Camera cam = g_win->R()->camera();
 	
-	if( cam == GL::Free )
+	if (cam == GL::Free)
 		cam = GL::Top;
 	
-	connect( ui->width, SIGNAL( valueChanged( double )), this, SLOT( slot_dimensionsChanged() ));
-	connect( ui->height, SIGNAL( valueChanged( double )), this, SLOT( slot_dimensionsChanged() ));
-	connect( ui->buttonBox, SIGNAL( helpRequested() ), this, SLOT( slot_help() ));
-	connect( ui->fileSearchButton, SIGNAL( clicked( bool )), this, SLOT( slot_fpath() ));
+	connect (ui->width, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
+	connect (ui->height, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
+	connect (ui->buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_help()));
+	connect (ui->fileSearchButton, SIGNAL (clicked (bool)), this, SLOT (slot_fpath()));
 	
 	slot_dimensionsChanged();
-	fillDefaults( cam );
+	fillDefaults (cam);
 }
 
-OverlayDialog::~OverlayDialog()
-{
+OverlayDialog::~OverlayDialog() {
 	delete ui;
 }
 
-void OverlayDialog::fillDefaults( int newcam )
-{
-	overlayMeta& info = g_win->R()->getOverlay( newcam );
-	
-	radioDefault<int>( newcam, m_cameraArgs );
+void OverlayDialog::fillDefaults (int newcam) {
+	overlayMeta& info = g_win->R()->getOverlay (newcam);
+	radioDefault<int> (newcam, m_cameraArgs);
 	
-	if( info.img != null )
-	{
-		ui->filename->setText( info.fname );
-		ui->originX->setValue( info.ox );
-		ui->originY->setValue( info.oy );
-		ui->width->setValue( info.lw );
-		ui->height->setValue( info.lh );
-	}
-	else
-	{
-		ui->filename->setText( "" );
-		ui->originX->setValue( 0 );
-		ui->originY->setValue( 0 );
-		ui->width->setValue( 0.0f );
-		ui->height->setValue( 0.0f );
+	if (info.img != null) {
+		ui->filename->setText (info.fname);
+		ui->originX->setValue (info.ox);
+		ui->originY->setValue (info.oy);
+		ui->width->setValue (info.lw);
+		ui->height->setValue (info.lh);
+	} else {
+		ui->filename->setText ("");
+		ui->originX->setValue (0);
+		ui->originY->setValue (0);
+		ui->width->setValue (0.0f);
+		ui->height->setValue (0.0f);
 	}
 }
 
-str OverlayDialog::fpath() const
-{
+str OverlayDialog::fpath() const {
 	return ui->filename->text();
 }
 
-ushort OverlayDialog::ofsx() const
-{
+ushort OverlayDialog::ofsx() const {
 	return ui->originX->value();
 }
 
-ushort OverlayDialog::ofsy() const
-{
+ushort OverlayDialog::ofsy() const {
 	return ui->originY->value();
 }
 
-double OverlayDialog::lwidth() const
-{
+double OverlayDialog::lwidth() const {
 	return ui->width->value();
 }
 
-double OverlayDialog::lheight() const
-{
+double OverlayDialog::lheight() const {
 	return ui->height->value();
 }
 
-int OverlayDialog::camera() const
-{
-	return radioSwitch<int>( GL::Top, m_cameraArgs );
+int OverlayDialog::camera() const {
+	return radioSwitch<int> (GL::Top, m_cameraArgs);
 }
 
-void OverlayDialog::slot_fpath()
-{
-	ui->filename->setText( QFileDialog::getOpenFileName( null, "Overlay image" ));
+void OverlayDialog::slot_fpath() {
+	ui->filename->setText (QFileDialog::getOpenFileName (null, "Overlay image"));
 }
 
-void OverlayDialog::slot_help()
-{
-	showDocumentation( g_docs_overlays );
+void OverlayDialog::slot_help() {
+	showDocumentation (g_docs_overlays);
 }
 
-void OverlayDialog::slot_dimensionsChanged()
-{
-	bool enable = ( ui->width->value() != 0 ) || (  ui->height->value() != 0 );
-	ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( enable );
+void OverlayDialog::slot_dimensionsChanged() {
+	bool enable = (ui->width->value() != 0) || (ui->height->value() != 0);
+	ui->buttonBox->button (QDialogButtonBox::Ok)->setEnabled (enable);
 }
 
 // =================================================================================================
-LDrawPathDialog::LDrawPathDialog( const bool validDefault, QWidget* parent, Qt::WindowFlags f )
-	: QDialog( parent, f ), m_validDefault( validDefault )
-{
-	ui = new Ui_LDPathUI;
-	ui->setupUi( this );
-	ui->status->setText( "---" );
+LDrawPathDialog::LDrawPathDialog (const bool validDefault, QWidget* parent, Qt::WindowFlags f) :
+	QDialog (parent, f),
+	m_validDefault (validDefault) {
 	
-	if( validDefault )
+	ui = new Ui_LDPathUI;
+	ui->setupUi (this);
+	ui->status->setText ("---");
+	
+	if (validDefault)
 		ui->heading->hide();
-	else
-	{
-		cancelButton()->setText( "Exit" );
-		cancelButton()->setIcon( getIcon( "exit" ));
+	else {
+		cancelButton()->setText ("Exit");
+		cancelButton()->setIcon (getIcon ("exit"));
 	}
 	
-	okButton()->setEnabled( false );
+	okButton()->setEnabled (false);
 	
-	connect( ui->path, SIGNAL( textEdited( QString ) ), this, SLOT( slot_tryConfigure() ) );
-	connect( ui->searchButton, SIGNAL( clicked() ), this, SLOT( slot_findPath() ) );
-	connect( ui->buttonBox, SIGNAL( rejected() ), this, validDefault ? SLOT( reject() ) : SLOT( slot_exit() ));
+	connect (ui->path, SIGNAL (textEdited (QString)), this, SLOT (slot_tryConfigure()));
+	connect (ui->searchButton, SIGNAL (clicked()), this, SLOT (slot_findPath()));
+	connect (ui->buttonBox, SIGNAL (rejected()), this, validDefault ? SLOT (reject()) : SLOT (slot_exit()));
 	
-	setPath( io_ldpath );
+	setPath (io_ldpath);
 	
-	if( validDefault )
+	if (validDefault)
 		slot_tryConfigure();
 }
 
-LDrawPathDialog::~LDrawPathDialog()
-{
+LDrawPathDialog::~LDrawPathDialog() {
 	delete ui;
 }
 
-QPushButton* LDrawPathDialog::okButton()
-{
-	return ui->buttonBox->button( QDialogButtonBox::Ok );
+QPushButton* LDrawPathDialog::okButton() {
+	return ui->buttonBox->button (QDialogButtonBox::Ok);
 }
 
-QPushButton* LDrawPathDialog::cancelButton()
-{
-	return ui->buttonBox->button( QDialogButtonBox::Cancel );
+QPushButton* LDrawPathDialog::cancelButton() {
+	return ui->buttonBox->button (QDialogButtonBox::Cancel);
 }
 
-void LDrawPathDialog::setPath( str path )
-{
-	ui->path->setText( path );
+void LDrawPathDialog::setPath (str path) {
+	ui->path->setText (path);
 }
 
-str LDrawPathDialog::filename() const
-{
+str LDrawPathDialog::filename() const {
 	return ui->path->text();
 }
 
-void LDrawPathDialog::slot_findPath()
-{
-	str newpath = QFileDialog::getExistingDirectory( this, "Find LDraw Path" );
-
-	if( newpath.length() > 0 && newpath != filename() )
-	{
-		setPath( newpath );
+void LDrawPathDialog::slot_findPath() {
+	str newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
+	
+	if (newpath.length() > 0 && newpath != filename()) {
+		setPath (newpath);
 		slot_tryConfigure();
 	}
 }
 
-void LDrawPathDialog::slot_exit()
-{
-	exit( 1 );
+void LDrawPathDialog::slot_exit() {
+	exit (1);
 }
 
-void LDrawPathDialog::slot_tryConfigure()
-{
-	if( LDPaths::tryConfigure( filename() ) == false )
-	{
-		ui->status->setText( fmt( "<span style=\"color:#700; \">%1</span>", LDPaths::getError() ) );
-		okButton()->setEnabled( false );
+void LDrawPathDialog::slot_tryConfigure() {
+	if (LDPaths::tryConfigure (filename()) == false) {
+		ui->status->setText (fmt ("<span style=\"color:#700; \">%1</span>", LDPaths::getError()));
+		okButton()->setEnabled (false);
 		return;
 	}
-	
-	ui->status->setText( "<span style=\"color: #270; \">OK!</span>" );
-	okButton()->setEnabled( true );
+
+	ui->status->setText ("<span style=\"color: #270; \">OK!</span>");
+	okButton()->setEnabled (true);
 }
 
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-OpenProgressDialog::OpenProgressDialog( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f )
-{
+OpenProgressDialog::OpenProgressDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
 	ui = new Ui_OpenProgressUI;
-	ui->setupUi( this );
-	ui->progressText->setText( "Parsing..." );
-	
-	setNumLines( 0 );
+	ui->setupUi (this);
+	ui->progressText->setText ("Parsing...");
+
+	setNumLines (0);
 	m_progress = 0;
 }
 
-OpenProgressDialog::~OpenProgressDialog()
-{
+OpenProgressDialog::~OpenProgressDialog() {
 	delete ui;
 }
 
-READ_ACCESSOR( ulong, OpenProgressDialog::numLines )
-{
+READ_ACCESSOR (ulong, OpenProgressDialog::numLines) {
 	return m_numLines;
 }
 
-SET_ACCESSOR( ulong, OpenProgressDialog::setNumLines )
-{
+SET_ACCESSOR (ulong, OpenProgressDialog::setNumLines) {
 	m_numLines = val;
-	ui->progressBar->setRange (0, numLines ());
+	ui->progressBar->setRange (0, numLines());
 	updateValues();
 }
 
-void OpenProgressDialog::updateValues()
-{
-	ui->progressText->setText( fmt( "Parsing... %1 / %2", progress(), numLines() ));
-	ui->progressBar->setValue( progress() );
+void OpenProgressDialog::updateValues() {
+	ui->progressText->setText (fmt ("Parsing... %1 / %2", progress(), numLines()));
+	ui->progressBar->setValue (progress());
 }
 
-void OpenProgressDialog::updateProgress( int progress )
-{
+void OpenProgressDialog::updateProgress (int progress) {
 	m_progress = progress;
-	updateValues ();
+	updateValues();
 }
 
-#include "build/moc_dialogs.cpp"
\ No newline at end of file
+#include "build/moc_dialogs.cpp"
+// kate: indent-mode cstyle; indent-width 4; replace-tabs off; tab-width 4; 
--- a/src/dialogs.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/dialogs.h	Fri Aug 02 16:33:30 2013 +0300
@@ -1,17 +1,17 @@
 /*
  *  LDForge: LDraw parts authoring CAD
  *  Copyright (C) 2013 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.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -39,12 +39,11 @@
 class Ui_LDPathUI;
 class Ui_OpenProgressUI;
 
-class OverlayDialog : public QDialog
-{
+class OverlayDialog : public QDialog {
 	Q_OBJECT
-
+	
 public:
-	explicit OverlayDialog( QWidget* parent = null, Qt::WindowFlags f = 0 );
+	explicit OverlayDialog (QWidget* parent = null, Qt::WindowFlags f = 0);
 	virtual ~OverlayDialog();
 	
 	str         fpath() const;
@@ -53,31 +52,30 @@
 	double      lwidth() const;
 	double      lheight() const;
 	int         camera() const;
-
+	
 private:
 	Ui_OverlayUI* ui;
 	List<pair<QRadioButton*, int>> m_cameraArgs;
-
+	
 private slots:
 	void slot_fpath();
 	void slot_help();
 	void slot_dimensionsChanged();
-	void fillDefaults( int newcam );
+	void fillDefaults (int newcam);
 };
 
 // =============================================================================
-class LDrawPathDialog : public QDialog
-{
+class LDrawPathDialog : public QDialog {
 	Q_OBJECT
 	
 public:
-	explicit LDrawPathDialog( const bool validDefault, QWidget* parent = null, Qt::WindowFlags f = 0 );
+	explicit LDrawPathDialog (const bool validDefault, QWidget* parent = null, Qt::WindowFlags f = 0);
 	virtual ~LDrawPathDialog();
 	str filename() const;
-	void setPath( str path );
+	void setPath (str path);
 	
 private:
-	Q_DISABLE_COPY( LDrawPathDialog )
+	Q_DISABLE_COPY (LDrawPathDialog)
 	const bool m_validDefault;
 	Ui_LDPathUI* ui;
 	QPushButton* okButton();
@@ -90,23 +88,23 @@
 };
 
 // =============================================================================
-class OpenProgressDialog : public QDialog
-{
+class OpenProgressDialog : public QDialog {
 	Q_OBJECT
-	READ_PROPERTY( ulong, progress, setProgress )
-	DECLARE_PROPERTY( ulong, numLines, setNumLines )
-	
+	READ_PROPERTY (ulong, progress, setProgress)
+	DECLARE_PROPERTY (ulong, numLines, setNumLines)
+
 public:
-	explicit OpenProgressDialog( QWidget* parent = null, Qt::WindowFlags f = 0 );
+	explicit OpenProgressDialog (QWidget* parent = null, Qt::WindowFlags f = 0);
 	virtual ~OpenProgressDialog();
-	
+
 public slots:
 	void updateProgress (int progress);
-	
+
 private:
 	Ui_OpenProgressUI* ui;
-	
-	void updateValues ();
+
+	void updateValues();
 };
 
-#endif // DIALOGS_H
\ No newline at end of file
+#endif // DIALOGS_H
+// kate: indent-mode cstyle; indent-width 4; replace-tabs off; tab-width 4; 
--- a/src/docs.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/docs.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -35,7 +35,7 @@
 		layout->addWidget (te_text);
 		layout->addWidget (bbx_buttons);
 		
-		connect (bbx_buttons, SIGNAL (rejected ()), this, SLOT (reject ()));
+		connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject()));
 	}
 	
 	void setText (const char* text) {
@@ -64,5 +64,5 @@
 void showDocumentation (const char* text) {
 	DocumentViewer dlg;
 	dlg.setText (text);
-	dlg.exec ();
+	dlg.exec();
 }
\ No newline at end of file
--- a/src/extprogs.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/extprogs.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -308,7 +308,7 @@
 		return;
 	
 	// Compose the command-line arguments
-	str argv = join ( {
+	str argv = join ({
 		(axis == X) ? "-x" : (axis == Y) ? "-y" : "-z",
 		(mode == Distance) ? "-d" : (mode == Symmetry) ? "-s" : (mode == Projection) ? "-p" : "-r",
 		depth,
@@ -351,7 +351,7 @@
 		return;
 	
 	// Compose arguments
-	str argv = join ( {
+	str argv = join ({
 		(!ui.cb_condense->isChecked()) ? "-q" : "",
 		(!ui.cb_subst->isChecked()) ? "-r" : "",
 		(ui.cb_condlineCheck->isChecked()) ? "-a" : "",
@@ -429,7 +429,7 @@
 		return;
 	}
 	
-	str parms = join ( {
+	str parms = join ({
 		(ui.cb_colorize->isChecked()) ? "-c" : "",
 		(ui.cb_nocondense->isChecked()) ? "-t" : "",
 		"-s",
@@ -505,7 +505,7 @@
 	if (!mkTempFile (in1dat, in1DATName) || !mkTempFile (in2dat, in2DATName) || !mkTempFile (outdat, outDATName))
 		return;
 	
-	str argv = join ( {
+	str argv = join ({
 		(ui.cb_oldsweep->isChecked() ? "-s" : ""),
 		(ui.cb_reverse->isChecked() ? "-r" : ""),
 		(ui.dsb_segsplit->value() != 0 ? fmt ("-l %1", ui.dsb_segsplit->value()) : ""),
@@ -564,7 +564,7 @@
 	if (!mkTempFile (in1dat, in1DATName) || !mkTempFile (in2dat, in2DATName) || !mkTempFile (outdat, outDATName))
 		return;
 	
-	str argv = join ( {
+	str argv = join ({
 		in1DATName,
 		in2DATName,
 		outDATName
@@ -600,7 +600,7 @@
 	
 	int unmatched = ui.unmatched->currentIndex();
 	
-	str argv = join ( {
+	str argv = join ({
 		fmt ("-p %1", ui.precision->value()),
 		fmt ("-af %1", ui.flatAngle->value()),
 		fmt ("-ac %1", ui.condAngle->value()),
--- a/src/file.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/file.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -55,7 +55,7 @@
 		if (!tryConfigure (io_ldpath)) {
 			LDrawPathDialog dlg (false);
 			
-			if (!dlg.exec ())
+			if (!dlg.exec())
 				exit (0);
 			
 			io_ldpath = dlg.filename();
@@ -120,12 +120,12 @@
 	
 	// If we just closed the current file, we need to set the current
 	// file as something else.
-	if( this == LDFile::current() ) {
+	if (this == LDFile::current()) {
 		// If we closed the last file, create a blank one.
-		if( g_loadedFiles.size() == 0 )
+		if (g_loadedFiles.size() == 0)
 			newFile();
 		else
-			LDFile::setCurrent( g_loadedFiles[0] );
+			LDFile::setCurrent (g_loadedFiles[0]);
 	}
 	
 	g_win->updateFileList();
@@ -134,7 +134,7 @@
 // =============================================================================
 LDFile* findLoadedFile (str name) {
 	for (LDFile* file : g_loadedFiles)
-		if (file->name () == name)
+		if (file->name() == name)
 			return file;
 	
 	return null;
@@ -180,7 +180,7 @@
 	if (LDFile::current()) {
 		// First, try find the file in the current model's file path. We want a file
 		// in the immediate vicinity of the current model to override stock LDraw stuff.
-		str partpath = fmt ("%1" DIRSLASH "%2", dirname (LDFile::current()->name ()), relpath);
+		str partpath = fmt ("%1" DIRSLASH "%2", dirname (LDFile::current()->name()), relpath);
 		
 		if (f->open (partpath, File::Read)) {
 			return f;
@@ -260,13 +260,13 @@
 		// Trim the trailing newline
 		qchar c;
 		
-		while ((c = line[line.length () - 1]) == '\n' || c == '\r')
+		while ((c = line[line.length() - 1]) == '\n' || c == '\r')
 			line.chop (1);
 		
 		LDObject* obj = parseLine (line);
 		
 		// Check for parse errors and warn about tthem
-		if (obj->getType () == LDObject::Error) {
+		if (obj->getType() == LDObject::Error) {
 			log ("Couldn't parse line #%1: %2", m_progress + 1, static_cast<LDErrorObject*> (obj)->reason);
 			
 			if (m_warningsPointer) {
@@ -344,7 +344,7 @@
 	File* f;
 	
 	if (search)
-		f = openLDrawFile (path.toLower (), true);
+		f = openLDrawFile (path.toLower(), true);
 	else {
 		f = new File (path, File::Read);
 		
@@ -410,13 +410,12 @@
 				setName (newpath);
 			}
 			
-			if (!save ()) {
+			if (!save()) {
 				message = fmt (QObject::tr ("Failed to save %1: %2\nDo you still want to close?"),
 					name(), strerror (errno));
 				
 				if (msgbox::critical (g_win, "Save Failure", message,
-					(msgbox::Yes | msgbox::No), msgbox::No) == msgbox::No)
-				{
+					(msgbox::Yes | msgbox::No), msgbox::No) == msgbox::No) {
 					return false;
 				}
 			}
@@ -439,14 +438,14 @@
 void closeAll() {
 	// Remove all loaded files and the objects they contain
 	List<LDFile*> files = g_loadedFiles;
-	for( LDFile* file : files )
+	for (LDFile* file : files)
 		delete file;
 }
 
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-void newFile () {
+void newFile() {
 	// Create a new anonymous file and set it to our current
 	LDFile* f = new LDFile;
 	f->setName ("");
@@ -471,7 +470,7 @@
 	
 	// 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.
@@ -503,7 +502,7 @@
 	if (!file) {
 		// Loading failed, thus drop down to a new file since we
 		// closed everything prior.
-		newFile ();
+		newFile();
 		
 		if (!g_aborted) {
 			// Tell the user loading failed.
@@ -571,7 +570,7 @@
 	// File is open, now save the model to it. Note that LDraw requires files to
 	// have DOS line endings, so we terminate the lines with \r\n.
 	for (LDObject* obj : objs())
-		f.write (obj->raw () + "\r\n");
+		f.write (obj->raw() + "\r\n");
 	
 	// File is saved, now clean up.
 	f.close();
@@ -592,7 +591,7 @@
 	if (tokens.size() != N) \
 		return new LDErrorObject (line, "Bad amount of tokens");
 
-#define CHECK_TOKEN_NUMBERS( MIN, MAX ) \
+#define CHECK_TOKEN_NUMBERS(MIN, MAX) \
 	for (ushort i = MIN; i <= MAX; ++i) \
 		if (!isNumber (tokens[i])) \
 			return new LDErrorObject (line, fmt ("Token #%1 was `%2`, expected a number", (i + 1), tokens[i]));
@@ -665,10 +664,10 @@
 				CHECK_TOKEN_NUMBERS (3, 6)
 				
 				LDVertexObject* obj = new LDVertexObject;
-				obj->setColor (tokens[3].toLong ());
+				obj->setColor (tokens[3].toLong());
 				
 				for (const Axis ax : g_Axes)
-					obj->pos[ax] = tokens[4 + ax].toDouble (); // 4 - 6
+					obj->pos[ax] = tokens[4 + ax].toDouble(); // 4 - 6
 				
 				return obj;
 			} elif (tokens[2] == "OVERLAY") {
@@ -793,7 +792,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-void reloadAllSubfiles () {
+void reloadAllSubfiles() {
 	if (!LDFile::current())
 		return;
 	
@@ -856,7 +855,7 @@
 }
 
 // =============================================================================
-bool safeToCloseAll () {
+bool safeToCloseAll() {
 	for (LDFile* f : g_loadedFiles)
 		if (!f->safeToClose())
 			return false;
@@ -869,7 +868,7 @@
 	assert (idx < numObjs());
 	
 	// Mark this change to history
-	str oldcode = object (idx)->raw ();
+	str oldcode = object (idx)->raw();
 	str newcode = obj->raw();
 	m_history << new EditHistory (idx, oldcode, newcode);
 	
@@ -894,7 +893,7 @@
 
 // =============================================================================
 // Find out which files are unused and close them.
-void LDFile::closeUnused () {
+void LDFile::closeUnused() {
 	List<LDFile*> filesUsed = getFilesUsed (LDFile::current());
 	
 	// Anything that's explicitly opened must not be closed
@@ -951,10 +950,10 @@
 }
 
 str LDFile::getShortName() {
-	if( name().length() > 0 )
-		return basename( name() );
+	if (name().length() > 0)
+		return basename (name());
 	
-	return tr( "<anonymous>" );
+	return tr ("<anonymous>");
 }
 
 // =============================================================================
@@ -971,19 +970,19 @@
 void LDFile::setCurrent (LDFile* f) {
 	/* Implicit files were loaded for caching purposes and must never be set
 	 * current. */
-	if( f && f->implicit() )
+	if (f && f->implicit())
 		return;
 	
 	m_curfile = f;
 	
-	if( g_win && f ) {
+	if (g_win && f) {
 		g_win->clearSelection();
-		g_win->updateFileListItem( f );
+		g_win->updateFileListItem (f);
 		g_win->buildObjList();
-		g_win->R()->setFile( f );
+		g_win->R()->setFile (f);
 		g_win->R()->repaint();
 		
-		log( "Changed file to %1", f->getShortName());
+		log ("Changed file to %1", f->getShortName());
 	}
 }
 
@@ -991,8 +990,8 @@
 int LDFile::countExplicitFiles() {
 	int count = 0;
 	
-	for( LDFile* f : g_loadedFiles )
-		if( f->implicit() == false )
+	for (LDFile* f : g_loadedFiles)
+		if (f->implicit() == false)
 			count++;
 	
 	return count;
@@ -1004,8 +1003,7 @@
 void LDFile::closeInitialFile() {
 	if (countExplicitFiles() == 2 &&
 		g_loadedFiles[0]->name() == "" &&
-		!g_loadedFiles[0]->hasUnsavedChanges())
-	{
+		!g_loadedFiles[0]->hasUnsavedChanges()) {
 		delete g_loadedFiles[0];
 	}
 }
--- a/src/gldraw.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/gldraw.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -40,13 +40,7 @@
 	const char glrotate[3];
 	const Axis axisX, axisY;
 	const bool negX, negY;
-} g_staticCameras[6] = {
-	{ { 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 },
-	{ { 0, 0, 0 }, X, Y, true, true },
-	{ { 0, -1, 0 }, Z, Y, false, true },
+} g_staticCameras[6] = { { { 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 }, { { 0, 0, 0 }, X, Y, true, true }, { { 0, -1, 0 }, Z, Y, false, true },
 };
 
 cfg (str, gl_bgcolor, "#CCCCD9");
@@ -61,13 +55,13 @@
 
 // argh
 const char* g_CameraNames[7] = {
-	QT_TRANSLATE_NOOP( "GLRenderer",  "Top" ),
-	QT_TRANSLATE_NOOP( "GLRenderer",  "Front" ),
-	QT_TRANSLATE_NOOP( "GLRenderer",  "Left" ),
-	QT_TRANSLATE_NOOP( "GLRenderer",  "Bottom" ),
-	QT_TRANSLATE_NOOP( "GLRenderer",  "Back" ),
-	QT_TRANSLATE_NOOP( "GLRenderer",  "Right" ),
-	QT_TRANSLATE_NOOP( "GLRenderer",  "Free" )
+	QT_TRANSLATE_NOOP ("GLRenderer",  "Top"),
+	QT_TRANSLATE_NOOP ("GLRenderer",  "Front"),
+	QT_TRANSLATE_NOOP ("GLRenderer",  "Left"),
+	QT_TRANSLATE_NOOP ("GLRenderer",  "Bottom"),
+	QT_TRANSLATE_NOOP ("GLRenderer",  "Back"),
+	QT_TRANSLATE_NOOP ("GLRenderer",  "Right"),
+	QT_TRANSLATE_NOOP ("GLRenderer",  "Free")
 };
 
 const GL::Camera g_Cameras[7] = {
@@ -83,10 +77,7 @@
 const struct GLAxis {
 	const QColor col;
 	const vertex vert;
-} g_GLAxes[3] = {
-	{ QColor (255, 0, 0), vertex (10000, 0, 0) },
-	{ QColor (128, 192, 0), vertex (0, 10000, 0) },
-	{ QColor (0, 160, 192), vertex (0, 0, 10000) },
+} g_GLAxes[3] = { { QColor (255, 0, 0), vertex (10000, 0, 0) }, { QColor (128, 192, 0), vertex (0, 10000, 0) }, { QColor (0, 160, 192), vertex (0, 0, 10000) },
 };
 	
 // =============================================================================
@@ -102,7 +93,7 @@
 	setFile (null);
 	setDrawOnly (false);
 	resetAngles();
-	setMessageLog( null );
+	setMessageLog (null);
 	
 	m_toolTipTimer = new QTimer (this);
 	m_toolTipTimer->setSingleShot (true);
@@ -249,8 +240,8 @@
 	
 	if ((list == BFCFrontList || list == BFCBackList) &&
 		obj->getType() != LDObject::Line &&
-		obj->getType() != LDObject::CondLine)
-	{
+		obj->getType() != LDObject::CondLine) {
+		
 		if (list == GL::BFCFrontList)
 			qcol = QColor (40, 192, 0);
 		else
@@ -261,7 +252,7 @@
 		else {
 			LDColor* col = getColor (obj->color());
 			
-			if( col )
+			if (col)
 				qcol = col->faceColor;
 		}
 		
@@ -507,7 +498,7 @@
 		}
 		
 		// Paint the coordinates onto the screen.
-		str text = fmt( tr( "X: %1, Y: %2, Z: %3" ), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z] );
+		str text = fmt (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]);
 		
 		QFontMetrics metrics = QFontMetrics (font());
 		QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text);
@@ -598,16 +589,16 @@
 			paint.drawPixmap (info.destRect, *info.img, info.srcRect);
 		}
 		
-		str fmtstr = tr( "%1 Camera" );
+		str fmtstr = tr ("%1 Camera");
 		
 		// Draw a label for the current camera in the top left corner
 		{
 			const ushort margin = 4;
 			
 			str label;
-			label = fmt( fmtstr, tr( g_CameraNames[camera()] ));
+			label = fmt (fmtstr, tr (g_CameraNames[camera()]));
 			paint.setPen (m_darkbg ? Qt::white : Qt::black);
-			paint.drawText( QPoint( margin, height() - ( margin + metrics.descent() )), label );
+			paint.drawText (QPoint (margin, height() -  (margin + metrics.descent())), label);
 		}
 		
 		// Tool tips
@@ -622,7 +613,7 @@
 				ushort x0 = m_pos.x(),
 					y0 = m_pos.y();
 				
-				str label = fmt( fmtstr, tr( g_CameraNames[m_toolTipCamera] ));
+				str label = fmt (fmtstr, tr (g_CameraNames[m_toolTipCamera]));
 				
 				const ushort textWidth = metrics.width (label),
 					textHeight = metrics.height(),
@@ -648,18 +639,16 @@
 	}
 	
 	// Message log
-	if( msglog() )
-	{
+	if (msglog()) {
 		int y = 0;
 		const int margin = 2;
 		QColor col = Qt::black;
-		paint.setPen( QPen() );
+		paint.setPen (QPen());
 		
-		for( const MessageManager::Line& line : *msglog())
-		{
-			col.setAlphaF( line.alpha );
-			paint.setPen( QPen( col ));
-			paint.drawText( QPoint( margin, y + margin + metrics.ascent() ), line.text );
+		for (const MessageManager::Line& line : *msglog()) {
+			col.setAlphaF (line.alpha);
+			paint.setPen (QPen (col));
+			paint.drawText (QPoint (margin, y + margin + metrics.ascent()), line.text);
 			y += metrics.height();
 		}
 	}
@@ -761,8 +750,7 @@
 		compileSubObject (obj, GL_QUADS);
 		break;
 	
-	case LDObject::Subfile:
-		{
+	case LDObject::Subfile: {
 			LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj);
 			List<LDObject*> objs = ref->inlineContents (true, true);
 			
@@ -1111,7 +1099,7 @@
 		if (idx == 0xFFFFFF)
 			continue; // White is background; skip
 		
-		LDObject* obj = LDObject::fromID( idx );
+		LDObject* obj = LDObject::fromID (idx);
 		
 		// If this is an additive single pick and the object is currently selected,
 		// we remove it from selection instead.
@@ -1199,16 +1187,14 @@
 	update();
 }
 
-READ_ACCESSOR( LDFile*, GLRenderer::file )
-{
+READ_ACCESSOR (LDFile*, GLRenderer::file) {
 	return m_file;
 }
 
-SET_ACCESSOR( LDFile*, GLRenderer::setFile )
-{
+SET_ACCESSOR (LDFile*, GLRenderer::setFile) {
 	m_file = val;
 	
-	if( val != null )
+	if (val != null)
 		overlaysFromObjects();
 }
 
--- a/src/gldraw.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/gldraw.h	Fri Aug 02 16:33:30 2013 +0300
@@ -5,7 +5,7 @@
  *  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
@@ -51,14 +51,14 @@
 // 
 // The main renderer object, draws the brick on the screen, manages the camera
 // and selection picking. The instance of GLRenderer is accessible as
-// g_win->R ()
+// g_win->R()
 // =============================================================================
 class GLRenderer : public QGLWidget {
 	Q_OBJECT
 	
-	PROPERTY( bool, drawOnly, setDrawOnly )
-	PROPERTY( double, zoom, setZoom )
-	PROPERTY( MessageManager*, msglog, setMessageLog )
+	PROPERTY (bool, drawOnly, setDrawOnly)
+	PROPERTY (double, zoom, setZoom)
+	PROPERTY (MessageManager*, msglog, setMessageLog)
 	READ_PROPERTY (bool, picking, setPicking)
 	DECLARE_PROPERTY (LDFile*, file, setFile)
 	DECLARE_PROPERTY (EditMode, editMode, setEditMode)
@@ -68,48 +68,48 @@
 	enum ListType { NormalList, PickList, BFCFrontList, BFCBackList };
 	
 	GLRenderer (QWidget* parent = null);
-	~GLRenderer ();
+	~GLRenderer();
 	
-	Camera         camera              () const { return m_camera; }
-	Axis           cameraAxis          ( bool y, Camera camid = (Camera) -1 );
-	const char*    cameraName          () const;
-	void           clearOverlay        ();
-	void           compileObject       (LDObject* obj);
-	void           compileAllObjects   ();
-	double         depthValue          () const;
-	void           drawGLScene         ();
-	void           endDraw             (bool accept);
-	QColor         getMainColor        ();
-	overlayMeta&   getOverlay          (int newcam);
-	void           hardRefresh         ();
-	void           initGLData          ();
-	void           overlaysFromObjects ();
-	void           refresh             ();
-	void           resetAngles         ();
-	uchar*         screencap           (ushort& w, ushort& h);
-	void           setBackground       ();
-	void           setCamera           (const Camera cam);
-	void           setDepthValue       (double depth);
-	bool           setupOverlay        ( GLRenderer::Camera cam, str file, int x, int y, int w, int h );
+	Camera         camera() const { return m_camera; }
+	Axis           cameraAxis (bool y, Camera camid = (Camera) -1);
+	const char*    cameraName() const;
+	void           clearOverlay();
+	void           compileObject (LDObject* obj);
+	void           compileAllObjects();
+	double         depthValue() const;
+	void           drawGLScene();
+	void           endDraw (bool accept);
+	QColor         getMainColor();
+	overlayMeta&   getOverlay (int newcam);
+	void           hardRefresh();
+	void           initGLData();
+	void           overlaysFromObjects();
+	void           refresh();
+	void           resetAngles();
+	uchar*         screencap (ushort& w, ushort& h);
+	void           setBackground();
+	void           setCamera (const Camera cam);
+	void           setDepthValue (double depth);
+	bool           setupOverlay (GLRenderer::Camera cam, str file, int x, int y, int w, int h);
 	void           updateOverlayObjects();
-	void           zoomNotch           (bool inward);
-	void           zoomToFit           ();
+	void           zoomNotch (bool inward);
+	void           zoomToFit();
 	
-	static void    deleteLists         (LDObject* obj);
+	static void    deleteLists (LDObject* obj);
 
 protected:
-	void           contextMenuEvent      (QContextMenuEvent* ev);
-	void           initializeGL          ();
-	void           keyPressEvent         (QKeyEvent* ev);
-	void           keyReleaseEvent       (QKeyEvent* ev);
-	void           leaveEvent            (QEvent* ev);
+	void           contextMenuEvent (QContextMenuEvent* ev);
+	void           initializeGL();
+	void           keyPressEvent (QKeyEvent* ev);
+	void           keyReleaseEvent (QKeyEvent* ev);
+	void           leaveEvent (QEvent* ev);
 	void           mouseDoubleClickEvent (QMouseEvent* ev);
-	void           mousePressEvent       (QMouseEvent* ev);
-	void           mouseMoveEvent        (QMouseEvent* ev);
-	void           mouseReleaseEvent     (QMouseEvent* ev);
-	void           paintEvent            (QPaintEvent* ev);
-	void           resizeGL              (int w, int h);
-	void           wheelEvent            (QWheelEvent* ev);
+	void           mousePressEvent (QMouseEvent* ev);
+	void           mouseMoveEvent (QMouseEvent* ev);
+	void           mouseReleaseEvent (QMouseEvent* ev);
+	void           paintEvent (QPaintEvent* ev);
+	void           resizeGL (int w, int h);
+	void           wheelEvent (QWheelEvent* ev);
 
 private:
 	// CameraIcon::img is a heap-allocated QPixmap because otherwise it gets
@@ -142,21 +142,21 @@
 	List<vertex> m_knownVerts;
 	bool m_panning;
 	
-	void           addDrawnVertex       (vertex m_hoverpos);
-	void           calcCameraIcons      ();                                      // Compute geometry for camera icons
-	void           clampAngle           (double& angle) const;                   // Clamps an angle to [0, 360]
-	void           compileList          (LDObject* obj, const ListType list);    // Compile one of the lists of an object
-	void           compileSubObject     (LDObject* obj, const GLenum gltype);    // Sub-routine for object compiling
-	void           compileVertex        (const vertex& vrt);                     // Compile a single vertex to a list
-	vertex         coordconv2_3         (const QPoint& pos2d, bool snap) const;  // Convert a 2D point to a 3D point
-	QPoint         coordconv3_2         (const vertex& pos3d) const;             // Convert a 3D point to a 2D point
-	LDOverlayObject*     findOverlayObject    ( Camera cam );
-	void           updateRectVerts      ();
-	void           pick                 (uint mouseX, uint mouseY);              // Perform object selection
-	void           setObjectColor       (LDObject* obj, const ListType list);    // Set the color to an object list
+	void           addDrawnVertex (vertex m_hoverpos);
+	void           calcCameraIcons();                                      // Compute geometry for camera icons
+	void           clampAngle (double& angle) const;                       // Clamps an angle to [0, 360]
+	void           compileList (LDObject* obj, const ListType list);       // Compile one of the lists of an object
+	void           compileSubObject (LDObject* obj, const GLenum gltype);  // Sub-routine for object compiling
+	void           compileVertex (const vertex& vrt);                      // Compile a single vertex to a list
+	vertex         coordconv2_3 (const QPoint& pos2d, bool snap) const;    // Convert a 2D point to a 3D point
+	QPoint         coordconv3_2 (const vertex& pos3d) const;               // Convert a 3D point to a 2D point
+	LDOverlayObject* findOverlayObject (Camera cam);
+	void           updateRectVerts();
+	void           pick (uint mouseX, uint mouseY);                        // Perform object selection
+	void           setObjectColor (LDObject* obj, const ListType list);    // Set the color to an object list
 	
 private slots:
-	void           slot_toolTipTimer    ();
+	void           slot_toolTipTimer();
 };
 
 // Alias for short namespaces
--- a/src/gui.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/gui.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -131,9 +131,9 @@
 #include "actions.h"
 }
 
-void ForgeWindow::invokeAction (QAction* act, void (*func) ()) {
+void ForgeWindow::invokeAction (QAction* act, void (*func)()) {
 	beginAction (act);
-	(*func) ();
+	(*func)();
 	endAction();
 }
 
@@ -251,7 +251,7 @@
 // =============================================================================
 int ForgeWindow::deleteSelection()
 {
-	if( m_sel.size() == 0 )
+	if (m_sel.size() == 0)
 		return 0;
 	
 	List<LDObject*> selCopy = m_sel;
@@ -341,9 +341,9 @@
 		
 		case LDObject::Overlay:
 			{
-				LDOverlayObject* ovl = static_cast<LDOverlayObject*>( obj );
-				descr = fmt( "[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()],
-					basename( ovl->filename() ), ovl->x(), ovl->y(), ovl->width(), ovl->height() );
+				LDOverlayObject* ovl = static_cast<LDOverlayObject*> (obj);
+				descr = fmt ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()],
+					basename (ovl->filename()), ovl->x(), ovl->y(), ovl->width(), ovl->height());
 			}
 			break;
 		
@@ -358,7 +358,7 @@
 		}
 		
 		QListWidgetItem* item = new QListWidgetItem (descr);
-		item->setIcon( getIcon( obj->typeName() ));
+		item->setIcon (getIcon (obj->typeName()));
 		
 		// Color gibberish orange on red so it stands out.
 		if (obj->getType() == LDObject::Error) {
@@ -466,7 +466,7 @@
 			continue; // uncolored object
 		
 		obj->setColor (newColor);
-		R()->compileObject( obj );
+		R()->compileObject (obj);
 	}
 	
 	refresh();
@@ -510,7 +510,7 @@
 	
 	ui->objectList->clearSelection();
 	for (LDObject* obj : m_sel) {
-		if( obj->qObjListEntry == null )
+		if (obj->qObjListEntry == null)
 			continue;
 		
 		obj->qObjListEntry->setSelected (true);
@@ -679,7 +679,7 @@
 	connect (hidetimer, SIGNAL (timeout()), m_primLoaderWidget, SLOT (hide()));
 	hidetimer->setSingleShot (true);
 	hidetimer->start (1500);
-	m_primLoaderBar->setFormat( tr( "Done" ));
+	m_primLoaderBar->setFormat (tr ("Done"));
 	log (tr ("Primitives scanned: %1 primitives listed"), m_primLoaderBar->value());
 }
 
--- a/src/gui_actions.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/gui_actions.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -80,7 +80,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-DEFINE_ACTION( NewFile, CTRL( N )) {
+DEFINE_ACTION (NewFile, CTRL (N)) {
 	newFile();
 }
 
@@ -335,7 +335,7 @@
 	for (LDObject* obj : objs) {
 		LDFile::current()->insertObj (idx, obj);
 		g_win->sel() << obj;
-		g_win->R()->compileObject( obj );
+		g_win->R()->compileObject (obj);
 		
 		idx++;
 	}
@@ -397,7 +397,7 @@
 		
 		LDFile::current()->insertObj (idx, obj);
 		g_win->sel() << obj;
-		g_win->R()->compileObject( obj );
+		g_win->R()->compileObject (obj);
 		idx++;
 	}
 	
--- a/src/gui_editactions.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/gui_editactions.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -137,7 +137,7 @@
 			LDObject* newobj = parseLine (line);
 			LDFile::current()->insertObj (idx++, newobj);
 			g_win->sel() << newobj;
-			g_win->R()->compileObject( inlineobj );
+			g_win->R()->compileObject (inlineobj);
 		}
 		
 		// Delete the subfile now as it's been inlined.
@@ -180,8 +180,8 @@
 		LDFile::current()->setObject (index, triangles[0]);
 		LDFile::current()->insertObj (index + 1, triangles[1]);
 		
-		for( LDTriangleObject* t : triangles )
-			g_win->R()->compileObject( t );
+		for (LDTriangleObject * t : triangles)
+			g_win->R()->compileObject (t);
 		
 		// Delete this quad now, it has been split.
 		delete obj;
@@ -429,7 +429,7 @@
 	const double cosangle = cos (angle),
 		sinangle = sin (angle);
 	
-	matrix transform ( {
+	matrix transform ({
 		(l* l * (1 - cosangle)) + cosangle,
 		(m* l * (1 - cosangle)) - (n* sinangle),
 		(n* l * (1 - cosangle)) + (m* sinangle),
@@ -500,7 +500,7 @@
 		}
 		
 		obj->setVertex (i, v);
-		g_win->R()->compileObject( obj );
+		g_win->R()->compileObject (obj);
 		num += 3;
 	}
 	
@@ -524,7 +524,7 @@
 			col = edgecolor;
 		
 		obj->setColor (col);
-		g_win->R()->compileObject( obj );
+		g_win->R()->compileObject (obj);
 		num++;
 	}
 	
@@ -570,7 +570,7 @@
 		}
 		
 		obj->setVertex (i, v);
-		g_win->R()->compileObject( obj );
+		g_win->R()->compileObject (obj);
 	}
 	
 	log (ForgeWindow::tr ("Altered %1 values"), num);
--- a/src/history.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/history.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -26,8 +26,8 @@
 bool g_fullRefresh = false;
 
 History::History() :
-	m_pos( -1 ),
-	m_opened( false ) {}
+	m_pos (-1),
+	m_opened (false) {}
 
 void History::undo() {
 	if (m_changesets.size() == 0 || pos() == -1)
--- a/src/history.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/history.h	Fri Aug 02 16:33:30 2013 +0300
@@ -47,16 +47,16 @@
 		Swap,
 	};
 	
-	History ();
-	void undo ();
-	void redo ();
-	void clear ();
-	void updateActions () const;
+	History();
+	void undo();
+	void redo();
+	void clear();
+	void updateActions() const;
 	
-	void open ();
-	void close ();
+	void open();
+	void close();
 	void add (AbstractHistoryEntry* entry);
-	long size () const { return m_changesets.size (); }
+	long size() const { return m_changesets.size(); }
 	
 	History& operator<< (AbstractHistoryEntry* entry) {
 		add (entry);
@@ -79,10 +79,10 @@
 	PROPERTY (History*, parent, setParent)
 	
 public:
-	virtual void undo () const {}
-	virtual void redo () const {}
-	virtual ~AbstractHistoryEntry () {}
-	virtual History::Type getType () const { return (History::Type) 0; }
+	virtual void undo() const {}
+	virtual void redo() const {}
+	virtual ~AbstractHistoryEntry() {}
+	virtual History::Type getType() const { return (History::Type) 0; }
 };
 
 // =============================================================================
@@ -103,7 +103,9 @@
 	IMPLEMENT_HISTORY_TYPE (Del)
 	
 	DelHistory (ulong idx, LDObject* obj, Type type = Other) :
-		m_index (idx), m_code (obj->raw ()), m_type (type) {}
+		m_index (idx),
+		m_code (obj->raw()),
+		m_type (type) {}
 };
 
 // =============================================================================
@@ -118,7 +120,9 @@
 	IMPLEMENT_HISTORY_TYPE (Edit)
 	
 	EditHistory (ulong idx, str oldCode, str newCode) :
-		m_index (idx), m_oldCode (oldCode), m_newCode (newCode) {}
+		m_index (idx),
+		m_oldCode (oldCode),
+		m_newCode (newCode) {}
 };
 
 // =============================================================================
@@ -139,7 +143,9 @@
 	IMPLEMENT_HISTORY_TYPE (Add)
 	
 	AddHistory (ulong idx, LDObject* obj, Type type = Other) :
-		m_index (idx), m_code (obj->raw ()), m_type (type) {}
+		m_index (idx),
+		m_code (obj->raw()),
+		m_type (type) {}
 };
 
 // =============================================================================
@@ -153,16 +159,18 @@
 	vertex dest;
 	
 	MoveHistory (List<ulong> indices, vertex dest) :
-		indices (indices), dest (dest) {}
+		indices (indices), 
+		dest (dest) {}
 };
 
-class SwapHistory : public AbstractHistoryEntry
-{
+class SwapHistory : public AbstractHistoryEntry {
 public:
-	IMPLEMENT_HISTORY_TYPE( Swap )
+	IMPLEMENT_HISTORY_TYPE (Swap)
 	ulong a, b;
 	
-	SwapHistory( ulong a, ulong b ) : a( a ), b( b ) {}
+	SwapHistory (ulong a, ulong b) :
+		a (a),
+		b (b) {}
 };
 
 #endif // HISTORY_H
\ No newline at end of file
--- a/src/labeledwidget.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/labeledwidget.h	Fri Aug 02 16:33:30 2013 +0300
@@ -39,8 +39,8 @@
 	}
 	
 	explicit LabeledWidget (const char* labelstr, R* widget, QWidget* parent = null) :
-		QWidget (parent), m_widget (widget)
-	{
+		QWidget (parent), m_widget (widget) {
+		
 		commonInit (labelstr);
 	}
 	
@@ -49,8 +49,8 @@
 		commonInit ("");
 	}
 	
-	R* w () const { return m_widget; }
-	operator R* () { return m_widget; }
+	R* w() const { return m_widget; }
+	operator R*() { return m_widget; }
 	
 private:
 	Q_DISABLE_COPY (LabeledWidget<R>)
--- a/src/ldconfig.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/ldconfig.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -24,90 +24,86 @@
 
 // =============================================================================
 // Helper function for parseLDConfig
-static bool parseLDConfigTag( LDConfigParser& pars, char const* tag, str& val )
-{
+static bool parseLDConfigTag (LDConfigParser& pars, char const* tag, str& val) {
 	short pos;
-
+	
 	// Try find the token and get its position
-	if( !pars.findToken( pos, tag, 1 ))
+	if (!pars.findToken (pos, tag, 1))
 		return false;
-
+	
 	// Get the token after it and store it into val
-	return pars.getToken( val, pos + 1 );
+	return pars.getToken (val, pos + 1);
 }
 
 // =============================================================================
-void parseLDConfig()
-{
-	File* f = openLDrawFile( "LDConfig.ldr", false );
+void parseLDConfig() {
+	File* f = openLDrawFile ("LDConfig.ldr", false);
 	
-	if( !f )
-	{
-		critical( fmt( QObject::tr( "Unable to open LDConfig.ldr for parsing! (%1)" ),
-			strerror( errno )) );
+	if (!f) {
+		critical (fmt (QObject::tr ("Unable to open LDConfig.ldr for parsing! (%1)"),
+			strerror (errno)));
 		delete f;
 		return;
 	}
 	
 	// Read in the lines
-	for( str line : *f )
-	{
-		if( line.length() == 0 || line[0] != '0' )
+	for (str line : *f) {
+		if (line.length() == 0 || line[0] != '0')
 			continue; // empty or illogical
 		
-		line.remove( '\r' );
-		line.remove( '\n' );
+		line.remove ('\r');
+		line.remove ('\n');
 		
 		// Parse the line
-		LDConfigParser pars( line, ' ' );
+		LDConfigParser pars (line, ' ');
 		
 		short code = 0, alpha = 255;
 		str name, facename, edgename, valuestr;
 		
 		// Check 0 !COLOUR, parse the name
-		if( !pars.tokenCompare( 0, "0" ) || !pars.tokenCompare( 1, "!COLOUR" ) || !pars.getToken( name, 2 ))
+		if (!pars.tokenCompare (0, "0") || !pars.tokenCompare (1, "!COLOUR") || !pars.getToken (name, 2))
 			continue;
 		
 		// Replace underscores in the name with spaces for readability
-		name.replace( "_", " " );
+		name.replace ("_", " ");
 		
 		// Get the CODE tag
-		if( !parseLDConfigTag( pars, "CODE", valuestr ))
+		if (!parseLDConfigTag (pars, "CODE", valuestr))
 			continue;
 		
-		if( !isNumber( valuestr ))
+		if (!isNumber (valuestr))
 			continue; // not a number
 		
 		// Ensure that the code is within [0 - 511]
 		bool ok;
-		code = valuestr.toShort( &ok );
+		code = valuestr.toShort (&ok);
 		
-		if( !ok || code < 0 || code >= 512 )
+		if (!ok || code < 0 || code >= 512)
 			continue;
 		
 		// VALUE and EDGE tags
-		if( !parseLDConfigTag( pars, "VALUE", facename ) || !parseLDConfigTag( pars, "EDGE", edgename ))
+		if (!parseLDConfigTag (pars, "VALUE", facename) || !parseLDConfigTag (pars, "EDGE", edgename))
 			continue;
 		
 		// Ensure that our colors are correct
-		QColor faceColor( facename ),
-			edgeColor( edgename );
+		QColor faceColor (facename),
+			   edgeColor (edgename);
 		
-		if( !faceColor.isValid() || !edgeColor.isValid() )
+		if (!faceColor.isValid() || !edgeColor.isValid())
 			continue;
 		
 		// Parse alpha if given.
-		if( parseLDConfigTag( pars, "ALPHA", valuestr ))
-			alpha = clamp<short> ( valuestr.toShort(), 0, 255 );
+		if (parseLDConfigTag (pars, "ALPHA", valuestr))
+			alpha = clamp<short> (valuestr.toShort(), 0, 255);
 		
 		LDColor* col = new LDColor;
 		col->name = name;
 		col->faceColor = faceColor;
 		col->edgeColor = edgeColor;
 		col->hexcode = facename;
-		col->faceColor.setAlpha( alpha );
+		col->faceColor.setAlpha (alpha);
 		col->index = code;
-		setColor( code, col );
+		setColor (code, col);
 	}
 	
 	delete f;
@@ -122,13 +118,13 @@
 }
 
 // -----------------------------------------------------------------------------
-bool LDConfigParser::atBeginning () {
+bool LDConfigParser::atBeginning() {
 	return (m_pos == -1);
 }
 
 // -----------------------------------------------------------------------------
-bool LDConfigParser::atEnd () {
-	return (m_pos == (signed) m_tokens.size () - 1);
+bool LDConfigParser::atEnd() {
+	return (m_pos == (signed) m_tokens.size() - 1);
 }
 
 // -----------------------------------------------------------------------------
@@ -152,7 +148,7 @@
 
 // -----------------------------------------------------------------------------
 bool LDConfigParser::findToken (short& result, char const* needle, short args) {
-	for (ushort i = 0; i < (m_tokens.size () - args); ++i) {
+	for (ushort i = 0; i < (m_tokens.size() - args); ++i) {
 		if (m_tokens[i] == needle) {
 			result = i;
 			return true;
@@ -163,7 +159,7 @@
 }
 
 // -----------------------------------------------------------------------------
-void LDConfigParser::rewind () {
+void LDConfigParser::rewind() {
 	m_pos = -1;
 }
 
@@ -173,7 +169,7 @@
 }
 
 // -----------------------------------------------------------------------------
-size_t LDConfigParser::size () {
+size_t LDConfigParser::size() {
 	return m_tokens.size();
 }
 
--- a/src/ldconfig.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/ldconfig.h	Fri Aug 02 16:33:30 2013 +0300
@@ -30,14 +30,14 @@
 public:
 	LDConfigParser (str inText, char sep);
 	
-	bool atEnd ();
-	bool atBeginning ();
+	bool atEnd();
+	bool atBeginning();
 	bool next (str& val);
 	bool peekNext (str& val);
 	bool getToken (str& val, const ushort pos);
 	bool findToken (short& result, char const* needle, short args);
-	size_t size ();
-	void rewind ();
+	size_t size();
+	void rewind();
 	void seek (short amount, bool rel);
 	bool tokenCompare (short inPos, const char* sOther);
 	
--- a/src/ldtypes.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/ldtypes.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -32,16 +32,16 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 // LDObject constructors
-LDObject::LDObject () :
+LDObject::LDObject() :
 	m_hidden (false),
 	m_selected (false),
 	m_parent (null),
 	m_file (null),
 	qObjListEntry (null),
-	m_glinit (false)
-{
+	m_glinit (false) {
+	
 	// Determine ID
-	qint32 id = 1; // 0 is invalid
+	int32 id = 1; // 0 is invalid
 	
 	for (LDObject* obj : g_LDObjects)
 		if (obj->id() >= id)
@@ -507,7 +507,7 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 #define CHECK_FOR_OBJ(N) \
-	if( type == LDObject::N ) \
+	if (type == LDObject::N) \
 		return new LD##N##Object;
 
 LDObject* LDObject::getDefault (const LDObject::Type type) {
--- a/src/ldtypes.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/ldtypes.h	Fri Aug 02 16:33:30 2013 +0300
@@ -35,19 +35,19 @@
 	virtual void move (vertex vVector); \
 	virtual void invert();
 
-#define LDOBJ_NAME( N )        virtual str typeName() const override { return #N; }
-#define LDOBJ_VERTICES( V )    virtual short vertices() const override { return V; }
-#define LDOBJ_SETCOLORED( V )  virtual bool isColored() const override { return V; }
-#define LDOBJ_COLORED          LDOBJ_SETCOLORED( true )
-#define LDOBJ_UNCOLORED        LDOBJ_SETCOLORED( false )
+#define LDOBJ_NAME(N)          virtual str typeName() const override { return #N; }
+#define LDOBJ_VERTICES(V)      virtual short vertices() const override { return V; }
+#define LDOBJ_SETCOLORED(V)    virtual bool isColored() const override { return V; }
+#define LDOBJ_COLORED          LDOBJ_SETCOLORED (true)
+#define LDOBJ_UNCOLORED        LDOBJ_SETCOLORED (false)
 
 #define LDOBJ_CUSTOM_SCEMANTIC virtual bool isScemantic() const override
 #define LDOBJ_SCEMANTIC        LDOBJ_CUSTOM_SCEMANTIC { return true; }
 #define LDOBJ_NON_SCEMANTIC    LDOBJ_CUSTOM_SCEMANTIC { return false; }
 
 #define LDOBJ_SETMATRIX(V)     virtual bool hasMatrix() const override { return V; }
-#define LDOBJ_HAS_MATRIX       LDOBJ_SETMATRIX( true )
-#define LDOBJ_NO_MATRIX        LDOBJ_SETMATRIX( false )
+#define LDOBJ_HAS_MATRIX       LDOBJ_SETMATRIX (true)
+#define LDOBJ_NO_MATRIX        LDOBJ_SETMATRIX (false)
 
 class QListWidgetItem;
 class LDSubfileObject;
@@ -66,7 +66,7 @@
 	PROPERTY (bool, selected, setSelected)
 	PROPERTY (LDObject*, parent, setParent)
 	PROPERTY (LDFile*, file, setFile)
-	READ_PROPERTY (qint32, id, setID)
+	READ_PROPERTY (int32, id, setID)
 	DECLARE_PROPERTY (short, color, setColor)
 
 public:
@@ -91,7 +91,7 @@
 	virtual ~LDObject();
 	
 	virtual LDObject* clone() {return 0;}       // Creates a new LDObject identical to this one.
-	long getIndex () const;                     // Index (i.e. line number) of this object
+	long getIndex() const;                      // Index (i.e. line number) of this object
 	virtual LDObject::Type getType() const;     // Type enumerator of this object
 	const vertex& getVertex (int i) const;      // Get a vertex by index
 	virtual bool hasMatrix() const;             // Does this object have a matrix and position? (see LDMatrixObject)
--- a/src/main.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/main.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -41,8 +41,8 @@
 
 void doPrint (File& f, initlist<StringFormatArg> args) {
 	str msg = DoFormat (args);
-	f.write (msg.toUtf8 ());
-	f.flush ();
+	f.write (msg.toUtf8());
+	f.flush();
 }
 
 void doPrint (FILE* fp, initlist<StringFormatArg> args) {
@@ -63,24 +63,24 @@
 	LDFile::setCurrent (null);
 	
 	// Load or create the configuration
-	if (!config::load ()) {
+	if (!config::load()) {
 		print ("Creating configuration file...\n");
-		if (config::save ())
+		if (config::save())
 			print ("Configuration file successfully created.\n");
 		else
 			print ("failed to create configuration file!\n");
 	}
 	
-	LDPaths::initPaths ();
-	initColors ();
+	LDPaths::initPaths();
+	initColors();
 
 	ForgeWindow* win = new ForgeWindow;
 	
-	newFile ();
-	loadPrimitives ();
+	newFile();
+	loadPrimitives();
 	
-	win->show ();
-	return app.exec ();
+	win->show();
+	return app.exec();
 }
 
 void doDevf (const char* func, const char* fmtstr, ...) {
@@ -93,7 +93,7 @@
 	va_end (va);
 }
 
-const char* versionString () {
+const char* versionString() {
 	if (g_versionString.length() == 0) {
 #if VERSION_PATCH == 0
 		g_versionString = fmt ("%1.%2", VERSION_MAJOR, VERSION_MINOR);
@@ -105,7 +105,7 @@
 	return g_versionString.toStdString().c_str();
 }
 
-const char* versionMoniker () {
+const char* versionMoniker() {
 #if BUILD_ID == BUILD_INTERNAL
 	return " Internal";
 #elif BUILD_ID == BUILD_ALPHA
@@ -119,9 +119,9 @@
 #endif // BUILD_ID
 }
 
-const char* fullVersionString () {
+const char* fullVersionString() {
 	if (g_fullVersionString.length() == 0)
-		g_fullVersionString = fmt ("v%1%2", versionString (), versionMoniker ());
+		g_fullVersionString = fmt ("v%1%2", versionString(), versionMoniker());
 	
 	return g_fullVersionString.toStdString().c_str();
 }
@@ -138,7 +138,7 @@
 	box.addButton (btn);
 	box.button (btn)->setText ("Damn it");
 	box.setDefaultButton (btn);
-	box.exec ();
+	box.exec();
 }
 
 void assertionFailure (const char* file, const ulong line, const char* funcname, const char* expr) {
@@ -155,10 +155,10 @@
 	
 #if BUILD_ID == BUILD_INTERNAL
 	if (g_win)
-		g_win->deleteLater ();
+		g_win->deleteLater();
 	
 	bombBox (errmsg);
-	abort ();
+	abort();
 #endif
 }
 
@@ -169,8 +169,8 @@
 	print ("%1\n", errmsg);
 	
 	if (g_win)
-		g_win->deleteLater ();
+		g_win->deleteLater();
 	
 	bombBox (errmsg);
-	abort ();
-}
+	abort();
+}
\ No newline at end of file
--- a/src/messagelog.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/messagelog.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -28,39 +28,38 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-MessageManager::MessageManager( QObject* parent ) :
-	QObject( parent )
-{
+MessageManager::MessageManager (QObject* parent) :
+	QObject (parent) {
 	m_ticker = new QTimer;
-	m_ticker->start( 100 );
-	connect( m_ticker, SIGNAL( timeout() ), this, SLOT( tick() ));
+	m_ticker->start (100);
+	connect (m_ticker, SIGNAL (timeout()), this, SLOT (tick()));
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-MessageManager::Line::Line( str text ) :
-	text( text ),
-	alpha( 1.0f ),
-	expiry( QDateTime::currentDateTime().addSecs( g_expiry )) {}
+MessageManager::Line::Line (str text) :
+	text (text),
+	alpha (1.0f),
+	expiry (QDateTime::currentDateTime().addSecs (g_expiry)) {}
 
 // =============================================================================
 // Check this line's expiry and update alpha accordingly. Returns true if the
 // line is to still stick around, false if it expired. 'changed' is updated to
 // whether the line has somehow changed since the last update.
-bool MessageManager::Line::update( bool& changed ) {
+bool MessageManager::Line::update (bool& changed) {
 	changed = false;
+	QDateTime now = QDateTime::currentDateTime();
+	int msec = now.msecsTo (expiry);
 	
-	QDateTime now = QDateTime::currentDateTime();
-	if( now >= expiry ) {
+	if (now >= expiry) {
 		// Message line has expired
 		changed = true;
 		return false;
 	}
 	
-	int msec = now.msecsTo( expiry );
-	if( msec <= g_fadeTime ) {
+	if (msec <= g_fadeTime) {
 		// Message line has not expired but is fading out
-		alpha = ( (float) msec ) / g_fadeTime;
+		alpha = ((float) msec) / g_fadeTime;
 		changed = true;
 	}
 	
@@ -70,23 +69,23 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 // Add a line to the message manager.
-void MessageManager::addLine( str line ) {
+void MessageManager::addLine (str line) {
 	// If there's too many entries, pop the excess out
-	while( m_lines.size() >= g_maxMessages )
-		m_lines.erase( 0 );
+	while (m_lines.size() >= g_maxMessages)
+		m_lines.erase (0);
 	
-	m_lines << Line( line );
+	m_lines << Line (line);
 	
 	// Update the renderer view
-	if( renderer() )
+	if (renderer())
 		renderer()->update();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 // Shortcut
-MessageManager& MessageManager::operator<<( str line ) {
-	addLine( line );
+MessageManager& MessageManager::operator<< (str line) {
+	addLine (line);
 	return *this;
 }
 
@@ -95,21 +94,21 @@
 // Ticks the message manager. All lines are ticked and the renderer scene is
 // redrawn if something changed.
 void MessageManager::tick() {
-	if( m_lines.size() == 0 )
+	if (m_lines.size() == 0)
 		return;
 	
 	bool changed = false;
 	
-	for( uint i = 0; i < m_lines.size(); ++i ) {
+	for (uint i = 0; i < m_lines.size(); ++i) {
 		bool lineChanged;
 		
-		if( !m_lines[i].update( lineChanged ))
-			m_lines.erase( i-- );
+		if (!m_lines[i].update (lineChanged))
+			m_lines.erase (i--);
 		
 		changed |= lineChanged;
 	}
 	
-	if( changed && renderer() )
+	if (changed && renderer())
 		renderer()->update();
 }
 
@@ -130,12 +129,12 @@
 // -----------------------------------------------------------------------------
 // log() interface - format the argument list and add the resulting string to
 // the main message manager.
-void DoLog( std::initializer_list<StringFormatArg> args ) {
-	const str msg = DoFormat( args );
-	g_win->addMessage( msg );
+void DoLog (std::initializer_list<StringFormatArg> args) {
+	const str msg = DoFormat (args);
+	g_win->addMessage (msg);
 	
 	// Also print it to stdout
-	print( "%1\n", msg );
+	print ("%1\n", msg);
 }
 
 #include "build/moc_messagelog.cpp"
\ No newline at end of file
--- a/src/messagelog.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/messagelog.h	Fri Aug 02 16:33:30 2013 +0300
@@ -1,17 +1,17 @@
 /*
  *  LDForge: LDraw parts authoring CAD
  *  Copyright (C) 2013 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.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -39,14 +39,14 @@
  */
 class MessageManager : public QObject {
 	Q_OBJECT
-	PROPERTY( GLRenderer*, renderer, setRenderer )
+	PROPERTY (GLRenderer*, renderer, setRenderer)
 	
 public:
 	// Single line of the message log.
 	class Line {
 	public:
-		Line( str text );
-		bool update( bool& changed );
+		Line (str text);
+		bool update (bool& changed);
 		
 		str text;
 		float alpha;
@@ -56,12 +56,12 @@
 	typedef List<Line>::it it;
 	typedef List<Line>::c_it c_it;
 	
-	explicit MessageManager( QObject* parent = 0 );
-	void addLine( str line );
+	explicit MessageManager (QObject* parent = 0);
+	void addLine (str line);
 	c_it begin() const;
 	c_it end() const;
 	
-	MessageManager& operator<<( str line );
+	MessageManager& operator<< (str line);
 	
 private:
 	List<Line> m_lines;
--- a/src/misc.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/misc.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -111,7 +111,7 @@
 // =============================================================================
 // 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]->value;
+	const double gridval = currentGrid().confs[axis]->value;
 	const long mult = abs (in / gridval);
 	const bool neg = (in < 0);
 	double out = mult * gridval;
@@ -155,7 +155,7 @@
 bool isNumber (const str& tok) {
 	bool gotDot = false;
 	
-	for (int i = 0; i < tok.length (); ++i) {
+	for (int i = 0; i < tok.length(); ++i) {
 		const qchar c = tok[i];
 		
 		// Allow leading hyphen for negatives
@@ -205,23 +205,19 @@
 }
 
 // =============================================================================
-vertex rotPoint( const List<LDObject*>& objs )
-{
+vertex rotPoint (const List<LDObject*>& objs) {
 	LDBoundingBox box;
 	
-	switch( edit_rotpoint )
-	{
+	switch (edit_rotpoint) {
 	case ObjectOrigin:
 		// Calculate center vertex
-		for( LDObject * obj : objs )
-		{
-			if( obj->hasMatrix() )
-				box << dynamic_cast<LDMatrixObject*>( obj )->position();
+		for (LDObject * obj : objs)
+			if (obj->hasMatrix())
+				box << dynamic_cast<LDMatrixObject*>(obj)->position();
 			else
 				box << obj;
-		}
 		
-		return box.center ();
+		return box.center();
 	
 	case WorldOrigin:
 		return g_origin;
@@ -233,38 +229,36 @@
 	return vertex();
 }
 
-void configRotationPoint()
-{
+void configRotationPoint() {
 	QDialog* dlg = new QDialog;
 	Ui::RotPointUI ui;
-	ui.setupUi( dlg );
+	ui.setupUi (dlg);
 	
-	switch( edit_rotpoint )
-	{
+	switch (edit_rotpoint) {
 	case ObjectOrigin:
-		ui.objectPoint->setChecked( true );
+		ui.objectPoint->setChecked (true);
 		break;
 	
 	case WorldOrigin:
-		ui.worldPoint->setChecked( true );
+		ui.worldPoint->setChecked (true);
 		break;
 	
 	case CustomPoint:
-		ui.customPoint->setChecked( true );
+		ui.customPoint->setChecked (true);
 		break;
 	}
 	
-	ui.customX->setValue( edit_rotpoint_x );
-	ui.customY->setValue( edit_rotpoint_y );
-	ui.customZ->setValue( edit_rotpoint_z );
+	ui.customX->setValue (edit_rotpoint_x);
+	ui.customY->setValue (edit_rotpoint_y);
+	ui.customZ->setValue (edit_rotpoint_z);
 	
-	if (!dlg->exec ())
+	if (!dlg->exec())
 		return;
 	
 	edit_rotpoint =
-		( ui.objectPoint->isChecked() ) ? ObjectOrigin :
-		( ui.worldPoint->isChecked() )  ? WorldOrigin :
-		                                  CustomPoint;
+		(ui.objectPoint->isChecked()) ? ObjectOrigin :
+		(ui.worldPoint->isChecked())  ? WorldOrigin :
+		                                CustomPoint;
 	
 	edit_rotpoint_x = ui.customX->value();
 	edit_rotpoint_y = ui.customY->value();
@@ -274,26 +268,25 @@
 str join (initlist<StringFormatArg> vals, str delim) {
 	QStringList list;
 	for (const StringFormatArg& arg : vals)
-		list << arg.value ();
+		list << arg.value();
 	
 	return list.join (delim);
 }
 
-double atof( str val )
-{
+double atof (str val) {
 	// Disable the locale while parsing the line or atof's behavior changes
 	// between locales (i.e. fails to read decimals properly). That is
 	// quite undesired...
-	setlocale( LC_NUMERIC, "C" );
+	setlocale (LC_NUMERIC, "C");
 	
 	char* buf = new char[val.length()];
 	char* bufptr = &buf[0];
 	
-	for( qchar& c : val )
+	for (qchar& c : val)
 		*bufptr++ = c.toLatin1();
 	*bufptr = '\0';
 	
-	double fval = atof( buf );
+	double fval = atof (buf);
 	delete[] buf;
 	return fval;
 }
\ No newline at end of file
--- a/src/misc.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/misc.h	Fri Aug 02 16:33:30 2013 +0300
@@ -37,7 +37,7 @@
 // Converts a float value to a string value.
 str ftoa (double num);
 
-double atof( str val );
+double atof (str val);
 
 // Simplifies the given fraction.
 void simplify (short& numer, short& denom);
@@ -54,7 +54,7 @@
 static const short g_NumGrids = 3;
 extern const gridinfo g_GridInfo[3];
 
-inline const gridinfo& currentGrid () {
+inline const gridinfo& currentGrid() {
 	return g_GridInfo[grid];
 }
 
@@ -67,7 +67,7 @@
 };
 
 vertex rotPoint (const List<LDObject*>& objs);
-void configRotationPoint ();
+void configRotationPoint();
 
 template<class T, class R> R container_cast (const T& a) {
 	R b;
--- a/src/primitives.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/primitives.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -286,7 +286,7 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 static double radialPoint (int i, int divs, double (*func) (double)) {
-	return (*func) ( (i * 2 * pi) / divs);
+	return (*func) ((i * 2 * pi) / divs);
 }
 
 // =============================================================================
@@ -492,7 +492,7 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 void generatePrimitive() {
-	PrimitivePrompt* dlg = new PrimitivePrompt( g_win );
+	PrimitivePrompt* dlg = new PrimitivePrompt (g_win);
 	
 	if (!dlg->exec())
 		return;
@@ -508,7 +508,7 @@
 		dlg->ui->rb_ring->isChecked()     ? Ring : Cone;
 	
 	// Make the description
-	str frac = ftoa ( ( (float) segs) / divs);
+	str frac = ftoa (((float) segs) / divs);
 	str name = radialFileName (type, segs, divs, num);
 	str descr;
 	
@@ -518,16 +518,16 @@
 	
 	if (type == Ring || type == Cone) {
 		str spacing =
-			( num < 10  ) ? "  " :
-			( num < 100 ) ? " "  : "";
+			 (num < 10 ) ? "  " :
+			 (num < 100) ? " "  : "";
 		
 		descr = fmt ("%1 %2%3 x %4", primitiveTypeName (type), spacing, num, frac);
 	} else
 		descr = fmt ("%1 %2", primitiveTypeName (type), frac);
 	
 	// Prepend "Hi-Res" if 48/ primitive.
-	if( divs == hires )
-		descr.insert( 0, "Hi-Res " );
+	if (divs == hires)
+		descr.insert (0, "Hi-Res ");
 	
 	LDFile* f = new LDFile;
 	f->setName (QFileDialog::getSaveFileName (null, QObject::tr ("Save Primitive"), name));
@@ -547,24 +547,24 @@
 }
 
 PrimitivePrompt::PrimitivePrompt (QWidget* parent, Qt::WindowFlags f) :
-	QDialog (parent, f)
-{
+	QDialog (parent, f) {
+	
 	ui = new Ui_MakePrimUI;
-	ui->setupUi( this );
-	connect( ui->cb_hires, SIGNAL( toggled(bool) ), this, SLOT( hiResToggled( bool )));
+	ui->setupUi (this);
+	connect (ui->cb_hires, SIGNAL (toggled(bool)), this, SLOT (hiResToggled (bool)));
 }
 
 PrimitivePrompt::~PrimitivePrompt() {
 	delete ui;
 }
 
-void PrimitivePrompt::hiResToggled( bool on ) {
-	ui->sb_segs->setMaximum( on ? hires : lores );
+void PrimitivePrompt::hiResToggled (bool on) {
+	ui->sb_segs->setMaximum (on ? hires : lores);
 	
 	// If the current value is 16 and we switch to hi-res, default the
 	// spinbox to 48.
-	if( on && ui->sb_segs->value() == lores )
-		ui->sb_segs->setValue( hires );
+	if (on && ui->sb_segs->value() == lores)
+		ui->sb_segs->setValue (hires);
 }
 
 #include "build/moc_primitives.cpp"
\ No newline at end of file
--- a/src/primitives.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/primitives.h	Fri Aug 02 16:33:30 2013 +0300
@@ -65,14 +65,14 @@
 	Q_OBJECT
 	
 public:
-	static void start ();
+	static void start();
 	
 public slots:
-	void work ();
+	void work();
 	
 signals:
 	void starting (ulong num);
-	void workDone ();
+	void workDone();
 	void update (ulong i);
 	
 private:
@@ -81,8 +81,8 @@
 
 extern List<PrimitiveCategory> g_PrimitiveCategories;
 
-void loadPrimitives ();
-bool primitiveLoaderBusy ();
+void loadPrimitives();
+bool primitiveLoaderBusy();
 
 enum PrimitiveType
 {
@@ -99,12 +99,12 @@
 	Q_OBJECT
 	
 public:
-	explicit PrimitivePrompt( QWidget* parent = null, Qt::WindowFlags f = 0 );
+	explicit PrimitivePrompt (QWidget* parent = null, Qt::WindowFlags f = 0);
 	virtual ~PrimitivePrompt();
 	Ui_MakePrimUI* ui;
 	
 public slots:
-	void hiResToggled( bool on );
+	void hiResToggled (bool on);
 };
 
 void generatePrimitive();
--- a/src/types.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/types.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -5,7 +5,7 @@
  *  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
@@ -27,358 +27,308 @@
 #include "ldtypes.h"
 #include "file.h"
 
-str DoFormat( List<StringFormatArg> args )
-{
-	assert( args.size() >= 1 );
+str DoFormat (List<StringFormatArg> args) {
+	assert (args.size() >= 1);
 	str text = args[0].value();
 	
-	for( uchar i = 1; i < args.size(); ++i )
-		text = text.arg( args[i].value() );
+	for (uchar i = 1; i < args.size(); ++i)
+		text = text.arg (args[i].value());
 	
 	return text;
 }
 
-vertex::vertex( double x, double y, double z )
-{
+vertex::vertex (double x, double y, double z) {
 	m_coords[X] = x;
 	m_coords[Y] = y;
 	m_coords[Z] = z;
 }
 
 // =============================================================================
-void vertex::move( const vertex& other )
-{
-	for( const Axis ax : g_Axes )
+void vertex::move (const vertex& other) {
+	for (const Axis ax : g_Axes)
 		m_coords[ax] += other[ax];
 }
 
 // =============================================================================
-vertex vertex::midpoint( const vertex& other )
-{
+vertex vertex::midpoint (const vertex& other) {
 	vertex mid;
 	
-	for( const Axis ax : g_Axes )
-		mid[ax] = ( m_coords[ax] + other[ax] ) / 2;
+	for (const Axis ax : g_Axes)
+		mid[ax] = (m_coords[ax] + other[ax]) / 2;
 	
 	return mid;
 }
 
 // =============================================================================
-str vertex::stringRep( bool mangled ) const
-{
+str vertex::stringRep (bool mangled) const {
 	str fmtstr = "%1 %2 %3";
-	if( mangled )
+	if (mangled)
 		fmtstr = "(%1, %2, %3)";
 	
-	return fmt( fmtstr, coord( X ), coord( Y ), coord( Z ));
+	return fmt (fmtstr, coord (X), coord (Y), coord (Z));
 }
 
 // =============================================================================
-void vertex::transform( matrix matr, vertex pos )
-{
-	double x2 = ( matr[0] * x()) + ( matr[1] * y()) + ( matr[2] * z()) + pos[X];
-	double y2 = ( matr[3] * x()) + ( matr[4] * y()) + ( matr[5] * z()) + pos[Y];
-	double z2 = ( matr[6] * x()) + ( matr[7] * y()) + ( matr[8] * z()) + pos[Z];
+void vertex::transform (matrix matr, vertex pos) {
+	double x2 = (matr[0] * x()) + (matr[1] * y()) + (matr[2] * z()) + pos[X];
+	double y2 = (matr[3] * x()) + (matr[4] * y()) + (matr[5] * z()) + pos[Y];
+	double z2 = (matr[6] * x()) + (matr[7] * y()) + (matr[8] * z()) + pos[Z];
 	
 	x() = x2;
 	y() = y2;
 	z() = z2;
 }
 
-vertex vertex::operator-() const
-{
-	return vertex( -m_coords[X], -m_coords[Y], -m_coords[Z] );
+vertex vertex::operator-() const {
+	return vertex (-m_coords[X], -m_coords[Y], -m_coords[Z]);
 }
 
-bool vertex::operator!= ( const vertex& other ) const
-{
-	return !operator== ( other );
+bool vertex::operator!= (const vertex& other) const {
+	return !operator== (other);
 }
 
-double& vertex::operator[]( const Axis ax )
-{
-	return coord( ( ushort ) ax );
+double& vertex::operator[] (const Axis ax) {
+	return coord ((ushort) ax);
 }
 
-const double& vertex::operator[]( const Axis ax ) const
-{
-	return coord( ( ushort ) ax );
+const double& vertex::operator[] (const Axis ax) const {
+	return coord ((ushort) ax);
 }
 
-double& vertex::operator[]( const int ax )
-{
-	return coord( ax );
+double& vertex::operator[] (const int ax) {
+	return coord (ax);
 }
 
-const double& vertex::operator[]( const int ax ) const
-{
-	return coord( ax );
+const double& vertex::operator[] (const int ax) const {
+	return coord (ax);
 }
 
-bool vertex::operator== ( const vertex& other ) const
-{
-	return coord( X ) == other[X] &&
-	       coord( Y ) == other[Y] &&
-	       coord( Z ) == other[Z];
+bool vertex::operator== (const vertex& other) const {
+	return coord (X) == other[X] &&
+	       coord (Y) == other[Y] &&
+	       coord (Z) == other[Z];
 }
 
-vertex& vertex::operator/= ( const double d )
-{
-	for( const Axis ax : g_Axes )
+vertex& vertex::operator/= (const double d) {
+	for (const Axis ax : g_Axes)
 		m_coords[ax] /= d;
 	
 	return *this;
 }
 
-vertex vertex::operator/ ( const double d ) const
-{
-	vertex other( *this );
+vertex vertex::operator/ (const double d) const {
+	vertex other (*this);
 	return other /= d;
 }
 
-vertex& vertex::operator+= ( const vertex& other )
-{
-	move( other );
+vertex& vertex::operator+= (const vertex& other) {
+	move (other);
 	return *this;
 }
 
-vertex vertex::operator+ ( const vertex& other ) const
-{
-	vertex newvert( *this );
-	newvert.move( other );
+vertex vertex::operator+ (const vertex& other) const {
+	vertex newvert (*this);
+	newvert.move (other);
 	return newvert;
 }
 
-int vertex::operator< ( const vertex& other ) const
-{
-	if( operator==( other ))
+int vertex::operator< (const vertex& other) const {
+	if (operator== (other))
 		return false;
 	
-	if( coord( X ) < other[X] )
+	if (coord (X) < other[X])
 		return true;
 	
-	if( coord( X ) > other[X] )
+	if (coord (X) > other[X])
 		return false;
 	
-	if( coord( Y ) < other[Y] )
+	if (coord (Y) < other[Y])
 		return true;
 	
-	if( coord( Y ) > other[Y] )
+	if (coord (Y) > other[Y])
 		return false;
 	
-	return coord( Z ) < other[Z];
+	return coord (Z) < other[Z];
 }
 
 // =============================================================================
-matrix::matrix( double vals[] )
-{
-	for( short i = 0; i < 9; ++i )
+matrix::matrix (double vals[]) {
+	for (short i = 0; i < 9; ++i)
 		m_vals[i] = vals[i];
 }
 
-matrix::matrix( double fillval )
-{
-	for( short i = 0; i < 9; ++i )
+matrix::matrix (double fillval) {
+	for (short i = 0; i < 9; ++i)
 		m_vals[i] = fillval;
 }
 
-matrix::matrix( initlist<double> vals )
-{
-	assert( vals.size() == 9 );
-	memcpy( &m_vals[0], &( *vals.begin() ), sizeof m_vals );
+matrix::matrix (initlist<double> vals) {
+	assert (vals.size() == 9);
+	memcpy (&m_vals[0], & (*vals.begin()), sizeof m_vals);
 }
 
-void matrix::puts() const
-{
-	for( short i = 0; i < 3; ++i )
-	{
-		for( short j = 0; j < 3; ++j )
-			print( "%1\t", m_vals[( i * 3 ) + j] );
+void matrix::puts() const {
+	for (short i = 0; i < 3; ++i) {
+		for (short j = 0; j < 3; ++j)
+			print ("%1\t", m_vals[ (i * 3) + j]);
 		
-		print( "\n" );
+		print ("\n");
 	}
 }
 
 // =============================================================================
-str matrix::stringRep() const
-{
+str matrix::stringRep() const {
 	str val;
 	
-	for( short i = 0; i < 9; ++i )
-	{
-		if( i > 0 )
+	for (short i = 0; i < 9; ++i) {
+		if (i > 0)
 			val += ' ';
 		
-		val += ftoa( m_vals[i] );
+		val += ftoa (m_vals[i]);
 	}
 	
 	return val;
 }
 
 // =============================================================================
-void matrix::zero()
-{
-	memset( &m_vals[0], 0, sizeof( double ) * 9 );
+void matrix::zero() {
+	memset (&m_vals[0], 0, sizeof (double) * 9);
 }
 
 // =============================================================================
-matrix matrix::mult( matrix other ) const
-{
+matrix matrix::mult (matrix other) const {
 	matrix val;
 	val.zero();
 	
-	for( short i = 0; i < 3; ++i )
-	for( short j = 0; j < 3; ++j )
-	for( short k = 0; k < 3; ++k )
-		val[( i * 3 ) + j] += m_vals[( i * 3 ) + k] * other[( k * 3 ) + j];
+	for (short i = 0; i < 3; ++i)
+	for (short j = 0; j < 3; ++j)
+	for (short k = 0; k < 3; ++k)
+		val[ (i * 3) + j] += m_vals[ (i * 3) + k] * other[ (k * 3) + j];
 
 	return val;
 }
 
 // =============================================================================
-matrix& matrix::operator= ( matrix other )
-{
-	memcpy( &m_vals[0], &other.m_vals[0], sizeof( double ) * 9 );
+matrix& matrix::operator= (matrix other) {
+	memcpy (&m_vals[0], &other.m_vals[0], sizeof (double) * 9);
 	return *this;
 }
 
 // =============================================================================
-double matrix::determinant() const
-{
-	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 )) -
-	       ( val( 1 ) * val( 3 ) * val( 8 )) -
-	       ( val( 0 ) * val( 5 ) * val( 7 ));
+double matrix::determinant() const {
+	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)) -
+	       (val (1) * val (3) * val (8)) -
+	       (val (0) * val (5) * val (7));
 }
 
 // =============================================================================
-StringFormatArg::StringFormatArg( const str& v )
-{
+StringFormatArg::StringFormatArg (const str& v) {
 	m_val = v;
 }
 
-StringFormatArg::StringFormatArg( const char& v )
-{
+StringFormatArg::StringFormatArg (const char& v) {
 	m_val = v;
 }
 
-StringFormatArg::StringFormatArg( const uchar& v )
-{
+StringFormatArg::StringFormatArg (const uchar& v) {
 	m_val = v;
 }
 
-StringFormatArg::StringFormatArg( const qchar& v )
-{
+StringFormatArg::StringFormatArg (const qchar& v) {
 	m_val = v;
 }
 
-StringFormatArg::StringFormatArg( const float& v )
-{
-	m_val = ftoa( v );
+StringFormatArg::StringFormatArg (const float& v) {
+	m_val = ftoa (v);
 }
 
-StringFormatArg::StringFormatArg( const double& v )
-{
-	m_val = ftoa( v );
+StringFormatArg::StringFormatArg (const double& v) {
+	m_val = ftoa (v);
 }
 
-StringFormatArg::StringFormatArg( const vertex& v )
-{
-	m_val = v.stringRep( false );
+StringFormatArg::StringFormatArg (const vertex& v) {
+	m_val = v.stringRep (false);
 }
 
-StringFormatArg::StringFormatArg( const matrix& v )
-{
+StringFormatArg::StringFormatArg (const matrix& v) {
 	m_val = v.stringRep();
 }
 
-StringFormatArg::StringFormatArg( const char* v )
-{
+StringFormatArg::StringFormatArg (const char* v) {
 	m_val = v;
 }
 
-StringFormatArg::StringFormatArg( const strconfig& v )
-{
+StringFormatArg::StringFormatArg (const strconfig& v) {
 	m_val = v.value;
 }
 
-StringFormatArg::StringFormatArg( const intconfig& v )
-{
-	m_val.number( v.value );
+StringFormatArg::StringFormatArg (const intconfig& v) {
+	m_val.number (v.value);
 }
 
-StringFormatArg::StringFormatArg( const floatconfig& v )
-{
-	m_val.number( v.value );
+StringFormatArg::StringFormatArg (const floatconfig& v) {
+	m_val.number (v.value);
 }
 
-StringFormatArg::StringFormatArg( const void* v )
-{
-	m_val.sprintf( "%p", v );
+StringFormatArg::StringFormatArg (const void* v) {
+	m_val.sprintf ("%p", v);
 }
 
 // =============================================================================
-File::File()
-{
+File::File() {
 	// Make a null file
 	m_file = null;
 	m_textstream = null;
 }
 
-File::File( str path, OpenType rtype )
-{
+File::File (str path, OpenType rtype) {
 	m_file = null;
-	open( path, rtype );
+	open (path, rtype);
 }
 
-File::File( FILE* fp, OpenType rtype )
-{
+File::File (FILE* fp, OpenType rtype) {
 	m_file = null;
-	open( fp, rtype );
+	open (fp, rtype);
 }
 
-File::~File()
-{
-	if( m_file )
-	{
+File::~File() {
+	if (m_file) {
 		m_file->close();
 		delete m_file;
 		
-		if( m_textstream )
+		if (m_textstream)
 			delete m_textstream;
 	}
 }
 
-bool File::open( FILE* fp, OpenType rtype )
-{
-	return open( "", rtype, fp );
+bool File::open (FILE* fp, OpenType rtype) {
+	return open ("", rtype, fp);
 }
 
-bool File::open( str path, OpenType rtype, FILE* fp )
-{
+bool File::open (str path, OpenType rtype, FILE* fp) {
 	close();
 	
-	if( !m_file )
+	if (!m_file)
 		m_file = new QFile;
 	
-	m_file->setFileName( path );
+	m_file->setFileName (path);
 	
 	bool result;
 	
 	QIODevice::OpenMode mode =
-		( rtype == Read ) ? QIODevice::ReadOnly :
-		( rtype == Write ) ? QIODevice::WriteOnly : QIODevice::Append;
+		 (rtype == Read) ? QIODevice::ReadOnly :
+		 (rtype == Write) ? QIODevice::WriteOnly : QIODevice::Append;
 	
-	if( fp )
-		result = m_file->open( fp, mode );
+	if (fp)
+		result = m_file->open (fp, mode);
 	else
-		result = m_file->open( mode );
+		result = m_file->open (mode);
 	
-	if( result )
-	{
-		m_textstream = new QTextStream( m_file );
+	if (result) {
+		m_textstream = new QTextStream (m_file);
 		return true;
 	}
 	
@@ -387,102 +337,85 @@
 	return false;
 }
 
-File::iterator File::begin()
-{
-	return iterator( this );
+File::iterator File::begin() {
+	return iterator (this);
 }
 
-File::iterator& File::end()
-{
+File::iterator& File::end() {
 	return m_endIterator;
 }
 
-void File::write( str msg )
-{
-	m_file->write( msg.toUtf8(), msg.length() );
+void File::write (str msg) {
+	m_file->write (msg.toUtf8(), msg.length());
 }
 
-bool File::readLine( str& line )
-{
-	if( !m_textstream || m_textstream->atEnd() )
+bool File::readLine (str& line) {
+	if (!m_textstream || m_textstream->atEnd())
 		return false;
 	
 	line = m_textstream->readLine();
 	return true;
 }
 
-bool File::atEnd() const
-{
-	if( !m_textstream )
-		fatal( "cannot use atEnd on a null file" );
+bool File::atEnd() const {
+	if (!m_textstream)
+		fatal ("cannot use atEnd on a null file");
 	
 	return m_textstream->atEnd();
 }
 
-bool File::isNull() const
-{
+bool File::isNull() const {
 	return m_file == null;
 }
 
-bool File::operator!() const
-{
+bool File::operator!() const {
 	return isNull();
 }
 
-void File::close()
-{
-	if( !m_file )
+void File::close() {
+	if (!m_file)
 		return;
 	
 	delete m_file;
 	m_file = null;
 	
-	if( m_textstream )
-	{
+	if (m_textstream) {
 		delete m_textstream;
 		m_textstream = null;
 	}
 }
 
-bool File::flush()
-{
+bool File::flush() {
 	return m_file->flush();
 }
 
-File::operator bool () const
-{
+File::operator bool() const {
 	return !isNull();
 }
 
-void File::rewind()
-{
-	m_file->seek( 0 );
+void File::rewind() {
+	m_file->seek (0);
 }
 
-File::iterator::iterator( File* f ) : m_file( f )
-{
-	operator++ ();
+File::iterator::iterator (File* f) : m_file (f) {
+	operator++();
 }
 
-void File::iterator::operator++ ()
-{
-	m_gotdata = m_file->readLine( m_text );
+void File::iterator::operator++() {
+	m_gotdata = m_file->readLine (m_text);
 }
 
-str File::iterator::operator* ()
-{
+str File::iterator::operator*() {
 	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 );
+bool File::iterator::operator== (File::iterator& other) {
+	return (other.m_file == null && !m_gotdata);
 }
 
-bool File::iterator::operator!= ( File::iterator& other )
-{
-	return !operator== ( other );
+bool File::iterator::operator!= (File::iterator& other) {
+	return !operator== (other);
 }
 
 // =============================================================================
--- a/src/types.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/types.h	Fri Aug 02 16:33:30 2013 +0300
@@ -5,7 +5,7 @@
  *  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
@@ -39,16 +39,14 @@
 typedef unsigned int uint;
 typedef unsigned short ushort;
 typedef unsigned long ulong;
-
-// Typedef out the _t suffices :)
-typedef int8_t int8;
-typedef int16_t int16;
-typedef int32_t int32;
-typedef int64_t int64;
-typedef uint8_t uint8;
-typedef uint16_t uint16;
-typedef uint32_t uint32;
-typedef uint64_t uint64;
+typedef qint8 int8;
+typedef qint16 int16;
+typedef qint32 int32;
+typedef qint64 int64;
+typedef quint8 uint8;
+typedef quint16 uint16;
+typedef quint32 uint32;
+typedef quint64 uint64;
 
 template<class T> using initlist = std::initializer_list<T>;
 template<class T, class R> using pair = std::pair<T, R>;
@@ -66,7 +64,7 @@
 // =============================================================================
 class matrix {
 public:
-	matrix () {}
+	matrix() {}
 	matrix (initlist<double> vals);
 	matrix (double fillval);
 	matrix (double vals[]);
@@ -98,7 +96,7 @@
 // =============================================================================
 class vertex {
 public:
-	vertex () {}
+	vertex() {}
 	vertex (double x, double y, double z);
 	
 	double&			coord			(const ushort n) { return m_coords[n]; }
@@ -145,51 +143,51 @@
 	typedef typename std::deque<T>::reverse_iterator r_it;
 	typedef typename std::deque<T>::const_reverse_iterator cr_it;
 	
-	List () {}
+	List() {}
 	List (initlist<T> vals) {
 		m_vect = vals;
 	}
 	
-	it begin () {
-		return m_vect.begin ();
+	it begin() {
+		return m_vect.begin();
 	}
 	
-	c_it begin () const {
-		return m_vect.cbegin ();
+	c_it begin() const {
+		return m_vect.cbegin();
 	}
 	
-	it end () {
-		return m_vect.end ();
+	it end() {
+		return m_vect.end();
 	}
 	
-	c_it end () const {
-		return m_vect.cend ();
+	c_it end() const {
+		return m_vect.cend();
 	}
 	
-	r_it rbegin () {
-		return m_vect.rbegin ();
+	r_it rbegin() {
+		return m_vect.rbegin();
 	}
 	
-	cr_it crbegin () const {
-		return m_vect.crbegin ();
+	cr_it crbegin() const {
+		return m_vect.crbegin();
 	}
 	
-	r_it rend () {
-		return m_vect.rend ();
+	r_it rend() {
+		return m_vect.rend();
 	}
 	
-	cr_it crend () const {
-		return m_vect.crend ();
+	cr_it crend() const {
+		return m_vect.crend();
 	}
 	
 	void erase (ulong pos) {
-		assert (pos < size ());
-		m_vect.erase (m_vect.begin () + pos);
+		assert (pos < size());
+		m_vect.erase (m_vect.begin() + pos);
 	}
 	
 	T& push_back (const T& value) {
 		m_vect.push_back (value);
-		return m_vect[m_vect.size () - 1];
+		return m_vect[m_vect.size() - 1];
 	}
 	
 	void push_back (const List<T>& vals) {
@@ -198,11 +196,11 @@
 	}
 	
 	bool pop (T& val) {
-		if (size () == 0)
+		if (size() == 0)
 			return false;
 		
-		val = m_vect[size () - 1];
-		erase (size () - 1);
+		val = m_vect[size() - 1];
+		erase (size() - 1);
 		return true;
 	}
 	
@@ -218,7 +216,7 @@
 		return pop (value);
 	}
 	
-	List<T> reverse () const {
+	List<T> reverse() const {
 		List<T> rev;
 		
 		for (const T& val : c_rev<T> (*this))
@@ -227,33 +225,33 @@
 		return rev;
 	}
 	
-	void clear () {
-		m_vect.clear ();
+	void clear() {
+		m_vect.clear();
 	}
 	
 	void insert (ulong pos, const T& value) {
-		m_vect.insert (m_vect.begin () + pos, value);
+		m_vect.insert (m_vect.begin() + pos, value);
 	}
 	
-	void makeUnique () {
+	void makeUnique() {
 		// Remove duplicate entries. For this to be effective, the List must be
 		// sorted first.
-		sort ();
-		it pos = std::unique (begin (), end ());
-		resize (std::distance (begin (), pos));
+		sort();
+		it pos = std::unique (begin(), end());
+		resize (std::distance (begin(), pos));
 	}
 	
-	ulong size () const {
-		return m_vect.size ();
+	ulong size() const {
+		return m_vect.size();
 	}
 	
 	T& operator[] (ulong n) {
-		assert (n < size ());
+		assert (n < size());
 		return m_vect[n];
 	}
 	
 	const T& operator[] (ulong n) const {
-		assert (n < size ());
+		assert (n < size());
 		return m_vect[n];
 	}
 	
@@ -261,8 +259,8 @@
 		m_vect.resize (size);
 	}
 	
-	void sort () {
-		std::sort (begin (), end ());
+	void sort() {
+		std::sort (begin(), end());
 	}
 	
 	ulong find (const T& needle) {
@@ -296,12 +294,12 @@
 		m_vect = &vect;
 	}
 	
-	it begin () {
-		return m_vect->rbegin ();
+	it begin() {
+		return m_vect->rbegin();
 	}
 	
-	it end () {
-		return m_vect->rend ();
+	it end() {
+		return m_vect->rend();
 	}
 	
 private:
@@ -323,12 +321,12 @@
 		m_vect = &vect;
 	}
 	
-	it begin () const {
-		return m_vect->crbegin ();
+	it begin() const {
+		return m_vect->crbegin();
 	}
 	
-	it end () const {
-		return m_vect->crend ();
+	it end() const {
+		return m_vect->crend();
 	}
 	
 private:
@@ -343,7 +341,7 @@
 // =============================================================================
 // StringFormatArg
 // 
-// Converts a given value into a string that can be retrieved with ::value ().
+// Converts a given value into a string that can be retrieved with ::value().
 // Used as the argument type to the formatting functions, hence its name.
 // =============================================================================
 class StringFormatArg {
@@ -386,7 +384,7 @@
 				m_val += ", ";
 			
 			StringFormatArg arg (it);
-			m_val += arg.value ();
+			m_val += arg.value();
 		}
 		
 		if (i)
@@ -395,7 +393,7 @@
 		m_val += "}";
 	}
 	
-	str value () const { return m_val; }
+	str value() const { return m_val; }
 private:
 	str m_val;
 };
@@ -412,10 +410,10 @@
 	// Iterator class to enable range-for-loop support. Rough hack.. don't use directly!
 	class iterator {
 	public:
-		iterator () : m_file (null) {} // end iterator has m_file == null
+		iterator() : m_file (null) {} // end iterator has m_file == null
 		iterator (File* f);
-		void operator++ ();
-		str  operator* ();
+		void operator++();
+		str  operator*();
 		bool operator== (iterator& other);
 		bool operator!= (iterator& other);
 	
@@ -432,25 +430,25 @@
 		Append
 	};
 	
-	File ();
+	File();
 	File (str path, File::OpenType rtype);
 	File (FILE* fp, File::OpenType rtype);
-	~File ();
+	~File();
 	
-	bool         atEnd         () const;
-	iterator     begin         ();
-	void         close         ();
-	iterator&    end           ();
-	bool         flush         ();
-	bool         isNull        () const;
-	bool         readLine      (str& line);
-	void         rewind        ();
-	bool         open          (FILE* fp, OpenType rtype);
-	bool         open          (str path, OpenType rtype, FILE* fp = null);
-	void         write         (str msg);
+	bool         atEnd() const;
+	iterator     begin();
+	void         close();
+	iterator&    end();
+	bool         flush();
+	bool         isNull() const;
+	bool         readLine (str& line);
+	void         rewind();
+	bool         open (FILE* fp, OpenType rtype);
+	bool         open (str path, OpenType rtype, FILE* fp = null);
+	void         write (str msg);
 	
-	bool         operator!     () const;
-	operator bool () const;
+	bool         operator!() const;
+	operator bool() const;
 	
 private:
 	QFile*       m_file;
@@ -491,7 +489,7 @@
 
 // log() - universal access to the message log. Defined here so that I don't have
 // to include messagelog.h here and recompile everything every time that file changes.
-void DoLog( std::initializer_list<StringFormatArg> args );
+void DoLog (std::initializer_list<StringFormatArg> args);
 
 // Macros to access these functions
 # ifndef IN_IDE_PARSER
@@ -503,7 +501,7 @@
 str fmt (const char* fmtstr, ...);
 void print (const char* fmtstr, ...);
 void fprint (File& f, const char* fmtstr, ...);
-void log( const char* fmtstr, ... );
+void log (const char* fmtstr, ...);
 #endif
 
 extern File g_file_stdout;
--- a/src/widgets.cpp	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/widgets.cpp	Fri Aug 02 16:33:30 2013 +0300
@@ -33,7 +33,7 @@
 }
 
 bool RadioBox::isChecked (int n) const {
-	return m_buttonGroup->checkedId () == n;
+	return m_buttonGroup->checkedId() == n;
 }
 
 void RadioBox::init (Qt::Orientation orient) {
@@ -47,7 +47,7 @@
 	setLayout (m_coreLayout);
 	
 	// Init the first row with a break
-	rowBreak ();
+	rowBreak();
 	
 	connect (m_buttonGroup, SIGNAL (buttonPressed (int)), this, SLOT (slot_buttonPressed (int)));
 	connect (m_buttonGroup, SIGNAL (buttonReleased (int)), this, SLOT (slot_buttonReleased (int)));
@@ -63,7 +63,7 @@
 		addButton (entry);
 }
 
-void RadioBox::rowBreak () {
+void RadioBox::rowBreak() {
 	QBoxLayout* newLayout = new QBoxLayout (m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
 	m_currentLayout = newLayout;
 	m_layouts << newLayout;
@@ -101,8 +101,8 @@
 	m_currentLayout = m_layouts[row];
 }
 
-int RadioBox::value () const {
-	return m_buttonGroup->checkedId ();
+int RadioBox::value() const {
+	return m_buttonGroup->checkedId();
 }
 
 void RadioBox::setValue (int val) {
@@ -116,23 +116,23 @@
 void RadioBox::slot_buttonPressed (int btn) {
 	emit buttonPressed (btn);
 	
-	m_oldId = m_buttonGroup->checkedId ();
+	m_oldId = m_buttonGroup->checkedId();
 }
 
 void RadioBox::slot_buttonReleased (int btn) {
 	emit buttonReleased (btn);
-	int newid = m_buttonGroup->checkedId ();
+	int newid = m_buttonGroup->checkedId();
 	
 	if (m_oldId != newid)
 		emit valueChanged (newid);
 }
 
 RadioBox::it RadioBox::begin() {
-	 return m_objects.begin ();
+	 return m_objects.begin();
 }
 
 RadioBox::it RadioBox::end() {
-	return m_objects.end ();
+	return m_objects.end();
 }
 
 #include "build/moc_widgets.cpp"
\ No newline at end of file
--- a/src/widgets.h	Fri Aug 02 15:57:03 2013 +0300
+++ b/src/widgets.h	Fri Aug 02 16:33:30 2013 +0300
@@ -41,8 +41,8 @@
 public:
 	typedef List<QRadioButton*>::it it;
 	
+	explicit RadioBox() { init (Qt::Vertical); }
 	explicit RadioBox (QWidget* parent = null) : QGroupBox (parent) { init (Qt::Vertical); }
-	explicit RadioBox () { init (Qt::Vertical); }
 	explicit RadioBox (const QString& title, QWidget* parent = null);
 	explicit RadioBox (const QString& title, initlist<char const*> entries, int const defaultId,
 		const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null);

mercurial