| @@ -551,15 +551,15 @@ Chain::insert ( Module *m, Module *n ) | |||||
| { | { | ||||
| if ( modules() == 0 && n->can_support_inputs( 0 ) >= 0 ) | if ( modules() == 0 && n->can_support_inputs( 0 ) >= 0 ) | ||||
| { | { | ||||
| n->chain( this ); | |||||
| n->configure_inputs( 0 ); | n->configure_inputs( 0 ); | ||||
| modules_pack->add( n ); | modules_pack->add( n ); | ||||
| n->chain( this ); | |||||
| } | } | ||||
| else if ( n->can_support_inputs( module( modules() - 1 )->noutputs() ) >= 0 ) | else if ( n->can_support_inputs( module( modules() - 1 )->noutputs() ) >= 0 ) | ||||
| { | { | ||||
| n->chain( this ); | |||||
| n->configure_inputs( module( modules() - 1 )->noutputs() ); | n->configure_inputs( module( modules() - 1 )->noutputs() ); | ||||
| modules_pack->add( n ); | modules_pack->add( n ); | ||||
| n->chain( this ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -572,6 +572,8 @@ Chain::insert ( Module *m, Module *n ) | |||||
| { | { | ||||
| int i = modules_pack->find( m ); | int i = modules_pack->find( m ); | ||||
| n->chain( this ); | |||||
| if ( 0 == i ) | if ( 0 == i ) | ||||
| { | { | ||||
| /* inserting to head of chain*/ | /* inserting to head of chain*/ | ||||
| @@ -596,7 +598,6 @@ Chain::insert ( Module *m, Module *n ) | |||||
| } | } | ||||
| modules_pack->insert( *n, i ); | modules_pack->insert( *n, i ); | ||||
| n->chain( this ); | |||||
| } | } | ||||
| @@ -160,7 +160,7 @@ Module::get ( Log_Entry &e ) const | |||||
| e.add( ":active", ! bypass() ); | e.add( ":active", ! bypass() ); | ||||
| } | } | ||||
| void | |||||
| bool | |||||
| Module::copy ( void ) const | Module::copy ( void ) const | ||||
| { | { | ||||
| Module *m = clone_empty(); | Module *m = clone_empty(); | ||||
| @@ -168,6 +168,7 @@ Module::copy ( void ) const | |||||
| if ( ! m ) | if ( ! m ) | ||||
| { | { | ||||
| DMESSAGE( "Module \"%s\" doesn't support cloning", name() ); | DMESSAGE( "Module \"%s\" doesn't support cloning", name() ); | ||||
| return false; | |||||
| } | } | ||||
| Log_Entry *ne = new Log_Entry(); | Log_Entry *ne = new Log_Entry(); | ||||
| @@ -196,6 +197,8 @@ Module::copy ( void ) const | |||||
| } | } | ||||
| _copied_module_settings = ne->print(); | _copied_module_settings = ne->print(); | ||||
| return true; | |||||
| } | } | ||||
| void | void | ||||
| @@ -840,10 +843,11 @@ Module::menu_cb ( const Fl_Menu_ *m ) | |||||
| } | } | ||||
| else if ( ! strcmp( picked, "Cut" ) ) | 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" ) ) | else if ( ! strcmp( picked, "Copy" ) ) | ||||
| { | { | ||||
| @@ -63,7 +63,7 @@ class Module : public Fl_Group, public Loggable { | |||||
| static void menu_cb ( Fl_Widget *w, void *v ); | static void menu_cb ( Fl_Widget *w, void *v ); | ||||
| Fl_Menu_Button & menu ( void ) const; | Fl_Menu_Button & menu ( void ) const; | ||||
| void copy ( void ) const; | |||||
| bool copy ( void ) const; | |||||
| void paste_before ( void ); | void paste_before ( void ); | ||||
| protected: | protected: | ||||
| @@ -49,6 +49,8 @@ public: | |||||
| virtual ~Spatializer_Module ( ); | virtual ~Spatializer_Module ( ); | ||||
| LOG_CREATE_FUNC( Spatializer_Module ); | LOG_CREATE_FUNC( Spatializer_Module ); | ||||
| MODULE_CLONE_FUNC(Spatializer_Module); | |||||
| virtual void handle_sample_rate_change ( nframes_t n ); | virtual void handle_sample_rate_change ( nframes_t n ); | ||||