- fixed documentless objects being selected on document close

Sat, 06 Sep 2014 23:18:26 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 06 Sep 2014 23:18:26 +0300
changeset 880
5dcd2e741d1c
parent 879
c5b3bc08e609
child 881
82a9c3549db1

- fixed documentless objects being selected on document close

src/extPrograms.cc file | annotate | diff | comparison | revisions
src/ldDocument.cc file | annotate | diff | comparison | revisions
src/ldObject.cc file | annotate | diff | comparison | revisions
src/ldObject.h file | annotate | diff | comparison | revisions
--- a/src/extPrograms.cc	Sat Sep 06 20:40:58 2014 +0300
+++ b/src/extPrograms.cc	Sat Sep 06 23:18:26 2014 +0300
@@ -281,9 +281,9 @@
 	if (not err.isEmpty())
 	{
 		CriticalError (format ("%1 failed: %2\n", g_extProgNames[prog], err));
-
 		QString filename ("externalProgramOutput.txt");
 		QFile file (filename);
+
 		if (file.open (QIODevice::WriteOnly | QIODevice::Text))
 		{
 			file.write (proc.readAllStandardOutput());
@@ -295,6 +295,7 @@
 			print ("Couldn't open %1 for writing: %2",
 				QFileInfo (filename).absoluteFilePath(), file.errorString());
 		}
+
 		return false;
 	}
 
--- a/src/ldDocument.cc	Sat Sep 06 20:40:58 2014 +0300
+++ b/src/ldDocument.cc	Sat Sep 06 23:18:26 2014 +0300
@@ -159,6 +159,9 @@
 	if (IsExiting())
 		return;
 
+	for (LDObjectPtr obj : m_objects)
+		obj->setSelected (false);
+
 	g_allDocuments.removeOne (self());
 	m_flags |= DOCF_IsBeingDestroyed;
 	delete m_history;
--- a/src/ldObject.cc	Sat Sep 06 20:40:58 2014 +0300
+++ b/src/ldObject.cc	Sat Sep 06 23:18:26 2014 +0300
@@ -337,6 +337,16 @@
 
 // =============================================================================
 //
+void LDObject::setDocument (const LDDocumentWeakPtr& a)
+{
+	m_document = a;
+
+	if (a == null)
+		setSelected (false);
+}
+
+// =============================================================================
+//
 static void TransformObject (LDObjectPtr obj, Matrix transform, Vertex pos, LDColor parentcolor)
 {
 	switch (obj->type())
--- a/src/ldObject.h	Sat Sep 06 20:40:58 2014 +0300
+++ b/src/ldObject.h	Sat Sep 06 23:18:26 2014 +0300
@@ -95,7 +95,7 @@
 	PROPERTY (public,		bool,				isSelected,		setSelected,	STOCK_WRITE)
 	PROPERTY (public,		bool,				isDestructed,	setDestructed,	STOCK_WRITE)
 	PROPERTY (public,		LDObjectWeakPtr,	parent,			setParent,		STOCK_WRITE)
-	PROPERTY (public,		LDDocumentWeakPtr,	document,		setDocument,	STOCK_WRITE)
+	PROPERTY (public,		LDDocumentWeakPtr,	document,		setDocument,	CUSTOM_WRITE)
 	PROPERTY (private,		int32,				id,				setID,			STOCK_WRITE)
 	PROPERTY (public,		LDColor,			color,			setColor,		CUSTOM_WRITE)
 	PROPERTY (private,		QColor,				randomColor,	setRandomColor,	STOCK_WRITE)

mercurial