Mixer: Fix behavior issues of Toggle controls.
This commit is contained in:
parent
a11961f9b6
commit
100b23d1fb
|
@ -311,6 +311,9 @@ Controller_Module::connect_to ( Port *p )
|
|||
o->value( p->control_value() );
|
||||
|
||||
_type = TOGGLE;
|
||||
|
||||
/* FIXME: hack */
|
||||
control = (Fl_Valuator*)o;
|
||||
}
|
||||
else if ( p->hints.type == Module::Port::Hints::INTEGER )
|
||||
{
|
||||
|
@ -430,7 +433,13 @@ Controller_Module::cb_handle ( Fl_Widget *w, void *v )
|
|||
void
|
||||
Controller_Module::cb_handle ( Fl_Widget *w )
|
||||
{
|
||||
if ( type() == TOGGLE )
|
||||
{
|
||||
control_value = ((Fl_Button*)w)->value();
|
||||
}
|
||||
else
|
||||
control_value = ((Fl_Valuator*)w)->value();
|
||||
|
||||
if ( control_output[0].connected() )
|
||||
control_output[0].connected_port()->control_value( control_value );
|
||||
}
|
||||
|
@ -535,11 +544,10 @@ Controller_Module::handle_control_changed ( Port *p )
|
|||
if ( p )
|
||||
control_value = p->control_value();
|
||||
|
||||
if ( control->value() != control_value )
|
||||
{
|
||||
redraw();
|
||||
DMESSAGE( "handle_control_changed" );
|
||||
}
|
||||
/* if ( control->value() != control_value ) */
|
||||
/* { */
|
||||
/* redraw(); */
|
||||
/* } */
|
||||
|
||||
if ( type() == SPATIALIZATION )
|
||||
{
|
||||
|
@ -550,6 +558,9 @@ Controller_Module::handle_control_changed ( Port *p )
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( type() == TOGGLE )
|
||||
((Fl_Button*)control)->value(control_value);
|
||||
else
|
||||
control->value(control_value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -250,6 +250,10 @@ Module_Parameter_Editor::make_controls ( void )
|
|||
|
||||
w->align(FL_ALIGN_TOP);
|
||||
w->labelsize( 10 );
|
||||
|
||||
if ( p->hints.type == Module::Port::Hints::BOOLEAN )
|
||||
w->callback( cb_button_handle, new callback_data( this, i ) );
|
||||
else
|
||||
w->callback( cb_value_handle, new callback_data( this, i ) );
|
||||
|
||||
{ Fl_Group *o = new Fl_Group( 0, 0, 50, 75 );
|
||||
|
@ -323,6 +327,15 @@ Module_Parameter_Editor::cb_value_handle ( Fl_Widget *w, void *v )
|
|||
cd->base_widget->set_value( cd->port_number[0], ((Fl_Valuator*)w)->value() );
|
||||
}
|
||||
|
||||
void
|
||||
Module_Parameter_Editor::cb_button_handle ( Fl_Widget *w, void *v )
|
||||
{
|
||||
callback_data *cd = (callback_data*)v;
|
||||
|
||||
cd->base_widget->set_value( cd->port_number[0], ((Fl_Button*)w)->value() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Module_Parameter_Editor::cb_panner_value_handle ( Fl_Widget *w, void *v )
|
||||
{
|
||||
|
@ -375,12 +388,24 @@ Module_Parameter_Editor::handle_control_changed ( Module::Port *p )
|
|||
{
|
||||
int i = _module->control_input_port_index( p );
|
||||
|
||||
/* FIXME: very hacky in that it assumes the control is an Fl_Valuator... (which buttons are not) */
|
||||
Fl_Group *g = (Fl_Group*)control_pack->child( i );
|
||||
Fl_Group *g2 = (Fl_Group*)g->child( 0 );
|
||||
|
||||
|
||||
if ( p->hints.type == Module::Port::Hints::BOOLEAN )
|
||||
{
|
||||
Fl_Button *v = (Fl_Button*)g2->child( 0 );
|
||||
|
||||
v->value( p->control_value() );
|
||||
}
|
||||
else
|
||||
{
|
||||
Fl_Valuator *v = (Fl_Valuator*)g2->child( 0 );
|
||||
|
||||
v->value( p->control_value() );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Module_Parameter_Editor::set_value (int i, float value )
|
||||
|
|
|
@ -52,6 +52,7 @@ class Module_Parameter_Editor : public Fl_Double_Window
|
|||
|
||||
};
|
||||
|
||||
static void cb_button_handle ( Fl_Widget *w, void *v );
|
||||
static void cb_value_handle ( Fl_Widget *w, void *v );
|
||||
static void cb_panner_value_handle ( Fl_Widget *w, void *v );
|
||||
static void cb_mode_handle ( Fl_Widget *w, void *v );
|
||||
|
|
Loading…
Reference in New Issue