]> Creatis software - cpPlugins.git/blobdiff - lib/cpBaseQtApplication/MainWindow.cxx
..
[cpPlugins.git] / lib / cpBaseQtApplication / MainWindow.cxx
index 60cdc20ad5913d68ee0f9da041bd38410dc5bf37..9b16236acb94760f09af7f12bf3fb1f8d7e8c6ad 100644 (file)
 #include <cpBaseQtApplication/MainWindow.h>
+#include <cpBaseQtApplication/Plugins/Navigator.h>
+#include <cpBaseQtApplication/Pipeline/Canvas.h>
+#include <cpExtensions/QT/ConfigurationChooser.h>
+#include <cpExtensions/QT/ActorsWidgetInterface.h>
 
-#include <QApplication>
 #include <QDir>
 #include <QFileDialog>
-#include <QFileInfo>
-#include <QMessageBox>
-
-#include <cpExtensions/QT/SimpleMPRWidget.h>
-#include <cpExtensions/QT/ConfigurationChooser.h>
-
-#include <vtkDataSet.h>
-
-#include <cpBaseQtApplication/Editor.h>
-#include <cpBaseQtApplication/PathsDialog.h>
-#include <cpBaseQtApplication/PluginsNavigator.h>
-#include <cpBaseQtApplication/ActorPropertiesQDialog.h>
-
-/* TODO
-   #include <cpPlugins/Interface/Plugins.h>
-   #include <cpPlugins/BaseObjects/Widget.h>
-   #include <vtkImageData.h>
-   #include <vtkPolyData.h>
-   #include <vtkRenderer.h>
-   #include <QColorDialog>
-*/
-
-// -------------------------------------------------------------------------
-bool cpBaseQtApplication::MainWindow::_TBlocker::
-eventFilter( QObject* obj, QEvent* event )
-{
-  return( true ); // -> Block all events
-  /* NOTE: this should be the correct implementation:
-     switch( event->type( ) )
-     {
-     //list event you want to prevent here ...
-     case QEvent::KeyPress:
-     case QEvent::KeyRelease:
-     case QEvent::MouseButtonRelease:
-     case QEvent::MouseButtonPress:
-     case QEvent::MouseButtonDblClick:
-     //...
-     return( true );
-     } // hctiws
-     return( this->QObject::eventFilter( obj, event ) );
-  */
-}
+#include <QInputDialog>
 
 // -------------------------------------------------------------------------
 cpBaseQtApplication::MainWindow::
-MainWindow( int argc, char* argv[], QApplication* app, QWidget* parent )
+MainWindow(
+  int argc, char* argv[],
+  QWidget* parent
+  )
   : Superclass( parent ),
-    m_Application( app ),
+    m_LastSaveFileName( "" ),
+    m_SingleWorkspace( false ),
+    m_BaseWindowTitle( "cpBaseQtApplication" ),
+    m_Canvas( NULL ),
     m_Navigator( NULL ),
-    m_Editor( NULL ),
-    m_MPR( NULL )
+    m_Viewer( NULL )
 {
-  // Use some evident paths
-  QFileInfo e_path( argv[ 0 ] );
-  QDir r_path( "." );
-  std::set< std::string > paths;
-  paths.insert( e_path.canonicalPath( ).toStdString( ) );
-  paths.insert( r_path.canonicalPath( ).toStdString( ) );
-  std::stringstream env;
-  for( auto p = paths.begin( ); p != paths.end( ); ++p )
-    env << *p << cpPlugins_ENV_SEPARATOR;
-
-  // Some variables
-  this->m_RunPath = r_path.canonicalPath( ).toStdString( );
-
-  // Get the plugins interface
+  this->m_RunPath = QDir( "." ).canonicalPath( ).toStdString( );
   this->m_Plugins = TPlugins::New( );
-  try { this->m_Plugins->AddEnvironments( env.str( ) ); } catch( ... ) { }
-  try { this->m_Plugins->LoadPaths( this->m_RunPath ); } catch( ... ) { }
-  this->updateEnvironment( );
-  try { this->m_Plugins->SavePaths( this->m_RunPath ); } catch( ... ) { }
-
-  // Create local workspace
-  this->m_Workspace = TWorkspace::New( );
-}
-
-// -------------------------------------------------------------------------
-cpBaseQtApplication::MainWindow::
-~MainWindow( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpBaseQtApplication::MainWindow::
-updateEnvironment( )
-{
   try
   {
-    this->m_Plugins->LoadEnvironments( );
+    this->m_Plugins->GuessEnvironment( this->m_RunPath );
     this->m_Plugins->GuessPlugins( );
   }
   catch( std::exception& err )
   {
-    QMessageBox::critical(
-      this, "Error loading required libraries", err.what( )
-      );
-    return;
+    QMessageBox::critical( this, "Error guessing plugins.", err.what( ) );
 
   } // yrt
 }
 
 // -------------------------------------------------------------------------
-void cpBaseQtApplication::MainWindow::
-updateFilter( const std::string& name )
+cpBaseQtApplication::MainWindow::
+~MainWindow( )
 {
-  auto filter = this->m_Workspace->GetFilter( name );
-  if( filter != NULL )
-    cpBaseQtApplication_Execute( filter->Update( ) );
 }
 
 // -------------------------------------------------------------------------
-void cpBaseQtApplication::MainWindow::
-showData( const std::string& name, const std::string& port )
+cpBaseQtApplication::MainWindow::
+TWorkspace* cpBaseQtApplication::MainWindow::
+workspace( const std::string& wname )
 {
-  this->updateFilter( name );
-  auto filter = this->m_Workspace->GetFilter( name );
-  if( filter != NULL )
-    this->showData(
-      filter->GetOutput( port ), port + std::string( "@" ) + name
-      );
+  auto wIt = this->m_Workspaces.find( wname );
+  if( wIt != this->m_Workspaces.end( ) )
+    return( wIt->second.GetPointer( ) );
   else
-    QMessageBox::critical(
-      this,
-      QMessageBox::tr( "Error showing data" ),
-      QMessageBox::tr( "Unknown filter." )
-      );
+    return( NULL );
 }
 
 // -------------------------------------------------------------------------
-void cpBaseQtApplication::MainWindow::
-showData( cpPlugins::BaseObjects::DataObject* data, const std::string& name )
+const cpBaseQtApplication::MainWindow::
+TWorkspace* cpBaseQtApplication::MainWindow::
+workspace( const std::string& wname ) const
 {
-  if( this->m_MPR == NULL || data == NULL )
-    return;
-
-  // Associate visual data
-  this->_block( );
-  bool success = this->m_MPR->Add( data->GetVTK< vtkDataSet >( ), name );
-  this->_unBlock( );
-
-  // Show data or show an error
-  if( success )
-    this->m_MPR->Render( );
+  auto wIt = this->m_Workspaces.find( wname );
+  if( wIt != this->m_Workspaces.end( ) )
+    return( wIt->second.GetPointer( ) );
   else
-    QMessageBox::critical(
-      this,
-      QMessageBox::tr( "Error showing data" ),
-      QMessageBox::tr( "Unknown conversion to a \"vtkProp\" object." )
-      );
+    return( NULL );
 }
 
 // -------------------------------------------------------------------------
-/* TODO
-   void cpBaseQtApplication::MainWindow::
-   hideData( const std::string& name, const std::string& port )
-   {
-   this->hideData( port + std::string( "@" ) + name );
-   }
-
-   // -------------------------------------------------------------------------
-   void cpBaseQtApplication::MainWindow::
-   hideData( const std::string& name )
-   {
-   }
-*/
+cpBaseQtApplication::Pipeline::Canvas*
+cpBaseQtApplication::MainWindow::
+canvas( )
+{
+  return( this->m_Canvas );
+}
 
 // -------------------------------------------------------------------------
-void cpBaseQtApplication::MainWindow::
-dataProperties( const std::string& name, const std::string& port )
+const cpBaseQtApplication::Pipeline::Canvas*
+cpBaseQtApplication::MainWindow::
+canvas( ) const
 {
-  this->dataProperties( port + std::string( "@" ) + name );
+  return( this->m_Canvas );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-dataProperties( const std::string& name )
+setCanvas( cpBaseQtApplication::Pipeline::Canvas* c )
 {
-  if( this->m_MPR == NULL )
-    return;
-
-  auto props = this->m_MPR->GetViewProps( name );
-  if( props.size( ) > 0 )
-  {
-    this->_block( );
-    auto dlg = new cpBaseQtApplication::ActorPropertiesQDialog( NULL );
-    dlg->setProps( props );
-    dlg->addRenderWindow( this->m_MPR->GetXRenderWindow( ) );
-    dlg->addRenderWindow( this->m_MPR->GetYRenderWindow( ) );
-    dlg->addRenderWindow( this->m_MPR->GetZRenderWindow( ) );
-    dlg->addRenderWindow( this->m_MPR->GetWRenderWindow( ) );
-    this->_unBlock( );
-    dlg->exec( );
-
-  } // fi
+  this->m_Canvas = c;
 }
 
 // -------------------------------------------------------------------------
-void cpBaseQtApplication::MainWindow::
-_block( )
+cpBaseQtApplication::Plugins::Navigator*
+cpBaseQtApplication::MainWindow::
+navigator( )
 {
-  if( this->m_Application != NULL )
-  {
-    this->m_Application->setOverrideCursor( Qt::WaitCursor );
-    this->m_Application->installEventFilter( &( this->m_Blocker ) );
+  return( this->m_Navigator );
+}
 
-  } // fi
+// -------------------------------------------------------------------------
+const cpBaseQtApplication::Plugins::Navigator*
+cpBaseQtApplication::MainWindow::
+navigator( ) const
+{
+  return( this->m_Navigator );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_unBlock( )
+setNavigator( cpBaseQtApplication::Plugins::Navigator* n )
 {
-  if( this->m_Application != NULL )
-  {
-    while( this->m_Application->overrideCursor( ) )
-      this->m_Application->restoreOverrideCursor( );
-    this->m_Application->removeEventFilter( &( this->m_Blocker ) );
-
-  } // fi
+  this->m_Navigator = n;
 }
 
 // -------------------------------------------------------------------------
-void cpBaseQtApplication::MainWindow::
-_configure( PluginsNavigator* nav, TMPR* mpr, Editor* edt )
+cpExtensions::QT::ActorsWidgetInterface*
+cpBaseQtApplication::MainWindow::
+viewer( )
 {
-  this->m_Navigator = nav;
-  this->m_MPR = mpr;
-  this->m_Editor = edt;
-  this->_updatePlugins( );
-  if( this->m_Editor != NULL )
-    this->m_Editor->setWorkspace( this->m_Workspace );
-
-  // Associate interactors
-  if( this->m_MPR != NULL )
-  {
-    this->m_Workspace->AddInteractor( this->m_MPR->GetXInteractor( ) );
-    this->m_Workspace->AddInteractor( this->m_MPR->GetYInteractor( ) );
-    this->m_Workspace->AddInteractor( this->m_MPR->GetZInteractor( ) );
-    this->m_Workspace->AddInteractor( this->m_MPR->GetWInteractor( ) );
+  return( this->m_Viewer );
+}
 
-  } // fi
+// -------------------------------------------------------------------------
+const cpExtensions::QT::ActorsWidgetInterface*
+cpBaseQtApplication::MainWindow::
+viewer( ) const
+{
+  return( this->m_Viewer );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_updatePlugins( )
+setViewer( cpExtensions::QT::ActorsWidgetInterface* v )
 {
-  if( this->m_Navigator == NULL )
-    return;
-  this->_block( );
-  this->m_Navigator->Update( );
-  this->_unBlock( );
+  this->m_Viewer = v;
+  if( this->m_Viewer != NULL )
+  {
+    auto interactors = this->m_Viewer->GetInteractors( );
+    for( auto wIt : this->m_Workspaces )
+      for( auto i : interactors )
+        wIt.second->AddInteractor( i );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_loadWorkspace( const std::string& filename )
+_loadPlugins( const std::string& filename )
 {
   try
   {
-    this->m_Workspace->Load( filename );
+    this->m_Plugins->LoadPluginsFile( filename );
+    if( this->m_Navigator != NULL )
+      this->m_Navigator->Update( );
   }
   catch( std::exception& err )
   {
     QMessageBox::critical(
       this,
-      QMessageBox::tr( "Error loading workspace" ),
-      QMessageBox::tr( err.what( ) )
+      "Error loading plugins path",
+      err.what( )
       );
 
   } // yrt
-  if( this->m_Editor != NULL )
-    this->m_Editor->redrawWorkspace( );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_loadWorkspace( )
+_loadPlugins( )
 {
   QFileDialog dlg( this );
-  dlg.setFileMode( QFileDialog::ExistingFile );
-  dlg.setDirectory( "." );
-  dlg.setNameFilter(
-    QFileDialog::tr( "Workspace file (*.wxml);;All files (*)" )
-    );
-  dlg.setDefaultSuffix( QFileDialog::tr( "wxml" ) );
+  dlg.setFileMode( QFileDialog::ExistingFiles );
+
+  std::stringstream filter;
+  std::string suffix = std::string( cpPlugins_LIB_EXT );
+  filter << "Plugins file (*" << cpPlugins_LIB_EXT << ");;All files (*)";
+  dlg.setNameFilter( filter.str( ).c_str( ) );
+  dlg.setDefaultSuffix( suffix.c_str( ) );
   if( !( dlg.exec( ) ) )
     return;
-  this->_loadWorkspace( dlg.selectedFiles( ).begin( )->toStdString( ) );
+  QStringList names = dlg.selectedFiles( );
+  for( auto qIt = names.begin( ); qIt != names.end( ); ++qIt )
+    this->_loadPlugins( qIt->toStdString( ) );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_saveWorkspace( const std::string& filename )
+_loadPluginsFromPath( const std::string& path )
 {
   try
   {
-    this->m_Workspace->Save( filename );
+    this->m_Plugins->LoadPluginsDirectory( path );
+    this->m_Plugins->SaveEnvironment( this->m_RunPath );
+    if( this->m_Navigator != NULL )
+      this->m_Navigator->Update( );
   }
   catch( std::exception& err )
   {
     QMessageBox::critical(
       this,
-      QMessageBox::tr( "Error saving workspace" ),
-      QMessageBox::tr( err.what( ) )
+      "Error loading plugins path",
+      err.what( )
       );
 
   } // yrt
@@ -315,115 +207,186 @@ _saveWorkspace( const std::string& filename )
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_saveWorkspace( )
+_loadPluginsFromPath( )
 {
-  QFileDialog dlg( this );
-  dlg.setFileMode( QFileDialog::AnyFile );
-  dlg.setDirectory( "." );
-  dlg.setAcceptMode( QFileDialog::AcceptSave );
-  dlg.setNameFilter(
-    QFileDialog::tr( "Workspace file (*.wxml);;All files (*)" )
-    );
-  dlg.setDefaultSuffix( QFileDialog::tr( "wxml" ) );
-  if( !( dlg.exec( ) ) )
+  QFileDialog d( this );
+  d.setFileMode( QFileDialog::DirectoryOnly );
+  if( !( d.exec( ) ) )
     return;
-  this->_saveWorkspace( dlg.selectedFiles( ).begin( )->toStdString( ) );
+  this->_loadPluginsFromPath( d.selectedFiles( ).begin( )->toStdString( ) );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_showPlugins( )
+_clearWorkspaces( )
 {
-  std::stringstream info;
-  this->m_Plugins->Print( info );
-  QMessageBox::information(
-    this,
-    "Loaded libraries and plugins information",
-    info.str( ).c_str( )
-    );
+  this->m_Workspaces.clear( );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_addEnvironmentPaths( const std::string& envs )
+_addWorkspace( const std::string& name )
 {
-  try { this->m_Plugins->AddEnvironments( envs ); } catch( ... ) { }
-  try { this->m_Plugins->SavePaths( this->m_RunPath ); } catch( ... ) { }
-  this->updateEnvironment( );
-  this->_updatePlugins( );
+  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( );
+    if( this->m_Canvas != NULL )
+      this->m_Canvas->setWorkspace( this->m_Workspaces[ name ] );
+    if( this->m_Viewer !=  NULL )
+    {
+      auto interactors = this->m_Viewer->GetInteractors( );
+      auto wIt = this->m_Workspaces.find( name );
+      for( auto i : interactors )
+        wIt->second->AddInteractor( i );
+
+    } // fi
+    this->setWindowTitle( ( this->m_BaseWindowTitle + name ).c_str( ) );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_addEnvironmentPaths( )
+_addWorkspace( )
 {
-  PathsDialog dlg( this );
-  dlg.addPaths( this->m_Plugins->GetPaths( ) );
-  if( dlg.exec( ) )
-  {
-    auto paths = dlg.getPaths( );
-    std::stringstream envs;
-    for( auto p = paths.begin( ); p != paths.end( ); ++p )
-      envs << *p << cpPlugins_ENV_SEPARATOR;
-    this->_addEnvironmentPaths( envs.str( ) );
-
-  } // fi
+  bool ok;
+  QString text =
+    QInputDialog::getText(
+      this, "Creating a new workspace...",
+      "New workspace name: ",
+      QLineEdit::Normal,
+      "new_workspace",
+      &ok
+      );
+  if( ok && !text.isEmpty( ) )
+    this->_addWorkspace( text.toStdString( ) );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_loadPlugins( const std::string& filename )
+_saveWorkspace( const std::string& wname, const std::string& fname )
 {
-  try
+  auto wIt = this->m_Workspaces.find( wname );
+  if( wIt != this->m_Workspaces.end( ) )
   {
-    this->m_Plugins->LoadFile( filename );
-    this->_updatePlugins( );
+    try
+    {
+      wIt->second->Save( fname );
+      this->m_LastSaveFileName = fname;
+    }
+    catch( std::exception& err )
+    {
+      QMessageBox::critical(
+        this,
+        QMessageBox::tr( "Error saving workspace" ),
+        QMessageBox::tr( err.what( ) )
+        );
+
+    } // yrt
   }
-  catch( std::exception& err )
-  {
+  else
     QMessageBox::critical(
       this,
-      "Error loading plugins path",
-      err.what( )
+      "Error saving workspace",
+      (
+        std::string( "Workspace \"" ) + wname +
+        std::string( "\" does not exist." )
+        ).c_str( )
       );
+}
 
-  } // yrt
+// -------------------------------------------------------------------------
+void cpBaseQtApplication::MainWindow::
+_saveWorkspace( const std::string& wname, bool force )
+{
+  auto wIt = this->m_Workspaces.find( wname );
+  if( wIt != this->m_Workspaces.end( ) )
+  {
+    if( this->m_LastSaveFileName == "" || force )
+    {
+      QFileDialog dlg( this );
+      dlg.setFileMode( QFileDialog::AnyFile );
+      dlg.setDirectory( "." );
+      dlg.setAcceptMode( QFileDialog::AcceptSave );
+      dlg.setNameFilter(
+        QFileDialog::tr( "Workspace file (*.wxml);;All files (*)" )
+        );
+      dlg.setDefaultSuffix( QFileDialog::tr( "wxml" ) );
+      dlg.setWindowTitle(
+        (
+          std::string( "Saving \"" ) + wIt->first + std::string( "\"..." )
+          ).c_str( )
+        );
+      if( dlg.exec( ) )
+        this->_saveWorkspace(
+          wIt->first, dlg.selectedFiles( ).begin( )->toStdString( )
+          );
+    }
+    else
+      this->_saveWorkspace( wIt->first, this->m_LastSaveFileName );
+  }
+  else
+    QMessageBox::critical(
+      this,
+      "Error saving workspace",
+      (
+        std::string( "Workspace \"" ) + wname +
+        std::string( "\" does not exist." )
+        ).c_str( )
+      );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_loadPlugins( )
+_saveWorkspace( )
 {
-  QFileDialog dlg( this );
-  dlg.setFileMode( QFileDialog::ExistingFiles );
+  for(
+    auto wIt = this->m_Workspaces.begin( );
+    wIt != this->m_Workspaces.end( );
+    ++wIt
+    )
+  {
+    QFileDialog dlg( this );
+    dlg.setFileMode( QFileDialog::AnyFile );
+    dlg.setDirectory( "." );
+    dlg.setAcceptMode( QFileDialog::AcceptSave );
+    dlg.setNameFilter(
+      QFileDialog::tr( "Workspace file (*.wxml);;All files (*)" )
+      );
+    dlg.setDefaultSuffix( QFileDialog::tr( "wxml" ) );
+    dlg.setWindowTitle(
+      (
+        std::string( "Saving \"" ) + wIt->first + std::string( "\"..." )
+        ).c_str( )
+      );
+    if( dlg.exec( ) )
+      this->_saveWorkspace(
+        wIt->first, dlg.selectedFiles( ).begin( )->toStdString( )
+        );
 
-  std::stringstream filter;
-  std::string suffix = std::string( cpPlugins_LIB_EXT );
-  filter << "Plugins file (*" << cpPlugins_LIB_EXT << ");;All files (*)";
-  dlg.setNameFilter( filter.str( ).c_str( ) );
-  dlg.setDefaultSuffix( suffix.c_str( ) );
-  if( !( dlg.exec( ) ) )
-    return;
-  QStringList names = dlg.selectedFiles( );
-  for( auto qIt = names.begin( ); qIt != names.end( ); ++qIt )
-    this->_loadPlugins( qIt->toStdString( ) );
+  } // rof
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_loadPluginsFromPath( const std::string& path )
+_loadWorkspace( const std::string& fname )
 {
   try
   {
-    this->m_Plugins->LoadDirectory( path );
-    this->_updatePlugins( );
+    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 )
   {
     QMessageBox::critical(
       this,
-      "Error loading plugins path",
-      err.what( )
+      QMessageBox::tr( "Error loading workspace" ),
+      QMessageBox::tr( err.what( ) )
       );
 
   } // yrt
@@ -431,37 +394,35 @@ _loadPluginsFromPath( const std::string& path )
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
-_loadPluginsFromPath( )
+_loadWorkspace( )
 {
-  QFileDialog d( this );
-  d.setFileMode( QFileDialog::DirectoryOnly );
-  if( !( d.exec( ) ) )
+  QFileDialog dlg( this );
+  dlg.setFileMode( QFileDialog::ExistingFile );
+  dlg.setDirectory( "." );
+  dlg.setNameFilter(
+    QFileDialog::tr( "Workspace file (*.wxml);;All files (*)" )
+    );
+  dlg.setDefaultSuffix( QFileDialog::tr( "wxml" ) );
+  if( !( dlg.exec( ) ) )
     return;
-  this->_loadPluginsFromPath( d.selectedFiles( ).begin( )->toStdString( ) );
+  this->_loadWorkspace( dlg.selectedFiles( ).begin( )->toStdString( ) );
 }
 
 // -------------------------------------------------------------------------
 void cpBaseQtApplication::MainWindow::
 _actorsProperties( )
 {
-  if( this->m_MPR != NULL )
+  auto data =
+    dynamic_cast< cpExtensions::QT::ActorsWidgetInterface* >(
+      this->m_Viewer
+      );
+  if( data != NULL )
   {
     auto dlg = new cpExtensions::QT::ConfigurationChooser( this );
-    dlg->setData( this->m_MPR );
+    dlg->setData( data );
     dlg->exec( );
 
   } // fi
 }
 
-// -------------------------------------------------------------------------
-/* TODO
-   void cpBaseQtApplication::MainWindow::
-   _ClearWorkspace( )
-   {
-   if( this->m_Editor != NULL )
-   this->m_Editor->clear( );
-   this->m_Workspace->Clear( );
-   }
-*/
-
 // eof - $RCSfile$