From 2fd81006ea5fc0365e5f83f23034249d75be7a9d Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 1 Dec 2021 23:24:16 +0100 Subject: [PATCH] PD: fix build failure with C++20 --- src/Mod/PartDesign/Gui/Workbench.cpp | 19 ++++++++----------- src/Mod/PartDesign/Gui/Workbench.h | 13 +++++++------ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index 4ae7939dda..76f8cc1eda 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -452,22 +452,19 @@ void Workbench::activated() Gui::Control().showTaskView(); // Let us be notified when a document is activated, so that we can update the ActivePartObject - Gui::Application::Instance->signalActiveDocument.connect(boost::bind(&Workbench::slotActiveDocument, this, bp::_1)); - App::GetApplication().signalNewDocument.connect(boost::bind(&Workbench::slotNewDocument, this, bp::_1)); - App::GetApplication().signalFinishRestoreDocument.connect(boost::bind(&Workbench::slotFinishRestoreDocument, this, bp::_1)); - App::GetApplication().signalDeleteDocument.connect(boost::bind(&Workbench::slotDeleteDocument, this, bp::_1)); - // Watch out for objects being added to the active document, so that we can add them to the body - //App::GetApplication().signalNewObject.connect(boost::bind(&Workbench::slotNewObject, this, bp::_1)); + activeDoc = Gui::Application::Instance->signalActiveDocument.connect(boost::bind(&Workbench::slotActiveDocument, this, bp::_1)); + createDoc = App::GetApplication().signalNewDocument.connect(boost::bind(&Workbench::slotNewDocument, this, bp::_1)); + finishDoc = App::GetApplication().signalFinishRestoreDocument.connect(boost::bind(&Workbench::slotFinishRestoreDocument, this, bp::_1)); + deleteDoc = App::GetApplication().signalDeleteDocument.connect(boost::bind(&Workbench::slotDeleteDocument, this, bp::_1)); } void Workbench::deactivated() { // Let us be notified when a document is activated, so that we can update the ActivePartObject - Gui::Application::Instance->signalActiveDocument.disconnect(boost::bind(&Workbench::slotActiveDocument, this, bp::_1)); - App::GetApplication().signalNewDocument.disconnect(boost::bind(&Workbench::slotNewDocument, this, bp::_1)); - App::GetApplication().signalFinishRestoreDocument.disconnect(boost::bind(&Workbench::slotFinishRestoreDocument, this, bp::_1)); - App::GetApplication().signalDeleteDocument.disconnect(boost::bind(&Workbench::slotDeleteDocument, this, bp::_1)); - //App::GetApplication().signalNewObject.disconnect(boost::bind(&Workbench::slotNewObject, this, bp::_1)); + activeDoc.disconnect(); + createDoc.disconnect(); + finishDoc.disconnect(); + deleteDoc.disconnect(); removeTaskWatcher(); // reset the active Body diff --git a/src/Mod/PartDesign/Gui/Workbench.h b/src/Mod/PartDesign/Gui/Workbench.h index 382fab4e95..647bd6c54a 100644 --- a/src/Mod/PartDesign/Gui/Workbench.h +++ b/src/Mod/PartDesign/Gui/Workbench.h @@ -24,7 +24,9 @@ #ifndef PARTDESIGN_WORKBENCH_H #define PARTDESIGN_WORKBENCH_H +#include #include +#include namespace Gui { @@ -36,12 +38,6 @@ class ViewProviderDocumentObject; namespace PartDesignGui { -// pointer to the active assembly object -//extern PartDesign::Body *ActivePartObject; -//extern Gui::Document *ActiveGuiDoc; -//extern App::Document *ActiveAppDoc; -//extern Gui::ViewProviderDocumentObject *ActiveVp; - /** * @author Werner Mayer */ @@ -80,6 +76,11 @@ private: void _switchToDocument(const App::Document* doc); +private: + boost::signals2::connection activeDoc; + boost::signals2::connection createDoc; + boost::signals2::connection finishDoc; + boost::signals2::connection deleteDoc; }; } // namespace PartDesignGui