Salome HOME
Issue #6 Extended processing of nested actions.
[modules/shaper.git] / src / XGUI / XGUI_DocumentDataModel.cpp
index 5e599abec1f0dd274e791ce3c5789c7217909b9f..1ee46e331e9d07ca4d2c47980bf40cdea6af65a0 100644 (file)
@@ -8,7 +8,7 @@
 #include <ModelAPI_Data.h>
 #include <Model_Events.h>
 
-#include <Event_Loop.h>
+#include <Events_Loop.h>
 
 
 #include <QIcon>
@@ -19,13 +19,13 @@ XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
   : QAbstractItemModel(theParent)
 {
   // Find Document object
-  std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+  boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
   myDocument = aMgr->currentDocument();
 
   // Register in event loop
-  Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_CREATED));
-  Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_UPDATED));
-  Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_DELETED));
+  Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_CREATED));
+  Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+  Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_DELETED));
 
   // Create a top part of data tree model
   myModel = new XGUI_TopDataModel(myDocument, this);
@@ -38,13 +38,13 @@ XGUI_DocumentDataModel::~XGUI_DocumentDataModel()
 }
 
 
-void XGUI_DocumentDataModel::processEvent(const Event_Message* theMessage)
+void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
 {
   // Created object event *******************
   if (QString(theMessage->eventID().eventText()) == EVENT_FEATURE_CREATED) {
-    const ModelAPI_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const ModelAPI_FeatureUpdatedMessage*>(theMessage);
-    std::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
-    std::shared_ptr<ModelAPI_Feature> aFeature = aUpdMsg->feature();
+    const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
+    boost::shared_ptr<ModelAPI_Feature> aFeature = aUpdMsg->feature();
+    boost::shared_ptr<ModelAPI_Document> aDoc = aFeature->document();
 
     if (aDoc == myDocument) {  // If root objects
       if (aFeature->getGroup().compare(PARTS_GROUP) == 0) { // Updsate only Parts group
@@ -79,8 +79,8 @@ void XGUI_DocumentDataModel::processEvent(const Event_Message* theMessage)
 
   // Deteted object event ***********************
   } else if (QString(theMessage->eventID().eventText()) == EVENT_FEATURE_DELETED) {
-    const ModelAPI_FeatureDeletedMessage* aUpdMsg = dynamic_cast<const ModelAPI_FeatureDeletedMessage*>(theMessage);
-    std::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
+    const Model_FeatureDeletedMessage* aUpdMsg = dynamic_cast<const Model_FeatureDeletedMessage*>(theMessage);
+    boost::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
 
     if (aDoc == myDocument) {  // If root objects
       if (aUpdMsg->group().compare(PARTS_GROUP) == 0) { // Updsate only Parts group
@@ -253,7 +253,7 @@ FeaturePtr XGUI_DocumentDataModel::feature(const QModelIndex& theIndex) const
 {
   QModelIndex aIndex = toSourceModelIndex(theIndex);
   if (!hasSubModel(aIndex.model())) 
-    return 0;
+    return FeaturePtr();
 
   const XGUI_FeaturesModel* aModel = dynamic_cast<const XGUI_FeaturesModel*>(aIndex.model());
   return aModel->feature(aIndex);
@@ -295,4 +295,4 @@ bool XGUI_DocumentDataModel::hasSubModel(const QAbstractItemModel* theModel) con
     if ((*aIt) == theModel)
       return true;
   return false;
-}
\ No newline at end of file
+}