src/toolsets/basictoolset.cpp

changeset 1217
314e12e23c3a
parent 1011
4fdd74a04790
child 1222
34def2630300
--- a/src/toolsets/basictoolset.cpp	Thu Jan 04 19:40:52 2018 +0200
+++ b/src/toolsets/basictoolset.cpp	Thu Jan 04 19:44:26 2018 +0200
@@ -31,8 +31,8 @@
 #include "../dialogs/colorselector.h"
 #include "basictoolset.h"
 
-BasicToolset::BasicToolset (MainWindow *parent) :
-	Toolset (parent) {}
+BasicToolset::BasicToolset(MainWindow *parent) :
+	Toolset(parent) {}
 
 int BasicToolset::copyToClipboard()
 {
@@ -50,7 +50,7 @@
 		++count;
 	}
 
-	qApp->clipboard()->setText (data);
+	qApp->clipboard()->setText(data);
 	return count;
 }
 
@@ -58,13 +58,13 @@
 {
 	int num = copyToClipboard();
 	m_window->deleteSelection();
-	print (tr ("%1 objects cut"), num);
+	print(tr("%1 objects cut"), num);
 }
 
 void BasicToolset::copy()
 {
 	int num = copyToClipboard();
-	print (tr ("%1 objects copied"), num);
+	print(tr("%1 objects copied"), num);
 }
 
 void BasicToolset::paste()
@@ -74,15 +74,15 @@
 	currentDocument()->clearSelection();
 	int num = 0;
 
-	for (QString line : clipboardText.split ("\n"))
+	for (QString line : clipboardText.split("\n"))
 	{
-		LDObject* pasted = ParseLine (line);
-		currentDocument()->insertObj (idx++, pasted);
+		LDObject* pasted = ParseLine(line);
+		currentDocument()->insertObj(idx++, pasted);
 		pasted->select();
 		++num;
 	}
 
-	print (tr ("%1 objects pasted"), num);
+	print(tr("%1 objects pasted"), num);
 	m_window->refresh();
 	m_window->scrollToSelection();
 }
@@ -90,12 +90,12 @@
 void BasicToolset::remove()
 {
 	int num = m_window->deleteSelection();
-	print (tr ("%1 objects deleted"), num);
+	print(tr("%1 objects deleted"), num);
 }
 
-void BasicToolset::doInline (bool deep)
+void BasicToolset::doInline(bool deep)
 {
-	for (LDSubfileReference* ref : filterByType<LDSubfileReference> (selectedObjects()))
+	for (LDSubfileReference* ref : filterByType<LDSubfileReference>(selectedObjects()))
 	{
 		// Get the index of the subfile so we know where to insert the
 		// inlined contents.
@@ -103,15 +103,15 @@
 
 		if (idx != -1)
 		{
-			LDObjectList objs = ref->inlineContents (deep, false);
+			LDObjectList objs = ref->inlineContents(deep, false);
 	
 			// Merge in the inlined objects
 			for (LDObject* inlineobj : objs)
 			{
 				QString line = inlineobj->asText();
 				inlineobj->destroy();
-				LDObject* newobj = ParseLine (line);
-				currentDocument()->insertObj (idx++, newobj);
+				LDObject* newobj = ParseLine(line);
+				currentDocument()->insertObj(idx++, newobj);
 				newobj->select();
 			}
 	
@@ -120,18 +120,18 @@
 		}
 	}
 
-	for (LDBezierCurve* curve : filterByType<LDBezierCurve> (selectedObjects()))
-		curve->replace (curve->rasterize());
+	for (LDBezierCurve* curve : filterByType<LDBezierCurve>(selectedObjects()))
+		curve->replace(curve->rasterize());
 }
 
 void BasicToolset::inlineShallow()
 {
-	doInline (false);
+	doInline(false);
 }
 
 void BasicToolset::inlineDeep()
 {
-	doInline (true);
+	doInline(true);
 }
 
 void BasicToolset::undo()
@@ -153,11 +153,11 @@
 		if (not obj->isColored())
 			continue;
 
-		obj->setColor (obj->defaultColor());
+		obj->setColor(obj->defaultColor());
 		num++;
 	}
 
-	print (tr ("%1 objects uncolored"), num);
+	print(tr("%1 objects uncolored"), num);
 }
 
 void BasicToolset::insertRaw()
@@ -167,25 +167,25 @@
 	QDialog* const dlg = new QDialog;
 	QVBoxLayout* const layout = new QVBoxLayout;
 	QTextEdit* const inputbox = new QTextEdit;
-	QDialogButtonBox* const buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+	QDialogButtonBox* const buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
 
-	layout->addWidget (inputbox);
-	layout->addWidget (buttons);
-	dlg->setLayout (layout);
-	dlg->setWindowTitle (APPNAME " - Insert Raw");
-	dlg->connect (buttons, SIGNAL (accepted()), dlg, SLOT (accept()));
-	dlg->connect (buttons, SIGNAL (rejected()), dlg, SLOT (reject()));
+	layout->addWidget(inputbox);
+	layout->addWidget(buttons);
+	dlg->setLayout(layout);
+	dlg->setWindowTitle(APPNAME " - Insert Raw");
+	dlg->connect(buttons, SIGNAL(accepted()), dlg, SLOT(accept()));
+	dlg->connect(buttons, SIGNAL(rejected()), dlg, SLOT(reject()));
 
 	if (dlg->exec() == QDialog::Rejected)
 		return;
 
 	currentDocument()->clearSelection();
 
-	for (QString line : QString (inputbox->toPlainText()).split ("\n"))
+	for (QString line : QString(inputbox->toPlainText()).split("\n"))
 	{
-		LDObject* obj = ParseLine (line);
+		LDObject* obj = ParseLine(line);
 
-		currentDocument()->insertObj (idx, obj);
+		currentDocument()->insertObj(idx, obj);
 		obj->select();
 		idx++;
 	}
@@ -207,12 +207,12 @@
 	LDColor defaultcol = m_window->getUniformSelectedColor();
 
 	// Show the dialog to the user now and ask for a color.
-	if (ColorSelector::selectColor (m_window, color, defaultcol))
+	if (ColorSelector::selectColor(m_window, color, defaultcol))
 	{
 		for (LDObject* obj : objs)
 		{
 			if (obj->isColored())
-				obj->setColor (color);
+				obj->setColor(color);
 		}
 	}
 }
@@ -225,37 +225,37 @@
 
 void BasicToolset::newSubfile()
 {
-	AddObjectDialog::staticDialog (OBJ_SubfileReference, nullptr);
+	AddObjectDialog::staticDialog(OBJ_SubfileReference, nullptr);
 }
 
 void BasicToolset::newLine()
 {
-	AddObjectDialog::staticDialog (OBJ_Line, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Line, nullptr);
 }
 
 void BasicToolset::newTriangle()
 {
-	AddObjectDialog::staticDialog (OBJ_Triangle, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Triangle, nullptr);
 }
 
 void BasicToolset::newQuadrilateral()
 {
-	AddObjectDialog::staticDialog (OBJ_Quad, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Quad, nullptr);
 }
 
 void BasicToolset::newConditionalLine()
 {
-	AddObjectDialog::staticDialog (OBJ_CondLine, nullptr);
+	AddObjectDialog::staticDialog(OBJ_CondLine, nullptr);
 }
 
 void BasicToolset::newComment()
 {
-	AddObjectDialog::staticDialog (OBJ_Comment, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Comment, nullptr);
 }
 
 void BasicToolset::newBFC()
 {
-	AddObjectDialog::staticDialog (OBJ_Bfc, nullptr);
+	AddObjectDialog::staticDialog(OBJ_Bfc, nullptr);
 }
 
 void BasicToolset::edit()
@@ -264,40 +264,40 @@
 		return;
 
 	LDObject* obj = selectedObjects().first();
-	AddObjectDialog::staticDialog (obj->type(), obj);
+	AddObjectDialog::staticDialog(obj->type(), obj);
 }
 
 void BasicToolset::modeSelect()
 {
-	m_window->renderer()->setEditMode (EditModeType::Select);
+	m_window->renderer()->setEditMode(EditModeType::Select);
 }
 
 void BasicToolset::modeCurve()
 {
-	m_window->renderer()->setEditMode (EditModeType::Curve);
+	m_window->renderer()->setEditMode(EditModeType::Curve);
 }
 
 void BasicToolset::modeDraw()
 {
-	m_window->renderer()->setEditMode (EditModeType::Draw);
+	m_window->renderer()->setEditMode(EditModeType::Draw);
 }
 
 void BasicToolset::modeRectangle()
 {
-	m_window->renderer()->setEditMode (EditModeType::Rectangle);
+	m_window->renderer()->setEditMode(EditModeType::Rectangle);
 }
 
 void BasicToolset::modeCircle()
 {
-	m_window->renderer()->setEditMode (EditModeType::Circle);
+	m_window->renderer()->setEditMode(EditModeType::Circle);
 }
 
 void BasicToolset::modeMagicWand()
 {
- 	m_window->renderer()->setEditMode (EditModeType::MagicWand);
+ 	m_window->renderer()->setEditMode(EditModeType::MagicWand);
 }
 
 void BasicToolset::modeLinePath()
 {
-	m_window->renderer()->setEditMode (EditModeType::LinePath);
+	m_window->renderer()->setEditMode(EditModeType::LinePath);
 }
\ No newline at end of file

mercurial