Mixer: Improve display of strip 'control' tab.

This commit is contained in:
Jonathan Moore Liles 2013-09-18 17:10:23 -07:00
parent d97a2ee7ba
commit ea0c2839c1
7 changed files with 56 additions and 31 deletions

View File

@ -68,6 +68,7 @@ public:
/* TODO: other alignments */ /* TODO: other alignments */
} }
resizable(o);
init_sizes(); init_sizes();
} }

View File

@ -144,11 +144,9 @@ Chain::Chain ( ) : Fl_Group( 0, 0, 100, 100, "")
o->color( FL_BACKGROUND_COLOR ); o->color( FL_BACKGROUND_COLOR );
o->box( FL_NO_BOX ); o->box( FL_NO_BOX );
o->type( Fl_Scroll::VERTICAL ); o->type( Fl_Scroll::VERTICAL );
{ Fl_Flowpack *o = controls_pack = new Fl_Flowpack( X, Y, W, H ); { Fl_Pack *o = controls_pack = new Fl_Pack( X, Y, W, H );
o->type( FL_VERTICAL ); o->type( Fl_Pack::VERTICAL );
o->hspacing( 10 ); o->spacing( 5 );
o->vspacing( 10 );
o->box( FL_NO_BOX );
// o->color( FL_RED ); // o->color( FL_RED );
o->end(); o->end();
Fl_Group::current()->resizable( o ); Fl_Group::current()->resizable( o );

View File

@ -38,7 +38,7 @@ class Controller_Module;
class Chain : public Fl_Group, public Loggable { class Chain : public Fl_Group, public Loggable {
Fl_Flip_Button *tab_button; Fl_Flip_Button *tab_button;
Fl_Flowpack *controls_pack; Fl_Pack *controls_pack;
Fl_Group *chain_tab; Fl_Group *chain_tab;
Fl_Group *control_tab; Fl_Group *control_tab;
Fl_Pack *modules_pack; Fl_Pack *modules_pack;

View File

@ -57,6 +57,7 @@ Controller_Module::Controller_Module ( bool is_default ) : Module( is_default, 5
// label( "" ); // label( "" );
box( FL_NO_BOX ); box( FL_NO_BOX );
_horizontal = true;
_pad = true; _pad = true;
control = 0; control = 0;
control_value =0.0f; control_value =0.0f;
@ -426,50 +427,70 @@ Controller_Module::connect_to ( Port *p )
o->value( p->control_value() ); o->value( p->control_value() );
} }
else if ( p->hints.type == Module::Port::Hints::LOGARITHMIC ) // else if ( p->hints.type == Module::Port::Hints::LOGARITHMIC )
else
{ {
Fl_Value_SliderX *o = new Fl_Value_SliderX(0, 0, 30, 250, p->name() ); Fl_Value_SliderX *o = new Fl_Value_SliderX(0, 0, 30, 250, p->name() );
control = o; control = o;
w = o; w = o;
o->type(4); if ( ! _horizontal )
{
o->size( 30, 250 );
o->type(FL_VERT_NICE_SLIDER);
}
else
{
o->size(250,20);
o->type(FL_HOR_NICE_SLIDER);
}
// o->type(4);
o->color( FL_BACKGROUND2_COLOR ); o->color( FL_BACKGROUND2_COLOR );
o->selection_color( fl_color_average( FL_GRAY, FL_CYAN, 0.5 ) ); o->selection_color( fl_color_average( FL_GRAY, FL_CYAN, 0.5 ) );
o->minimum(1.5); o->minimum(1.5);
o->maximum(0); o->maximum(0);
o->value(1); o->value(1);
o->textsize(9); // o->textsize(9);
if ( p->hints.ranged ) if ( p->hints.ranged )
{
if ( ! _horizontal )
{ {
o->minimum( p->hints.maximum ); o->minimum( p->hints.maximum );
o->maximum( p->hints.minimum ); o->maximum( p->hints.minimum );
} }
else
{
o->minimum( p->hints.minimum );
o->maximum( p->hints.maximum );
}
}
o->value( p->control_value() ); o->value( p->control_value() );
_type = SLIDER; _type = SLIDER;
} }
else /* else */
{ /* { */
{ Fl_DialX *o = new Fl_DialX( 0, 0, 50, 50, p->name() ); /* { Fl_DialX *o = new Fl_DialX( 0, 0, 50, 50, p->name() ); */
w = o; /* w = o; */
control = o; /* control = o; */
if ( p->hints.ranged ) /* if ( p->hints.ranged ) */
{ /* { */
DMESSAGE( "Min: %f, max: %f", p->hints.minimum, p->hints.maximum ); /* DMESSAGE( "Min: %f, max: %f", p->hints.minimum, p->hints.maximum ); */
o->minimum( p->hints.minimum ); /* o->minimum( p->hints.minimum ); */
o->maximum( p->hints.maximum ); /* o->maximum( p->hints.maximum ); */
} /* } */
o->color( fl_darker( FL_GRAY ) ); /* o->color( fl_darker( FL_GRAY ) ); */
o->selection_color( FL_WHITE ); /* o->selection_color( FL_WHITE ); */
o->value( p->control_value() ); /* o->value( p->control_value() ); */
} /* } */
_type = KNOB; /* _type = KNOB; */
} /* } */
control_value = p->control_value(); control_value = p->control_value();
@ -485,6 +506,8 @@ Controller_Module::connect_to ( Port *p )
size( flg->w(), flg->h() ); size( flg->w(), flg->h() );
flg->position( x(), y() ); flg->position( x(), y() );
add( flg ); add( flg );
resizable(flg);
// init_sizes();
} }
else else
{ {
@ -500,7 +523,7 @@ Controller_Module::connect_to ( Port *p )
w->resize( x(), y(), this->w(), h() ); w->resize( x(), y(), this->w(), h() );
add( w ); add( w );
resizable( w ); resizable( w );
// init_sizes(); init_sizes();
} }
} }

View File

@ -33,6 +33,7 @@ class Controller_Module : public Module
{ {
bool _pad; bool _pad;
bool _horizontal;
volatile float control_value; volatile float control_value;
@ -65,6 +66,7 @@ public:
Mode mode ( void ) const { return _mode; } Mode mode ( void ) const { return _mode; }
void mode ( Mode v ); void mode ( Mode v );
void horizontal ( bool v ) { _horizontal = v; }
Type type ( void ) const { return _type; } Type type ( void ) const { return _type; }
Controller_Module ( bool is_default = false ); Controller_Module ( bool is_default = false );

View File

@ -649,6 +649,7 @@ Mixer_Strip::init ( )
o->spacing( 20 ); o->spacing( 20 );
o->type( Fl_Scalepack::HORIZONTAL ); o->type( Fl_Scalepack::HORIZONTAL );
{ Controller_Module *o = gain_controller = new Controller_Module( true ); { Controller_Module *o = gain_controller = new Controller_Module( true );
o->horizontal(false);
o->pad( false ); o->pad( false );
o->size( 33, 100 ); o->size( 33, 100 );
} }

View File

@ -432,7 +432,7 @@ Module_Parameter_Editor::bind_control ( int i )
Controller_Module *o = new Controller_Module(); Controller_Module *o = new Controller_Module();
o->label( p->name() ); o->label( p->name() );
o->chain( _module->chain() ); o->chain( _module->chain() );
o->horizontal( true );
o->connect_to( p ); o->connect_to( p );
_module->chain()->add_control( o ); _module->chain()->add_control( o );