]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Small core corrections
authorsbh <sergey.belash@opencascade.com>
Wed, 21 Jan 2015 13:29:19 +0000 (16:29 +0300)
committersbh <sergey.belash@opencascade.com>
Wed, 21 Jan 2015 13:29:19 +0000 (16:29 +0300)
src/Model/Model_Session.cpp
src/ModelAPI/ModelAPI_Events.h
src/XGUI/XGUI_Workshop.cpp

index 159b7a2f678b19e60ac6fac4862c1881100dbeca..7827db07c64db84db1b077ad47cbe93825dfac11 100644 (file)
@@ -12,6 +12,7 @@
 #include <Model_Application.h>
 #include <Model_Events.h>
 #include <Model_Validator.h>
+#include <ModelAPI_Events.h>
 #include <Events_Loop.h>
 #include <Events_Error.h>
 #include <Config_FeatureMessage.h>
@@ -177,7 +178,8 @@ void Model_Session::setActiveDocument(
   if (myCurrentDoc != theDoc) {
     myCurrentDoc = theDoc;
     if (theSendSignal) {
-      static std::shared_ptr<Events_Message> aMsg(new Events_Message(Events_Loop::eventByName("CurrentDocumentChanged")));
+      static std::shared_ptr<Events_Message> aMsg(
+          new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)));
       Events_Loop::loop()->send(aMsg);
     }
   }
index 26441f25336f9115398f9ea8bc68a88f1475e75c..9876e616a863ee3819af26cab49aa866bfc28e7b 100644 (file)
@@ -38,6 +38,8 @@ static const char * EVENT_PLUGIN_LOADED = "PliginLoaded";
 static const char * EVENT_OBJECT_TOSHOW = "ObjectShow";
 /// Event ID that data of feature has to be shown (comes with ModelAPI_ObjectUpdatedMessage)
 static const char * EVENT_OBJECT_TOHIDE = "ObjectHide";
+//
+static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged";
 
 static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest";
 static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse";
index 87d424125c0db2b5c4397f4760e73a6b5da6f351..a0ee892600a6e08320351deda27c4a0bf7d845ee 100644 (file)
@@ -187,9 +187,9 @@ void XGUI_Workshop::startApplication()
   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_OBJECT_DELETED));
-  aLoop->registerListener(this, Events_Loop::eventByName("LongOperation"));
+  aLoop->registerListener(this, Events_LongOp::eventID());
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED));
-  aLoop->registerListener(this, Events_Loop::eventByName("CurrentDocumentChanged"));
+  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOSHOW));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOHIDE));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SELFILTER_LOADED));
@@ -322,7 +322,6 @@ void XGUI_Workshop::processEvent(const std::shared_ptr<Events_Message>& theMessa
       addFeature(aFeatureMsg);
     }
   }
-
   // Process creation of Part
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
@@ -337,36 +336,29 @@ void XGUI_Workshop::processEvent(const std::shared_ptr<Events_Message>& theMessa
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED)) {
     myUpdatePrefs = true;
   }
-
   // Redisplay feature
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
     onFeatureRedisplayMsg(aUpdMsg);
   }
-
   //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)) {
     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
     onFeatureUpdatedMsg(anUpdateMsg);
-  }
-
-  else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
     std::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
         std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
     onObjectDeletedMsg(aDelMsg);
-  }
-
-  else if (theMessage->eventID() == Events_LongOp::eventID()) {
-    if (Events_LongOp::isPerformed())
+  } else if (theMessage->eventID() == Events_LongOp::eventID()) {
+    if (Events_LongOp::isPerformed()) {
       QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-    else
+    } else {
       QApplication::restoreOverrideCursor();
-  }
-
-  else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOSHOW)) {
+    }
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOSHOW)) {
     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
     const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
@@ -375,9 +367,7 @@ void XGUI_Workshop::processEvent(const std::shared_ptr<Events_Message>& theMessa
     for (aIt = aObjList.cbegin(); aIt != aObjList.cend(); ++aIt)
       aList.append(*aIt);
     showObjects(aList, true);
-  }
-
-  else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOHIDE)) {
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOHIDE)) {
     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
     const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
@@ -387,7 +377,6 @@ void XGUI_Workshop::processEvent(const std::shared_ptr<Events_Message>& theMessa
       aList.append(*aIt);
     showObjects(aList, false);
   }
-
   //An operation passed by message. Start it, process and commit.
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) {
     std::shared_ptr<Config_PointerMessage> aPartSetMsg =
@@ -402,8 +391,7 @@ void XGUI_Workshop::processEvent(const std::shared_ptr<Events_Message>& theMessa
           updateCommandStatus();
       }
     }
-  }
-  else if (theMessage->eventID() == Events_Loop::loop()->eventByName("CurrentDocumentChanged")) {
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
     myActionsMgr->update();
     // Find and Activate active part
     if (myPartActivating)
@@ -1388,4 +1376,4 @@ void XGUI_Workshop::displayObject(ObjectPtr theObj)
       viewer()->fitAll();
   } else 
     myDisplayer->display(theObj, false);
-}
\ No newline at end of file
+}