renamed the linetypes namespace to ldraw namespace and added more structures to it

Thu, 30 Jan 2020 19:20:11 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 30 Jan 2020 19:20:11 +0200
changeset 35
98906a94732f
parent 34
1de2b8d64e9f
child 36
bbb901b97404

renamed the linetypes namespace to ldraw namespace and added more structures to it

locale/fi.ts file | annotate | diff | comparison | revisions
src/colors.cpp file | annotate | diff | comparison | revisions
src/colors.h file | annotate | diff | comparison | revisions
src/document.cpp file | annotate | diff | comparison | revisions
src/document.h file | annotate | diff | comparison | revisions
src/documentmanager.cpp file | annotate | diff | comparison | revisions
src/gl/common.h file | annotate | diff | comparison | revisions
src/gl/compiler.cpp file | annotate | diff | comparison | revisions
src/gl/compiler.h file | annotate | diff | comparison | revisions
src/gl/partrenderer.cpp file | annotate | diff | comparison | revisions
src/gl/partrenderer.h file | annotate | diff | comparison | revisions
src/libraries.cpp file | annotate | diff | comparison | revisions
src/libraries.h file | annotate | diff | comparison | revisions
src/linetypes/comment.cpp file | annotate | diff | comparison | revisions
src/linetypes/comment.h file | annotate | diff | comparison | revisions
src/linetypes/conditionaledge.cpp file | annotate | diff | comparison | revisions
src/linetypes/conditionaledge.h file | annotate | diff | comparison | revisions
src/linetypes/edge.cpp file | annotate | diff | comparison | revisions
src/linetypes/edge.h file | annotate | diff | comparison | revisions
src/linetypes/errorline.cpp file | annotate | diff | comparison | revisions
src/linetypes/errorline.h file | annotate | diff | comparison | revisions
src/linetypes/metacommand.cpp file | annotate | diff | comparison | revisions
src/linetypes/metacommand.h file | annotate | diff | comparison | revisions
src/linetypes/object.cpp file | annotate | diff | comparison | revisions
src/linetypes/object.h file | annotate | diff | comparison | revisions
src/linetypes/quadrilateral.cpp file | annotate | diff | comparison | revisions
src/linetypes/quadrilateral.h file | annotate | diff | comparison | revisions
src/linetypes/subfilereference.cpp file | annotate | diff | comparison | revisions
src/linetypes/subfilereference.h file | annotate | diff | comparison | revisions
src/linetypes/triangle.cpp file | annotate | diff | comparison | revisions
src/linetypes/triangle.h file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
src/main.h file | annotate | diff | comparison | revisions
src/mainwindow.h file | annotate | diff | comparison | revisions
src/model.cpp file | annotate | diff | comparison | revisions
src/model.h file | annotate | diff | comparison | revisions
src/modeleditcontext.cpp file | annotate | diff | comparison | revisions
src/modeleditcontext.h file | annotate | diff | comparison | revisions
src/parser.cpp file | annotate | diff | comparison | revisions
src/parser.h file | annotate | diff | comparison | revisions
--- a/locale/fi.ts	Tue Jan 28 23:34:49 2020 +0200
+++ b/locale/fi.ts	Thu Jan 30 19:20:11 2020 +0200
@@ -189,7 +189,7 @@
 <context>
     <name>PartRenderer</name>
     <message>
-        <location filename="../src/gl/partrenderer.cpp" line="152"/>
+        <location filename="../src/gl/partrenderer.cpp" line="156"/>
         <source>Rendering error</source>
         <translation type="unfinished"></translation>
     </message>
--- a/src/colors.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/colors.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -18,14 +18,14 @@
 
 #include "colors.h"
 
-const ColorTable::ColorDefinition ColorTable::unknownColor{{}, {}, "Unknown"};
+const ldraw::ColorTable::ColorDefinition ldraw::ColorTable::unknownColor{{}, {}, "Unknown"};
 
-void ColorTable::clear()
+void ldraw::ColorTable::clear()
 {
 	definitions = {};
 }
 
-Result ColorTable::load(QIODevice& device, QTextStream& errors)
+Result ldraw::ColorTable::load(QIODevice& device, QTextStream& errors)
 {
 	this->clear();
 	if (device.isReadable())
@@ -45,7 +45,7 @@
 	}
 }
 
-const ColorTable::ColorDefinition& ColorTable::operator[](Color color) const
+const ldraw::ColorTable::ColorDefinition& ldraw::ColorTable::operator[](Color color) const
 {
 	auto it = this->definitions.find(color.index);
 	if (it != this->definitions.end())
@@ -58,7 +58,7 @@
 	}
 }
 
-void ColorTable::loadColorFromString(const QString& string)
+void ldraw::ColorTable::loadColorFromString(const QString& string)
 {
 	const QRegExp pattern{
 		R"(^\s*0 \!COLOUR\s+([^\s]+)\s+)"_q +
--- a/src/colors.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/colors.h	Thu Jan 30 19:20:11 2020 +0200
@@ -20,12 +20,18 @@
 #include <QColor>
 #include "main.h"
 
-struct Color
+namespace ldraw
+{
+	struct Color;
+	class ColorTable;
+}
+
+struct ldraw::Color
 {
 	qint32 index;
 };
 
-class ColorTable
+class ldraw::ColorTable
 {
 public:
 	struct ColorDefinition
@@ -43,37 +49,37 @@
 	QMap<qint32, ColorDefinition> definitions;
 };
 
-inline bool operator==(const Color& one, const Color& other)
+inline bool operator==(const ldraw::Color& one, const ldraw::Color& other)
 {
 	return one.index == other.index;
 }
 
-inline bool operator!=(const Color& one, const Color& other)
+inline bool operator!=(const ldraw::Color& one, const ldraw::Color& other)
 {
 	return one.index != other.index;
 }
 
-inline bool operator<(const Color& one, const Color& other)
+inline bool operator<(const ldraw::Color& one, const ldraw::Color& other)
 {
 	return one.index < other.index;
 }
 
-inline bool operator<=(const Color& one, const Color& other)
+inline bool operator<=(const ldraw::Color& one, const ldraw::Color& other)
 {
 	return one.index <= other.index;
 }
 
-inline bool operator>(const Color& one, const Color& other)
+inline bool operator>(const ldraw::Color& one, const ldraw::Color& other)
 {
 	return one.index > other.index;
 }
 
-inline bool operator>=(const Color& one, const Color& other)
+inline bool operator>=(const ldraw::Color& one, const ldraw::Color& other)
 {
 	return one.index >= other.index;
 }
 
-namespace colors
+namespace ldraw
 {
 	static constexpr Color black {0};
 	static constexpr Color blue {1};
@@ -81,6 +87,6 @@
 	static constexpr Color red {4};
 	static constexpr Color yellow {14};
 	static constexpr Color white {15};
-	static constexpr Color main {16};
-	static constexpr Color edge {24};
+	static constexpr Color mainColor {16};
+	static constexpr Color edgeColor {24};
 }
--- a/src/document.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/document.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -20,7 +20,11 @@
 #include "ui_document.h"
 #include "model.h"
 
-Document::Document(Model* model, DocumentManager* documents, const ColorTable& colorTable, QWidget* parent) :
+Document::Document(
+	Model* model,
+	DocumentManager* documents,
+	const ldraw::ColorTable& colorTable,
+	QWidget* parent) :
 	QWidget{parent},
 	model{model},
 	documents{documents},
--- a/src/document.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/document.h	Thu Jan 30 19:20:11 2020 +0200
@@ -32,7 +32,11 @@
 {
 	Q_OBJECT
 public:
-	explicit Document(Model* model, DocumentManager* documents, const ColorTable& colorTable, QWidget *parent = nullptr);
+	explicit Document(
+		Model* model,
+		DocumentManager* documents,
+		const ldraw::ColorTable& colorTable,
+		QWidget *parent = nullptr);
 	~Document();
 	QByteArray saveSplitterState() const;
 	void restoreSplitterState(const QByteArray& state);
@@ -41,7 +45,7 @@
 private:
 	Model* model;
 	DocumentManager* const documents;
-	const ColorTable& colorTable;
+	const ldraw::ColorTable& colorTable;
 	PartRenderer* renderer;
 	Ui::Document& ui;
 };
--- a/src/documentmanager.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/documentmanager.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -161,7 +161,7 @@
 	Model* model = this->findModelByName(modelName);
 	for (int i = 0; i < model->size(); i += 1)
 	{
-		const QString referenceName = model->getObjectProperty(i, linetypes::Property::ReferenceName).toString();
+		const QString referenceName = model->getObjectProperty(i, ldraw::Property::ReferenceName).toString();
 		if (not referenceName.isEmpty()
 			and openModels.find(referenceName) == std::end(openModels)
 			and not missing.contains(referenceName))
--- a/src/gl/common.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/gl/common.h	Thu Jan 30 19:20:11 2020 +0200
@@ -47,8 +47,8 @@
 	};
 	Type type;
 	glm::vec3 vertices[4];
-	Color color;
-	linetypes::Id id;
+	ldraw::Color color;
+	ldraw::Id id;
 
 	/**
 	 * @return amount of vertices used for geometry
@@ -84,7 +84,7 @@
 
 namespace gl
 {
-	inline Polygon edgeLine(const glm::vec3& v_1, const glm::vec3& v_2, Color color, linetypes::Id id)
+	inline Polygon edgeLine(const glm::vec3& v_1, const glm::vec3& v_2, ldraw::Color color, ldraw::Id id)
 	{
 		return {Polygon::EdgeLine, {v_1, v_2}, color, id};
 	}
@@ -93,8 +93,8 @@
 		const glm::vec3& v_1,
 		const glm::vec3& v_2,
 		const glm::vec3& v_3,
-		Color color,
-		linetypes::Id id)
+		ldraw::Color color,
+		ldraw::Id id)
 	{
 		return {Polygon::Triangle, {v_1, v_2, v_3}, color, id};
 	}
@@ -104,8 +104,8 @@
 		const glm::vec3& v_2,
 		const glm::vec3& v_3,
 		const glm::vec3& v_4,
-		Color color,
-		linetypes::Id id)
+		ldraw::Color color,
+		ldraw::Id id)
 	{
 		return {Polygon::Quadrilateral, {v_1, v_2, v_3, v_4}, color, id};
 	}
@@ -115,8 +115,8 @@
 		const glm::vec3& v_2,
 		const glm::vec3& control_1,
 		const glm::vec3& control_2,
-		Color color,
-		linetypes::Id id)
+		ldraw::Color color,
+		ldraw::Id id)
 	{
 		return {Polygon::ConditionalEdge, {v_1, v_2, control_1, control_2}, color, id};
 	}
@@ -129,6 +129,7 @@
 		Quads,
 		ConditionalLines
 	};
+
 	constexpr ArrayClass ARRAY_CLASSES[] = {ArrayClass::Lines, ArrayClass::Triangles, ArrayClass::Quads, ArrayClass::ConditionalLines};
 	constexpr int NUM_ARRAY_CLASSES = countof(ARRAY_CLASSES);
 	constexpr int FLOATS_PER_VERTEX = 7;
--- a/src/gl/compiler.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/gl/compiler.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -68,7 +68,7 @@
 }
 )";
 
-gl::Compiler::Compiler(const ColorTable& colorTable, QObject* parent) :
+gl::Compiler::Compiler(const ldraw::ColorTable& colorTable, QObject* parent) :
 	QObject{parent},
 	colorTable{colorTable}
 {
@@ -163,7 +163,7 @@
 }
 
 [[maybe_unused]]
-static QColor colorFromId(linetypes::Id id)
+static QColor colorFromId(ldraw::Id id)
 {
 	// Calculate a color based from this index. This method caters for
 	// 16777216 objects. I don't think that will be exceeded anytime soon.
@@ -197,11 +197,11 @@
 {
 	QColor color;
 	// For normal colors, use the polygon's color.
-	if (polygon.color == colors::main)
+	if (polygon.color == ldraw::mainColor)
 	{
 		color = {255, 255, 64}; // mainColorRepresentation();
 	}
-	else if (polygon.color == colors::edge)
+	else if (polygon.color == ldraw::edgeColor)
 	{
 		// Edge color is black, unless we have a dark background, in which case lines need to be bright.
 		color = Qt::black; //luma(config::backgroundColor()) > 40 ? Qt::black : Qt::white;
--- a/src/gl/compiler.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/gl/compiler.h	Thu Jan 30 19:20:11 2020 +0200
@@ -46,7 +46,7 @@
 {
 	Q_OBJECT
 public:
-	Compiler(const ColorTable& colorTable, QObject* parent);
+	Compiler(const ldraw::ColorTable& colorTable, QObject* parent);
 	~Compiler();
 	void build(Model* model, DocumentManager* context);
 	void buildPolygon(Polygon polygon, std::vector<Vertex>* vboData);
@@ -83,7 +83,7 @@
 	std::size_t storedVertexCounts[gl::NUM_ARRAY_CLASSES] = {0_z};
 	bool initialized = false;
 	BoundingBox boundingBox;
-	const ColorTable& colorTable;
+	const ldraw::ColorTable& colorTable;
 	struct
 	{
 		QOpenGLShaderProgram* program = nullptr;
--- a/src/gl/partrenderer.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/gl/partrenderer.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -23,7 +23,11 @@
 #include <QMessageBox>
 #include "partrenderer.h"
 
-PartRenderer::PartRenderer(Model* model, DocumentManager* documents, const ColorTable& colorTable, QWidget* parent) :
+PartRenderer::PartRenderer(
+	Model* model,
+	DocumentManager* documents,
+	const ldraw::ColorTable& colorTable,
+	QWidget* parent) :
 	QOpenGLWidget{parent},
 	model{model},
 	documents{documents},
--- a/src/gl/partrenderer.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/gl/partrenderer.h	Thu Jan 30 19:20:11 2020 +0200
@@ -15,7 +15,11 @@
 {
 	Q_OBJECT
 public:
-	PartRenderer(Model* model, DocumentManager* documents, const ColorTable& colorTable, QWidget* parent = nullptr);
+	PartRenderer(
+		Model* model,
+		DocumentManager* documents,
+		const ldraw::ColorTable& colorTable,
+		QWidget* parent = nullptr);
 	~PartRenderer() override;
 protected:
 	void initializeGL() override;
@@ -30,7 +34,7 @@
 	void updateViewMatrix();
 	Model* const model;
 	DocumentManager* const documents;
-	const ColorTable& colorTable;
+	const ldraw::ColorTable& colorTable;
 	QPointF lastMousePosition;
 	gl::Compiler* compiler;
 	gl::RenderStyle renderStyle = gl::RenderStyle::Normal;
--- a/src/libraries.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/libraries.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -220,9 +220,9 @@
  * @param errors Where to stream any encountered errors
  * @return color table
  */
-ColorTable LibraryManager::loadColorTable(QTextStream& errors)
+ldraw::ColorTable LibraryManager::loadColorTable(QTextStream& errors)
 {
-	ColorTable result;
+	ldraw::ColorTable result;
 	for (const Library& library : this->libraries)
 	{
 		const QString path = library.path.filePath("LDConfig.ldr");
--- a/src/libraries.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/libraries.h	Thu Jan 30 19:20:11 2020 +0200
@@ -74,7 +74,7 @@
 	int rowCount(const QModelIndex&) const override;
 	int columnCount(const QModelIndex&) const override;
 	bool isValidIndex(const int libraryIndex) const;
-	ColorTable loadColorTable(QTextStream& errors);
+	ldraw::ColorTable loadColorTable(QTextStream& errors);
 private:
 	enum Column
 	{
--- a/src/linetypes/comment.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/comment.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -1,7 +1,7 @@
 #include <QFont>
 #include "comment.h"
 
-QFont linetypes::Comment::textRepresentationFont() const
+QFont ldraw::Comment::textRepresentationFont() const
 {
 	QFont font;
 	font.setItalic(true);
--- a/src/linetypes/comment.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/comment.h	Thu Jan 30 19:20:11 2020 +0200
@@ -2,12 +2,12 @@
 #include "object.h"
 #include "metacommand.h"
 
-namespace linetypes
+namespace ldraw
 {
 	class Comment;
 }
 
-class linetypes::Comment : public MetaCommand
+class ldraw::Comment : public MetaCommand
 {
 	using MetaCommand::MetaCommand;
 	QFont textRepresentationFont() const override;
--- a/src/linetypes/conditionaledge.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/conditionaledge.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -1,6 +1,6 @@
 #include "conditionaledge.h"
 
-linetypes::ConditionalEdge::ConditionalEdge(
+ldraw::ConditionalEdge::ConditionalEdge(
 	const glm::vec3& point_1,
 	const glm::vec3& point_2,
 	const glm::vec3& controlPoint_1,
@@ -12,14 +12,14 @@
 {
 }
 
-linetypes::ConditionalEdge::ConditionalEdge(const QVector<glm::vec3>& vertices, const Color color) :
+ldraw::ConditionalEdge::ConditionalEdge(const QVector<glm::vec3>& vertices, const Color color) :
 	Edge{vertices[0], vertices[1], color},
 	controlPoint_1{vertices[2]},
 	controlPoint_2{vertices[3]}
 {
 }
 
-QVariant linetypes::ConditionalEdge::getProperty(Property property) const
+QVariant ldraw::ConditionalEdge::getProperty(Property property) const
 {
 	switch (property)
 	{
@@ -32,7 +32,7 @@
 	}
 }
 
-auto linetypes::ConditionalEdge::setProperty(
+auto ldraw::ConditionalEdge::setProperty(
 	Property property,
 	const QVariant& value)
 	-> SetPropertyResult
@@ -48,7 +48,7 @@
 	}
 }
 
-QString linetypes::ConditionalEdge::textRepresentation() const
+QString ldraw::ConditionalEdge::textRepresentation() const
 {
 	return Edge::textRepresentation() + utility::format("%1 %2",
 		utility::vertexToStringParens(controlPoint_1),
--- a/src/linetypes/conditionaledge.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/conditionaledge.h	Thu Jan 30 19:20:11 2020 +0200
@@ -1,12 +1,12 @@
 #pragma once
 #include "edge.h"
 
-namespace linetypes
+namespace ldraw
 {
 	class ConditionalEdge;
 }
 
-class linetypes::ConditionalEdge : public Edge
+class ldraw::ConditionalEdge : public Edge
 {
 public:
 	ConditionalEdge() = default;
@@ -15,7 +15,7 @@
 		const glm::vec3& point_2,
 		const glm::vec3& controlPoint_1,
 		const glm::vec3& controlPoint_2,
-		const Color colorIndex = colors::edge);
+		const Color colorIndex = ldraw::edgeColor);
 	ConditionalEdge(const QVector<glm::vec3>& vertices, const Color color);
 	QVariant getProperty(Property property) const override;
 	SetPropertyResult setProperty(
--- a/src/linetypes/edge.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/edge.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -1,6 +1,6 @@
 #include "edge.h"
 
-linetypes::Edge::Edge(
+ldraw::Edge::Edge(
 	const glm::vec3& point_1,
 	const glm::vec3& point_2,
 	const Color color_index) :
@@ -8,14 +8,14 @@
 	point_1{point_1},
 	point_2{point_2} {}
 
-linetypes::Edge::Edge(const QVector<glm::vec3>& vertices, const Color color) :
+ldraw::Edge::Edge(const QVector<glm::vec3>& vertices, const Color color) :
 	ColoredObject{color},
 	point_1{vertices[0]},
 	point_2{vertices[1]}
 {
 }
 
-QVariant linetypes::Edge::getProperty(Property property) const
+QVariant ldraw::Edge::getProperty(Property property) const
 {
 	switch (property)
 	{
@@ -28,7 +28,7 @@
 	}
 }
 
-auto linetypes::Edge::setProperty(Property property, const QVariant& value)
+auto ldraw::Edge::setProperty(Property property, const QVariant& value)
 	-> SetPropertyResult
 {
 	switch (property)
@@ -44,12 +44,12 @@
 	}
 }
 
-QString linetypes::Edge::textRepresentation() const
+QString ldraw::Edge::textRepresentation() const
 {
 	return utility::format("%1 %2", utility::vertexToStringParens(point_1), utility::vertexToStringParens(point_2));
 }
 
-void linetypes::Edge::getPolygons(
+void ldraw::Edge::getPolygons(
 	std::vector<gl::Polygon>& polygons,
 	GetPolygonsContext* context) const
 {
--- a/src/linetypes/edge.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/edge.h	Thu Jan 30 19:20:11 2020 +0200
@@ -1,18 +1,18 @@
 #pragma once
 #include "object.h"
 
-namespace linetypes
+namespace ldraw
 {
 	class Edge;
 }
 
-class linetypes::Edge : public ColoredObject
+class ldraw::Edge : public ColoredObject
 {
 public:
 	using BaseClass = ColoredObject;
 	Edge() = default;
 	Edge(const glm::vec3& point_1, const glm::vec3& point_2,
-		 const Color colorIndex = colors::edge);
+		 const Color colorIndex = ldraw::edgeColor);
 	Edge(const QVector<glm::vec3>& vertices, const Color color);
 	QVariant getProperty(Property property) const override;
 	SetPropertyResult setProperty(
--- a/src/linetypes/errorline.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/errorline.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -1,13 +1,13 @@
 #include <QBrush>
 #include "errorline.h"
 
-linetypes::ErrorLine::ErrorLine(QStringView text, QStringView message) :
+ldraw::ErrorLine::ErrorLine(QStringView text, QStringView message) :
 	text{text.toString()},
 	message{message.toString()}
 {
 }
 
-QVariant linetypes::ErrorLine::getProperty(Property property) const
+QVariant ldraw::ErrorLine::getProperty(Property property) const
 {
 	switch (property)
 	{
@@ -20,7 +20,7 @@
 	}
 }
 
-auto linetypes::ErrorLine::setProperty(
+auto ldraw::ErrorLine::setProperty(
 	Property property,
 	const QVariant& value)
 	-> SetPropertyResult
@@ -38,17 +38,17 @@
 	}
 }
 
-QString linetypes::ErrorLine::textRepresentation() const
+QString ldraw::ErrorLine::textRepresentation() const
 {
 	return this->text;
 }
 
-QBrush linetypes::ErrorLine::textRepresentationForeground() const
+QBrush ldraw::ErrorLine::textRepresentationForeground() const
 {
 	return QBrush{Qt::yellow};
 }
 
-QBrush linetypes::ErrorLine::textRepresentationBackground() const
+QBrush ldraw::ErrorLine::textRepresentationBackground() const
 {
 	return QBrush{Qt::red};
 }
--- a/src/linetypes/errorline.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/errorline.h	Thu Jan 30 19:20:11 2020 +0200
@@ -1,12 +1,12 @@
 #pragma once
 #include "object.h"
 
-namespace linetypes
+namespace ldraw
 {
 	class ErrorLine;
 }
 
-class linetypes::ErrorLine : public Object
+class ldraw::ErrorLine : public Object
 {
 public:
 	ErrorLine(QStringView text = u"", QStringView message = u"");
--- a/src/linetypes/metacommand.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/metacommand.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -1,10 +1,10 @@
 #include "metacommand.h"
 
-linetypes::MetaCommand::MetaCommand(QStringView text) :
+ldraw::MetaCommand::MetaCommand(QStringView text) :
 	Object{},
 	storedText{text.toString()} {}
 
-QVariant linetypes::MetaCommand::getProperty(Property property) const
+QVariant ldraw::MetaCommand::getProperty(Property property) const
 {
 	switch (property)
 	{
@@ -15,7 +15,7 @@
 	}
 }
 
-auto linetypes::MetaCommand::setProperty(Property property, const QVariant& value)
+auto ldraw::MetaCommand::setProperty(Property property, const QVariant& value)
 	-> SetPropertyResult
 {
 	switch (property)
@@ -28,7 +28,7 @@
 	}
 }
 
-QString linetypes::MetaCommand::textRepresentation() const
+QString ldraw::MetaCommand::textRepresentation() const
 {
 	return this->storedText;
 }
--- a/src/linetypes/metacommand.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/metacommand.h	Thu Jan 30 19:20:11 2020 +0200
@@ -1,11 +1,11 @@
 #pragma once
 #include "object.h"
 
-namespace linetypes
+namespace ldraw
 {
 	class MetaCommand;
 }
-class linetypes::MetaCommand : public Object
+class ldraw::MetaCommand : public Object
 {
 public:
 	MetaCommand() = default;
--- a/src/linetypes/object.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/object.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -9,27 +9,27 @@
 	return id;
 }
 
-linetypes::Object::Object() :
+ldraw::Object::Object() :
 	id {getIdForNewObject()}
 {
 }
 
-linetypes::Object::~Object()
+ldraw::Object::~Object()
 {
 }
 
-bool linetypes::Object::hasColor() const
+bool ldraw::Object::hasColor() const
 {
 	return false;
 }
 
-QVariant linetypes::Object::getProperty(Property id) const
+QVariant ldraw::Object::getProperty(Property id) const
 {
 	Q_UNUSED(id);
 	return {};
 }
 
-auto linetypes::Object::setProperty(Property id, const QVariant& value)
+auto ldraw::Object::setProperty(Property id, const QVariant& value)
 	-> SetPropertyResult
 {
 	Q_UNUSED(id)
@@ -37,38 +37,38 @@
 	return SetPropertyResult::PropertyNotHandled;
 }
 
-QBrush linetypes::Object::textRepresentationForeground() const
+QBrush ldraw::Object::textRepresentationForeground() const
 {
 	return {};
 }
 
-QBrush linetypes::Object::textRepresentationBackground() const
+QBrush ldraw::Object::textRepresentationBackground() const
 {
 	return {};
 }
 
-QFont linetypes::Object::textRepresentationFont() const
+QFont ldraw::Object::textRepresentationFont() const
 {
 	return {};
 }
 
-void linetypes::Object::getPolygons(std::vector<gl::Polygon>& polygons, GetPolygonsContext* context) const
+void ldraw::Object::getPolygons(std::vector<gl::Polygon>& polygons, GetPolygonsContext* context) const
 {
 	Q_UNUSED(polygons)
 	Q_UNUSED(context)
 }
 
-linetypes::ColoredObject::ColoredObject(const Color color_index) :
+ldraw::ColoredObject::ColoredObject(const Color color_index) :
 	colorIndex{color_index}
 {
 }
 
-bool linetypes::ColoredObject::hasColor() const
+bool ldraw::ColoredObject::hasColor() const
 {
 	return true;
 }
 
-QVariant linetypes::ColoredObject::getProperty(Property id) const
+QVariant ldraw::ColoredObject::getProperty(Property id) const
 {
 	switch (id)
 	{
@@ -79,7 +79,7 @@
 	}
 }
 
-auto linetypes::ColoredObject::setProperty(Property id, const QVariant& value)
+auto ldraw::ColoredObject::setProperty(Property id, const QVariant& value)
 	-> SetPropertyResult
 {
 	switch (id)
@@ -103,7 +103,7 @@
 	}
 }
 
-QString linetypes::Empty::textRepresentation() const
+QString ldraw::Empty::textRepresentation() const
 {
 	return "";
 }
--- a/src/linetypes/object.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/object.h	Thu Jan 30 19:20:11 2020 +0200
@@ -6,7 +6,7 @@
 #include "colors.h"
 #include "gl/common.h"
 
-namespace linetypes
+namespace ldraw
 {
 	struct GetPolygonsContext;
 	enum class Property;
@@ -17,7 +17,7 @@
 
 class DocumentManager;
 
-struct linetypes::GetPolygonsContext
+struct ldraw::GetPolygonsContext
 {
 	::DocumentManager* documents;
 };
@@ -25,7 +25,7 @@
 /**
  * @brief Different properties that can be queried with getProperty
  */
-enum class linetypes::Property
+enum class ldraw::Property
 {
 	Color, // Color of the object
 	Text, // Text contained in a comment
@@ -41,7 +41,7 @@
 	ErrorMessage // For error lines, why parsing failed
 };
 
-class linetypes::Object
+class ldraw::Object
 {
 public:
 	enum class SetPropertyResult
@@ -66,21 +66,21 @@
 	virtual void invert() {}
 };
 
-class linetypes::ColoredObject : public Object
+class ldraw::ColoredObject : public Object
 {
 public:
-	ColoredObject(const Color colorIndex = colors::main);
+	ColoredObject(const Color colorIndex = ldraw::mainColor);
 	bool hasColor() const override final;
 	QVariant getProperty(Property id) const override;
 	SetPropertyResult setProperty(Property id, const QVariant& value) override;
 protected:
-	Color colorIndex = colors::main;
+	Color colorIndex = ldraw::mainColor;
 };
 
 /**
  * @brief Represents an empty line.
  */
-class linetypes::Empty : public Object
+class ldraw::Empty : public Object
 {
 	QString textRepresentation() const override;
 };
--- a/src/linetypes/quadrilateral.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/quadrilateral.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -1,6 +1,6 @@
 #include "quadrilateral.h"
 
-linetypes::Quadrilateral::Quadrilateral(
+ldraw::Quadrilateral::Quadrilateral(
 	const glm::vec3& point_1,
 	const glm::vec3& point_2,
 	const glm::vec3& point_3,
@@ -11,13 +11,13 @@
 {
 }
 
-linetypes::Quadrilateral::Quadrilateral(const QVector<glm::vec3>& vertices, const Color color) :
+ldraw::Quadrilateral::Quadrilateral(const QVector<glm::vec3>& vertices, const Color color) :
 	ColoredObject{color},
 	points{vertices[0], vertices[1], vertices[2], vertices[3]}
 {
 }
 
-QVariant linetypes::Quadrilateral::getProperty(const Property id) const
+QVariant ldraw::Quadrilateral::getProperty(const Property id) const
 {
 	switch (id)
 	{
@@ -34,7 +34,7 @@
 	}
 }
 
-auto linetypes::Quadrilateral::setProperty(
+auto ldraw::Quadrilateral::setProperty(
 	const Property id,
 	const QVariant& value)
 	-> SetPropertyResult
@@ -58,7 +58,7 @@
 	}
 }
 
-QString linetypes::Quadrilateral::textRepresentation() const
+QString ldraw::Quadrilateral::textRepresentation() const
 {
 	return utility::format("%1 %2 %3 %4",
 		utility::vertexToStringParens(points[0]),
@@ -67,7 +67,7 @@
 		utility::vertexToStringParens(points[3]));
 }
 
-void linetypes::Quadrilateral::getPolygons(
+void ldraw::Quadrilateral::getPolygons(
 	std::vector<gl::Polygon>& polygons,
 	GetPolygonsContext* context) const
 {
@@ -81,7 +81,7 @@
 			this->id));
 }
 
-void linetypes::Quadrilateral::invert()
+void ldraw::Quadrilateral::invert()
 {
 	//    0 1 2 3
 	// -> 2 1 0 3
--- a/src/linetypes/quadrilateral.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/quadrilateral.h	Thu Jan 30 19:20:11 2020 +0200
@@ -1,21 +1,21 @@
 #pragma once
 #include "object.h"
 
-namespace linetypes
+namespace ldraw
 {
 	class Quadrilateral;
 }
 
-class linetypes::Quadrilateral : public ColoredObject
+class ldraw::Quadrilateral : public ColoredObject
 {
 public:
 	Quadrilateral() = default;
 	Quadrilateral(
-	const glm::vec3 &point_1,
-	const glm::vec3 &point_2,
-	const glm::vec3 &point_3,
-	const glm::vec3 &point_4,
-	Color colorIndex = colors::main);
+		const glm::vec3 &point_1,
+		const glm::vec3 &point_2,
+		const glm::vec3 &point_3,
+		const glm::vec3 &point_4,
+		Color colorIndex = ldraw::mainColor);
 	Quadrilateral(const QVector<glm::vec3>& vertices, const Color color);
 	QVariant getProperty(Property id) const override;
 	SetPropertyResult setProperty(Property id, const QVariant& value) override;
--- a/src/linetypes/subfilereference.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/subfilereference.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -2,7 +2,7 @@
 #include "documentmanager.h"
 #include "invert.h"
 
-linetypes::SubfileReference::SubfileReference(const glm::mat4& transformation,
+ldraw::SubfileReference::SubfileReference(const glm::mat4& transformation,
 	const QString& referenceName,
 	const Color color) :
 	ColoredObject{color},
@@ -11,7 +11,7 @@
 {
 }
 
-QVariant linetypes::SubfileReference::getProperty(Property property) const
+QVariant ldraw::SubfileReference::getProperty(Property property) const
 {
 	switch (property)
 	{
@@ -24,7 +24,7 @@
 	}
 }
 
-auto linetypes::SubfileReference::setProperty(
+auto ldraw::SubfileReference::setProperty(
 	Property property,
 	const QVariant& value)
 	-> SetPropertyResult
@@ -42,12 +42,12 @@
 	}
 }
 
-QString linetypes::SubfileReference::textRepresentation() const
+QString ldraw::SubfileReference::textRepresentation() const
 {
 	return referenceName + " " + utility::vertexToStringParens(this->position());
 }
 
-void linetypes::SubfileReference::getPolygons(
+void ldraw::SubfileReference::getPolygons(
 	std::vector<gl::Polygon>& polygons,
 	GetPolygonsContext* context) const
 {
@@ -69,7 +69,7 @@
 			{
 				gl::invert(polygon);
 			}
-			if (polygon.color == colors::main)
+			if (polygon.color == ldraw::mainColor)
 			{
 				polygon.color = this->colorIndex;
 			}
@@ -79,17 +79,17 @@
 	}
 }
 
-glm::vec3 linetypes::SubfileReference::position() const
+glm::vec3 ldraw::SubfileReference::position() const
 {
 	return {this->transformation[3][0], this->transformation[3][1], this->transformation[3][2]};
 }
 
-void linetypes::SubfileReference::invert()
+void ldraw::SubfileReference::invert()
 {
 	this->isInverted = not this->isInverted;
 }
 
-Model* linetypes::SubfileReference::resolve(DocumentManager* documents) const
+Model* ldraw::SubfileReference::resolve(DocumentManager* documents) const
 {
 	return documents->findModelByName(this->referenceName);
 }
--- a/src/linetypes/subfilereference.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/subfilereference.h	Thu Jan 30 19:20:11 2020 +0200
@@ -3,19 +3,19 @@
 
 class Model;
 
-namespace linetypes
+namespace ldraw
 {
 	class SubfileReference;
 }
 
-class linetypes::SubfileReference : public ColoredObject
+class ldraw::SubfileReference : public ColoredObject
 {
 public:
 	SubfileReference() = default;
 	SubfileReference(
 		const glm::mat4& transformation,
 		const QString &referenceName,
-		const Color color = colors::main);
+		const Color color = ldraw::mainColor);
 	QVariant getProperty(Property property) const override;
 	SetPropertyResult setProperty(Property property, const QVariant& value) override;
 	QString textRepresentation() const override;
--- a/src/linetypes/triangle.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/triangle.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -1,6 +1,6 @@
 #include "triangle.h"
 
-linetypes::Triangle::Triangle(
+ldraw::Triangle::Triangle(
 	const glm::vec3& point_1,
 	const glm::vec3& point_2,
 	const glm::vec3& point_3,
@@ -10,13 +10,13 @@
 {
 }
 
-linetypes::Triangle::Triangle(const QVector<glm::vec3>& vertices, const Color color) :
+ldraw::Triangle::Triangle(const QVector<glm::vec3>& vertices, const Color color) :
 	ColoredObject{color},
 	points{vertices[0], vertices[1], vertices[2]}
 {
 }
 
-QVariant linetypes::Triangle::getProperty(const Property id) const
+QVariant ldraw::Triangle::getProperty(const Property id) const
 {
 	switch (id)
 	{
@@ -31,7 +31,7 @@
 	}
 }
 
-auto linetypes::Triangle::setProperty(Property id, const QVariant& value)
+auto ldraw::Triangle::setProperty(Property id, const QVariant& value)
 	-> SetPropertyResult
 {
 	switch (id)
@@ -50,7 +50,7 @@
 	}
 }
 
-QString linetypes::Triangle::textRepresentation() const
+QString ldraw::Triangle::textRepresentation() const
 {
 	return utility::format("%1 %2 %3",
 		utility::vertexToStringParens(points[0]),
@@ -58,7 +58,7 @@
 		utility::vertexToStringParens(points[2]));
 }
 
-void linetypes::Triangle::getPolygons(
+void ldraw::Triangle::getPolygons(
 	std::vector<gl::Polygon>& polygons,
 	GetPolygonsContext* context) const
 {
@@ -71,7 +71,7 @@
 			this->id));
 }
 
-void linetypes::Triangle::invert()
+void ldraw::Triangle::invert()
 {
 	//    0 1 2
 	// -> 1 0 2
--- a/src/linetypes/triangle.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/linetypes/triangle.h	Thu Jan 30 19:20:11 2020 +0200
@@ -1,11 +1,11 @@
 #include "object.h"
 
-namespace linetypes
+namespace ldraw
 {
 	class Triangle;
 }
 
-class linetypes::Triangle : public ColoredObject
+class ldraw::Triangle : public ColoredObject
 {
 public:
 	Triangle() = default;
@@ -13,7 +13,7 @@
 		const glm::vec3 &point_1,
 		const glm::vec3 &point_2,
 		const glm::vec3 &point_3,
-		Color colorIndex = colors::main);
+		Color colorIndex = ldraw::mainColor);
 	Triangle(const QVector<glm::vec3>& vertices, const Color color);
 	QVariant getProperty(Property id) const override;
 	SetPropertyResult setProperty(Property id, const QVariant& value) override;
--- a/src/main.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/main.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -23,6 +23,7 @@
 
 int main(int argc, char *argv[])
 {
+	ldraw::Color color = ldraw::red;
 	::glutInit(&argc, argv);
 	QCoreApplication::setApplicationName(::appName);
 	QCoreApplication::setOrganizationName("hecknology.net");
--- a/src/main.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/main.h	Thu Jan 30 19:20:11 2020 +0200
@@ -31,13 +31,13 @@
 	constexpr char mainwindow[] = "mainwindow";
 }
 
-namespace linetypes
+namespace ldraw
 {
 	// Uniquely identifies a model body object
 	struct Id
 	{
 		unsigned int value;
-		constexpr bool operator<(linetypes::Id other) const
+		constexpr bool operator<(ldraw::Id other) const
 		{
 			return this->value < other.value;
 		}
--- a/src/mainwindow.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/mainwindow.h	Thu Jan 30 19:20:11 2020 +0200
@@ -54,7 +54,7 @@
 	uiutilities::KeySequenceMap defaultKeyboardShortcuts;
 	static constexpr int maxRecentlyOpenedFiles = 10;
 	QStringList recentlyOpenedFiles;
-	ColorTable colorTable;
+	ldraw::ColorTable colorTable;
 	void updateTitle();
 	void saveSettings();
 	void restoreSettings();
--- a/src/model.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/model.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -42,7 +42,7 @@
 QVariant Model::data(const QModelIndex& index, int role) const
 {
 	const int row = index.row();
-	linetypes::Object* object = this->body[row].get();
+	ldraw::Object* object = this->body[row].get();
 	switch(role)
 	{
 	case Qt::DisplayRole:
@@ -69,9 +69,9 @@
 	}
 }
 
-QVariant Model::getObjectProperty(const int index, const linetypes::Property property) const
+QVariant Model::getObjectProperty(const int index, const ldraw::Property property) const
 {
-	const linetypes::Object* object = this->body[index].get();
+	const ldraw::Object* object = this->body[index].get();
 	return object->getProperty(property);
 }
 
@@ -80,7 +80,7 @@
 	if (this->needRecache)
 	{
 		this->cachedPolygons.clear();
-		linetypes::GetPolygonsContext context{documents};
+		ldraw::GetPolygonsContext context{documents};
 		for (int i = 0; i < this->size(); i += 1)
 		{
 			this->getObjectPolygons(i, this->cachedPolygons, &context);
@@ -93,9 +93,9 @@
 void Model::getObjectPolygons(
 	const int index,
 	std::vector<gl::Polygon>& polygons_out,
-	linetypes::GetPolygonsContext* context) const
+	ldraw::GetPolygonsContext* context) const
 {
-	const linetypes::Object* object = this->body[index].get();
+	const ldraw::Object* object = this->body[index].get();
 	object->getPolygons(polygons_out, context);
 }
 
--- a/src/model.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/model.h	Thu Jan 30 19:20:11 2020 +0200
@@ -42,33 +42,33 @@
 	QVariant data(const QModelIndex& index, int role) const override;
 	QVariant getHeaderProperty(const HeaderProperty property);
 	const QString& getName() const;
-	QVariant getObjectProperty(const int index, const linetypes::Property property) const;
+	QVariant getObjectProperty(const int index, const ldraw::Property property) const;
 	std::vector<gl::Polygon> getPolygons(class DocumentManager* documents) const;
-	void getObjectPolygons(const int index, std::vector<gl::Polygon>& polygons_out, linetypes::GetPolygonsContext* context) const;
+	void getObjectPolygons(const int index, std::vector<gl::Polygon>& polygons_out, ldraw::GetPolygonsContext* context) const;
 signals:
-	void objectAdded(linetypes::Id id, int position);
+	void objectAdded(ldraw::Id id, int position);
 private:
-	using ModelObjectPointer = std::unique_ptr<linetypes::Object>;
+	using ModelObjectPointer = std::unique_ptr<ldraw::Object>;
 	template<typename T, typename... Args>
-	linetypes::Id append(Args&&... args);
+	ldraw::Id append(Args&&... args);
 	void append(ModelObjectPointer&& object);
 	template<typename T, typename... Args>
-	linetypes::Id insert(int position, Args&&... args);
+	ldraw::Id insert(int position, Args&&... args);
 	bool modified = false;
 	QString path;
 	LDHeader header;
 	std::vector<ModelObjectPointer> body;
-	std::map<linetypes::Id, linetypes::Object*> objectsById;
+	std::map<ldraw::Id, ldraw::Object*> objectsById;
 	mutable std::vector<gl::Polygon> cachedPolygons;
 	mutable bool needRecache = true;
 };
 
 template<typename T, typename... Args>
-linetypes::Id Model::append(Args&&... args)
+ldraw::Id Model::append(Args&&... args)
 {
 	emit layoutAboutToBeChanged();
 	this->body.push_back(std::make_unique<T>(args...));
-	linetypes::Object* pointer = this->body.back().get();
+	ldraw::Object* pointer = this->body.back().get();
 	this->objectsById[pointer->id] = pointer;
 	emit objectAdded(pointer->id, this->body.size() - 1);
 	emit layoutChanged();
@@ -76,11 +76,11 @@
 }
 
 template<typename T, typename... Args>
-linetypes::Id Model::insert(int position, Args&&... args)
+ldraw::Id Model::insert(int position, Args&&... args)
 {
 	emit layoutAboutToBeChanged();
 	this->body.insert(position, std::make_unique<T>(args...));
-	linetypes::Object* pointer = this->body[position].get();
+	ldraw::Object* pointer = this->body[position].get();
 	this->objectsById[pointer->id] = pointer;
 	emit objectAdded(pointer->id, position);
 	emit layoutChanged();
--- a/src/modeleditcontext.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/modeleditcontext.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -23,28 +23,28 @@
 {
 }
 
-linetypes::Id Model::EditContext::append(std::unique_ptr<linetypes::Object>&& object)
+ldraw::Id Model::EditContext::append(std::unique_ptr<ldraw::Object>&& object)
 {
-	const linetypes::Id id = object->id;
+	const ldraw::Id id = object->id;
 	this->model.objectsById[id] = object.get();
 	this->model.append(std::move(object));
 	return id;
 }
 
 void Model::EditContext::setObjectProperty(
-	linetypes::Object* object,
-	linetypes::Property property,
+	ldraw::Object* object,
+	ldraw::Property property,
 	const QVariant& value)
 {
 	object->setProperty(property, value);
 }
 
-void Model::EditContext::invertObject(linetypes::Id id)
+void Model::EditContext::invertObject(ldraw::Id id)
 {
 	auto it = this->model.objectsById.find(id);
 	if (it != this->model.objectsById.end())
 	{
-		linetypes::Object* object = it->second;
+		ldraw::Object* object = it->second;
 		object->invert();
 	}
 }
--- a/src/modeleditcontext.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/modeleditcontext.h	Thu Jan 30 19:20:11 2020 +0200
@@ -24,15 +24,15 @@
 {
 public:
 	template<typename T, typename... Args>
-	linetypes::Id append(Args&&... args);
-	linetypes::Id append(std::unique_ptr<linetypes::Object>&& object);
+	ldraw::Id append(Args&&... args);
+	ldraw::Id append(std::unique_ptr<ldraw::Object>&& object);
 	template<typename T, typename... Args>
-	linetypes::Id insert(int position, Args&&... args);
+	ldraw::Id insert(int position, Args&&... args);
 	void setObjectProperty(
-		linetypes::Object* object,
-		linetypes::Property property,
+		ldraw::Object* object,
+		ldraw::Property property,
 		const QVariant &value);
-	void invertObject(linetypes::Id id);
+	void invertObject(ldraw::Id id);
 private:
 	EditContext(Model& model);
 	friend class Model;
@@ -40,13 +40,13 @@
 };
 
 template<typename T, typename... Args>
-linetypes::Id Model::EditContext::append(Args&&... args)
+ldraw::Id Model::EditContext::append(Args&&... args)
 {
 	return this->model.append<T>(args...);
 }
 
 template<typename T, typename... Args>
-linetypes::Id Model::EditContext::insert(int position, Args&&... args)
+ldraw::Id Model::EditContext::insert(int position, Args&&... args)
 {
 	return this->model.insert<T>(position, args...);
 }
--- a/src/parser.cpp	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/parser.cpp	Thu Jan 30 19:20:11 2020 +0200
@@ -255,7 +255,7 @@
 			invertNext = true;
 			continue;
 		}
-		std::unique_ptr<linetypes::Object> object = parseFromString(line);
+		std::unique_ptr<ldraw::Object> object = parseFromString(line);
 		auto id = editor.append(std::move(object));
 		if (invertNext)
 		{
@@ -265,10 +265,10 @@
 	}
 }
 
-static Color colorFromString(const QString& colorString)
+static ldraw::Color colorFromString(const QString& colorString)
 {
 	bool colorSucceeded;
-	const Color color = {colorString.toInt(&colorSucceeded)};
+	const ldraw::Color color = {colorString.toInt(&colorSucceeded)};
 	if (colorSucceeded)
 	{
 		return color;
@@ -329,22 +329,22 @@
 	return result;
 }
 
-static std::unique_ptr<linetypes::Object> parseType0Line(
+static std::unique_ptr<ldraw::Object> parseType0Line(
 	const QString& line,
 	const QStringList& tokens)
 {
 	Q_UNUSED(tokens)
 	if (line.startsWith("0 //"))
 	{
-		return std::make_unique<linetypes::Comment>(line.mid(std::strlen("0 //")).simplified());
+		return std::make_unique<ldraw::Comment>(line.mid(std::strlen("0 //")).simplified());
 	}
 	else
 	{
-		return std::make_unique<linetypes::MetaCommand>(line.mid(1).simplified());
+		return std::make_unique<ldraw::MetaCommand>(line.mid(1).simplified());
 	}
 }
 
-static std::unique_ptr<linetypes::SubfileReference> parseType1Line(
+static std::unique_ptr<ldraw::SubfileReference> parseType1Line(
 	const QString& line,
 	const QStringList& tokens)
 {
@@ -357,10 +357,10 @@
 	{
 		throw BodyParseError{"wrong amount of tokens in a type-1 line"};
 	}
-	const Color color = colorFromString(tokens[colorPosition]);
+	const ldraw::Color color = colorFromString(tokens[colorPosition]);
 	const glm::mat4 transform = matrixFromStrings(tokens, transformPosition, positionPosition);
 	const QString& name = tokens[namePosition];
-	return std::make_unique<linetypes::SubfileReference>(transform, name, color);
+	return std::make_unique<ldraw::SubfileReference>(transform, name, color);
 }
 
 template<typename T, int NumVertices>
@@ -375,7 +375,7 @@
 	{
 		throw BodyParseError{"wrong amount of tokens"};
 	}
-	const Color color = colorFromString(tokens[colorPosition]);
+	const ldraw::Color color = colorFromString(tokens[colorPosition]);
 	QVector<glm::vec3> vertices;
 	vertices.reserve(NumVertices);
 	for (int i = 0; i < NumVertices; i += 1)
@@ -385,7 +385,7 @@
 	return std::make_unique<T>(vertices, color);
 }
 
-std::unique_ptr<linetypes::Object> Parser::parseFromString(QString line)
+std::unique_ptr<ldraw::Object> Parser::parseFromString(QString line)
 {
 	line = line.simplified();
 	try
@@ -393,7 +393,7 @@
 		const QStringList tokens = line.split(QRegExp{R"(\s+)"});
 		if (tokens.empty() or tokens == QStringList{{""}})
 		{
-			return std::make_unique<linetypes::Empty>();
+			return std::make_unique<ldraw::Empty>();
 		}
 		bool ok_code;
 		const int code = tokens[0].toInt(&ok_code);
@@ -408,19 +408,19 @@
 		case 1:
 			return parseType1Line(line, tokens);
 		case 2:
-			return parsePolygon<linetypes::Edge, 2>(line, tokens);
+			return parsePolygon<ldraw::Edge, 2>(line, tokens);
 		case 3:
-			return parsePolygon<linetypes::Triangle, 3>(line, tokens);
+			return parsePolygon<ldraw::Triangle, 3>(line, tokens);
 		case 4:
-			return parsePolygon<linetypes::Quadrilateral, 4>(line, tokens);
+			return parsePolygon<ldraw::Quadrilateral, 4>(line, tokens);
 		case 5:
-			return parsePolygon<linetypes::ConditionalEdge, 4>(line, tokens);
+			return parsePolygon<ldraw::ConditionalEdge, 4>(line, tokens);
 		default:
 			throw BodyParseError{utility::format("bad line type '%1'", code)};
 		}
 	}
 	catch(const BodyParseError& error)
 	{
-		return std::make_unique<linetypes::ErrorLine>(line, error.message);
+		return std::make_unique<ldraw::ErrorLine>(line, error.message);
 	}
 }
--- a/src/parser.h	Tue Jan 28 23:34:49 2020 +0200
+++ b/src/parser.h	Thu Jan 30 19:20:11 2020 +0200
@@ -31,7 +31,7 @@
 	Parser(QIODevice& device, QObject* parent = nullptr);
 	LDHeader parseHeader(Winding& winding);
 	void parseBody(Model::EditContext& editor);
-	static std::unique_ptr<linetypes::Object> parseFromString(QString line);
+	static std::unique_ptr<ldraw::Object> parseFromString(QString line);
 private:
 	enum HeaderParseResult {ParseSuccess, ParseFailure, StopParsing};
 	QString readLine();

mercurial