src/ldDocument.cpp

changeset 1231
ce0c9f2e6b9c
parent 1222
34def2630300
child 1232
7eb8b59577d0
--- a/src/ldDocument.cpp	Thu Jan 11 11:41:40 2018 +0200
+++ b/src/ldDocument.cpp	Thu Jan 11 15:09:44 2018 +0200
@@ -131,11 +131,10 @@
 	if (m_isCache)
 	{
 		m_isCache = false;
-		print("Opened %1", name());
 
 		// Cache files are not compiled by the GL renderer. Now that this file is open for editing, it needs to be
 		// compiled.
-		m_window->renderer()->compiler()->compileDocument(this);
+		m_window->currentRenderer()->compiler()->compileDocument(this);
 		m_window->updateDocumentList();
 	}
 }
@@ -177,10 +176,7 @@
 		m_isCache = true;
 		print("Closed %1", name());
 		m_window->updateDocumentList();
-
-		// If the current document just became implicit(i.e. user closed it), we need to get a new one to show.
-		if (currentDocument() == this)
-			m_window->currentDocumentClosed();
+		emit closed();
 	}
 }
 
@@ -599,7 +595,7 @@
 	m_objects << obj;
 	addKnownVertices(obj);
 	obj->setDocument(this);
-	m_window->renderer()->compileObject(obj);
+	m_window->currentRenderer()->compileObject(obj);
 	return getObjectCount() - 1;
 }
 
@@ -621,7 +617,7 @@
 	history()->add(new AddHistoryEntry(pos, obj));
 	m_objects.insert(pos, obj);
 	obj->setDocument(this);
-	m_window->renderer()->compileObject(obj);
+	m_window->currentRenderer()->compileObject(obj);
 	
 
 #ifdef DEBUG
@@ -686,7 +682,7 @@
 	m_objects[idx]->setDocument(nullptr);
 	obj->setDocument(this);
 	addKnownVertices(obj);
-	m_window->renderer()->compileObject(obj);
+	m_window->currentRenderer()->compileObject(obj);
 	m_objects[idx] = obj;
 	needVertexMerge();
 }
@@ -830,7 +826,7 @@
 	if (obj->isSelected() and obj->document() == this)
 	{
 		m_sel << obj;
-		m_window->renderer()->compileObject(obj);
+		m_window->currentRenderer()->compileObject(obj);
 	}
 }
 
@@ -841,7 +837,7 @@
 	if (not obj->isSelected() and obj->document() == this)
 	{
 		m_sel.removeOne(obj);
-		m_window->renderer()->compileObject(obj);
+		m_window->currentRenderer()->compileObject(obj);
 	}
 }
 
@@ -852,7 +848,7 @@
 	for (LDObject* obj : m_sel)
 	{
 		obj->deselect();
-		m_window->renderer()->compileObject(obj);
+		m_window->currentRenderer()->compileObject(obj);
 	}
 
 	m_sel.clear();
@@ -909,4 +905,4 @@
 void LDDocument::needVertexMerge()
 {
 	m_needVertexMerge = true;
-}
\ No newline at end of file
+}

mercurial