From 0d732d09ee00388974a4de6e9da9c5315a97c8c4 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 30 Aug 2007 12:00:57 +0000 Subject: [PATCH] Join modifications from BR_MULTIPR_INDUS --- src/STD/STD_Application.cxx | 2 ++ src/SUIT/SUIT_Application.cxx | 14 +++++++++++++- src/SUIT/SUIT_Application.h | 3 +++ src/SUIT/SUIT_Study.cxx | 9 +++++++++ src/SUIT/SUIT_Study.h | 1 + src/SalomeApp/SalomeApp_Study.cxx | 10 ++++++++++ src/SalomeApp/SalomeApp_Study.h | 1 + 7 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index 90690cad7..41f98bcaa 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -577,6 +577,8 @@ void STD_Application::updateDesktopTitle() /*!Update commands status.*/ void STD_Application::updateCommandsStatus() { + SUIT_Application::updateCommandsStatus(); + bool aHasStudy = activeStudy() != 0; bool aIsNeedToSave = false; if ( aHasStudy ) diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index 5033fd64e..903d7141a 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -48,8 +48,8 @@ SUIT_Application::SUIT_Application() */ SUIT_Application::~SUIT_Application() { + setActiveStudy( 0 ); delete myStudy; - myStudy = 0; setDesktop( 0 ); } @@ -206,6 +206,12 @@ void SUIT_Application::onInfoClear() emit infoChanged( QString::null ); } +/*! + Updates status of the registerd actions +*/ +void SUIT_Application::updateCommandsStatus() +{} + /*! Initialize with application arguments \param argc - number of application arguments @@ -268,6 +274,12 @@ void SUIT_Application::setActiveStudy( SUIT_Study* study ) if ( myStudy == study ) return; + if(myStudy) + disconnect(myStudy, SIGNAL( studyModified( SUIT_Study* ) ), this, SLOT( updateCommandsStatus() ) ); + + if(study) + connect(study, SIGNAL( studyModified( SUIT_Study* ) ), this, SLOT( updateCommandsStatus() ) ); + myStudy = study; } diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index 2bf9da355..9efe0f3b6 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -117,6 +117,9 @@ signals: void activated( SUIT_Application* ); void infoChanged( QString ); +public slots: + virtual void updateCommandsStatus(); + private slots: void onInfoClear(); diff --git a/src/SUIT/SUIT_Study.cxx b/src/SUIT/SUIT_Study.cxx index 19dabb03b..801d9ecb0 100755 --- a/src/SUIT/SUIT_Study.cxx +++ b/src/SUIT/SUIT_Study.cxx @@ -200,6 +200,15 @@ void SUIT_Study::setIsModified( const bool on ) myIsModified = on; } +/*! + Set study modified to \a on. + */ +void SUIT_Study::Modified() +{ + setIsModified( TRUE ); + sendChangesNotification(); +} + /*! Set root object. */ diff --git a/src/SUIT/SUIT_Study.h b/src/SUIT/SUIT_Study.h index fc6c35f0c..15f78a351 100755 --- a/src/SUIT/SUIT_Study.h +++ b/src/SUIT/SUIT_Study.h @@ -50,6 +50,7 @@ public: virtual bool isSaved() const; virtual bool isModified() const; + virtual void Modified(); virtual void createDocument(); virtual void closeDocument( bool = true ); diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index 503438d4a..aeee814b6 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -308,6 +308,16 @@ bool SalomeApp_Study::isModified() const return isAnyChanged; } +/*! + Set study modified to \a on. + */ +void SalomeApp_Study::Modified() +{ + if(_PTR(Study) aStudy = studyDS()) + aStudy->Modified(); + LightApp_Study::Modified(); +} + /*! \return if data model is saved */ diff --git a/src/SalomeApp/SalomeApp_Study.h b/src/SalomeApp/SalomeApp_Study.h index 707518a37..516df81d8 100644 --- a/src/SalomeApp/SalomeApp_Study.h +++ b/src/SalomeApp/SalomeApp_Study.h @@ -51,6 +51,7 @@ public: virtual bool isSaved() const; virtual bool isModified() const; + virtual void Modified(); virtual void addComponent ( const CAM_DataModel* dm); -- 2.39.2