X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_WorkshopListener.cpp;h=03aaf4fa1f10e729201c7bcaafa8a27d82a62145;hb=220bd2b37119be1c65abf88a88792445cb9d99f8;hp=570ebbf239ff1b2665e0369399d28ec5550ef27b;hpb=60dfa3359d9982f72d6359fede8520280bfaa6db;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 570ebbf23..03aaf4fa1 100755 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -11,12 +11,14 @@ #include "XGUI_ModuleConnector.h" #include "XGUI_QtEvents.h" +#ifndef HAVE_SALOME #include #include #include #include #include #include +#endif #include @@ -27,6 +29,7 @@ #include #include #include +#include #include #include @@ -63,13 +66,15 @@ //#define DEBUG_FEATURE_UPDATED //#define DEBUG_RESULT_COMPSOLID +#ifdef DEBUG_FEATURE_REDISPLAY +const std::string DebugFeatureKind = "Extrusion"; +#endif + XGUI_WorkshopListener::XGUI_WorkshopListener(ModuleBase_IWorkshop* theWorkshop) : myWorkshop(theWorkshop), myUpdatePrefs(false) { XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr(); - //connect(anOperationMgr, SIGNAL(nestedStateChanged(const std::string&, const bool)), - // this, SLOT(onNestedStateChanged(const std::string&, const bool))); } //****************************************************** @@ -187,14 +192,24 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr& // the viewer's update context is unblocked, the viewer's update works XGUI_Displayer* aDisplayer = workshop()->displayer(); aDisplayer->enableUpdateViewer(true); - aDisplayer->updateViewer(); } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_OBJECT_ERROR_CHANGED)) { std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage); - std::set aObjects = aUpdMsg->objects(); - std::set::const_iterator aIt; - for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) { - workshop()->errorMgr()->updateActions(ModelAPI_Feature::feature(*aIt)); + std::set anObjects = aUpdMsg->objects(); + + ModuleBase_OperationFeature* aFOperation = dynamic_cast + (workshop()->operationMgr()->currentOperation()); + bool aFeatureChanged = false; + if(aFOperation ) { + FeaturePtr aFeature = aFOperation->feature(); + if (aFeature.get()) { + std::set::const_iterator aIt; + for (aIt = anObjects.begin(); aIt != anObjects.end() && !aFeatureChanged; ++aIt) { + aFeatureChanged = ModelAPI_Feature::feature(*aIt) == aFeature; + } + } + if (aFeatureChanged) + workshop()->operationMgr()->onValidateOperation(); } } else { //Show error dialog if error message received. @@ -204,12 +219,12 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr& } return; } - if (!workshop()->isSalomeMode()) { +#ifndef HAVE_SALOME SessionPtr aMgr = ModelAPI_Session::get(); AppElements_MainWindow* aMainWindow = workshop()->mainWindow(); if (aMgr->isModified() != aMainWindow->isModifiedState()) aMainWindow->setModifiedState(aMgr->isModified()); - } +#endif } //****************************************************** @@ -217,14 +232,14 @@ void XGUI_WorkshopListener::onFeatureUpdatedMsg( const std::shared_ptr& theMsg) { #ifdef DEBUG_FEATURE_UPDATED - std::set aObjects = theMsg->objects(); + std::set anObjects = theMsg->objects(); std::set::const_iterator aIt; QStringList anInfo; - for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) { + for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { anInfo.append(ModuleBase_Tools::objectInfo((*aIt))); } QString anInfoStr = anInfo.join(";\t"); - qDebug(QString("onFeatureUpdatedMsg: %1, %2").arg(aObjects.size()).arg(anInfoStr).toStdString().c_str()); + qDebug(QString("onFeatureUpdatedMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str()); #endif std::set aFeatures = theMsg->objects(); XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr(); @@ -252,22 +267,25 @@ void XGUI_WorkshopListener::onFeatureUpdatedMsg( //****************************************************** void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptr& theMsg) { - std::set aObjects = theMsg->objects(); + std::set anObjects = theMsg->objects(); std::set::const_iterator aIt; #ifdef DEBUG_FEATURE_REDISPLAY QStringList anInfo; - for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) { + for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { anInfo.append(ModuleBase_Tools::objectInfo((*aIt))); } QString anInfoStr = anInfo.join(";\t"); - qDebug(QString("onFeatureRedisplayMsg: %1, %2").arg(aObjects.size()).arg(anInfoStr).toStdString().c_str()); + qDebug(QString("onFeatureRedisplayMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str()); #endif XGUI_Workshop* aWorkshop = workshop(); XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + bool aFirstVisualizedBody = false; + bool aRedisplayed = false; - for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) { + //std::list aHiddenObjects; + for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { ObjectPtr aObj = (*aIt); // Hide the object if it is invalid or concealed one @@ -276,7 +294,13 @@ void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptr