return( ok );
}
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Workspace::
+Connect(
+ TDataObject* input,
+ const std::string& destination_filter,
+ const std::string& destination_input
+ )
+{
+ // Get filters and check pertinence
+ if( input == NULL )
+ return( false );
+ TFilter* destination = this->GetFilter( destination_filter );
+ if( destination == NULL )
+ return( false );
+ if( !( destination->HasInput( destination_input ) ) )
+ return( false );
+
+ // Check if there is room for a new connection
+ bool ok = true;
+ if( destination->IsInputMultiple( destination_input ) )
+ {
+ for(
+ unsigned int i = 0;
+ i < destination->GetInputSize( destination_input );
+ ++i
+ )
+ if(
+ destination->GetInput( destination_input, i )->GetSource( ) ==
+ input->GetSource( )
+ )
+ ok = false;
+ }
+ else
+ ok = ( destination->GetInput( destination_input ) == NULL );
+ if( ok )
+ destination->AddInput(
+ destination_input,
+ input
+ );
+ return( ok );
+}
+
// -------------------------------------------------------------------------
bool cpPlugins::Interface::Workspace::
Disconnect(