]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Workspace.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / Workspace.cxx
index 3822969f30b977a5f53b52ecd6b6680961f31018..4fbcb2bbf3b154e11332f29b0a32cd7201630f95 100644 (file)
@@ -78,7 +78,10 @@ HasWidget( const std::string& name ) const
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Workspace::
 TFilter* cpPlugins::Interface::Workspace::
-CreateFilter( const std::string& category, const std::string& filter )
+CreateFilter(
+  const std::string& category, const std::string& filter,
+  const std::string& name
+  )
 {
   typedef cpPlugins::Pipeline::Widget _TWidget;
 
@@ -86,11 +89,11 @@ CreateFilter( const std::string& category, const std::string& filter )
   if( o.IsNotNull( ) )
   {
     // Choose a name
-    std::string name = filter;
-    while( this->GetFilter( name ) != NULL )
-      name += std::string( "_" );
+    std::string real_name = name;
+    while( this->GetFilter( real_name ) != NULL )
+      real_name += std::string( "_" );
     o->SetPrintExecution( this->m_PrintExecution );
-    o->SetName( name );
+    o->SetName( real_name );
 
     // Interactors
     for(
@@ -101,12 +104,20 @@ CreateFilter( const std::string& category, const std::string& filter )
       o->AddInteractor( *i );
 
     // Finish association
-    this->m_Filters[ name ] = o;
+    this->m_Filters[ real_name ] = o;
 
   } // fi
   return( o.GetPointer( ) );
 }
 
+// -------------------------------------------------------------------------
+cpPlugins::Interface::Workspace::
+TFilter* cpPlugins::Interface::Workspace::
+CreateFilter( const std::string& category, const std::string& filter )
+{
+  return( this->CreateFilter( category, filter, filter ) );
+}
+
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Workspace::
 RenameFilter( const std::string& old_name, const std::string& new_name )