diff --git a/mixer/src/Mixer.C b/mixer/src/Mixer.C index 6d859f8..321bbb0 100644 --- a/mixer/src/Mixer.C +++ b/mixer/src/Mixer.C @@ -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(); } diff --git a/mixer/src/Mixer.H b/mixer/src/Mixer.H index c86109b..71ec55b 100644 --- a/mixer/src/Mixer.H +++ b/mixer/src/Mixer.H @@ -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 ); diff --git a/mixer/src/Mixer_Strip.C b/mixer/src/Mixer_Strip.C index 54c3d62..231a7d8 100644 --- a/mixer/src/Mixer_Strip.C +++ b/mixer/src/Mixer_Strip.C @@ -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; } /************/ diff --git a/mixer/src/Mixer_Strip.H b/mixer/src/Mixer_Strip.H index 081d207..9c601d8 100644 --- a/mixer/src/Mixer_Strip.H +++ b/mixer/src/Mixer_Strip.H @@ -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 );