diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index fcfe3706ee..cc1953694f 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -755,8 +755,7 @@ void DocumentObject::onBeforeChange(const Property* prop) signalBeforeChange(*this,*prop); } -/// get called by the container when a Property was changed -void DocumentObject::onChanged(const Property* prop) +void DocumentObject::onEarlyChange(const Property *prop) { if(GetApplication().isClosingAll()) return; @@ -774,6 +773,15 @@ void DocumentObject::onChanged(const Property* prop) } } + signalEarlyChanged(*this, *prop); +} + +/// get called by the container when a Property was changed +void DocumentObject::onChanged(const Property* prop) +{ + if(GetApplication().isClosingAll()) + return; + // Delay signaling view provider until the document object has handled the // change // if (_pDoc) diff --git a/src/App/DocumentObject.h b/src/App/DocumentObject.h index 33eab1608e..9302f56cb7 100644 --- a/src/App/DocumentObject.h +++ b/src/App/DocumentObject.h @@ -110,6 +110,8 @@ public: boost::signals2::signal signalBeforeChange; /// signal on changed property of this object boost::signals2::signal signalChanged; + /// signal on changed property of this object before document scoped signalChangedObject + boost::signals2::signal signalEarlyChanged; /// returns the type name of the ViewProvider virtual const char* getViewProviderName(void) const { @@ -601,6 +603,8 @@ protected: virtual void onBeforeChange(const Property* prop) override; /// get called by the container when a property was changed virtual void onChanged(const Property* prop) override; + /// get called by the container when a property was changed + virtual void onEarlyChange(const Property* prop) override; /// get called after a document has been fully restored virtual void onDocumentRestored(); /// get called after an undo/redo transaction is finished diff --git a/src/App/Property.cpp b/src/App/Property.cpp index 460c08ca7b..7f6a4e3a46 100644 --- a/src/App/Property.cpp +++ b/src/App/Property.cpp @@ -28,15 +28,17 @@ #endif #include +#include #include #include #include +#include "Application.h" +#include "DocumentObject.h" #include "Property.h" #include "ObjectIdentifier.h" #include "PropertyContainer.h" - using namespace App; @@ -230,10 +232,15 @@ void Property::destroy(Property *p) { void Property::touch() { + if(GetApplication().isClosingAll()) + return; + PropertyCleaner guard(this); - if (father) - father->onChanged(this); StatusBits.set(Touched); + if (getName() && father) { + father->onEarlyChange(this); + father->onChanged(this); + } } void Property::setReadOnly(bool readOnly) diff --git a/src/App/PropertyContainer.h b/src/App/PropertyContainer.h index 19670d973e..34c4b3256e 100644 --- a/src/App/PropertyContainer.h +++ b/src/App/PropertyContainer.h @@ -249,6 +249,11 @@ public: protected: + /** get called by the container when a property has changed + * + * This function is called before onChanged() + */ + virtual void onEarlyChange(const Property* /*prop*/){} /// get called by the container when a property has changed virtual void onChanged(const Property* /*prop*/){} /// get called before the value is changed