From: vsv Date: Fri, 12 Sep 2014 12:01:44 +0000 (+0400) Subject: Issue #127: Create processing of events only in Workshop X-Git-Tag: V_0.4.4~65^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=214b63f5c1f1ddac5f938796eaef2618f783f1f8;p=modules%2Fshaper.git Issue #127: Create processing of events only in Workshop --- diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp index fcb176d1a..feb3c0b5e 100644 --- a/src/XGUI/XGUI_DocumentDataModel.cpp +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -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); diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index c62643ad0..9cd3bc933 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -348,3 +348,9 @@ void XGUI_ObjectsBrowser::setObjectsSelected(const QList& theObjects) } } } + +//*************************************************** +void XGUI_ObjectsBrowser::processEvent(const Events_Message* theMessage) +{ + myDocModel->processEvent(theMessage); +} diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h index c5149fdd9..0760242bd 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.h +++ b/src/XGUI/XGUI_ObjectsBrowser.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -93,6 +94,8 @@ Q_OBJECT void rebuildDataTree(); + void processEvent(const Events_Message* theMessage); + signals: //! Emited when selection is changed void selectionChanged(); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 9e21d4831..27b9716ac 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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 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(aLastPart); - if (aPart) + if (aPart) { activatePart(aPart); + } } //**************************************************************