]> Creatis software - cpPlugins.git/blobdiff - lib/cpBaseQtApplication/MainWindow.cxx
...
[cpPlugins.git] / lib / cpBaseQtApplication / MainWindow.cxx
index 0b67e49f5df7d297b19f8fd05e640b3613f321fd..bfe8b5b9d4b5b9943b3e36080dbd4b7c543529a9 100644 (file)
@@ -1,5 +1,6 @@
 #include <cpBaseQtApplication/MainWindow.h>
 #include <cpBaseQtApplication/Plugins/Navigator.h>
+#include <cpBaseQtApplication/Pipeline/Canvas.h>
 
 #include <QDir>
 #include <QFileDialog>
@@ -13,6 +14,8 @@ MainWindow(
   )
   : Superclass( parent ),
     m_LastSaveFileName( "" ),
+    m_SingleWorkspace( false ),
+    m_BaseWindowTitle( "cpBaseQtApplication" ),
     m_Canvas( NULL ),
     m_Navigator( NULL ),
     m_Viewer( NULL )
@@ -216,7 +219,13 @@ _addWorkspace( const std::string& name )
 {
   auto wIt = this->m_Workspaces.find( name );
   if( wIt == this->m_Workspaces.end( ) )
+  {
+    if( this->m_SingleWorkspace )
+      this->m_Workspaces.clear( );
     this->m_Workspaces[ name ] = TWorkspace::New( );
+    this->setWindowTitle( ( this->m_BaseWindowTitle + name ).c_str( ) );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
@@ -349,6 +358,8 @@ _loadWorkspace( const std::string& fname )
   {
     this->_addWorkspace( fname );
     this->m_Workspaces[ fname ]->Load( fname );
+    if( this->m_Canvas != NULL )
+      this->m_Canvas->setWorkspace( this->m_Workspaces[ fname ] );
   }
   catch( std::exception& err )
   {