From 55f17f8c0789c9d437f6845b45ae4574db47face Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 4 Sep 2006 11:30:42 +0000 Subject: [PATCH] Join modifications from branch BR_For_OCT_611: migration to OCCT6.1.1 with new exception handling and improved threads support. --- src/CAF/CAF_Study.cxx | 43 ++++++++++++++++---- src/DDS/DDS_Dictionary.cxx | 6 +++ src/SUITApp/SUITApp_Application.cxx | 2 + src/SalomeApp/SalomeApp_ExceptionHandler.cxx | 23 +++++++++-- src/Session/Makefile.in | 2 +- src/Session/SALOME_Session_Server.cxx | 2 + 6 files changed, 64 insertions(+), 14 deletions(-) diff --git a/src/CAF/CAF_Study.cxx b/src/CAF/CAF_Study.cxx index 7acc291dc..79d0da098 100755 --- a/src/CAF/CAF_Study.cxx +++ b/src/CAF/CAF_Study.cxx @@ -31,6 +31,7 @@ #include #include +#include #include /*! @@ -87,8 +88,11 @@ void CAF_Study::createDocument() if ( app && !app->stdApp().IsNull() ) { try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif TColStd_SequenceOfExtendedString formats; - app->stdApp()->Formats( formats ); + app->stdApp()->Formats( formats ); if ( !formats.IsEmpty() ) app->stdApp()->NewDocument( formats.First(), myStdDoc ); } @@ -121,6 +125,9 @@ bool CAF_Study::openDocument( const QString& fname ) bool status = false; try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif status = app->Open( CAF_Tools::toExtString( fname ), myStdDoc ) == CDF_RS_OK; } catch ( Standard_Failure ) { @@ -149,6 +156,9 @@ bool CAF_Study::saveDocumentAs( const QString& fname ) bool status = false; try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif if ( save ) status = app->Save( stdDoc() ) == CDF_SS_OK; else @@ -185,6 +195,9 @@ bool CAF_Study::openTransaction() bool res = true; try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif if ( myStdDoc->HasOpenCommand() ) myStdDoc->AbortCommand(); @@ -207,8 +220,11 @@ bool CAF_Study::abortTransaction() bool res = true; try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif myStdDoc->AbortCommand(); - update(); + update(); } catch ( Standard_Failure ) { res = false; @@ -226,12 +242,15 @@ bool CAF_Study::commitTransaction( const QString& name ) bool res = true; try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif myStdDoc->CommitCommand(); if ( canUndo() ) { Handle(TDF_Delta) d = myStdDoc->GetUndos().Last(); - if ( !d.IsNull() ) + if ( !d.IsNull() ) d->SetName( CAF_Tools::toExtString( name ) ); } } @@ -313,18 +332,21 @@ void CAF_Study::clearModified() */ bool CAF_Study::undo() { - if ( myStdDoc.IsNull() ) + if ( myStdDoc.IsNull() ) return false; try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif myStdDoc->Undo(); undoModified(); /* decrement modification counter */ } catch ( Standard_Failure ) { - SUIT_MessageBox::error1( application()->desktop(), tr( "ERR_ERROR" ), - tr( "ERR_DOC_UNDO" ), tr ( "BUT_OK" ) ); - return false; - } + SUIT_MessageBox::error1(application()->desktop(), tr( "ERR_ERROR" ), + tr( "ERR_DOC_UNDO" ), tr ( "BUT_OK" )); + return false; + } return true; } @@ -333,10 +355,13 @@ bool CAF_Study::undo() */ bool CAF_Study::redo() { - if ( myStdDoc.IsNull() ) + if ( myStdDoc.IsNull() ) return false; try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif myStdDoc->Redo(); doModified(); /* increment modification counter */ } diff --git a/src/DDS/DDS_Dictionary.cxx b/src/DDS/DDS_Dictionary.cxx index adaff0469..4fb61b601 100644 --- a/src/DDS/DDS_Dictionary.cxx +++ b/src/DDS/DDS_Dictionary.cxx @@ -221,6 +221,9 @@ Standard_Real DDS_Dictionary::ToSI( const Standard_Real theValue, const Standard if ( theUnits && *theUnits && strcmp( theUnits, "%" ) ) { try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif aRetValue = UnitsAPI::AnyToSI( theValue, theUnits ); } catch( Standard_Failure ) { @@ -238,6 +241,9 @@ Standard_Real DDS_Dictionary::FromSI( const Standard_Real theValue, const Standa if ( theUnits && *theUnits && strcmp( theUnits, "%" ) ) { try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif aRetValue = UnitsAPI::AnyFromSI( theValue, theUnits ); } catch( Standard_Failure ) { diff --git a/src/SUITApp/SUITApp_Application.cxx b/src/SUITApp/SUITApp_Application.cxx index af2badc6b..bf32979de 100644 --- a/src/SUITApp/SUITApp_Application.cxx +++ b/src/SUITApp/SUITApp_Application.cxx @@ -69,6 +69,7 @@ myExceptHandler( hand ) */ bool SUITApp_Application::notify( QObject* receiver, QEvent* e ) { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) < 0x060101 // Disable GUI user actions while python command is executed if (SUIT_Session::IsPythonExecuted()) { // Disable mouse and keyboard events @@ -80,6 +81,7 @@ bool SUITApp_Application::notify( QObject* receiver, QEvent* e ) aType == QEvent::Accel || aType == QEvent::AccelOverride) return false; } +#endif return myExceptHandler ? myExceptHandler->handle( receiver, e ) : QApplication::notify( receiver, e ); diff --git a/src/SalomeApp/SalomeApp_ExceptionHandler.cxx b/src/SalomeApp/SalomeApp_ExceptionHandler.cxx index b22ab38d8..81cd56b04 100644 --- a/src/SalomeApp/SalomeApp_ExceptionHandler.cxx +++ b/src/SalomeApp/SalomeApp_ExceptionHandler.cxx @@ -17,7 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "SalomeApp_ExceptionHandler.h" -#include "CASCatch.hxx" #include @@ -26,6 +25,13 @@ #include +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + #include + #include +#else + #include "CASCatch.hxx" +#endif + /*!Constructor. Initialize by \a floatSignal.*/ SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal ) : SUIT_ExceptionHandler() @@ -36,14 +42,23 @@ SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal ) /*!Try to call SUIT_ExceptionHandler::internalHandle(o, e), catch if failure.*/ bool SalomeApp_ExceptionHandler::handleSignals( QObject* o, QEvent* e ) { - CASCatch_TRY { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + try { + OCC_CATCH_SIGNALS; +#else + CASCatch_TRY { +#endif SUIT_ExceptionHandler::internalHandle( o, e ); } +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + catch(Standard_Failure) { +#else CASCatch_CATCH(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); +#endif + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); throw Standard_Failure( aFail->GetMessageString() ); } - + return true; } diff --git a/src/Session/Makefile.in b/src/Session/Makefile.in index 6379a1395..a02da3494 100755 --- a/src/Session/Makefile.in +++ b/src/Session/Makefile.in @@ -59,7 +59,7 @@ LIB_SERVER_IDL = SALOME_Session.idl SalomeApp_Engine.idl BIN_SERVER_IDL = BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOME_Registry.idl SALOME_ModuleCatalog.idl SALOME_Exception.idl SALOME_GenericObj.idl -CPPFLAGS += $(QT_MT_INCLUDES) $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(BOOST_CPPFLAGS) $(KERNEL_CXXFLAGS) -I$(OCC_INCLUDES) +CPPFLAGS += $(QT_MT_INCLUDES) $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(BOOST_CPPFLAGS) $(KERNEL_CXXFLAGS) $(OCC_INCLUDES) CXXFLAGS += $(OCC_CXXFLAGS) $(BOOST_CPPFLAGS) LDFLAGS += $(QT_MT_LIBS) $(KERNEL_LDFLAGS) -lSalomeNS -lsuit -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lwith_loggerTraceCollector -lEvent -lSalomeCatalog -lSalomeDSClient $(CAS_KERNEL) diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 4aec7c8ed..1a9987a54 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -247,6 +247,7 @@ public: virtual bool notify( QObject* receiver, QEvent* e ) { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) < 0x060101 // Disable GUI user actions while python command is executed if (SUIT_Session::IsPythonExecuted()) { // Disable mouse and keyboard events @@ -258,6 +259,7 @@ public: aType == QEvent::Accel || aType == QEvent::AccelOverride) return false; } +#endif return myHandler ? myHandler->handle( receiver, e ) : QApplication::notify( receiver, e ); -- 2.39.2