Merge ../ldforge into gl

Sun, 09 Mar 2014 14:59:46 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 09 Mar 2014 14:59:46 +0200
changeset 690
9e9c52ca955e
parent 689
397870c6ed38 (current diff)
parent 652
5d37b2f2ae16 (diff)
child 691
ed26a5bbd585

Merge ../ldforge into gl

Conflicts:
src/Document.cc
src/Document.h
src/GLRenderer.cc
src/LDObject.cc
src/LDObject.h
src/Types.h
src/actions/EditActions.cc

CMakeLists.txt file | annotate | diff | comparison | revisions
src/Document.cc file | annotate | diff | comparison | revisions
src/Document.h file | annotate | diff | comparison | revisions
src/ExternalPrograms.cc file | annotate | diff | comparison | revisions
src/GLCompiler.h file | annotate | diff | comparison | revisions
src/GLRenderer.cc file | annotate | diff | comparison | revisions
src/GLRenderer.h file | annotate | diff | comparison | revisions
src/LDObject.cc file | annotate | diff | comparison | revisions
src/LDObject.h file | annotate | diff | comparison | revisions
src/Main.cc file | annotate | diff | comparison | revisions
src/PropertyMacro.h file | annotate | diff | comparison | revisions
src/Types.cc file | annotate | diff | comparison | revisions
src/Types.h file | annotate | diff | comparison | revisions
src/actions/EditActions.cc file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Sun Mar 09 14:04:06 2014 +0200
+++ b/CMakeLists.txt	Sun Mar 09 14:59:46 2014 +0200
@@ -48,7 +48,7 @@
 )
 
 set (LDForgeHeaders
-	src/PropertyMacro.h
+	src/Macros.h
 	src/CrashCatcher.h
 	src/Colors.h
 	src/misc/DocumentPointer.h
@@ -73,6 +73,7 @@
 	src/Configuration.h
 	src/MainWindow.h
 	src/EditHistory.h
+	src/Format.h
 )
 
 set (LDForgeForms
--- a/src/AddObjectDialog.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/AddObjectDialog.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -36,23 +36,23 @@
 #include "Primitives.h"
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 class SubfileListItem : public QTreeWidgetItem
 {
-	PROPERTY (public,	Primitive*,	PrimitiveInfo, NO_OPS,	STOCK_WRITE)
+	PROPERTY (public, Primitive*,	primitive, setPrimitive, STOCK_WRITE)
 
 	public:
 		SubfileListItem (QTreeWidgetItem* parent, Primitive* info) :
 			QTreeWidgetItem (parent),
-			m_PrimitiveInfo (info) {}
+			m_primitive (info) {}
 
 		SubfileListItem (QTreeWidget* parent, Primitive* info) :
 			QTreeWidgetItem (parent),
-			m_PrimitiveInfo (info) {}
+			m_primitive (info) {}
 };
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 AddObjectDialog::AddObjectDialog (const LDObject::Type type, LDObject* obj, QWidget* parent) :
 	QDialog (parent)
 {
@@ -68,7 +68,7 @@
 			le_comment = new QLineEdit;
 
 			if (obj)
-				le_comment->setText (static_cast<LDComment*> (obj)->text);
+				le_comment->setText (static_cast<LDComment*> (obj)->text());
 
 			le_comment->setMinimumWidth (384);
 		} break;
@@ -104,11 +104,11 @@
 				if (i == LDBFC::NumStatements / 2)
 					rb_bfcType->rowBreak();
 
-				rb_bfcType->addButton (LDBFC::statements[i]);
+				rb_bfcType->addButton (LDBFC::k_statementStrings[i]);
 			}
 
 			if (obj)
-				rb_bfcType->setValue ( (int) static_cast<LDBFC*> (obj)->type);
+				rb_bfcType->setValue ( (int) static_cast<LDBFC*> (obj)->statement());
 		} break;
 
 		case LDObject::ESubfile:
@@ -120,18 +120,18 @@
 			for (PrimitiveCategory* cat : g_PrimitiveCategories)
 			{
 				SubfileListItem* parentItem = new SubfileListItem (tw_subfileList, null);
-				parentItem->setText (0, cat->getName());
+				parentItem->setText (0, cat->name());
 				QList<QTreeWidgetItem*> subfileItems;
 
 				for (Primitive& prim : cat->prims)
 				{
 					SubfileListItem* item = new SubfileListItem (parentItem, &prim);
-					item->setText (0, fmt ("%1 - %2", prim.name, prim.title));
+					item->setText (0, format ("%1 - %2", prim.name, prim.title));
 					subfileItems << item;
 
 					// If this primitive is the one the current object points to,
 					// select it by default
-					if (obj && static_cast<LDSubfile*> (obj)->getFileInfo()->getName() == prim.name)
+					if (obj && static_cast<LDSubfile*> (obj)->fileInfo()->name() == prim.name)
 						tw_subfileList->setCurrentItem (item);
 				}
 
@@ -146,17 +146,17 @@
 			if (obj)
 			{
 				LDSubfile* ref = static_cast<LDSubfile*> (obj);
-				le_subfileName->setText (ref->getFileInfo()->getName());
+				le_subfileName->setText (ref->fileInfo()->name());
 			}
 		} break;
 
 		default:
 		{
-			critical (fmt ("Unhandled LDObject type %1 (%2) in AddObjectDialog", (int) type, typeName));
+			critical (format ("Unhandled LDObject type %1 (%2) in AddObjectDialog", (int) type, typeName));
 		} return;
 	}
 
-	QPixmap icon = getIcon (fmt ("add-%1", typeName));
+	QPixmap icon = getIcon (format ("add-%1", typeName));
 	LDObject* defaults = LDObject::getDefault (type);
 
 	lb_typeIcon = new QLabel;
@@ -166,7 +166,7 @@
 	if (defaults->isColored())
 	{
 		if (obj != null)
-			colnum = obj->getColor();
+			colnum = obj->color();
 		else
 			colnum = (type == LDObject::ECondLine || type == LDObject::ELine) ? edgecolor : maincolor;
 
@@ -198,7 +198,7 @@
 			{
 				for (int i = 0; i < coordCount / 3; ++i)
 					for (int j = 0; j < 3; ++j)
-						dsb_coords[ (i * 3) + j]->setValue (obj->getVertex (i).getCoordinate (j));
+						dsb_coords[ (i * 3) + j]->setValue (obj->vertex (i).getCoordinate (j));
 			}
 
 			break;
@@ -233,9 +233,9 @@
 		if (mo)
 		{
 			for_axes (ax)
-				dsb_coords[ax]->setValue (mo->getPosition()[ax]);
+				dsb_coords[ax]->setValue (mo->position()[ax]);
 
-			defaultMatrix = mo->getTransform();
+			defaultMatrix = mo->transform();
 		}
 
 		le_matrix->setText (defaultMatrix.toString());
@@ -261,39 +261,39 @@
 	QWidget::connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject()));
 	layout->addWidget (bbx_buttons, 5, 0, 1, 4);
 	setLayout (layout);
-	setWindowTitle (fmt (tr ("Edit %1"), typeName));
+	setWindowTitle (format (tr ("Edit %1"), typeName));
 
 	setWindowIcon (icon);
-	defaults->deleteSelf();
+	defaults->destroy();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void AddObjectDialog::setButtonBackground (QPushButton* button, int colnum)
 {
-	LDColor* col = getColor (colnum);
+	LDColor* col = ::getColor (colnum);
 
 	button->setIcon (getIcon ("palette"));
 	button->setAutoFillBackground (true);
 
 	if (col)
-		button->setStyleSheet (fmt ("background-color: %1", col->hexcode));
+		button->setStyleSheet (format ("background-color: %1", col->hexcode));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 QString AddObjectDialog::currentSubfileName()
 {
 	SubfileListItem* item = static_cast<SubfileListItem*> (tw_subfileList->currentItem());
 
-	if (item->getPrimitiveInfo() == null)
+	if (item->primitive() == null)
 		return ""; // selected a heading
 
-	return item->getPrimitiveInfo()->name;
+	return item->primitive()->name;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void AddObjectDialog::slot_colorButtonClicked()
 {
 	ColorSelector::selectColor (colnum, colnum, this);
@@ -301,7 +301,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void AddObjectDialog::slot_subfileTypeChanged()
 {
 	QString name = currentSubfileName();
@@ -311,7 +311,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 template<class T> static T* initObj (LDObject*& obj)
 {
 	if (obj == null)
@@ -321,13 +321,13 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void AddObjectDialog::staticDialog (const LDObject::Type type, LDObject* obj)
 {
 	setlocale (LC_ALL, "C");
 
 	// FIXME: Redirect to Edit Raw
-	if (obj && obj->getType() == LDObject::EError)
+	if (obj && obj->type() == LDObject::EError)
 		return;
 
 	if (type == LDObject::EEmpty)
@@ -337,7 +337,7 @@
 	Matrix transform = g_identity;
 	AddObjectDialog dlg (type, obj);
 
-	assert (!obj || obj->getType() == type);
+	assert (obj == null || obj->type() == type);
 
 	if (dlg.exec() == false)
 		return;
@@ -363,7 +363,7 @@
 		case LDObject::EComment:
 		{
 			LDComment* comm = initObj<LDComment> (obj);
-			comm->text = dlg.le_comment->text();
+			comm->setText (dlg.le_comment->text());
 		}
 		break;
 
@@ -389,7 +389,7 @@
 		case LDObject::EBFC:
 		{
 			LDBFC* bfc = initObj<LDBFC> (obj);
-			bfc->type = (LDBFC::Type) dlg.rb_bfcType->value();
+			bfc->setStatement ((LDBFC::Statement) dlg.rb_bfcType->value());
 		} break;
 
 		case LDObject::EVertex:
@@ -412,7 +412,7 @@
 
 			if (!file)
 			{
-				critical (fmt ("Couldn't open `%1': %2", name, strerror (errno)));
+				critical (format ("Couldn't open `%1': %2", name, strerror (errno)));
 				return;
 			}
 
--- a/src/AddObjectDialog.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/AddObjectDialog.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_ADDOBJECTDIALOG_H
-#define LDFORGE_ADDOBJECTDIALOG_H
-
+#pragma once
 #include <QDialog>
 #include "LDObject.h"
 
@@ -69,5 +67,3 @@
 		void slot_colorButtonClicked();
 		void slot_subfileTypeChanged();
 };
-
-#endif // LDFORGE_ADDOBJECTDIALOG_H
--- a/src/ColorSelector.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/ColorSelector.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -39,7 +39,7 @@
 extern_cfg (Float, gl_maincolor_alpha);
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 ColorSelector::ColorSelector (int defval, QWidget* parent) : QDialog (parent)
 {
 	// Remove the default color if it's invalid
@@ -66,14 +66,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 ColorSelector::~ColorSelector()
 {
 	delete ui;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ColorSelector::drawScene()
 {
 	const int numCols = g_numColumns;
@@ -111,11 +111,11 @@
 
 		QPen pen (info->edgeColor, penWidth, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 		m_scene->addRect (x, y, w, w, pen, col);
-		QGraphicsTextItem* numtext = m_scene->addText (fmt ("%1", i));
+		QGraphicsTextItem* numtext = m_scene->addText (format ("%1", i));
 		numtext->setDefaultTextColor ( (luma (col) < 80) ? Qt::white : Qt::black);
 		numtext->setPos (x, y);
 
-		if (getSelection() && i == getSelection()->index)
+		if (selection() && i == selection()->index)
 		{
 			auto curspic = m_scene->addPixmap (getIcon ("colorcursor"));
 			curspic->setPos (x, y);
@@ -124,34 +124,34 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 int ColorSelector::numRows() const
 {
 	return (MAX_COLORS / g_numColumns);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 int ColorSelector::viewportWidth() const
 {
 	return g_numColumns * g_squareSize + 21;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ColorSelector::drawColorInfo()
 {
-	if (!getSelection())
+	if (!selection())
 	{
 		ui->colorLabel->setText ("---");
 		return;
 	}
 
-	ui->colorLabel->setText (fmt ("%1 - %2", getSelection()->index, getSelection()->name));
+	ui->colorLabel->setText (format ("%1 - %2", selection()->index, selection()->name));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ColorSelector::resizeEvent (QResizeEvent* ev)
 {
 	// If this is the first resize, check if we need to scroll down to see the
@@ -161,9 +161,9 @@
 	{
 		int visibleColors = (ui->viewport->height() / g_squareSize) * g_numColumns;
 
-		if (getSelection() && getSelection()->index >= visibleColors)
+		if (selection() && selection()->index >= visibleColors)
 		{
-			int y = (getSelection()->index / g_numColumns) * g_squareSize;
+			int y = (selection()->index / g_numColumns) * g_squareSize;
 			ui->viewport->verticalScrollBar()->setValue (y);
 		}
 
@@ -175,7 +175,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ColorSelector::mousePressEvent (QMouseEvent* event)
 {
 	QPointF scenepos = ui->viewport->mapToScene (event->pos());
@@ -195,14 +195,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 bool ColorSelector::selectColor (int& val, int defval, QWidget* parent)
 {
 	ColorSelector dlg (defval, parent);
 
-	if (dlg.exec() && dlg.getSelection() != null)
+	if (dlg.exec() && dlg.selection() != null)
 	{
-		val = dlg.getSelection()->index;
+		val = dlg.selection()->index;
 		return true;
 	}
 
--- a/src/ColorSelector.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/ColorSelector.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_COLORSELECTOR_H
-#define LDFORGE_COLORSELECTOR_H
-
+#pragma once
 #include <QDialog>
 #include "Main.h"
 
@@ -29,7 +27,7 @@
 class ColorSelector : public QDialog
 {
 	Q_OBJECT
-	PROPERTY (private,	LDColor*,	Selection,	NO_OPS,	STOCK_WRITE)
+	PROPERTY (private,	LDColor*,	selection,	setSelection,	STOCK_WRITE)
 
 	public:
 		explicit ColorSelector (int defval = -1, QWidget* parent = null);
@@ -50,5 +48,3 @@
 		void drawScene();
 		void drawColorInfo();
 };
-
-#endif // LDFORGE_COLORSELECTOR_H
--- a/src/Colors.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Colors.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -32,11 +32,11 @@
 static LDColor* g_LDColors[MAX_COLORS];
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void initColors()
 {
 	LDColor* col;
-	log ("%1: initializing color information.\n", __func__);
+	print ("Initializing color information.\n");
 
 	// Always make sure there's 16 and 24 available. They're special like that.
 	col = new LDColor;
@@ -52,7 +52,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 LDColor* getColor (int colnum)
 {
 	// Check bounds
@@ -63,7 +63,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void setColor (int colnum, LDColor* col)
 {
 	if (colnum < 0 || colnum >= MAX_COLORS)
@@ -73,7 +73,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 int luma (QColor& col)
 {
 	return (0.2126f * col.red()) +
--- a/src/Colors.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Colors.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_COLORS_H
-#define LDFORGE_COLORS_H
-
+#pragma once
 #include <QColor>
 #include "Main.h"
 
@@ -42,5 +40,3 @@
 // Main and edge color identifiers
 static const int maincolor = 16;
 static const int edgecolor = 24;
-
-#endif // LDFORGE_COLORS_H
--- a/src/Configuration.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Configuration.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -45,7 +45,7 @@
 
 // =============================================================================
 // Get the QSettings object.
-// -----------------------------------------------------------------------------
+// =============================================================================
 static QSettings* getSettingsObject()
 {
 	QString path = qApp->applicationDirPath() + "/" UNIXNAME EXTENSION;
@@ -53,24 +53,24 @@
 }
 
 Config::Config (QString name) :
-	m_Name (name) {}
+	m_name (name) {}
 
 // =============================================================================
 // Load the configuration from file
-// -----------------------------------------------------------------------------
+// =============================================================================
 bool Config::load()
 {
 	QSettings* settings = getSettingsObject();
-	log ("config::load: Loading configuration file from %1\n", settings->fileName());
+	print ("config::load: Loading configuration file from %1\n", settings->fileName());
 
 	for (Config* cfg : g_configPointers)
 	{
 		if (!cfg)
 			break;
 
-		QVariant val = settings->value (cfg->getName(), cfg->getDefaultAsVariant());
+		QVariant val = settings->value (cfg->name(), cfg->getDefaultAsVariant());
 		cfg->loadFromVariant (val);
-		g_configsByName[cfg->getName()] = cfg;
+		g_configsByName[cfg->name()] = cfg;
 		g_configs << cfg;
 	}
 
@@ -79,29 +79,30 @@
 }
 
 // =============================================================================
+//
 // Save the configuration to disk
-// -----------------------------------------------------------------------------
+//
 bool Config::save()
 {
 	QSettings* settings = getSettingsObject();
-	log ("Saving configuration to %1...\n", settings->fileName());
 
 	for (Config* cfg : g_configs)
 	{
 		if (!cfg->isDefault())
-			settings->setValue (cfg->getName(), cfg->toVariant());
+			settings->setValue (cfg->name(), cfg->toVariant());
 		else
-			settings->remove (cfg->getName());
+			settings->remove (cfg->name());
 	}
 
 	settings->sync();
+	print ("Configuration saved to %1.\n", settings->fileName());
 	settings->deleteLater();
 	return true;
 }
 
 // =============================================================================
 // Reset configuration to defaults.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void Config::reset()
 {
 	for (Config* cfg : g_configs)
@@ -110,7 +111,7 @@
 
 // =============================================================================
 // Where is the configuration file located at?
-// -----------------------------------------------------------------------------
+// =============================================================================
 QString Config::filepath (QString file)
 {
 	return Config::dirpath() + DIRSLASH + file;
@@ -118,7 +119,7 @@
 
 // =============================================================================
 // Directory of the configuration file.
-// -----------------------------------------------------------------------------
+// =============================================================================
 QString Config::dirpath()
 {
 	QSettings* cfg = getSettingsObject();
@@ -129,7 +130,7 @@
 // We cannot just add config objects to a list or vector because that would rely
 // on the vector's c-tor being called before the configs' c-tors. With global
 // variables we cannot assume that, therefore we need to use a C-style array here.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void Config::addToArray (Config* ptr)
 {
 	if (g_cfgPointerCursor == 0)
@@ -140,7 +141,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 template<class T> T* getConfigByName (QString name, Config::Type type)
 {
 	auto it = g_configsByName.find (name);
@@ -160,7 +161,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 #undef IMPLEMENT_CONFIG
 
 #define IMPLEMENT_CONFIG(NAME)										\
--- a/src/Configuration.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Configuration.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,16 +16,13 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_CONFIG_H
-#define LDFORGE_CONFIG_H
-
-#include "PropertyMacro.h"
-#include "Types.h"
-
-// =============================================================================
+#pragma once
 #include <QString>
 #include <QVariant>
 #include <QKeySequence>
+#include "Macros.h"
+#include "Types.h"
+
 class QSettings;
 
 #define MAX_INI_LINE 512
@@ -40,7 +37,7 @@
 // =========================================================
 class Config
 {
-	PROPERTY (private, QString, Name, STR_OPS, STOCK_WRITE)
+	PROPERTY (private, QString, name, setName, STOCK_WRITE)
 
 	public:
 		enum Type
@@ -148,45 +145,50 @@
 	ValueType	m_default;
 
 // =============================================================================
+//
 class IntConfig : public Config
 {
 	IMPLEMENT_CONFIG (Int)
 };
 
 // =============================================================================
+//
 class StringConfig : public Config
 {
 	IMPLEMENT_CONFIG (String)
 };
 
 // =============================================================================
+//
 class FloatConfig : public Config
 {
 	IMPLEMENT_CONFIG (Float)
 };
 
 // =============================================================================
+//
 class BoolConfig : public Config
 {
 	IMPLEMENT_CONFIG (Bool)
 };
 
 // =============================================================================
+//
 class KeySequenceConfig : public Config
 {
 	IMPLEMENT_CONFIG (KeySequence)
 };
 
 // =============================================================================
+//
 class ListConfig : public Config
 {
 	IMPLEMENT_CONFIG (List)
 };
 
 // =============================================================================
+//
 class VertexConfig : public Config
 {
 	IMPLEMENT_CONFIG (Vertex)
 };
-
-#endif // LDFORGE_CONFIG_H
--- a/src/ConfigurationDialog.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/ConfigurationDialog.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -80,7 +80,7 @@
 #endif
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 ConfigDialog::ConfigDialog (ConfigDialog::Tab deftab, QWidget* parent, Qt::WindowFlags f) :
 	QDialog (parent, f)
 {
@@ -163,14 +163,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 ConfigDialog::~ConfigDialog()
 {
 	delete ui;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::selectPage (int row)
 {
 	ui->m_pagelist->setCurrentRow (row);
@@ -179,7 +179,7 @@
 
 // =============================================================================
 // Adds a shortcut entry to the list of shortcuts.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::addShortcut (KeySequenceConfig& cfg, QAction* act, int& i)
 {
 	ShortcutListItem* item = new ShortcutListItem;
@@ -198,7 +198,7 @@
 
 // =============================================================================
 // Initializes the table of grid stuff
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::initGrids()
 {
 	QGridLayout* gridlayout = new QGridLayout;
@@ -208,7 +208,7 @@
 	*anglabel = new QLabel ("Angle");
 	int i = 1;
 
-	for (QLabel* label : initlist<QLabel*> ({xlabel, ylabel, zlabel, anglabel}))
+	for (QLabel* label : QList<QLabel*> ({xlabel, ylabel, zlabel, anglabel}))
 	{
 		label->setAlignment (Qt::AlignCenter);
 		gridlayout->addWidget (label, 0, i++);
@@ -218,10 +218,10 @@
 	{
 		// Icon
 		lb_gridIcons[i] = new QLabel;
-		lb_gridIcons[i]->setPixmap (getIcon (fmt ("grid-%1", QString (g_GridInfo[i].name).toLower())));
+		lb_gridIcons[i]->setPixmap (getIcon (format ("grid-%1", QString (g_GridInfo[i].name).toLower())));
 
 		// Text label
-		lb_gridLabels[i] = new QLabel (fmt ("%1:", g_GridInfo[i].name));
+		lb_gridLabels[i] = new QLabel (format ("%1:", g_GridInfo[i].name));
 
 		QHBoxLayout* labellayout = new QHBoxLayout;
 		labellayout->addWidget (lb_gridIcons[i]);
@@ -246,7 +246,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 static struct LDExtProgInfo
 {
 	const QString		name,
@@ -276,7 +276,7 @@
 
 // =============================================================================
 // Initializes the stuff in the ext programs tab
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::initExtProgs()
 {
 	QGridLayout* pathsLayout = new QGridLayout;
@@ -317,7 +317,7 @@
 
 // =============================================================================
 // Set the settings based on widget data.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::applySettings()
 {
 	// Apply configuration
@@ -364,13 +364,12 @@
 	loadLogoedStuds();
 	g_win->R()->setBackground();
 	g_win->doFullRefresh();
-	g_win->updateToolBars();
 	g_win->updateDocumentList();
 }
 
 // =============================================================================
 // A dialog button was clicked
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::buttonClicked (QAbstractButton* button)
 {
 	typedef QDialogButtonBox QDDB;
@@ -391,7 +390,7 @@
 
 // =============================================================================
 // Update the list of color toolbar items in the quick color tab.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::updateQuickColorList (LDQuickColor* sel)
 {
 	for (QListWidgetItem * item : quickColorItems)
@@ -411,7 +410,7 @@
 		}
 		else
 		{
-			LDColor* col = entry.getColor();
+			LDColor* col = entry.color();
 
 			if (col == null)
 			{
@@ -438,7 +437,7 @@
 
 // =============================================================================
 // Quick colors: add or edit button was clicked.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_setColor()
 {
 	LDQuickColor* entry = null;
@@ -459,7 +458,7 @@
 			return; // don't color separators
 	}
 
-	int defval = entry ? entry->getColor()->index : -1;
+	int defval = entry ? entry->color()->index : -1;
 	int val;
 
 	if (ColorSelector::selectColor (val, defval, this) == false)
@@ -483,7 +482,7 @@
 
 // =============================================================================
 // Remove a quick color
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_delColor()
 {
 	if (ui->quickColorList->selectedItems().isEmpty())
@@ -496,7 +495,7 @@
 
 // =============================================================================
 // Move a quick color up/down
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_moveColor()
 {
 	const bool up = (static_cast<QPushButton*> (sender()) == ui->quickColor_moveUp);
@@ -519,8 +518,9 @@
 }
 
 // =============================================================================
+//
 // Add a separator to quick colors
-// -----------------------------------------------------------------------------
+//
 void ConfigDialog::slot_addColorSeparator()
 {
 	quickColors << LDQuickColor::getSeparator();
@@ -528,8 +528,9 @@
 }
 
 // =============================================================================
+//
 // Clear all quick colors
-// -----------------------------------------------------------------------------
+//
 void ConfigDialog::slot_clearColors()
 {
 	quickColors.clear();
@@ -537,8 +538,9 @@
 }
 
 // =============================================================================
+//
 // Pick a color and set the appropriate configuration option.
-// -----------------------------------------------------------------------------
+//
 void ConfigDialog::pickColor (QString& conf, QPushButton* button)
 {
 	QColor col = QColorDialog::getColor (QColor (conf));
@@ -557,21 +559,21 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_setGLBackground()
 {
 	pickColor (gl_bgcolor, ui->backgroundColorButton);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_setGLForeground()
 {
 	pickColor (gl_maincolor, ui->mainColorButton);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_setGLSelectColor()
 {
 	pickColor (gl_selectcolor, ui->selColorButton);
@@ -579,17 +581,17 @@
 
 // =============================================================================
 // Sets background color of a given button.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::setButtonBackground (QPushButton* button, QString value)
 {
 	button->setIcon (getIcon ("colorselect"));
 	button->setAutoFillBackground (true);
-	button->setStyleSheet (fmt ("background-color: %1", value));
+	button->setStyleSheet (format ("background-color: %1", value));
 }
 
 // =============================================================================
 // Finds the given list widget item in the list of widget items given.
-// -----------------------------------------------------------------------------
+// =============================================================================
 int ConfigDialog::getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack)
 {
 	int i = 0;
@@ -607,7 +609,7 @@
 
 // =============================================================================
 // Which quick color is currently selected?
-// -----------------------------------------------------------------------------
+// =============================================================================
 QListWidgetItem* ConfigDialog::getSelectedQuickColor()
 {
 	if (ui->quickColorList->selectedItems().isEmpty())
@@ -618,7 +620,7 @@
 
 // =============================================================================
 // Get the list of shortcuts selected
-// -----------------------------------------------------------------------------
+// =============================================================================
 QList<ShortcutListItem*> ConfigDialog::getShortcutSelection()
 {
 	QList<ShortcutListItem*> out;
@@ -631,7 +633,7 @@
 
 // =============================================================================
 // Edit the shortcut of a given action.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_setShortcut()
 {
 	QList<ShortcutListItem*> sel = getShortcutSelection();
@@ -641,41 +643,41 @@
 
 	ShortcutListItem* item = sel[0];
 
-	if (KeySequenceDialog::staticDialog (item->getKeyConfig(), this))
+	if (KeySequenceDialog::staticDialog (item->keyConfig(), this))
 		setShortcutText (item);
 }
 
 // =============================================================================
 // Reset a shortcut to defaults
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_resetShortcut()
 {
 	QList<ShortcutListItem*> sel = getShortcutSelection();
 
 	for (ShortcutListItem* item : sel)
 	{
-		item->getKeyConfig()->reset();
+		item->keyConfig()->reset();
 		setShortcutText (item);
 	}
 }
 
 // =============================================================================
 // Remove the shortcut of an action.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_clearShortcut()
 {
 	QList<ShortcutListItem*> sel = getShortcutSelection();
 
 	for (ShortcutListItem* item : sel)
 	{
-		item->getKeyConfig()->setValue (QKeySequence());
+		item->keyConfig()->setValue (QKeySequence());
 		setShortcutText (item);
 	}
 }
 
 // =============================================================================
 // Set the path of an external program
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ConfigDialog::slot_setExtProgPath()
 {
 	const LDExtProgInfo* info = null;
@@ -690,7 +692,7 @@
 	}
 
 	assert (info != null);
-	QString fpath = QFileDialog::getOpenFileName (this, fmt ("Path to %1", info->name), *info->path, g_extProgPathFilter);
+	QString fpath = QFileDialog::getOpenFileName (this, format ("Path to %1", info->name), *info->path, g_extProgPathFilter);
 
 	if (fpath.isEmpty())
 		return;
@@ -699,8 +701,9 @@
 }
 
 // =============================================================================
+//
 // '...' button pressed for the download path
-// -----------------------------------------------------------------------------
+//
 void ConfigDialog::slot_findDownloadFolder()
 {
 	QString dpath = QFileDialog::getExistingDirectory();
@@ -708,19 +711,20 @@
 }
 
 // =============================================================================
+//
 // Updates the text string for a given shortcut list item
-// -----------------------------------------------------------------------------
+//
 void ConfigDialog::setShortcutText (ShortcutListItem* item)
 {
-	QAction* act = item->getAction();
+	QAction* act = item->action();
 	QString label = act->iconText();
-	QString keybind = item->getKeyConfig()->getValue().toString();
-	item->setText (fmt ("%1 (%2)", label, keybind));
+	QString keybind = item->keyConfig()->getValue().toString();
+	item->setText (format ("%1 (%2)", label, keybind));
 }
 
 // =============================================================================
 // Gets the configuration string of the quick color toolbar
-// -----------------------------------------------------------------------------
+// =============================================================================
 QString ConfigDialog::quickColorString()
 {
 	QString val;
@@ -733,7 +737,7 @@
 		if (entry.isSeparator())
 			val += '|';
 		else
-			val += fmt ("%1", entry.getColor()->index);
+			val += format ("%1", entry.color()->index);
 	}
 
 	return val;
@@ -765,7 +769,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 bool KeySequenceDialog::staticDialog (KeySequenceConfig* cfg, QWidget* parent)
 {
 	KeySequenceDialog dlg (cfg->getValue(), parent);
@@ -778,7 +782,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void KeySequenceDialog::updateOutput()
 {
 	QString shortcut = seq.toString();
@@ -786,12 +790,12 @@
 	if (seq == QKeySequence())
 		shortcut = "&lt;empty&gt;";
 
-	QString text = fmt ("<center><b>%1</b></center>", shortcut);
+	QString text = format ("<center><b>%1</b></center>", shortcut);
 	lb_output->setText (text);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void KeySequenceDialog::keyPressEvent (QKeyEvent* ev)
 {
 	seq = ev->key() + ev->modifiers();
--- a/src/ConfigurationDialog.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/ConfigurationDialog.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_CONFIGDIALOG_H
-#define LDFORGE_CONFIGDIALOG_H
-
+#pragma once
 #include "MainWindow.h"
 #include <QDialog>
 
@@ -29,8 +27,8 @@
 // =============================================================================
 class ShortcutListItem : public QListWidgetItem
 {
-	PROPERTY (public,	KeySequenceConfig*,	KeyConfig,	NO_OPS,	STOCK_WRITE)
-	PROPERTY (public,	QAction*,				Action,		NO_OPS,	STOCK_WRITE)
+	PROPERTY (public,	KeySequenceConfig*,	keyConfig,	setKeyConfig,	STOCK_WRITE)
+	PROPERTY (public,	QAction*,			action,		setAction,		STOCK_WRITE)
 
 	public:
 		explicit ShortcutListItem (QListWidget* view = null, int type = Type) :
@@ -119,5 +117,3 @@
 	private slots:
 		virtual void keyPressEvent (QKeyEvent* ev) override;
 };
-
-#endif // LDFORGE_CONFIGDIALOG_H
--- a/src/CrashCatcher.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/CrashCatcher.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -24,7 +24,11 @@
 #include <QMessageBox>
 #include <unistd.h>
 #include <signal.h>
-#include <sys/prctl.h>
+
+#ifdef Q_OS_LINUX
+# include <sys/prctl.h>
+#endif
+
 #include "CrashCatcher.h"
 #include "Types.h"
 #include "Dialogs.h"
@@ -44,7 +48,7 @@
 });
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void handleCrash (int sig)
 {
 	printf ("%s: crashed with signal %d, launching gdb\n", __func__, sig);
@@ -63,7 +67,7 @@
 
 	if (commandsFile.open())
 	{
-		commandsFile.write (fmt ("attach %1\n", pid).toLocal8Bit());
+		commandsFile.write (format ("attach %1\n", pid).toLocal8Bit());
 		commandsFile.write (QString ("backtrace full\n").toLocal8Bit());
 		commandsFile.write (QString ("detach\n").toLocal8Bit());
 		commandsFile.write (QString ("quit").toLocal8Bit());
@@ -78,13 +82,15 @@
 	// Linux doesn't allow ptrace to be used on anything but direct child processes
 	// so we need to use prctl to register an exception to this to allow GDB attach to us.
 	// We need to do this now and no earlier because only now we actually know GDB's PID.
+#ifdef Q_OS_LINUX
 	prctl (PR_SET_PTRACER, proc.pid(), 0, 0, 0);
+#endif
 
 	proc.waitForFinished (1000);
 	QString output = QString (proc.readAllStandardOutput());
 	QString err = QString (proc.readAllStandardError());
 
-	bombBox (fmt ("<h3>Program crashed with signal %1</h3>\n\n"
+	bombBox (format ("<h3>Program crashed with signal %1</h3>\n\n"
 		"%2"
 		"<p><b>GDB <tt>stdout</tt>:</b></p><pre>%3</pre>\n"
 		"<p><b>GDB <tt>stderr</tt>:</b></p><pre>%4</pre>",
@@ -92,7 +98,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void initCrashCatcher()
 {
 	struct sigaction sighandler;
@@ -103,19 +109,20 @@
 	for (int sig : g_signalsToCatch)
 		sigaction (sig, &sighandler, null);
 
-	log ("%1: crash catcher hooked to signals: %2\n", __func__, g_signalsToCatch);
+	print ("%1: crash catcher hooked to signals: %2\n", __func__, g_signalsToCatch);
 }
 #endif // #ifdef __unix__
 
 // =============================================================================
+//
 // This function must be readily available in both Windows and Linux. We display
 // the bomb box straight in Windows while in Linux we let abort() trigger the
 // signal handler, which will cause the usual bomb box with GDB diagnostics.
 // Said prompt will embed the assertion failure information.
-// -----------------------------------------------------------------------------
+//
 void assertionFailure (const char* file, int line, const char* funcname, const char* expr)
 {
-	QString errmsg = fmt (
+	QString errmsg = format (
 		"<p><b>File</b>: <tt>%1</tt><br />"
 		"<b>Line</b>: <tt>%2</tt><br />"
 		"<b>Function:</b> <tt>%3</tt></p>"
--- a/src/CrashCatcher.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/CrashCatcher.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,14 +16,9 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_CRASHCATCHER_H
-#define LDFORGE_CRASHCATCHER_H
-
+#pragma once
 #ifdef __unix__
-
 void initCrashCatcher();
-
 #else // ifdef __unix__
-#define initCrashCatcher()
+# define initCrashCatcher()
 #endif // ifdef __unix__
-#endif // ifndef LDFORGE_CRASHCATCHER_H
\ No newline at end of file
--- a/src/Dialogs.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Dialogs.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -48,7 +48,7 @@
 extern_cfg (String, io_ldpath);
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 OverlayDialog::OverlayDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f)
 {
 	ui = new Ui_OverlayUI;
@@ -79,14 +79,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 OverlayDialog::~OverlayDialog()
 {
 	delete ui;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void OverlayDialog::fillDefaults (int newcam)
 {
 	LDGLOverlay& info = g_win->R()->getOverlay (newcam);
@@ -111,7 +111,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 QString OverlayDialog::fpath() const
 {
 	return ui->filename->text();
@@ -159,7 +159,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 LDrawPathDialog::LDrawPathDialog (const bool validDefault, QWidget* parent, Qt::WindowFlags f) :
 	QDialog (parent, f),
 	m_validDefault (validDefault)
@@ -190,7 +190,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 LDrawPathDialog::~LDrawPathDialog()
 {
 	delete ui;
@@ -217,7 +217,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void LDrawPathDialog::slot_findPath()
 {
 	QString newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
@@ -230,19 +230,19 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void LDrawPathDialog::slot_exit()
 {
 	exit (0);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void LDrawPathDialog::slot_tryConfigure()
 {
 	if (LDPaths::tryConfigure (filename()) == false)
 	{
-		ui->status->setText (fmt ("<span style=\"color:#700; \">%1</span>", LDPaths::getError()));
+		ui->status->setText (format ("<span style=\"color:#700; \">%1</span>", LDPaths::getError()));
 		okButton()->setEnabled (false);
 		return;
 	}
@@ -252,7 +252,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void LDrawPathDialog::slot_accept()
 {
 	Config::save();
@@ -260,42 +260,42 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 OpenProgressDialog::OpenProgressDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f)
 {
 	ui = new Ui_OpenProgressUI;
 	ui->setupUi (this);
 	ui->progressText->setText ("Parsing...");
 	setNumLines (0);
-	m_Progress = 0;
+	m_progress = 0;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 OpenProgressDialog::~OpenProgressDialog()
 {
 	delete ui;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void OpenProgressDialog::setNumLines (int const& a)
 {
-	m_NumLines = a;
-	ui->progressBar->setRange (0, getNumLines());
+	m_numLines = a;
+	ui->progressBar->setRange (0, numLines());
 	updateValues();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void OpenProgressDialog::updateValues()
 {
-	ui->progressText->setText (fmt ("Parsing... %1 / %2", getProgress(), getNumLines()));
-	ui->progressBar->setValue (getProgress());
+	ui->progressText->setText (format ("Parsing... %1 / %2", progress(), numLines()));
+	ui->progressBar->setValue (progress());
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void OpenProgressDialog::updateProgress (int progress)
 {
 	setProgress (progress);
@@ -303,7 +303,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 ExtProgPathPrompt::ExtProgPathPrompt (QString progName, QWidget* parent, Qt::WindowFlags f) :
 	QDialog (parent, f),
 	ui (new Ui_ExtProgPath)
@@ -316,14 +316,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 ExtProgPathPrompt::~ExtProgPathPrompt()
 {
 	delete ui;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void ExtProgPathPrompt::findPath()
 {
 	QString path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter);
@@ -333,14 +333,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 QString ExtProgPathPrompt::getPath() const
 {
 	return ui->m_path->text();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 AboutDialog::AboutDialog (QWidget* parent, Qt::WindowFlags f) :
 	QDialog (parent, f)
 {
@@ -354,18 +354,18 @@
 	ui.buttonBox->addButton (static_cast<QAbstractButton*> (mailButton), QDialogButtonBox::HelpRole);
 	connect (ui.buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_mail()));
 
-	setWindowTitle (fmt (tr ("About %1"), APPNAME));
+	setWindowTitle (format (tr ("About %1"), APPNAME));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void AboutDialog::slot_mail()
 {
 	QDesktopServices::openUrl (QUrl ("mailto:Santeri Piippo <arezey@gmail.com>?subject=LDForge"));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void bombBox (const QString& message)
 {
 	QDialog dlg (g_win);
--- a/src/Dialogs.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Dialogs.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_DIALOGS_H
-#define LDFORGE_DIALOGS_H
-
+#pragma once
 #include <QDialog>
 #include "Main.h"
 #include "Types.h"
@@ -95,8 +93,8 @@
 class OpenProgressDialog : public QDialog
 {
 	Q_OBJECT
-	PROPERTY (public,	int, Progress,	NUM_OPS,	STOCK_WRITE)
-	PROPERTY (public,	int, NumLines,	NUM_OPS,	CUSTOM_WRITE)
+	PROPERTY (public,	int, progress,	setProgress,	STOCK_WRITE)
+	PROPERTY (public,	int, numLines,	setNumLines,	CUSTOM_WRITE)
 
 	public:
 		explicit OpenProgressDialog (QWidget* parent = null, Qt::WindowFlags f = 0);
@@ -141,5 +139,3 @@
 };
 
 void bombBox (const QString& message);
-
-#endif // LDFORGE_DIALOGS_H
--- a/src/Document.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Document.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -47,7 +47,7 @@
 const QStringList g_specialSubdirectories ({ "s", "48", "8" });
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 namespace LDPaths
 {
 	static QString pathError;
@@ -90,9 +90,9 @@
 			return false;
 		}
 
-		pathInfo.partsPath = fmt ("%1" DIRSLASH "parts", path);
-		pathInfo.LDConfigPath = fmt ("%1" DIRSLASH "LDConfig.ldr", path);
-		pathInfo.primsPath = fmt ("%1" DIRSLASH "p", path);
+		pathInfo.partsPath = format ("%1" DIRSLASH "parts", path);
+		pathInfo.LDConfigPath = format ("%1" DIRSLASH "LDConfig.ldr", path);
+		pathInfo.primsPath = format ("%1" DIRSLASH "p", path);
 
 		return true;
 	}
@@ -120,7 +120,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocument::LDDocument() :
 	m_gldata (new LDGLData)
 {
@@ -128,24 +128,24 @@
 	setSavePosition (-1);
 	setTabIndex (-1);
 	setHistory (new History);
-	m_History->setDocument (this);
+	history()->setDocument (this);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocument::~LDDocument()
 {
 	// Remove this file from the list of files. This MUST be done FIRST, otherwise
 	// a ton of other functions will think this file is still valid when it is not!
 	g_loadedFiles.removeOne (this);
 
-	m_History->setIgnoring (true);
+	m_history->setIgnoring (true);
 
 	// Clear everything from the model
-	for (LDObject* obj : getObjects())
-		obj->deleteSelf();
+	for (LDObject* obj : objects())
+		obj->destroy();
 
-	delete m_History;
+	delete history();
 	delete m_gldata;
 
 	// If we just closed the current file, we need to set the current
@@ -176,22 +176,22 @@
 		g_logoedStud2 = null;
 
 	g_win->updateDocumentList();
-	log ("Closed %1", getName());
+	print ("Closed %1", name());
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocument* findDocument (QString name)
 {
 	for (LDDocument * file : g_loadedFiles)
-		if (!file->getName().isEmpty() && file->getName() == name)
+		if (!file->name().isEmpty() && file->name() == name)
 			return file;
 
 	return null;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString dirname (QString path)
 {
 	long lastpos = path.lastIndexOf (DIRSLASH);
@@ -208,7 +208,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString basename (QString path)
 {
 	long lastpos = path.lastIndexOf (DIRSLASH);
@@ -220,7 +220,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static QString findLDrawFilePath (QString relpath, bool subdirs)
 {
 	QString fullPath;
@@ -238,10 +238,10 @@
 
 	for (LDDocument* doc : g_loadedFiles)
 	{
-		if (doc->getFullPath().isEmpty())
+		if (doc->fullPath().isEmpty())
 			continue;
 
-		QString partpath = fmt ("%1/%2", dirname (doc->getFullPath()), relpath);
+		QString partpath = format ("%1/%2", dirname (doc->fullPath()), relpath);
 		QFile f (partpath);
 
 		if (f.exists())
@@ -269,7 +269,7 @@
 		return relpath;
 
 	// Try with just the LDraw path first
-	fullPath = fmt ("%1" DIRSLASH "%2", io_ldpath, relpath);
+	fullPath = format ("%1" DIRSLASH "%2", io_ldpath, relpath);
 
 	if (QFile::exists (fullPath))
 		return fullPath;
@@ -278,11 +278,11 @@
 	{
 		// Look in sub-directories: parts and p. Also look in net_downloadpath, since that's
 		// where we download parts from the PT to.
-		for (const QString& topdir : initlist<QString> ({ io_ldpath, net_downloadpath }))
+		for (const QString& topdir : QList<QString> ({ io_ldpath, net_downloadpath }))
 		{
-			for (const QString& subdir : initlist<QString> ({ "parts", "p" }))
+			for (const QString& subdir : QList<QString> ({ "parts", "p" }))
 			{
-				fullPath = fmt ("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relpath);
+				fullPath = format ("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relpath);
 
 				if (QFile::exists (fullPath))
 					return fullPath;
@@ -296,7 +296,7 @@
 
 QFile* openLDrawFile (QString relpath, bool subdirs, QString* pathpointer)
 {
-	log ("Opening %1...\n", relpath);
+	print ("Opening %1...\n", relpath);
 	QString path = findLDrawFilePath (relpath, subdirs);
 
 	if (pathpointer != null)
@@ -315,7 +315,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDFileLoader::start()
 {
 	setDone (false);
@@ -331,7 +331,7 @@
 		// Of course we cannot exec() the dialog because then the dialog would
 		// block.
 		dlg = new OpenProgressDialog (g_win);
-		dlg->setNumLines (getLines().size());
+		dlg->setNumLines (lines().size());
 		dlg->setModal (true);
 		dlg->show();
 
@@ -347,16 +347,16 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDFileLoader::work (int i)
 {
 	// User wishes to abort, so stop here now.
 	if (isAborted())
 	{
-		for (LDObject* obj : m_Objects)
-			obj->deleteSelf();
+		for (LDObject* obj : m_objects)
+			obj->destroy();
 
-		m_Objects.clear();
+		m_objects.clear();
 		setDone (true);
 		return;
 	}
@@ -364,9 +364,9 @@
 	// Parse up to 300 lines per iteration
 	int max = i + 300;
 
-	for (; i < max && i < (int) getLines().size(); ++i)
+	for (; i < max && i < (int) lines().size(); ++i)
 	{
-		QString line = getLines()[i];
+		QString line = lines()[i];
 
 		// Trim the trailing newline
 		QChar c;
@@ -377,15 +377,15 @@
 		LDObject* obj = parseLine (line);
 
 		// Check for parse errors and warn about tthem
-		if (obj->getType() == LDObject::EError)
+		if (obj->type() == LDObject::EError)
 		{
-			log ("Couldn't parse line #%1: %2", getProgress() + 1, static_cast<LDError*> (obj)->reason);
+			print ("Couldn't parse line #%1: %2", progress() + 1, static_cast<LDError*> (obj)->reason());
 
-			if (getWarnings() != null)
-				(*getWarnings())++;
+			if (warnings() != null)
+				(*warnings())++;
 		}
 
-		m_Objects << obj;
+		m_objects << obj;
 		setProgress (i);
 
 		// If we have a dialog pointer, update the progress now
@@ -394,7 +394,7 @@
 	}
 
 	// If we're done now, tell the environment we're done and stop.
-	if (i >= ((int) getLines().size()) - 1)
+	if (i >= ((int) lines().size()) - 1)
 	{
 		emit workDone();
 		setDone (true);
@@ -422,7 +422,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDFileLoader::abort()
 {
 	setAborted (true);
@@ -432,7 +432,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDObjectList loadFileContents (QFile* fp, int* numWarnings, bool* ok)
 {
 	QStringList lines;
@@ -462,12 +462,12 @@
 	if (ok)
 		*ok = !loader->isAborted();
 
-	objs = loader->getObjects();
+	objs = loader->objects();
 	return objs;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocument* openDocument (QString path, bool search)
 {
 	// Convert the file name to lowercase since some parts contain uppercase
@@ -495,12 +495,12 @@
 
 	LDDocument* load = new LDDocument;
 	load->setFullPath (fullpath);
-	load->setName (LDDocument::shortenName (load->getFullPath()));
-	dlog ("name: %1 (%2)", load->getName(), load->getFullPath());
+	load->setName (LDDocument::shortenName (load->fullPath()));
+	dprint ("name: %1 (%2)", load->name(), load->fullPath());
 	g_loadedFiles << load;
 
 	// Don't take the file loading as actual edits to the file
-	load->getHistory()->setIgnoring (true);
+	load->history()->setIgnoring (true);
 
 	int numWarnings;
 	bool ok;
@@ -520,16 +520,16 @@
 	if (g_loadingMainFile)
 	{
 		LDDocument::setCurrent (load);
-		g_win->R()->setFile (load);
-		log (QObject::tr ("File %1 parsed successfully (%2 errors)."), path, numWarnings);
+		g_win->R()->setDocument (load);
+		print (QObject::tr ("File %1 parsed successfully (%2 errors)."), path, numWarnings);
 	}
 
-	load->getHistory()->setIgnoring (false);
+	load->history()->setIgnoring (false);
 	return load;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDDocument::isSafeToClose()
 {
 	typedef QMessageBox msgbox;
@@ -538,8 +538,8 @@
 	// If we have unsaved changes, warn and give the option of saving.
 	if (hasUnsavedChanges())
 	{
-		QString message = fmt (tr ("There are unsaved changes to %1. Should it be saved?"),
-			(getName().length() > 0) ? getName() : tr ("<anonymous>"));
+		QString message = format (tr ("There are unsaved changes to %1. Should it be saved?"),
+			(name().length() > 0) ? name() : tr ("<anonymous>"));
 
 		int button = msgbox::question (g_win, tr ("Unsaved Changes"), message,
 			(msgbox::Yes | msgbox::No | msgbox::Cancel), msgbox::Cancel);
@@ -549,10 +549,10 @@
 			case msgbox::Yes:
 			{
 				// If we don't have a file path yet, we have to ask the user for one.
-				if (getName().length() == 0)
+				if (name().length() == 0)
 				{
 					QString newpath = QFileDialog::getSaveFileName (g_win, tr ("Save As"),
-						getCurrentDocument()->getName(), tr ("LDraw files (*.dat *.ldr)"));
+						getCurrentDocument()->name(), tr ("LDraw files (*.dat *.ldr)"));
 
 					if (newpath.length() == 0)
 						return false;
@@ -562,8 +562,8 @@
 
 				if (!save())
 				{
-					message = fmt (tr ("Failed to save %1 (%2)\nDo you still want to close?"),
-						getName(), strerror (errno));
+					message = format (tr ("Failed to save %1 (%2)\nDo you still want to close?"),
+						name(), strerror (errno));
 
 					if (msgbox::critical (g_win, tr ("Save Failure"), message,
 						(msgbox::Yes | msgbox::No), msgbox::No) == msgbox::No)
@@ -585,7 +585,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void closeAll()
 {
 	// Remove all loaded files and the objects they contain
@@ -596,7 +596,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void newFile()
 {
 	// Create a new anonymous file and set it to our current
@@ -606,14 +606,14 @@
 	g_loadedFiles << f;
 	LDDocument::setCurrent (f);
 	LDDocument::closeInitialFile();
-	g_win->R()->setFile (f);
+	g_win->R()->setDocument (f);
 	g_win->doFullRefresh();
 	g_win->updateTitle();
 	g_win->updateActions();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void addRecentFile (QString path)
 {
 	auto& rfiles = io_recentfiles;
@@ -642,7 +642,7 @@
 
 // =============================================================================
 // Open an LDraw file and set it as the main model
-// -----------------------------------------------------------------------------
+// =============================================================================
 void openMainFile (QString path)
 {
 	g_loadingMainFile = true;
@@ -653,7 +653,7 @@
 
 	for (LDDocument* doc : g_loadedFiles)
 	{
-		if (doc->getName() == shortName)
+		if (doc->name() == shortName)
 		{
 			documentToReplace = doc;
 			break;
@@ -680,7 +680,7 @@
 		{
 			// Tell the user loading failed.
 			setlocale (LC_ALL, "C");
-			critical (fmt (QObject::tr ("Failed to open %1: %2"), path, strerror (errno)));
+			critical (format (QObject::tr ("Failed to open %1: %2"), path, strerror (errno)));
 		}
 
 		g_loadingMainFile = false;
@@ -692,14 +692,14 @@
 	// Replace references to the old file with the new file.
 	if (documentToReplace != null)
 	{
-		for (LDDocumentPointer* ptr : documentToReplace->getReferences())
-		{	dlog ("ptr: %1 (%2)\n",
-				ptr, ptr->getPointer() ? ptr->getPointer()->getName() : "<null>");
+		for (LDDocumentPointer* ptr : documentToReplace->references())
+		{	dprint ("ptr: %1 (%2)\n",
+				ptr, ptr->pointer() ? ptr->pointer()->name() : "<null>");
 
-			ptr->operator= (file);
+			*ptr = file;
 		}
 
-		assert (documentToReplace->countReferences() == 0);
+		assert (documentToReplace->references().isEmpty());
 		delete documentToReplace;
 	}
 
@@ -717,11 +717,11 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDDocument::save (QString savepath)
 {
 	if (!savepath.length())
-		savepath = getFullPath();
+		savepath = fullPath();
 
 	QFile f (savepath);
 
@@ -732,28 +732,28 @@
 	// Only do this if the file is explicitly open.
 	LDObject* nameObject = getObject (1);
 
-	if (!isImplicit() && nameObject != null && nameObject->getType() == LDObject::EComment)
+	if (!isImplicit() && nameObject != null && nameObject->type() == LDObject::EComment)
 	{
 		LDComment* nameComment = static_cast<LDComment*> (nameObject);
 
-		if (nameComment->text.left (6) == "Name: ")
+		if (nameComment->text().left (6) == "Name: ")
 		{
 			QString newname = shortenName (savepath);
-			nameComment->text = fmt ("Name: %1", newname);
+			nameComment->setText (format ("Name: %1", newname));
 			g_win->buildObjList();
 		}
 	}
 
 	// 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 : getObjects())
-		f.write ((obj->raw() + "\r\n").toUtf8());
+	for (LDObject* obj : objects())
+		f.write ((obj->asText() + "\r\n").toUtf8());
 
 	// File is saved, now clean up.
 	f.close();
 
 	// We have successfully saved, update the save position now.
-	setSavePosition (getHistory()->getPosition());
+	setSavePosition (history()->position());
 	setFullPath (savepath);
 	setName (shortenName (savepath));
 
@@ -763,31 +763,33 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 class LDParseError : public std::exception
 {
-	PROPERTY (private, QString,	Error,	STR_OPS, STOCK_WRITE)
-	PROPERTY (private, QString,	Line,		STR_OPS,	STOCK_WRITE)
+	PROPERTY (private, QString,	error,	setError,	STOCK_WRITE)
+	PROPERTY (private, QString,	line,	setLine,	STOCK_WRITE)
 
 	public:
-		LDParseError (QString line, QString a) : m_Error (a), m_Line (line) {}
+		LDParseError (QString line, QString a) :
+			m_error (a),
+			m_line (line) {}
 
 		const char* what() const throw()
 		{
-			return getError().toLocal8Bit().constData();
+			return qPrintable (error());
 		}
 };
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void checkTokenCount (QString line, const QStringList& tokens, int num)
 {
 	if (tokens.size() != num)
-		throw LDParseError (line, fmt ("Bad amount of tokens, expected %1, got %2", num, tokens.size()));
+		throw LDParseError (line, format ("Bad amount of tokens, expected %1, got %2", num, tokens.size()));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void checkTokenNumbers (QString line, const QStringList& tokens, int min, int max)
 {
 	bool ok;
@@ -800,12 +802,12 @@
 		tokens[i].toDouble (&ok);
 
 		if (!ok && !scient.exactMatch (tokens[i]))
-			throw LDParseError (line, fmt ("Token #%1 was `%2`, expected a number (matched length: %3)", (i + 1), tokens[i], scient.matchedLength()));
+			throw LDParseError (line, format ("Token #%1 was `%2`, expected a number (matched length: %3)", (i + 1), tokens[i], scient.matchedLength()));
 	}
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static Vertex parseVertex (QStringList& s, const int n)
 {
 	Vertex v;
@@ -820,7 +822,7 @@
 // This is the LDraw code parser function. It takes in a string containing LDraw
 // code and returns the object parsed from it. parseLine never returns null,
 // the object will be LDError if it could not be parsed properly.
-// -----------------------------------------------------------------------------
+// =============================================================================
 LDObject* parseLine (QString line)
 {
 	try
@@ -849,8 +851,8 @@
 				if (tokens.size() > 2 && tokens[1] == "BFC")
 				{
 					for (int i = 0; i < LDBFC::NumStatements; ++i)
-						if (comm == fmt ("BFC %1", LDBFC::statements [i]))
-							return new LDBFC ( (LDBFC::Type) i);
+						if (comm == format ("BFC %1", LDBFC::k_statementStrings [i]))
+							return new LDBFC ( (LDBFC::Statement) i);
 
 					// MLCAD is notorious for stuffing these statements in parts it
 					// creates. The above block only handles valid statements, so we
@@ -858,7 +860,7 @@
 					struct
 					{
 						QString			a;
-						LDBFC::Type	b;
+						LDBFC::Statement	b;
 					} BFCData[] =
 					{
 						{ "INVERTNEXT", LDBFC::InvertNext },
@@ -905,7 +907,7 @@
 
 				// Just a regular comment:
 				LDComment* obj = new LDComment;
-				obj->text = comm;
+				obj->setText (comm);
 				return obj;
 			}
 
@@ -926,7 +928,7 @@
 				// here because the error object needs the document reference.
 				if (!load)
 				{
-					LDError* obj = new LDError (line, fmt ("Could not open %1", tokens[14]));
+					LDError* obj = new LDError (line, format ("Could not open %1", tokens[14]));
 					obj->setFileReferenced (tokens[14]);
 					return obj;
 				}
@@ -1003,12 +1005,12 @@
 	}
 	catch (LDParseError& e)
 	{
-		return new LDError (e.getLine(), e.getError());
+		return new LDError (e.line(), e.error());
 	}
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocument* getDocument (QString filename)
 {
 	// Try find the file in the list of loaded files
@@ -1022,7 +1024,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void reloadAllSubfiles()
 {
 	if (!getCurrentDocument())
@@ -1032,47 +1034,47 @@
 	g_loadedFiles << getCurrentDocument();
 
 	// Go through all objects in the current file and reload the subfiles
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 	{
-		if (obj->getType() == LDObject::ESubfile)
+		if (obj->type() == LDObject::ESubfile)
 		{
 			LDSubfile* ref = static_cast<LDSubfile*> (obj);
-			LDDocument* fileInfo = getDocument (ref->getFileInfo()->getName());
+			LDDocument* fileInfo = getDocument (ref->fileInfo()->name());
 
 			if (fileInfo)
 				ref->setFileInfo (fileInfo);
 			else
-				ref->replace (new LDError (ref->raw(), fmt ("Could not open %1", ref->getFileInfo()->getName())));
+				ref->replace (new LDError (ref->asText(), format ("Could not open %1", ref->fileInfo()->name())));
 		}
 
 		// Reparse gibberish files. It could be that they are invalid because
 		// of loading errors. Circumstances may be different now.
-		if (obj->getType() == LDObject::EError)
-			obj->replace (parseLine (static_cast<LDError*> (obj)->contents));
+		if (obj->type() == LDObject::EError)
+			obj->replace (parseLine (static_cast<LDError*> (obj)->contents()));
 	}
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int LDDocument::addObject (LDObject* obj)
 {
-	getHistory()->add (new AddHistory (getObjects().size(), obj));
-	m_Objects << obj;
+	history()->add (new AddHistory (objects().size(), obj));
+	m_objects << obj;
 
-	if (obj->getType() == LDObject::EVertex)
-		m_Vertices << obj;
+	if (obj->type() == LDObject::EVertex)
+		m_vertices << obj;
 
 #ifdef DEBUG
 	if (!isImplicit())
-		dlog ("Added object #%1 (%2)\n", obj->getID(), obj->getTypeName());
+		dprint ("Added object #%1 (%2)\n", obj->id(), obj->typeName());
 #endif
 
-	obj->setFile (this);
+	obj->setDocument (this);
 	return getObjectCount() - 1;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::addObjects (const LDObjectList objs)
 {
 	for (LDObject* obj : objs)
@@ -1081,36 +1083,36 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::insertObj (int pos, LDObject* obj)
 {
-	getHistory()->add (new AddHistory (pos, obj));
-	m_Objects.insert (pos, obj);
-	obj->setFile (this);
+	history()->add (new AddHistory (pos, obj));
+	m_objects.insert (pos, obj);
+	obj->setDocument (this);
 
 #ifdef DEBUG
 	if (!isImplicit())
-		dlog ("Inserted object #%1 (%2) at %3\n", obj->getID(), obj->getTypeName(), pos);
+		dprint ("Inserted object #%1 (%2) at %3\n", obj->id(), obj->typeName(), pos);
 #endif
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::forgetObject (LDObject* obj)
 {
-	int idx = obj->getIndex();
+	int idx = obj->lineNumber();
 	obj->unselect();
-	assert (m_Objects[idx] == obj);
+	assert (m_objects[idx] == obj);
 
-	if (!getHistory()->isIgnoring())
-		getHistory()->add (new DelHistory (idx, obj));
+	if (!history()->isIgnoring())
+		history()->add (new DelHistory (idx, obj));
 
-	m_Objects.removeAt (idx);
-	obj->setFile (null);
+	m_objects.removeAt (idx);
+	obj->setDocument (null);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool safeToCloseAll()
 {
 	for (LDDocument* f : g_loadedFiles)
@@ -1121,68 +1123,69 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::setObject (int idx, LDObject* obj)
 {
-	assert (idx >= 0 && idx < m_Objects.size());
+	assert (idx >= 0 && idx < m_objects.size());
 
 	// Mark this change to history
-	if (!m_History->isIgnoring())
+	if (!m_history->isIgnoring())
 	{
-		QString oldcode = getObject (idx)->raw();
-		QString newcode = obj->raw();
-		*m_History << new EditHistory (idx, oldcode, newcode);
+		QString oldcode = getObject (idx)->asText();
+		QString newcode = obj->asText();
+		*m_history << new EditHistory (idx, oldcode, newcode);
 	}
 
-	m_Objects[idx]->unselect();
-	m_Objects[idx]->setFile (null);
-	obj->setFile (this);
-	m_Objects[idx] = obj;
+	m_objects[idx]->unselect();
+	m_objects[idx]->setDocument (null);
+	obj->setDocument (this);
+	m_objects[idx] = obj;
 }
 
 // =============================================================================
-// Close all implicit files with no references
-// -----------------------------------------------------------------------------
+//
+// Close all documents we don't need anymore
+//
 void LDDocument::closeUnused()
 {
 	for (LDDocument* file : g_loadedFiles)
-		if (file->isImplicit() && file->countReferences() == 0)
+		if (file->isImplicit() && file->references().isEmpty())
 			delete file;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDObject* LDDocument::getObject (int pos) const
 {
-	if (m_Objects.size() <= pos)
+	if (m_objects.size() <= pos)
 		return null;
 
-	return m_Objects[pos];
+	return m_objects[pos];
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int LDDocument::getObjectCount() const
 {
-	return getObjects().size();
+	return objects().size();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDDocument::hasUnsavedChanges() const
 {
-	return !isImplicit() && getHistory()->getPosition() != getSavePosition();
+	return !isImplicit() && history()->position() != savePosition();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString LDDocument::getDisplayName()
 {
-	if (!getName().isEmpty())
-		return getName();
+	if (!name().isEmpty())
+		return name();
 
-	if (!getDefaultName().isEmpty())
-		return "[" + getDefaultName() + "]";
+	if (!defaultName().isEmpty())
+		return "[" + defaultName() + "]";
 
 	return tr ("<anonymous>");
 }
@@ -1201,11 +1204,11 @@
 
 		if (data != null)
 		{
-			m_PolygonData << *data;
+			m_polygonData << *data;
 			delete data;
 		}
 
-		obj->deleteSelf();
+		obj->destroy();
 	}
 
 	m_needsGLReInit = false;
@@ -1218,7 +1221,7 @@
 	if (m_needsGLReInit == true)
 		initializeGLData();
 
-	return m_PolygonData;
+	return polygonData();
 }
 
 // =============================================================================
@@ -1233,15 +1236,15 @@
 		// Ensure logoed studs are loaded first
 		loadLogoedStuds();
 
-		if (getName() == "stud.dat" && g_logoedStud != null)
+		if (name() == "stud.dat" && g_logoedStud != null)
 			return g_logoedStud->inlineContents (deep, renderinline);
-		elif (getName() == "stud2.dat" && g_logoedStud2 != null)
+		elif (name() == "stud2.dat" && g_logoedStud2 != null)
 			return g_logoedStud2->inlineContents (deep, renderinline);
 	}
 
 	LDObjectList objs, objcache;
 
-	for (LDObject* obj : getObjects())
+	for (LDObject* obj : objects())
 	{
 		// Skip those without scemantic meaning
 		if (!obj->isScemantic())
@@ -1249,7 +1252,7 @@
 
 		// Got another sub-file reference, inline it if we're deep-inlining. If not,
 		// just add it into the objects normally. Yay, recursion!
-		if (deep == true && obj->getType() == LDObject::ESubfile)
+		if (deep == true && obj->type() == LDObject::ESubfile)
 		{
 			LDSubfile* ref = static_cast<LDSubfile*> (obj);
 			LDObjectList otherobjs = ref->inlineContents (deep, renderinline);
@@ -1265,7 +1268,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocument* LDDocument::current()
 {
 	return m_curdoc;
@@ -1276,7 +1279,7 @@
 // was an operation completely unheard of. ;)
 //
 // TODO: f can be temporarily null. This probably should not be the case.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void LDDocument::setCurrent (LDDocument* f)
 {
 	// Implicit files were loaded for caching purposes and must never be set
@@ -1292,14 +1295,14 @@
 		g_win->updateDocumentListItem (f);
 		g_win->buildObjList();
 		g_win->updateTitle();
-		g_win->R()->setFile (f);
+		g_win->R()->setDocument (f);
 		g_win->R()->repaint();
-		log ("Changed file to %1", f->getDisplayName());
+		print ("Changed file to %1", f->getDisplayName());
 	}
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int LDDocument::countExplicitFiles()
 {
 	int count = 0;
@@ -1314,20 +1317,20 @@
 // =============================================================================
 // This little beauty closes the initial file that was open at first when opening
 // a new file over it.
-// -----------------------------------------------------------------------------
+// =============================================================================
 void LDDocument::closeInitialFile()
 {
 	if (
 		countExplicitFiles() == 2 &&
-		g_loadedFiles[0]->getName().isEmpty() &&
-		g_loadedFiles[1]->getName().isEmpty() == false &&
+		g_loadedFiles[0]->name().isEmpty() &&
+		g_loadedFiles[1]->name().isEmpty() == false &&
 		!g_loadedFiles[0]->hasUnsavedChanges()
 	)
 		delete g_loadedFiles[0];
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void loadLogoedStuds()
 {
 	if (g_logoedStud && g_logoedStud2)
@@ -1339,35 +1342,35 @@
 	g_logoedStud = openDocument ("stud-logo.dat", true);
 	g_logoedStud2 = openDocument ("stud2-logo.dat", true);
 
-	log (LDDocument::tr ("Logoed studs loaded.\n"));
+	print (LDDocument::tr ("Logoed studs loaded.\n"));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::addToSelection (LDObject* obj) // [protected]
 {
 	if (obj->isSelected())
 		return;
 
-	assert (obj->getFile() == this);
+	assert (obj->document() == this);
 	m_sel << obj;
 	obj->setSelected (true);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::removeFromSelection (LDObject* obj) // [protected]
 {
 	if (!obj->isSelected())
 		return;
 
-	assert (obj->getFile() == this);
+	assert (obj->document() == this);
 	m_sel.removeOne (obj);
 	obj->setSelected (false);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::clearSelection()
 {
 	for (LDObject* obj : m_sel)
@@ -1377,26 +1380,26 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 const LDObjectList& LDDocument::getSelection() const
 {
 	return m_sel;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::swapObjects (LDObject* one, LDObject* other)
 {
-	int a = m_Objects.indexOf (one);
-	int b = m_Objects.indexOf (other);
+	int a = m_objects.indexOf (one);
+	int b = m_objects.indexOf (other);
 	assert (a != b && a != -1 && b != -1);
-	m_Objects[b] = one;
-	m_Objects[a] = other;
-	addToHistory (new SwapHistory (one->getID(), other->getID()));
+	m_objects[b] = one;
+	m_objects[a] = other;
+	addToHistory (new SwapHistory (one->id(), other->id()));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString LDDocument::shortenName (QString a) // [static]
 {
 	QString shortname = basename (a);
@@ -1409,18 +1412,18 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::addReference (LDDocumentPointer* ptr)
 {
-	pushToReferences (ptr);
+	m_references << ptr;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocument::removeReference (LDDocumentPointer* ptr)
 {
-	removeFromReferences (ptr);
+	m_references.removeOne (ptr);
 
-	if (getReferences().size() == 0)
+	if (references().isEmpty())
 		invokeLater (closeUnused);
 }
\ No newline at end of file
--- a/src/Document.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Document.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_DOCUMENT_H
-#define LDFORGE_DOCUMENT_H
-
+#pragma once
 #include <QObject>
 #include "Main.h"
 #include "LDObject.h"
@@ -42,33 +40,34 @@
 }
 
 // =============================================================================
-// LDDocument
 //
-// The LDDocument class stores a document opened in LDForge either as a editable
-// file for the user or for subfile caching. Its methods handle file input and
-// output.
+// This class stores a document either as a editable file for the user or for
+// subfile caching. Its methods handle file input and output.
 //
 // A file is implicit when they are opened automatically for caching purposes
 // and are hidden from the user. User-opened files are explicit (not implicit).
 //
 // The default name is a placeholder, initially suggested name for a file. The
 // primitive generator uses this to give initial names to primitives.
-// =============================================================================
+//
 class LDDocument : public QObject
 {
-	properties:
+	public:
+		using ReferenceList = QList<LDDocumentPointer*>;
+
 		Q_OBJECT
-		PROPERTY (private,	LDObjectList,				Objects, 		LIST_OPS,	STOCK_WRITE)
-		PROPERTY (private,	History*,					History,		NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	LDObjectList,				Vertices,		LIST_OPS,	STOCK_WRITE)
-		PROPERTY (private,	QList<LDDocumentPointer*>,	References,		LIST_OPS,	STOCK_WRITE)
-		PROPERTY (public,	QString,					Name,			STR_OPS,	STOCK_WRITE)
-		PROPERTY (public,	QString,					FullPath,		STR_OPS,	STOCK_WRITE)
-		PROPERTY (public,	QString,					DefaultName,	STR_OPS,	STOCK_WRITE)
-		PROPERTY (public,	bool,						Implicit,		BOOL_OPS,	STOCK_WRITE)
-		PROPERTY (public,	QList<LDPolygon>,			PolygonData,	NO_OPS,		STOCK_WRITE)
-		PROPERTY (public,	long,						SavePosition,	NUM_OPS,	STOCK_WRITE)
-		PROPERTY (public,	int,						TabIndex,		NO_OPS,		STOCK_WRITE)
+		PROPERTY (public,	QString,		name,			setName,			STOCK_WRITE)
+		PROPERTY (private,	LDObjectList,	objects, 		setObjects,			STOCK_WRITE)
+		PROPERTY (private,	LDObjectList,	cache, 			setCache,			STOCK_WRITE)
+		PROPERTY (private,	History*,		history,		setHistory,			STOCK_WRITE)
+		PROPERTY (private,	LDObjectList,	vertices,		setVertices,		STOCK_WRITE)
+		PROPERTY (private,	ReferenceList,	references,		setReferences,		STOCK_WRITE)
+		PROPERTY (public,	QString,		fullPath,		setFullPath,		STOCK_WRITE)
+		PROPERTY (public,	QString,		defaultName,	setDefaultName,		STOCK_WRITE)
+		PROPERTY (public,	bool,			isImplicit,		setImplicit,		STOCK_WRITE)
+		PROPERTY (public,	long,			savePosition,	setSavePosition,	STOCK_WRITE)
+		PROPERTY (public,	int,			tabIndex,		setTabIndex,		STOCK_WRITE)
+		PROPERTY (public,	QList<LDPolygon>,	polygonData,	setPolygonData,	STOCK_WRITE)
 
 	public:
 		LDDocument();
@@ -80,7 +79,7 @@
 		void forgetObject (LDObject* obj); // Deletes the given object from the object chain.
 		QString getDisplayName();
 		const LDObjectList& getSelection() const;
-		bool hasUnsavedChanges() const; // Does this Document.have unsaved changes?
+		bool hasUnsavedChanges() const; // Does this document have unsaved changes?
 		void initializeGLData();
 		LDObjectList inlineContents (bool deep, bool renderinline);
 		void insertObj (int pos, LDObject* obj);
@@ -102,27 +101,27 @@
 
 		inline void addHistoryStep()
 		{
-			m_History->addStep();
+			history()->addStep();
 		}
 
 		inline void undo()
 		{
-			m_History->undo();
+			history()->undo();
 		}
 
 		inline void redo()
 		{
-			m_History->redo();
+			history()->redo();
 		}
 
 		inline void clearHistory()
 		{
-			m_History->clear();
+			history()->clear();
 		}
 
 		inline void addToHistory (AbstractHistoryEntry* entry)
 		{
-			*m_History << entry;
+			*history() << entry;
 		}
 
 		static void closeUnused();
@@ -211,24 +210,23 @@
 extern QList<LDDocument*> g_loadedFiles; // Vector of all currently opened files.
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-// FileLoader
+//
+// LDFileLoader
 //
 // Loads the given file and parses it to LDObjects using parseLine. It's a
 // separate class so as to be able to do the work progressively through the
 // event loop, allowing the program to maintain responsivity during loading.
-// =============================================================================
+//
 class LDFileLoader : public QObject
 {
 	Q_OBJECT
-	PROPERTY (private,	LDObjectList,	Objects,			NO_OPS,		STOCK_WRITE)
-	PROPERTY (private,	bool,					Done,				BOOL_OPS,	STOCK_WRITE)
-	PROPERTY (private,	int,					Progress,		NUM_OPS,		STOCK_WRITE)
-	PROPERTY (private,	bool,					Aborted,			BOOL_OPS,	STOCK_WRITE)
-	PROPERTY (public,		QStringList,		Lines,			NO_OPS,		STOCK_WRITE)
-	PROPERTY (public,		int*,					Warnings,		NO_OPS,		STOCK_WRITE)
-	PROPERTY (public,		bool,					OnForeground,	BOOL_OPS,	STOCK_WRITE)
+	PROPERTY (private,	LDObjectList,	objects,		setObjects,			STOCK_WRITE)
+	PROPERTY (private,	bool,			isDone,			setDone,			STOCK_WRITE)
+	PROPERTY (private,	int,			progress,		setProgress,		STOCK_WRITE)
+	PROPERTY (private,	bool,			isAborted,		setAborted,			STOCK_WRITE)
+	PROPERTY (public,	QStringList,	lines,			setLines,			STOCK_WRITE)
+	PROPERTY (public,	int*,			warnings,		setWarnings,		STOCK_WRITE)
+	PROPERTY (public,	bool,			isOnForeground,	setOnForeground,	STOCK_WRITE)
 
 	public slots:
 		void start();
@@ -244,5 +242,3 @@
 		void progressUpdate (int progress);
 		void workDone();
 };
-
-#endif // LDFORGE_DOCUMENT_H
--- a/src/Documentation.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Documentation.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -24,7 +24,7 @@
 #include "Types.h"
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 class DocumentViewer : public QDialog
 {
 	public:
@@ -67,7 +67,7 @@
 	"overlay image should then be ready for use.";
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+// =============================================================================
 void showDocumentation (const char* text)
 {
 	DocumentViewer dlg;
--- a/src/Documentation.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Documentation.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,11 +16,6 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_DOCS_H
-#define LDFORGE_DOCS_H
-
+#pragma once
 extern const char* g_docs_overlays;
-
 void showDocumentation (const char* text);
-
-#endif // LDFORGE_DOCS_H
\ No newline at end of file
--- a/src/EditHistory.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/EditHistory.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -26,19 +26,19 @@
 // =============================================================================
 //
 History::History() :
-	m_Position (-1) {}
+	m_position (-1) {}
 
 // =============================================================================
 //
 void History::undo()
 {
-	if (m_changesets.isEmpty() || getPosition() == -1)
+	if (m_changesets.isEmpty() || position() == -1)
 		return;
 
 	// Don't take the changes done here as actual edits to the document
 	setIgnoring (true);
 
-	const Changeset& set = getChangeset (getPosition());
+	const Changeset& set = getChangeset (position());
 
 	// Iterate the list in reverse and undo all actions
 	for (int i = set.size() - 1; i >= 0; --i)
@@ -47,10 +47,10 @@
 		change->undo();
 	}
 
-	decreasePosition();
+	m_position--;
 	g_win->refresh();
 	g_win->updateActions();
-	dlog ("Position is now %1", getPosition());
+	dprint ("Position is now %1", position());
 	setIgnoring (false);
 }
 
@@ -58,20 +58,20 @@
 //
 void History::redo()
 {
-	if (getPosition() == m_changesets.size())
+	if (position() == m_changesets.size())
 		return;
 
 	setIgnoring (true);
-	const Changeset& set = getChangeset (getPosition() + 1);
+	const Changeset& set = getChangeset (position() + 1);
 
 	// Redo things - in the order as they were done in the first place
 	for (const AbstractHistoryEntry* change : set)
 		change->redo();
 
-	setPosition (getPosition() + 1);
+	setPosition (position() + 1);
 	g_win->refresh();
 	g_win->updateActions();
-	dlog ("Position is now %1", getPosition());
+	dprint ("Position is now %1", position());
 	setIgnoring (false);
 }
 
@@ -84,7 +84,7 @@
 			delete change;
 
 	m_changesets.clear();
-	dlog ("History: cleared");
+	dprint ("History: cleared");
 }
 
 // =============================================================================
@@ -94,7 +94,7 @@
 	if (m_currentChangeset.isEmpty())
 		return;
 
-	while (getPosition() < getSize() - 1)
+	while (position() < getSize() - 1)
 	{
 		Changeset last = m_changesets.last();
 
@@ -104,10 +104,10 @@
 		m_changesets.removeLast();
 	}
 
-	dlog ("History: step added (%1 changes)", m_currentChangeset.size());
+	dprint ("History: step added (%1 changes)", m_currentChangeset.size());
 	m_changesets << m_currentChangeset;
 	m_currentChangeset.clear();
-	setPosition (getPosition() + 1);
+	setPosition (position() + 1);
 	g_win->updateActions();
 }
 
@@ -123,39 +123,39 @@
 
 	entry->setParent (this);
 	m_currentChangeset << entry;
-	dlog ("History: added entry of type %1", entry->getTypeName());
+	dprint ("History: added entry of type %1", entry->getTypeName());
 }
 
 // =============================================================================
 //
 void AddHistory::undo() const
 {
-	LDObject* obj = getParent()->getDocument()->getObject (getIndex());
-	obj->deleteSelf();
+	LDObject* obj = parent()->document()->getObject (index());
+	obj->destroy();
 }
 
 // =============================================================================
 //
 void AddHistory::redo() const
 {
-	LDObject* obj = parseLine (getCode());
-	getParent()->getDocument()->insertObj (getIndex(), obj);
+	LDObject* obj = parseLine (code());
+	parent()->document()->insertObj (index(), obj);
 	g_win->R()->compileObject (obj);
 }
 
 // =============================================================================
 //
 DelHistory::DelHistory (int idx, LDObject* obj) :
-	m_Index (idx),
-	m_Code (obj->raw()) {}
+	m_index (idx),
+	m_code (obj->asText()) {}
 
 // =============================================================================
 // heh
 //
 void DelHistory::undo() const
 {
-	LDObject* obj = parseLine (getCode());
-	getParent()->getDocument()->insertObj (getIndex(), obj);
+	LDObject* obj = parseLine (code());
+	parent()->document()->insertObj (index(), obj);
 	g_win->R()->compileObject (obj);
 }
 
@@ -163,16 +163,16 @@
 //
 void DelHistory::redo() const
 {
-	LDObject* obj = getParent()->getDocument()->getObject (getIndex());
-	obj->deleteSelf();
+	LDObject* obj = parent()->document()->getObject (index());
+	obj->destroy();
 }
 
 // =============================================================================
 //
 void EditHistory::undo() const
 {
-	LDObject* obj = getCurrentDocument()->getObject (getIndex());
-	LDObject* newobj = parseLine (getOldCode());
+	LDObject* obj = getCurrentDocument()->getObject (index());
+	LDObject* newobj = parseLine (oldCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
 }
@@ -181,8 +181,8 @@
 //
 void EditHistory::redo() const
 {
-	LDObject* obj = getCurrentDocument()->getObject (getIndex());
-	LDObject* newobj = parseLine (getNewCode());
+	LDObject* obj = getCurrentDocument()->getObject (index());
+	LDObject* newobj = parseLine (newCode());
 	obj->replace (newobj);
 	g_win->R()->compileObject (newobj);
 }
--- a/src/EditHistory.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/EditHistory.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_HISTORY_H
-#define LDFORGE_HISTORY_H
-
+#pragma once
 #include "Main.h"
 #include "LDObject.h"
 
@@ -42,9 +40,9 @@
 // =============================================================================
 class History
 {
-	PROPERTY (private,	int,			Position,	NUM_OPS,	STOCK_WRITE)
-	PROPERTY (public,	LDDocument*,	Document,	NO_OPS,		STOCK_WRITE)
-	PROPERTY (public,	bool,			Ignoring,	BOOL_OPS,	STOCK_WRITE)
+	PROPERTY (private,	int,			position,	setPosition,	STOCK_WRITE)
+	PROPERTY (public,	LDDocument*,	document,	setDocument,	STOCK_WRITE)
+	PROPERTY (public,	bool,			isIgnoring,	setIgnoring,	STOCK_WRITE)
 
 	public:
 		typedef QList<AbstractHistoryEntry*> Changeset;
@@ -88,11 +86,10 @@
 };
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+//
 class AbstractHistoryEntry
 {
-	PROPERTY (public,	History*,	Parent,	NO_OPS,	STOCK_WRITE)
+	PROPERTY (public,	History*,	parent,	setParent,	STOCK_WRITE)
 
 	public:
 		virtual ~AbstractHistoryEntry() {}
@@ -103,12 +100,11 @@
 };
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+//
 class DelHistory : public AbstractHistoryEntry
 {
-	PROPERTY (private,	int,		Index,		NO_OPS,	STOCK_WRITE)
-	PROPERTY (private,	QString,	Code,		NO_OPS,	STOCK_WRITE)
+	PROPERTY (private,	int,		index,	setIndex,	STOCK_WRITE)
+	PROPERTY (private,	QString,	code,	setCode,	STOCK_WRITE)
 
 	public:
 		IMPLEMENT_HISTORY_TYPE (Del)
@@ -116,21 +112,20 @@
 };
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+//
 class EditHistory : public AbstractHistoryEntry
 {
-	PROPERTY (private,	int, 		Index,		NO_OPS,	STOCK_WRITE)
-	PROPERTY (private,	QString,	OldCode,	NO_OPS,	STOCK_WRITE)
-	PROPERTY (private,	QString,	NewCode,	NO_OPS,	STOCK_WRITE)
+	PROPERTY (private,	int, 		index,		setIndex,	STOCK_WRITE)
+	PROPERTY (private,	QString,	oldCode,	setOldCode,	STOCK_WRITE)
+	PROPERTY (private,	QString,	newCode,	setNewCode,	STOCK_WRITE)
 
 	public:
 		IMPLEMENT_HISTORY_TYPE (Edit)
 
 		EditHistory (int idx, QString oldCode, QString newCode) :
-				m_Index (idx),
-				m_OldCode (oldCode),
-				m_NewCode (newCode) {}
+			m_index (idx),
+			m_oldCode (oldCode),
+			m_newCode (newCode) {}
 };
 
 // =============================================================================
@@ -138,20 +133,19 @@
 // =============================================================================
 class AddHistory : public AbstractHistoryEntry
 {
-	PROPERTY (private,	int,		Index,	NO_OPS,	STOCK_WRITE)
-	PROPERTY (private,	QString,	Code,		NO_OPS,	STOCK_WRITE)
+	PROPERTY (private,	int,		index,	setIndex,	STOCK_WRITE)
+	PROPERTY (private,	QString,	code,	setCode,	STOCK_WRITE)
 
 	public:
 		IMPLEMENT_HISTORY_TYPE (Add)
 
 		AddHistory (int idx, LDObject* obj) :
-				m_Index (idx),
-				m_Code (obj->raw()) {}
+			m_index (idx),
+			m_code (obj->asText()) {}
 };
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+//
 class MoveHistory : public AbstractHistoryEntry
 {
 	public:
@@ -166,19 +160,16 @@
 };
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+//
 class SwapHistory : public AbstractHistoryEntry
 {
 	public:
 		IMPLEMENT_HISTORY_TYPE (Swap)
 
 		SwapHistory (int a, int b) :
-				a (a),
-				b (b) {}
+			a (a),
+			b (b) {}
 
 	private:
 		int a, b;
 };
-
-#endif // LDFORGE_HISTORY_H
--- a/src/ExternalPrograms.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/ExternalPrograms.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -50,7 +50,7 @@
 };
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 cfg (String, prog_isecalc, "");
 cfg (String, prog_intersector, "");
 cfg (String, prog_coverer, "");
@@ -98,7 +98,7 @@
 };
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static bool mkTempFile (QTemporaryFile& tmp, QString& fname)
 {
 	if (!tmp.open())
@@ -110,7 +110,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static bool checkProgPath (const extprog prog)
 {
 	QString& path = *g_extProgPaths[prog];
@@ -130,7 +130,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static QString processErrorString (extprog prog, QProcess& proc)
 {
 	switch (proc.error())
@@ -144,7 +144,7 @@
 				wineblurb = "make sure Wine is installed and ";
 #endif
 
-			return fmt ("Program failed to start, %1check your permissions", wineblurb);
+			return format ("Program failed to start, %1check your permissions", wineblurb);
 		} break;
 
 		case QProcess::Crashed:
@@ -158,19 +158,19 @@
 			return "Unknown error";
 
 		case QProcess::Timedout:
-			return fmt ("Timed out (30 seconds)");
+			return format ("Timed out (30 seconds)");
 	}
 
 	return "";
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void writeObjects (const LDObjectList& objects, QFile& f)
 {
 	for (LDObject* obj : objects)
 	{
-		if (obj->getType() == LDObject::ESubfile)
+		if (obj->type() == LDObject::ESubfile)
 		{
 			LDSubfile* ref = static_cast<LDSubfile*> (obj);
 			LDObjectList objs = ref->inlineContents (true, false);
@@ -178,15 +178,15 @@
 			writeObjects (objs, f);
 
 			for (LDObject* obj : objs)
-				obj->deleteSelf();
+				obj->destroy();
 		}
 		else
-			f.write ((obj->raw() + "\r\n").toUtf8());
+			f.write ((obj->asText() + "\r\n").toUtf8());
 	}
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void writeObjects (const LDObjectList& objects, QString fname)
 {
 	// Write the input file
@@ -194,7 +194,7 @@
 
 	if (!f.open (QIODevice::WriteOnly | QIODevice::Text))
 	{
-		critical (fmt ("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString()));
+		critical (format ("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString()));
 		return;
 	}
 
@@ -207,21 +207,21 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void writeSelection (QString fname)
 {
 	writeObjects (selection(), fname);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void writeColorGroup (const int colnum, QString fname)
 {
 	LDObjectList objects;
 
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 	{
-		if (obj->isColored() == false || obj->getColor() != colnum)
+		if (obj->isColored() == false || obj->color() != colnum)
 			continue;
 
 		objects << obj;
@@ -231,7 +231,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool runUtilityProcess (extprog prog, QString path, QString argvstr)
 {
 	QTemporaryFile input;
@@ -245,7 +245,7 @@
 	}
 #endif // _WIN32
 
-	log ("cmdline: %1 %2\n", path, argv.join (" "));
+	print ("Running command: %1 %2\n", path, argv.join (" "));
 
 	if (!input.open())
 		return false;
@@ -258,7 +258,7 @@
 
 	if (!proc.waitForStarted())
 	{
-		critical (fmt ("Couldn't start %1: %2\n", g_extProgNames[prog], processErrorString (prog, proc)));
+		critical (format ("Couldn't start %1: %2\n", g_extProgNames[prog], processErrorString (prog, proc)));
 		return false;
 	}
 
@@ -275,11 +275,11 @@
 
 	// Check the return code
 	if (proc.exitCode() != 0)
-		err = fmt ("Program exited abnormally (return code %1).",  proc.exitCode());
+		err = format ("Program exited abnormally (return code %1).",  proc.exitCode());
 
 	if (!err.isEmpty())
 	{
-		critical (fmt ("%1 failed: %2\n", g_extProgNames[prog], err));
+		critical (format ("%1 failed: %2\n", g_extProgNames[prog], err));
 		return false;
 	}
 
@@ -287,7 +287,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void insertOutput (QString fname, bool replace, QList<int> colorsToReplace)
 {
 #ifdef DEBUG
@@ -299,7 +299,7 @@
 
 	if (!f.open (QIODevice::ReadOnly))
 	{
-		critical (fmt ("Couldn't open temporary file %1 for reading.\n", fname));
+		critical (format ("Couldn't open temporary file %1 for reading.\n", fname));
 		return;
 	}
 
@@ -319,7 +319,7 @@
 	{
 		if (!obj->isScemantic())
 		{
-			obj->deleteSelf();
+			obj->destroy();
 			continue;
 		}
 
@@ -332,7 +332,7 @@
 
 // =============================================================================
 // Interface for Ytruder
-// -----------------------------------------------------------------------------
+// =============================================================================
 DEFINE_ACTION (Ytruder, 0)
 {
 	setlocale (LC_ALL, "C");
@@ -389,7 +389,7 @@
 
 // =============================================================================
 // Rectifier interface
-// -----------------------------------------------------------------------------
+// =============================================================================
 DEFINE_ACTION (Rectifier, 0)
 {
 	setlocale (LC_ALL, "C");
@@ -434,7 +434,7 @@
 
 // =============================================================================
 // Intersector interface
-// -----------------------------------------------------------------------------
+// =============================================================================
 DEFINE_ACTION (Intersector, 0)
 {
 	setlocale (LC_ALL, "C");
@@ -532,7 +532,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Coverer, 0)
 {
 	setlocale (LC_ALL, "C");
@@ -575,8 +575,8 @@
 	{
 		(ui.cb_oldsweep->isChecked() ? "-s" : ""),
 		(ui.cb_reverse->isChecked() ? "-r" : ""),
-		(ui.dsb_segsplit->value() != 0 ? fmt ("-l %1", ui.dsb_segsplit->value()) : ""),
-		(ui.sb_bias->value() != 0 ? fmt ("-s %1", ui.sb_bias->value()) : ""),
+		(ui.dsb_segsplit->value() != 0 ? format ("-l %1", ui.dsb_segsplit->value()) : ""),
+		(ui.sb_bias->value() != 0 ? format ("-s %1", ui.sb_bias->value()) : ""),
 		in1DATName,
 		in2DATName,
 		outDATName
@@ -592,7 +592,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Isecalc, 0)
 {
 	setlocale (LC_ALL, "C");
@@ -647,7 +647,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Edger2, 0)
 {
 	setlocale (LC_ALL, "C");
@@ -672,10 +672,10 @@
 
 	QString argv = join (
 	{
-		fmt ("-p %1", ui.precision->value()),
-		fmt ("-af %1", ui.flatAngle->value()),
-		fmt ("-ac %1", ui.condAngle->value()),
-		fmt ("-ae %1", ui.edgeAngle->value()),
+		format ("-p %1", ui.precision->value()),
+		format ("-af %1", ui.flatAngle->value()),
+		format ("-ac %1", ui.condAngle->value()),
+		format ("-ae %1", ui.edgeAngle->value()),
 		ui.delLines->isChecked()     ? "-de" : "",
 		ui.delCondLines->isChecked() ? "-dc" : "",
 		ui.colored->isChecked()      ? "-c" : "",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Format.h	Sun Mar 09 14:59:46 2014 +0200
@@ -0,0 +1,171 @@
+/*
+ *  LDForge: LDraw parts authoring CAD
+ *  Copyright (C) 2013, 2014 Santeri Piippo
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  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/>.
+ */
+
+#pragma once
+#include <QString>
+#include "Types.h"
+
+//! \file Format.h
+//! Contains string formatting-related functions and classes.
+
+//!
+//! Converts a given value into a string that can be retrieved with text().
+//! Used as the argument type to the formatting functions, hence its name.
+//!
+class StringFormatArg
+{
+	public:
+		StringFormatArg (const QString& a) : m_text (a) {}
+		StringFormatArg (const char& a) : m_text (a) {}
+		StringFormatArg (const uchar& a) : m_text (a) {}
+		StringFormatArg (const QChar& a) : m_text (a) {}
+		StringFormatArg (int a) : m_text (QString::number (a)) {}
+		StringFormatArg (const float& a) : m_text (QString::number (a)) {}
+		StringFormatArg (const double& a) : m_text (QString::number (a)) {}
+		StringFormatArg (const Vertex& a) : m_text (a.toString (false)) {}
+		StringFormatArg (const Matrix& a) : m_text (a.toString()) {}
+		StringFormatArg (const char* a) : m_text (a) {}
+
+		StringFormatArg (const void* a)
+		{
+			m_text.sprintf ("%p", a);
+		}
+
+		template<typename T>
+		StringFormatArg (const QList<T>& a)
+		{
+			m_text = "{";
+
+			for (const T& it : a)
+			{
+				if (&it != &a.first())
+					m_text += ", ";
+
+				StringFormatArg arg (it);
+				m_text += arg.text();
+			}
+
+			m_text += "}";
+		}
+
+		inline QString text() const
+		{
+			return m_text;
+		}
+
+	private:
+		QString m_text;
+};
+
+//!
+//! Helper function for \c format
+//!
+template<typename Arg1, typename... Rest>
+void formatHelper (QString& str, Arg1 arg1, Rest... rest)
+{
+	str = str.arg (StringFormatArg (arg1).text());
+	formatHelper (str, rest...);
+}
+
+//!
+//! Overload of \c formatHelper() with no template args
+//!
+static void formatHelper (QString& str) __attribute__ ((unused));
+static void formatHelper (QString& str)
+{
+	(void) str;
+}
+
+//!
+//! @brief Format the message with the given args.
+//!
+//! The formatting ultimately uses QString's arg() method to actually format
+//! the args so the format string should be prepared accordingly, with %1
+//! referring to the first arg, %2 to the second, etc.
+//!
+//! \param fmtstr The string to format
+//! \param args The args to format with
+//! \return The formatted string
+//!
+template<typename... Args>
+QString format (QString fmtstr, Args... args)
+{
+	formatHelper (fmtstr, args...);
+	return fmtstr;
+}
+
+//!
+//! From MessageLog.cc - declared here so that I don't need to include
+//! MessageLog.h here. Prints the given message to log.
+//!
+void printToLog (const QString& msg);
+
+//!
+//! Format and print the given args to the message log.
+//! \param fmtstr The string to format
+//! \param args The args to format with
+//!
+template<typename... Args>
+void print (QString fmtstr, Args... args)
+{
+	formatHelper (fmtstr, args...);
+	printToLog (fmtstr);
+}
+
+//!
+//! Format and print the given args to the given file descriptor
+//! \param fp The file descriptor to print to
+//! \param fmtstr The string to format
+//! \param args The args to format with
+//!
+template<typename... Args>
+void fprint (FILE* fp, QString fmtstr, Args... args)
+{
+	formatHelper (fmtstr, args...);
+	fprintf (fp, "%s", qPrintable (fmtstr));
+}
+
+//!
+//! Overload of \c fprint with a QIODevice
+//! \param dev The IO device to print to
+//! \param fmtstr The string to format
+//! \param args The args to format with
+//!
+template<typename... Args>
+void fprint (QIODevice& dev, QString fmtstr, Args... args)
+{
+	formatHelper (fmtstr, args...);
+	dev.write (fmtstr.toUtf8());
+}
+
+//!
+//! Exactly like print() except no-op in release builds.
+//! \param fmtstr The string to format
+//! \param args The args to format with
+//!
+template<typename... Args>
+void dprint (QString fmtstr, Args... args)
+{
+#ifndef RELEASE
+	formatHelper (fmtstr, args...);
+	printToLog (fmtstr);
+#else
+	(void) fmtstr;
+	(void) args;
+#endif
+}
\ No newline at end of file
--- a/src/GLCompiler.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/GLCompiler.h	Sun Mar 09 14:59:46 2014 +0200
@@ -28,7 +28,7 @@
 //
 class GLCompiler
 {
-	PROPERTY (public,	LDDocumentPointer,	Document,	NO_OPS,	STOCK_WRITE)
+	PROPERTY (public,	LDDocumentPointer,	Document,	setDocument,	STOCK_WRITE)
 
 	public:
 		struct ObjectVBOInfo
--- a/src/GLRenderer.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/GLRenderer.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -119,14 +119,14 @@
 //
 GLRenderer::GLRenderer (QWidget* parent) : QGLWidget (parent)
 {
-	m_Picking = m_rangepick = false;
+	m_isPicking = m_rangepick = false;
 	m_camera = (EFixedCamera) gl_camera;
 	m_drawToolTip = false;
-	m_EditMode = ESelectMode;
+	m_editMode = ESelectMode;
 	m_rectdraw = false;
 	m_panning = false;
 	m_compiler = new GLCompiler;
-	setFile (null);
+	setDocument (null);
 	setDrawOnly (false);
 	setMessageLog (null);
 	m_width = m_height = -1;
@@ -143,7 +143,7 @@
 	// Init camera icons
 	for (const GL::EFixedCamera cam : g_Cameras)
 	{
-		QString iconname = fmt ("camera-%1", tr (g_CameraNames[cam]).toLower());
+		QString iconname = format ("camera-%1", tr (g_CameraNames[cam]).toLower());
 
 		CameraIcon* info = &m_cameraIcons[cam];
 		info->img = new QPixmap (getIcon (iconname));
@@ -326,7 +326,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void GLRenderer::refresh()
 {
 	update();
@@ -363,7 +363,7 @@
 //
 void GLRenderer::drawGLScene()
 {
-	if (getFile() == null)
+	if (document() == null)
 		return;
 
 	if (gl_wireframe && !isPicking())
@@ -595,7 +595,7 @@
 		}
 
 		// Paint the coordinates onto the screen.
-		QString text = fmt (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]);
+		QString text = format (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);
 		paint.setPen (textpen);
@@ -607,7 +607,7 @@
 		linepen.setColor (luma (m_bgcolor) < 40 ? Qt::white : Qt::black);
 
 		// Mode-specific rendering
-		if (getEditMode() == EDrawMode)
+		if (editMode() == EDrawMode)
 		{
 			QPoint poly[4];
 			Vertex poly3d[4];
@@ -698,7 +698,7 @@
 				}
 			}
 		}
-		elif (getEditMode() == ECircleMode)
+		elif (editMode() == ECircleMode)
 		{
 			// If we have not specified the center point of the circle yet, preview it on the screen.
 			if (m_drawedVerts.isEmpty())
@@ -708,7 +708,7 @@
 				QVector<Vertex> verts, verts2;
 				const double dist0 = getCircleDrawDist (0),
 					dist1 = (m_drawedVerts.size() >= 2) ? getCircleDrawDist (1) : -1;
-				const int segs = lores;
+				const int segs = g_lores;
 				const double angleUnit = (2 * pi) / segs;
 				Axis relX, relY;
 				QVector<QPoint> ringpoints, circlepoints, circle2points;
@@ -801,20 +801,20 @@
 		for (CameraIcon& info : m_cameraIcons)
 		{
 			// Don't draw the free camera icon when in draw mode
-			if (&info == &m_cameraIcons[GL::EFreeCamera] && getEditMode() != ESelectMode)
+			if (&info == &m_cameraIcons[GL::EFreeCamera] && editMode() != ESelectMode)
 				continue;
 
 			paint.drawPixmap (info.destRect, *info.img, info.srcRect);
 		}
 
-		QString fmtstr = tr ("%1 Camera");
+		QString formatstr = tr ("%1 Camera");
 
 		// Draw a label for the current camera in the bottom left corner
 		{
 			const int margin = 4;
 
 			QString label;
-			label = fmt (fmtstr, tr (g_CameraNames[camera()]));
+			label = format (formatstr, tr (g_CameraNames[camera()]));
 			paint.setPen (textpen);
 			paint.drawText (QPoint (margin, height() - (margin + metrics.descent())), label);
 		}
@@ -826,20 +826,20 @@
 				m_drawToolTip = false;
 			else
 			{
-				QString label = fmt (fmtstr, tr (g_CameraNames[m_toolTipCamera]));
+				QString label = format (formatstr, tr (g_CameraNames[m_toolTipCamera]));
 				QToolTip::showText (m_globalpos, label);
 			}
 		}
 	}
 
 	// Message log
-	if (getMessageLog())
+	if (messageLog())
 	{
 		int y = 0;
 		const int margin = 2;
 		QColor penColor = textpen.color();
 
-		for (const MessageManager::Line& line : getMessageLog()->getLines())
+		for (const MessageManager::Line& line : messageLog()->getLines())
 		{
 			penColor.setAlphaF (line.alpha);
 			paint.setPen (penColor);
@@ -901,7 +901,7 @@
 void GLRenderer::addDrawnVertex (Vertex pos)
 {
 	// If we picked an already-existing vertex, stop drawing
-	if (getEditMode() == EDrawMode)
+	if (editMode() == EDrawMode)
 	{
 		for (Vertex& vert : m_drawedVerts)
 		{
@@ -942,7 +942,7 @@
 			}
 		}
 
-		switch (getEditMode())
+		switch (editMode())
 		{
 			case EDrawMode:
 			{
@@ -1002,7 +1002,7 @@
 		m_rangepick = false;
 	}
 
-	if (wasMid && getEditMode() != ESelectMode && m_drawedVerts.size() < 4 && m_totalmove < 10)
+	if (wasMid && editMode() != ESelectMode && m_drawedVerts.size() < 4 && m_totalmove < 10)
 	{
 		// Find the closest vertex to our cursor
 		double mindist = 1024.0f;
@@ -1293,7 +1293,7 @@
 //
 void GLRenderer::setEditMode (EditMode const& a)
 {
-	m_EditMode = a;
+	m_editMode = a;
 
 	switch (a)
 	{
@@ -1335,9 +1335,9 @@
 
 // =============================================================================
 //
-void GLRenderer::setFile (LDDocument* const& a)
+void GLRenderer::setDocument (LDDocument* const& a)
 {
-	m_File = a;
+	m_document = a;
 	m_compiler->setDocument (a);
 
 	if (a != null)
@@ -1379,7 +1379,7 @@
 	QList<Vertex>& verts = m_drawedVerts;
 	LDObjectList objs;
 
-	switch (getEditMode())
+	switch (editMode())
 	{
 		case EDrawMode:
 		{
@@ -1437,7 +1437,7 @@
 
 		case ECircleMode:
 		{
-			const int segs = lores, divs = lores; // TODO: make customizable
+			const int segs = g_lores, divs = g_lores; // TODO: make customizable
 			double dist0 = getCircleDrawDist (0),
 				dist1 = getCircleDrawDist (1);
 			LDDocument* refFile = null;
@@ -1468,9 +1468,9 @@
 				{
 					// Get a ref file for this primitive. If we cannot find it in the
 					// LDraw library, generate it.
-					if ((refFile = ::getDocument (radialFileName (::Ring, lores, lores, cmp.num))) == null)
+					if ((refFile = ::getDocument (radialFileName (::Ring, g_lores, g_lores, cmp.num))) == null)
 					{
-						refFile = generatePrimitive (::Ring, lores, lores, cmp.num);
+						refFile = generatePrimitive (::Ring, g_lores, g_lores, cmp.num);
 						refFile->setImplicit (false);
 					}
 
@@ -1548,7 +1548,7 @@
 	{
 		for (LDObject* obj : objs)
 		{
-			getFile()->addObject (obj);
+			document()->addObject (obj);
 			compileObject (obj);
 		}
 
@@ -1592,9 +1592,9 @@
 	if (obj->vertices() >= 2)
 	{
 		for (int i = 0; i < obj->vertices(); ++i)
-			verts << obj->getVertex (i);
+			verts << obj->vertex (i);
 	}
-	elif (obj->getType() == LDObject::ESubfile)
+	elif (obj->type() == LDObject::ESubfile)
 	{
 		LDSubfile* ref = static_cast<LDSubfile*> (obj);
 		LDObjectList objs = ref->inlineContents (true, false);
@@ -1602,7 +1602,7 @@
 		for (LDObject* obj : objs)
 		{
 			verts << getVertices (obj);
-			obj->deleteSelf();
+			obj->destroy();
 		}
 	}
 
@@ -1789,7 +1789,7 @@
 //
 void GLRenderer::zoomToFit()
 {
-	if (getFile() == null || m_width == -1 || m_height == -1)
+	if (document() == null || m_width == -1 || m_height == -1)
 	{
 		zoom() = 30.0f;
 		return;
@@ -1938,7 +1938,7 @@
 //
 void GLRenderer::mouseDoubleClickEvent (QMouseEvent* ev)
 {
-	if (!(ev->buttons() & Qt::LeftButton) || getEditMode() != ESelectMode)
+	if (!(ev->buttons() & Qt::LeftButton) || editMode() != ESelectMode)
 		return;
 
 	pick (ev->x(), ev->y());
@@ -1947,7 +1947,7 @@
 		return;
 
 	LDObject* obj = selection().first();
-	AddObjectDialog::staticDialog (obj->getType(), obj);
+	AddObjectDialog::staticDialog (obj->type(), obj);
 	g_win->endAction();
 	ev->accept();
 }
@@ -1958,9 +1958,9 @@
 {
 	LDOverlay* ovlobj = null;
 
-	for (LDObject* obj : getFile()->getObjects())
+	for (LDObject* obj : document()->objects())
 	{
-		if (obj->getType() == LDObject::EOverlay && static_cast<LDOverlay*> (obj)->getCamera() == cam)
+		if (obj->type() == LDObject::EOverlay && static_cast<LDOverlay*> (obj)->camera() == cam)
 		{
 			ovlobj = static_cast<LDOverlay*> (obj);
 			break;
@@ -1988,9 +1988,10 @@
 		{
 			delete meta.img;
 			meta.img = null;
-		} elif (ovlobj && (!meta.img || meta.fname != ovlobj->getFileName()))
-			setupOverlay (cam, ovlobj->getFileName(), ovlobj->getX(),
-				ovlobj->getY(), ovlobj->getWidth(), ovlobj->getHeight());
+		}
+		elif (ovlobj && (!meta.img || meta.fname != ovlobj->fileName()))
+			setupOverlay (cam, ovlobj->fileName(), ovlobj->x(),
+				ovlobj->y(), ovlobj->width(), ovlobj->height());
 	}
 }
 
@@ -2011,12 +2012,12 @@
 			// If this is the last overlay image, we need to remove the empty space after it as well.
 			LDObject* nextobj = ovlobj->next();
 
-			if (nextobj && nextobj->getType() == LDObject::EEmpty)
-				nextobj->deleteSelf();
+			if (nextobj && nextobj->type() == LDObject::EEmpty)
+				nextobj->destroy();
 
 			// If the overlay object was there and the overlay itself is
 			// not, remove the object.
-			ovlobj->deleteSelf();
+			ovlobj->destroy();
 		} elif (meta.img && !ovlobj)
 		{
 			// Inverse case: image is there but the overlay object is
@@ -2032,9 +2033,9 @@
 			int i, lastOverlay = -1;
 			bool found = false;
 
-			for (i = 0; i < getFile()->getObjectCount(); ++i)
+			for (i = 0; i < document()->getObjectCount(); ++i)
 			{
-				LDObject* obj = getFile()->getObject (i);
+				LDObject* obj = document()->getObject (i);
 
 				if (obj->isScemantic())
 				{
@@ -2042,18 +2043,18 @@
 					break;
 				}
 
-				if (obj->getType() == LDObject::EOverlay)
+				if (obj->type() == LDObject::EOverlay)
 					lastOverlay = i;
 			}
 
 			if (lastOverlay != -1)
-				getFile()->insertObj (lastOverlay + 1, ovlobj);
+				document()->insertObj (lastOverlay + 1, ovlobj);
 			else
 			{
-				getFile()->insertObj (i, ovlobj);
+				document()->insertObj (i, ovlobj);
 
 				if (found)
-					getFile()->insertObj (i + 1, new LDEmpty);
+					document()->insertObj (i + 1, new LDEmpty);
 			}
 		}
 
--- a/src/GLRenderer.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/GLRenderer.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,11 +16,10 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_GLDRAW_H
-#define LDFORGE_GLDRAW_H
-
+#pragma once
 #include <QGLWidget>
 #include "Main.h"
+#include "Macros.h"
 #include "LDObject.h"
 #include "Document.h"
 #include "GLShared.h"
@@ -97,7 +96,7 @@
 //
 class GLRenderer : public QGLWidget
 {
-	typedefs:
+	public:
 		enum EFixedCamera
 		{
 			ETopCamera,
@@ -129,13 +128,12 @@
 			EFixedCamera	cam;
 		};
 
-	properties:
 		Q_OBJECT
-		PROPERTY (public,		bool,					DrawOnly,	BOOL_OPS,	STOCK_WRITE)
-		PROPERTY (public,		MessageManager*,	MessageLog, NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	bool,					Picking,		BOOL_OPS,	STOCK_WRITE)
-		PROPERTY (public,		LDDocument*,		File,			NO_OPS,		CUSTOM_WRITE)
-		PROPERTY (public,		EditMode,			EditMode,	NO_OPS,		CUSTOM_WRITE)
+		PROPERTY (public,	bool,				isDrawOnly,	setDrawOnly,	STOCK_WRITE)
+		PROPERTY (public,	MessageManager*,	messageLog, setMessageLog,	STOCK_WRITE)
+		PROPERTY (private,	bool,				isPicking,	setPicking,		STOCK_WRITE)
+		PROPERTY (public,	LDDocument*,		document,	setDocument,	CUSTOM_WRITE)
+		PROPERTY (public,	EditMode,			editMode,	setEditMode,	CUSTOM_WRITE)
 
 	public:
 		GLRenderer (QWidget* parent = null);
@@ -192,7 +190,7 @@
 	private:
 		CameraIcon					m_cameraIcons[7];
 		QTimer*						m_toolTipTimer;
-		Qt::MouseButtons				m_lastButtons;
+		Qt::MouseButtons			m_lastButtons;
 		Qt::KeyboardModifiers		m_keymods;
 		Vertex						m_hoverpos;
 		double						m_virtWidth,
@@ -266,7 +264,7 @@
 
 		LDGLData& currentDocumentData() const
 		{
-			return *getFile()->getGLData();
+			return *document()->getGLData();
 		}
 
 		// Get a rotation value
@@ -298,6 +296,12 @@
 			return currentDocumentData().zoom[camera()];
 		}
 
+		template<typename... Args>
+		inline QString format (QString fmtstr, Args... args)
+		{
+			return ::format (fmtstr, args...);
+		}
+
 	private slots:
 		void           slot_toolTipTimer();
 		void initializeAxes();
@@ -316,5 +320,3 @@
 
 extern const GL::EFixedCamera g_Cameras[7];
 extern const char* g_CameraNames[7];
-
-#endif // LDFORGE_GLDRAW_H
--- a/src/LDConfig.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/LDConfig.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -24,8 +24,9 @@
 #include "Colors.h"
 
 // =============================================================================
+//
 // Helper function for parseLDConfig
-// -----------------------------------------------------------------------------
+//
 static bool parseLDConfigTag (LDConfigParser& pars, char const* tag, QString& val)
 {
 	int pos;
@@ -39,7 +40,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void parseLDConfig()
 {
 	QFile* fp = openLDrawFile ("LDConfig.ldr", false);
@@ -118,7 +119,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDConfigParser::LDConfigParser (QString inText, char sep)
 {
 	m_tokens = inText.split (sep, QString::SkipEmptyParts);
@@ -126,21 +127,21 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDConfigParser::isAtBeginning()
 {
 	return m_pos == -1;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDConfigParser::isAtEnd()
 {
 	return m_pos == m_tokens.size() - 1;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDConfigParser::getToken (QString& val, const int pos)
 {
 	if (pos >= m_tokens.size())
@@ -151,21 +152,21 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDConfigParser::getNextToken (QString& val)
 {
 	return getToken (val, ++m_pos);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDConfigParser::peekNextToken (QString& val)
 {
 	return getToken (val, m_pos + 1);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDConfigParser::findToken (int& result, char const* needle, int args)
 {
 	for (int i = 0; i < (m_tokens.size() - args); ++i)
@@ -181,28 +182,28 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDConfigParser::rewind()
 {
 	m_pos = -1;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDConfigParser::seek (int amount, bool rel)
 {
 	m_pos = (rel ? m_pos : 0) + amount;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int LDConfigParser::getSize()
 {
 	return m_tokens.size();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool LDConfigParser::tokenCompare (int inPos, const char* sOther)
 {
 	QString tok;
--- a/src/LDConfig.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/LDConfig.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,17 +16,14 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_LDCONFIG_H
-#define LDFORGE_LDCONFIG_H
-
+#pragma once
 #include "Types.h"
 #include <QStringList>
 
-// =============================================================================
-// LDConfigParser
+// ============================================================================
 //
 // String parsing utility for parsing ldconfig.ldr
-// =============================================================================
+//
 class LDConfigParser
 {
 	public:
@@ -54,5 +51,3 @@
 };
 
 void parseLDConfig();
-
-#endif // LDFORGE_LDCONFIG_H
--- a/src/LDObject.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/LDObject.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -35,13 +35,13 @@
 
 // =============================================================================
 // LDObject constructors
-// -----------------------------------------------------------------------------
+//
 LDObject::LDObject() :
-	m_Hidden (false),
-	m_Selected (false),
-	m_Parent (null),
-	m_File (null),
-	m_GLInit (false),
+	m_isHidden (false),
+	m_isSelected (false),
+	m_parent (null),
+	m_document (null),
+	m_isGLInit (false),
 	qObjListEntry (null)
 {
 	memset (m_coords, 0, sizeof m_coords);
@@ -50,7 +50,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::chooseID()
 {
 	int32 id = 1; // 0 shalt be null
@@ -59,18 +59,18 @@
 	{
 		assert (obj != this);
 
-		if (obj->getID() >= id)
-			id = obj->getID() + 1;
+		if (obj->id() >= id)
+			id = obj->id() + 1;
 	}
 
 	setID (id);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::setVertexCoord (int i, Axis ax, double value)
 {
-	Vertex v = getVertex (i);
+	Vertex v = vertex (i);
 	v[ax] = value;
 	setVertex (i, v);
 }
@@ -78,96 +78,96 @@
 LDError::LDError() {}
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDComment::raw() const
+//
+QString LDComment::asText() const
 {
-	return fmt ("0 %1", text);
+	return format ("0 %1", text());
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDSubfile::raw() const
+//
+QString LDSubfile::asText() const
 {
-	QString val = fmt ("1 %1 %2 ", getColor(), getPosition());
-	val += getTransform().toString();
+	QString val = format ("1 %1 %2 ", color(), position());
+	val += transform().toString();
 	val += ' ';
-	val += getFileInfo()->getName();
+	val += fileInfo()->name();
 	return val;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDLine::raw() const
+//
+QString LDLine::asText() const
 {
-	QString val = fmt ("2 %1", getColor());
+	QString val = format ("2 %1", color());
 
 	for (int i = 0; i < 2; ++i)
-		val += fmt (" %1", getVertex (i));
+		val += format (" %1", vertex (i));
 
 	return val;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDTriangle::raw() const
+//
+QString LDTriangle::asText() const
 {
-	QString val = fmt ("3 %1", getColor());
+	QString val = format ("3 %1", color());
 
 	for (int i = 0; i < 3; ++i)
-		val += fmt (" %1", getVertex (i));
+		val += format (" %1", vertex (i));
 
 	return val;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDQuad::raw() const
+//
+QString LDQuad::asText() const
 {
-	QString val = fmt ("4 %1", getColor());
+	QString val = format ("4 %1", color());
 
 	for (int i = 0; i < 4; ++i)
-		val += fmt (" %1", getVertex (i));
+		val += format (" %1", vertex (i));
 
 	return val;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDCondLine::raw() const
+//
+QString LDCondLine::asText() const
 {
-	QString val = fmt ("5 %1", getColor());
+	QString val = format ("5 %1", color());
 
 	// Add the coordinates
 	for (int i = 0; i < 4; ++i)
-		val += fmt (" %1", getVertex (i));
+		val += format (" %1", vertex (i));
 
 	return val;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDError::raw() const
+//
+QString LDError::asText() const
 {
-	return contents;
+	return contents();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDVertex::raw() const
+//
+QString LDVertex::asText() const
 {
-	return fmt ("0 !LDFORGE VERTEX %1 %2", getColor(), pos);
+	return format ("0 !LDFORGE VERTEX %1 %2", color(), pos);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDEmpty::raw() const
+//
+QString LDEmpty::asText() const
 {
 	return "";
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-const char* LDBFC::statements[] =
+//
+const char* LDBFC::k_statementStrings[] =
 {
 	"CERTIFY CCW",
 	"CCW",
@@ -181,13 +181,13 @@
 	"NOCLIP",
 };
 
-QString LDBFC::raw() const
+QString LDBFC::asText() const
 {
-	return fmt ("0 BFC %1", LDBFC::statements[type]);
+	return format ("0 BFC %1", LDBFC::k_statementStrings[m_statement]);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QList<LDTriangle*> LDQuad::splitToTriangles()
 {
 	// Create the two triangles based on this quadrilateral:
@@ -196,12 +196,12 @@
 	// |   |  ==>  | /    / |
 	// |   |       |/    /  |
 	// 1---2       1    1---2
-	LDTriangle* tri1 = new LDTriangle (getVertex (0), getVertex (1), getVertex (3));
-	LDTriangle* tri2 = new LDTriangle (getVertex (1), getVertex (2), getVertex (3));
+	LDTriangle* tri1 = new LDTriangle (vertex (0), vertex (1), vertex (3));
+	LDTriangle* tri2 = new LDTriangle (vertex (1), vertex (2), vertex (3));
 
 	// The triangles also inherit the quad's color
-	tri1->setColor (getColor());
-	tri2->setColor (getColor());
+	tri1->setColor (color());
+	tri2->setColor (color());
 
 	QList<LDTriangle*> triangles;
 	triangles << tri1;
@@ -210,29 +210,29 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::replace (LDObject* other)
 {
-	long idx = getIndex();
+	long idx = lineNumber();
 	assert (idx != -1);
 
 	// Replace the instance of the old object with the new object
-	getFile()->setObject (idx, other);
+	document()->setObject (idx, other);
 
 	// Remove the old object
-	deleteSelf();
+	destroy();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::swap (LDObject* other)
 {
-	assert (getFile() == other->getFile());
-	getFile()->swapObjects (this, other);
+	assert (document() == other->document());
+	document()->swapObjects (this, other);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDLine::LDLine (Vertex v1, Vertex v2)
 {
 	setVertex (0, v1);
@@ -240,7 +240,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDQuad::LDQuad (const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3)
 {
 	setVertex (0, v0);
@@ -250,24 +250,24 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDObject::~LDObject() {}
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDSubfile::~LDSubfile() {}
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-void LDObject::deleteSelf()
+//
+void LDObject::destroy()
 {
 	// If this object was selected, unselect it now
 	if (isSelected())
 		unselect();
 
 	// If this object was associated to a file, remove it off it now
-	if (getFile())
-		getFile()->forgetObject (this);
+	if (document())
+		document()->forgetObject (this);
 
 	// Delete the GL lists
 	g_win->R()->forgetObject (this);
@@ -279,10 +279,10 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void transformObject (LDObject* obj, Matrix transform, Vertex pos, int parentcolor)
 {
-	switch (obj->getType())
+	switch (obj->type())
 	{
 		case LDObject::ELine:
 		case LDObject::ECondLine:
@@ -291,7 +291,7 @@
 
 			for (int i = 0; i < obj->vertices(); ++i)
 			{
-				Vertex v = obj->getVertex (i);
+				Vertex v = obj->vertex (i);
 				v.transform (transform, pos);
 				obj->setVertex (i, v);
 			}
@@ -301,8 +301,8 @@
 		case LDObject::ESubfile:
 		{
 			LDSubfile* ref = static_cast<LDSubfile*> (obj);
-			Matrix newMatrix = transform * ref->getTransform();
-			Vertex newpos = ref->getPosition();
+			Matrix newMatrix = transform * ref->transform();
+			Vertex newpos = ref->position();
 
 			newpos.transform (transform, pos);
 			ref->setPosition (newpos);
@@ -314,7 +314,7 @@
 			break;
 	}
 
-	if (obj->getColor() == maincolor)
+	if (obj->color() == maincolor)
 		obj->setColor (parentcolor);
 }
 
@@ -322,14 +322,14 @@
 // -----------------------------------------------------------------------------
 LDObjectList LDSubfile::inlineContents (bool deep, bool render)
 {
-	LDObjectList objs = getFileInfo()->inlineContents (deep, render);
+	LDObjectList objs = fileInfo()->inlineContents (deep, render);
 
 	// Transform the objects
 	for (LDObject* obj : objs)
 	{
 		// Set the parent now so we know what inlined the object.
 		obj->setParent (this);
-		transformObject (obj, getTransform(), getPosition(), getColor());
+		transformObject (obj, transform(), position(), color());
 	}
 
 	return objs;
@@ -339,7 +339,7 @@
 //
 LDPolygon* LDObject::getPolygon()
 {
-	Type ot = getType();
+	Type ot = type();
 	int num =
 		(ot == LDObject::ELine)		?	2 :
 		(ot == LDObject::ETriangle)	?	3 :
@@ -350,13 +350,13 @@
 		return null;
 
 	LDPolygon* data = new LDPolygon;
-	data->id = getID();
+	data->id = id();
 	data->num = num;
-	data->color = getColor();
-	data->origin = getOrigin();
+	data->color = color();
+	data->origin = origin();
 
 	for (int i = 0; i < data->numVertices(); ++i)
-		data->vertices[i] = getVertex (i);
+		data->vertices[i] = vertex (i);
 
 	return data;
 }
@@ -365,30 +365,30 @@
 //
 QList<LDPolygon> LDSubfile::inlinePolygons()
 {
-	QList<LDPolygon> data = getFileInfo()->inlinePolygons();
+	QList<LDPolygon> data = fileInfo()->inlinePolygons();
 
 	for (LDPolygon& entry : data)
 		for (int i = 0; i < entry.numVertices(); ++i)
-			entry.vertices[i].transform (getTransform(), getPosition());
+			entry.vertices[i].transform (transform(), position());
 
 	return data;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-long LDObject::getIndex() const
+long LDObject::lineNumber() const
 {
-	assert (getFile() != null);
+	assert (document() != null);
 
-	for (int i = 0; i < getFile()->getObjectCount(); ++i)
-		if (getFile()->getObject (i) == this)
+	for (int i = 0; i < document()->getObjectCount(); ++i)
+		if (document()->getObject (i) == this)
 			return i;
 
 	return -1;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::moveObjects (LDObjectList objs, const bool up)
 {
 	if (objs.isEmpty())
@@ -399,16 +399,16 @@
 	const long end = up ? objs.size() : -1;
 	const long incr = up ? 1 : -1;
 	LDObjectList objsToCompile;
-	LDDocument* file = objs[0]->getFile();
+	LDDocument* file = objs[0]->document();
 
 	for (long i = start; i != end; i += incr)
 	{
 		LDObject* obj = objs[i];
 
-		const long idx = obj->getIndex(),
+		const long idx = obj->lineNumber(),
 				   target = idx + (up ? -1 : 1);
 
-		if ( (up && idx == 0) || (!up && idx == (long) (file->getObjects().size() - 1)))
+		if ((up && idx == 0) || (!up && idx == (long) (file->objects().size() - 1)))
 		{
 			// One of the objects hit the extrema. If this happens, this should be the first
 			// object to be iterated on. Thus, nothing has changed yet and it's safe to just
@@ -432,17 +432,17 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString LDObject::typeName (LDObject::Type type)
 {
 	LDObject* obj = LDObject::getDefault (type);
-	QString name = obj->getTypeName();
-	obj->deleteSelf();
+	QString name = obj->typeName();
+	obj->destroy();
 	return name;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString LDObject::describeObjects (const LDObjectList& objs)
 {
 	bool firstDetails = true;
@@ -457,7 +457,7 @@
 		int count = 0;
 
 		for (LDObject * obj : objs)
-			if (obj->getType() == objType)
+			if (obj->type() == objType)
 				count++;
 
 		if (count == 0)
@@ -466,13 +466,13 @@
 		if (!firstDetails)
 			text += ", ";
 
-		QString noun = fmt ("%1%2", typeName (objType), plural (count));
+		QString noun = format ("%1%2", typeName (objType), plural (count));
 
 		// Plural of "vertex" is "vertices", correct that
 		if (objType == EVertex && count != 1)
 			noun = "vertices";
 
-		text += fmt ("%1 %2", count, noun);
+		text += format ("%1 %2", count, noun);
 		firstDetails = false;
 	}
 
@@ -480,56 +480,56 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDObject* LDObject::topLevelParent()
 {
-	if (!getParent())
+	if (parent() == null)
 		return this;
 
 	LDObject* it = this;
 
-	while (it->getParent())
-		it = it->getParent();
+	while (it->parent() != null)
+		it = it->parent();
 
 	return it;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDObject* LDObject::next() const
 {
-	long idx = getIndex();
+	long idx = lineNumber();
 	assert (idx != -1);
 
-	if (idx == (long) getFile()->getObjectCount() - 1)
+	if (idx == (long) document()->getObjectCount() - 1)
 		return null;
 
-	return getFile()->getObject (idx + 1);
+	return document()->getObject (idx + 1);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-LDObject* LDObject::prev() const
+//
+LDObject* LDObject::previous() const
 {
-	long idx = getIndex();
+	long idx = lineNumber();
 	assert (idx != -1);
 
 	if (idx == 0)
 		return null;
 
-	return getFile()->getObject (idx - 1);
+	return document()->getObject (idx - 1);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::move (Vertex vect)
 {
 	if (hasMatrix())
 	{
 		LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (this);
-		mo->setPosition (mo->getPosition() + vect);
+		mo->setPosition (mo->position() + vect);
 	}
-	elif (getType() == LDObject::EVertex)
+	elif (type() == LDObject::EVertex)
 	{
 		// ugh
 		static_cast<LDVertex*> (this)->pos += vect;
@@ -537,12 +537,12 @@
 	else
 	{
 		for (int i = 0; i < vertices(); ++i)
-			setVertex (i, getVertex (i) + vect);
+			setVertex (i, vertex (i) + vect);
 	}
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 #define CHECK_FOR_OBJ(N) \
 	if (type == LDObject::E##N) \
 		return new LD##N;
@@ -565,7 +565,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::invert() {}
 void LDBFC::invert() {}
 void LDEmpty::invert() {}
@@ -573,32 +573,32 @@
 void LDError::invert() {}
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDTriangle::invert()
 {
 	// Triangle goes 0 -> 1 -> 2, reversed: 0 -> 2 -> 1.
 	// Thus, we swap 1 and 2.
-	Vertex tmp = getVertex (1);
-	setVertex (1, getVertex (2));
+	Vertex tmp = vertex (1);
+	setVertex (1, vertex (2));
 	setVertex (2, tmp);
 
 	return;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDQuad::invert()
 {
 	// Quad: 0 -> 1 -> 2 -> 3
 	// rev:  0 -> 3 -> 2 -> 1
 	// Thus, we swap 1 and 3.
-	Vertex tmp = getVertex (1);
-	setVertex (1, getVertex (3));
+	Vertex tmp = vertex (1);
+	setVertex (1, vertex (3));
 	setVertex (3, tmp);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDSubfile::invert()
 {
 	// Subfiles are inverted when they're prefixed with
@@ -607,33 +607,33 @@
 	// flipped but I don't have a method for checking flatness yet.
 	// Food for thought...
 
-	int idx = getIndex();
+	int idx = lineNumber();
 
 	if (idx > 0)
 	{
-		LDBFC* bfc = dynamic_cast<LDBFC*> (prev());
+		LDBFC* bfc = dynamic_cast<LDBFC*> (previous());
 
-		if (bfc && bfc->type == LDBFC::InvertNext)
+		if (bfc && bfc->statement() == LDBFC::InvertNext)
 		{
 			// This is prefixed with an invertnext, thus remove it.
-			bfc->deleteSelf();
+			bfc->destroy();
 			return;
 		}
 	}
 
 	// Not inverted, thus prefix it with a new invertnext.
 	LDBFC* bfc = new LDBFC (LDBFC::InvertNext);
-	getFile()->insertObj (idx, bfc);
+	document()->insertObj (idx, bfc);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void invertLine (LDObject* line)
 {
 	// For lines, we swap the vertices. I don't think that a
 	// cond-line's control points need to be swapped, do they?
-	Vertex tmp = line->getVertex (0);
-	line->setVertex (0, line->getVertex (1));
+	Vertex tmp = line->vertex (0);
+	line->setVertex (0, line->vertex (1));
 	line->setVertex (1, tmp);
 }
 
@@ -650,37 +650,37 @@
 void LDVertex::invert() {}
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDLine* LDCondLine::demote()
 {
 	LDLine* repl = new LDLine;
 
 	for (int i = 0; i < repl->vertices(); ++i)
-		repl->setVertex (i, getVertex (i));
+		repl->setVertex (i, vertex (i));
 
-	repl->setColor (getColor());
+	repl->setColor (color());
 
 	replace (repl);
 	return repl;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDObject* LDObject::fromID (int id)
 {
 	for (LDObject* obj : g_LDObjects)
-		if (obj->getID() == id)
+		if (obj->id() == id)
 			return obj;
 
 	return null;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString LDOverlay::raw() const
+//
+QString LDOverlay::asText() const
 {
-	return fmt ("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6",
-		getFileName(), getCamera(), getX(), getY(), getWidth(), getHeight());
+	return format ("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6",
+		fileName(), camera(), x(), y(), width(), height());
 }
 
 void LDOverlay::invert() {}
@@ -689,7 +689,7 @@
 // Hook the set accessors of certain properties to this changeProperty function.
 // It takes care of history management so we can capture low-level changes, this
 // makes history stuff work out of the box.
-// -----------------------------------------------------------------------------
+//
 template<class T> static void changeProperty (LDObject* obj, T* ptr, const T& val)
 {
 	long idx;
@@ -697,56 +697,56 @@
 	if (*ptr == val)
 		return;
 
-	if (obj->getFile() && (idx = obj->getIndex()) != -1)
+	if (obj->document() && (idx = obj->lineNumber()) != -1)
 	{
-		QString before = obj->raw();
+		QString before = obj->asText();
 		*ptr = val;
-		QString after = obj->raw();
+		QString after = obj->asText();
 
 		if (before != after)
-			obj->getFile()->addToHistory (new EditHistory (idx, before, after));
+			obj->document()->addToHistory (new EditHistory (idx, before, after));
 	}
 	else
 		*ptr = val;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::setColor (const int& val)
 {
-	changeProperty (this, &m_Color, val);
+	changeProperty (this, &m_color, val);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-const Vertex& LDObject::getVertex (int i) const
+//
+const Vertex& LDObject::vertex (int i) const
 {
 	return m_coords[i]->data();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::setVertex (int i, const Vertex& vert)
 {
 	changeProperty (this, &m_coords[i], LDSharedVertex::getSharedVertex (vert));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDMatrixObject::setPosition (const Vertex& a)
 {
-	changeProperty (getLinkPointer(), &m_Position, LDSharedVertex::getSharedVertex (a));
+	changeProperty (linkPointer(), &m_position, LDSharedVertex::getSharedVertex (a));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDMatrixObject::setTransform (const Matrix& val)
 {
-	changeProperty (getLinkPointer(), &m_Transform, val);
+	changeProperty (linkPointer(), &m_transform, val);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static QMap<Vertex, LDSharedVertex*> g_sharedVerts;
 
 LDSharedVertex* LDSharedVertex::getSharedVertex (const Vertex& a)
@@ -764,14 +764,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDSharedVertex::addRef (LDObject* a)
 {
 	m_refs << a;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDSharedVertex::delRef (LDObject* a)
 {
 	m_refs.removeOne (a);
@@ -784,42 +784,32 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::select()
 {
-	if (!getFile())
-	{
-		log ("Warning: Object #%1 cannot be selected as it is not assigned a file!\n", getID());
-		return;
-	}
-
-	getFile()->addToSelection (this);
+	assert (document() != null);
+	document()->addToSelection (this);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDObject::unselect()
 {
-	if (!getFile())
-	{
-		log ("Warning: Object #%1 cannot be unselected as it is not assigned a file!\n", getID());
-		return;
-	}
-
-	getFile()->removeFromSelection (this);
+	assert (document() != null);
+	document()->removeFromSelection (this);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString getLicenseText (int id)
 {
 	switch (id)
 	{
 		case 0:
-			return CALicense;
+			return g_CALicense;
 
 		case 1:
-			return NonCALicense;
+			return g_nonCALicense;
 
 		case 2:
 			return "";
@@ -830,7 +820,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDObject* LDObject::createCopy() const
 {
 	/*
@@ -843,14 +833,14 @@
 
 	/*
 	LDObject* copy = getDefault (getType());
-	copy->setColor (getColor());
+	copy->setColor (color());
 
 	if (hasMatrix())
 	{
 		LDMatrixObject* copyMo = static_cast<LDMatrixObject*> (copy);
 		const LDMatrixObject* mo = static_cast<const LDMatrixObject*> (this);
 		copyMo->setPosition (mo->getPosition());
-		copyMo->setTransform (mo->getTransform());
+		copyMo->setTransform (mo->transform());
 	}
 	else
 	{
@@ -865,17 +855,17 @@
 			LDSubfile* copyRef = static_cast<LDSubfile*> (copy);
 			const LDSubfile* ref = static_cast<const LDSubfile*> (this);
 
-			copyRef->setFileInfo (ref->getFileInfo());
+			copyRef->setFileInfo (ref->fileInfo());
 		}
 	}
 	*/
 
-	LDObject* copy = parseLine (raw());
+	LDObject* copy = parseLine (asText());
 
-	if (getOrigin().isEmpty() == false)
-		copy->setOrigin (getOrigin());
-	elif (getFile() != null)
-		copy->setOrigin (getFile()->getDisplayName() + ":" + QString::number (getIndex()));
+	if (origin().isEmpty() == false)
+		copy->setOrigin (origin());
+	elif (document() != null)
+		copy->setOrigin (document()->displayName() + ":" + QString::number (lineNumber()));
 
 	return copy;
 }
@@ -884,15 +874,15 @@
 //
 void LDSubfile::setFileInfo (const LDDocumentPointer& a)
 {
-	m_FileInfo = a;
+	m_fileInfo = a;
 
 	// If it's an immediate subfile reference (i.e. this subfile belongs in an
 	// explicit file), we need to pre-compile the GL polygons for the document
 	// if they don't exist already.
 	if (a != null &&
 		a->isImplicit() == false &&
-		a->getPolygonData().isEmpty())
+		a->polygonData().isEmpty())
 	{
 		a->initializeGLData();
 	}
-};
\ No newline at end of file
+};
--- a/src/LDObject.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/LDObject.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_LDTYPES_H
-#define LDFORGE_LDTYPES_H
-
+#pragma once
 #include "Main.h"
 #include "Types.h"
 #include "misc/DocumentPointer.h"
@@ -32,14 +30,14 @@
 	}													\
 														\
 public:													\
-	virtual LDObject::Type getType() const override		\
+	virtual LDObject::Type type() const override		\
 	{													\
 		return LDObject::E##T;							\
 	}													\
-	virtual QString raw() const override;				\
+	virtual QString asText() const override;			\
 	virtual void invert() override;
 
-#define LDOBJ_NAME(N)          virtual QString getTypeName() const override { return #N; }
+#define LDOBJ_NAME(N)          virtual QString typeName() const override { return #N; }
 #define LDOBJ_VERTICES(V)      virtual int vertices() const override { return V; }
 #define LDOBJ_SETCOLORED(V)    virtual bool isColored() const override { return V; }
 #define LDOBJ_COLORED          LDOBJ_SETCOLORED (true)
@@ -68,14 +66,14 @@
 // =============================================================================
 class LDObject
 {
-	PROPERTY (public,		bool,			Hidden,			BOOL_OPS,	STOCK_WRITE)
-	PROPERTY (public,		bool,			Selected,		BOOL_OPS,	STOCK_WRITE)
-	PROPERTY (public,		LDObject*,		Parent,			NO_OPS,		STOCK_WRITE)
-	PROPERTY (public,		LDDocument*,	File,			NO_OPS,		STOCK_WRITE) // TODO: rename~
-	PROPERTY (private,		int,			ID,				NUM_OPS,	STOCK_WRITE)
-	PROPERTY (public,		int,			Color,			NUM_OPS,	CUSTOM_WRITE)
-	PROPERTY (public,		bool,			GLInit,			BOOL_OPS,	STOCK_WRITE)
-	PROPERTY (public,		QString,		Origin,			NO_OPS,		STOCK_WRITE)
+	PROPERTY (public,		bool,			isHidden,		setHidden,		STOCK_WRITE)
+	PROPERTY (public,		bool,			isSelected,		setSelected,	STOCK_WRITE)
+	PROPERTY (public,		LDObject*,		parent,			setParent,		STOCK_WRITE)
+	PROPERTY (public,		LDDocument*,	document,		setDocument,	STOCK_WRITE)
+	PROPERTY (private,		int,			id,				setID,			STOCK_WRITE)
+	PROPERTY (public,		int,			color,			setColor,		CUSTOM_WRITE)
+	PROPERTY (public,		bool,			isGLInit,		setGLInit,		STOCK_WRITE)
+	PROPERTY (public,		QString,		origin,			setOrigin,		STOCK_WRITE)
 
 	public:
 		// Object type codes.
@@ -102,19 +100,19 @@
 		LDObject*					createCopy() const;
 
 		// Deletes this object
-		void						deleteSelf();
+		void						destroy();
 
 		// Index (i.e. line number) of this object
-		long						getIndex() const;
+		long						lineNumber() const;
 
 		// Type enumerator of this object
-		virtual Type				getType() const = 0;
+		virtual Type				type() const = 0;
 
 		// Get a vertex by index
-		const Vertex&				getVertex (int i) const;
+		const Vertex&				vertex (int i) const;
 
 		// Type name of this object
-		virtual QString				getTypeName() const = 0;
+		virtual QString				typeName() const = 0;
 
 		// Does this object have a matrix and position? (see LDMatrixObject)
 		virtual bool				hasMatrix() const = 0;
@@ -135,10 +133,10 @@
 		LDObject*					next() const;
 
 		// Object prior to this in the current file
-		LDObject*					prev() const;
+		LDObject*					previous() const;
 
 		// This object as LDraw code
-		virtual						QString raw() const = 0;
+		virtual QString				asText() const = 0;
 
 		// Replace this LDObject with another LDObject. Object is deleted in the process.
 		void						replace (LDObject* other);
@@ -204,7 +202,7 @@
 // LDSharedVertex
 //
 // For use as coordinates of LDObjects. Keeps count of references.
-// -----------------------------------------------------------------------------
+// =============================================================================
 class LDSharedVertex
 {
 	public:
@@ -232,8 +230,6 @@
 };
 
 // =============================================================================
-// LDMatrixObject
-// =============================================================================
 //
 // Common code for objects with matrices. This class is multiple-derived in
 // and thus not used directly other than as a common storage point for matrices
@@ -245,28 +241,28 @@
 // In 0.1-alpha, there was a separate 'radial' type which had a position and
 // matrix as well. Even though right now only LDSubfile uses this, I'm keeping
 // this class distinct in case I get new extension ideas. :)
-// =============================================================================
+//
 class LDMatrixObject
 {
-	PROPERTY (public,	LDObject*,			LinkPointer,	NO_OPS,	STOCK_WRITE)
-	PROPERTY (public,	Matrix,				Transform,		NO_OPS,	CUSTOM_WRITE)
+	PROPERTY (public,	LDObject*,	linkPointer,	setLinkPointer,	STOCK_WRITE)
+	PROPERTY (public,	Matrix,		transform,		setTransform,	CUSTOM_WRITE)
 
 	public:
 		LDMatrixObject() :
-			m_Position (LDSharedVertex::getSharedVertex (g_origin)) {}
+			m_position (LDSharedVertex::getSharedVertex (g_origin)) {}
 
 		LDMatrixObject (const Matrix& transform, const Vertex& pos) :
-			m_Transform (transform),
-			m_Position (LDSharedVertex::getSharedVertex (pos)) {}
+			m_transform (transform),
+			m_position (LDSharedVertex::getSharedVertex (pos)) {}
 
-		inline const Vertex& getPosition() const
+		inline const Vertex& position() const
 		{
-			return m_Position->data();
+			return m_position->data();
 		}
 
 		void setCoordinate (const Axis ax, double value)
 		{
-			Vertex v = getPosition();
+			Vertex v = position();
 			v[ax] = value;
 			setPosition (v);
 		}
@@ -274,17 +270,15 @@
 		void setPosition (const Vertex& a);
 
 	private:
-		LDSharedVertex*	m_Position;
+		LDSharedVertex*	m_position;
 };
 
 // =============================================================================
-// LDError
 //
 // Represents a line in the LDraw file that could not be properly parsed. It is
 // represented by a (!) ERROR in the code view. It exists for the purpose of
-// allowing garbage lines be debugged and corrected within LDForge. The member
-// zContent contains the contents of the unparsable line.
-// =============================================================================
+// allowing garbage lines be debugged and corrected within LDForge.
+//
 class LDError : public LDObject
 {
 	LDOBJ (Error)
@@ -293,24 +287,21 @@
 	LDOBJ_UNCOLORED
 	LDOBJ_SCEMANTIC
 	LDOBJ_NO_MATRIX
-	PROPERTY (public,	QString, FileReferenced, STR_OPS,	STOCK_WRITE)
+	PROPERTY (public,	QString,	fileReferenced, setFileReferenced,	STOCK_WRITE)
+	PROPERTY (private,	QString,	contents,		setContents,		STOCK_WRITE)
+	PROPERTY (private,	QString,	reason,			setReason,			STOCK_WRITE)
 
 	public:
 		LDError();
-		LDError (QString contents, QString reason) : contents (contents), reason (reason) {}
-
-		// Content of this unknown line
-		QString contents;
-
-		// Why is this gibberish?
-		QString reason;
+		LDError (QString contents, QString reason) :
+			m_contents (contents),
+			m_reason (reason) {}
 };
 
 // =============================================================================
-// LDEmpty
 //
 // Represents an empty line in the LDraw code file.
-// =============================================================================
+//
 class LDEmpty : public LDObject
 {
 	LDOBJ (Empty)
@@ -322,13 +313,12 @@
 };
 
 // =============================================================================
-// LDComment
 //
-// Represents a code-0 comment in the LDraw code file. Member text contains
-// the text of the comment.
-// =============================================================================
+// Represents a code-0 comment in the LDraw code file.
+//
 class LDComment : public LDObject
 {
+	PROPERTY (public, QString, text, setText, STOCK_WRITE)
 	LDOBJ (Comment)
 	LDOBJ_NAME (comment)
 	LDOBJ_VERTICES (0)
@@ -338,21 +328,18 @@
 
 	public:
 		LDComment() {}
-		LDComment (QString text) : text (text) {}
-
-		QString text; // The text of this comment
+		LDComment (QString text) : m_text (text) {}
 };
 
 // =============================================================================
-// LDBFC
 //
 // Represents a 0 BFC statement in the LDraw code. eStatement contains the type
 // of this statement.
-// =============================================================================
+//
 class LDBFC : public LDObject
 {
 	public:
-		enum Type
+		enum Statement
 		{
 			CertifyCCW,
 			CCW,
@@ -371,18 +358,17 @@
 		LDOBJ_NAME (bfc)
 		LDOBJ_VERTICES (0)
 		LDOBJ_UNCOLORED
-		LDOBJ_CUSTOM_SCEMANTIC { return (type == InvertNext); }
+		LDOBJ_CUSTOM_SCEMANTIC { return (statement() == InvertNext); }
 		LDOBJ_NO_MATRIX
+		PROPERTY (public, Statement, statement, setStatement, STOCK_WRITE)
 
 	public:
 		LDBFC() {}
-		LDBFC (const LDBFC::Type type) :
-			type (type) {}
+		LDBFC (const LDBFC::Statement type) :
+			m_statement (type) {}
 
 		// Statement strings
-		static const char* statements[];
-
-		Type type;
+		static const char* k_statementStrings[];
 };
 
 // =============================================================================
@@ -398,7 +384,7 @@
 	LDOBJ_COLORED
 	LDOBJ_SCEMANTIC
 	LDOBJ_HAS_MATRIX
-	PROPERTY (public,	LDDocumentPointer, FileInfo, NO_OPS,	CUSTOM_WRITE)
+	PROPERTY (public, LDDocumentPointer, fileInfo, setFileInfo, CUSTOM_WRITE)
 
 	public:
 		enum InlineFlag
@@ -406,8 +392,7 @@
 			DeepInline     = (1 << 0),
 			CacheInline    = (1 << 1),
 			RendererInline = (1 << 2),
-
-			DeepCacheInline = DeepInline | CacheInline,
+			DeepCacheInline = (DeepInline | CacheInline),
 		};
 
 		Q_DECLARE_FLAGS (InlineFlags, InlineFlag)
@@ -555,20 +540,18 @@
 	LDOBJ_UNCOLORED
 	LDOBJ_NON_SCEMANTIC
 	LDOBJ_NO_MATRIX
-	PROPERTY (public,	int,	 Camera,	NUM_OPS,	STOCK_WRITE)
-	PROPERTY (public,	int,	 X,			NUM_OPS,	STOCK_WRITE)
-	PROPERTY (public,	int,	 Y,			NUM_OPS,	STOCK_WRITE)
-	PROPERTY (public,	int,	 Width,		NUM_OPS,	STOCK_WRITE)
-	PROPERTY (public,	int,	 Height,	NUM_OPS,	STOCK_WRITE)
-	PROPERTY (public,	QString, FileName,	STR_OPS,	STOCK_WRITE)
+	PROPERTY (public,	int,	 camera,	setCamera,		STOCK_WRITE)
+	PROPERTY (public,	int,	 x,			setX,			STOCK_WRITE)
+	PROPERTY (public,	int,	 y,			setY,			STOCK_WRITE)
+	PROPERTY (public,	int,	 width,		setWidth,		STOCK_WRITE)
+	PROPERTY (public,	int,	 height,	setHeight,		STOCK_WRITE)
+	PROPERTY (public,	QString, fileName,	setFileName,	STOCK_WRITE)
 };
 
 // Other common LDraw stuff
-static const QString CALicense = "!LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt",
-				 NonCALicense = "!LICENSE Not redistributable : see NonCAreadme.txt";
-static const int lores = 16;
-static const int hires = 48;
+static const QString g_CALicense ("!LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt");
+static const QString g_nonCALicense ("!LICENSE Not redistributable : see NonCAreadme.txt");
+static const int g_lores = 16;
+static const int g_hires = 48;
 
 QString getLicenseText (int id);
-
-#endif // LDFORGE_LDTYPES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Macros.h	Sun Mar 09 14:59:46 2014 +0200
@@ -0,0 +1,104 @@
+/*
+ *  LDForge: LDraw parts authoring CAD
+ *  Copyright (C) 2013, 2014 Santeri Piippo
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  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/>.
+ */
+
+#pragma once
+
+#ifndef __GNUC__
+# define __attribute__(X)
+#endif
+
+// =============================================================================
+//
+#define PROPERTY(ACCESS, TYPE, READ, WRITE, WRITETYPE)			\
+private:														\
+	TYPE m_##READ;												\
+																\
+public:															\
+	inline TYPE const& READ() const								\
+	{															\
+		return m_##READ; 										\
+	}															\
+																\
+ACCESS:															\
+	void WRITE (TYPE const& a) PROPERTY_##WRITETYPE (READ)		\
+
+#define PROPERTY_STOCK_WRITE(READ)								\
+	{															\
+		m_##READ = a;											\
+	}
+
+#define PROPERTY_CUSTOM_WRITE(READ)								\
+	;
+
+// =============================================================================
+//
+#define elif(A) else if (A)
+
+// =============================================================================
+//
+#ifdef WIN32
+# define DIRSLASH "\\"
+# define DIRSLASH_CHAR '\\'
+#else // WIN32
+# define DIRSLASH "/"
+# define DIRSLASH_CHAR '/'
+#endif // WIN32
+
+// =============================================================================
+//
+#ifdef __GNUC__
+#define FUNCNAME __PRETTY_FUNCTION__
+#else
+#define FUNCNAME __func__
+#endif // __GNUC__
+
+// =============================================================================
+//
+#define dvalof(A) dprint ("value of '%1' = %2\n", #A, A)
+
+// =============================================================================
+//
+// Replace assert with a version that shows a GUI dialog if possible.
+// On Windows I just can't get the actual error messages otherwise.
+//
+#undef assert
+
+#ifdef DEBUG
+# define assert(N) { ((N) ? (void) 0 : assertionFailure (__FILE__, __LINE__, FUNCNAME, #N)); }
+#else
+# define assert(N) {}
+#endif // DEBUG
+
+#define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z}))
+
+// =============================================================================
+#ifdef IN_IDE_PARSER // KDevelop workarounds:
+# error IN_IDE_PARSER is defined (this code is only for KDevelop workarounds)
+# define COMPILE_DATE "14-01-10 10:31:09"
+
+# ifndef va_start
+#  define va_start(va, arg)
+# endif // va_start
+
+# ifndef va_end
+#  define va_end(va)
+# endif // va_end
+
+static const char* __func__ = ""; // Current function name
+typedef void FILE; // :|
+#endif // IN_IDE_PARSER
\ No newline at end of file
--- a/src/Main.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Main.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -45,7 +45,7 @@
 cfg (Bool, firststart, true);
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int main (int argc, char* argv[])
 {
 	QApplication app (argc, argv);
@@ -57,12 +57,12 @@
 	// Load or create the configuration
 	if (!Config::load())
 	{
-		log ("Creating configuration file...\n");
+		print ("Creating configuration file...\n");
 
 		if (Config::save())
-			log ("Configuration file successfully created.\n");
+			print ("Configuration file successfully created.\n");
 		else
-			log ("failed to create configuration file!\n");
+			critical ("Failed to create configuration file!\n");
 	}
 
 	LDPaths::initPaths();
@@ -83,22 +83,3 @@
 	loadPrimitives();
 	return app.exec();
 }
-
-// =============================================================================
-// -----------------------------------------------------------------------------
-void doPrint (QFile& f, QList<StringFormatArg> args)
-{
-	QString msg = DoFormat (args);
-	f.write (msg.toUtf8());
-	f.flush();
-}
-
-// =============================================================================
-// -----------------------------------------------------------------------------
-void doPrint (FILE* fp, QList<StringFormatArg> args)
-{
-	QString msg = DoFormat (args);
-	fwrite (msg.toStdString().c_str(), 1, msg.length(), fp);
-	fflush (fp);
-}
-
--- a/src/Main.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Main.h	Sun Mar 09 14:59:46 2014 +0200
@@ -20,88 +20,23 @@
 // This file is included one way or another in every source file of LDForge.
 // Stuff defined and included here is universally included.
 
-#ifndef LDFORGE_MAIN_H
-#define LDFORGE_MAIN_H
-
+#pragma once
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdarg.h>
 #include <QString>
 #include <QTextFormat>
-
+#include "Macros.h"
 #include "Version.h"
-#include "PropertyMacro.h"
 #include "Configuration.h"
-
-// =============================================
-#define alias auto&
-#define elif(A) else if (A)
+#include "Format.h"
 
 // Null pointer
 static const std::nullptr_t null = nullptr;
 
-#ifdef WIN32
-# define DIRSLASH "\\"
-# define DIRSLASH_CHAR '\\'
-#else // WIN32
-# define DIRSLASH "/"
-# define DIRSLASH_CHAR '/'
-#endif // WIN32
-
-#ifdef __GNUC__
-#define FUNCNAME __PRETTY_FUNCTION__
-#else
-#define FUNCNAME __func__
-#endif // __GNUC__
-
-#ifdef IN_IDE_PARSER
-void dlog(void, ...) {}
-#else
-# ifdef DEBUG
-#  define dlog(...) log (QString (__PRETTY_FUNCTION__) + ": " __VA_ARGS__)
-# else
-#  define dlog(...)
-# endif // DEBUG
-#endif // IN_IDE_PARSER
-
-#define dvalof(A) dlog ("value of '%1' = %2\n", #A, A)
-
-// Replace assert with a version that shows a GUI dialog if possible.
-// On Windows I just can't get the actual error messages otherwise.
 void assertionFailure (const char* file, int line, const char* funcname, const char* expr);
 
-#undef assert
-
-#ifdef DEBUG
-# define assert(N) { ((N) ? (void) 0 : assertionFailure (__FILE__, __LINE__, FUNCNAME, #N)); }
-#else
-# define assert(N) {}
-#endif // DEBUG
-
 // Version string identifier. These are defined in Version.cc.
 const char* versionString();
 const char* fullVersionString();
-
-#define properties private
-#define typedefs public
-#define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z}))
-
-// -----------------------------------------------------------------------------
-#ifdef IN_IDE_PARSER // KDevelop workarounds:
-# error IN_IDE_PARSER is defined (this code is only for KDevelop workarounds)
-# define COMPILE_DATE "14-01-10 10:31:09"
-
-# ifndef va_start
-#  define va_start(va, arg)
-# endif // va_start
-
-# ifndef va_end
-#  define va_end(va)
-# endif // va_end
-
-static const char* __func__ = ""; // Current function name
-typedef void FILE; // :|
-#endif // IN_IDE_PARSER
-
-#endif // LDFORGE_MAIN_H
--- a/src/MainWindow.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/MainWindow.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -63,8 +63,9 @@
 extern_cfg (Bool,		gl_drawangles);
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-MainWindow::MainWindow()
+//
+
+MainWindow::MainWindow (QWidget* parent, Qt::WindowFlags flags)
 {
 	g_win = this;
 	ui = new Ui_LDForgeUI;
@@ -97,7 +98,7 @@
 	updateGridToolBar();
 	updateEditModeActions();
 	updateRecentFilesMenu();
-	updateToolBars();
+	updateColorToolbar();
 	updateTitle();
 	updateActionShortcuts();
 
@@ -112,15 +113,15 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-KeySequenceConfig* MainWindow::shortcutForAction (QAction* act)
+//
+KeySequenceConfig* MainWindow::shortcutForAction (QAction* action)
 {
-	QString keycfgname = fmt ("key_%1", act->objectName());
+	QString keycfgname = format ("key_%1", action->objectName());
 	return KeySequenceConfig::getByName (keycfgname);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::updateActionShortcuts()
 {
 	for (QAction* act : findChildren<QAction*>())
@@ -133,23 +134,18 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::slot_action()
 {
-	// Get the name of the sender object and use it to compose the slot name.
-	QString methodName = fmt ("slot_%1", sender()->objectName());
-
-#ifdef DEBUG
-	log ("Action %1 triggered", sender()->objectName());
-#endif
-
-	// Now invoke this slot to call the action.
-	QMetaObject::invokeMethod (this, methodName.toAscii().constData(), Qt::DirectConnection);
+	// Get the name of the sender object and use it to compose the slot name,
+	// then invoke this slot to call the action.
+	QMetaObject::invokeMethod (this,
+		qPrintable (format ("slot_%1", sender()->objectName())), Qt::DirectConnection);
 	endAction();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::endAction()
 {
 	// Add a step in the history now.
@@ -161,7 +157,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::slot_lastSecondCleanup()
 {
 	delete m_renderer;
@@ -169,7 +165,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::updateRecentFilesMenu()
 {
 	// First, clear any items in the recent files menu
@@ -193,7 +189,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QList<LDQuickColor> quickColorsFromConfig()
 {
 	QList<LDQuickColor> colors;
@@ -215,8 +211,8 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-void MainWindow::updateToolBars()
+//
+void MainWindow::updateColorToolbar()
 {
 	m_colorButtons.clear();
 	ui->colorToolbar->clear();
@@ -228,9 +224,9 @@
 		else
 		{
 			QToolButton* colorButton = new QToolButton;
-			colorButton->setIcon (makeColorIcon (entry.getColor(), 22));
+			colorButton->setIcon (makeColorIcon (entry.color(), 22));
 			colorButton->setIconSize (QSize (22, 22));
-			colorButton->setToolTip (entry.getColor()->name);
+			colorButton->setToolTip (entry.color()->name);
 
 			connect (colorButton, SIGNAL (clicked()), this, SLOT (slot_quickColor()));
 			ui->colorToolbar->addWidget (colorButton);
@@ -244,7 +240,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::updateGridToolBar()
 {
 	// Ensure that the current grid - and only the current grid - is selected.
@@ -254,28 +250,28 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::updateTitle()
 {
-	QString title = fmt (APPNAME " %1", fullVersionString());
+	QString title = format (APPNAME " %1", fullVersionString());
 
 	// Append our current file if we have one
 	if (getCurrentDocument())
 	{
-		if (getCurrentDocument()->getName().length() > 0)
-			title += fmt (": %1", basename (getCurrentDocument()->getName()));
+		if (getCurrentDocument()->name().length() > 0)
+			title += format (": %1", basename (getCurrentDocument()->name()));
 		else
-			title += fmt (": <anonymous>");
+			title += format (": <anonymous>");
 
 		if (getCurrentDocument()->getObjectCount() > 0 &&
-				getCurrentDocument()->getObject (0)->getType() == LDObject::EComment)
+				getCurrentDocument()->getObject (0)->type() == LDObject::EComment)
 		{
 			// Append title
 			LDComment* comm = static_cast<LDComment*> (getCurrentDocument()->getObject (0));
-			title += fmt (": %1", comm->text);
+			title += format (": %1", comm->text());
 		}
 
-		if (getCurrentDocument()->getHistory()->getPosition() != getCurrentDocument()->getSavePosition())
+		if (getCurrentDocument()->hasUnsavedChanges())
 			title += '*';
 	}
 
@@ -293,7 +289,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int MainWindow::deleteSelection()
 {
 	if (selection().isEmpty())
@@ -303,14 +299,14 @@
 
 	// Delete the objects that were being selected
 	for (LDObject* obj : selCopy)
-		obj->deleteSelf();
+		obj->destroy();
 
 	refresh();
 	return selCopy.size();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::buildObjList()
 {
 	if (!getCurrentDocument())
@@ -326,20 +322,22 @@
 
 	ui->objectList->clear();
 
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 	{
 		QString descr;
 
-		switch (obj->getType())
+		switch (obj->type())
 		{
 			case LDObject::EComment:
 			{
-				descr = static_cast<LDComment*> (obj)->text;
+				descr = static_cast<LDComment*> (obj)->text();
 
 				// Remove leading whitespace
 				while (descr[0] == ' ')
 					descr.remove (0, 1);
-			} break;
+
+				break;
+			}
 
 			case LDObject::EEmpty:
 				break; // leave it empty
@@ -354,54 +352,60 @@
 					if (i != 0)
 						descr += ", ";
 
-					descr += obj->getVertex (i).toString (true);
+					descr += obj->vertex (i).toString (true);
 				}
-			} break;
+				break;
+			}
 
 			case LDObject::EError:
 			{
-				descr = fmt ("ERROR: %1", obj->raw());
-			} break;
+				descr = format ("ERROR: %1", obj->asText());
+				break;
+			}
 
 			case LDObject::EVertex:
 			{
 				descr = static_cast<LDVertex*> (obj)->pos.toString (true);
-			} break;
+				break;
+			}
 
 			case LDObject::ESubfile:
 			{
 				LDSubfile* ref = static_cast<LDSubfile*> (obj);
 
-				descr = fmt ("%1 %2, (", ref->getFileInfo()->getDisplayName(), ref->getPosition().toString (true));
+				descr = format ("%1 %2, (", ref->fileInfo()->getDisplayName(), ref->position().toString (true));
 
 				for (int i = 0; i < 9; ++i)
-					descr += fmt ("%1%2", ref->getTransform()[i], (i != 8) ? " " : "");
+					descr += format ("%1%2", ref->transform()[i], (i != 8) ? " " : "");
 
 				descr += ')';
-			} break;
+				break;
+			}
 
 			case LDObject::EBFC:
 			{
-				descr = LDBFC::statements[static_cast<LDBFC*> (obj)->type];
-			} break;
+				descr = LDBFC::k_statementStrings[static_cast<LDBFC*> (obj)->statement()];
+				break;
+			}
 
 			case LDObject::EOverlay:
 			{
 				LDOverlay* ovl = static_cast<LDOverlay*> (obj);
-				descr = fmt ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->getCamera()],
-					basename (ovl->getFileName()), ovl->getX(), ovl->getY(),
-					ovl->getWidth(), ovl->getHeight());
+				descr = format ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()],
+					basename (ovl->fileName()), ovl->x(), ovl->y(),
+					ovl->width(), ovl->height());
+				break;
 			}
-			break;
 
 			default:
 			{
-				descr = obj->getTypeName();
-			} break;
+				descr = obj->typeName();
+				break;
+			}
 		}
 
 		QListWidgetItem* item = new QListWidgetItem (descr);
-		item->setIcon (getIcon (obj->getTypeName()));
+		item->setIcon (getIcon (obj->typeName()));
 
 		// Use italic font if hidden
 		if (obj->isHidden())
@@ -412,16 +416,16 @@
 		}
 
 		// Color gibberish orange on red so it stands out.
-		if (obj->getType() == LDObject::EError)
+		if (obj->type() == LDObject::EError)
 		{
 			item->setBackground (QColor ("#AA0000"));
 			item->setForeground (QColor ("#FFAA00"));
 		}
-		elif (lv_colorize && obj->isColored() && obj->getColor() != maincolor && obj->getColor() != edgecolor)
+		elif (lv_colorize && obj->isColored() && obj->color() != maincolor && obj->color() != edgecolor)
 		{
 			// If the object isn't in the main or edge color, draw this
 			// list entry in said color.
-			LDColor* col = getColor (obj->getColor());
+			LDColor* col = getColor (obj->color());
 
 			if (col)
 				item->setForeground (col->faceColor);
@@ -437,7 +441,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::scrollToSelection()
 {
 	if (selection().isEmpty())
@@ -448,7 +452,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::slot_selectionChanged()
 {
 	if (g_isSelectionLocked == true || getCurrentDocument() == null)
@@ -466,7 +470,7 @@
 	getCurrentDocument()->clearSelection();
 	const QList<QListWidgetItem*> items = ui->objectList->selectedItems();
 
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 	{
 		for (QListWidgetItem* item : items)
 		{
@@ -489,7 +493,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::slot_recentFile()
 {
 	QAction* qAct = static_cast<QAction*> (sender());
@@ -497,7 +501,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::slot_quickColor()
 {
 	QToolButton* button = static_cast<QToolButton*> (sender());
@@ -505,9 +509,9 @@
 
 	for (const LDQuickColor& entry : m_quickColors)
 	{
-		if (entry.getToolButton() == button)
+		if (entry.toolButton() == button)
 		{
-			col = entry.getColor();
+			col = entry.color();
 			break;
 		}
 	}
@@ -531,19 +535,19 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int MainWindow::getInsertionPoint()
 {
 	// If we have a selection, put the item after it.
 	if (!selection().isEmpty())
-		return selection().last()->getIndex() + 1;
+		return selection().last()->lineNumber() + 1;
 
 	// Otherwise place the object at the end.
 	return getCurrentDocument()->getObjectCount();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::doFullRefresh()
 {
 	buildObjList();
@@ -551,7 +555,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::refresh()
 {
 	buildObjList();
@@ -559,12 +563,12 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::updateSelection()
 {
 	g_isSelectionLocked = true;
 
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 		obj->setSelected (false);
 
 	ui->objectList->clearSelection();
@@ -583,7 +587,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int MainWindow::getSelectedColor()
 {
 	int result = -1;
@@ -593,36 +597,36 @@
 		if (obj->isColored() == false)
 			continue; // doesn't use color
 
-		if (result != -1 && obj->getColor() != result)
+		if (result != -1 && obj->color() != result)
 			return -1; // No consensus in object color
 
 		if (result == -1)
-			result = obj->getColor();
+			result = obj->color();
 	}
 
 	return result;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDObject::Type MainWindow::getUniformSelectedType()
 {
 	LDObject::Type result = LDObject::EUnidentified;
 
 	for (LDObject* obj : selection())
 	{
-		if (result != LDObject::EUnidentified && obj->getColor() != result)
+		if (result != LDObject::EUnidentified && obj->color() != result)
 			return LDObject::EUnidentified;
 
 		if (result == LDObject::EUnidentified)
-			result = obj->getType();
+			result = obj->type();
 	}
 
 	return result;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::closeEvent (QCloseEvent* ev)
 {
 	// Check whether it's safe to close all files.
@@ -640,7 +644,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::spawnContextMenu (const QPoint pos)
 {
 	const bool single = (selection().size() == 1);
@@ -648,7 +652,7 @@
 
 	QMenu* contextMenu = new QMenu;
 
-	if (single && singleObj->getType() != LDObject::EEmpty)
+	if (single && singleObj->type() != LDObject::EEmpty)
 	{
 		contextMenu->addAction (ui->actionEdit);
 		contextMenu->addSeparator();
@@ -687,48 +691,40 @@
 }
 
 // =============================================================================
-// TODO: what the heh?
-// -----------------------------------------------------------------------------
-void MainWindow::deleteObjects (LDObjectList objs)
-{
-	for (LDObject* obj : objs)
-		obj->deleteSelf();
-}
-
-// =============================================================================
-// -----------------------------------------------------------------------------
-void MainWindow::deleteByColor (const int colnum)
+//
+void MainWindow::deleteByColor (int colnum)
 {
 	LDObjectList objs;
 
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 	{
-		if (!obj->isColored() || obj->getColor() != colnum)
+		if (!obj->isColored() || obj->color() != colnum)
 			continue;
 
 		objs << obj;
 	}
 
-	deleteObjects (objs);
+	for (LDObject* obj : objs)
+		obj->destroy();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::updateEditModeActions()
 {
-	const EditMode mode = R()->getEditMode();
+	const EditMode mode = R()->editMode();
 	ui->actionModeSelect->setChecked (mode == ESelectMode);
 	ui->actionModeDraw->setChecked (mode == EDrawMode);
 	ui->actionModeCircle->setChecked (mode == ECircleMode);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void MainWindow::slot_editObject (QListWidgetItem* listitem)
 {
 	LDObject* obj = null;
 
-	for (LDObject* it : getCurrentDocument()->getObjects())
+	for (LDObject* it : getCurrentDocument()->objects())
 	{
 		if (it->qObjListEntry == listitem)
 		{
@@ -737,23 +733,23 @@
 		}
 	}
 
-	AddObjectDialog::staticDialog (obj->getType(), obj);
+	AddObjectDialog::staticDialog (obj->type(), obj);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-bool MainWindow::save (LDDocument* f, bool saveAs)
+//
+bool MainWindow::save (LDDocument* doc, bool saveAs)
 {
-	QString path = f->getFullPath();
+	QString path = doc->fullPath();
 
 	if (saveAs || path.isEmpty())
 	{
-		QString name = f->getDefaultName();
+		QString name = doc->defaultName();
 
-		if (!f->getFullPath().isEmpty()) 
-			name = f->getFullPath();
-		elif (!f->getName().isEmpty())
-			name = f->getName();
+		if (!doc->fullPath().isEmpty()) 
+			name = doc->fullPath();
+		elif (!doc->name().isEmpty())
+			name = doc->name();
 
 		name.replace ("\\", "/");
 		path = QFileDialog::getSaveFileName (g_win, tr ("Save As"),
@@ -766,19 +762,19 @@
 		}
 	}
 
-	if (f->save (path))
+	if (doc->save (path))
 	{
-		if (f == getCurrentDocument())
+		if (doc == getCurrentDocument())
 			updateTitle();
 
-		log ("Saved to %1.", path);
+		print ("Saved to %1.", path);
 
 		// Add it to recent files
 		addRecentFile (path);
 		return true;
 	}
 
-	QString message = fmt (tr ("Failed to save to %1: %2"), path, strerror (errno));
+	QString message = format (tr ("Failed to save to %1: %2"), path, strerror (errno));
 
 	// Tell the user the save failed, and give the option for saving as with it.
 	QMessageBox dlg (QMessageBox::Critical, tr ("Save Failure"), message, QMessageBox::Close, g_win);
@@ -791,7 +787,7 @@
 	dlg.exec();
 
 	if (dlg.clickedButton() == saveAsBtn)
-		return save (f, true); // yay recursion!
+		return save (doc, true); // yay recursion!
 
 	return false;
 }
@@ -808,28 +804,28 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QPixmap getIcon (QString iconName)
 {
-	return (QPixmap (fmt (":/icons/%1.png", iconName)));
+	return (QPixmap (format (":/icons/%1.png", iconName)));
 }
 
 // =============================================================================
 bool confirm (QString msg)
 {
-	return confirm (MainWindow::tr ("Confirm"), msg);
+	return confirm (MainWindow::tr ("Confirm"), message);
 }
 
 bool confirm (QString title, QString msg)
 {
-	return QMessageBox::question (g_win, title, msg,
+	return QMessageBox::question (g_win, title, messag,
 		(QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes;
 }
 
 // =============================================================================
 void critical (QString msg)
 {
-	QMessageBox::critical (g_win, MainWindow::tr ("Error"), msg,
+	QMessageBox::critical (g_win, MainWindow::tr ("Error"), message,
 		(QMessageBox::Close), QMessageBox::Close);
 }
 
@@ -864,15 +860,15 @@
 {
 	std::map<int, int> counts;
 
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 	{
 		if (!obj->isColored())
 			continue;
 
-		if (counts.find (obj->getColor()) == counts.end())
-			counts[obj->getColor()] = 1;
+		if (counts.find (obj->color()) == counts.end())
+			counts[obj->color()] = 1;
 		else
-			counts[obj->getColor()]++;
+			counts[obj->color()]++;
 	}
 
 	box->clear();
@@ -884,7 +880,7 @@
 		assert (col != null);
 
 		QIcon ico = makeColorIcon (col, 16);
-		box->addItem (ico, fmt ("[%1] %2 (%3 object%4)",
+		box->addItem (ico, format ("[%1] %2 (%3 object%4)",
 			pair.first, col->name, pair.second, plural (pair.second)));
 		box->setItemData (row, pair.first);
 
@@ -914,12 +910,12 @@
 	m_updatingTabs = false;
 }
 
-void MainWindow::updateDocumentListItem (LDDocument* f)
+void MainWindow::updateDocumentListItem (LDDocument* doc)
 {
 	bool oldUpdatingTabs = m_updatingTabs;
 	m_updatingTabs = true;
 
-	if (f->getTabIndex() == -1)
+	if (doc->tabIndex() == -1)
 	{
 		// We don't have a list item for this file, so the list either doesn't
 		// exist yet or is out of date. Build the list now.
@@ -929,13 +925,13 @@
 
 	// If this is the current file, it also needs to be the selected item on
 	// the list.
-	if (f == getCurrentDocument())
-		m_tabs->setCurrentIndex (f->getTabIndex());
+	if (doc == getCurrentDocument())
+		m_tabs->setCurrentIndex (doc->tabIndex());
 
-	m_tabs->setTabText (f->getTabIndex(), f->getDisplayName());
+	m_tabs->setTabText (doc->tabIndex(), doc->getDisplayName());
 
 	// If the document.has unsaved changes, draw a little icon next to it to mark that.
-	m_tabs->setTabIcon (f->getTabIndex(), f->hasUnsavedChanges() ? getIcon ("file-save") : QIcon());
+	m_tabs->setTabIcon (doc->tabIndex(), doc->hasUnsavedChanges() ? getIcon ("file-save") : QIcon());
 	m_updatingTabs = oldUpdatingTabs;
 }
 
@@ -953,7 +949,7 @@
 	// Find the file pointer of the item that was selected.
 	for (LDDocument* it : g_loadedFiles)
 	{
-		if (it->getTabIndex() == tabIndex)
+		if (it->tabIndex() == tabIndex)
 		{
 			f = it;
 			break;
@@ -984,8 +980,8 @@
 
 void MainWindow::updateActions()
 {
-	History* his = getCurrentDocument()->getHistory();
-	int pos = his->getPosition();
+	History* his = getCurrentDocument()->history();
+	int pos = his->position();
 	ui->actionUndo->setEnabled (pos != -1);
 	ui->actionRedo->setEnabled (pos < (long) his->getSize() - 1);
 	ui->actionAxes->setChecked (gl_axes);
@@ -1000,10 +996,10 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDQuickColor::LDQuickColor (LDColor* color, QToolButton* toolButton) :
-	m_Color (color),
-	m_ToolButton (toolButton) {}
+	m_color (color),
+	m_toolButton (toolButton) {}
 
 LDQuickColor LDQuickColor::getSeparator()
 {
@@ -1012,5 +1008,5 @@
 
 bool LDQuickColor::isSeparator() const
 {
-	return getColor() == null;
+	return color() == null;
 }
--- a/src/MainWindow.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/MainWindow.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_GUI_H
-#define LDFORGE_GUI_H
-
+#pragma once
 #include <QMainWindow>
 #include <QAction>
 #include <QListWidget>
@@ -59,8 +57,8 @@
 // =============================================================================
 class LDQuickColor
 {
-	PROPERTY (public,	LDColor*,		Color,		NO_OPS,	STOCK_WRITE)
-	PROPERTY (public,	QToolButton*,	ToolButton,	NO_OPS,	STOCK_WRITE)
+	PROPERTY (public,	LDColor*,		color,		setColor,		STOCK_WRITE)
+	PROPERTY (public,	QToolButton*,	toolButton,	setToolButton,	STOCK_WRITE)
 
 	public:
 		LDQuickColor (LDColor* color, QToolButton* toolButton);
@@ -69,11 +67,9 @@
 		static LDQuickColor getSeparator();
 };
 
-// =============================================================================
-// ObjectList
-//
-// Object list class for MainWindow
-// =============================================================================
+//!
+//! Object list class for MainWindow
+//!
 class ObjectList : public QListWidget
 {
 	Q_OBJECT
@@ -82,56 +78,118 @@
 		void contextMenuEvent (QContextMenuEvent* ev);
 };
 
-// =============================================================================
-// MainWindow
-//
-// The one main GUI class. Hosts the renderer, object list, message log. Contains
-// slot_action, which is what all actions connect to. Manages menus and toolbars.
-// Large and in charge.
-// =============================================================================
+//!
+//! \brief The main window class.
+//!
+//! The MainWindow is LDForge's main GUI. It hosts the renderer, the object list,
+//! the message log, etc. Contains \c slot_action(), which is what all actions
+//! connect to.
+//!
 class MainWindow : public QMainWindow
 {
 	Q_OBJECT
 
 	public:
-		MainWindow();
+		//! Constructs the main window
+		explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0);
+
+		//! Rebuilds the object list, located to the right of the GUI.
 		void buildObjList();
+
+		//! Updates the window title.
 		void updateTitle();
+
+		//! Builds the object list and tells the GL renderer to init a full
+		//! refresh.
 		void doFullRefresh();
+
+		//! Builds the object list and tells the GL renderer to do a soft update.
 		void refresh();
+
+		//! \returns the suggested position to place a new object at.
 		int getInsertionPoint();
-		void updateToolBars();
+
+		//! Updates the quick color toolbar
+		void updateColorToolbar();
+
+		//! Rebuilds the recent files submenu
 		void updateRecentFilesMenu();
+
+		//! Sets the selection based on what's selected in the object list.
 		void updateSelection();
+
+		//! Updates the grids, selects the selected grid and deselects others.
 		void updateGridToolBar();
+
+		//! Updates the edit modes, current one is selected and others are deselected.
 		void updateEditModeActions();
+
+		//! Rebuilds the document tab list.
 		void updateDocumentList();
-		void updateDocumentListItem (LDDocument* f);
+
+		//! Updates the document tab for \c doc. If no such tab exists, the
+		//! document list is rebuilt instead.
+		void updateDocumentListItem (LDDocument* doc);
+
+		//! \returns the uniform selected color (i.e. 4 if everything selected is
+		//! red), -1 if there is no such consensus.
 		int getSelectedColor();
+
+		//! \returns the uniform selected type (i.e. \c LDObject::ELine if everything
+		//! selected is a line), \c LDObject::EUnidentified if there is no such
+		//! consensus.
 		LDObject::Type getUniformSelectedType();
+
+		//! Automatically scrolls the object list so that it points to the first
+		//! selected object.
 		void scrollToSelection();
+
+		//! Spawns the context menu at the given position.
 		void spawnContextMenu (const QPoint pos);
-		void deleteObjects (LDObjectList objs);
+
+		//! Deletes all selected objects.
+		//! \returns the count of deleted objects.
 		int deleteSelection();
-		void deleteByColor (const int colnum);
-		bool save (LDDocument* f, bool saveAs);
+
+		//! Deletes all objects by the given color number.
+		void deleteByColor (int colnum);
+
+		//! Tries to save the given document.
+		//! \param doc the document to save
+		//! \param saveAs if true, always ask for a file path
+		//! \returns whether the save was successful
+		bool save (LDDocument* doc, bool saveAs);
+
+		//! Updates various actions, undo/redo are set enabled/disabled where
+		//! appropriate, togglable actions are updated based on configuration,
+		//! etc.
 		void updateActions();
 
+		//! \returns a pointer to the renderer
 		inline GLRenderer* R()
 		{
 			return m_renderer;
 		}
 
-		inline void setQuickColors (QList<LDQuickColor>& colors)
+		//! Sets the quick color list to the given list of colors.
+		inline void setQuickColors (const QList<LDQuickColor>& colors)
 		{
 			m_quickColors = colors;
+			updateColorToolbar();
 		}
 
+		//! Adds a message to the renderer's message manager.
 		void addMessage (QString msg);
+
+		//! Updates the object list. Right now this just rebuilds it.
 		void refreshObjectList();
+
+		//! Updates all actions to ensure they have the correct shortcut as
+		//! defined in the configuration entries.
 		void updateActionShortcuts();
-		KeySequenceConfig* shortcutForAction (QAction* act);
-		void endAction();
+
+		//! Gets the shortcut configuration for the given \c action
+		KeySequenceConfig* shortcutForAction (QAction* action);
 
 	public slots:
 		void changeCurrentFile();
@@ -245,6 +303,8 @@
 		QTabBar*			m_tabs;
 		bool				m_updatingTabs;
 
+		void endAction();
+
 	private slots:
 		void slot_selectionChanged();
 		void slot_recentFile();
@@ -253,26 +313,43 @@
 		void slot_editObject (QListWidgetItem* listitem);
 };
 
-// -----------------------------------------------------------------------------
-// Pointer to the instance of MainWindow.
+//! Pointer to the instance of MainWindow.
 extern MainWindow* g_win;
 
-// -----------------------------------------------------------------------------
-// Other GUI-related stuff not directly part of MainWindow:
-QPixmap getIcon (QString iconName); // Get an icon from the resource dir
-QList<LDQuickColor> quickColorsFromConfig(); // Make a list of quick colors based on config
-bool confirm (QString title, QString msg); // Generic confirm prompt
-bool confirm (QString msg); // Generic confirm prompt
-void critical (QString msg); // Generic error prompt
-QIcon makeColorIcon (LDColor* colinfo, const int size); // Makes an icon for the given color
-void makeColorComboBox (QComboBox* box); // Fills the given combo-box with color information
+//! Get an icon by name from the resources directory.
+QPixmap getIcon (QString iconName);
+
+//! \returns a list of quick colors based on the configuration entry.
+QList<LDQuickColor> quickColorsFromConfig();
+
+//! Asks the user a yes/no question with the given \c message and the given
+//! window \c title.
+//! \returns true if the user answered yes, false if no.
+bool confirm (QString title, QString message); // Generic confirm prompt
+
+//! An overload of \c confirm(), this asks the user a yes/no question with the
+//! given \c message.
+//! \returns true if the user answered yes, false if no.
+bool confirm (QString message);
+
+//! Displays an error prompt with the given \c message
+void critical (QString message);
+
+//! Makes an icon of \c size x \c size pixels to represent \c colinfo
+QIcon makeColorIcon (LDColor* colinfo, const int size);
+
+//! Fills the given combo-box with color information
+void makeColorComboBox (QComboBox* box);
+
+//! \returns a QImage from the given raw GL \c data
 QImage imageFromScreencap (uchar* data, int w, int h);
 
-// =============================================================================
-// -----------------------------------------------------------------------------
-// Takes in pairs of radio buttons and respective values and returns the value of
-// the first found radio button that was checked.
-// =============================================================================
+//!
+//! Takes in pairs of radio buttons and respective values and finds the first
+//! selected one.
+//! \returns returns the value of the first found radio button that was checked
+//! \returns by the user.
+//!
 template<class T>
 T radioSwitch (const T& defval, QList<pair<QRadioButton*, T>> haystack)
 {
@@ -283,11 +360,10 @@
 	return defval;
 }
 
-// =============================================================================
-// -----------------------------------------------------------------------------
-// Takes in pairs of radio buttons and respective values and checks the first
-// found radio button to have the given value.
-// =============================================================================
+//!
+//! Takes in pairs of radio buttons and respective values and checks the first
+//! found radio button whose respsective value matches \c expr have the given value.
+//!
 template<class T>
 void radioDefault (const T& expr, QList<pair<QRadioButton*, T>> haystack)
 {
@@ -300,5 +376,3 @@
 		}
 	}
 }
-
-#endif // LDFORGE_GUI_H
--- a/src/MessageLog.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/MessageLog.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -27,7 +27,7 @@
 static const int g_fadeTime = 500; // msecs
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 MessageManager::MessageManager (QObject* parent) :
 			QObject (parent)
 {
@@ -37,17 +37,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 MessageManager::Line::Line (QString 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)
 {
 	changed = false;
@@ -73,7 +70,7 @@
 
 // =============================================================================
 // Add a line to the message manager.
-// -----------------------------------------------------------------------------
+//
 void MessageManager::addLine (QString line)
 {
 	// If there's too many entries, pop the excess out
@@ -83,14 +80,14 @@
 	m_lines << Line (line);
 
 	// Update the renderer view
-	if (getRenderer())
-		getRenderer()->update();
+	if (renderer())
+		renderer()->update();
 }
 
 // =============================================================================
 // Ticks the message manager. All lines are ticked and the renderer scene is
 // redrawn if something changed.
-// -----------------------------------------------------------------------------
+//
 void MessageManager::tick()
 {
 	if (m_lines.isEmpty())
@@ -108,28 +105,24 @@
 		changed |= lineChanged;
 	}
 
-	if (changed && getRenderer())
-		getRenderer()->update();
+	if (changed && renderer())
+		renderer()->update();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 const QList<MessageManager::Line>& MessageManager::getLines() const
 {
 	return m_lines;
 }
 
 // =============================================================================
-// log() interface - format the argument list and add the resulting string to
-// the main message manager.
-// -----------------------------------------------------------------------------
-void DoLog (std::initializer_list<StringFormatArg> args)
+//
+void printToLog (const QString& msg)
 {
-	const QString msg = DoFormat (args);
-
 	for (QString& a : msg.split ("\n", QString::SkipEmptyParts))
 	{
-		if (g_win)
+		if (g_win != null)
 			g_win->addMessage (a);
 
 		// Also print it to stdout
--- a/src/MessageLog.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/MessageLog.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_MESSAGELOG_H
-#define LDFORGE_MESSAGELOG_H
-
+#pragma once
 #include <QObject>
 #include <QDate>
 #include "Main.h"
@@ -27,27 +25,38 @@
 class GLRenderer;
 class QTimer;
 
-/* The message manager is an object which keeps track of messages that appear
- * on the renderer's screen. Each line is contained in a separate object which
- * contains the text, expiry time and alpha. The message manager is doubly
- * linked to its corresponding renderer.
- *
- * Message manager calls its tick() function regularly to update the messages,
- * where each line's expiry is checked for. Lines begin to fade out when nearing
- * their expiry. If the message manager's lines change, the renderer undergoes
- * repainting.
- */
+//!
+//! \brief Manages the list of messages at the top-left of the renderer.
+//!
+//! The message manager is an object which keeps track of messages that appear
+//! on the renderer's screen. Each line is contained in a separate object which
+//! contains the text, expiry time and alpha. The message manager is doubly
+//! linked to its corresponding renderer.
+//!
+//! Message manager calls its \c tick() function regularly to update the messages,
+//! where each line's expiry is checked for. Lines begin to fade out when nearing
+//! their expiry. If the message manager's lines change, the renderer undergoes
+//! repainting.
+//!
 class MessageManager : public QObject
 {
 	Q_OBJECT
-	PROPERTY (public,	GLRenderer*,	Renderer,	NO_OPS,	STOCK_WRITE)
+	PROPERTY (public, GLRenderer*, renderer, setRenderer, STOCK_WRITE)
 
 	public:
-		// Single line of the message log.
+		//! \class MessageManager::Line
+		//! A single line of the message log.
 		class Line
 		{
 			public:
+				//! Constructs a line with the given \c text
 				Line (QString text);
+
+				//! Check this line's expiry and update alpha accordingly.
+				//! \c changed is updated to whether the line has somehow
+				//! changed since the last update.
+				//! \returns true if the line is to still stick around, false
+				//! \returns if it expired.
 				bool update (bool& changed);
 
 				QString text;
@@ -55,16 +64,21 @@
 				QDateTime expiry;
 		};
 
-		explicit MessageManager (QObject* parent = 0);
+		//! Constructs the message manager.
+		explicit MessageManager (QObject* parent = null);
+
+		//! Adds a line with the given \c text to the message manager.
 		void addLine (QString line);
+
+		//! \returns all active lines in the message manager.
 		const QList<Line>& getLines() const;
 
 	private:
-		QList<Line> m_lines;
-		QTimer* m_ticker;
+		QList<Line>	m_lines;
+		QTimer*		m_ticker;
 
 	private slots:
+		//! Ticks the manager. This is called by the timer to update
+		//! the messages.
 		void tick();
 };
-
-#endif // LDFORGE_MESSAGELOG_H
--- a/src/Misc.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Misc.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -99,8 +99,9 @@
 };
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 // Grid stuff
+//
 cfg (Int,		grid,					Grid::Medium);
 cfg (Float,		grid_coarse_x,			5.0f);
 cfg (Float,		grid_coarse_y,			5.0f);
@@ -125,8 +126,9 @@
 };
 
 // =============================================================================
+//
 // 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];
@@ -144,7 +146,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool numeric (const QString& tok)
 {
 	bool gotDot = false;
@@ -176,7 +178,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void simplify (int& numer, int& denom)
 {
 	bool repeat;
@@ -205,7 +207,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Vertex rotPoint (const LDObjectList& objs)
 {
 	switch ((ERotationPoint) edit_rotpoint)
@@ -218,7 +220,7 @@
 			for (LDObject* obj : objs)
 			{
 				if (obj->hasMatrix())
-					box << dynamic_cast<LDMatrixObject*> (obj)->getPosition();
+					box << dynamic_cast<LDMatrixObject*> (obj)->position();
 				else
 					box << obj;
 			}
@@ -241,7 +243,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void configRotationPoint()
 {
 	QDialog* dlg = new QDialog;
@@ -281,19 +283,19 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString join (initlist<StringFormatArg> vals, QString delim)
+//
+QString join (QList<StringFormatArg> vals, QString delim)
 {
 	QStringList list;
 
 	for (const StringFormatArg& arg : vals)
-		list << arg.value();
+		list << arg.text();
 
 	return list.join (delim);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void roundToDecimals (double& a, int decimals)
 {
 	assert (decimals >= 0 && decimals < (signed) (sizeof g_e10 / sizeof *g_e10));
--- a/src/Misc.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Misc.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_MISC_H
-#define LDFORGE_MISC_H
-
+#pragma once
 #include <QVector>
 #include "Configuration.h"
 #include "Main.h"
@@ -41,13 +39,13 @@
 
 void roundToDecimals (double& a, int decimals);
 
-QString join (initlist<StringFormatArg> vals, QString delim = " ");
+QString join (QList< StringFormatArg > vals, QString delim = " ");
 
 // Grid stuff
 struct gridinfo
 {
 	const char* const	name;
-	float* const			confs[4];
+	float* const		confs[4];
 };
 
 extern_cfg (Int, grid);
@@ -91,14 +89,14 @@
 	double snap (double value, const Grid::Config axis);
 }
 
-// -----------------------------------------------------------------------------
+// =============================================================================
 // Plural expression
 template<class T> static inline const char* plural (T n)
 {
 	return (n != 1) ? "s" : "";
 }
 
-// -----------------------------------------------------------------------------
+// =============================================================================
 // Templated clamp
 template<class T> static inline T clamp (T a, T min, T max)
 {
@@ -138,5 +136,3 @@
 	std::sort (a.begin(), a.end());
 	a.erase (std::unique (a.begin(), a.end()), a.end());
 }
-
-#endif // LDFORGE_MISC_H
--- a/src/PartDownloader.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/PartDownloader.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -37,7 +37,7 @@
 const QString g_unofficialLibraryURL ("http://ldraw.org/library/unofficial/");
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloader::staticBegin()
 {
 	QString path = getDownloadPath();
@@ -56,7 +56,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString PartDownloader::getDownloadPath()
 {
 	QString path = net_downloadpath;
@@ -69,33 +69,33 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PartDownloader::PartDownloader (QWidget* parent) : QDialog (parent)
 {
 	setInterface (new Ui_DownloadFrom);
-	getInterface()->setupUi (this);
-	getInterface()->fname->setFocus();
-	getInterface()->progress->horizontalHeader()->setResizeMode (PartLabelColumn, QHeaderView::Stretch);
+	interface()->setupUi (this);
+	interface()->fname->setFocus();
+	interface()->progress->horizontalHeader()->setResizeMode (PartLabelColumn, QHeaderView::Stretch);
 
 	setDownloadButton (new QPushButton (tr ("Download")));
-	getInterface()->buttonBox->addButton (getDownloadButton(), QDialogButtonBox::ActionRole);
+	interface()->buttonBox->addButton (downloadButton(), QDialogButtonBox::ActionRole);
 	getButton (Abort)->setEnabled (false);
 
-	connect (getInterface()->source, SIGNAL (currentIndexChanged (int)),
+	connect (interface()->source, SIGNAL (currentIndexChanged (int)),
 		this, SLOT (sourceChanged (int)));
-	connect (getInterface()->buttonBox, SIGNAL (clicked (QAbstractButton*)),
+	connect (interface()->buttonBox, SIGNAL (clicked (QAbstractButton*)),
 		this, SLOT (buttonClicked (QAbstractButton*)));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PartDownloader::~PartDownloader()
 {
-	delete getInterface();
+	delete interface();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString PartDownloader::getURL() const
 {
 	const Source src = getSource();
@@ -104,12 +104,12 @@
 	switch (src)
 	{
 		case PartsTracker:
-			dest = getInterface()->fname->text();
+			dest = interface()->fname->text();
 			modifyDestination (dest);
 			return g_unofficialLibraryURL + dest;
 
 		case CustomURL:
-			return getInterface()->fname->text();
+			return interface()->fname->text();
 	}
 
 	// Shouldn't happen
@@ -117,7 +117,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloader::modifyDestination (QString& dest) const
 {
 	dest = dest.simplified();
@@ -179,24 +179,24 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PartDownloader::Source PartDownloader::getSource() const
 {
-	return (Source) getInterface()->source->currentIndex();
+	return (Source) interface()->source->currentIndex();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloader::sourceChanged (int i)
 {
 	if (i == CustomURL)
-		getInterface()->fileNameLabel->setText (tr ("URL:"));
+		interface()->fileNameLabel->setText (tr ("URL:"));
 	else
-		getInterface()->fileNameLabel->setText (tr ("File name:"));
+		interface()->fileNameLabel->setText (tr ("File name:"));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloader::buttonClicked (QAbstractButton* btn)
 {
 	if (btn == getButton (Close))
@@ -207,12 +207,12 @@
 	{
 		setAborted (true);
 
-		for (PartDownloadRequest* req : getRequests())
+		for (PartDownloadRequest* req : requests())
 			req->abort();
 	}
 	elif (btn == getButton (Download))
 	{
-		QString dest = getInterface()->fname->text();
+		QString dest = interface()->fname->text();
 		setPrimaryFile (null);
 		setAborted (false);
 
@@ -223,15 +223,15 @@
 
 		if (QFile::exists (PartDownloader::getDownloadPath() + DIRSLASH + dest))
 		{
-			const QString overwritemsg = fmt (tr ("%1 already exists in download directory. Overwrite?"), dest);
+			const QString overwritemsg = format (tr ("%1 already exists in download directory. Overwrite?"), dest);
 			if (!confirm (tr ("Overwrite?"), overwritemsg))
 				return;
 		}
 
-		getDownloadButton()->setEnabled (false);
-		getInterface()->progress->setEnabled (true);
-		getInterface()->fname->setEnabled (false);
-		getInterface()->source->setEnabled (false);
+		downloadButton()->setEnabled (false);
+		interface()->progress->setEnabled (true);
+		interface()->fname->setEnabled (false);
+		interface()->source->setEnabled (false);
 		downloadFile (dest, getURL(), true);
 		getButton (Close)->setEnabled (false);
 		getButton (Abort)->setEnabled (true);
@@ -240,51 +240,49 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloader::downloadFile (QString dest, QString url, bool primary)
 {
-	const int row = getInterface()->progress->rowCount();
+	const int row = interface()->progress->rowCount();
 
 	// Don't download files repeadetly.
-	if (getFilesToDownload().indexOf (dest) != -1)
+	if (filesToDownload().indexOf (dest) != -1)
 		return;
 
 	modifyDestination (dest);
-	log ("DOWNLOAD: %1 -> %2\n", url, PartDownloader::getDownloadPath() + DIRSLASH + dest);
 	PartDownloadRequest* req = new PartDownloadRequest (url, dest, primary, this);
-
-	pushToFilesToDownload (dest);
-	pushToRequests (req);
-	getInterface()->progress->insertRow (row);
+	m_filesToDownload << dest;
+	m_requests << req;
+	interface()->progress->insertRow (row);
 	req->setTableRow (row);
 	req->updateToTable();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloader::checkIfFinished()
 {
 	bool failed = isAborted();
 
 	// If there is some download still working, we're not finished.
-	for (PartDownloadRequest* req : getRequests())
+	for (PartDownloadRequest* req : requests())
 	{
 		if (!req->isFinished())
 			return;
 
-		if (req->getState() == PartDownloadRequest::EFailed)
+		if (req->state() == PartDownloadRequest::EFailed)
 			failed = true;
 	}
 
-	for (PartDownloadRequest* req : getRequests())
+	for (PartDownloadRequest* req : requests())
 		delete req;
 
-	clearRequests();
+	m_requests.clear();
 
 	// Update everything now
-	if (getPrimaryFile())
+	if (primaryFile() != null)
 	{
-		LDDocument::setCurrent (getPrimaryFile());
+		LDDocument::setCurrent (primaryFile());
 		reloadAllSubfiles();
 		g_win->doFullRefresh();
 		g_win->R()->resetAngles();
@@ -304,107 +302,107 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QPushButton* PartDownloader::getButton (PartDownloader::Button i)
 {
 	switch (i)
 	{
 		case Download:
-			return getDownloadButton();
+			return downloadButton();
 
 		case Abort:
-			return qobject_cast<QPushButton*> (getInterface()->buttonBox->button (QDialogButtonBox::Abort));
+			return qobject_cast<QPushButton*> (interface()->buttonBox->button (QDialogButtonBox::Abort));
 
 		case Close:
-			return qobject_cast<QPushButton*> (getInterface()->buttonBox->button (QDialogButtonBox::Close));
+			return qobject_cast<QPushButton*> (interface()->buttonBox->button (QDialogButtonBox::Close));
 	}
 
 	return null;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PartDownloadRequest::PartDownloadRequest (QString url, QString dest, bool primary, PartDownloader* parent) :
 	QObject (parent),
-	m_State (ERequesting),
-	m_Prompt (parent),
-	m_URL (url),
-	m_Destinaton (dest),
-	m_FilePath (PartDownloader::getDownloadPath() + DIRSLASH + dest),
-	m_NAM (new QNetworkAccessManager),
-	m_FirstUpdate (true),
-	m_Primary (primary),
-	m_FilePointer (null)
+	m_state (ERequesting),
+	m_prompt (parent),
+	m_url (url),
+	m_destinaton (dest),
+	m_filePath (PartDownloader::getDownloadPath() + DIRSLASH + dest),
+	m_networkManager (new QNetworkAccessManager),
+	m_isFirstUpdate (true),
+	m_isPrimary (primary),
+	m_filePointer (null)
 {
 	// Make sure that we have a valid destination.
-	QString dirpath = dirname (getFilePath());
+	QString dirpath = dirname (filePath());
 
 	QDir dir (dirpath);
 
-	if (!dir.exists())
+	if (dir.exists() == false)
 	{
-		log ("Creating %1...\n", dirpath);
+		print ("Creating %1...\n", dirpath);
 
 		if (!dir.mkpath (dirpath))
-			critical (fmt (tr ("Couldn't create the directory %1!"), dirpath));
+			critical (format (tr ("Couldn't create the directory %1!"), dirpath));
 	}
 
-	setReply (getNAM()->get (QNetworkRequest (QUrl (url))));
-	connect (getReply(), SIGNAL (finished()), this, SLOT (downloadFinished()));
-	connect (getReply(), SIGNAL (readyRead()), this, SLOT (readyRead()));
-	connect (getReply(), SIGNAL (downloadProgress (qint64, qint64)),
+	setNetworkReply (networkManager()->get (QNetworkRequest (QUrl (url))));
+	connect (networkReply(), SIGNAL (finished()), this, SLOT (downloadFinished()));
+	connect (networkReply(), SIGNAL (readyRead()), this, SLOT (readyRead()));
+	connect (networkReply(), SIGNAL (downloadProgress (qint64, qint64)),
 		this, SLOT (downloadProgress (qint64, qint64)));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PartDownloadRequest::~PartDownloadRequest() {}
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloadRequest::updateToTable()
 {
 	const int		labelcol = PartDownloader::PartLabelColumn,
-						progcol = PartDownloader::ProgressColumn;
-	QTableWidget*	table = getPrompt()->getInterface()->progress;
+					progcol = PartDownloader::ProgressColumn;
+	QTableWidget*	table = prompt()->interface()->progress;
 	QProgressBar*	prog;
 
-	switch (getState())
+	switch (state())
 	{
 		case ERequesting:
 		case EDownloading:
 		{
-			prog = qobject_cast<QProgressBar*> (table->cellWidget (getTableRow(), progcol));
+			prog = qobject_cast<QProgressBar*> (table->cellWidget (tableRow(), progcol));
 
 			if (!prog)
 			{
 				prog = new QProgressBar;
-				table->setCellWidget (getTableRow(), progcol, prog);
+				table->setCellWidget (tableRow(), progcol, prog);
 			}
 
-			prog->setRange (0, getBytesTotal());
-			prog->setValue (getBytesRead());
+			prog->setRange (0, numBytesTotal());
+			prog->setValue (numBytesRead());
 		} break;
 
 		case EFinished:
 		case EFailed:
 		{
-			const QString text = (getState() == EFinished)
+			const QString text = (state() == EFinished)
 				? "<b><span style=\"color: #080\">FINISHED</span></b>"
 				: "<b><span style=\"color: #800\">FAILED</span></b>";
 
 			QLabel* lb = new QLabel (text);
 			lb->setAlignment (Qt::AlignCenter);
-			table->setCellWidget (getTableRow(), progcol, lb);
+			table->setCellWidget (tableRow(), progcol, lb);
 		} break;
 	}
 
-	QLabel* lb = qobject_cast<QLabel*> (table->cellWidget (getTableRow(), labelcol));
+	QLabel* lb = qobject_cast<QLabel*> (table->cellWidget (tableRow(), labelcol));
 
 	if (isFirstUpdate())
 	{
-		lb = new QLabel (fmt ("<b>%1</b>", getDestinaton()), table);
-		table->setCellWidget (getTableRow(), labelcol, lb);
+		lb = new QLabel (format ("<b>%1</b>", destinaton()), table);
+		table->setCellWidget (tableRow(), labelcol, lb);
 	}
 
 	// Make sure that the cell is big enough to contain the label
@@ -415,40 +413,40 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloadRequest::downloadFinished()
 {
-	if (getReply()->error() != QNetworkReply::NoError)
+	if (networkReply()->error() != QNetworkReply::NoError)
 	{
-		if (isPrimary() && !getPrompt()->isAborted())
-			critical (getReply()->errorString());
+		if (isPrimary() && !prompt()->isAborted())
+			critical (networkReply()->errorString());
 
 		setState (EFailed);
 	}
-	elif (getState() != EFailed)
+	elif (state() != EFailed)
 		setState (EFinished);
 
-	setBytesRead (getBytesTotal());
+	setNumBytesRead (numBytesTotal());
 	updateToTable();
 
-	if (getFilePointer())
+	if (filePointer())
 	{
-		getFilePointer()->close();
-		delete getFilePointer();
+		filePointer()->close();
+		delete filePointer();
 		setFilePointer (null);
 
-		if (getState() == EFailed)
-			QFile::remove (getFilePath());
+		if (state() == EFailed)
+			QFile::remove (filePath());
 	}
 
-	if (getState() != EFinished)
+	if (state() != EFinished)
 	{
-		getPrompt()->checkIfFinished();
+		prompt()->checkIfFinished();
 		return;
 	}
 
 	// Try to load this file now.
-	LDDocument* f = openDocument (getFilePath(), false);
+	LDDocument* f = openDocument (filePath(), false);
 
 	if (!f)
 		return;
@@ -459,82 +457,82 @@
 	// from unknown file references, try resolve that by downloading the reference.
 	// This is why downloading a part may end up downloading multiple files, as
 	// it resolves dependencies.
-	for (LDObject* obj : f->getObjects())
+	for (LDObject* obj : f->objects())
 	{
 		LDError* err = dynamic_cast<LDError*> (obj);
 
-		if (!err || err->getFileReferenced().isEmpty())
+		if (err == null || err->fileReferenced().isEmpty())
 			continue;
 
-		QString dest = err->getFileReferenced();
-		getPrompt()->modifyDestination (dest);
-		getPrompt()->downloadFile (dest, g_unofficialLibraryURL + dest, false);
+		QString dest = err->fileReferenced();
+		prompt()->modifyDestination (dest);
+		prompt()->downloadFile (dest, g_unofficialLibraryURL + dest, false);
 	}
 
 	if (isPrimary())
 	{
-		addRecentFile (getFilePath());
-		getPrompt()->setPrimaryFile (f);
+		addRecentFile (filePath());
+		prompt()->setPrimaryFile (f);
 	}
 
-	getPrompt()->checkIfFinished();
+	prompt()->checkIfFinished();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloadRequest::downloadProgress (int64 recv, int64 total)
 {
-	setBytesRead (recv);
-	setBytesTotal (total);
+	setNumBytesRead (recv);
+	setNumBytesTotal (total);
 	setState (EDownloading);
 	updateToTable();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloadRequest::readyRead()
 {
-	if (getState() == EFailed)
+	if (state() == EFailed)
 		return;
 
-	if (getFilePointer() == null)
+	if (filePointer() == null)
 	{
-		replaceInFilePath ("\\", "/");
+		m_filePath.replace ("\\", "/");
 
 		// We have already asked the user whether we can overwrite so we're good
 		// to go here.
-		setFilePointer (new QFile (getFilePath().toLocal8Bit()));
+		setFilePointer (new QFile (filePath().toLocal8Bit()));
 
-		if (!getFilePointer()->open (QIODevice::WriteOnly))
+		if (!filePointer()->open (QIODevice::WriteOnly))
 		{
-			critical (fmt (tr ("Couldn't open %1 for writing: %2"), getFilePath(), strerror (errno)));
+			critical (format (tr ("Couldn't open %1 for writing: %2"), filePath(), strerror (errno)));
 			setState (EFailed);
-			getReply()->abort();
+			networkReply()->abort();
 			updateToTable();
-			getPrompt()->checkIfFinished();
+			prompt()->checkIfFinished();
 			return;
 		}
 	}
 
-	getFilePointer()->write (getReply()->readAll());
+	filePointer()->write (networkReply()->readAll());
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool PartDownloadRequest::isFinished() const
 {
-	return getState() == EFinished || getState() == EFailed;
+	return state() == EFinished || state() == EFailed;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PartDownloadRequest::abort()
 {
-	getReply()->abort();
+	networkReply()->abort();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (DownloadFrom, 0)
 {
 	PartDownloader::staticBegin();
--- a/src/PartDownloader.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/PartDownloader.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_DOWNLOAD_H
-#define LDFORGE_DOWNLOAD_H
-
+#pragma once
 #include <QDialog>
 #include "Main.h"
 #include "Types.h"
@@ -33,10 +31,10 @@
 class QAbstractButton;
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 class PartDownloader : public QDialog
 {
-	typedefs:
+	public:
 		enum Source
 		{
 			PartsTracker,
@@ -58,26 +56,25 @@
 
 		using RequestList = QList<PartDownloadRequest*>;
 
-	properties:
 		Q_OBJECT
-		PROPERTY (public,	LDDocument*, 		PrimaryFile,		NO_OPS,		STOCK_WRITE)
-		PROPERTY (public,	bool,				Aborted,			BOOL_OPS,	STOCK_WRITE)
-		PROPERTY (private,	Ui_DownloadFrom*,	Interface,			NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	QStringList,			FilesToDownload,		LIST_OPS,	STOCK_WRITE)
-		PROPERTY (private,	RequestList,		Requests,			LIST_OPS,	STOCK_WRITE)
-		PROPERTY (private,	QPushButton*,		DownloadButton,		NO_OPS,		STOCK_WRITE)
+		PROPERTY (public,	LDDocument*, 		primaryFile,		setPrimaryFile,		STOCK_WRITE)
+		PROPERTY (public,	bool,				isAborted,			setAborted,			STOCK_WRITE)
+		PROPERTY (private,	Ui_DownloadFrom*,	interface,			setInterface,		STOCK_WRITE)
+		PROPERTY (private,	QStringList,		filesToDownload,	setFilesToDownload,	STOCK_WRITE)
+		PROPERTY (private,	RequestList,		requests,			setRequests,		STOCK_WRITE)
+		PROPERTY (private,	QPushButton*,		downloadButton,		setDownloadButton,	STOCK_WRITE)
 
 	public:
 		explicit		PartDownloader (QWidget* parent = null);
 		virtual			~PartDownloader();
 
 		void			downloadFile (QString dest, QString url, bool primary);
-		QPushButton*		getButton (Button i);
-		QString				getURL() const;
+		QPushButton*	getButton (Button i);
+		QString			getURL() const;
 		Source			getSource() const;
 		void			modifyDestination (QString& dest) const;
 
-		static QString		getDownloadPath();
+		static QString	getDownloadPath();
 		static void		staticBegin();
 
 	public slots:
@@ -87,10 +84,10 @@
 };
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 class PartDownloadRequest : public QObject
 {
-	typedefs:
+	public:
 		enum EState
 		{
 			ERequesting,
@@ -99,21 +96,20 @@
 			EFailed,
 		};
 
-	properties:
 		Q_OBJECT
-		PROPERTY (public,	int,						TableRow,		NUM_OPS,	STOCK_WRITE)
-		PROPERTY (private,	EState,					State,			NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	PartDownloader*,			Prompt,			NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	QString,					URL,			STR_OPS,	STOCK_WRITE)
-		PROPERTY (private,	QString,					Destinaton,		STR_OPS,	STOCK_WRITE)
-		PROPERTY (private,	QString,					FilePath,		STR_OPS,	STOCK_WRITE)
-		PROPERTY (private,	QNetworkAccessManager*,	NAM,			NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	QNetworkReply*,			Reply,			NO_OPS,		STOCK_WRITE)
-		PROPERTY (private,	bool,					FirstUpdate,	BOOL_OPS,	STOCK_WRITE)
-		PROPERTY (private,	int64,					BytesRead,		NUM_OPS,	STOCK_WRITE)
-		PROPERTY (private,	int64,					BytesTotal,		NUM_OPS,	STOCK_WRITE)
-		PROPERTY (private,	bool,					Primary,		BOOL_OPS,	STOCK_WRITE)
-		PROPERTY (private,	QFile*,					FilePointer,	NO_OPS,		STOCK_WRITE)
+		PROPERTY (public,	int,					tableRow,		setTableRow,		STOCK_WRITE)
+		PROPERTY (private,	EState,					state,			setState,			STOCK_WRITE)
+		PROPERTY (private,	PartDownloader*,		prompt,			setPrompt,			STOCK_WRITE)
+		PROPERTY (private,	QString,				url,			setURL,				STOCK_WRITE)
+		PROPERTY (private,	QString,				destinaton,		setDestination,		STOCK_WRITE)
+		PROPERTY (private,	QString,				filePath,		setFilePath,		STOCK_WRITE)
+		PROPERTY (private,	QNetworkAccessManager*,	networkManager,	setNetworkManager,	STOCK_WRITE)
+		PROPERTY (private,	QNetworkReply*,			networkReply,	setNetworkReply,	STOCK_WRITE)
+		PROPERTY (private,	bool,					isFirstUpdate,	setFirstUpdate,		STOCK_WRITE)
+		PROPERTY (private,	int64,					numBytesRead,	setNumBytesRead,	STOCK_WRITE)
+		PROPERTY (private,	int64,					numBytesTotal,	setNumBytesTotal,	STOCK_WRITE)
+		PROPERTY (private,	bool,					isPrimary,		setPrimary,			STOCK_WRITE)
+		PROPERTY (private,	QFile*,					filePointer,	setFilePointer,		STOCK_WRITE)
 
 	public:
 		explicit PartDownloadRequest (QString url, QString dest, bool primary, PartDownloader* parent);
@@ -121,7 +117,6 @@
 		virtual ~PartDownloadRequest();
 		void updateToTable();
 		bool isFinished() const;
-
 		void operator= (const PartDownloadRequest&) = delete;
 
 	public slots:
@@ -130,5 +125,3 @@
 		void downloadProgress (qint64 recv, qint64 total);
 		void abort();
 };
-
-#endif // LDFORGE_DOWNLOAD_H
--- a/src/Primitives.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Primitives.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -51,7 +51,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void loadPrimitives()
 {
 	PrimitiveCategory::loadCategories();
@@ -59,7 +59,7 @@
 	// Try to load prims.cfg
 	QFile conf (Config::filepath ("prims.cfg"));
 
-	if (!conf.open (QIODevice::ReadOnly))
+	if (conf.open (QIODevice::ReadOnly) == false)
 	{
 		// No prims.cfg, build it
 		PrimitiveScanner::start();
@@ -85,12 +85,12 @@
 		}
 
 		PrimitiveCategory::populateCategories();
-		log ("%1 primitives loaded.\n", g_primitives.size());
+		print ("%1 primitives loaded.\n", g_primitives.size());
 	}
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void recursiveGetFilenames (QDir dir, QList<QString>& fnames)
 {
 	QFileInfoList flist = dir.entryInfoList (QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
@@ -105,7 +105,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PrimitiveScanner::PrimitiveScanner (QObject* parent) :
 	QObject (parent),
 	m_i (0)
@@ -116,18 +116,18 @@
 	m_baselen = dir.absolutePath().length();
 	recursiveGetFilenames (dir, m_files);
 	emit starting (m_files.size());
-	log ("Scanning primitives...");
+	print ("Scanning primitives...");
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PrimitiveScanner::~PrimitiveScanner()
 {
 	g_activeScanner = null;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PrimitiveScanner::work()
 {
 	int j = min (m_i + 100, m_files.size());
@@ -143,7 +143,7 @@
 		Primitive info;
 		info.name = fname.mid (m_baselen + 1);  // make full path relative
 		info.name.replace ('/', '\\');  // use DOS backslashes, they're expected
-		info.cat = null;
+		info.category = null;
 		QByteArray titledata = f.readLine();
 
 		if (titledata != QByteArray())
@@ -167,7 +167,7 @@
 		QFile conf (path);
 
 		if (!conf.open (QIODevice::WriteOnly | QIODevice::Text))
-			critical (fmt ("Couldn't write primitive list %1: %2",
+			critical (format ("Couldn't write primitive list %1: %2",
 				path, conf.errorString()));
 		else
 		{
@@ -179,7 +179,7 @@
 
 		g_primitives = m_prims;
 		PrimitiveCategory::populateCategories();
-		log ("%1 primitives scanned", g_primitives.size());
+		print ("%1 primitives scanned", g_primitives.size());
 		g_activeScanner = null;
 		emit workDone();
 		deleteLater();
@@ -193,7 +193,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PrimitiveScanner::start()
 {
 	if (g_activeScanner)
@@ -204,13 +204,13 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PrimitiveCategory::PrimitiveCategory (QString name, QObject* parent) :
 	QObject (parent),
-	m_Name (name) {}
+	m_name (name) {}
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PrimitiveCategory::populateCategories()
 {
 	for (PrimitiveCategory* cat : g_PrimitiveCategories)
@@ -220,7 +220,7 @@
 	for (Primitive& prim : g_primitives)
 	{
 		bool matched = false;
-		prim.cat = null;
+		prim.category = null;
 
 		// Go over the categories and their regexes, if and when there's a match,
 		// the primitive's category is set to the category the regex beloings to.
@@ -245,27 +245,27 @@
 
 				if (matched)
 				{
-					prim.cat = cat;
+					prim.category = cat;
 					break;
 				}
 			}
 
 			// Drop out if a category was decided on.
-			if (prim.cat != null)
+			if (prim.category != null)
 				break;
 		}
 
 		// If there was a match, add the primitive to the category.
 		// Otherwise, add it to the list of unmatched primitives.
-		if (prim.cat != null)
-			prim.cat->prims << prim;
+		if (prim.category != null)
+			prim.category->prims << prim;
 		else
 			g_unmatched->prims << prim;
 	}
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PrimitiveCategory::loadCategories()
 {
 	for (PrimitiveCategory* cat : g_PrimitiveCategories)
@@ -281,7 +281,7 @@
 
 	if (!f.open (QIODevice::ReadOnly))
 	{
-		critical (fmt (QObject::tr ("Failed to open primitive categories: %1"), f.errorString()));
+		critical (format (QObject::tr ("Failed to open primitive categories: %1"), f.errorString()));
 		return;
 	}
 
@@ -308,7 +308,7 @@
 		elif (cat != null)
 		{
 			QString cmd = line.left (colon);
-			ERegexType type = EFilenameRegex;
+			RegexType type = EFilenameRegex;
 
 			if (cmd == "f")
 				type = EFilenameRegex;
@@ -316,7 +316,7 @@
 				type = ETitleRegex;
 			else
 			{
-				log (tr ("Warning: unknown command \"%1\" on line \"%2\""), cmd, line);
+				print (tr ("Warning: unknown command \"%1\" on line \"%2\""), cmd, line);
 				continue;
 			}
 
@@ -325,7 +325,7 @@
 			cat->regexes << entry;
 		}
 		else
-			log ("Warning: Rules given before the first category name");
+			print ("Warning: Rules given before the first category name");
 	}
 
 	if (cat->isValidToInclude())
@@ -340,12 +340,12 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool PrimitiveCategory::isValidToInclude()
 {
-	if (regexes.size() == 0)
+	if (regexes.isEmpty())
 	{
-		log (tr ("Warning: category \"%1\" left without patterns"), getName());
+		print (tr ("Warning: category \"%1\" left without patterns"), name());
 		deleteLater();
 		return false;
 	}
@@ -354,21 +354,21 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool isPrimitiveLoaderBusy()
 {
 	return g_activeScanner != null;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static double radialPoint (int i, int divs, double (*func) (double))
 {
 	return (*func) ((i * 2 * pi) / divs);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void makeCircle (int segs, int divs, double radius, QList<QLineF>& lines)
 {
 	for (int i = 0; i < segs; ++i)
@@ -383,7 +383,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDObjectList makePrimitive (PrimitiveType type, int segs, int divs, int num)
 {
 	LDObjectList objs;
@@ -536,7 +536,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static QString primitiveTypeName (PrimitiveType type)
 {
 	// Not translated as primitives are in English.
@@ -548,7 +548,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString radialFileName (PrimitiveType type, int segs, int divs, int num)
 {
 	int numer = segs,
@@ -565,10 +565,10 @@
 	}
 
 	// Compose some general information: prefix, fraction, root, ring number
-	QString prefix = (divs == lores) ? "" : fmt ("%1/", divs);
-	QString frac = fmt ("%1-%2", numer, denom);
+	QString prefix = (divs == g_lores) ? "" : format ("%1/", divs);
+	QString frac = format ("%1-%2", numer, denom);
 	QString root = g_radialNameRoots[type];
-	QString numstr = (type == Ring || type == Cone) ? fmt ("%1", num) : "";
+	QString numstr = (type == Ring || type == Cone) ? format ("%1", num) : "";
 
 	// Truncate the root if necessary (7-16rin4.dat for instance).
 	// However, always keep the root at least 2 characters.
@@ -580,7 +580,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocument* generatePrimitive (PrimitiveType type, int segs, int divs, int num)
 {
 	// Make the description
@@ -598,13 +598,13 @@
 			(num < 10) ? "  " :
 			(num < 100) ? " "  : "";
 
-		descr = fmt ("%1 %2%3 x %4", primitiveTypeName (type), spacing, num, frac);
+		descr = format ("%1 %2%3 x %4", primitiveTypeName (type), spacing, num, frac);
 	}
 	else
-		descr = fmt ("%1 %2", primitiveTypeName (type), frac);
+		descr = format ("%1 %2", primitiveTypeName (type), frac);
 
 	// Prepend "Hi-Res" if 48/ primitive.
-	if (divs == hires)
+	if (divs == g_hires)
 		descr.insert (0, "Hi-Res ");
 
 	LDDocument* f = new LDDocument;
@@ -616,15 +616,15 @@
 	if (ld_defaultname.isEmpty() == false)
 	{
 		license = getLicenseText (ld_defaultlicense);
-		author = fmt ("%1 [%2]", ld_defaultname, ld_defaultuser);
+		author = format ("%1 [%2]", ld_defaultname, ld_defaultuser);
 	}
 
 	f->addObjects (
 	{
 		new LDComment (descr),
-		new LDComment (fmt ("Name: %1", name)),
-		new LDComment (fmt ("Author: %1", author)),
-		new LDComment (fmt ("!LDRAW_ORG Unofficial_%1Primitive", divs == hires ? "48_" : "")),
+		new LDComment (format ("Name: %1", name)),
+		new LDComment (format ("Author: %1", author)),
+		new LDComment (format ("!LDRAW_ORG Unofficial_%1Primitive", divs == g_hires ? "48_" : "")),
 		new LDComment (license),
 		new LDEmpty,
 		new LDBFC (LDBFC::CertifyCCW),
@@ -636,7 +636,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocument* getPrimitive (PrimitiveType type, int segs, int divs, int num)
 {
 	QString name = radialFileName (type, segs, divs, num);
@@ -649,7 +649,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PrimitivePrompt::PrimitivePrompt (QWidget* parent, Qt::WindowFlags f) :
 	QDialog (parent, f)
 {
@@ -659,26 +659,26 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 PrimitivePrompt::~PrimitivePrompt()
 {
 	delete ui;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void PrimitivePrompt::hiResToggled (bool on)
 {
-	ui->sb_segs->setMaximum (on ? hires : lores);
+	ui->sb_segs->setMaximum (on ? g_hires : g_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() == g_lores)
+		ui->sb_segs->setValue (g_hires);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (MakePrimitive, 0)
 {
 	PrimitivePrompt* dlg = new PrimitivePrompt (g_win);
@@ -687,7 +687,7 @@
 		return;
 
 	int segs = dlg->ui->sb_segs->value();
-	int divs = dlg->ui->cb_hires->isChecked() ? hires : lores;
+	int divs = dlg->ui->cb_hires->isChecked() ? g_hires : g_lores;
 	int num = dlg->ui->sb_ringnum->value();
 	PrimitiveType type =
 		dlg->ui->rb_circle->isChecked()   ? Circle :
--- a/src/Primitives.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Primitives.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_PRIMITIVES_H
-#define LDFORGE_PRIMITIVES_H
-
+#pragma once
 #include "Main.h"
 #include "Types.h"
 #include <QRegExp>
@@ -29,17 +27,18 @@
 class PrimitiveCategory;
 struct Primitive
 {
-	QString name, title;
-	PrimitiveCategory* cat;
+	QString				name,
+						title;
+	PrimitiveCategory*	category;
 };
 
 class PrimitiveCategory : public QObject
 {
 	Q_OBJECT
-	PROPERTY (public,	QString,	Name,	STR_OPS,	STOCK_WRITE)
+	PROPERTY (public, QString, name, setName, STOCK_WRITE)
 
 	public:
-		enum ERegexType
+		enum RegexType
 		{
 			EFilenameRegex,
 			ETitleRegex
@@ -48,7 +47,7 @@
 		struct RegexEntry
 		{
 			QRegExp		regex;
-			ERegexType	type;
+			RegexType	type;
 		};
 
 		QList<RegexEntry> regexes;
@@ -62,13 +61,12 @@
 };
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+//
 // PrimitiveScanner
 //
 // Worker object that scans the primitives folder for primitives and
 // builds an index of them.
-// =============================================================================
+//
 class PrimitiveScanner : public QObject
 {
 	Q_OBJECT
@@ -130,5 +128,3 @@
 LDDocument* getPrimitive (PrimitiveType type, int segs, int divs, int num);
 
 QString radialFileName (PrimitiveType type, int segs, int divs, int num);
-
-#endif // LDFORGE_PRIMITIVES_H
--- a/src/PropertyMacro.h	Sun Mar 09 14:04:06 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
- *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013, 2014 Santeri Piippo
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  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/>.
- */
-
-#ifndef LDFORGE_PROPERTY_H
-#define LDFORGE_PROPERTY_H
-
-// =============================================================================
-//
-// Identifier names
-//
-#define PROPERTY_SET_ACCESSOR(NAME)			set##NAME
-#define PROPERTY_GET_ACCESSOR(NAME)			get##NAME
-#define PROPERTY_IS_ACCESSOR(NAME)			is##NAME // for bool types
-#define PROPERTY_MEMBER_NAME(NAME)			m_##NAME
-
-// Names of operations
-#define PROPERTY_APPEND_OPERATION(NAME)		appendTo##NAME
-#define PROPERTY_PREPEND_OPERATION(NAME)	prependTo##NAME
-#define PROPERTY_REPLACE_OPERATION(NAME)	replaceIn##NAME
-#define PROPERTY_INCREASE_OPERATION(NAME)	increase##NAME
-#define PROPERTY_DECREASE_OPERATION(NAME)	decrease##NAME
-#define PROPERTY_TOGGLE_OPERATION(NAME)		toggle##NAME
-#define PROPERTY_PUSH_OPERATION(NAME)		pushTo##NAME
-#define PROPERTY_REMOVE_OPERATION(NAME)		removeFrom##NAME
-#define PROPERTY_CLEAR_OPERATION(NAME)		clear##NAME
-#define PROPERTY_COUNT_OPERATION(NAME)		count##NAME
-
-// Operation definitions
-// These are the methods of the list type that are called in the operations.
-#define PROPERTY_APPEND_METHOD_NAME			append		// QString::append
-#define PROPERTY_PREPEND_METHOD_NAME		prepend		// QString::prepend
-#define PROPERTY_REPLACE_METHOD_NAME		replace		// QString::replace
-#define PROPERTY_PUSH_METHOD_NAME			append		// QList<T>::append
-#define PROPERTY_REMOVE_METHOD_NAME			removeOne	// QList<T>::removeOne
-#define PROPERTY_CLEAR_METHOD_NAME			clear		// QList<T>::clear
-
-// =============================================================================
-//
-// Main PROPERTY macro
-//
-#define PROPERTY(ACCESS, TYPE, NAME, OPS, WRITETYPE)							\
-	private:																	\
-		TYPE PROPERTY_MEMBER_NAME(NAME);										\
-																				\
-	public:																		\
-		inline TYPE const& PROPERTY_GET_READ_METHOD (NAME, OPS) const			\
-		{																		\
-			return PROPERTY_MEMBER_NAME(NAME); 									\
-		}																		\
-																				\
-	ACCESS:																		\
-		PROPERTY_MAKE_WRITE (TYPE, NAME, WRITETYPE)								\
-		PROPERTY_DEFINE_OPERATIONS (TYPE, NAME, OPS)
-
-// =============================================================================
-//
-// PROPERTY_GET_READ_METHOD
-//
-// This macro uses the OPS argument to construct the name of the actual
-// macro which returns the name of the get accessor. This is so that the
-// bool properties get is<NAME>() accessors while non-bools get get<NAME>()
-//
-#define PROPERTY_GET_READ_METHOD(NAME, OPS)										\
-	PROPERTY_GET_READ_METHOD_##OPS (NAME)
-
-#define PROPERTY_GET_READ_METHOD_BOOL_OPS(NAME) PROPERTY_IS_ACCESSOR (NAME)()
-#define PROPERTY_GET_READ_METHOD_NO_OPS(NAME) PROPERTY_GET_ACCESSOR (NAME)()
-#define PROPERTY_GET_READ_METHOD_STR_OPS(NAME) PROPERTY_GET_ACCESSOR (NAME)()
-#define PROPERTY_GET_READ_METHOD_NUM_OPS(NAME) PROPERTY_GET_ACCESSOR (NAME)()
-#define PROPERTY_GET_READ_METHOD_LIST_OPS(NAME) PROPERTY_GET_ACCESSOR (NAME)()
-
-// =============================================================================
-//
-// PROPERTY_MAKE_WRITE
-//
-// This macro uses the WRITETYPE argument to construct the set accessor of the
-// property. If WRITETYPE is STOCK_WRITE, an inline method is defined to just
-// set the new value of the property. If WRITETYPE is CUSTOM_WRITE, the accessor
-// is merely declared and is left for the user to define.
-//
-#define PROPERTY_MAKE_WRITE(TYPE, NAME, WRITETYPE)								\
-	PROPERTY_MAKE_WRITE_##WRITETYPE (TYPE, NAME)
-
-#define PROPERTY_MAKE_WRITE_STOCK_WRITE(TYPE, NAME)								\
-		inline void set##NAME (TYPE const& new##NAME)							\
-		{																		\
-			PROPERTY_MEMBER_NAME(NAME) = new##NAME;								\
-		}
-
-#define PROPERTY_MAKE_WRITE_CUSTOM_WRITE(TYPE, NAME)							\
-		void set##NAME (TYPE const& new##NAME);									\
-
-// =============================================================================
-//
-// PROPERTY_DEFINE_OPERATIONS
-//
-// This macro may expand into methods defining additional operations for the
-// method. 
-
-#define PROPERTY_DEFINE_OPERATIONS(TYPE, NAME, OPS)								\
-	DEFINE_PROPERTY_##OPS (TYPE, NAME)
-
-// =============================================================================
-//
-// DEFINE_PROPERTY_NO_OPS
-//
-// Obviously NO_OPS expands into no operations.
-//
-#define DEFINE_PROPERTY_NO_OPS(TYPE, NAME)
-
-// =============================================================================
-//
-// DEFINE_PROPERTY_STR_OPS
-//
-#define DEFINE_PROPERTY_STR_OPS(TYPE, NAME)										\
-		void PROPERTY_APPEND_OPERATION(NAME) (const TYPE& a)					\
-		{																		\
-			TYPE tmp (PROPERTY_MEMBER_NAME(NAME));								\
-			tmp.PROPERTY_APPEND_METHOD_NAME (a);								\
-			set##NAME (tmp);													\
-		}																		\
-																				\
-		void PROPERTY_PREPEND_OPERATION(NAME) (const TYPE& a)					\
-		{																		\
-			TYPE tmp (PROPERTY_MEMBER_NAME(NAME));								\
-			tmp.PROPERTY_PREPEND_METHOD_NAME (a);								\
-			set##NAME (tmp);													\
-		}																		\
-																				\
-		void PROPERTY_REPLACE_OPERATION(NAME) (const TYPE& a, const TYPE& b)	\
-		{																		\
-			TYPE tmp (PROPERTY_MEMBER_NAME(NAME));								\
-			tmp.PROPERTY_REPLACE_METHOD_NAME (a, b);							\
-			set##NAME (tmp);													\
-		}
-
-// =============================================================================
-//
-// DEFINE_PROPERTY_NUM_OPS
-//
-#define DEFINE_PROPERTY_NUM_OPS(TYPE, NAME)										\
-		inline void PROPERTY_INCREASE_OPERATION(NAME) (TYPE a = 1)				\
-		{																		\
-			set##NAME (PROPERTY_MEMBER_NAME(NAME) + a);							\
-		}																		\
-																				\
-		inline void PROPERTY_DECREASE_OPERATION(NAME) (TYPE a = 1)				\
-		{																		\
-			set##NAME (PROPERTY_MEMBER_NAME(NAME) - a);							\
-		}
-
-// =============================================================================
-//
-// DEFINE_PROPERTY_BOOL_OPS
-//
-#define DEFINE_PROPERTY_BOOL_OPS(TYPE, NAME)									\
-		inline void PROPERTY_TOGGLE_OPERATION(NAME)()							\
-		{																		\
-			set##NAME (!PROPERTY_MEMBER_NAME(NAME));							\
-		}
-
-// =============================================================================
-//
-// DEFINE_PROPERTY_LIST_OPS
-//
-#define DEFINE_PROPERTY_LIST_OPS(TYPE, NAME)									\
-		void PROPERTY_PUSH_OPERATION(NAME) (const TYPE::value_type& a)			\
-		{																		\
-			PROPERTY_MEMBER_NAME(NAME).PROPERTY_PUSH_METHOD_NAME (a);			\
-		}																		\
-																				\
-		void PROPERTY_REMOVE_OPERATION(NAME) (const TYPE::value_type& a)		\
-		{																		\
-			PROPERTY_MEMBER_NAME(NAME).PROPERTY_REMOVE_METHOD_NAME (a);			\
-		}																		\
-																				\
-		inline void PROPERTY_CLEAR_OPERATION(NAME)()							\
-		{																		\
-			PROPERTY_MEMBER_NAME(NAME).PROPERTY_CLEAR_METHOD_NAME();			\
-		}																		\
-																				\
-	public:																		\
-		inline int PROPERTY_COUNT_OPERATION(NAME)() const						\
-		{																		\
-			return PROPERTY_GET_ACCESSOR (NAME)().size();						\
-		}
-
-#endif // LDFORGE_PROPERTY_H
\ No newline at end of file
--- a/src/Types.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Types.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -28,20 +28,7 @@
 #include "Document.h"
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-QString DoFormat (QList<StringFormatArg> args)
-{
-	assert (args.size() >= 1);
-	QString text = args[0].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)
 {
 	m_coords[X] = x;
@@ -50,7 +37,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void Vertex::move (const Vertex& other)
 {
 	for_axes (ax)
@@ -58,7 +45,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 double Vertex::distanceTo (const Vertex& other) const
 {
 	double dx = abs (x() - other.x());
@@ -68,7 +55,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Vertex Vertex::midpoint (const Vertex& other)
 {
 	Vertex mid;
@@ -80,19 +67,19 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString Vertex::toString (bool mangled) const
 {
-	QString fmtstr = "%1 %2 %3";
+	QString formatstr = "%1 %2 %3";
 
 	if (mangled)
-		fmtstr = "(%1, %2, %3)";
+		formatstr = "(%1, %2, %3)";
 
-	return fmt (fmtstr, x(), y(), z());
+	return format (formatstr, x(), y(), z());
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void Vertex::transform (const Matrix& matr, const Vertex& pos)
 {
 	double x2 = (matr[0] * x()) + (matr[1] * y()) + (matr[2] * z()) + pos[X];
@@ -105,21 +92,21 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 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 getCoordinate (X) == other[X] &&
@@ -128,7 +115,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Vertex& Vertex::operator/= (const double d)
 {
 	for_axes (ax)
@@ -138,7 +125,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Vertex Vertex::operator/ (const double d) const
 {
 	Vertex other (*this);
@@ -146,7 +133,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Vertex& Vertex::operator+= (const Vertex& other)
 {
 	move (other);
@@ -154,7 +141,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Vertex Vertex::operator+ (const Vertex& other) const
 {
 	Vertex newvert (*this);
@@ -163,7 +150,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int Vertex::operator< (const Vertex& other) const
 {
 	if (operator== (other))
@@ -185,7 +172,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Matrix::Matrix (double vals[])
 {
 	for (int i = 0; i < 9; ++i)
@@ -193,7 +180,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Matrix::Matrix (double fillval)
 {
 	for (int i = 0; i < 9; ++i)
@@ -201,28 +188,28 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-Matrix::Matrix (initlist<double> vals)
+//
+Matrix::Matrix (QList<double> vals)
 {
 	assert (vals.size() == 9);
 	memcpy (&m_vals[0], & (*vals.begin()), sizeof m_vals);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-void Matrix::puts() const
+//
+void Matrix::dump() const
 {
 	for (int i = 0; i < 3; ++i)
 	{
 		for (int j = 0; j < 3; ++j)
-			log ("%1\t", m_vals[ (i * 3) + j]);
+			print ("%1\t", m_vals[ (i * 3) + j]);
 
-		log ("\n");
+		print ("\n");
 	}
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QString Matrix::toString() const
 {
 	QString val;
@@ -239,14 +226,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void Matrix::zero()
 {
 	memset (&m_vals[0], 0, sizeof m_vals);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Matrix Matrix::mult (const Matrix& other) const
 {
 	Matrix val;
@@ -261,7 +248,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Matrix& Matrix::operator= (const Matrix& other)
 {
 	memcpy (&m_vals[0], &other.m_vals[0], sizeof m_vals);
@@ -269,53 +256,53 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 double Matrix::getDeterminant() 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));
+	return (value (0) * value (4) * value (8)) +
+		   (value (1) * value (5) * value (6)) +
+		   (value (2) * value (3) * value (7)) -
+		   (value (2) * value (4) * value (6)) -
+		   (value (1) * value (3) * value (8)) -
+		   (value (0) * value (5) * value (7));
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool Matrix::operator== (const Matrix& other) const
 {
 	for (int i = 0; i < 9; ++i)
-		if (val (i) != other[i])
+		if (value (i) != other[i])
 			return false;
 
 	return true;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDBoundingBox::LDBoundingBox()
 {
 	reset();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-void LDBoundingBox::calculate()
+//
+void LDBoundingBox::calculateFromCurrentDocument()
 {
 	reset();
 
 	if (!getCurrentDocument())
 		return;
 
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 		calcObject (obj);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDBoundingBox::calcObject (LDObject* obj)
 {
-	switch (obj->getType())
+	switch (obj->type())
 	{
 		case LDObject::ELine:
 		case LDObject::ETriangle:
@@ -323,7 +310,7 @@
 		case LDObject::ECondLine:
 		{
 			for (int i = 0; i < obj->vertices(); ++i)
-				calcVertex (obj->getVertex (i));
+				calcVertex (obj->vertex (i));
 		} break;
 
 		case LDObject::ESubfile:
@@ -334,7 +321,7 @@
 			for (LDObject * obj : objs)
 			{
 				calcObject (obj);
-				obj->deleteSelf();
+				obj->destroy();
 			}
 		}
 		break;
@@ -345,7 +332,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDBoundingBox& LDBoundingBox::operator<< (const Vertex& v)
 {
 	calcVertex (v);
@@ -353,7 +340,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDBoundingBox& LDBoundingBox::operator<< (LDObject* obj)
 {
 	calcObject (obj);
@@ -361,34 +348,34 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-void LDBoundingBox::calcVertex (const Vertex& v)
+//
+void LDBoundingBox::calcVertex (const Vertex& vertex)
 {
 	for_axes (ax)
 	{
-		m_Vertex0[ax] = min (v[ax], m_Vertex0[ax]);
-		m_Vertex1[ax] = max (v[ax], m_Vertex1[ax]);
+		m_vertex0[ax] = min (vertex[ax], m_vertex0[ax]);
+		m_vertex1[ax] = max (vertex[ax], m_vertex1[ax]);
 	}
 
 	setEmpty (false);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDBoundingBox::reset()
 {
-	m_Vertex0[X] = m_Vertex0[Y] = m_Vertex0[Z] = 10000.0;
-	m_Vertex1[X] = m_Vertex1[Y] = m_Vertex1[Z] = -10000.0;
+	m_vertex0[X] = m_vertex0[Y] = m_vertex0[Z] = 10000.0;
+	m_vertex1[X] = m_vertex1[Y] = m_vertex1[Z] = -10000.0;
 	setEmpty (true);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-double LDBoundingBox::size() const
+//
+double LDBoundingBox::longestMeasurement() const
 {
-	double xscale = (m_Vertex0[X] - m_Vertex1[X]);
-	double yscale = (m_Vertex0[Y] - m_Vertex1[Y]);
-	double zscale = (m_Vertex0[Z] - m_Vertex1[Z]);
+	double xscale = (m_vertex0[X] - m_vertex1[X]);
+	double yscale = (m_vertex0[Y] - m_vertex1[Y]);
+	double zscale = (m_vertex0[Z] - m_vertex1[Z]);
 	double size = zscale;
 
 	if (xscale > yscale)
@@ -406,11 +393,11 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 Vertex LDBoundingBox::center() const
 {
 	return Vertex (
-		(m_Vertex0[X] + m_Vertex1[X]) / 2,
-		(m_Vertex0[Y] + m_Vertex1[Y]) / 2,
-		(m_Vertex0[Z] + m_Vertex1[Z]) / 2);
+		(m_vertex0[X] + m_vertex1[X]) / 2,
+		(m_vertex0[Y] + m_vertex1[Y]) / 2,
+		(m_vertex0[Z] + m_vertex1[Z]) / 2);
 }
--- a/src/Types.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Types.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,15 +16,12 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_TYPES_H
-#define LDFORGE_TYPES_H
-
+#pragma once
 #include <QString>
 #include <QObject>
 #include <QStringList>
 #include <QMetaType>
-#include <QVector>
-#include "PropertyMacro.h"
+#include "Macros.h"
 
 class LDObject;
 class QFile;
@@ -39,11 +36,8 @@
 using uint32 = quint32;
 using uint64 = quint64;
 
-template<class T>
-using initlist = std::initializer_list<T>;
-
-template<class T, class R>
-using pair = std::pair<T, R>;
+template<typename T, typename R>
+using Pair = std::pair<T, R>;
 
 enum Axis
 {
@@ -57,143 +51,230 @@
 class LDObject;
 using LDObjectList = QList<LDObject*>;
 
-// =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-// matrix
-//
-// A mathematical 3 x 3 matrix
-// =============================================================================
+//!
+//! \brief A mathematical 3 x 3 matrix
+//!
 class Matrix
 {
 	public:
+		//! Constructs a matrix with undetermined values.
 		Matrix() {}
-		Matrix (initlist<double> vals);
+
+		//! Constructs a matrix with the given values.
+		//! \note \c vals is expected to have exactly 9 elements.
+		Matrix (const QList<double>& vals);
+
+		//! Constructs a matrix all 9 elements initialized to the same value.
+		//! \param fillval the value to initialize the matrix coordinates as
 		Matrix (double fillval);
+
+		//! Constructs a matrix with a C-array.
+		//! \note \c vals is expected to have exactly 9 elements.
 		Matrix (double vals[]);
 
+		//! Calculates the matrix's determinant.
+		//! \returns the calculated determinant.
 		double			getDeterminant() const;
+
+		//! Multiplies this matrix with \c other
+		//! \param other the matrix to multiply with.
+		//! \returns the resulting matrix
+		//! \note a.mult(b) is not equivalent to b.mult(a)!
 		Matrix			mult (const Matrix& other) const;
-		void			puts() const;
+
+		//! Prints the matrix to stdout.
+		void			dump() const;
+
+		//! \returns a string representation of the matrix.
 		QString			toString() const;
+
+		//! Zeroes the matrix out.
 		void			zero();
+
+		//! Assigns the matrix values to the values of \c other.
+		//! \param other the matrix to assign this to.
+		//! \returns a reference to self
 		Matrix&			operator= (const Matrix& other);
 
-		inline double& val (int idx)
+		//! \returns a mutable reference to a value by \c idx
+		inline double& value (int idx)
 		{
 			return m_vals[idx];
 		}
 
-		inline const double& val (int idx) const
+		//! An overload of \c value() for const matrices.
+		//! \returns a const reference to a value by \c idx
+		inline const double& value (int idx) const
 		{
 			return m_vals[idx];
 		}
 
+		//! An operator overload for \c mult().
+		//! \returns the multiplied matrix.
 		inline Matrix operator* (const Matrix& other) const
 		{
 			return mult (other);
 		}
 
+		//! An operator overload for \c value().
+		//! \returns a mutable reference to a value by \c idx
 		inline double& operator[] (int idx)
 		{
-			return val (idx);
+			return value (idx);
 		}
 
+		//! An operator overload for \c value() const.
+		//! \returns a const reference to a value by \c idx
 		inline const double& operator[] (int idx) const
 		{
-			return val (idx);
+			return value (idx);
 		}
 
+		//! \param other the matrix to check against
+		//! \returns whether the two matrices have the same values.
 		bool operator== (const Matrix& other) const;
 
 	private:
 		double m_vals[9];
 };
 
-// =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-// Vertex
-//
-// Vertex class, contains a single point in 3D space. Not to be confused with
-// LDVertex, which is a vertex used in an LDraw part file.
-// =============================================================================
+//!
+//! \brief A vertex in 3D space
+//!
+//! Contains a single point in 3D space. Not to be confused with
+//! LDVertex, which is a vertex used in an LDraw part file.
+//!
+//! This also sees use as a position vector.
+//!
 class Vertex
 {
 	public:
-		Vertex() {}
+		//! Constructs a zero vertex
+		Vertex() : m_coords({0, 0, 0}) {}
+
+		//! Constructs a vertex with the given \c x, \c y and \c z.
 		Vertex (double x, double y, double z);
 
+		//! \returns the distance from this vertex to \c other
 		double			distanceTo (const Vertex& other) const;
+
+		//! \returns the vertex at the midpoint between this and \c other
 		Vertex			midpoint (const Vertex& other);
+
+		//! Moves this vertex using \param other as a position vector.
 		void			move (const Vertex& other);
+
+		//! Yields a string representation of the vertex. The string returned
+		//! can possibly be mangled.
+		//! - As mangled: {1.5, 2.8, 3.14}
+		//! - Without mangling: 1.5 2.8 3.14
+		//!
+		//! The mangled version is suitable for printing to the user, the
+		//! non-mangled one is used when writing the vertex to LDraw files.
+		//!
+		//! \returns a string representation of this vertex
+		//! \param mangled whether to return a mangled representation or not
 		QString			toString (bool mangled) const;
+
+		//! Transforms this vertex with \c matr as transformation matrix
+		//! and \c pos as the position column of the 4x4 matrix.
 		void			transform (const Matrix& matr, const Vertex& pos);
 
+		//! An operator overload for \c move().
 		Vertex&			operator+= (const Vertex& other);
+
+		//! An operator overload for \c move(), using a temporary vertex.
 		Vertex			operator+ (const Vertex& other) const;
+
+		//! Divides all values by \c d.
 		Vertex			operator/ (const double d) const;
+
+		//! Divides all values by \c d.
 		Vertex&			operator/= (const double d);
+
+		//! Checks whether this vertex has the same values as \c other.
 		bool			operator== (const Vertex& other) const;
+
+		//! Checks whether this vertex has different values than \c other.
 		bool			operator!= (const Vertex& other) const;
+
+		//! \returns a negated version the vertex
 		Vertex			operator-() const;
+
+		//! \returns whether the vertex has lesser values than \c other.
 		int				operator< (const Vertex& other) const;
 
+		//! An operator overload for \c getCoordinate().
 		inline double& operator[] (const Axis ax)
 		{
 			return getCoordinate ((int) ax);
 		}
 
+		//! An operator overload for \c getCoordinate() const.
 		inline const double& operator[] (const Axis ax) const
 		{
 			return getCoordinate ((int) ax);
 		}
 
+		//! An operator overload for \c getCoordinate().
 		inline double& operator[] (const int ax)
 		{
 			return getCoordinate (ax);
 		}
 
+		//! An operator overload for \c getCoordinate() const.
 		inline const double& operator[] (const int ax) const
 		{
 			return getCoordinate (ax);
 		}
 
+		//! \returns a mutable reference for the coordinate designated by \param n.
 		inline double& getCoordinate (int n)
 		{
 			return m_coords[n];
 		}
 
+		//! An overload of \c getCoordinate for const vertices.
+		//! \returns a const reference for the coordinate designated by \param n.
 		inline const double& getCoordinate (int n) const
 		{
 			return m_coords[n];
 		}
 
+		//! \returns a mutable reference to X.
 		inline double& x()
 		{
 			return m_coords[X];
 		}
 
+		//! An overload of \c x() for const vertices.
+		//! \returns a const reference to X.
 		inline const double& x() const
 		{
 			return m_coords[X];
 		}
 
+		//! \returns a mutable reference to Y.
 		inline double& y()
 		{
 			return m_coords[Y];
 		}
 
+		//! An overload of \c y() for const vertices.
+		//! \returns a const reference to Y.
 		inline const double& y() const
 		{
 			return m_coords[Y];
 		}
 
+		//! \returns a mutable reference to Z.
 		inline double& z()
 		{
 			return m_coords[Z];
 		}
 
+		//! An overload of \c z() for const vertices.
+		//! \returns a const reference to Z.
 		inline const double& z() const
 		{
 			return m_coords[Z];
@@ -205,122 +286,49 @@
 
 Q_DECLARE_METATYPE (Vertex)
 
-// =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-// StringFormatArg
+//!
+//! Defines a bounding box that encompasses a given set of objects.
+//! vertex0 is the minimum vertex, vertex1 is the maximum vertex.
 //
-// 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
-{
-	public:
-		StringFormatArg (const QString& a) : m_val (a) {}
-		StringFormatArg (const char& a) : m_val (a) {}
-		StringFormatArg (const uchar& a) : m_val (a) {}
-		StringFormatArg (const QChar& a) : m_val (a) {}
-		StringFormatArg (int a) : m_val (QString::number (a)) {}
-		StringFormatArg (const float& a) : m_val (QString::number (a)) {}
-		StringFormatArg (const double& a) : m_val (QString::number (a)) {}
-		StringFormatArg (const Vertex& a) : m_val (a.toString (false)) {}
-		StringFormatArg (const Matrix& a) : m_val (a.toString()) {}
-		StringFormatArg (const char* a) : m_val (a) {}
-
-		StringFormatArg (const void* a)
-		{
-			m_val.sprintf ("%p", a);
-		}
-
-		template<class T, class R> void initFromList (const T& a)
-		{
-			m_val = "{ ";
-
-			for (const R& it : a)
-			{
-				if (&it != &a.first())
-					m_val += ", ";
-
-				StringFormatArg arg (it);
-				m_val += arg.value();
-			}
-
-			if (!a.isEmpty())
-				m_val += " ";
-
-			m_val += "}";
-		}
-
-		template<class T> StringFormatArg (const QList<T>& a)
-		{
-			initFromList<QList<T>, T> (a);
-		}
-
-		template<class T> StringFormatArg (const QVector<T>& a)
-		{
-			initFromList<QVector<T>, T> (a);
-		}
-
-		inline QString value() const
-		{
-			return m_val;
-		}
-
-	private:
-		QString m_val;
-};
-
-// =============================================================================
-// LDBoundingBox
-//
-// The bounding box is the box that encompasses a given set of objects.
-// v0 is the minimum vertex, v1 is the maximum vertex.
-// =============================================================================
 class LDBoundingBox
 {
-	PROPERTY (private,	bool,		Empty,		BOOL_OPS,	STOCK_WRITE)
-	PROPERTY (private,	Vertex,		Vertex0,	NO_OPS,		STOCK_WRITE)
-	PROPERTY (private,	Vertex,		Vertex1,	NO_OPS,		STOCK_WRITE)
+	PROPERTY (private,	bool,		isEmpty,	setEmpty,		STOCK_WRITE)
+	PROPERTY (private,	Vertex,		vertex0,	setVertex0,		STOCK_WRITE)
+	PROPERTY (private,	Vertex,		vertex1,	setVertex1,		STOCK_WRITE)
 
 	public:
+		//! Constructs an empty bounding box.
 		LDBoundingBox();
+
+		//! Clears the bounding box
 		void reset();
-		void calculate();
-		double size() const;
+
+		//! Calculates the bounding box's values from the objects in the current
+		//! document.
+		void calculateFromCurrentDocument();
+
+		//! \returns the length of the bounding box on the longest measure.
+		double longestMeasurement() const;
+
+		//! Calculates the given \c obj to the bounding box, adjusting
+		//! extremas if necessary.
 		void calcObject (LDObject* obj);
-		void calcVertex (const Vertex& v);
+
+		//! Calculates the given \c vertex to the bounding box, adjusting
+		//! extremas if necessary.
+		void calcVertex (const Vertex& vertex);
+
+		//! \returns the center of the bounding box.
 		Vertex center() const;
 
+		//! An operator overload for \c calcObject()
 		LDBoundingBox& operator<< (LDObject* obj);
+
+		//! An operator overload for \c calcVertex()
 		LDBoundingBox& operator<< (const Vertex& v);
 };
 
-// Formatter function
-QString DoFormat (QList<StringFormatArg> args);
-
-// printf replacement
-void doPrint (QFile& f, QList<StringFormatArg> args);
-void doPrint (FILE* fp, QList<StringFormatArg> args);
-
-// 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);
-
-// Macros to access these functions
-# ifndef IN_IDE_PARSER 
-#define fmt(...) DoFormat ({__VA_ARGS__})
-# define fprint(F, ...) doPrint (F, {__VA_ARGS__})
-# define log(...) DoLog({ __VA_ARGS__ })
-#else
-QString fmt (const char* fmtstr, ...);
-void fprint (QFile& f, const char* fmtstr, ...);
-void fprint (FILE* fp, const char* fmtstr, ...);
-void log (const char* fmtstr, ...);
-#endif
-
 extern const Vertex g_origin; // Vertex at (0, 0, 0)
 extern const Matrix g_identity; // Identity matrix
 
 static const double pi = 3.14159265358979323846;
-
-#endif // LDFORGE_TYPES_H
--- a/src/Version.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Version.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -24,7 +24,7 @@
 char gVersionString[64] = {'\0'};
 char gFullVersionString[256] = {'\0'};
 
-// -----------------------------------------------------------------------------
+// =============================================================================
 //
 const char* versionString()
 {
@@ -40,7 +40,7 @@
 	return gVersionString;
 }
 
-// -----------------------------------------------------------------------------
+// =============================================================================
 //
 const char* fullVersionString()
 {
--- a/src/Version.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Version.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,15 +16,33 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+//! \file Version.h
+//! Contains macros related to application name and version.
+
 #pragma once
+
+//! The application name.
 #define APPNAME			"LDForge"
+
+//! The unix-style name of the application. used in filenames
 #define UNIXNAME		"ldforge"
+
+//! The major version number.
 #define VERSION_MAJOR	0
-#define VERSION_MINOR	2
-#define VERSION_PATCH	999
+
+//! The minor version number.
+#define VERSION_MINOR	3
+
+//! The patch level version number.
+#define VERSION_PATCH	0
+
+//! The build ID, use either BUILD_INTERNAL or BUILD_RELEASE
 #define BUILD_ID		BUILD_INTERNAL
 
+//! The build code for internal builds
 #define BUILD_INTERNAL	0
+
+//! The build code for release builds.
 #define BUILD_RELEASE	1
 
 // =============================================
@@ -34,4 +52,4 @@
 
 #ifdef RELEASE
 # undef DEBUG
-#endif // RELEASE
\ No newline at end of file
+#endif // RELEASE
--- a/src/Widgets.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Widgets.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -29,28 +29,28 @@
 #include "Widgets.h"
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 RadioGroup::RadioGroup (const QString& title, QWidget* parent) : QGroupBox (title, parent)
 {
 	init (Qt::Vertical);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QBoxLayout::Direction makeDirection (Qt::Orientation orient, bool invert = false)
 {
 	return (orient == (invert ? Qt::Vertical : Qt::Horizontal)) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 bool RadioGroup::isChecked (int n) const
 {
 	return m_buttonGroup->checkedId() == n;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void RadioGroup::init (Qt::Orientation orient)
 {
 	m_vert = orient == Qt::Vertical;
@@ -70,8 +70,8 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
-RadioGroup::RadioGroup (const QString& title, initlist<char const*> entries, int const defaultId, const Qt::Orientation orient, QWidget* parent) :
+//
+RadioGroup::RadioGroup (const QString& title, QList<char const*> entries, int const defaultId, const Qt::Orientation orient, QWidget* parent) :
 		QGroupBox (title, parent),
 		m_defId (defaultId)
 {
@@ -83,7 +83,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void RadioGroup::rowBreak()
 {
 	QBoxLayout* newLayout = new QBoxLayout (m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
@@ -94,7 +94,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void RadioGroup::addButton (const char* entry)
 {
 	QRadioButton* button = new QRadioButton (entry);
@@ -102,7 +102,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void RadioGroup::addButton (QRadioButton* button)
 {
 	bool const selectThis = (m_curId == m_defId);
@@ -116,7 +116,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 RadioGroup& RadioGroup::operator<< (QRadioButton* button)
 {
 	addButton (button);
@@ -124,7 +124,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 RadioGroup& RadioGroup::operator<< (const char* entry)
 {
 	addButton (entry);
@@ -132,35 +132,35 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void RadioGroup::setCurrentRow (int row)
 {
 	m_currentLayout = m_layouts[row];
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 int RadioGroup::value() const
 {
 	return m_buttonGroup->checkedId();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void RadioGroup::setValue (int val)
 {
 	m_buttonGroup->button (val)->setChecked (true);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 QRadioButton* RadioGroup::operator[] (int n) const
 {
 	return m_objects[n];
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void RadioGroup::slot_buttonPressed (int btn)
 {
 	emit buttonPressed (btn);
@@ -169,7 +169,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void RadioGroup::slot_buttonReleased (int btn)
 {
 	emit buttonReleased (btn);
@@ -180,14 +180,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 RadioGroup::Iterator RadioGroup::begin()
 {
 	return m_objects.begin();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 RadioGroup::Iterator RadioGroup::end()
 {
 	return m_objects.end();
--- a/src/Widgets.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/Widgets.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef WIDGETS_H
-#define WIDGETS_H
-
+#pragma once
 #include <QGroupBox>
 #include <QSpinBox>
 #include <map>
@@ -54,7 +52,7 @@
 		}
 
 		explicit RadioGroup (const QString& title, QWidget* parent = null);
-		explicit RadioGroup (const QString& title, initlist<char const*> entries, int const defaultId,
+		explicit RadioGroup (const QString& title, QList<char const*> entries, int const defaultId,
 			const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null);
 
 		void            addButton	(const char* entry);
@@ -92,5 +90,3 @@
 		void slot_buttonPressed (int btn);
 		void slot_buttonReleased (int btn);
 };
-
-#endif // WIDGETS_H
--- a/src/actions/EditActions.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/actions/EditActions.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -1,5 +1,5 @@
 /*
- *  LDForge: LDraw parts authoring CAD
+ *  LDForge: LDasText parts authoring CAD
  *  Copyright (C) 2013, 2014 Santeri Piippo
  *
  *  This program is free software: you can redistribute it and/or modify
@@ -38,7 +38,7 @@
 extern_cfg (String, ld_defaultuser);
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static int copyToClipboard()
 {
 	LDObjectList objs = selection();
@@ -55,7 +55,7 @@
 		if (data.length() > 0)
 			data += "\n";
 
-		data += obj->raw();
+		data += obj->asText();
 		++num;
 	}
 
@@ -64,24 +64,24 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Cut, CTRL (X))
 {
 	int num = copyToClipboard();
 	deleteSelection();
-	log (tr ("%1 objects cut"), num);
+	print (tr ("%1 objects cut"), num);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Copy, CTRL (C))
 {
 	int num = copyToClipboard();
-	log (tr ("%1 objects copied"), num);
+	print (tr ("%1 objects copied"), num);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Paste, CTRL (V))
 {
 	const QString clipboardText = qApp->clipboard()->text();
@@ -98,21 +98,21 @@
 		++num;
 	}
 
-	log (tr ("%1 objects pasted"), num);
+	print (tr ("%1 objects pasted"), num);
 	refresh();
 	scrollToSelection();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Delete, KEY (Delete))
 {
 	int num = deleteSelection();
-	log (tr ("%1 objects deleted"), num);
+	print (tr ("%1 objects deleted"), num);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void doInline (bool deep)
 {
 	LDObjectList sel = selection();
@@ -121,18 +121,18 @@
 	{
 		// Get the index of the subfile so we know where to insert the
 		// inlined contents.
-		long idx = obj->getIndex();
+		long idx = obj->lineNumber();
 
-		if (idx == -1 || obj->getType() != LDObject::ESubfile)
+		if (idx == -1 || obj->type() != LDObject::ESubfile)
 			continue;
 
 		LDObjectList objs = static_cast<LDSubfile*> (obj)->inlineContents (deep, false);
 
 		// Merge in the inlined objects
-		for (LDObject * inlineobj : objs)
+		for (LDObject* inlineobj : objs)
 		{
-			QString line = inlineobj->raw();
-			inlineobj->deleteSelf();
+			QString line = inlineobj->asText();
+			inlineobj->destroy();
 			LDObject* newobj = parseLine (line);
 			getCurrentDocument()->insertObj (idx++, newobj);
 			newobj->select();
@@ -140,7 +140,7 @@
 		}
 
 		// Delete the subfile now as it's been inlined.
-		obj->deleteSelf();
+		obj->destroy();
 	}
 
 	g_win->refresh();
@@ -157,7 +157,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SplitQuads, 0)
 {
 	LDObjectList objs = selection();
@@ -165,11 +165,11 @@
 
 	for (LDObject* obj : objs)
 	{
-		if (obj->getType() != LDObject::EQuad)
+		if (obj->type() != LDObject::EQuad)
 			continue;
 
 		// Find the index of this quad
-		long index = obj->getIndex();
+		long index = obj->lineNumber();
 
 		if (index == -1)
 			return;
@@ -185,17 +185,17 @@
 			R()->compileObject (t);
 
 		// Delete this quad now, it has been split.
-		obj->deleteSelf();
+		obj->destroy();
 
 		num++;
 	}
 
-	log ("%1 quadrilaterals split", num);
+	print ("%1 quadrilaterals split", num);
 	refresh();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (EditRaw, KEY (F9))
 {
 	if (selection().size() != 1)
@@ -206,10 +206,10 @@
 	Ui::EditRawUI ui;
 
 	ui.setupUi (dlg);
-	ui.code->setText (obj->raw());
+	ui.code->setText (obj->asText());
 
-	if (obj->getType() == LDObject::EError)
-		ui.errorDescription->setText (static_cast<LDError*> (obj)->reason);
+	if (obj->type() == LDObject::EError)
+		ui.errorDescription->setText (static_cast<LDError*> (obj)->reason());
 	else
 	{
 		ui.errorDescription->hide();
@@ -231,7 +231,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SetColor, KEY (C))
 {
 	if (selection().isEmpty())
@@ -263,7 +263,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Borders, CTRL_SHIFT (B))
 {
 	LDObjectList objs = selection();
@@ -271,7 +271,7 @@
 
 	for (LDObject* obj : objs)
 	{
-		const LDObject::Type type = obj->getType();
+		const LDObject::Type type = obj->type();
 		if (type != LDObject::EQuad && type != LDObject::ETriangle)
 			continue;
 
@@ -283,24 +283,24 @@
 			numLines = 4;
 
 			LDQuad* quad = static_cast<LDQuad*> (obj);
-			lines[0] = new LDLine (quad->getVertex (0), quad->getVertex (1));
-			lines[1] = new LDLine (quad->getVertex (1), quad->getVertex (2));
-			lines[2] = new LDLine (quad->getVertex (2), quad->getVertex (3));
-			lines[3] = new LDLine (quad->getVertex (3), quad->getVertex (0));
+			lines[0] = new LDLine (quad->vertex (0), quad->vertex (1));
+			lines[1] = new LDLine (quad->vertex (1), quad->vertex (2));
+			lines[2] = new LDLine (quad->vertex (2), quad->vertex (3));
+			lines[3] = new LDLine (quad->vertex (3), quad->vertex (0));
 		}
 		else
 		{
 			numLines = 3;
 
 			LDTriangle* tri = static_cast<LDTriangle*> (obj);
-			lines[0] = new LDLine (tri->getVertex (0), tri->getVertex (1));
-			lines[1] = new LDLine (tri->getVertex (1), tri->getVertex (2));
-			lines[2] = new LDLine (tri->getVertex (2), tri->getVertex (0));
+			lines[0] = new LDLine (tri->vertex (0), tri->vertex (1));
+			lines[1] = new LDLine (tri->vertex (1), tri->vertex (2));
+			lines[2] = new LDLine (tri->vertex (2), tri->vertex (0));
 		}
 
 		for (int i = 0; i < numLines; ++i)
 		{
-			long idx = obj->getIndex() + i + 1;
+			long idx = obj->lineNumber() + i + 1;
 
 			lines[i]->setColor (edgecolor);
 			getCurrentDocument()->insertObj (idx, lines[i]);
@@ -310,12 +310,12 @@
 		num += numLines;
 	}
 
-	log (tr ("Added %1 border lines"), num);
+	print (tr ("Added %1 border lines"), num);
 	refresh();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (CornerVerts, 0)
 {
 	int num = 0;
@@ -325,26 +325,26 @@
 		if (obj->vertices() < 2)
 			continue;
 
-		int idx = obj->getIndex();
+		int ln = obj->lineNumber();
 
 		for (int i = 0; i < obj->vertices(); ++i)
 		{
 			LDVertex* vert = new LDVertex;
-			vert->pos = obj->getVertex (i);
-			vert->setColor (obj->getColor());
+			vert->pos = obj->vertex (i);
+			vert->setColor (obj->color());
 
-			getCurrentDocument()->insertObj (++idx, vert);
+			getCurrentDocument()->insertObj (++ln, vert);
 			R()->compileObject (vert);
 			++num;
 		}
 	}
 
-	log (tr ("Added %1 vertices"), num);
+	print (tr ("Added %1 vertices"), num);
 	refresh();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void doMoveSelection (const bool up)
 {
 	LDObjectList objs = selection();
@@ -353,7 +353,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (MoveUp, KEY (PageUp))
 {
 	doMoveSelection (true);
@@ -365,7 +365,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Undo, CTRL (Z))
 {
 	getCurrentDocument()->undo();
@@ -377,7 +377,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void doMoveObjects (Vertex vect)
 {
 	// Apply the grid values
@@ -397,7 +397,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (MoveXNeg, KEY (Left))
 {
 	doMoveObjects ({ -1, 0, 0});
@@ -429,7 +429,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Invert, CTRL_SHIFT (W))
 {
 	LDObjectList sel = selection();
@@ -444,7 +444,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void rotateVertex (Vertex& v, const Vertex& rotpoint, const Matrix& transform)
 {
 	v.move (-rotpoint);
@@ -453,7 +453,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static void doRotate (const int l, const int m, const int n)
 {
 	LDObjectList sel = selection();
@@ -486,7 +486,7 @@
 		{
 			for (int i = 0; i < obj->vertices(); ++i)
 			{
-				Vertex v = obj->getVertex (i);
+				Vertex v = obj->vertex (i);
 				rotateVertex (v, rotpoint, transform);
 				obj->setVertex (i, v);
 			}
@@ -496,14 +496,14 @@
 			LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
 
 			// Transform the position
-			Vertex v = mo->getPosition();
+			Vertex v = mo->position();
 			rotateVertex (v, rotpoint, transform);
 			mo->setPosition (v);
 
 			// Transform the matrix
-			mo->setTransform (transform * mo->getTransform());
+			mo->setTransform (transform * mo->transform());
 		}
-		elif (obj->getType() == LDObject::EVertex)
+		elif (obj->type() == LDObject::EVertex)
 		{
 			LDVertex* vert = static_cast<LDVertex*> (obj);
 			Vertex v = vert->pos;
@@ -518,7 +518,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (RotateXPos, CTRL (Right))
 {
 	doRotate (1, 0, 0);
@@ -550,7 +550,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (RoundCoordinates, 0)
 {
 	setlocale (LC_ALL, "C");
@@ -562,8 +562,8 @@
 
 		if (mo != null)
 		{
-			Vertex v = mo->getPosition();
-			Matrix t = mo->getTransform();
+			Vertex v = mo->position();
+			Matrix t = mo->transform();
 
 			for_axes (ax)
 				roundToDecimals (v[ax], 3);
@@ -581,7 +581,7 @@
 		{
 			for (int i = 0; i < obj->vertices(); ++i)
 			{
-				Vertex v = obj->getVertex (i);
+				Vertex v = obj->vertex (i);
 
 				for_axes (ax)
 					roundToDecimals (v[ax], 3);
@@ -593,13 +593,13 @@
 		}
 	}
 
-	log (tr ("Rounded %1 values"), num);
+	print (tr ("Rounded %1 values"), num);
 	refreshObjectList();
 	refresh();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Uncolorize, 0)
 {
 	int num = 0;
@@ -611,7 +611,7 @@
 
 		int col = maincolor;
 
-		if (obj->getType() == LDObject::ELine || obj->getType() == LDObject::ECondLine)
+		if (obj->type() == LDObject::ELine || obj->type() == LDObject::ECondLine)
 			col = edgecolor;
 
 		obj->setColor (col);
@@ -619,12 +619,12 @@
 		num++;
 	}
 
-	log (tr ("%1 objects uncolored"), num);
+	print (tr ("%1 objects uncolored"), num);
 	refresh();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (ReplaceCoords, CTRL (R))
 {
 	QDialog* dlg = new QDialog (g_win);
@@ -650,7 +650,7 @@
 	{
 		for (int i = 0; i < obj->vertices(); ++i)
 		{
-			Vertex v = obj->getVertex (i);
+			Vertex v = obj->vertex (i);
 
 			for (Axis ax : sel)
 			{
@@ -671,12 +671,12 @@
 		}
 	}
 
-	log (tr ("Altered %1 values"), num);
+	print (tr ("Altered %1 values"), num);
 	refresh();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Flip, CTRL_SHIFT (F))
 {
 	QDialog* dlg = new QDialog;
@@ -696,7 +696,7 @@
 	{
 		for (int i = 0; i < obj->vertices(); ++i)
 		{
-			Vertex v = obj->getVertex (i);
+			Vertex v = obj->vertex (i);
 
 			for (Axis ax : sel)
 				v[ax] *= -1;
@@ -710,7 +710,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Demote, 0)
 {
 	LDObjectList sel = selection();
@@ -718,7 +718,7 @@
 
 	for (LDObject* obj : sel)
 	{
-		if (obj->getType() != LDObject::ECondLine)
+		if (obj->type() != LDObject::ECondLine)
 			continue;
 
 		LDLine* repl = static_cast<LDCondLine*> (obj)->demote();
@@ -726,23 +726,23 @@
 		++num;
 	}
 
-	log (tr ("Demoted %1 conditional lines"), num);
+	print (tr ("Demoted %1 conditional lines"), num);
 	refresh();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 static bool isColorUsed (int colnum)
 {
-	for (LDObject* obj : getCurrentDocument()->getObjects())
-		if (obj->isColored() && obj->getColor() == colnum)
+	for (LDObject* obj : getCurrentDocument()->objects())
+		if (obj->isColored() && obj->color() == colnum)
 			return true;
 
 	return false;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Autocolor, 0)
 {
 	int colnum = 0;
@@ -752,7 +752,7 @@
 
 	if (colnum >= MAX_COLORS)
 	{
-		log (tr ("Cannot auto-color: all colors are in use!"));
+		print (tr ("Cannot auto-color: all colors are in use!"));
 		return;
 	}
 
@@ -765,12 +765,12 @@
 		R()->compileObject (obj);
 	}
 
-	log (tr ("Auto-colored: new color is [%1] %2"), colnum, getColor (colnum)->name);
+	print (tr ("Auto-colored: new color is [%1] %2"), colnum, getColor (colnum)->name);
 	refresh();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (AddHistoryLine, 0)
 {
 	LDObject* obj;
@@ -788,7 +788,7 @@
 		return;
 
 	// Create the comment object based on input
-	QString commentText = fmt ("!HISTORY %1 [%2] %3",
+	QString commentText = format ("!HISTORY %1 [%2] %3",
 		ui->m_date->date().toString ("yyyy-MM-dd"),
 		ui->m_username->text(),
 		ui->m_comment->text());
@@ -804,7 +804,7 @@
 	{
 		LDComment* comm = dynamic_cast<LDComment*> (obj);
 
-		if (comm && comm->text.startsWith ("!HISTORY "))
+		if (comm != null && comm->text().startsWith ("!HISTORY "))
 			ishistory = true;
 
 		if (prevIsHistory && !ishistory)
@@ -817,7 +817,7 @@
 		prevIsHistory = ishistory;
 	}
 
-	int idx = obj ? obj->getIndex() : 0;
+	int idx = obj ? obj->lineNumber() : 0;
 	getCurrentDocument()->insertObj (idx++, comm);
 
 	// If we're adding a history line right before a scemantic object, pad it
--- a/src/actions/MainActions.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/actions/MainActions.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -45,7 +45,7 @@
 extern_cfg (Bool,		gl_drawangles);
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (New, CTRL_SHIFT (N))
 {
 	QDialog* dlg = new QDialog (g_win);
@@ -55,7 +55,7 @@
 	QString authortext = ld_defaultname;
 
 	if (!ld_defaultuser.isEmpty())
-		authortext.append (fmt (" [%1]", ld_defaultuser));
+		authortext.append (format (" [%1]", ld_defaultuser));
 
 	ui.le_author->setText (authortext);
 
@@ -75,7 +75,7 @@
 
 		default:
 			QMessageBox::warning (null, "Warning",
-				fmt ("Unknown ld_defaultlicense value %1!", ld_defaultlicense));
+				format ("Unknown ld_defaultlicense value %1!", ld_defaultlicense));
 			break;
 	}
 
@@ -84,20 +84,20 @@
 
 	newFile();
 
-	const LDBFC::Type BFCType =
+	const LDBFC::Statement BFCType =
 		ui.rb_bfc_ccw->isChecked() ? LDBFC::CertifyCCW :
 		ui.rb_bfc_cw->isChecked()  ? LDBFC::CertifyCW : LDBFC::NoCertify;
 
 	const QString license =
-		ui.rb_license_ca->isChecked()    ? CALicense :
-		ui.rb_license_nonca->isChecked() ? NonCALicense : "";
+		ui.rb_license_ca->isChecked()    ? g_CALicense :
+		ui.rb_license_nonca->isChecked() ? g_nonCALicense : "";
 
 	getCurrentDocument()->addObjects (
 	{
 		new LDComment (ui.le_title->text()),
 		new LDComment ("Name: <untitled>.dat"),
-		new LDComment (fmt ("Author: %1", ui.le_author->text())),
-		new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")),
+		new LDComment (format ("Author: %1", ui.le_author->text())),
+		new LDComment (format ("!LDRAW_ORG Unofficial_Part")),
 		(license != "" ? new LDComment (license) : null),
 		new LDEmpty,
 		new LDBFC (BFCType),
@@ -108,14 +108,14 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (NewFile, CTRL (N))
 {
 	newFile();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Open, CTRL (O))
 {
 	QString name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)");
@@ -127,21 +127,21 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Save, CTRL (S))
 {
 	save (getCurrentDocument(), false);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SaveAs, CTRL_SHIFT (S))
 {
 	save (getCurrentDocument(), true);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SaveAll, CTRL (L))
 {
 	for (LDDocument* file : g_loadedFiles)
@@ -154,7 +154,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Close, CTRL (W))
 {
 	if (!getCurrentDocument()->isSafeToClose())
@@ -164,7 +164,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (CloseAll, 0)
 {
 	if (!safeToCloseAll())
@@ -174,125 +174,125 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Settings, 0)
 {
 	(new ConfigDialog)->exec();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SetLDrawPath, 0)
 {
 	(new LDrawPathDialog (true))->exec();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Exit, CTRL (Q))
 {
 	exit (0);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (NewSubfile, 0)
 {
 	AddObjectDialog::staticDialog (LDObject::ESubfile, null);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (NewLine, 0)
 {
 	AddObjectDialog::staticDialog (LDObject::ELine, null);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (NewTriangle, 0)
 {
 	AddObjectDialog::staticDialog (LDObject::ETriangle, null);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (NewQuad, 0)
 {
 	AddObjectDialog::staticDialog (LDObject::EQuad, null);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (NewCLine, 0)
 {
 	AddObjectDialog::staticDialog (LDObject::ECondLine, null);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (NewComment, 0)
 {
 	AddObjectDialog::staticDialog (LDObject::EComment, null);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (NewBFC, 0)
 {
 	AddObjectDialog::staticDialog (LDObject::EBFC, null);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (NewVertex, 0)
 {
 	AddObjectDialog::staticDialog (LDObject::EVertex, null);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Edit, 0)
 {
 	if (selection().size() != 1)
 		return;
 
 	LDObject* obj = selection() [0];
-	AddObjectDialog::staticDialog (obj->getType(), obj);
+	AddObjectDialog::staticDialog (obj->type(), obj);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Help, KEY (F1))
 {
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (About, 0)
 {
 	AboutDialog().exec();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (AboutQt, 0)
 {
 	QMessageBox::aboutQt (g_win);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SelectAll, CTRL (A))
 {
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 		obj->select();
 
 	updateSelection();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SelectByColor, CTRL_SHIFT (A))
 {
 	int colnum = getSelectedColor();
@@ -302,15 +302,15 @@
 
 	getCurrentDocument()->clearSelection();
 
-	for (LDObject* obj : getCurrentDocument()->getObjects())
-		if (obj->getColor() == colnum)
+	for (LDObject* obj : getCurrentDocument()->objects())
+		if (obj->color() == colnum)
 			obj->select();
 
 	updateSelection();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SelectByType, 0)
 {
 	if (selection().isEmpty())
@@ -327,21 +327,21 @@
 
 	if (type == LDObject::ESubfile)
 	{
-		refName = static_cast<LDSubfile*> (selection()[0])->getFileInfo()->getName();
+		refName = static_cast<LDSubfile*> (selection()[0])->fileInfo()->name();
 
 		for (LDObject* obj : selection())
-			if (static_cast<LDSubfile*> (obj)->getFileInfo()->getName() != refName)
+			if (static_cast<LDSubfile*> (obj)->fileInfo()->name() != refName)
 				return;
 	}
 
 	getCurrentDocument()->clearSelection();
 
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 	{
-		if (obj->getType() != type)
+		if (obj->type() != type)
 			continue;
 
-		if (type == LDObject::ESubfile && static_cast<LDSubfile*> (obj)->getFileInfo()->getName() != refName)
+		if (type == LDObject::ESubfile && static_cast<LDSubfile*> (obj)->fileInfo()->name() != refName)
 			continue;
 
 		obj->select();
@@ -351,7 +351,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (GridCoarse, 0)
 {
 	grid = Grid::Coarse;
@@ -371,7 +371,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (ResetView, CTRL (0))
 {
 	R()->resetAngles();
@@ -379,7 +379,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (InsertFrom, 0)
 {
 	QString fname = QFileDialog::getOpenFileName();
@@ -392,7 +392,7 @@
 
 	if (!f.open (QIODevice::ReadOnly))
 	{
-		critical (fmt ("Couldn't open %1 (%2)", fname, f.errorString()));
+		critical (format ("Couldn't open %1 (%2)", fname, f.errorString()));
 		return;
 	}
 
@@ -414,7 +414,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (ExportTo, 0)
 {
 	if (selection().isEmpty())
@@ -429,13 +429,13 @@
 
 	if (!file.open (QIODevice::WriteOnly | QIODevice::Text))
 	{
-		critical (fmt ("Unable to open %1 for writing (%2)", fname, file.errorString()));
+		critical (format ("Unable to open %1 for writing (%2)", fname, file.errorString()));
 		return;
 	}
 
 	for (LDObject* obj : selection())
 	{
-		QString contents = obj->raw();
+		QString contents = obj->asText();
 		QByteArray data = contents.toUtf8();
 		file.write (data, data.size());
 		file.write ("\r\n", 2);
@@ -443,7 +443,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (InsertRaw, 0)
 {
 	int idx = getInsertionPoint();
@@ -480,7 +480,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Screenshot, 0)
 {
 	setlocale (LC_ALL, "C");
@@ -489,23 +489,23 @@
 	uchar* imgdata = R()->getScreencap (w, h);
 	QImage img = imageFromScreencap (imgdata, w, h);
 
-	QString root = basename (getCurrentDocument()->getName());
+	QString root = basename (getCurrentDocument()->name());
 
 	if (root.right (4) == ".dat")
 		root.chop (4);
 
-	QString defaultname = (root.length() > 0) ? fmt ("%1.png", root) : "";
+	QString defaultname = (root.length() > 0) ? format ("%1.png", root) : "";
 	QString fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname,
 				"PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)");
 
 	if (fname.length() > 0 && !img.save (fname))
-		critical (fmt ("Couldn't open %1 for writing to save screencap: %2", fname, strerror (errno)));
+		critical (format ("Couldn't open %1 for writing to save screencap: %2", fname, strerror (errno)));
 
 	delete[] imgdata;
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 extern_cfg (Bool, gl_axes);
 DEFINE_ACTION (Axes, 0)
 {
@@ -515,17 +515,17 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (VisibilityToggle, 0)
 {
 	for (LDObject* obj : selection())
-		obj->toggleHidden();
+		obj->setHidden (!obj->isHidden());
 
 	refresh();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (VisibilityHide, 0)
 {
 	for (LDObject* obj : selection())
@@ -535,7 +535,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (VisibilityReveal, 0)
 {
 	for (LDObject* obj : selection())
@@ -544,7 +544,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (Wireframe, 0)
 {
 	gl_wireframe = !gl_wireframe;
@@ -552,7 +552,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SetOverlay,  0)
 {
 	OverlayDialog dlg;
@@ -565,35 +565,35 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (ClearOverlay, 0)
 {
 	R()->clearOverlay();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (ModeSelect, CTRL (1))
 {
 	R()->setEditMode (ESelectMode);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (ModeDraw, CTRL (2))
 {
 	R()->setEditMode (EDrawMode);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (ModeCircle, CTRL (3))
 {
 	R()->setEditMode (ECircleMode);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (DrawAngles, 0)
 {
 	gl_drawangles = !gl_drawangles;
@@ -601,7 +601,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SetDrawDepth, 0)
 {
 	if (R()->camera() == GL::EFreeCamera)
@@ -609,7 +609,7 @@
 
 	bool ok;
 	double depth = QInputDialog::getDouble (g_win, "Set Draw Depth",
-											fmt ("Depth value for %1 Camera:", R()->getCameraName()),
+											format ("Depth value for %1 Camera:", R()->getCameraName()),
 											R()->getDepthValue(), -10000.0f, 10000.0f, 3, &ok);
 
 	if (ok)
@@ -666,14 +666,14 @@
 #endif
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (ScanPrimitives, 0)
 {
 	PrimitiveScanner::start();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (BFCView, SHIFT (B))
 {
 	gl_colorbfc = !gl_colorbfc;
@@ -682,7 +682,7 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (JumpTo, CTRL (G))
 {
 	bool ok;
@@ -690,7 +690,7 @@
 	LDObject* obj;
 
 	if (selection().size() == 1)
-		defval = selection()[0]->getIndex();
+		defval = selection()[0]->lineNumber();
 
 	int idx = QInputDialog::getInt (null, "Go to line", "Go to line:", defval,
 		1, getCurrentDocument()->getObjectCount(), 1, &ok);
@@ -704,16 +704,16 @@
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 DEFINE_ACTION (SubfileSelection, 0)
 {
 	if (selection().size() == 0)
 		return;
 
-	QString			parentpath = getCurrentDocument()->getFullPath();
+	QString			parentpath = getCurrentDocument()->fullPath();
 
 	// BFC type of the new subfile - it shall inherit the BFC type of the parent document
-	LDBFC::Type		bfctype = LDBFC::NoCertify;
+	LDBFC::Statement		bfctype = LDBFC::NoCertify;
 
 	// Dirname of the new subfile
 	QString			subdirname = dirname (parentpath);
@@ -734,11 +734,11 @@
 	QString			fullsubname;
 
 	// Where to insert the subfile reference?
-	int				refidx = selection()[0]->getIndex();
+	int				refidx = selection()[0]->lineNumber();
 
 	// Determine title of subfile
 	if (titleobj != null)
-		subtitle = "~" + titleobj->text;
+		subtitle = "~" + titleobj->text();
 	else
 		subtitle = "~subfile";
 
@@ -748,13 +748,13 @@
 
 	// If this the parent document isn't already in s/, we need to stuff it into
 	// a subdirectory named s/. Ensure it exists!
-	QString topdirname = basename (dirname (getCurrentDocument()->getFullPath()));
+	QString topdirname = basename (dirname (getCurrentDocument()->fullPath()));
 
 	if (topdirname != "s")
 	{
 		QString desiredPath = subdirname + "/s";
 		QString title = tr ("Create subfile directory?");
-		QString text = fmt (tr ("The directory <b>%1</b> is suggested for "
+		QString text = format (tr ("The directory <b>%1</b> is suggested for "
 			"subfiles. This directory does not exist, create it?"), desiredPath);
 
 		if (QDir (desiredPath).exists() || confirm (title, text))
@@ -795,14 +795,14 @@
 
 	// Determine the BFC winding type used in the main document - it is to
 	// be carried over to the subfile.
-	for (LDObject* obj : getCurrentDocument()->getObjects())
+	for (LDObject* obj : getCurrentDocument()->objects())
 	{
 		LDBFC* bfc = dynamic_cast<LDBFC*> (obj);
 
 		if (!bfc)
 			continue;
 
-		LDBFC::Type a = bfc->type;
+		LDBFC::Statement a = bfc->statement();
 
 		if (a == LDBFC::CertifyCCW || a == LDBFC::CertifyCW || a == LDBFC::NoCertify)
 		{
@@ -813,7 +813,7 @@
 
 	// Get the body of the document in LDraw code
 	for (LDObject* obj : selection())
-		code << obj->raw();
+		code << obj->asText();
 
 	// Create the new subfile document
 	LDDocument* doc = new LDDocument;
@@ -824,8 +824,8 @@
 	{
 		new LDComment (subtitle),
 		new LDComment ("Name: "),
-		new LDComment (fmt ("Author: %1 [%2]", ld_defaultname, ld_defaultuser)),
-		new LDComment (fmt ("!LDRAW_ORG Unofficial_Subpart")),
+		new LDComment (format ("Author: %1 [%2]", ld_defaultname, ld_defaultuser)),
+		new LDComment (format ("!LDRAW_ORG Unofficial_Subpart")),
 		(license != "" ? new LDComment (license) : null),
 		new LDEmpty,
 		new LDBFC (bfctype),
@@ -844,10 +844,10 @@
 	{
 		// Remove the selection now
 		for (LDObject* obj : selection())
-			obj->deleteSelf();
+			obj->destroy();
 
 		// Compile all objects in the new subfile
-		for (LDObject* obj : doc->getObjects())
+		for (LDObject* obj : doc->objects())
 			R()->compileObject (obj);
 
 		g_loadedFiles << doc;
--- a/src/misc/DocumentPointer.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/misc/DocumentPointer.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -20,52 +20,52 @@
 #include "../Document.h"
 #include "../Misc.h"
 
-LDDocumentPointer::LDDocumentPointer()  : m_Pointer (null) {}
+LDDocumentPointer::LDDocumentPointer()  : m_pointer (null) {}
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocumentPointer::LDDocumentPointer (LDDocument* ptr) :
-	m_Pointer (ptr)
+	m_pointer (ptr)
 {
 	addReference ();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocumentPointer::LDDocumentPointer (const LDDocumentPointer& other) :
-	m_Pointer (other.getPointer())
+	m_pointer (other.pointer())
 {
 	addReference ();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocumentPointer::~LDDocumentPointer()
 {
 	removeReference();
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocumentPointer::addReference()
 {
-	if (getPointer() != null)
-		getPointer()->addReference (this);
+	if (pointer() != null)
+		pointer()->addReference (this);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 void LDDocumentPointer::removeReference()
 {
-	if (getPointer() != null)
-		getPointer()->removeReference (this);
+	if (pointer() != null)
+		pointer()->removeReference (this);
 }
 
 // =============================================================================
-// -----------------------------------------------------------------------------
+//
 LDDocumentPointer& LDDocumentPointer::operator= (LDDocument* ptr)
 {
-	if (ptr != getPointer())
+	if (ptr != pointer())
 	{
 		removeReference();
 		setPointer (ptr);
--- a/src/misc/DocumentPointer.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/misc/DocumentPointer.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,43 +16,59 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_DOCUMENT_POINTER_H
-#define LDFORGE_DOCUMENT_POINTER_H
+#pragma once
 
 #include "../Main.h"
 
 class LDSubfile;
 class LDDocument;
 
+//!
+//! \brief A reference-counting pointer to LDDocument.
+//!
+//! The LDDocumentPointer class defines a reference-counting pointer which
+//! points to LDDocument.
+//!
 class LDDocumentPointer
 {
-	PROPERTY (private, LDDocument*,			Pointer,	NO_OPS, STOCK_WRITE)
+	PROPERTY (private, LDDocument*, pointer, setPointer, STOCK_WRITE)
 
 	public:
+		//! Constructs a null LDDocumentPointer
 		LDDocumentPointer();
+
+		//! Constructs a document pointer with the given pointer
 		LDDocumentPointer (LDDocument* ptr);
+
+		//! Copy-constructs a LDDocumentPointer.
 		LDDocumentPointer (const LDDocumentPointer& other);
+
+		//! Destructs the pointer.
 		~LDDocumentPointer();
+
+		//! \param ptr the new pointer to change to.
 		LDDocumentPointer& operator= (LDDocument* ptr);
 
+		//! Copy operator.
+		//! \param other the pointer whose internal pointer to copy.
 		inline LDDocumentPointer& operator= (LDDocumentPointer& other)
 		{
-			return operator= (other.getPointer());
+			return operator= (other.pointer());
 		}
 
+		//! Operator overload for a->b support.
 		inline LDDocument* operator->() const
 		{
-			return getPointer();
+			return pointer();
 		}
 
+		//! Cast operator overload
 		inline operator LDDocument*() const
 		{
-			return getPointer();
+			return pointer();
 		}
 
 	private:
 		void addReference();
 		void removeReference();
 };
-
-#endif // LDFORGE_DOCUMENT_POINTER_H
\ No newline at end of file
--- a/src/misc/InvokationDeferer.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/misc/InvokationDeferer.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,9 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_MISC_INVOKATION_DEFERER_H
-#define LDFORGE_MISC_INVOKATION_DEFERER_H
-
+#pragma once
 #include <QObject>
 
 class InvokationDeferer : public QObject
@@ -42,5 +40,3 @@
 };
 
 void invokeLater (InvokationDeferer::FunctionType func);
-
-#endif // LDFORGE_MISC_INVOKATION_DEFERER_H
\ No newline at end of file
--- a/src/misc/RingFinder.cc	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/misc/RingFinder.cc	Sun Mar 09 14:59:46 2014 +0200
@@ -22,15 +22,6 @@
 RingFinder g_RingFinder;
 
 // =============================================================================
-// This is the main algorithm of the ring finder. It tries to use math to find
-// the one ring between r0 and r1. If it fails (the ring number is non-integral),
-// it finds an intermediate radius (ceil of the ring number times scale) and
-// splits the radius at this point, calling this function again to try find the
-// rings between r0 - r and r - r1.
-//
-// This does not always yield into usable results. If at some point r == r0 or
-// r == r1, there is no hope of finding the rings, at least with this algorithm,
-// as it would fall into an infinite recursion.
 //
 bool RingFinder::findRingsRecursor (double r0, double r1, Solution& currentSolution)
 {
@@ -133,7 +124,7 @@
 	{
 		const Solution& sol = *solp;
 
-		if (m_bestSolution == null || sol.isBetterThan (m_bestSolution))
+		if (m_bestSolution == null || sol.isSuperiorTo (m_bestSolution))
 			m_bestSolution = &sol;
 	}
 
@@ -142,7 +133,7 @@
 
 // =============================================================================
 //
-bool RingFinder::Solution::isBetterThan (const Solution* other) const
+bool RingFinder::Solution::isSuperiorTo (const Solution* other) const
 {
 	// If this solution has less components than the other one, this one
 	// is definitely better.
--- a/src/misc/RingFinder.h	Sun Mar 09 14:04:06 2014 +0200
+++ b/src/misc/RingFinder.h	Sun Mar 09 14:59:46 2014 +0200
@@ -16,73 +16,114 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LDFORGE_MISC_RINGFINDER_H
-#define LDFORGE_MISC_RINGFINDER_H
+#pragma once
 
 #include "../Main.h"
 
-// =============================================================================
-// RingFinder
-//
-// Provides an algorithm for finding a solution of rings between radii r0 and r1.
-// =============================================================================
+//!
+//! \brief Provides an algorithm for finding solutions of rings between given radii.
+//!
+//! The RingFinder is a class which implements a ring finding algorithm. It is passed
+//! two radii and it tries to find solutions of rings that would fill the given space.
+//!
+//! \note It is not fool-proof and does not always yield a solution, never assume
+//! \note that one is a available as none is guaranteed.
+//!
 class RingFinder
 {
 	public:
+		//! A single component in a solution
 		struct Component
 		{
 			int num;
 			double scale;
 		};
 
+		//! A solution whose components would fill the desired ring space.
 		class Solution
 		{
 			public:
-				// Components of this solution
+				//! \returns components of this solution
 				inline const QVector<Component>& getComponents() const
 				{
 					return m_components;
 				}
 
-				// Add a component to this solution
+				//! Add a component to this solution
 				inline void addComponent (const Component& a)
 				{
 					m_components.push_back (a);
 				}
 
-				// Compare solutions
-				bool isBetterThan (const Solution* other) const;
+				//! \brief Compare solutions.
+				//!
+				//! Compares this solution with \c other and determines which
+				//! one is superior.
+				//!
+				//! A solution is considered superior if solution has less
+				//! components than the other one. If both solution have an
+				//! equal amount components, the solution with a lesser maximum
+				//! ring number is found superior, as such solutions should
+				//! yield less new primitives and cleaner definitions.
+				//!
+				//! The solution which is found superior to every other solution
+				//! will be the one returned by \c RingFinder::bestSolution().
+				//!
+				//! \param other the solution to check against
+				//! \returns whether this solution is considered superior
+				//! \returns to \c other.
+				//!
+				bool isSuperiorTo (const Solution* other) const;
 
 			private:
 				QVector<Component> m_components;
 		};
 
+		//! Constructs a ring finder.
 		RingFinder() {}
+
+		//! \brief Tries to find rings between \c r0 and \c r1.
+		//!
+		//! This is the main algorithm of the ring finder. It tries to use math
+		//! to find the one ring between r0 and r1. If it fails (the ring number
+		//! is non-integral), it finds an intermediate radius (ceil of the ring
+		//! number times scale) and splits the radius at this point, calling this
+		//! function again to try find the rings between r0 - r and r - r1.
+		//!
+		//! This does not always yield into usable results. If at some point r ==
+		//! r0 or r == r1, there is no hope of finding the rings, at least with
+		//! this algorithm, as it would fall into an infinite recursion.
+		//!
+		//! \param r0 the lower radius of the ring space
+		//! \param r1 the higher radius of the ring space
+		//! \returns whether it was possible to find a solution for the given
+		//! \returns ring space.
+		//!
 		bool findRings (double r0, double r1);
 
+		//! \returns the solution that was considered best. Returns \c null
+		//! \returns if no suitable solution was found.
+		//! \see \c RingFinder::Solution::isSuperiorTo()
 		inline const Solution* bestSolution()
 		{
 			return m_bestSolution;
 		}
 
+		//! \returns all found solutions. The list is empty if no solutions
+		//! \returns were found.
 		inline const QVector<Solution>& allSolutions() const
 		{
 			return m_solutions;
 		}
 
-		inline bool operator() (double r0, double r1)
-		{
-			return findRings (r0, r1);
-		}
-
 	private:
 		QVector<Solution> m_solutions;
 		const Solution*   m_bestSolution;
 		int               m_stack;
 
+		//! Helper function for \c findRings
 		bool findRingsRecursor (double r0, double r1, Solution& currentSolution);
 };
 
 extern RingFinder g_RingFinder;
 
-#endif // LDFORGE_MISC_RINGFINDER_H
\ No newline at end of file

mercurial