From: sbh Date: Wed, 21 Jan 2015 13:29:19 +0000 (+0300) Subject: Small core corrections X-Git-Tag: V_1.0.0~33 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5aaa5a4c13ea66d9d08342dd4cc9d7c7c4f9441a;p=modules%2Fshaper.git Small core corrections --- diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index 159b7a2f6..7827db07c 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -177,7 +178,8 @@ void Model_Session::setActiveDocument( if (myCurrentDoc != theDoc) { myCurrentDoc = theDoc; if (theSendSignal) { - static std::shared_ptr aMsg(new Events_Message(Events_Loop::eventByName("CurrentDocumentChanged"))); + static std::shared_ptr aMsg( + new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED))); Events_Loop::loop()->send(aMsg); } } diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index 26441f253..9876e616a 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -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"; diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 87d424125..a0ee89260 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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& theMessa addFeature(aFeatureMsg); } } - // Process creation of Part else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) { std::shared_ptr aUpdMsg = @@ -337,36 +336,29 @@ void XGUI_Workshop::processEvent(const std::shared_ptr& 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 aUpdMsg = std::dynamic_pointer_cast(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 anUpdateMsg = std::dynamic_pointer_cast(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 aDelMsg = std::dynamic_pointer_cast(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 anUpdateMsg = std::dynamic_pointer_cast(theMessage); const std::set& aObjList = anUpdateMsg->objects(); @@ -375,9 +367,7 @@ void XGUI_Workshop::processEvent(const std::shared_ptr& 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 anUpdateMsg = std::dynamic_pointer_cast(theMessage); const std::set& aObjList = anUpdateMsg->objects(); @@ -387,7 +377,6 @@ void XGUI_Workshop::processEvent(const std::shared_ptr& 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 aPartSetMsg = @@ -402,8 +391,7 @@ void XGUI_Workshop::processEvent(const std::shared_ptr& 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 +}