diff --git a/mixer/src/Module.C b/mixer/src/Module.C index f28f8f5..4de5e19 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -190,8 +190,15 @@ Module::paste_before ( void ) { Module *m = _copied_module_empty; - m->chain( chain() ); Log_Entry le( _copied_module_settings ); + le.remove( ":chain" ); + + char *print = le.print(); + + DMESSAGE( "Pasting settings: %s", print ); + + free( print ); + m->set( le ); if ( ! chain()->insert( this, m ) ) @@ -203,7 +210,7 @@ Module::paste_before ( void ) _copied_module_settings = NULL; _copied_module_empty = NULL; - /* set up for another copy */ + /* set up for another paste */ m->copy(); } @@ -429,6 +436,26 @@ Module::set ( Log_Entry &e ) +void +Module::chain ( Chain *v ) +{ + if ( _chain != v ) + { + DMESSAGE( "Adding module %s in to chain %s", label(), v ? v->name() : "NULL" ); + + _chain = v; + + for ( int i = 0; i < ncontrol_inputs(); ++i ) + { + control_input[i].update_osc_port(); + } + } + else + { + DMESSAGE( "Module %s already belongs to chain %s", label(), v ? v->name() : "NULL" ); + } +} + /* return a string serializing this module's parameter settings. The format is 1.0:2.0:... Where 1.0 is the value of the first control input, 2.0 is the value of the second control input etc. diff --git a/mixer/src/Module.H b/mixer/src/Module.H index 2ee4d9c..e28b603 100644 --- a/mixer/src/Module.H +++ b/mixer/src/Module.H @@ -373,18 +373,7 @@ public: } Chain *chain ( void ) const { return _chain; } - void chain ( Chain * v ) - { - if ( _chain != v ) - { - _chain = v; - - for ( int i = 0; i < ncontrol_inputs(); ++i ) - { - control_input[i].update_osc_port(); - } - } - } + void chain ( Chain * v ); char *get_parameters ( void ) const; void set_parameters ( const char * ); diff --git a/nonlib/Log_Entry.C b/nonlib/Log_Entry.C index ae6b6c8..5857e4e 100644 --- a/nonlib/Log_Entry.C +++ b/nonlib/Log_Entry.C @@ -280,6 +280,19 @@ Log_Entry::get ( int n, const char **name, const char **value ) const } +void +Log_Entry::remove ( const char *name ) +{ + for ( int i = 0; i < _i; i++ ) + { + if ( !strcmp( _sa[ i ], name ) ) + { + free( _sa[i] ); + _sa[i] = NULL; + } + } +} + char ** Log_Entry::sa ( void ) { diff --git a/nonlib/Log_Entry.H b/nonlib/Log_Entry.H index eb4e0d7..93730c8 100644 --- a/nonlib/Log_Entry.H +++ b/nonlib/Log_Entry.H @@ -88,6 +88,9 @@ public: /* _sa.push( p ); \ */ /* } \ */ + + void remove ( const char *s ); + ADD( int, "%d", v ); ADD( nframes_t, "%lu", (unsigned long)v ); ADD( unsigned long, "%lu", v );