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

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

View File

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

View File

@ -534,6 +534,7 @@ Mixer_Strip::update ( void )
} }
} }
void void
Mixer_Strip::init ( ) Mixer_Strip::init ( )
{ {
@ -563,6 +564,24 @@ Mixer_Strip::init ( )
o->tooltip( "Drag and drop to move strip" ); 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 ); { Fl_Pack *o = new Fl_Pack( 2, 2, 114, 100 );
o->type( Fl_Pack::VERTICAL ); o->type( Fl_Pack::VERTICAL );
o->spacing(2); o->spacing(2);
@ -582,7 +601,7 @@ Mixer_Strip::init ( )
} }
{ Fl_Scalepack *o = new Fl_Scalepack( 7, 143, 110, 18 ); { Fl_Scalepack *o = new Fl_Scalepack( 7, 143, 110, 18 );
o->type( Fl_Pack::HORIZONTAL ); o->type( Fl_Pack::HORIZONTAL );
o->spacing(2);
{ Fl_Flip_Button* o = width_button = new Fl_Flip_Button(61, 183, 45, 22, "[]/[-]"); { Fl_Flip_Button* o = width_button = new Fl_Flip_Button(61, 183, 45, 22, "[]/[-]");
o->type(1); o->type(1);
o->tooltip( "Switch between wide and narrow views" ); o->tooltip( "Switch between wide and narrow views" );
@ -604,16 +623,6 @@ Mixer_Strip::init ( )
o->end(); o->end();
} // Fl_Group* o } // 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); { Fl_Choice* o = group_choice = new Fl_Choice(61, 183, 45, 22);
o->tooltip( "Create or assign group" ); o->tooltip( "Create or assign group" );
o->labeltype(FL_NO_LABEL); o->labeltype(FL_NO_LABEL);
@ -624,6 +633,7 @@ Mixer_Strip::init ( )
o->callback( ((Fl_Callback*)cb_handle), this ); o->callback( ((Fl_Callback*)cb_handle), this );
} }
{ Fl_Scalepack *o = new Fl_Scalepack( 0,0, 45, 22 ); { Fl_Scalepack *o = new Fl_Scalepack( 0,0, 45, 22 );
o->spacing(2);
o->type( FL_HORIZONTAL ); o->type( FL_HORIZONTAL );
{ Fl_Flip_Button* o = tab_button = new Fl_Flip_Button(61, 183, 45, 22, "Fadr/Signl"); { Fl_Flip_Button* o = tab_button = new Fl_Flip_Button(61, 183, 45, 22, "Fadr/Signl");
o->tooltip( "Switch between fader and signal views" ); o->tooltip( "Switch between fader and signal views" );
@ -1225,10 +1235,23 @@ Mixer_Strip::send_feedback ( void )
_chain->send_feedback(); _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 int
Mixer_Strip::number ( void ) const Mixer_Strip::number ( void ) const
{ {
return mixer->find_strip( this ); return _number;
} }
/************/ /************/

View File

@ -98,6 +98,7 @@ private:
int _gain_controller_mode; int _gain_controller_mode;
int _mute_controller_mode; int _mute_controller_mode;
bool _manual_connection; bool _manual_connection;
int _number;
Fl_Menu_Button *output_connection_button; Fl_Menu_Button *output_connection_button;
Fl_Flip_Button *width_button; Fl_Flip_Button *width_button;
@ -176,6 +177,7 @@ public:
void group ( Group * ); void group ( Group * );
void send_feedback ( void ); void send_feedback ( void );
int number ( void ) const; int number ( void ) const;
void number ( int );
static bool import_strip ( const char *filename ); static bool import_strip ( const char *filename );
void command_toggle_fader_view ( void ); void command_toggle_fader_view ( void );