Drags and drop with groups

This commit is contained in:
plgarcia
2018-05-15 08:16:05 +02:00
committed by wmayer
parent 47ae980fa2
commit 77232b2141
10 changed files with 82 additions and 2 deletions

View File

@@ -152,6 +152,18 @@ bool ViewProviderBoolean::onDelete(const std::vector<std::string> &)
return true;
}
void ViewProviderBoolean::replaceObject(App::DocumentObject* oldValue, App::DocumentObject* newValue)
{
Part::Boolean* pBool = static_cast<Part::Boolean*>(getObject());
if (oldValue == pBool->Base.getValue()) {
pBool->Base.setValue(newValue);
}
else if (oldValue == pBool->Tool.getValue()) {
pBool->Tool.setValue(newValue);
}
}
PROPERTY_SOURCE(PartGui::ViewProviderMultiFuse,PartGui::ViewProviderPart)
ViewProviderMultiFuse::ViewProviderMultiFuse()
@@ -279,6 +291,13 @@ void ViewProviderMultiFuse::dropObject(App::DocumentObject* obj)
pBool->Shapes.setValues(pShapes);
}
void ViewProviderMultiFuse::replaceObject(App::DocumentObject* oldValue, App::DocumentObject* newValue)
{
Part::MultiFuse* pBool = static_cast<Part::MultiFuse*>(getObject());
std::vector<App::DocumentObject*> pShapes = pBool->Shapes.getValues();
std::replace(pShapes.begin(), pShapes.end(), oldValue, newValue);
pBool->Shapes.setValues(pShapes);
}
PROPERTY_SOURCE(PartGui::ViewProviderMultiCommon,PartGui::ViewProviderPart)
@@ -406,3 +425,11 @@ void ViewProviderMultiCommon::dropObject(App::DocumentObject* obj)
pShapes.push_back(obj);
pBool->Shapes.setValues(pShapes);
}
void ViewProviderMultiCommon::replaceObject(App::DocumentObject* oldValue, App::DocumentObject* newValue)
{
Part::MultiFuse* pBool = static_cast<Part::MultiFuse*>(getObject());
std::vector<App::DocumentObject*> pShapes = pBool->Shapes.getValues();
std::replace(pShapes.begin(), pShapes.end(), oldValue, newValue);
pBool->Shapes.setValues(pShapes);
}