rename status bit 'Delete' to 'Remove' as it fits better for its purpose, add new bit 'Destroy'

This commit is contained in:
wmayer
2017-09-13 15:47:48 +02:00
parent 071763d464
commit ca77c54d10
6 changed files with 14 additions and 13 deletions

View File

@@ -2602,7 +2602,7 @@ void Document::remObject(const char* sName)
d->activeObject = 0;
// Mark the object as about to be deleted
pos->second->setStatus(ObjectStatus::Delete, true);
pos->second->setStatus(ObjectStatus::Remove, true);
if (!d->undoing && !d->rollback) {
pos->second->unsetupObject();
}
@@ -2662,7 +2662,7 @@ void Document::remObject(const char* sName)
}
}
pos->second->setStatus(ObjectStatus::Delete, false); // Unset the bit to be on the safe side
pos->second->setStatus(ObjectStatus::Remove, false); // Unset the bit to be on the safe side
d->objectMap.erase(pos);
}
@@ -2678,8 +2678,8 @@ void Document::_remObject(DocumentObject* pcObject)
if (d->activeObject == pcObject)
d->activeObject = 0;
// Mark the object as about to be deleted
pcObject->setStatus(ObjectStatus::Delete, true);
// Mark the object as about to be removed
pcObject->setStatus(ObjectStatus::Remove, true);
if (!d->undoing && !d->rollback) {
pcObject->unsetupObject();
}
@@ -2705,7 +2705,7 @@ void Document::_remObject(DocumentObject* pcObject)
}
// remove from map
pcObject->setStatus(ObjectStatus::Delete, false); // Unset the bit to be on the safe side
pcObject->setStatus(ObjectStatus::Remove, false); // Unset the bit to be on the safe side
d->objectMap.erase(pos);
for (std::vector<DocumentObject*>::iterator it = d->objectArray.begin(); it != d->objectArray.end(); ++it) {

View File

@@ -48,8 +48,9 @@ enum ObjectStatus {
New = 2,
Recompute = 3,
Restore = 4,
Delete = 5,
Remove = 5,
PythonCall = 6,
Destroy = 7,
Expand = 16
};
@@ -122,8 +123,8 @@ public:
bool isRecomputing() const {return StatusBits.test(ObjectStatus::Recompute);}
/// returns true if this objects is currently restoring from file
bool isRestoring() const {return StatusBits.test(ObjectStatus::Restore);}
/// returns true if this objects is currently restoring from file
bool isDeleting() const {return StatusBits.test(ObjectStatus::Delete);}
/// returns true if this objects is currently removed from the document
bool isRemoving() const {return StatusBits.test(ObjectStatus::Remove);}
/// return the status bits
unsigned long getStatus() const {return StatusBits.to_ulong();}
bool testStatus(ObjectStatus pos) const {return StatusBits.test((size_t)pos);}

View File

@@ -174,8 +174,8 @@ void Origin::unsetupObject () {
// Check that previous deletes wasn't inderectly removed one of our objects
const auto &objsLnk = OriginFeatures.getValues ();
if ( std::find(objsLnk.begin(), objsLnk.end(), obj) != objsLnk.end()) {
if ( ! obj->isDeleting () ) {
obj->getDocument ()->remObject (obj->getNameInDocument());
if ( ! obj->isRemoving() ) {
obj->getDocument()->remObject (obj->getNameInDocument());
}
}
}

View File

@@ -119,7 +119,7 @@ void OriginGroupExtension::onExtendedSetupObject () {
void OriginGroupExtension::onExtendedUnsetupObject () {
App::DocumentObject *origin = Origin.getValue ();
if (origin && !origin->isDeleting ()) {
if (origin && !origin->isRemoving ()) {
origin->getDocument ()->remObject (origin->getNameInDocument());
}

View File

@@ -85,7 +85,7 @@ std::vector<App::DocumentObject*> ViewProviderGeoFeatureGroupExtension::extensio
//condition. But then it is needed to understand the problem for the user
auto grp = getExtendedViewProvider()->getObject();
vin.erase(std::remove_if(vin.begin(), vin.end(), [&](App::DocumentObject* obj)->bool {
return obj->isDeleting() ||
return obj->isRemoving() ||
obj == grp ||
App::GeoFeatureGroupExtension::getGroupOfObject(obj)!=grp;
}), vin.end());

View File

@@ -135,7 +135,7 @@ void ViewProviderOriginGroupExtension::slotChangedObjectGui ( const Gui::ViewPro
void ViewProviderOriginGroupExtension::updateOriginSize () {
if(getExtendedViewProvider()->getObject()->isDeleting() ||
if(getExtendedViewProvider()->getObject()->isRemoving() ||
getExtendedViewProvider()->getObject()->getDocument()->testStatus(App::Document::Restoring))
return;