X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Workshop.cpp;h=533efe7bffa9180fe642f509c1a3b810331dd765;hb=64fc7e4fdd63997ec7a502b233ef5f88186d5bbb;hp=abe349cf27e832f596f629a828d1b703de40563a;hpb=73b63afd03a150740406d8c5cebf45ac5125f2e3;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index abe349cf2..533efe7bf 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -131,7 +131,6 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector) 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))); @@ -145,6 +144,7 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector) ModuleBase_IWorkshop* aWorkshop = moduleConnector(); myOperationMgr->setWorkshop(aWorkshop); + myErrorMgr = new XGUI_ErrorMgr(this, aWorkshop); myEventsListener = new XGUI_WorkshopListener(aWorkshop); connect(myOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)), @@ -392,7 +392,7 @@ void XGUI_Workshop::onAcceptActionClicked() } //****************************************************** -void XGUI_Workshop::onValidationStateChanged(bool theEnabled) +/*void XGUI_Workshop::onValidationStateChanged(bool theEnabled) { XGUI_OperationMgr* anOperationMgr = operationMgr(); if (anOperationMgr) { @@ -403,7 +403,7 @@ void XGUI_Workshop::onValidationStateChanged(bool theEnabled) myErrorMgr->updateActionState(anAction, aFOperation->feature(), theEnabled); } } -} +}*/ //****************************************************** @@ -418,6 +418,24 @@ void XGUI_Workshop::deactivateActiveObject(const ObjectPtr& theObject, const boo } } +//****************************************************** +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) { @@ -431,7 +449,7 @@ 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(); @@ -495,14 +513,16 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) // 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 aResults = aFeature->results(); - std::list::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 aResults = aFeature->results(); + std::list::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; @@ -977,8 +997,8 @@ void XGUI_Workshop::createDockWidgets() 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))); } //****************************************************** @@ -1293,8 +1313,12 @@ bool XGUI_Workshop::canMoveFeature() 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; @@ -1323,7 +1347,7 @@ bool XGUI_Workshop::canMoveFeature() 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; }