From a9e75317b195d4067963d789dcf07020deda3f3d Mon Sep 17 00:00:00 2001 From: mpa Date: Thu, 13 Oct 2016 14:11:42 +0300 Subject: [PATCH] Multi-study removing (addition). --- CMakeLists.txt | 7 ----- SalomeGUIConfig.cmake.in | 4 --- src/LightApp/LightApp_Application.cxx | 6 ---- src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 28 +------------------ src/SALOME_PYQT/SalomePyQt/SalomePyQt.h | 1 - src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip | 1 - src/SALOME_SWIG/SALOMEGUI_Swig.cxx | 26 +---------------- src/SALOME_SWIG/SALOMEGUI_Swig.hxx | 1 - src/SALOME_SWIG/SALOMEGUI_Swig.i | 1 - src/SOCC/SOCC_ViewModel.cxx | 34 ----------------------- src/SPlot2d/SPlot2d_ViewModel.cxx | 25 ----------------- src/SVTK/SVTK_ViewModel.cxx | 23 --------------- src/SalomeApp/SalomeApp_Application.cxx | 5 ++-- src/SalomeApp/SalomeApp_Study.cxx | 11 +------- src/Session/Session_ServerThread.cxx | 2 +- src/Session/Session_Session_i.cxx | 10 ------- src/Session/Session_Session_i.hxx | 2 -- 17 files changed, 6 insertions(+), 181 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f39f3c257..d5e474ae0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,12 +89,10 @@ OPTION(SALOME_USE_PVVIEWER "Enable ParaView visualization (Mandatory in classic CMAKE_DEPENDENT_OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory in classic configurations)" ON "SALOME_LIGHT_ONLY" ON) -OPTION(SALOME_USE_SINGLE_DESKTOP "Enable multiple document interface" ON) MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_VTKVIEWER SALOME_USE_GRAPHICSVIEW SALOME_USE_PVVIEWER) MARK_AS_ADVANCED(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_PLOT2DVIEWER) MARK_AS_ADVANCED(SALOME_USE_PYCONSOLE SALOME_USE_QXGRAPHVIEWER SALOME_USE_PYVIEWER) -MARK_AS_ADVANCED(SALOME_USE_SINGLE_DESKTOP) # Prerequisites # ============= @@ -146,11 +144,6 @@ IF(SALOME_GUI_USE_OBSERVERS) ADD_DEFINITIONS(-DWITH_SALOMEDS_OBSERVER) ENDIF() -# Single-study GUI -IF(SALOME_USE_SINGLE_DESKTOP) - ADD_DEFINITIONS(-DSINGLE_DESKTOP) -ENDIF() - # OCCT FIND_PACKAGE(SalomeCAS REQUIRED) diff --git a/SalomeGUIConfig.cmake.in b/SalomeGUIConfig.cmake.in index 74af92640..bcd7e3c24 100644 --- a/SalomeGUIConfig.cmake.in +++ b/SalomeGUIConfig.cmake.in @@ -63,16 +63,12 @@ SET(SALOME_USE_PVVIEWER @SALOME_USE_PVVIEWER@) SET(SALOME_USE_PYVIEWER @SALOME_USE_PYVIEWER@) SET(SALOME_USE_PYCONSOLE @SALOME_USE_PYCONSOLE@) SET(SALOME_USE_SALOMEOBJECT @SALOME_USE_SALOMEOBJECT@) -SET(SALOME_USE_SINGLE_DESKTOP @SALOME_USE_SINGLE_DESKTOP@) SET(SALOME_GUI_USE_OBSERVERS @SALOME_GUI_USE_OBSERVERS@) SET(SALOME_GUI_USE_OPENGL2 @SALOME_GUI_USE_OPENGL2@) IF(SALOME_GUI_LIGHT_ONLY) LIST(APPEND GUI_DEFINITIONS "-DGUI_DISABLE_CORBA") ENDIF() -IF(SALOME_USE_SINGLE_DESKTOP) - LIST(APPEND GUI_DEFINITIONS "-DSINGLE_DESKTOP") -ENDIF() IF(SALOME_GUI_USE_OBSERVERS) LIST(APPEND GUI_DEFINITIONS "-DWITH_SALOMEDS_OBSERVER") ENDIF() diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 0015d75ce..0f9388e8b 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -922,10 +922,8 @@ void LightApp_Application::onNewWindow() */ void LightApp_Application::onNewDoc() { -#ifdef SINGLE_DESKTOP if ( !checkExistingDoc() ) return; -#endif //asl: fix for 0020515 saveDockWindowsState(); @@ -940,10 +938,8 @@ void LightApp_Application::onOpenDoc() { SUIT_Study* study = activeStudy(); -#ifdef SINGLE_DESKTOP if ( !checkExistingDoc() ) return; -#endif CAM_Application::onOpenDoc(); @@ -960,10 +956,8 @@ void LightApp_Application::onOpenDoc() */ bool LightApp_Application::onOpenDoc( const QString& aName ) { -#ifdef SINGLE_DESKTOP if ( !checkExistingDoc() ) return false; -#endif saveDockWindowsState(); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 69544f95a..8dadb719f 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -510,30 +510,6 @@ QTreeView* SalomePyQt::getObjectBrowser() return ProcessEvent( new TGetObjectBrowserEvent() ); } -/*! - \fn int SalomePyQt::getStudyId(); - \brief Get active study's identifier. - \return active study ID or 0 if there is no active study -*/ - -class TGetStudyIdEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - TGetStudyIdEvent() : myResult( 0 ) {} - virtual void Execute() - { - if ( LightApp_Study* aStudy = getActiveStudy() ) { - myResult = aStudy->id(); - } - } -}; -int SalomePyQt::getStudyId() -{ - return ProcessEvent( new TGetStudyIdEvent() ); -} - /*! \fn SALOME_Selection* SalomePyQt::getSelection(); \brief Get the selection object for the current study. @@ -667,14 +643,12 @@ bool SalomePyQt::activateModule( const QString& modName ) } /*! - \brief Update an Object Browser of the specified (by identifier) study. + \brief Update an Object Browser of the study. - If \a studyId <= 0 the active study's object browser is updated. The \a updateSelection parameter is obsolete and currently is not used. This parameter will be removed in future, so try to avoid its usage in your code. - \brief studyId study identifier \brief updateSelection update selection flag (not used) \sa getActiveStudy() */ diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 72f45703d..70fe3a665 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -169,7 +169,6 @@ public: static QMenu* getPopupMenu( const QString& ); static QTreeView* getObjectBrowser(); static SALOME_Selection* getSelection(); - static int getStudyId(); static void putInfo( const QString&, const int = 0 ); static const QString getActiveComponent(); static PyObject* getActivePythonModule(); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index c6d3bd3dc..d76e181b6 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -271,7 +271,6 @@ public: static QMenu* getPopupMenu( const QString& ) /ReleaseGIL/ ; static QTreeView* getObjectBrowser() /ReleaseGIL/ ; static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ; - static int getStudyId() /ReleaseGIL/ ; static void putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ; static const QString getActiveComponent() /ReleaseGIL/ ; static SIP_PYOBJECT getActivePythonModule() /ReleaseGIL/ ; diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx index b56a92be2..7d85191c0 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx @@ -70,7 +70,7 @@ This module provides an access to the SALOME GUI implementing set of functions which can be used from Python. This module is implemented using SWIG wrappings for some GUI functionality: - - getActiveStudyId(), getActiveStudyName() : get active study identifier and name + - getActiveStudyName() : get active study name - updateObjBrowser() : update contents of the Object Browser - SelectedCount() : get number of currently selected items - getSelected() : get entry of the speicified selected item @@ -191,30 +191,6 @@ void SALOMEGUI_Swig::updateObjBrowser( bool /*updateSelection*/ ) ProcessVoidEvent( new TEvent() ); } -/*! - \fn int SALOMEGUI_Swig::getActiveStudyId() - \brief Get active study identifier - \return active study's ID or 0 if there is no active study -*/ - -class TGetActiveStudyIdEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - TGetActiveStudyIdEvent() : myResult( 0 ) {} - virtual void Execute() - { - if ( LightApp_Study* aStudy = getActiveStudy() ) { - myResult = aStudy->id(); - } - } -}; -int SALOMEGUI_Swig::getActiveStudyId() -{ - return ProcessEvent( new TGetActiveStudyIdEvent() ); -} - /*! \fn const char* SALOMEGUI_Swig::getActiveStudyName() \brief Get active study name diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.hxx b/src/SALOME_SWIG/SALOMEGUI_Swig.hxx index 6b537c8c9..fb735652b 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.hxx +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.hxx @@ -37,7 +37,6 @@ public: void updateObjBrowser( bool ); - int getActiveStudyId(); const char* getActiveStudyName(); const char* getComponentName( const char* ); diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.i b/src/SALOME_SWIG/SALOMEGUI_Swig.i index 10631d881..3b846dfe9 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.i +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.i @@ -60,7 +60,6 @@ public: void updateObjBrowser(bool); /* get active study */ - int getActiveStudyId(); const char *getActiveStudyName(); /* get component name/username */ diff --git a/src/SOCC/SOCC_ViewModel.cxx b/src/SOCC/SOCC_ViewModel.cxx index 03825c7a4..dbec2f4b2 100755 --- a/src/SOCC/SOCC_ViewModel.cxx +++ b/src/SOCC/SOCC_ViewModel.cxx @@ -44,45 +44,11 @@ #include #include -// Temporarily commented to avoid awful dependecy on SALOMEDS -// TODO: better mechanism of storing display/erse status in a study -// should be provided... -//#include -//#include -//#include -//#include - -//#include "SALOMEDSClient.hxx" -//#include "SALOMEDS_StudyManager.hxx" - #include #include #include -// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study. -// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from -// SALOMEDS::StudyManager - no linkage with SalomeApp. - -// Temporarily commented to avoid awful dependecy on SALOMEDS -// TODO: better mechanism of storing display/erse status in a study -// should be provided... -//static _PTR(Study) getStudyDS() -//{ -// SALOMEDSClient_Study* aStudy = NULL; -// _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() ); - - // get id of SUIT_Study, if it's a SalomeApp_Study, it will return - // id of its underlying SALOMEDS::Study -// SUIT_Application* app = SUIT_Session::session()->activeApplication(); -// if ( !app ) return _PTR(Study)(aStudy); -// SUIT_Study* stud = app->activeStudy(); -// if ( !stud ) return _PTR(Study)(aStudy); -// const int id = stud->id(); // virtual method, must return SALOMEDS_Study id - // get SALOMEDS_Study with this id from StudyMgr -// return aMgr->GetStudyByID( id ); -//} - /*! Constructor \param DisplayTrihedron - is trihedron displayed diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index abe70294a..f890ca74c 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -47,31 +47,6 @@ #include #include -//ASL: Temporary commented in order to avoir dependency on SALOMEDS - -//#include "SALOMEDSClient.hxx" -//#include "SALOMEDS_StudyManager.hxx" - -// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study. -// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from -// SALOMEDS::StudyManager - no linkage with SalomeApp. - -/*static _PTR(Study) getStudyDS() -{ - SALOMEDSClient_Study* aStudy = NULL; - _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() ); - - // get id of SUIT_Study, if it's a SalomeApp_Study, it will return - // id of its underlying SALOMEDS::Study - SUIT_Application* app = SUIT_Session::session()->activeApplication(); - if ( !app ) return _PTR(Study)(aStudy); - SUIT_Study* stud = app->activeStudy(); - if ( !stud ) return _PTR(Study)(aStudy); - const int id = stud->id(); // virtual method, must return SALOMEDS_Study id - // get SALOMEDS_Study with this id from StudyMgr - return aMgr->GetStudyByID( id ); -} */ - /*! Constructor */ diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 28bc07177..1063979c5 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -50,29 +50,6 @@ // VSR: Uncomment below line to allow texture background support in VTK viewer #define VTK_ENABLE_TEXTURED_BACKGROUND - -// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study. -// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from -// SALOMEDS::StudyManager - no linkage with SalomeApp. - -// Temporarily commented to avoid awful dependecy on SALOMEDS -// TODO: better mechanism of storing display/erse status in a study -// should be provided... -//static _PTR(Study) getStudyDS() -//{ -// SALOMEDSClient_Study* aStudy = NULL; -// _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() ); - // get id of SUIT_Study, if it's a SalomeApp_Study, it will return - // id of its underlying SALOMEDS::Study -// SUIT_Application* app = SUIT_Session::session()->activeApplication(); -// if ( !app ) return _PTR(Study)(aStudy); -// SUIT_Study* stud = app->activeStudy(); -// if ( !stud ) return _PTR(Study)(aStudy); -// const int id = stud->id(); // virtual method, must return SALOMEDS_Study id - // get SALOMEDS_Study with this id from StudyMgr -// return aMgr->GetStudyByID( id ); -//} - /*! Constructor */ diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index de451cc60..6d60921dd 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -516,10 +516,9 @@ void SalomeApp_Application::onNewWithScript() /*!SLOT. Load document with \a aName.*/ bool SalomeApp_Application::onLoadDoc( const QString& aName ) { -#ifdef SINGLE_DESKTOP if ( !LightApp_Application::closeDoc() ) return false; -#endif + bool res = true; if ( !activeStudy() ) { // if no study - load in current desktop @@ -1304,7 +1303,7 @@ CORBA::ORB_var SalomeApp_Application::orb() return _orb; } -/*!Create and return SALOMEDS_StudyManager.*/ +/*!Create and return SALOMEDS_Study.*/ SALOMEDSClient_Study* SalomeApp_Application::getStudy() { static _PTR(Study) _study; diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index d7e793b70..aea2607e1 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -573,20 +573,13 @@ bool SalomeApp_Study::openDocument( const QString& theFileName ) } /*! - Connects GUI study to SALOMEDS one already loaded into StudyManager + Connects GUI study to SALOMEDS one \param theStudyName - name of study */ bool SalomeApp_Study::loadDocument( const QString& theStudyName ) { MESSAGE( "loadDocument" ); - // obtain myStudyDS from StudyManager - _PTR(Study) study = studyDS(); - if ( !study ) - return false; - - setStudyDS( study ); - setRoot( new SalomeApp_RootObject( this ) ); // create myRoot //SRN: BugID IPAL9021, put there the same code as in a method openDocument @@ -742,8 +735,6 @@ void SalomeApp_Study::closeDocument(bool permanently) app->getPyInterp()->destroy(); #endif } - SALOMEDSClient_Study* aStudy = 0; - setStudyDS( _PTR(Study)(aStudy) ); } } diff --git a/src/Session/Session_ServerThread.cxx b/src/Session/Session_ServerThread.cxx index 0ca79c9bb..7574a6609 100755 --- a/src/Session/Session_ServerThread.cxx +++ b/src/Session/Session_ServerThread.cxx @@ -215,7 +215,7 @@ void Session_ServerThread::ActivateSALOMEDS(int argc, // counted objects, they will be deleted by the POA when they are no // longer needed. -// ClientFactory::createStudyManager(_orb,_root_poa); +// ClientFactory::createStudyManager(_orb,_root_poa); NB!!! } catch(CORBA::SystemException&) { INFOS( "Caught CORBA::SystemException." ); diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx index 95103de9c..101be1989 100755 --- a/src/Session/Session_Session_i.cxx +++ b/src/Session/Session_Session_i.cxx @@ -245,16 +245,6 @@ SALOME::StatSession SALOME_Session_i::GetStatSession() return myStats._retn() ; } -CORBA::Long SALOME_Session_i::GetActiveStudyId() -{ - long aStudyId=-1; - if ( SUIT_Session::session() && SUIT_Session::session()->activeApplication() ) { - if ( SUIT_Session::session()->activeApplication()->activeStudy() ) // mkr : IPAL12128 - aStudyId = SUIT_Session::session()->activeApplication()->activeStudy()->id(); - } - return aStudyId; -} - CORBA::Long SALOME_Session_i::getPID() { return (CORBA::Long) #ifndef WIN32 diff --git a/src/Session/Session_Session_i.hxx b/src/Session/Session_Session_i.hxx index 5a83d5fdf..ab8d96721 100755 --- a/src/Session/Session_Session_i.hxx +++ b/src/Session/Session_Session_i.hxx @@ -68,8 +68,6 @@ public: //! Unregister the servant from Naming Service void NSunregister(); - CORBA::Long GetActiveStudyId(); - void ping(){}; CORBA::Long getPID(); char* getHostname(); -- 2.39.2