diff --git a/Mixer/Mixer.C b/Mixer/Mixer.C index eb7233d..165c205 100644 --- a/Mixer/Mixer.C +++ b/Mixer/Mixer.C @@ -28,7 +28,7 @@ #include #include "New_Project_Dialog.H" #include "Engine/Engine.H" - +#include "FL/Fl_Flowpack.H" #include "Project.H" #include @@ -36,8 +36,6 @@ const double STATUS_UPDATE_FREQ = 0.2f; -static Fl_Pack *mixer_strips; - #include "util/debug.h" @@ -84,7 +82,7 @@ void Mixer::cb_menu(Fl_Widget* o) { { Project::save(); } - if (! strcmp( picked, "&Project/&Quit") ) + else if (! strcmp( picked, "&Project/&Quit") ) { quit(); } @@ -92,6 +90,19 @@ void Mixer::cb_menu(Fl_Widget* o) { { new_strip(); } + else if (! strcmp( picked, "&Mixer/&Rows/One") ) + { + rows( 1 ); + } + else if (! strcmp( picked, "&Mixer/&Rows/Two") ) + { + rows( 2 ); + } + else if (! strcmp( picked, "&Mixer/&Rows/Three") ) + { + rows( 3 ); + } + } void Mixer::cb_menu(Fl_Widget* o, void* v) { @@ -101,6 +112,7 @@ void Mixer::cb_menu(Fl_Widget* o, void* v) { Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : Fl_Group( X, Y, W, H, L ) { + _rows = 1; box( FL_NO_BOX ); labelsize( 96 ); { Fl_Menu_Bar *o = new Fl_Menu_Bar( X, Y, W, 24 ); @@ -109,19 +121,23 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : o->add( "&Project/&Save", FL_CTRL + 's', 0, 0 ); o->add( "&Project/&Quit", FL_CTRL + 'q', 0, 0 ); o->add( "&Mixer/&Add Strip", 'a', 0, 0 ); - o->add( "&Options" ); + o->add( "&Mixer/&Rows/One", '1', 0, 0 ); + o->add( "&Mixer/&Rows/Two", '2', 0, 0 ); + o->add( "&Mixer/&Rows/Three", '3', 0, 0 ); o->callback( cb_menu, this ); } { Fl_Scroll *o = scroll = new Fl_Scroll( X, Y + 24, W, H - 24 ); o->box( FL_NO_BOX ); - o->type( Fl_Scroll::HORIZONTAL_ALWAYS ); +// o->type( Fl_Scroll::HORIZONTAL_ALWAYS ); +// o->box( Fl_Scroll::BOTH ); { - Fl_Pack *o = mixer_strips = new Fl_Pack( X, Y + 24, W, H - 18 - 24 ); + Fl_Flowpack *o = mixer_strips = new Fl_Flowpack( X, Y + 24, W, H - 18 - 24 ); label( "Non-Mixer" ); align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE) ); o->box( FL_NO_BOX ); o->type( Fl_Pack::HORIZONTAL ); - o->spacing( 2 ); + o->hspacing( 2 ); + o->vspacing( 2 ); o->end(); Fl_Group::current()->resizable( o ); } @@ -150,6 +166,8 @@ void Mixer::resize ( int X, int Y, int W, int H ) mixer_strips->resize( X, Y + 24, W, H - 18 - 24 ); scroll->resize( X, Y + 24, W, H - 24 ); + + rows( _rows ); } void Mixer::add ( Mixer_Strip *ms ) @@ -158,6 +176,8 @@ void Mixer::add ( Mixer_Strip *ms ) mixer_strips->add( ms ); + rows( _rows ); + scroll->redraw(); } @@ -221,6 +241,38 @@ Mixer::contains ( Mixer_Strip *ms ) return ms->parent() == mixer_strips; } +void +Mixer::rows ( int n ) +{ + + int sh; + + if ( n > 1 ) + sh = (scroll->h() / n) - (mixer_strips->vspacing() * (n - 1)); + else + sh = (scroll->h() - 18) / n; + + int tw = 0; + + for ( int i = 0; i < mixer_strips->children(); ++i ) + { + Mixer_Strip *t = (Mixer_Strip*)mixer_strips->child( i ); + + t->size( t->w(), sh ); + + tw += t->w() + mixer_strips->hspacing(); + } + + if ( n > 1 ) + mixer_strips->size( scroll->w() - 18, mixer_strips->h() ); + else + mixer_strips->size( tw, mixer_strips->h() ); + + _rows = n; + + scroll->redraw(); +} + void Mixer::update ( void ) { THREAD_ASSERT( UI ); diff --git a/Mixer/Mixer.H b/Mixer/Mixer.H index b9bbe9e..6c2892a 100644 --- a/Mixer/Mixer.H +++ b/Mixer/Mixer.H @@ -26,11 +26,15 @@ #include #include "Mixer_Strip.H" +class Fl_Flowpack; + class Mixer : public Fl_Group { private: + int _rows; + Mixer_Strip* track_by_name ( const char *name ); char * get_unique_track_name ( const char *name ); @@ -42,6 +46,8 @@ private: Fl_Scroll *scroll; Fl_Pack *pack; + Fl_Flowpack *mixer_strips; + protected: @@ -49,6 +55,7 @@ protected: public: + void rows ( int n ); virtual void resize ( int X, int Y, int W, int H ); void update ( void ); diff --git a/Mixer/Mixer_Strip.C b/Mixer/Mixer_Strip.C index 10a0b20..899d876 100644 --- a/Mixer/Mixer_Strip.C +++ b/Mixer/Mixer_Strip.C @@ -149,6 +149,7 @@ Mixer_Strip::chain ( Chain *c ) Mixer_Strip::Mixer_Strip( const char *strip_name, int channels ) : Fl_Group( 0, 0, 120, 600 ) { label( strdup( strip_name ) ); + labeltype( FL_NO_LABEL ); init();