Mixer: Show strip number at top of each strip (eases mentally mapping onto hardware control surface).

This commit is contained in:
Jonathan Moore Liles 2020-10-10 20:10:16 -07:00
parent a7a7b967c8
commit b3ffef17b5
4 changed files with 63 additions and 16 deletions

View File

@ -757,8 +757,10 @@ void Mixer::add ( Mixer_Strip *ms )
mixer_strips->add( ms );
ms->size( ms->w(), _strip_height );
ms->redraw();
ms->take_focus();
ms->redraw();
ms->take_focus();
renumber_strips();
}
int
@ -775,12 +777,24 @@ Mixer::quit ( void )
while ( Fl::first_window() ) Fl::first_window()->hide();
}
void
Mixer::renumber_strips ( void )
{
for ( int i = mixer_strips->children(); i--; )
{
Mixer_Strip *o = (Mixer_Strip*)mixer_strips->child(i);
o->number( find_strip( o ) );
}
}
void
Mixer::insert ( Mixer_Strip *ms, Mixer_Strip *before )
{
// mixer_strips->remove( ms );
mixer_strips->insert( *ms, before );
renumber_strips();
// scroll->redraw();
}
void
@ -789,6 +803,7 @@ Mixer::insert ( Mixer_Strip *ms, int i )
Mixer_Strip *before = (Mixer_Strip*)mixer_strips->child( i );
insert( ms, before);
renumber_strips();
}
void
@ -799,6 +814,7 @@ Mixer::move_left ( Mixer_Strip *ms )
if ( i > 0 )
insert( ms, i - 1 );
renumber_strips();
/* FIXME: do better */
mixer_strips->redraw();
}
@ -811,6 +827,8 @@ Mixer::move_right ( Mixer_Strip *ms )
if ( i < mixer_strips->children() - 1 )
insert( ms, i + 2 );
renumber_strips();
/* FIXME: do better */
mixer_strips->redraw();
}
@ -823,6 +841,8 @@ void Mixer::remove ( Mixer_Strip *ms )
if ( parent() )
parent()->redraw();
renumber_strips();
}

View File

@ -159,6 +159,8 @@ public:
void save_project_settings ( void );
void load_project_settings ( void );
void renumber_strips ( void );
public:
void command_toggle_fader_view ( void );

View File

@ -534,6 +534,7 @@ Mixer_Strip::update ( void )
}
}
void
Mixer_Strip::init ( )
{
@ -562,10 +563,28 @@ Mixer_Strip::init ( )
o->box(FL_FLAT_BOX);
o->tooltip( "Drag and drop to move strip" );
}
{ Fl_Progress* o = dsp_load_progress = new Fl_Progress(61, 183, 45, 14, "group dsp");
o->box(FL_BORDER_BOX);
o->type(FL_HORIZONTAL);
/* o->labelsize( 9 ); */
o->minimum( 0 );
// o->maximum( 0.25f );
o->maximum( 1 );
/* o->color(fl_rgb_color( 10,10,10 ) ); */
o->color2(FL_CYAN);
o->color(fl_contrast(FL_DARK1,FL_FOREGROUND_COLOR));
o->labelcolor(FL_FOREGROUND_COLOR);
/* o->labeltype(FL_NORMAL_LABEL); */
o->labeltype(FL_NORMAL_LABEL);
o->labelfont( FL_COURIER_BOLD );
o->labelsize( 12 );
}
{ Fl_Pack *o = new Fl_Pack( 2, 2, 114, 100 );
o->type( Fl_Pack::VERTICAL );
o->spacing( 2 );
o->spacing(2);
{
Fl_Sometimes_Input *o = new Fl_Sometimes_Input( 2, 2, 144, 15 );
name_field = o;
@ -582,7 +601,7 @@ Mixer_Strip::init ( )
}
{ Fl_Scalepack *o = new Fl_Scalepack( 7, 143, 110, 18 );
o->type( Fl_Pack::HORIZONTAL );
o->spacing(2);
{ Fl_Flip_Button* o = width_button = new Fl_Flip_Button(61, 183, 45, 22, "[]/[-]");
o->type(1);
o->tooltip( "Switch between wide and narrow views" );
@ -604,16 +623,6 @@ Mixer_Strip::init ( )
o->end();
} // Fl_Group* o
{ Fl_Progress* o = dsp_load_progress = new Fl_Progress(61, 183, 45, 14, "group dsp");
o->box(FL_BORDER_BOX);
o->type(FL_HORIZONTAL);
o->labelsize( 9 );
o->minimum( 0 );
// o->maximum( 0.25f );
o->maximum( 1 );
o->color(fl_rgb_color( 10,10,10 ) );
o->color2(FL_CYAN);
}
{ Fl_Choice* o = group_choice = new Fl_Choice(61, 183, 45, 22);
o->tooltip( "Create or assign group" );
o->labeltype(FL_NO_LABEL);
@ -624,6 +633,7 @@ Mixer_Strip::init ( )
o->callback( ((Fl_Callback*)cb_handle), this );
}
{ Fl_Scalepack *o = new Fl_Scalepack( 0,0, 45, 22 );
o->spacing(2);
o->type( FL_HORIZONTAL );
{ Fl_Flip_Button* o = tab_button = new Fl_Flip_Button(61, 183, 45, 22, "Fadr/Signl");
o->tooltip( "Switch between fader and signal views" );
@ -1225,10 +1235,23 @@ Mixer_Strip::send_feedback ( void )
_chain->send_feedback();
}
/* called to inform the strip its number has changed. */
void
Mixer_Strip::number ( int n )
{
if ( _number != n )
{
_number = n;
char *s =NULL;
asprintf( &s,"%i", n+1 );
dsp_load_progress->label(s);
}
}
int
Mixer_Strip::number ( void ) const
{
return mixer->find_strip( this );
return _number;
}
/************/

View File

@ -98,6 +98,7 @@ private:
int _gain_controller_mode;
int _mute_controller_mode;
bool _manual_connection;
int _number;
Fl_Menu_Button *output_connection_button;
Fl_Flip_Button *width_button;
@ -125,7 +126,7 @@ private:
Fl_Progress *dsp_load_progress;
Fl_Box *color_box;
nframes_t nframes;
Fl_Color _color;
@ -176,6 +177,7 @@ public:
void group ( Group * );
void send_feedback ( void );
int number ( void ) const;
void number ( int );
static bool import_strip ( const char *filename );
void command_toggle_fader_view ( void );