myOperationMgr = new XGUI_OperationMgr(this, 0);
myActionsMgr = new XGUI_ActionsMgr(this);
myErrorDlg = new XGUI_ErrorDialog(QApplication::desktop());
- myErrorMgr = new XGUI_ErrorMgr(this);
myContextMenuMgr = new XGUI_ContextMenuMgr(this);
connect(myContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
SLOT(onContextMenuCommand(const QString&, bool)));
ModuleBase_IWorkshop* aWorkshop = moduleConnector();
myOperationMgr->setWorkshop(aWorkshop);
+ myErrorMgr = new XGUI_ErrorMgr(this, aWorkshop);
myEventsListener = new XGUI_WorkshopListener(aWorkshop);
connect(myOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)),
}
//******************************************************
-void XGUI_Workshop::onValidationStateChanged(bool theEnabled)
+/*void XGUI_Workshop::onValidationStateChanged(bool theEnabled)
{
XGUI_OperationMgr* anOperationMgr = operationMgr();
if (anOperationMgr) {
myErrorMgr->updateActionState(anAction, aFOperation->feature(), theEnabled);
}
}
-}
+}*/
//******************************************************
}
}
+//******************************************************
+bool XGUI_Workshop::isFeatureOfNested(const FeaturePtr& theFeature)
+{
+ bool aHasNested = false;
+ std::string aFeatureKind = theFeature->getKind();
+ if (isSalomeMode()) {
+ XGUI_SalomeConnector* aSalomeConnector = salomeConnector();
+ if (aSalomeConnector->isFeatureOfNested(actionsMgr()->action(aFeatureKind.c_str())))
+ aHasNested = true;
+ } else {
+ AppElements_MainMenu* aMenuBar = mainWindow()->menuObject();
+ AppElements_Command* aCommand = aMenuBar->feature(aFeatureKind.c_str());
+ if (aCommand && aCommand->button()->additionalButtonWidget())
+ aHasNested = true;
+ }
+ return aHasNested;
+}
+
//******************************************************
void XGUI_Workshop::onOperationStarted(ModuleBase_Operation* theOperation)
{
if (aFOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel
setPropertyPanel(aFOperation);
// filling the operation values by the current selection
- // if the operation can be commited after the controls filling, the method perform should
+ // if the operation can be committed after the controls filling, the method perform should
// be stopped. Otherwise unnecessary presentations can be shown(e.g. operation prs in sketch)
if (!aFOperation->isEditOperation()) {
aFOperation->activateByPreselection();
// They were deactivated on operation start or an object redisplay
QObjectPtrList anObjects;
FeaturePtr aFeature = aFOperation->feature();
- if (myDisplayer->isVisible(aFeature) && !myDisplayer->isActive(aFeature))
- anObjects.append(aFeature);
- std::list<ResultPtr> aResults = aFeature->results();
- std::list<ResultPtr>::const_iterator aIt;
- for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
- ResultPtr anObject = *aIt;
- if (myDisplayer->isVisible(anObject) && !myDisplayer->isActive(anObject)) {
- anObjects.append(anObject);
+ if (aFeature.get()) { // feature may be not created (plugin load fail)
+ if (myDisplayer->isVisible(aFeature) && !myDisplayer->isActive(aFeature))
+ anObjects.append(aFeature);
+ std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
+ ResultPtr anObject = *aIt;
+ if (myDisplayer->isVisible(anObject) && !myDisplayer->isActive(anObject)) {
+ anObjects.append(anObject);
+ }
}
}
QIntList aModes;
connect(myPropertyPanel, SIGNAL(noMoreWidgets()), myModule, SLOT(onNoMoreWidgets()));
connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)),
myOperationMgr, SLOT(onKeyReleased(QKeyEvent*)));
- connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),
- this, SLOT(onValidationStateChanged(bool)));
+ //connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),
+ // this, SLOT(onValidationStateChanged(bool)));
}
//******************************************************
QObjectPtrList aObjects = mySelector->selection()->selectedObjects();
QObjectPtrList aValidatedObjects;
foreach (ObjectPtr aObject, aObjects) {
- if (myModule->canApplyAction(aObject, anActionId))
- aValidatedObjects.append(aObject);
+ if (!myModule->canApplyAction(aObject, anActionId))
+ continue;
+ // To be moved feature should be in active document
+ if (aObject->document() != ModelAPI_Session::get()->activeDocument())
+ continue;
+ aValidatedObjects.append(aObject);
}
if (aValidatedObjects.size() != aObjects.size())
aObjects = aValidatedObjects;
std::set_intersection(aRefFeatures.begin(), aRefFeatures.end(),
aPlacedFeatures.begin(), aPlacedFeatures.end(),
std::inserter(aIntersectionFeatures, aIntersectionFeatures.begin()));
- // 4. Return false if any reference feature is placed before curent feature
+ // 4. Return false if any reference feature is placed before current feature
if (!aIntersectionFeatures.empty())
aCanMove = false;
}