X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FXGUI%2FXGUI_Workshop.cpp;h=646a41bfa8c070f70a6f183e566d8db0c59b2cb1;hb=9d2e6d9c21e4f16817ca5b572847fe323f6ef32a;hp=8774bbf917c3de5619be7cabed1909d1e41eaab7;hpb=5352bbb1915f98d1f02b1cb953a2de19b286a28c;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 8774bbf91..646a41bfa 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -468,17 +468,19 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const std::shared_ptrredisplay(aObj, false); - if (myOperationMgr->hasOperation()) { - ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); - if (!aOperation->isEditOperation() && - aOperation->hasObject(aObj) && myDisplayer->isActive(aObj)) + //if (myOperationMgr->hasOperation()) { + // ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); + // if (!aOperation->isEditOperation() && + // aOperation->hasObject(aObj) && myDisplayer->isActive(aObj)) + if (!myModule->canActivateSelection(aObj)) { + if (myDisplayer->isActive(aObj)) myDisplayer->deactivate(aObj); } } else { // display object if the current operation has it if (displayObject(aObj)) { - ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); - if (aOperation && aOperation->hasObject(aObj)) { - ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); + //ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); + //if (aOperation && aOperation->hasObject(aObj)) { + if (!myModule->canActivateSelection(aObj)) { #ifdef DEBUG_FEATURE_REDISPLAY QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); qDebug(QString(" display object = %1").arg(anObjInfo).toStdString().c_str()); @@ -514,16 +516,18 @@ void XGUI_Workshop::onFeatureCreatedMsg(const std::shared_ptrdata() || !anObject->data()->isValid()) - continue; - //ResultPartPtr aPart = std::dynamic_pointer_cast(*aIt); - //if (aPart) { - //aHasPart = true; - // If a feature is created from the aplication's python console - // it doesn't stored in the operation mgr and doesn't displayed - //} else { - isDisplayed = displayObject(*aIt); - //} + // we should not display disabled objects + bool aHide = !anObject->data() || !anObject->data()->isValid() || + anObject->isDisabled() || (!anObject->isDisplayed()); + if (!aHide) { + // setDisplayed has to be called in order to synchronize internal state of the object + // with list of displayed objects + if (myModule->canDisplayObject(anObject)) { + anObject->setDisplayed(true); + isDisplayed = displayObject(*aIt); + } else + anObject->setDisplayed(false); + } } //if (myObjectBrowser) // myObjectBrowser->processEvent(theMsg); @@ -846,7 +850,7 @@ void XGUI_Workshop::onOpen() aSession->closeAll(); aSession->load(myCurrentDir.toLatin1().constData()); myObjectBrowser->rebuildDataTree(); - displayAllResults(); + //displayAllResults(); updateCommandStatus(); myIsLoadingData = false; QApplication::restoreOverrideCursor(); @@ -1266,7 +1270,7 @@ void XGUI_Workshop::deleteObjects() aDescription += tr(" %1"); QStringList aObjectNames; foreach (ObjectPtr aObj, anObjects) { - if (!aObj->data().get()) + if (!aObj->data()->isValid()) continue; aObjectNames << QString::fromStdString(aObj->data()->name()); } @@ -1581,7 +1585,6 @@ void XGUI_Workshop::closeDocument() SessionPtr aMgr = ModelAPI_Session::get(); aMgr->closeAll(); - objectBrowser()->clearContent(); } //**************************************************************