From a3dda7e34715663d4fdc7adbf22920c3ac8455c7 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 28 Aug 2006 14:19:33 +0000 Subject: [PATCH] Consider OCCT version --- src/CAF/CAF_Study.cxx | 16 +++++++++++++ src/DDS/DDS_Dictionary.cxx | 4 ++++ src/SUITApp/SUITApp_Application.cxx | 24 +++++++++++--------- src/SalomeApp/SalomeApp_ExceptionHandler.cxx | 19 ++++++++++++---- src/Session/SALOME_Session_Server.cxx | 24 +++++++++++--------- 5 files changed, 60 insertions(+), 27 deletions(-) diff --git a/src/CAF/CAF_Study.cxx b/src/CAF/CAF_Study.cxx index 46dbea788..79d0da098 100755 --- a/src/CAF/CAF_Study.cxx +++ b/src/CAF/CAF_Study.cxx @@ -88,7 +88,9 @@ 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 ); if ( !formats.IsEmpty() ) @@ -123,7 +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 ) { @@ -152,7 +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 @@ -189,7 +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(); @@ -212,7 +220,9 @@ 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(); } @@ -232,7 +242,9 @@ 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() ) @@ -324,7 +336,9 @@ bool CAF_Study::undo() 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 */ } @@ -345,7 +359,9 @@ bool CAF_Study::redo() 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 5696d05d1..4fb61b601 100644 --- a/src/DDS/DDS_Dictionary.cxx +++ b/src/DDS/DDS_Dictionary.cxx @@ -221,7 +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 ) { @@ -239,7 +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 8518b89c9..bf32979de 100644 --- a/src/SUITApp/SUITApp_Application.cxx +++ b/src/SUITApp/SUITApp_Application.cxx @@ -69,17 +69,19 @@ myExceptHandler( hand ) */ bool SUITApp_Application::notify( QObject* receiver, QEvent* e ) { -// // Disable GUI user actions while python command is executed -// if (SUIT_Session::IsPythonExecuted()) { -// // Disable mouse and keyboard events -// QEvent::Type aType = e->type(); -// if (aType == QEvent::MouseButtonPress || aType == QEvent::MouseButtonRelease || -// aType == QEvent::MouseButtonDblClick || aType == QEvent::MouseMove || -// aType == QEvent::Wheel || aType == QEvent::ContextMenu || -// aType == QEvent::KeyPress || aType == QEvent::KeyRelease || -// aType == QEvent::Accel || aType == QEvent::AccelOverride) -// return false; -// } +#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 + QEvent::Type aType = e->type(); + if (aType == QEvent::MouseButtonPress || aType == QEvent::MouseButtonRelease || + aType == QEvent::MouseButtonDblClick || aType == QEvent::MouseMove || + aType == QEvent::Wheel || aType == QEvent::ContextMenu || + aType == QEvent::KeyPress || aType == QEvent::KeyRelease || + 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 0d0b77512..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,8 +25,12 @@ #include -#include -#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 ) @@ -39,13 +42,19 @@ 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 ); } -//CASCatch_CATCH(Standard_Failure) { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 catch(Standard_Failure) { +#else + CASCatch_CATCH(Standard_Failure) { +#endif Handle(Standard_Failure) aFail = Standard_Failure::Caught(); throw Standard_Failure( aFail->GetMessageString() ); } diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index ffc25888f..1a9987a54 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -247,17 +247,19 @@ public: virtual bool notify( QObject* receiver, QEvent* e ) { -// // Disable GUI user actions while python command is executed -// if (SUIT_Session::IsPythonExecuted()) { -// // Disable mouse and keyboard events -// QEvent::Type aType = e->type(); -// if (aType == QEvent::MouseButtonPress || aType == QEvent::MouseButtonRelease || -// aType == QEvent::MouseButtonDblClick || aType == QEvent::MouseMove || -// aType == QEvent::Wheel || aType == QEvent::ContextMenu || -// aType == QEvent::KeyPress || aType == QEvent::KeyRelease || -// aType == QEvent::Accel || aType == QEvent::AccelOverride) -// return false; -// } +#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 + QEvent::Type aType = e->type(); + if (aType == QEvent::MouseButtonPress || aType == QEvent::MouseButtonRelease || + aType == QEvent::MouseButtonDblClick || aType == QEvent::MouseMove || + aType == QEvent::Wheel || aType == QEvent::ContextMenu || + aType == QEvent::KeyPress || aType == QEvent::KeyRelease || + aType == QEvent::Accel || aType == QEvent::AccelOverride) + return false; + } +#endif return myHandler ? myHandler->handle( receiver, e ) : QApplication::notify( receiver, e ); -- 2.39.2