From: jfa Date: Tue, 31 Jul 2007 08:06:15 +0000 (+0000) Subject: Provide correct modified/not modified study state. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a8d7556e9fad2a5f264366efa32a25c7ad0f4e83;p=modules%2Fmultipr.git Provide correct modified/not modified study state. --- diff --git a/src/MULTIPR/MULTIPR_i.cxx b/src/MULTIPR/MULTIPR_i.cxx index e4663c2..a415f41 100644 --- a/src/MULTIPR/MULTIPR_i.cxx +++ b/src/MULTIPR/MULTIPR_i.cxx @@ -318,6 +318,19 @@ MULTIPR_ORB::MULTIPR_Obj_ptr MULTIPR_Gen_i::getObject (const char* medFilename) } +void MULTIPR_Gen_i::ObjModified (MULTIPR_ORB::MULTIPR_Obj_ptr theObj) +{ + // Mark current study as modified, if theObj is published in it + if (!CORBA::is_nil(myCurrentStudy) && !CORBA::is_nil(theObj)) + { + SALOMEDS::SObject_var aSO = myCurrentStudy->FindObjectIOR(_orb->object_to_string(theObj)); + // if published + if (!CORBA::is_nil(aSO)) + myCurrentStudy->Modified(); + } +} + + MULTIPR_Obj_i::MULTIPR_Obj_i (PortableServer::POA_ptr thePOA, const char* medFilename, bool isPersistence, @@ -429,6 +442,9 @@ void MULTIPR_Obj_i::setMesh (const char* meshName) e.dump(cout); THROW_SALOME_CORBA_EXCEPTION("Unable to set mesh", SALOME::INTERNAL_ERROR); } + + // Mark current study as modified, if theObj is published in it + _engine->ObjModified(_this()); } std::string MULTIPR_Obj_i::getMeshName() const @@ -452,6 +468,9 @@ void MULTIPR_Obj_i::setBoxing (CORBA::Long pBoxing) // Dump Python MULTIPR::TPythonDump(_engine) << this << ".setBoxing(" << pBoxing << ")"; + + // Mark current study as modified, if theObj is published in it + _engine->ObjModified(_this()); } @@ -588,6 +607,9 @@ MULTIPR_ORB::string_array* MULTIPR_Obj_i::partitionneDomaine() THROW_SALOME_CORBA_EXCEPTION("Unable to partition mesh", SALOME::INTERNAL_ERROR); } + // Mark current study as modified, if theObj is published in it + _engine->ObjModified(_this()); + return mySeq._retn(); } @@ -631,6 +653,9 @@ MULTIPR_ORB::string_array* MULTIPR_Obj_i::partitionneGrain( THROW_SALOME_CORBA_EXCEPTION(aStream.str().c_str(), SALOME::INTERNAL_ERROR); } + // Mark current study as modified, if theObj is published in it + _engine->ObjModified(_this()); + return mySeq._retn(); } @@ -679,6 +704,9 @@ MULTIPR_ORB::string_array* MULTIPR_Obj_i::decimePartition( THROW_SALOME_CORBA_EXCEPTION("Unable to decimate", SALOME::INTERNAL_ERROR); } + // Mark current study as modified, if theObj is published in it + _engine->ObjModified(_this()); + return mySeq._retn(); } @@ -729,6 +757,9 @@ MULTIPR_ORB::string_array* MULTIPR_Obj_i::decimatePart( THROW_SALOME_CORBA_EXCEPTION("Unable to decimate", SALOME::INTERNAL_ERROR); } + // Mark current study as modified, if theObj is published in it + _engine->ObjModified(_this()); + return mySeq._retn(); } @@ -776,6 +807,9 @@ void MULTIPR_Obj_i::removeParts (const char* pPrefixPartName) // Dump Python MULTIPR::TPythonDump(_engine) << this << ".removeParts(\"" << pPrefixPartName << "\")"; + + // Mark current study as modified, if theObj is published in it + _engine->ObjModified(_this()); } @@ -1547,7 +1581,7 @@ SALOMEDS::SObject_ptr MULTIPR_Gen_i::PublishInStudy (SALOMEDS::Study_ptr theSt MULTIPR_ORB::MULTIPR_Obj_var anObj = MULTIPR_ORB::MULTIPR_Obj::_narrow(theIOR); if (!anObj->_is_nil()) { - //aSO = ObjectToSObject(theStudy, anObj); + aSO = theStudy->FindObjectIOR(_orb->object_to_string(anObj)); if (aSO->_is_nil()) { SALOMEDS::GenericAttribute_var anAttr; diff --git a/src/MULTIPR/MULTIPR_i.hxx b/src/MULTIPR/MULTIPR_i.hxx index 9996197..a12f7c9 100644 --- a/src/MULTIPR/MULTIPR_i.hxx +++ b/src/MULTIPR/MULTIPR_i.hxx @@ -388,6 +388,9 @@ public: // Get current study SALOMEDS::Study_ptr GetCurrentStudy(); + // Mark current study as modified, if theObj is published in it + void ObjModified (MULTIPR_ORB::MULTIPR_Obj_ptr theObj); + // **************************************************** // Interface inherited methods (from SALOMEDS::Driver) // **************************************************** diff --git a/src/MULTIPRGUI/MULTIPR_GUI.cxx b/src/MULTIPRGUI/MULTIPR_GUI.cxx index 56755cd..bc8ec27 100644 --- a/src/MULTIPRGUI/MULTIPR_GUI.cxx +++ b/src/MULTIPRGUI/MULTIPR_GUI.cxx @@ -102,6 +102,7 @@ public: } else { myApp->updateObjectBrowser(); + myApp->updateActions(); } QApplication::restoreOverrideCursor(); } @@ -480,6 +481,7 @@ void MULTIPR_GUI::OnImportFromMEDFile() } getApp()->updateObjectBrowser(); + getApp()->updateActions(); } } @@ -527,6 +529,7 @@ void MULTIPR_GUI::OnPartition2() dialog->exec(); delete dialog; getApp()->updateObjectBrowser(); + getApp()->updateActions(); } @@ -559,6 +562,7 @@ void MULTIPR_GUI::OnDecimate() dialog->exec(); delete dialog; getApp()->updateObjectBrowser(); + getApp()->updateActions(); } @@ -616,6 +620,7 @@ void MULTIPR_GUI::OnRemove() QApplication::restoreOverrideCursor(); getApp()->updateObjectBrowser(); + getApp()->updateActions(); } @@ -777,6 +782,7 @@ bool MULTIPR_GUI::removeLowerResolution() QApplication::restoreOverrideCursor(); getApp()->updateObjectBrowser(); + getApp()->updateActions(); } return true;