]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Block/unblock signal is emitted for plane creation to avoid the planes blinking befor...
authornds <natalia.donis@opencascade.com>
Tue, 31 Mar 2015 10:13:28 +0000 (13:13 +0300)
committernds <natalia.donis@opencascade.com>
Tue, 31 Mar 2015 10:13:28 +0000 (13:13 +0300)
src/InitializationPlugin/InitializationPlugin_Plugin.cpp
src/ModelAPI/ModelAPI_Events.h
src/XGUI/XGUI_Workshop.cpp

index ad707767504d2ef5379632a241af8b2f906762fe..8270656852020ed435d8f0856abc319edddf92f2 100644 (file)
@@ -34,6 +34,12 @@ void InitializationPlugin_Plugin::processEvent(const std::shared_ptr<Events_Mess
     DocumentPtr aDoc = aMessage->document();
     std::list<FeaturePtr> aFeatures;
 
+    // the viewer update should be blocked in order to avoid the features blinking before they are
+    // hidden
+    std::shared_ptr<Events_Message> aMsg = std::shared_ptr<Events_Message>(
+        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_ptr<Events_Mess
     }
     Events_Loop::loop()->flush(HIDE_DISP);
 
+    // the viewer update should be unblocked in order to avoid the features blinking before they are
+    // hidden
+    aMsg = std::shared_ptr<Events_Message>(
+                  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: ")
index 20d2530bb1c9ddf12d3bf35642b0acbf9cc18998..00e61330a7634b121fe47a5fc8361fe63229b7c1 100644 (file)
@@ -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
 {
index 3d7e3142e63577773d374a016e19acbaab6ab7e2..0f02f7eb768d8bb91fde416a2b88073e9ece6e41 100644 (file)
@@ -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<Events_Message>& 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<Events_Error> anAppError = std::dynamic_pointer_cast<Events_Error>(theMessage);