replace hard-coded values with enum values

This commit is contained in:
wmayer
2017-05-30 15:21:23 +02:00
parent 397539aed2
commit c4cb4518ba
5 changed files with 30 additions and 27 deletions

View File

@@ -1202,9 +1202,9 @@ void Document::Restore(Base::XMLReader &reader)
string name = reader.getAttribute("name");
DocumentObject* pObj = getObject(name.c_str());
if (pObj) { // check if this feature has been registered
pObj->StatusBits.set(4);
pObj->setStatus(ObjectStatus::Restore, true);
pObj->Restore(reader);
pObj->StatusBits.reset(4);
pObj->setStatus(ObjectStatus::Restore, false);
}
reader.readEndElement("Feature");
}
@@ -1330,9 +1330,9 @@ Document::readObjects(Base::XMLReader& reader)
std::string name = reader.getName(reader.getAttribute("name"));
DocumentObject* pObj = getObject(name.c_str());
if (pObj) { // check if this feature has been registered
pObj->StatusBits.set(4);
pObj->setStatus(ObjectStatus::Restore, true);
pObj->Restore(reader);
pObj->StatusBits.reset(4);
pObj->setStatus(ObjectStatus::Restore, false);
}
reader.readEndElement("Object");
}
@@ -2203,7 +2203,7 @@ DocumentObject * Document::addObject(const char* sType, const char* pObjectName,
}
// mark the object as new (i.e. set status bit 2) and send the signal
pcObject->StatusBits.set(2);
pcObject->setStatus(ObjectStatus::New, true);
signalNewObject(*pcObject);
// do no transactions if we do a rollback!
@@ -2287,7 +2287,7 @@ std::vector<DocumentObject *> Document::addObjects(const char* sType, const std:
}
// mark the object as new (i.e. set status bit 2) and send the signal
pcObject->StatusBits.set(2);
pcObject->setStatus(ObjectStatus::New, true);
signalNewObject(*pcObject);
// do no transactions if we do a rollback!
@@ -2338,7 +2338,7 @@ void Document::addObject(DocumentObject* pcObject, const char* pObjectName)
pcObject->Label.setValue( ObjectName );
// mark the object as new (i.e. set status bit 2) and send the signal
pcObject->StatusBits.set(2);
pcObject->setStatus(ObjectStatus::New, true);
signalNewObject(*pcObject);
// do no transactions if we do a rollback!
@@ -2391,13 +2391,13 @@ void Document::remObject(const char* sName)
d->activeObject = 0;
// Mark the object as about to be deleted
pos->second->StatusBits.set (ObjectStatus::Delete);
pos->second->setStatus(ObjectStatus::Delete, true);
if (!d->undoing && !d->rollback) {
pos->second->unsetupObject();
}
signalDeletedObject(*(pos->second));
pos->second->StatusBits.reset (ObjectStatus::Delete); // Unset the bit to be on the safe side
pos->second->setStatus(ObjectStatus::Delete, false); // Unset the bit to be on the safe side
// do no transactions if we do a rollback!
if (!d->rollback && d->activeUndoTransaction) {
@@ -2468,13 +2468,13 @@ void Document::_remObject(DocumentObject* pcObject)
d->activeObject = 0;
// Mark the object as about to be deleted
pcObject->StatusBits.set (ObjectStatus::Delete);
pcObject->setStatus(ObjectStatus::Delete, true);
if (!d->undoing && !d->rollback) {
pcObject->unsetupObject();
}
signalDeletedObject(*pcObject);
// TODO Check me if it's needed (2015-09-01, Fat-Zer)
pcObject->StatusBits.reset (ObjectStatus::Delete); // Unset the bit to be on the safe side
pcObject->setStatus(ObjectStatus::Delete, false); // Unset the bit to be on the safe side
//remove the tip if needed
if (Tip.getValue() == pcObject) {