diff --git a/mixer/src/Chain.C b/mixer/src/Chain.C index 5814835..6d92802 100644 --- a/mixer/src/Chain.C +++ b/mixer/src/Chain.C @@ -551,15 +551,15 @@ Chain::insert ( Module *m, Module *n ) { if ( modules() == 0 && n->can_support_inputs( 0 ) >= 0 ) { + n->chain( this ); n->configure_inputs( 0 ); modules_pack->add( n ); - n->chain( this ); } else if ( n->can_support_inputs( module( modules() - 1 )->noutputs() ) >= 0 ) { + n->chain( this ); n->configure_inputs( module( modules() - 1 )->noutputs() ); modules_pack->add( n ); - n->chain( this ); } else { @@ -572,6 +572,8 @@ Chain::insert ( Module *m, Module *n ) { int i = modules_pack->find( m ); + n->chain( this ); + if ( 0 == i ) { /* inserting to head of chain*/ @@ -596,7 +598,6 @@ Chain::insert ( Module *m, Module *n ) } modules_pack->insert( *n, i ); - n->chain( this ); } diff --git a/mixer/src/Module.C b/mixer/src/Module.C index 7271599..29bfec6 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -160,7 +160,7 @@ Module::get ( Log_Entry &e ) const e.add( ":active", ! bypass() ); } -void +bool Module::copy ( void ) const { Module *m = clone_empty(); @@ -168,6 +168,7 @@ Module::copy ( void ) const if ( ! m ) { DMESSAGE( "Module \"%s\" doesn't support cloning", name() ); + return false; } Log_Entry *ne = new Log_Entry(); @@ -196,6 +197,8 @@ Module::copy ( void ) const } _copied_module_settings = ne->print(); + + return true; } void @@ -840,10 +843,11 @@ Module::menu_cb ( const Fl_Menu_ *m ) } else if ( ! strcmp( picked, "Cut" ) ) { - copy(); - - chain()->remove( this ); - Fl::delete_widget( this ); + if ( copy() ) + { + chain()->remove( this ); + Fl::delete_widget( this ); + } } else if ( ! strcmp( picked, "Copy" ) ) { diff --git a/mixer/src/Module.H b/mixer/src/Module.H index 1c852ec..e8460da 100644 --- a/mixer/src/Module.H +++ b/mixer/src/Module.H @@ -63,7 +63,7 @@ class Module : public Fl_Group, public Loggable { static void menu_cb ( Fl_Widget *w, void *v ); Fl_Menu_Button & menu ( void ) const; - void copy ( void ) const; + bool copy ( void ) const; void paste_before ( void ); protected: diff --git a/mixer/src/Spatializer_Module.H b/mixer/src/Spatializer_Module.H index 3476b2c..737eebf 100644 --- a/mixer/src/Spatializer_Module.H +++ b/mixer/src/Spatializer_Module.H @@ -49,6 +49,8 @@ public: virtual ~Spatializer_Module ( ); LOG_CREATE_FUNC( Spatializer_Module ); + + MODULE_CLONE_FUNC(Spatializer_Module); virtual void handle_sample_rate_change ( nframes_t n );