Revert "part deletion handling"
This reverts commit 6ab2002021ac1df26ebe77f488f5cd94e1df0b26.
This commit is contained in:
parent
dbb5786ffd
commit
c6797b6c29
|
@ -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<std::string,DocumentObject*>::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<std::string,DocumentObject*>::iterator pos = d->objectMap.find(pcObject->getNameInDocument());
|
||||
|
||||
|
||||
if (d->activeObject == pcObject)
|
||||
d->activeObject = 0;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -30,9 +30,8 @@
|
|||
#include <App/Plane.h>
|
||||
|
||||
#include "Part.h"
|
||||
#include "Origin.h"
|
||||
#include "PartPy.h"
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
||||
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)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "GeoFeatureGroup.h"
|
||||
#include "PropertyLinks.h"
|
||||
#include <boost/signals.hpp>
|
||||
|
||||
|
||||
|
||||
namespace App
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1050,19 +1050,6 @@ void StdCmdDelete::activated(int iMsg)
|
|||
// check if the edited view provider is selected
|
||||
for (std::vector<Gui::SelectionObject>::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<Gui::SelectionObject>::iterator ft = sel.begin(); ft != sel.end(); ++ft) {
|
||||
App::DocumentObject* obj = ft->getObject();
|
||||
std::vector<App::DocumentObject*> 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<App::DocumentObject*>::iterator lt = links.begin(); lt != links.end(); ++lt) {
|
||||
|
|
|
@ -469,7 +469,7 @@ void Body::removeModelFromDocument() {
|
|||
//delete all child objects if needed
|
||||
std::set<DocumentObject*> grp ( Model.getValues().begin (), Model.getValues().end() );
|
||||
for (auto obj : grp) {
|
||||
this->getDocument()->remObject(obj->getNameInDocument(), true);
|
||||
this->getDocument()->remObject(obj->getNameInDocument());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user