From: nds Date: Tue, 31 Mar 2015 10:13:28 +0000 (+0300) Subject: Block/unblock signal is emitted for plane creation to avoid the planes blinking befor... X-Git-Tag: V_1.1.0~70^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c4a9fdea72e65053f5f11894a5fb76d3a0772d6c;p=modules%2Fshaper.git Block/unblock signal is emitted for plane creation to avoid the planes blinking before they are hidden. --- diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp index ad7077675..827065685 100644 --- a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp +++ b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp @@ -34,6 +34,12 @@ void InitializationPlugin_Plugin::processEvent(const std::shared_ptrdocument(); std::list aFeatures; + // the viewer update should be blocked in order to avoid the features blinking before they are + // hidden + std::shared_ptr aMsg = std::shared_ptr( + new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); + Events_Loop::loop()->send(aMsg); + aFeatures.push_back(createPoint(aDoc)); aFeatures.push_back(createPlane(aDoc, 1., 0., 0.)); aFeatures.push_back(createPlane(aDoc, 0., 1., 0.)); @@ -55,6 +61,13 @@ void InitializationPlugin_Plugin::processEvent(const std::shared_ptrflush(HIDE_DISP); + // the viewer update should be unblocked in order to avoid the features blinking before they are + // hidden + aMsg = std::shared_ptr( + new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); + + Events_Loop::loop()->send(aMsg); + } else if (theMessage.get()) { Events_Error::send( std::string("InitializationPlugin_Plugin::processEvent: unhandled message caught: ") diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index 20d2530bb..00e61330a 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -45,6 +45,10 @@ static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged"; static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest"; static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse"; + +static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked"; +static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked"; + /// Message that feature was changed (used for Object Browser update): moved, updated and deleted class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup { diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 3d7e3142e..0f02f7eb7 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -225,6 +225,9 @@ void XGUI_Workshop::startApplication() aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOHIDE)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SELFILTER_LOADED)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)); + registerValidators(); // Calling of loadCustomProps before activating module is required @@ -472,6 +475,12 @@ void XGUI_Workshop::processEvent(const std::shared_ptr& theMessa aMsg->parameters()); } } + } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)) { + // the viewer's update context will not happens until viewer updated is emitted + myDisplayer->enableUpdateViewer(false); + } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)) { + // the viewer's update context is unblocked, the viewer's update works + myDisplayer->enableUpdateViewer(true); } else { //Show error dialog if error message received. std::shared_ptr anAppError = std::dynamic_pointer_cast(theMessage);