#include <ModelAPI_Events.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_ResultConstruction.h>
#include <QMainWindow>
#include <QAction>
theStdActions["SHOW_CMD"]->setEnabled(false);
theStdActions["HIDE_CMD"]->setEnabled(false);
theStdActions["HIDEALL_CMD"]->setEnabled(false);
+
+ ModuleBase_ISelection* aSelection = myModule->workshop()->selection();
+ QList<ModuleBase_ViewerPrsPtr> aPrsList = aSelection->getSelected(ModuleBase_ISelection::Viewer);
+ ResultConstructionPtr aResult;
+ bool canBeDeleted = true;
+ foreach(ModuleBase_ViewerPrsPtr aPrs, aPrsList) {
+ aResult = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aPrs->object());
+ if (aResult.get() != NULL) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aPrs->object());
+ canBeDeleted = !(!(aFeature->isInHistory()) && aResult->isInfinite());
+ if (!canBeDeleted)
+ break;
+ }
+ }
+ theStdActions["DELETE_CMD"]->setEnabled(canBeDeleted);
}
}
{
action("RENAME_CMD")->setEnabled(true);
if (aObject->groupName() == ModelAPI_ResultConstruction::group()) {
+ ResultConstructionPtr aConstr = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObject);
FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
- canBeDeleted = aFeature->isInHistory();
+ canBeDeleted = !(!(aFeature->isInHistory()) && aConstr->isInfinite());
action("DELETE_CMD")->setEnabled(canBeDeleted);
}
else
}
}
- ModuleBase_IModule* aModule = myWorkshop->module();
- if (aModule)
- aModule->updateViewerMenu(myActions);
-
if (myWorkshop->canChangeProperty("COLOR_CMD"))
action("COLOR_CMD")->setEnabled(true);
if (myWorkshop->canChangeProperty("TRANSPARENCY_CMD"))
action("TRANSPARENCY_CMD")->setEnabled(true);
- // Delete command is not used in viewer pop-up menu
- action("DELETE_CMD")->setEnabled(false);
+ ModuleBase_IModule* aModule = myWorkshop->module();
+ if (aModule)
+ aModule->updateViewerMenu(myActions);
}
void XGUI_ContextMenuMgr::connectObjectBrowser()