replaced "Config->" with "config."

Thu, 04 Jan 2018 19:40:16 +0200

author
Santeri Piippo
date
Thu, 04 Jan 2018 19:40:16 +0200
changeset 1215
77a0270352a3
parent 1214
fed9aacd1fab
child 1216
12f9ea615cbc

replaced "Config->" with "config."

src/dialogs/colorselector.cpp file | annotate | diff | comparison | revisions
src/dialogs/configdialog.cpp file | annotate | diff | comparison | revisions
src/dialogs/newpartdialog.cpp file | annotate | diff | comparison | revisions
src/documentmanager.cpp file | annotate | diff | comparison | revisions
src/editmodes/abstractEditMode.cpp file | annotate | diff | comparison | revisions
src/glCompiler.cpp file | annotate | diff | comparison | revisions
src/glRenderer.cpp file | annotate | diff | comparison | revisions
src/guiutilities.cpp file | annotate | diff | comparison | revisions
src/ldObject.cpp file | annotate | diff | comparison | revisions
src/ldpaths.cpp file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
src/main.h file | annotate | diff | comparison | revisions
src/mainwindow.cpp file | annotate | diff | comparison | revisions
src/matrixinput.cpp file | annotate | diff | comparison | revisions
src/matrixinput.h file | annotate | diff | comparison | revisions
src/matrixinput.ui file | annotate | diff | comparison | revisions
src/miscallenous.cpp file | annotate | diff | comparison | revisions
src/partdownloader.cpp file | annotate | diff | comparison | revisions
src/primitives.cpp file | annotate | diff | comparison | revisions
src/toolsets/algorithmtoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/filetoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/movetoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/viewtoolset.cpp file | annotate | diff | comparison | revisions
--- a/src/dialogs/colorselector.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/dialogs/colorselector.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -55,8 +55,8 @@
 
 			if (ldcolor == MainColor)
 			{
-				color = QColor (Config->mainColor());
-				color.setAlphaF (Config->mainColorAlpha());
+				color = QColor (config.mainColor());
+				color.setAlphaF (config.mainColorAlpha());
 			}
 
 			QString color2name (luma (color) < 80 ? "white" : "black");
--- a/src/dialogs/configdialog.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/dialogs/configdialog.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -82,7 +82,7 @@
 	applyToWidgetOptions (
 	[&](QWidget* widget, QString confname)
 	{
-		QVariant value = m_settings->value (confname, Config->defaultValueByName (confname));
+		QVariant value = m_settings->value (confname, config.defaultValueByName (confname));
 		QLineEdit* le;
 		QSpinBox* spinbox;
 		QDoubleSpinBox* doublespinbox;
@@ -232,7 +232,7 @@
 
 		QString optionname (widget->objectName().mid (strlen ("config")));
 
-		if (Config->existsEntry (optionname))
+		if (config.existsEntry (optionname))
 			func (widget, optionname);
 		else
 			print ("Couldn't find configuration entry named %1", optionname);
@@ -277,7 +277,7 @@
 
 	// Rebuild the quick color toolbar
 	m_window->setQuickColors (quickColors);
-	Config->setQuickColorToolbar (quickColorString());
+	config.setQuickColorToolbar (quickColorString());
 
 	// Ext program settings
 	for (int i = 0; i < NumExternalPrograms; ++i)
--- a/src/dialogs/newpartdialog.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/dialogs/newpartdialog.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -31,13 +31,13 @@
 {
 	ui.setupUi (this);
 
-	QString authortext = Config->defaultName();
+	QString authortext = config.defaultName();
 
-	if (not Config->defaultUser().isEmpty())
-		authortext.append (format (" [%1]", Config->defaultUser()));
+	if (not config.defaultUser().isEmpty())
+		authortext.append (format (" [%1]", config.defaultUser()));
 
 	ui.author->setText (authortext);
-	ui.useCaLicense->setChecked (Config->useCaLicense());
+	ui.useCaLicense->setChecked (config.useCaLicense());
 }
 
 BfcStatement NewPartDialog::getWinding() const
--- a/src/documentmanager.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/documentmanager.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -139,7 +139,7 @@
 		unknowns << static_cast<LDError*> (obj)->fileReferenced();
 	}
 
-	if (Config->tryDownloadMissingFiles() and not unknowns.isEmpty())
+	if (config.tryDownloadMissingFiles() and not unknowns.isEmpty())
 	{
 		PartDownloader dl (m_window);
 		dl.setSourceType (PartDownloader::PartsTracker);
@@ -225,7 +225,7 @@
 		return relativePath;
 
 	// Try with just the LDraw path first
-	QString fullPath = format ("%1" DIRSLASH "%2", Config->lDrawPath(), relativePath);
+	QString fullPath = format ("%1" DIRSLASH "%2", config.lDrawPath(), relativePath);
 
 	if (QFileInfo::exists (fullPath))
 		return fullPath;
@@ -234,7 +234,7 @@
 	{
 		// Look in sub-directories: parts and p. Also look in the download path, since that's where we download parts
 		// from the PT to.
-		QStringList dirs = { Config->lDrawPath(), Config->downloadFilePath() };
+		QStringList dirs = { config.lDrawPath(), config.downloadFilePath() };
 		for (const QString& topdir : dirs)
 		{
 			for (const QString& subdir : QStringList ({ "parts", "p" }))
@@ -362,7 +362,7 @@
 
 void DocumentManager::addRecentFile (QString path)
 {
-	QStringList recentFiles = Config->recentFiles();
+	QStringList recentFiles = config.recentFiles();
 	int idx = recentFiles.indexOf (path);
 
 	// If this file already is in the list, pop it out.
@@ -380,7 +380,7 @@
 
 	// Add the file
 	recentFiles << path;
-	Config->setRecentFiles (recentFiles);
+	config.setRecentFiles (recentFiles);
 	m_window->syncSettings();
 	m_window->updateRecentFilesMenu();
 }
@@ -415,7 +415,7 @@
 	// Possibly substitute with logoed studs:
 	// stud.dat -> stud-logo.dat
 	// stud2.dat -> stud-logo2.dat
-	if (Config->useLogoStuds() and renderinline)
+	if (config.useLogoStuds() and renderinline)
 	{
 		// Ensure logoed studs are loaded first
 		loadLogoedStuds();
--- a/src/editmodes/abstractEditMode.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/editmodes/abstractEditMode.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -189,7 +189,7 @@
 void AbstractDrawMode::drawLength (QPainter &painter, const Vertex &v0, const Vertex &v1,
 	const QPointF& v0p, const QPointF& v1p) const
 {
-	if (not Config->drawLineLengths())
+	if (not config.drawLineLengths())
 		return;
 
 	const QString label = QString::number ((v1 - v0).length());
@@ -231,7 +231,7 @@
 			if (withlengths)
 				drawLength (painter, poly3d[i], poly3d[j], poly[i], poly[j]);
 
-			if (withangles and Config->drawAngles())
+			if (withangles and config.drawAngles())
 			{
 				QLineF l0 (poly[h], poly[i]),
 					l1 (poly[i], poly[j]);
--- a/src/glCompiler.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/glCompiler.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -145,7 +145,7 @@
 		}
 		else if (poly.color == EdgeColor)
 		{
-			qcol = luma (QColor (Config->backgroundColor())) > 40 ? Qt::black : Qt::white;
+			qcol = luma (QColor (config.backgroundColor())) > 40 ? Qt::black : Qt::white;
 		}
 		else
 		{
@@ -186,7 +186,7 @@
 
 	if (blendAlpha != 0.0)
 	{
-		QColor selcolor (Config->selectColorBlend());
+		QColor selcolor (config.selectColorBlend());
 		double denom = blendAlpha + 1.0;
 		qcol.setRed ((qcol.red() + (selcolor.red() * blendAlpha)) / denom);
 		qcol.setGreen ((qcol.green() + (selcolor.green() * blendAlpha)) / denom);
--- a/src/glRenderer.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/glRenderer.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -78,7 +78,7 @@
 	m_initialized (false)
 {
 	m_isPicking = false;
-	m_camera = (ECamera) Config->camera();
+	m_camera = (ECamera) config.camera();
 	m_drawToolTip = false;
 	m_currentEditMode = AbstractEditMode::createByType (this, EditModeType::Select);
 	m_panning = false;
@@ -174,7 +174,7 @@
 	glShadeModel (GL_SMOOTH);
 	glEnable (GL_MULTISAMPLE);
 
-	if (Config->antiAliasedLines())
+	if (config.antiAliasedLines())
 	{
 		glEnable (GL_LINE_SMOOTH);
 		glEnable (GL_POLYGON_SMOOTH);
@@ -264,7 +264,7 @@
 	initializeOpenGLFunctions();
 #endif
 	setBackground();
-	glLineWidth (Config->lineThickness());
+	glLineWidth (config.lineThickness());
 	glLineStipple (1, 0x6666);
 	setAutoFillBackground (false);
 	setMouseTracking (true);
@@ -331,7 +331,7 @@
 		return;
 	}
 
-	QColor color = Config->backgroundColor();
+	QColor color = config.backgroundColor();
 
 	if (not color.isValid())
 		return;
@@ -392,7 +392,7 @@
 		zoomAllToFit();
 	}
 
-	if (Config->drawWireframe() and not isPicking())
+	if (config.drawWireframe() and not isPicking())
 		glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
 
 	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -446,7 +446,7 @@
 	}
 	else
 	{
-		if (Config->bfcRedGreenView())
+		if (config.bfcRedGreenView())
 		{
 			glEnable (GL_CULL_FACE);
 			glCullFace (GL_BACK);
@@ -461,7 +461,7 @@
 		{
 			ComplementVboType colors;
 
-			if (Config->randomColors())
+			if (config.randomColors())
 				colors = RandomColorsVboComplement;
 			else
 				colors = NormalColorsVboComplement;
@@ -475,7 +475,7 @@
 		drawVbos (ConditionalLinesVbo, NormalColorsVboComplement, GL_LINES);
 		glDisable (GL_LINE_STIPPLE);
 
-		if (Config->drawAxes())
+		if (config.drawAxes())
 		{
 			glBindBuffer (GL_ARRAY_BUFFER, m_axesVbo);
 			glVertexPointer (3, GL_FLOAT, 0, NULL);
@@ -501,9 +501,9 @@
 void GLRenderer::drawVbos (SurfaceVboType surface, ComplementVboType colors, GLenum type)
 {
 	// Filter this through some configuration options
-	if ((isOneOf (surface, QuadsVbo, TrianglesVbo) and Config->drawSurfaces() == false)
-		or (surface == LinesVbo and Config->drawEdgeLines() == false)
-		or (surface == ConditionalLinesVbo and Config->drawConditionalLines() == false))
+	if ((isOneOf (surface, QuadsVbo, TrianglesVbo) and config.drawSurfaces() == false)
+		or (surface == LinesVbo and config.drawEdgeLines() == false)
+		or (surface == ConditionalLinesVbo and config.drawConditionalLines() == false))
 	{
 		return;
 	}
@@ -914,7 +914,7 @@
 		return;
 
 	m_camera = cam;
-	Config->setCamera ((int) cam);
+	config.setCamera ((int) cam);
 	m_window->updateEditModeActions();
 }
 
@@ -1096,14 +1096,14 @@
 		glDisable (GL_DITHER);
 
 		// Use particularly thick lines while picking ease up selecting lines.
-		glLineWidth (qMax<double> (Config->lineThickness(), 6.5));
+		glLineWidth (qMax<double> (config.lineThickness(), 6.5));
 	}
 	else
 	{
 		glEnable (GL_DITHER);
 
 		// Restore line thickness
-		glLineWidth (Config->lineThickness());
+		glLineWidth (config.lineThickness());
 	}
 }
 
@@ -1540,14 +1540,14 @@
 //
 void GLRenderer::highlightCursorObject()
 {
-	if (not Config->highlightObjectBelowCursor() and objectAtCursor() == nullptr)
+	if (not config.highlightObjectBelowCursor() and objectAtCursor() == nullptr)
 		return;
 
 	LDObject* newObject = nullptr;
 	LDObject* oldObject = objectAtCursor();
 	qint32 newIndex;
 
-	if (m_isCameraMoving or not Config->highlightObjectBelowCursor())
+	if (m_isCameraMoving or not config.highlightObjectBelowCursor())
 	{
 		newIndex = 0;
 	}
--- a/src/guiutilities.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/guiutilities.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -37,8 +37,8 @@
 	if (ldcolor == MainColor)
 	{
 		// Use the user preferences for main color here
-		color = Config->mainColor();
-		color.setAlphaF (Config->mainColorAlpha());
+		color = config.mainColor();
+		color.setAlphaF (config.mainColorAlpha());
 	}
 
 	// Paint the icon border
@@ -84,11 +84,11 @@
 
 QColor GuiUtilities::mainColorRepresentation()
 {
-	QColor col (Config->mainColor());
+	QColor col (config.mainColor());
 
 	if (not col.isValid())
 		return QColor (0, 0, 0);
 
-	col.setAlpha (Config->mainColorAlpha() * 255.f);
+	col.setAlpha (config.mainColorAlpha() * 255.f);
 	return col;
 }
--- a/src/ldObject.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/ldObject.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -1167,7 +1167,7 @@
 //
 QString PreferredLicenseText()
 {
-	return Config->useCaLicense() ? CALicenseText : "";
+	return config.useCaLicense() ? CALicenseText : "";
 }
 
 // =============================================================================
--- a/src/ldpaths.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/ldpaths.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -29,7 +29,7 @@
 
 void LDPaths::checkPaths()
 {
-	QString pathconfig = Config->lDrawPath();
+	QString pathconfig = config.lDrawPath();
 
 	if (not configurePaths (pathconfig))
 	{
@@ -39,7 +39,7 @@
 		if (not m_dialog->exec())
 			exit (1);
 		else
-			Config->setLDrawPath (m_dialog->path());
+			config.setLDrawPath (m_dialog->path());
 	}
 }
 
--- a/src/main.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/main.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -35,7 +35,7 @@
 #include "documentmanager.h"
 
 MainWindow* g_win = nullptr;
-ConfigurationValueBag* Config = nullptr;
+ConfigurationValueBag config;
 const Vertex Origin (0.0f, 0.0f, 0.0f);
 const Matrix IdentityMatrix ({1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f});
 
@@ -49,9 +49,6 @@
 	app.setOrganizationName (APPNAME);
 	app.setApplicationName (APPNAME);
 
-	static ConfigurationValueBag configObject;
-	Config = &configObject;
-
 	LDPaths* paths = new LDPaths;
 	paths->checkPaths();
 	paths->deleteLater();
--- a/src/main.h	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/main.h	Thu Jan 04 19:40:16 2018 +0200
@@ -33,4 +33,4 @@
 #include "hierarchyelement.h"
 #include "configurationvaluebag.h"
 
-extern ConfigurationValueBag* Config;
\ No newline at end of file
+extern ConfigurationValueBag config;
\ No newline at end of file
--- a/src/mainwindow.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/mainwindow.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -160,7 +160,7 @@
 		}
 	}
 
-	for (QVariant const& toolbarname : Config->hiddenToolbars())
+	for (QVariant const& toolbarname : config.hiddenToolbars())
 	{
 		QToolBar* toolbar = findChild<QToolBar*> (toolbarname.toString());
 
@@ -170,11 +170,11 @@
 
 	// If this is the first start, get the user to configuration. Especially point
 	// them to the profile tab, it's the most important form to fill in.
-	if (Config->firstStart())
+	if (config.firstStart())
 	{
 		ConfigDialog* dialog = new ConfigDialog (this, ConfigDialog::ProfileTab);
 		dialog->show();
-		Config->setFirstStart (false);
+		config.setFirstStart (false);
 	}
 }
 
@@ -234,7 +234,7 @@
 
 	QAction* first = nullptr;
 
-	for (const QVariant& it : Config->recentFiles())
+	for (const QVariant& it : config.recentFiles())
 	{
 		QString file = it.toString();
 		QAction* recent = new QAction (GetIcon ("open-recent"), file, this);
@@ -252,7 +252,7 @@
 {
 	QList<ColorToolbarItem> colors;
 
-	for (QString colorname : Config->quickColorToolbar().split (":"))
+	for (QString colorname : config.quickColorToolbar().split (":"))
 	{
 		if (colorname == "|")
 			colors << ColorToolbarItem::makeSeparator();
@@ -306,7 +306,7 @@
 void MainWindow::updateGridToolBar()
 {
 	// Ensure that the current grid - and only the current grid - is selected.
-	int grid = Config->grid();
+	int grid = config.grid();
 	ui.actionGridCoarse->setChecked (grid == Grid::Coarse);
 	ui.actionGridMedium->setChecked (grid == Grid::Medium);
 	ui.actionGridFine->setChecked (grid == Grid::Fine);
@@ -481,7 +481,7 @@
 			item->setBackground (QColor ("#AA0000"));
 			item->setForeground (QColor ("#FFAA00"));
 		}
-		else if (Config->colorizeObjectsList()
+		else if (config.colorizeObjectsList()
 			and obj->isColored()
 			and obj->color().isValid()
 			and obj->color() != MainColor
@@ -714,7 +714,7 @@
 	}
 
 	// Save the configuration before leaving.
-	Config->setHiddenToolbars (hiddenToolbars);
+	config.setHiddenToolbars (hiddenToolbars);
 	syncSettings();
 	ev->accept();
 }
@@ -1040,14 +1040,14 @@
 		ui.actionRedo->setEnabled (pos < (long) his->size() - 1);
 	}
 
-	ui.actionWireframe->setChecked (Config->drawWireframe());
-	ui.actionAxes->setChecked (Config->drawAxes());
-	ui.actionBfcView->setChecked (Config->bfcRedGreenView());
-	ui.actionRandomColors->setChecked (Config->randomColors());
-	ui.actionDrawAngles->setChecked (Config->drawAngles());
-	ui.actionDrawSurfaces->setChecked (Config->drawSurfaces());
-	ui.actionDrawEdgeLines->setChecked (Config->drawEdgeLines());
-	ui.actionDrawConditionalLines->setChecked (Config->drawConditionalLines());
+	ui.actionWireframe->setChecked (config.drawWireframe());
+	ui.actionAxes->setChecked (config.drawAxes());
+	ui.actionBfcView->setChecked (config.bfcRedGreenView());
+	ui.actionRandomColors->setChecked (config.randomColors());
+	ui.actionDrawAngles->setChecked (config.drawAngles());
+	ui.actionDrawSurfaces->setChecked (config.drawSurfaces());
+	ui.actionDrawEdgeLines->setChecked (config.drawEdgeLines());
+	ui.actionDrawConditionalLines->setChecked (config.drawConditionalLines());
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -1202,7 +1202,7 @@
 //
 QVariant MainWindow::getConfigValue (QString name)
 {
-	QVariant value = m_settings->value (name, Config->defaultValueByName (name));
+	QVariant value = m_settings->value (name, config.defaultValueByName (name));
 	return value;
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/matrixinput.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -0,0 +1,7 @@
+#include "matrixinput.h"
+
+MatrixInput::MatrixInput(QWidget *parent) :
+	QWidget(parent)
+{
+	setupUi(this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/matrixinput.h	Thu Jan 04 19:40:16 2018 +0200
@@ -0,0 +1,14 @@
+#ifndef MATRIXINPUT_H
+#define MATRIXINPUT_H
+
+#include "ui_matrixinput.h"
+
+class MatrixInput : public QWidget, private Ui::MatrixInput
+{
+	Q_OBJECT
+
+public:
+	explicit MatrixInput(QWidget *parent = 0);
+};
+
+#endif // MATRIXINPUT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/matrixinput.ui	Thu Jan 04 19:40:16 2018 +0200
@@ -0,0 +1,21 @@
+<ui version="4.0">
+ <author/>
+ <comment/>
+ <exportmacro/>
+ <class>MatrixInput</class>
+ <widget class="QWidget" name="MatrixInput">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+ </widget>
+ <pixmapfunction/>
+ <connections/>
+</ui>
--- a/src/miscallenous.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/miscallenous.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -100,11 +100,11 @@
 
 float gridCoordinateSnap()
 {
-	switch (Config->grid())
+	switch (config.grid())
 	{
-	case Grid::Coarse: return Config->gridCoarseCoordinateSnap();
-	case Grid::Medium: return Config->gridMediumCoordinateSnap();
-	case Grid::Fine: return Config->gridFineCoordinateSnap();
+	case Grid::Coarse: return config.gridCoarseCoordinateSnap();
+	case Grid::Medium: return config.gridMediumCoordinateSnap();
+	case Grid::Fine: return config.gridFineCoordinateSnap();
 	}
 
 	return 1.0f;
@@ -112,11 +112,11 @@
 
 float gridAngleSnap()
 {
-	switch (Config->grid())
+	switch (config.grid())
 	{
-	case Grid::Coarse: return Config->gridCoarseAngleSnap();
-	case Grid::Medium: return Config->gridMediumAngleSnap();
-	case Grid::Fine: return Config->gridFineAngleSnap();
+	case Grid::Coarse: return config.gridCoarseAngleSnap();
+	case Grid::Medium: return config.gridMediumAngleSnap();
+	case Grid::Fine: return config.gridFineAngleSnap();
 	}
 
 	return 45.0f;
@@ -124,12 +124,12 @@
 
 float gridBezierCurveSegments()
 {
-	switch (Config->grid())
+	switch (config.grid())
 	{
 	default:
-	case Grid::Coarse: return Config->gridCoarseBezierCurveSegments();
-	case Grid::Medium: return Config->gridMediumBezierCurveSegments();
-	case Grid::Fine: return Config->gridFineBezierCurveSegments();
+	case Grid::Coarse: return config.gridCoarseBezierCurveSegments();
+	case Grid::Medium: return config.gridMediumBezierCurveSegments();
+	case Grid::Fine: return config.gridFineBezierCurveSegments();
 	}
 }
 
@@ -184,7 +184,7 @@
 //
 Vertex GetRotationPoint (const LDObjectList& objs)
 {
-	switch (RotationPoint (Config->rotationPointType()))
+	switch (RotationPoint (config.rotationPointType()))
 	{
 	case RotationPoint::ObjectOrigin:
 		{
@@ -206,7 +206,7 @@
 		return Origin;
 
 	case RotationPoint::CustomPoint:
-		return Config->customRotationPoint();
+		return config.customRotationPoint();
 
 	case RotationPoint::NumValues:
 		break;
@@ -223,7 +223,7 @@
 	Ui::RotPointUI ui;
 	ui.setupUi (dlg);
 
-	switch (RotationPoint (Config->rotationPointType()))
+	switch (RotationPoint (config.rotationPointType()))
 	{
 	case RotationPoint::ObjectOrigin:
 		ui.objectPoint->setChecked (true);
@@ -241,7 +241,7 @@
 		break;
 	}
 
-	Vertex custompoint = Config->customRotationPoint();
+	Vertex custompoint = config.customRotationPoint();
 	ui.customX->setValue (custompoint.x());
 	ui.customY->setValue (custompoint.y());
 	ui.customZ->setValue (custompoint.z());
@@ -249,7 +249,7 @@
 	if (not dlg->exec())
 		return;
 
-	Config->setRotationPointType (int (
+	config.setRotationPointType (int (
 		(ui.objectPoint->isChecked()) ? RotationPoint::ObjectOrigin :
 		(ui.worldPoint->isChecked())  ? RotationPoint::WorldOrigin :
 		RotationPoint::CustomPoint));
@@ -257,7 +257,7 @@
 	custompoint.setX (ui.customX->value());
 	custompoint.setY (ui.customY->value());
 	custompoint.setZ (ui.customZ->value());
-	Config->setCustomRotationPoint (custompoint);
+	config.setCustomRotationPoint (custompoint);
 }
 
 // =============================================================================
--- a/src/partdownloader.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/partdownloader.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -74,7 +74,7 @@
 		if (path.isEmpty())
 			reject();
 		else
-			Config->setDownloadFilePath (path);
+			config.setDownloadFilePath (path);
 	}
 }
 
@@ -103,7 +103,7 @@
 	dest = dest.simplified();
 
 	// If the user doesn't want us to guess, stop right here.
-	if (not Config->guessDownloadPaths())
+	if (not config.guessDownloadPaths())
 		return;
 
 	// Ensure .dat extension
@@ -271,7 +271,7 @@
 	for (LDDocument* f : m_files)
 		f->reloadAllSubfiles();
 
-	if (Config->autoCloseDownloadDialog() and not failed)
+	if (config.autoCloseDownloadDialog() and not failed)
 	{
 		// Close automatically if desired.
 		accept();
@@ -323,7 +323,7 @@
 
 QString PartDownloader::downloadPath()
 {
-	QString path = Config->downloadFilePath();
+	QString path = config.downloadFilePath();
 
 	if (DIRSLASH[0] != '/')
 		path.replace (DIRSLASH, "/");
--- a/src/primitives.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/primitives.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -625,10 +625,10 @@
 	QString author = APPNAME;
 	QString license = "";
 
-	if (not Config->defaultName().isEmpty())
+	if (not config.defaultName().isEmpty())
 	{
 		license = PreferredLicenseText();
-		author = format ("%1 [%2]", Config->defaultName(), Config->defaultUser());
+		author = format ("%1 [%2]", config.defaultName(), config.defaultUser());
 	}
 
 	LDObjectList objs;
--- a/src/toolsets/algorithmtoolset.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/toolsets/algorithmtoolset.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -161,12 +161,12 @@
 
 			v.apply ([&](Axis, double& a)
 			{
-				RoundToDecimals (a, Config->roundPositionPrecision());
+				RoundToDecimals (a, config.roundPositionPrecision());
 			});
 
 			ApplyToMatrix (t, [&](int, double& a)
 			{
-				RoundToDecimals (a, Config->roundMatrixPrecision());
+				RoundToDecimals (a, config.roundMatrixPrecision());
 			});
 
 			mo->setPosition (v);
@@ -180,7 +180,7 @@
 				Vertex v = obj->vertex (i);
 				v.apply ([&](Axis, double& a)
 				{
-					RoundToDecimals (a, Config->roundPositionPrecision());
+					RoundToDecimals (a, config.roundPositionPrecision());
 				});
 				obj->setVertex (i, v);
 				num += 3;
@@ -258,6 +258,38 @@
 
 	for (LDObject* obj : selectedObjects())
 	{
+        LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj);
+
+		if (mo)
+		{
+            Matrix transformationMatrix = mo->transform();
+            if (sel.contains(X))
+            {
+                transformationMatrix[0] *= -1;
+                transformationMatrix[1] *= -1;
+                transformationMatrix[2] *= -1;
+            }
+            if (sel.contains(Y))
+            {
+                transformationMatrix[3] *= -1;
+                transformationMatrix[4] *= -1;
+                transformationMatrix[5] *= -1;
+            }
+            if (sel.contains(Z))
+            {
+                transformationMatrix[6] *= -1;
+                transformationMatrix[7] *= -1;
+                transformationMatrix[8] *= -1;
+            }
+            mo->setTransform(transformationMatrix);
+            Vertex position = mo->position();
+			position.apply ([&](Axis ax, double& a)
+			{
+				if (sel.contains (ax))
+					a = -a;
+			});
+            mo->setPosition(position);
+        }
 		for (int i = 0; i < obj->numVertices(); ++i)
 		{
 			Vertex v = obj->vertex (i);
@@ -270,6 +302,8 @@
 
 			obj->setVertex (i, v);
 		}
+		if (not mo and sel.size() % 2 == 1)
+            obj->invert();
 	}
 }
 
@@ -333,7 +367,7 @@
 	QDialog* dlg = new QDialog;
 	Ui_AddHistoryLine* ui = new Ui_AddHistoryLine;
 	ui->setupUi (dlg);
-	ui->m_username->setText (Config->defaultUser());
+	ui->m_username->setText (config.defaultUser());
 	ui->m_date->setDate (QDate::currentDate());
 	ui->m_comment->setFocus();
 
@@ -378,12 +412,12 @@
 {
 	bool ok;
 	int segments = QInputDialog::getInt (m_window, APPNAME, "Amount of segments:",
-		Config->splitLinesSegments(), 0, std::numeric_limits<int>::max(), 1, &ok);
+		config.splitLinesSegments(), 0, std::numeric_limits<int>::max(), 1, &ok);
 
 	if (not ok)
 		return;
 
-	Config->setSplitLinesSegments (segments);
+	config.setSplitLinesSegments (segments);
 
 	for (LDObject* obj : selectedObjects())
 	{
@@ -544,7 +578,7 @@
 	LDObjectList objs;
 	objs << LDSpawn<LDComment> (subtitle);
 	objs << LDSpawn<LDComment> ("Name: "); // This gets filled in when the subfile is saved
-	objs << LDSpawn<LDComment> (format ("Author: %1 [%2]", Config->defaultName(), Config->defaultUser()));
+	objs << LDSpawn<LDComment> (format ("Author: %1 [%2]", config.defaultName(), config.defaultUser()));
 	objs << LDSpawn<LDComment> ("!LDRAW_ORG Unofficial_Subpart");
 
 	if (not license.isEmpty())
--- a/src/toolsets/filetoolset.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/toolsets/filetoolset.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -98,10 +98,10 @@
 
 void FileToolset::setLDrawPath()
 {
-	LDrawPathDialog* dialog = new LDrawPathDialog (Config->lDrawPath(), true);
+	LDrawPathDialog* dialog = new LDrawPathDialog (config.lDrawPath(), true);
 
 	if (dialog->exec())
-		Config->setLDrawPath (dialog->path());
+		config.setLDrawPath (dialog->path());
 }
 
 void FileToolset::exit()
--- a/src/toolsets/movetoolset.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/toolsets/movetoolset.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -44,19 +44,19 @@
 
 void MoveToolset::gridCoarse()
 {
-	Config->setGrid (Grid::Coarse);
+	config.setGrid (Grid::Coarse);
 	m_window->updateGridToolBar();
 }
 
 void MoveToolset::gridMedium()
 {
-	Config->setGrid (Grid::Medium);
+	config.setGrid (Grid::Medium);
 	m_window->updateGridToolBar();
 }
 
 void MoveToolset::gridFine()
 {
-	Config->setGrid (Grid::Fine);
+	config.setGrid (Grid::Fine);
 	m_window->updateGridToolBar();
 }
 
--- a/src/toolsets/viewtoolset.cpp	Thu Jan 04 19:24:40 2018 +0200
+++ b/src/toolsets/viewtoolset.cpp	Thu Jan 04 19:40:16 2018 +0200
@@ -126,7 +126,7 @@
 
 void ViewToolset::axes()
 {
-	Config->setDrawAxes (not Config->drawAxes());
+	config.setDrawAxes (not config.drawAxes());
 	m_window->updateActions();
 	m_window->renderer()->update();
 }
@@ -151,7 +151,7 @@
 
 void ViewToolset::wireframe()
 {
-	Config->setDrawWireframe (not Config->drawWireframe());
+	config.setDrawWireframe (not config.drawWireframe());
 	m_window->renderer()->refresh();
 }
 
@@ -173,7 +173,7 @@
 
 void ViewToolset::drawAngles()
 {
-	Config->setDrawAngles (not Config->drawAngles());
+	config.setDrawAngles (not config.drawAngles());
 	m_window->renderer()->refresh();
 }
 
@@ -242,10 +242,10 @@
 
 void ViewToolset::bfcView()
 {
-	Config->setBfcRedGreenView (not Config->bfcRedGreenView());
+	config.setBfcRedGreenView (not config.bfcRedGreenView());
 
-	if (Config->bfcRedGreenView())
-		Config->setRandomColors (false);
+	if (config.bfcRedGreenView())
+		config.setRandomColors (false);
 
 	m_window->updateActions();
 	m_window->renderer()->refresh();
@@ -273,10 +273,10 @@
 
 void ViewToolset::randomColors()
 {
-	Config->setRandomColors (not Config->randomColors());
+	config.setRandomColors (not config.randomColors());
 
-	if (Config->randomColors())
-		Config->setBfcRedGreenView (false);
+	if (config.randomColors())
+		config.setBfcRedGreenView (false);
 
 	m_window->updateActions();
 	m_window->renderer()->refresh();
@@ -284,18 +284,18 @@
 
 void ViewToolset::drawSurfaces()
 {
-	Config->setDrawSurfaces (not Config->drawSurfaces());
+	config.setDrawSurfaces (not config.drawSurfaces());
 	m_window->updateActions();
 }
 
 void ViewToolset::drawEdgeLines()
 {
-	Config->setDrawEdgeLines (not Config->drawEdgeLines());
+	config.setDrawEdgeLines (not config.drawEdgeLines());
 	m_window->updateActions();
 }
 
 void ViewToolset::drawConditionalLines()
 {
-	Config->setDrawConditionalLines (not Config->drawConditionalLines());
+	config.setDrawConditionalLines (not config.drawConditionalLines());
 	m_window->updateActions();
 }
\ No newline at end of file

mercurial