]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
A possibility to switch SALOME into "one-study-at-once" mode was added.
authorakl <akl@opencascade.com>
Fri, 14 Feb 2014 12:35:34 +0000 (16:35 +0400)
committerakl <akl@opencascade.com>
Fri, 14 Feb 2014 12:35:34 +0000 (16:35 +0400)
CMakeLists.txt
SalomeGUIConfig.cmake.in
src/LightApp/LightApp_Application.cxx
src/STD/STD_Application.cxx
src/STD/STD_Application.h
src/SalomeApp/SalomeApp_Application.cxx

index d31a2792e5fe89e7e41871acab684ce2e2f7c685..3d3666f1f781dd68da1f6ad500678f6a401fc76d 100755 (executable)
@@ -70,10 +70,12 @@ OPTION(SALOME_USE_GRAPHICSVIEW "Enable GraphicsView visualization (Mandatory in
 OPTION(SALOME_USE_PLOT2DVIEWER "Enable Plot2D visualization (Mandatory in classic configurations)" ON)
 OPTION(SALOME_USE_PYCONSOLE "Enable Python GUI interface (Mandatory in classic configurations)" ON)
 OPTION(SALOME_USE_QXGRAPHVIEWER "Enable QX graph visualization (Mandatory in classic configurations)" ON)
+OPTION(SALOME_USE_SINGLE_DESKTOP "Enable multiple document interface" OFF)
 
 MARK_AS_ADVANCED(SALOME_USE_VTKVIEWER SALOME_USE_VTKVIEWER SALOME_USE_GRAPHICSVIEW)
 MARK_AS_ADVANCED(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_PLOT2DVIEWER)
 MARK_AS_ADVANCED(SALOME_USE_PYCONSOLE SALOME_USE_QXGRAPHVIEWER)
+MARK_AS_ADVANCED(SALOME_USE_SINGLE_DESKTOP)
 
 # Prerequisites
 # =============
@@ -122,6 +124,10 @@ IF(SALOME_GUI_USE_OBSERVERS)
   ADD_DEFINITIONS(-DWITH_SALOMEDS_OBSERVER)
 ENDIF()
 
+IF(SALOME_USE_SINGLE_DESKTOP)
+  ADD_DEFINITIONS(-DSINGLE_DESKTOP)
+ENDIF()
+
 # OCCT
 FIND_PACKAGE(SalomeCAS REQUIRED)
 
index 22754b5a3985dc8ef9425a2acb107c80acd17ce7..02a1e7d34118a4cf3e581363c8388bf66fc3ddf4 100644 (file)
@@ -61,6 +61,14 @@ SET(SALOME_USE_OCCVIEWER    @SALOME_USE_OCCVIEWER@)
 SET(SALOME_USE_GLVIEWER     @SALOME_USE_GLVIEWER@)
 SET(SALOME_USE_VTKVIEWER    @SALOME_USE_VTKVIEWER@)
 SET(SALOME_USE_PLOT2DVIEWER @SALOME_USE_PLOT2DVIEWER@)
+SET(SALOME_USE_SINGLE_DESKTOP @SALOME_USE_SINGLE_DESKTOP@)
+IF(SALOME_USE_SINGLE_DESKTOP)
+  LIST(APPEND GUI_DEFINITIONS "-DSINGLE_DESKTOP")
+ENDIF()
+SET(SALOME_GUI_USE_OBSERVERS @SALOME_GUI_USE_OBSERVERS@)
+IF(SALOME_GUI_USE_OBSERVERS)
+  LIST(APPEND GUI_DEFINITIONS "-DWITH_SALOMEDS_OBSERVER")
+ENDIF()
 
 # Level 1 prerequisites:
 SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@")
index 1461178bc5a1dd770dce329664f633379986cfa5..06ee4d06452249e7609595a689fc44fadd5f9503 100644 (file)
@@ -867,8 +867,13 @@ void LightApp_Application::onNewWindow()
 void LightApp_Application::onNewDoc()
 {
   //asl: fix for 0020515
-  if ( activeStudy() )
+  if ( activeStudy() ) {
     saveDockWindowsState();
+#ifdef SINGLE_DESKTOP
+    if ( !closeDoc() )
+      return;
+#endif
+  }
 
   CAM_Application::onNewDoc();
 }
@@ -880,6 +885,12 @@ void LightApp_Application::onOpenDoc()
 {
   SUIT_Study* study = activeStudy();
   saveDockWindowsState();
+  if (study) {
+#ifdef SINGLE_DESKTOP
+    if ( !closeDoc() )
+      return;
+#endif
+  }
 
   CAM_Application::onOpenDoc();
 
@@ -896,6 +907,12 @@ void LightApp_Application::onOpenDoc()
 */
 bool LightApp_Application::onOpenDoc( const QString& aName )
 {
+  if ( activeStudy() ) {
+#ifdef SINGLE_DESKTOP
+    if ( !closeDoc() )
+      return false;
+#endif
+  }
   // We should take mru action first because this application instance can be deleted later.
   QtxMRUAction* mru = ::qobject_cast<QtxMRUAction*>( action( MRUId ) );
 
index 1fc24b2a74e170c8ee2da6e1f3703e74b327f270..c6f61411bebf0a796f2f8a0cd762b787e3d7bf31 100755 (executable)
@@ -390,11 +390,17 @@ void STD_Application::afterCloseDoc()
 
 /*!Close document, if it's possible.*/
 void STD_Application::onCloseDoc( bool ask )
+{
+  closeDoc( ask );
+}
+
+/*!Close document, if it's possible.*/
+bool STD_Application::closeDoc( bool ask )
 {
   bool closePermanently = true;
 
   if ( ask && !isPossibleToClose( closePermanently ) )
-    return;
+    return false;
 
   SUIT_Study* study = activeStudy();
 
@@ -430,6 +436,7 @@ void STD_Application::onCloseDoc( bool ask )
 
   if ( !desktop() )
     closeApplication();
+  return true;
 }
 
 /*!Check the application on closing.
index 506f9b86e6adf242bdda6e56cac1e6de132d8a86..51f8b836ec66d1cb18bfd366a21d58863e66455c 100755 (executable)
@@ -167,6 +167,7 @@ protected:
 
   virtual int           closeChoice( const QString& );
   virtual bool          closeAction( const int, bool& );
+  virtual bool          closeDoc( bool ask = true );
 
 private:
   ViewManagerList       myViewMgrs;
index c7b16a8ae4bcaf0f84ccd7daf80a9588eb6e35fd..175d78c55da013df498a03fe51e8193113d4a9d8 100644 (file)
@@ -487,6 +487,10 @@ 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