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
# =============
ADD_DEFINITIONS(-DWITH_SALOMEDS_OBSERVER)
ENDIF()
+IF(SALOME_USE_SINGLE_DESKTOP)
+ ADD_DEFINITIONS(-DSINGLE_DESKTOP)
+ENDIF()
+
# OCCT
FIND_PACKAGE(SalomeCAS REQUIRED)
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@")
void LightApp_Application::onNewDoc()
{
//asl: fix for 0020515
- if ( activeStudy() )
+ if ( activeStudy() ) {
saveDockWindowsState();
+#ifdef SINGLE_DESKTOP
+ if ( !closeDoc() )
+ return;
+#endif
+ }
CAM_Application::onNewDoc();
}
{
SUIT_Study* study = activeStudy();
saveDockWindowsState();
+ if (study) {
+#ifdef SINGLE_DESKTOP
+ if ( !closeDoc() )
+ return;
+#endif
+ }
CAM_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 ) );
/*!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();
if ( !desktop() )
closeApplication();
+ return true;
}
/*!Check the application on closing.
virtual int closeChoice( const QString& );
virtual bool closeAction( const int, bool& );
+ virtual bool closeDoc( bool ask = true );
private:
ViewManagerList myViewMgrs;
/*!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