diff --git a/src/App/Document.cpp b/src/App/Document.cpp index d4160d70e..47054b8ea 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -2053,20 +2053,13 @@ void Document::_addObject(DocumentObject* pcObject, const char* pObjectName) } /// Remove an object out of the document -void Document::remObject(const char* sName, bool forceIfUndeletable) +void Document::remObject(const char* sName) { std::map::iterator pos = d->objectMap.find(sName); // name not found? if (pos == d->objectMap.end()) return; - - // undeletable? - if (pos->second->testStatus(ObjectStatus::Undeletable) && !forceIfUndeletable) { - std::stringstream str; - str << "Document object '" << pos->second->getNameInDocument() << "' is undeletable"; - throw Base::Exception(str.str()); - } _checkTransaction(pos->second); @@ -2130,7 +2123,7 @@ void Document::_remObject(DocumentObject* pcObject) _checkTransaction(pcObject); std::map::iterator pos = d->objectMap.find(pcObject->getNameInDocument()); - + if (d->activeObject == pcObject) d->activeObject = 0; diff --git a/src/App/Document.h b/src/App/Document.h index 53138ec65..297dec147 100644 --- a/src/App/Document.h +++ b/src/App/Document.h @@ -170,6 +170,8 @@ public: * Unicode names are set through the Label property. */ DocumentObject *addObject(const char* sType, const char* pObjectName=0); + /// Remove a feature out of the document + void remObject(const char* sName); /** Add an existing feature with sName (ASCII) to this document and set it active. * Unicode names are set through the Label property. * This is an overloaded function of the function above and can be used to create @@ -179,11 +181,6 @@ public: */ void addObject(DocumentObject*, const char* pObjectName=0); - /** Remove a feature out of the document. - * If i is marked as undeletable an exeption is thrown. If you want to delete in nonetheless set - * the function parameter \a forceIfUndeletable to true - */ - void remObject(const char* sName, bool forceIfUndeletable = false); /** Copy an object from another document to this document * If \a recursive is true then all objects this object depends on diff --git a/src/App/Document.h.orig b/src/App/Document.h.orig index 5b0937b9a..2e54b3586 100644 --- a/src/App/Document.h.orig +++ b/src/App/Document.h.orig @@ -170,7 +170,7 @@ public: * Unicode names are set through the Label property. */ DocumentObject *addObject(const char* sType, const char* pObjectName=0); -<<<<<<< 985ebdc55b761ed8ae81d7e610ccd5b9f1378473 +<<<<<<< dd080ca693c9af42b6b87ee453f71fccb227b951 /** Add an existing feature with sName (ASCII) to this document and set it active. * Unicode names are set through the Label property. * This is an overloaded function of the function above and can be used to create @@ -179,15 +179,17 @@ public: * is raisedd. */ void addObject(DocumentObject*, const char* pObjectName=0); - /// Remove a feature out of the document - void remObject(const char* sName); -======= - /** Remove a feature out of the document. + + /** Remove a feature out of the document. * If i is marked as undeletable an exeption is thrown. If you want to delete in nonetheless set * the function parameter \a forceIfUndeletable to true */ void remObject(const char* sName, bool forceIfUndeletable = false); ->>>>>>> part deletion handling + +======= + /// Remove a feature out of the document + void remObject(const char* sName); +>>>>>>> Revert "part deletion handling" /** Copy an object from another document to this document * If \a recursive is true then all objects this object depends on * are copied as well. By default \a recursive is false. diff --git a/src/App/DocumentObject.h b/src/App/DocumentObject.h index d35eee75d..8b32e7a5e 100644 --- a/src/App/DocumentObject.h +++ b/src/App/DocumentObject.h @@ -47,7 +47,6 @@ enum ObjectStatus { New = 2, Recompute = 3, Restore = 4, - Undeletable = 5, Expand = 16 }; @@ -195,7 +194,7 @@ protected: * 2 - object is marked as 'new' * 3 - object is marked as 'recompute', i.e. the object gets recomputed now * 4 - object is marked as 'restoring', i.e. the object gets loaded at the moment - * 5 - object is marked as 'undeletable', i.e. the user is not allowed to delete this object from the document + * 5 - reserved * 6 - reserved * 7 - reserved * 16 - object is marked as 'expanded' in the tree view diff --git a/src/App/Line.cpp b/src/App/Line.cpp index 1e451eb0b..84b1ee964 100644 --- a/src/App/Line.cpp +++ b/src/App/Line.cpp @@ -42,10 +42,7 @@ PROPERTY_SOURCE(App::Line, App::GeoFeature) Line::Line(void) { ADD_PROPERTY(LineType,("")); - //placement can't be changed Placement.StatusBits.set(3, true); - //line can not be deleted by user - StatusBits.set(ObjectStatus::Undeletable, true); } diff --git a/src/App/Line.h b/src/App/Line.h index 0766407e8..8c9463d7d 100644 --- a/src/App/Line.h +++ b/src/App/Line.h @@ -37,7 +37,7 @@ namespace App /** Line Object - * Used to define linear support for all kind of operations in the document space + * Used to define planar support for all kind of operations in the document space */ class AppExport Line: public App::GeoFeature { diff --git a/src/App/Origin.cpp b/src/App/Origin.cpp index 76533a34b..6181ec543 100644 --- a/src/App/Origin.cpp +++ b/src/App/Origin.cpp @@ -45,10 +45,7 @@ PROPERTY_SOURCE(App::Origin, App::GeoFeatureGroup) Origin::Origin(void) { - //placement can't be changed Placement.StatusBits.set(3, true); - //origin can not be deleted by user - StatusBits.set(ObjectStatus::Undeletable, true); } Origin::~Origin(void) diff --git a/src/App/Origin.h b/src/App/Origin.h index e64981af3..47039274e 100644 --- a/src/App/Origin.h +++ b/src/App/Origin.h @@ -33,7 +33,7 @@ namespace App { -/** Describe a origin of a local coordinate system +/** Base class of all geometric document objects. */ class AppExport Origin : public App::GeoFeatureGroup { diff --git a/src/App/Part.cpp b/src/App/Part.cpp index 82ab8da47..74cf2af13 100644 --- a/src/App/Part.cpp +++ b/src/App/Part.cpp @@ -30,9 +30,8 @@ #include #include "Part.h" -#include "Origin.h" #include "PartPy.h" -#include + using namespace App; @@ -65,6 +64,7 @@ Part::Part(void) ADD_PROPERTY_TYPE(LicenseURL, ("http://creativecommons.org/licenses/by/3.0/"), 0, App::Prop_None, "URL to the license text/contract"); // color and apperance ADD_PROPERTY(Color, (1.0, 1.0, 1.0, 1.0)); // set transparent -> not used + } Part::~Part(void) diff --git a/src/App/Part.h b/src/App/Part.h index 244fcd8ad..cc4060e83 100644 --- a/src/App/Part.h +++ b/src/App/Part.h @@ -26,7 +26,7 @@ #include "GeoFeatureGroup.h" #include "PropertyLinks.h" -#include + namespace App diff --git a/src/App/Plane.cpp b/src/App/Plane.cpp index 586e074b3..14614f746 100644 --- a/src/App/Plane.cpp +++ b/src/App/Plane.cpp @@ -42,10 +42,7 @@ PROPERTY_SOURCE(App::Plane, App::GeoFeature) Plane::Plane(void) { ADD_PROPERTY(PlaneType,("")); - //placement can't be changed Placement.StatusBits.set(3, true); - //plane can not be deleted by user - StatusBits.set(ObjectStatus::Undeletable, true); } diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 2fd130dff..2d449542d 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -1050,19 +1050,6 @@ void StdCmdDelete::activated(int iMsg) // check if the edited view provider is selected for (std::vector::iterator ft = sel.begin(); ft != sel.end(); ++ft) { Gui::ViewProvider* vp = pGuiDoc->getViewProvider(ft->getObject()); - - if (ft->getObject()->testStatus(App::ObjectStatus::Undeletable)) { - QString bodyMessage; - QTextStream bodyMessageStream(&bodyMessage); - bodyMessageStream << qApp->translate("Std_Delete", - "The object is marked as undeletable."); - - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("Std_Delete", "Object status"), bodyMessage); - - return; - } - if (vp == vpedit) { if (!ft->getSubNames().empty()) { // handle the view provider @@ -1085,19 +1072,6 @@ void StdCmdDelete::activated(int iMsg) for (std::vector::iterator ft = sel.begin(); ft != sel.end(); ++ft) { App::DocumentObject* obj = ft->getObject(); std::vector links = obj->getInList(); - - if (obj->testStatus(App::ObjectStatus::Undeletable)) { - QString bodyMessage; - QTextStream bodyMessageStream(&bodyMessage); - bodyMessageStream << qApp->translate("Std_Delete", - "The object is marked as undeletable."); - - QMessageBox::warning(Gui::getMainWindow(), - qApp->translate("Std_Delete", "Object status"), bodyMessage); - - return; - } - if (!links.empty()) { // check if the referenced objects are groups or are selected too for (std::vector::iterator lt = links.begin(); lt != links.end(); ++lt) { diff --git a/src/Mod/PartDesign/App/Body.cpp b/src/Mod/PartDesign/App/Body.cpp index a75ea9371..9fb8d2eb3 100644 --- a/src/Mod/PartDesign/App/Body.cpp +++ b/src/Mod/PartDesign/App/Body.cpp @@ -469,7 +469,7 @@ void Body::removeModelFromDocument() { //delete all child objects if needed std::set grp ( Model.getValues().begin (), Model.getValues().end() ); for (auto obj : grp) { - this->getDocument()->remObject(obj->getNameInDocument(), true); + this->getDocument()->remObject(obj->getNameInDocument()); } }