diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 3b339bff4..7d6562911 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -405,6 +405,9 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj) // cycling to all views of the document ViewProvider* viewProvider = getViewProvider(&Obj); +#if 0 // With this we can show child objects again if this method was called by undo + viewProvider->onDelete(std::vector()); +#endif if (viewProvider && viewProvider->getTypeId().isDerivedFrom (ViewProviderDocumentObject::getClassTypeId())) { // go through the views diff --git a/src/Mod/Part/Gui/ViewProviderBoolean.cpp b/src/Mod/Part/Gui/ViewProviderBoolean.cpp index d73afe296..74aadfad5 100644 --- a/src/Mod/Part/Gui/ViewProviderBoolean.cpp +++ b/src/Mod/Part/Gui/ViewProviderBoolean.cpp @@ -142,6 +142,26 @@ void ViewProviderBoolean::updateData(const App::Property* prop) this->DiffuseColor.setValues(colBool); } } + else if (prop->getTypeId() == App::PropertyLink::getClassTypeId()) { + App::DocumentObject *pBase = static_cast(prop)->getValue(); + if (pBase) + Gui::Application::Instance->hideViewProvider(pBase); + } +} + +bool ViewProviderBoolean::onDelete(const std::vector &) +{ + // get the input shapes + Part::Boolean* pBool = static_cast(getObject()); + App::DocumentObject *pBase = pBool->Base.getValue(); + App::DocumentObject *pTool = pBool->Tool.getValue(); + + if (pBase) + Gui::Application::Instance->showViewProvider(pBase); + if (pTool) + Gui::Application::Instance->showViewProvider(pTool); + + return true; } PROPERTY_SOURCE(PartGui::ViewProviderMultiFuse,PartGui::ViewProviderPart) @@ -207,6 +227,26 @@ void ViewProviderMultiFuse::updateData(const App::Property* prop) if (setColor) this->DiffuseColor.setValues(colBool); } + else if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) { + std::vector pShapes = static_cast(prop)->getValues(); + for (std::vector::iterator it = pShapes.begin(); it != pShapes.end(); ++it) { + if (*it) + Gui::Application::Instance->hideViewProvider(*it); + } + } +} + +bool ViewProviderMultiFuse::onDelete(const std::vector &) +{ + // get the input shapes + Part::MultiFuse* pBool = static_cast(getObject()); + std::vector pShapes = pBool->Shapes.getValues(); + for (std::vector::iterator it = pShapes.begin(); it != pShapes.end(); ++it) { + if (*it) + Gui::Application::Instance->showViewProvider(*it); + } + + return true; } @@ -273,4 +313,24 @@ void ViewProviderMultiCommon::updateData(const App::Property* prop) if (setColor) this->DiffuseColor.setValues(colBool); } + else if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) { + std::vector pShapes = static_cast(prop)->getValues(); + for (std::vector::iterator it = pShapes.begin(); it != pShapes.end(); ++it) { + if (*it) + Gui::Application::Instance->hideViewProvider(*it); + } + } +} + +bool ViewProviderMultiCommon::onDelete(const std::vector &) +{ + // get the input shapes + Part::MultiCommon* pBool = static_cast(getObject()); + std::vector pShapes = pBool->Shapes.getValues(); + for (std::vector::iterator it = pShapes.begin(); it != pShapes.end(); ++it) { + if (*it) + Gui::Application::Instance->showViewProvider(*it); + } + + return true; } diff --git a/src/Mod/Part/Gui/ViewProviderBoolean.h b/src/Mod/Part/Gui/ViewProviderBoolean.h index 29c531109..04a409f81 100644 --- a/src/Mod/Part/Gui/ViewProviderBoolean.h +++ b/src/Mod/Part/Gui/ViewProviderBoolean.h @@ -43,6 +43,7 @@ public: std::vector claimChildren(void) const; QIcon getIcon(void) const; void updateData(const App::Property*); + bool onDelete(const std::vector &); }; /// ViewProvider for the MultiFuse feature @@ -60,6 +61,7 @@ public: std::vector claimChildren(void) const; QIcon getIcon(void) const; void updateData(const App::Property*); + bool onDelete(const std::vector &); }; /// ViewProvider for the MultiFuse feature @@ -77,6 +79,7 @@ public: std::vector claimChildren(void) const; QIcon getIcon(void) const; void updateData(const App::Property*); + bool onDelete(const std::vector &); }; diff --git a/src/Mod/Part/Gui/ViewProviderMirror.cpp b/src/Mod/Part/Gui/ViewProviderMirror.cpp index fa32a921d..841fb402b 100644 --- a/src/Mod/Part/Gui/ViewProviderMirror.cpp +++ b/src/Mod/Part/Gui/ViewProviderMirror.cpp @@ -243,6 +243,17 @@ std::vector ViewProviderFillet::claimChildren() const return temp; } +bool ViewProviderFillet::onDelete(const std::vector &) +{ + // get the input shape + Part::Fillet* pFillet = static_cast(getObject()); + App::DocumentObject *pBase = pFillet->Base.getValue(); + if (pBase) + Gui::Application::Instance->showViewProvider(pBase); + + return true; +} + // --------------------------------------- PROPERTY_SOURCE(PartGui::ViewProviderChamfer, PartGui::ViewProviderPart) @@ -296,6 +307,17 @@ std::vector ViewProviderChamfer::claimChildren() const return temp; } +bool ViewProviderChamfer::onDelete(const std::vector &) +{ + // get the input shape + Part::Chamfer* pChamfer = static_cast(getObject()); + App::DocumentObject *pBase = pChamfer->Base.getValue(); + if (pBase) + Gui::Application::Instance->showViewProvider(pBase); + + return true; +} + // --------------------------------------- PROPERTY_SOURCE(PartGui::ViewProviderRevolution, PartGui::ViewProviderPart) @@ -315,3 +337,14 @@ std::vector ViewProviderRevolution::claimChildren() const temp.push_back(static_cast(getObject())->Source.getValue()); return temp; } + +bool ViewProviderRevolution::onDelete(const std::vector &) +{ + // get the input shape + Part::Revolution* pRevolve = static_cast(getObject()); + App::DocumentObject *pBase = pRevolve->Source.getValue(); + if (pBase) + Gui::Application::Instance->showViewProvider(pBase); + + return true; +} diff --git a/src/Mod/Part/Gui/ViewProviderMirror.h b/src/Mod/Part/Gui/ViewProviderMirror.h index 603bedeac..7e282b01a 100644 --- a/src/Mod/Part/Gui/ViewProviderMirror.h +++ b/src/Mod/Part/Gui/ViewProviderMirror.h @@ -64,6 +64,7 @@ public: //@{ void setupContextMenu(QMenu*, QObject*, const char*); std::vector claimChildren() const; + bool onDelete(const std::vector &); protected: bool setEdit(int ModNum); @@ -84,6 +85,7 @@ public: //@{ void setupContextMenu(QMenu*, QObject*, const char*); std::vector claimChildren() const; + bool onDelete(const std::vector &); protected: bool setEdit(int ModNum); @@ -103,6 +105,7 @@ public: /// grouping handling std::vector claimChildren(void)const; + bool onDelete(const std::vector &); }; } // namespace PartGui