Mixer: Allow controller modules to be removed.
This commit is contained in:
parent
ac30a5a4e2
commit
363f2f04bc
|
@ -293,6 +293,25 @@ void Chain::cb_handle(Fl_Widget* o, void* v) {
|
||||||
((Chain*)(v))->cb_handle(o);
|
((Chain*)(v))->cb_handle(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Chain::remove ( Controller_Module *m )
|
||||||
|
{
|
||||||
|
DMESSAGE( "Removing controller module from chain" );
|
||||||
|
|
||||||
|
engine()->lock();
|
||||||
|
|
||||||
|
m->disconnect();
|
||||||
|
|
||||||
|
controls_pack->remove( m );
|
||||||
|
modules_pack->remove( m );
|
||||||
|
|
||||||
|
build_process_queue();
|
||||||
|
|
||||||
|
engine()->unlock();
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* remove a module from the chain. this isn't guaranteed to succeed,
|
/* remove a module from the chain. this isn't guaranteed to succeed,
|
||||||
* because removing the module might result in an invalid routing */
|
* because removing the module might result in an invalid routing */
|
||||||
|
@ -311,11 +330,15 @@ Chain::remove ( Module *m )
|
||||||
fl_alert( "Can't remove module at this point because the resultant chain is invalid" );
|
fl_alert( "Can't remove module at this point because the resultant chain is invalid" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
engine()->lock();
|
||||||
|
|
||||||
strip()->handle_module_removed( m );
|
strip()->handle_module_removed( m );
|
||||||
|
|
||||||
modules_pack->remove( m );
|
modules_pack->remove( m );
|
||||||
|
|
||||||
configure_ports();
|
configure_ports();
|
||||||
|
|
||||||
|
engine()->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* determine number of output ports, signal if changed. */
|
/* determine number of output ports, signal if changed. */
|
||||||
|
|
|
@ -101,6 +101,7 @@ public:
|
||||||
|
|
||||||
int modules ( void ) const { return modules_pack->children(); }
|
int modules ( void ) const { return modules_pack->children(); }
|
||||||
Module *module ( int n ) const { return (Module*)modules_pack->child( n ); }
|
Module *module ( int n ) const { return (Module*)modules_pack->child( n ); }
|
||||||
|
void remove ( Controller_Module *m );
|
||||||
void remove ( Module *m );
|
void remove ( Module *m );
|
||||||
bool add ( Module *m );
|
bool add ( Module *m );
|
||||||
bool add ( Controller_Module *m );
|
bool add ( Controller_Module *m );
|
||||||
|
|
|
@ -91,6 +91,17 @@ Controller_Module::handle_chain_name_changed()
|
||||||
// change_osc_path( generate_osc_path() );
|
// change_osc_path( generate_osc_path() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Controller_Module::disconnect ( void )
|
||||||
|
{
|
||||||
|
for ( std::vector<Module::Port>::iterator i = control_output.begin();
|
||||||
|
i != control_output.end();
|
||||||
|
++i )
|
||||||
|
{
|
||||||
|
(*i).disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -99,11 +110,21 @@ Controller_Module::get ( Log_Entry &e ) const
|
||||||
Module::get( e );
|
Module::get( e );
|
||||||
|
|
||||||
Port *p = control_output[0].connected_port();
|
Port *p = control_output[0].connected_port();
|
||||||
Module *m = p->module();
|
|
||||||
|
|
||||||
e.add( ":module", m );
|
if ( !p )
|
||||||
e.add( ":port", m->control_input_port_index( p ) );
|
{
|
||||||
e.add( ":mode", mode() );
|
e.add( ":module", "" );
|
||||||
|
e.add( ":port", "" );
|
||||||
|
e.add( ":mode", "" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Module *m = p->module();
|
||||||
|
|
||||||
|
e.add( ":module", m );
|
||||||
|
e.add( ":port", m->control_input_port_index( p ) );
|
||||||
|
e.add( ":mode", mode() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -485,6 +506,8 @@ Controller_Module::menu_cb ( const Fl_Menu_ *m )
|
||||||
mode( GUI );
|
mode( GUI );
|
||||||
else if ( ! strcmp( picked, "Mode/Control Voltage (JACK)" ) )
|
else if ( ! strcmp( picked, "Mode/Control Voltage (JACK)" ) )
|
||||||
mode( CV );
|
mode( CV );
|
||||||
|
else if ( ! strcmp( picked, "/Remove" ) )
|
||||||
|
command_remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** build the context menu for this control */
|
/** build the context menu for this control */
|
||||||
|
@ -498,7 +521,8 @@ Controller_Module::menu ( void )
|
||||||
{ "Mode", 0, 0, 0, FL_SUBMENU },
|
{ "Mode", 0, 0, 0, FL_SUBMENU },
|
||||||
{ "GUI + OSC", 0, 0, 0, FL_MENU_RADIO | ( mode() == GUI ? FL_MENU_VALUE : 0 ) },
|
{ "GUI + OSC", 0, 0, 0, FL_MENU_RADIO | ( mode() == GUI ? FL_MENU_VALUE : 0 ) },
|
||||||
{ "Control Voltage (JACK)", 0, 0, 0, FL_MENU_RADIO | ( mode() == CV ? FL_MENU_VALUE : 0 ) },
|
{ "Control Voltage (JACK)", 0, 0, 0, FL_MENU_RADIO | ( mode() == CV ? FL_MENU_VALUE : 0 ) },
|
||||||
{ 0 },
|
{ 0 },
|
||||||
|
{ "Remove", 0, 0, 0, 0 },
|
||||||
{ 0 },
|
{ 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -569,6 +593,18 @@ Controller_Module::handle_control_changed ( Port *p )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Controller_Module::command_remove ( void )
|
||||||
|
{
|
||||||
|
if ( is_default() )
|
||||||
|
fl_alert( "Default modules may not be deleted." );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chain()->remove( this );
|
||||||
|
Fl::delete_widget( this );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**********/
|
/**********/
|
||||||
/* Engine */
|
/* Engine */
|
||||||
/**********/
|
/**********/
|
||||||
|
|
|
@ -78,10 +78,13 @@ public:
|
||||||
|
|
||||||
void connect_to ( Port *p );
|
void connect_to ( Port *p );
|
||||||
bool connect_spatializer_to ( Module *m );
|
bool connect_spatializer_to ( Module *m );
|
||||||
|
void disconnect ( void );
|
||||||
|
|
||||||
void handle_control_changed ( Port *p );
|
void handle_control_changed ( Port *p );
|
||||||
void handle_chain_name_changed ( void );
|
void handle_chain_name_changed ( void );
|
||||||
|
|
||||||
|
virtual void command_remove ( void );
|
||||||
|
|
||||||
LOG_CREATE_FUNC( Controller_Module );
|
LOG_CREATE_FUNC( Controller_Module );
|
||||||
|
|
||||||
void process ( nframes_t nframes );
|
void process ( nframes_t nframes );
|
||||||
|
|
|
@ -437,8 +437,8 @@ protected:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void command_open_parameter_editor();
|
void command_open_parameter_editor();
|
||||||
void command_activate ( void );
|
virtual void command_activate ( void );
|
||||||
void command_deactivate ( void );
|
virtual void command_deactivate ( void );
|
||||||
void command_remove ( void );
|
virtual void command_remove ( void );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue