diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 953d593617..83dbb250c7 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -593,6 +593,7 @@ void Application::slotDeleteDocument(const App::Document& Doc) // We must clear the selection here to notify all observers Gui::Selection().clearSelection(doc->second->getDocument()->getName()); + doc->second->signalDeleteDocument(*doc->second); signalDeleteDocument(*doc->second); // If the active document gets destructed we must set it to 0. If there are further existing documents then the diff --git a/src/Gui/Document.h b/src/Gui/Document.h index 6a3268dfd6..f12ee307cf 100644 --- a/src/Gui/Document.h +++ b/src/Gui/Document.h @@ -118,6 +118,8 @@ public: mutable boost::signal signalUndoDocument; /// signal on redo Document mutable boost::signal signalRedoDocument; + /// signal on deleting Document + mutable boost::signal signalDeleteDocument; //@} /** @name I/O of the document */ diff --git a/src/Gui/DocumentObserver.cpp b/src/Gui/DocumentObserver.cpp index 4916ed4b66..5852d5a151 100644 --- a/src/Gui/DocumentObserver.cpp +++ b/src/Gui/DocumentObserver.cpp @@ -71,6 +71,8 @@ void DocumentObserver::attachDocument(Document* doc) (&DocumentObserver::slotUndoDocument, this, _1)); this->connectDocumentRedo = doc->signalRedoDocument.connect(boost::bind (&DocumentObserver::slotRedoDocument, this, _1)); + this->connectDocumentDelete = doc->signalDeleteDocument.connect(boost::bind + (&DocumentObserver::slotDeleteDocument, this, _1)); } void DocumentObserver::detachDocument() @@ -84,6 +86,7 @@ void DocumentObserver::detachDocument() this->connectDocumentResetObject.disconnect(); this->connectDocumentUndo.disconnect(); this->connectDocumentRedo.disconnect(); + this->connectDocumentDelete.disconnect(); } void DocumentObserver::enableNotifications(DocumentObserver::Notifications value) @@ -107,6 +110,10 @@ void DocumentObserver::slotRedoDocument(const Document& /*Doc*/) { } +void DocumentObserver::slotDeleteDocument(const Document& /*Doc*/) +{ +} + void DocumentObserver::slotCreatedObject(const ViewProviderDocumentObject& /*Obj*/) { } diff --git a/src/Gui/DocumentObserver.h b/src/Gui/DocumentObserver.h index b7b156a80d..083e789615 100644 --- a/src/Gui/DocumentObserver.h +++ b/src/Gui/DocumentObserver.h @@ -96,6 +96,8 @@ private: virtual void slotUndoDocument(const Document& Doc); /** Notifies on redo */ virtual void slotRedoDocument(const Document& Doc); + /** Notifies on deletion */ + virtual void slotDeleteDocument(const Document& Doc); private: typedef boost::BOOST_SIGNALS_NAMESPACE::scoped_connection Connection; @@ -108,6 +110,7 @@ private: Connection connectDocumentResetObject; Connection connectDocumentUndo; Connection connectDocumentRedo; + Connection connectDocumentDelete; }; } //namespace Gui