Mixer: Fix copy and paste of spatializer module.

pull/116/head
Jonathan Moore Liles 2013-08-27 23:02:36 -07:00
parent 442003e61f
commit f8f6bad322
4 changed files with 16 additions and 9 deletions

View File

@ -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 );
} }

View File

@ -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,11 +843,12 @@ Module::menu_cb ( const Fl_Menu_ *m )
} }
else if ( ! strcmp( picked, "Cut" ) ) else if ( ! strcmp( picked, "Cut" ) )
{ {
copy(); if ( copy() )
{
chain()->remove( this ); chain()->remove( this );
Fl::delete_widget( this ); Fl::delete_widget( this );
} }
}
else if ( ! strcmp( picked, "Copy" ) ) else if ( ! strcmp( picked, "Copy" ) )
{ {
copy(); copy();

View File

@ -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:

View File

@ -50,6 +50,8 @@ public:
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 );
virtual void draw ( void ); virtual void draw ( void );