]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #127: Create processing of events only in Workshop
authorvsv <vitaly.smetannikov@opencascade.com>
Fri, 12 Sep 2014 12:01:44 +0000 (16:01 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Fri, 12 Sep 2014 12:01:44 +0000 (16:01 +0400)
src/XGUI/XGUI_DocumentDataModel.cpp
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_ObjectsBrowser.h
src/XGUI/XGUI_Workshop.cpp

index fcb176d1afcc0ccd61e5bb1b138d1f03e4a71431..feb3c0b5e9a4e18fb3ea966952e6e80603fdfd1e 100644 (file)
@@ -29,10 +29,10 @@ XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
       myActivePart(0)
 {
   // Register in event loop
-  Events_Loop* aLoop = Events_Loop::loop();
-  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
-  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
-  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
+  //Events_Loop* aLoop = Events_Loop::loop();
+  //aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
+  //aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+  //aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
 
   // Create a top part of data tree model
   myModel = new XGUI_TopDataModel(this);
index c62643ad065f97a18032baa3b02005e42e80c134..9cd3bc933ddd928ceb7b80b0b559e6704740e7df 100644 (file)
@@ -348,3 +348,9 @@ void XGUI_ObjectsBrowser::setObjectsSelected(const QList<ObjectPtr>& theObjects)
     }
   }
 }
+
+//***************************************************
+void XGUI_ObjectsBrowser::processEvent(const Events_Message* theMessage) 
+{ 
+  myDocModel->processEvent(theMessage); 
+}
index c5149fdd909435768d6f6954604590ac63ffd49a..0760242bd99033635f2fef12a25fb6aea9f8ee10 100644 (file)
@@ -5,6 +5,7 @@
 #include <ModuleBase_Definitions.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Events.h>
 
 #include <QWidget>
 #include <QTreeView>
@@ -93,6 +94,8 @@ Q_OBJECT
 
   void rebuildDataTree();
 
+  void processEvent(const Events_Message* theMessage);
+
 signals:
   //! Emited when selection is changed
   void selectionChanged();
index 9e21d483181271c7392633267faedee67cd52ab0..27b9716acf38f2ea721b51994e659856c595bed8 100644 (file)
@@ -361,6 +361,8 @@ void XGUI_Workshop::onFeatureUpdatedMsg(const ModelAPI_ObjectUpdatedMessage* the
     }
   }
   myOperationMgr->validateCurrentOperation();
+  if (myObjectBrowser)
+    myObjectBrowser->processEvent(theMsg);
 }
 
 //******************************************************
@@ -410,18 +412,20 @@ void XGUI_Workshop::onFeatureCreatedMsg(const ModelAPI_ObjectUpdatedMessage* the
       }
     }
   }
+  if (myObjectBrowser)
+    myObjectBrowser->processEvent(theMsg);
   if (isDisplayed)
     myDisplayer->updateViewer();
   if (aHasPart) {
-    //The created part will be created in Object Browser later and we have to activate it
-    // only when it is created everywere
-    QTimer::singleShot(50, this, SLOT(activateLastPart()));
+    activateLastPart();
   }
 }
 
 //******************************************************
 void XGUI_Workshop::onObjectDeletedMsg(const ModelAPI_ObjectDeletedMessage* theMsg)
 {
+  if (myObjectBrowser)
+    myObjectBrowser->processEvent(theMsg);
   //std::set<ObjectPtr> aFeatures = theMsg->objects();
 }
 
@@ -1054,8 +1058,9 @@ void XGUI_Workshop::activateLastPart()
   std::string aGrpName = ModelAPI_ResultPart::group();
   ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
   ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
-  if (aPart)
+  if (aPart) {
     activatePart(aPart);
+  }
 }
 
 //**************************************************************