Gui: forbid to delete OriginFeatures
This commit is contained in:
parent
bceec93a92
commit
5918f6f264
|
@ -45,6 +45,7 @@
|
||||||
#include <App/DocumentObjectGroup.h>
|
#include <App/DocumentObjectGroup.h>
|
||||||
#include <App/DocumentObject.h>
|
#include <App/DocumentObject.h>
|
||||||
#include <App/GeoFeature.h>
|
#include <App/GeoFeature.h>
|
||||||
|
#include <App/Origin.h>
|
||||||
|
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
@ -559,7 +560,7 @@ DEF_STD_CMD_A(StdCmdProjectInfo);
|
||||||
StdCmdProjectInfo::StdCmdProjectInfo()
|
StdCmdProjectInfo::StdCmdProjectInfo()
|
||||||
:Command("Std_ProjectInfo")
|
:Command("Std_ProjectInfo")
|
||||||
{
|
{
|
||||||
// seting the
|
// seting the
|
||||||
sGroup = QT_TR_NOOP("File");
|
sGroup = QT_TR_NOOP("File");
|
||||||
sMenuText = QT_TR_NOOP("Project i&nformation...");
|
sMenuText = QT_TR_NOOP("Project i&nformation...");
|
||||||
sToolTipText = QT_TR_NOOP("Show details of the currently active project");
|
sToolTipText = QT_TR_NOOP("Show details of the currently active project");
|
||||||
|
@ -590,7 +591,7 @@ DEF_STD_CMD_A(StdCmdProjectUtil);
|
||||||
StdCmdProjectUtil::StdCmdProjectUtil()
|
StdCmdProjectUtil::StdCmdProjectUtil()
|
||||||
:Command("Std_ProjectUtil")
|
:Command("Std_ProjectUtil")
|
||||||
{
|
{
|
||||||
// seting the
|
// seting the
|
||||||
sGroup = QT_TR_NOOP("Tools");
|
sGroup = QT_TR_NOOP("Tools");
|
||||||
sWhatsThis = "Std_ProjectUtil";
|
sWhatsThis = "Std_ProjectUtil";
|
||||||
sMenuText = QT_TR_NOOP("Project utility...");
|
sMenuText = QT_TR_NOOP("Project utility...");
|
||||||
|
@ -1077,9 +1078,11 @@ void StdCmdDelete::activated(int iMsg)
|
||||||
for (std::vector<App::DocumentObject*>::iterator lt = links.begin(); lt != links.end(); ++lt) {
|
for (std::vector<App::DocumentObject*>::iterator lt = links.begin(); lt != links.end(); ++lt) {
|
||||||
if (
|
if (
|
||||||
(!(*lt)->getTypeId().isDerivedFrom(App::DocumentObjectGroup::getClassTypeId())) &&
|
(!(*lt)->getTypeId().isDerivedFrom(App::DocumentObjectGroup::getClassTypeId())) &&
|
||||||
|
(!(*lt)->getTypeId().isDerivedFrom(App::Origin::getClassTypeId())) &&
|
||||||
(!rSel.isSelected(*lt)) &&
|
(!rSel.isSelected(*lt)) &&
|
||||||
(!(*lt)->getTypeId().isDerivedFrom(Base::Type::fromName("Part::BodyBase")))
|
(!(*lt)->getTypeId().isDerivedFrom(Base::Type::fromName("Part::BodyBase")))
|
||||||
){
|
){
|
||||||
|
// TODO Do something with this hack of Part::BodyBase (2015-09-09, Fat-Zer)
|
||||||
autoDeletion = false;
|
autoDeletion = false;
|
||||||
affectedLabels.insert(QString::fromUtf8((*lt)->Label.getValue()));
|
affectedLabels.insert(QString::fromUtf8((*lt)->Label.getValue()));
|
||||||
}
|
}
|
||||||
|
@ -1099,7 +1102,7 @@ void StdCmdDelete::activated(int iMsg)
|
||||||
"Are you sure you want to continue?\n\n");
|
"Are you sure you want to continue?\n\n");
|
||||||
for (const auto ¤tLabel : affectedLabels)
|
for (const auto ¤tLabel : affectedLabels)
|
||||||
bodyMessageStream << currentLabel << '\n';
|
bodyMessageStream << currentLabel << '\n';
|
||||||
|
|
||||||
int ret = QMessageBox::question(Gui::getMainWindow(),
|
int ret = QMessageBox::question(Gui::getMainWindow(),
|
||||||
qApp->translate("Std_Delete", "Object dependencies"), bodyMessage,
|
qApp->translate("Std_Delete", "Object dependencies"), bodyMessage,
|
||||||
QMessageBox::Yes, QMessageBox::No);
|
QMessageBox::Yes, QMessageBox::No);
|
||||||
|
@ -1158,7 +1161,7 @@ void StdCmdRefresh::activated(int iMsg)
|
||||||
//testing the changes of properties.
|
//testing the changes of properties.
|
||||||
//openCommand("Refresh active document");
|
//openCommand("Refresh active document");
|
||||||
doCommand(Doc,"App.activeDocument().recompute()");
|
doCommand(Doc,"App.activeDocument().recompute()");
|
||||||
//commitCommand();
|
//commitCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <App/Document.h>
|
#include <App/Document.h>
|
||||||
|
#include <App/OriginFeature.h>
|
||||||
|
|
||||||
#include "SoFCSelection.h"
|
#include "SoFCSelection.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
|
@ -176,3 +177,14 @@ void ViewProviderOriginFeature::setDisplayMode (const char* ModeName)
|
||||||
setDisplayMaskMode("Base");
|
setDisplayMaskMode("Base");
|
||||||
ViewProviderGeometryObject::setDisplayMode(ModeName);
|
ViewProviderGeometryObject::setDisplayMode(ModeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ViewProviderOriginFeature::onDelete(const std::vector<std::string> &) {
|
||||||
|
App::OriginFeature *feat = static_cast <App::OriginFeature *> ( getObject() );
|
||||||
|
// Forbid deletion if there is an origin thes feature belongs to
|
||||||
|
|
||||||
|
if ( feat->getOrigin () ) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void onChanged ( const App::Property* prop );
|
virtual void onChanged ( const App::Property* prop );
|
||||||
|
virtual bool onDelete ( const std::vector<std::string> & );
|
||||||
protected:
|
protected:
|
||||||
SoSeparator * pOriginFeatureRoot;
|
SoSeparator * pOriginFeatureRoot;
|
||||||
SoScale * pScale;
|
SoScale * pScale;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user