X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_WorkshopListener.cpp;h=6ec62aba90d20ed11338b7a168406cf857fea6d3;hb=1035d41ad342fb22f5ea2552a8fc135aed95f3b8;hp=6de634520b08b91152bd49a87a3373bf3ac2ceec;hpb=c53720ca78f12ec6333ca44c8dc2bb6b7a9a5294;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 6de634520..6ec62aba9 100644 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -103,6 +103,7 @@ void XGUI_WorkshopListener::initializeEventListening() 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)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES)); aLoop->registerListener(this, Events_LongOp::eventID()); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED)); @@ -149,8 +150,32 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr& // Redisplay feature else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) { std::shared_ptr aUpdMsg = - std::dynamic_pointer_cast(theMessage); + std::dynamic_pointer_cast(theMessage); onFeatureRedisplayMsg(aUpdMsg); + } + else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_VISUAL_ATTRIBUTES)) { + std::shared_ptr aUpdMsg = + std::dynamic_pointer_cast(theMessage); + std::set aObjList = aUpdMsg->objects(); + std::set::const_iterator aIt; + std::list::const_iterator aResIt; + XGUI_Displayer* aDisplayer = workshop()->displayer(); + AISObjectPtr aAIS; + for (aIt = aObjList.begin(); aIt != aObjList.end(); ++aIt) { + FeaturePtr aFeature = std::dynamic_pointer_cast(*aIt); + if (aFeature) { + aAIS = aDisplayer->getAISObject(aFeature); + if (aAIS.get()) + workshop()->module()->customizePresentation(aFeature, aAIS); + + std::list aResults = aFeature->results(); + for (aResIt = aResults.begin(); aResIt != aResults.end(); ++aResIt) { + aAIS = aDisplayer->getAISObject(*aResIt); + if (aAIS.get()) + workshop()->module()->customizePresentation(*aResIt, aAIS); + } + } + } } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)) { std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage); @@ -354,11 +379,13 @@ void XGUI_WorkshopListener:: //if (aHiddenObjects.size() > 0) // myWorkshop->module()->processHiddenObject(aHiddenObjects); - bool isCustomized = customizeCurrentObject(anObjects, aRedisplayed); + bool isCustomized = customizeFeature(anObjects, aRedisplayed); if (aRedisplayed || isCustomized) { Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); - aDisplayer->updateViewer(); + // Do not update viewer here because it can be called in a loop + // In this case Update has to be called after redisplay event + //aDisplayer->updateViewer(); } } @@ -421,7 +448,7 @@ void XGUI_WorkshopListener:: } } - bool isCustomized = customizeCurrentObject(anObjects, aDisplayed); + bool isCustomized = customizeFeature(anObjects, aDisplayed); //if (myObjectBrowser) // myObjectBrowser->processEvent(theMsg); @@ -499,7 +526,7 @@ bool XGUI_WorkshopListener::displayObject(ObjectPtr theObj) return aDisplayer->display(theObj, false); } -bool XGUI_WorkshopListener::customizeCurrentObject(const std::set& theObjects, +bool XGUI_WorkshopListener::customizeFeature(const std::set& theObjects, bool theForceRedisplay) { XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr(); @@ -519,11 +546,11 @@ bool XGUI_WorkshopListener::customizeCurrentObject(const std::set& th // the feature is hidden, but arguments of the feature are modified // e.g. extrusion is hidden(h=0) but sketch is chosen if (theForceRedisplay || theObjects.find(aCurrentFeature) != theObjects.end()) { - aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature, + aCustomized = myWorkshop->module()->customizeFeature(aCurrentFeature, ModuleBase_IModule::CustomizeArguments, false) || aCustomized; - aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature, + aCustomized = myWorkshop->module()->customizeFeature(aCurrentFeature, ModuleBase_IModule::CustomizeResults, false) || aCustomized; - aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature, + aCustomized = myWorkshop->module()->customizeFeature(aCurrentFeature, ModuleBase_IModule::CustomizeHighlightedObjects, false) || aCustomized; } }