X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_WorkshopListener.cpp;h=849466192813c7078634f398aa82845264f3d8b0;hb=176403004ff97696f3c0b5f8bdf48692177fb34a;hp=366336a1f4307ed65b504699ec1c7dfbf52af5bc;hpb=a8cfbfb436c27ff96edd5c808e9a452c35cef207;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 366336a1f..849466192 100755 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -16,6 +16,7 @@ #endif #include +#include #include #include @@ -39,6 +40,7 @@ #include #include #include +#include #include #include @@ -83,7 +85,6 @@ void XGUI_WorkshopListener::initializeEventListening() //Initialize event listening Events_Loop* aLoop = Events_Loop::loop(); aLoop->registerListener(this, Events_InfoMessage::errorID()); //!< Listening application errors. - aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); @@ -94,6 +95,7 @@ void XGUI_WorkshopListener::initializeEventListening() aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION)); } //****************************************************** @@ -133,7 +135,16 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr& std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage); onFeatureEmptyPresentationMsg(aUpdMsg); + } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION)) { + ModuleBase_ModelWidget* aWidget = workshop()->propertyPanel()->activeWidget(); + if (aWidget) { + ModuleBase_WidgetSelector* aWidgetSelector = + dynamic_cast(aWidget); + if (aWidgetSelector) + myWorkshop->setSelected(aWidgetSelector->getAttributeSelection()); + } } + //Update property panel on corresponding message. If there is no current operation (no //property panel), or received message has different feature to the current - do nothing. else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) { @@ -147,26 +158,6 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr& QApplication::restoreOverrideCursor(); } } - //An operation passed by message. Start it, process and commit. - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) { - std::shared_ptr aPartSetMsg = - std::dynamic_pointer_cast(theMessage); - //myPropertyPanel->cleanContent(); - ModuleBase_Operation* anOperation = (ModuleBase_Operation*) aPartSetMsg->pointer(); - XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr(); - - if (anOperationMgr->startOperation(anOperation)) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast(anOperation); - if (aFOperation) { - workshop()->propertyPanel()->updateContentWidget(aFOperation->feature()); - workshop()->propertyPanel()->createContentPanel(aFOperation->feature()); - } - if (!anOperation->getDescription()->hasXmlRepresentation()) { - if (anOperation->commit()) - workshop()->updateCommandStatus(); - } - } - } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_SELFILTER_LOADED)) { std::shared_ptr aMsg = std::dynamic_pointer_cast(theMessage); @@ -186,7 +177,8 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr& aDisplayer->enableUpdateViewer(true); } else { //Show error dialog if error message received. - std::shared_ptr anIngfoMsg = std::dynamic_pointer_cast(theMessage); + std::shared_ptr anIngfoMsg = + std::dynamic_pointer_cast(theMessage); if (anIngfoMsg) { emit errorOccurred(anIngfoMsg); } @@ -212,7 +204,8 @@ void XGUI_WorkshopListener::onFeatureUpdatedMsg( anInfo.append(ModuleBase_Tools::objectInfo((*aIt))); } QString anInfoStr = anInfo.join(";\t"); - qDebug(QString("onFeatureUpdatedMsg: %1, %2").arg(anObjects.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(); @@ -238,7 +231,8 @@ void XGUI_WorkshopListener::onFeatureUpdatedMsg( } //****************************************************** -void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptr& theMsg) +void XGUI_WorkshopListener:: + onFeatureRedisplayMsg(const std::shared_ptr& theMsg) { std::set anObjects = theMsg->objects(); std::set::const_iterator aIt; @@ -249,13 +243,15 @@ void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptrdisplayer(); - bool aFirstVisualizedBody = false; - + //bool aFirstVisualizedBody = false; + bool aDoFitAll = false; + int aNbOfShownObjects = workshop()->displayer()->objectsCount(); bool aRedisplayed = false; //std::list aHiddenObjects; for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { @@ -279,7 +275,8 @@ void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptr(aRes); if (aCompSolidRes.get()) { - qDebug(QString("COMPSOLID, numberOfSubs = %1").arg(aCompSolidRes->numberOfSubs()).toStdString().c_str()); + qDebug(QString("COMPSOLID, numberOfSubs = %1") + .arg(aCompSolidRes->numberOfSubs()).toStdString().c_str()); } if (ModelAPI_Tools::compSolidOwner(aRes)) qDebug("COMPSOLID sub-object"); @@ -297,16 +294,16 @@ void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptr