0000736: when object is deleted, auto show its parametric objects
This commit is contained in:
parent
e5b4f0028f
commit
fc50177372
|
@ -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<std::string>());
|
||||
#endif
|
||||
if (viewProvider && viewProvider->getTypeId().isDerivedFrom
|
||||
(ViewProviderDocumentObject::getClassTypeId())) {
|
||||
// go through the views
|
||||
|
|
|
@ -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<const App::PropertyLink*>(prop)->getValue();
|
||||
if (pBase)
|
||||
Gui::Application::Instance->hideViewProvider(pBase);
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderBoolean::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
// get the input shapes
|
||||
Part::Boolean* pBool = static_cast<Part::Boolean*>(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<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
Gui::Application::Instance->hideViewProvider(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderMultiFuse::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
// get the input shapes
|
||||
Part::MultiFuse* pBool = static_cast<Part::MultiFuse*>(getObject());
|
||||
std::vector<App::DocumentObject*> pShapes = pBool->Shapes.getValues();
|
||||
for (std::vector<App::DocumentObject*>::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<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
Gui::Application::Instance->hideViewProvider(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderMultiCommon::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
// get the input shapes
|
||||
Part::MultiCommon* pBool = static_cast<Part::MultiCommon*>(getObject());
|
||||
std::vector<App::DocumentObject*> pShapes = pBool->Shapes.getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
Gui::Application::Instance->showViewProvider(*it);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
std::vector<App::DocumentObject*> claimChildren(void) const;
|
||||
QIcon getIcon(void) const;
|
||||
void updateData(const App::Property*);
|
||||
bool onDelete(const std::vector<std::string> &);
|
||||
};
|
||||
|
||||
/// ViewProvider for the MultiFuse feature
|
||||
|
@ -60,6 +61,7 @@ public:
|
|||
std::vector<App::DocumentObject*> claimChildren(void) const;
|
||||
QIcon getIcon(void) const;
|
||||
void updateData(const App::Property*);
|
||||
bool onDelete(const std::vector<std::string> &);
|
||||
};
|
||||
|
||||
/// ViewProvider for the MultiFuse feature
|
||||
|
@ -77,6 +79,7 @@ public:
|
|||
std::vector<App::DocumentObject*> claimChildren(void) const;
|
||||
QIcon getIcon(void) const;
|
||||
void updateData(const App::Property*);
|
||||
bool onDelete(const std::vector<std::string> &);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -243,6 +243,17 @@ std::vector<App::DocumentObject*> ViewProviderFillet::claimChildren() const
|
|||
return temp;
|
||||
}
|
||||
|
||||
bool ViewProviderFillet::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
// get the input shape
|
||||
Part::Fillet* pFillet = static_cast<Part::Fillet*>(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<App::DocumentObject*> ViewProviderChamfer::claimChildren() const
|
|||
return temp;
|
||||
}
|
||||
|
||||
bool ViewProviderChamfer::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
// get the input shape
|
||||
Part::Chamfer* pChamfer = static_cast<Part::Chamfer*>(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<App::DocumentObject*> ViewProviderRevolution::claimChildren() const
|
|||
temp.push_back(static_cast<Part::Revolution*>(getObject())->Source.getValue());
|
||||
return temp;
|
||||
}
|
||||
|
||||
bool ViewProviderRevolution::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
// get the input shape
|
||||
Part::Revolution* pRevolve = static_cast<Part::Revolution*>(getObject());
|
||||
App::DocumentObject *pBase = pRevolve->Source.getValue();
|
||||
if (pBase)
|
||||
Gui::Application::Instance->showViewProvider(pBase);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ public:
|
|||
//@{
|
||||
void setupContextMenu(QMenu*, QObject*, const char*);
|
||||
std::vector<App::DocumentObject*> claimChildren() const;
|
||||
bool onDelete(const std::vector<std::string> &);
|
||||
|
||||
protected:
|
||||
bool setEdit(int ModNum);
|
||||
|
@ -84,6 +85,7 @@ public:
|
|||
//@{
|
||||
void setupContextMenu(QMenu*, QObject*, const char*);
|
||||
std::vector<App::DocumentObject*> claimChildren() const;
|
||||
bool onDelete(const std::vector<std::string> &);
|
||||
|
||||
protected:
|
||||
bool setEdit(int ModNum);
|
||||
|
@ -103,6 +105,7 @@ public:
|
|||
|
||||
/// grouping handling
|
||||
std::vector<App::DocumentObject*> claimChildren(void)const;
|
||||
bool onDelete(const std::vector<std::string> &);
|
||||
};
|
||||
|
||||
} // namespace PartGui
|
||||
|
|
Loading…
Reference in New Issue
Block a user