Fl_Flowpack: Fix mixer usage.

This commit is contained in:
Jonathan Moore Liles 2013-02-21 18:19:44 -08:00
parent e4d08afc68
commit a228920ac1
2 changed files with 40 additions and 12 deletions

View File

@ -27,6 +27,7 @@ class Fl_Flowpack : public Fl_Group
int _vspacing; int _vspacing;
int _max_width; int _max_width;
bool _flow; bool _flow;
bool _flowdown;
public: public:
@ -36,6 +37,7 @@ public:
resizable( 0 ); resizable( 0 );
_max_width = _hspacing = _vspacing = 0; _max_width = _hspacing = _vspacing = 0;
_flow = true; _flow = true;
_flowdown = false;
} }
virtual ~Fl_Flowpack ( ) virtual ~Fl_Flowpack ( )
@ -53,6 +55,9 @@ public:
bool flow ( void ) const { return _flow; } bool flow ( void ) const { return _flow; }
void flow ( bool v ) { _flow = v; } void flow ( bool v ) { _flow = v; }
bool flowdown ( void ) const { return _flowdown; }
void flowdown ( bool v ) { _flowdown = v; }
void void
add ( Fl_Widget *w ) add ( Fl_Widget *w )
{ {
@ -101,6 +106,8 @@ public:
int LW = 0; int LW = 0;
int LH = 0; int LH = 0;
int LX = 0;
int LY = 0;
for ( int i = 0; i < children(); ++i ) for ( int i = 0; i < children(); ++i )
{ {
@ -113,10 +120,10 @@ public:
if ( _flow ) if ( _flow )
{ {
if ( Y + o->h() < H ) if ( _flowdown && Y + o->h() < H )
{ {
/* if it'll fit in this column, put it below the previous widget */ /* if it'll fit in this column, put it below the previous widget */
X -= LW + _hspacing; X = LX;
} }
else if ( X + o->w() >= W ) else if ( X + o->w() >= W )
{ {
@ -128,20 +135,39 @@ public:
else else
{ {
/* otherwise, put it in the next column */ /* otherwise, put it in the next column */
Y = 0; Y = LY;
}
} }
LW = o->w(); LW = o->w();
LH = o->h(); LH = o->h();
}
/* avoid bothering the control with lots of resize() calls */ /* avoid bothering the control with lots of resize() calls */
if ( ! ( o->x() == x() + X &&
o->y() == y() + Y ) )
o->position( x() + X, y() + Y );
LX = X;
LY = Y;
if ( ! ( o->x() == x() + LX &&
o->y() == y() + LY ) )
o->position( x() + LX, y() + LY );
if ( _flow )
{
Y += LH + _vspacing; Y += LH + _vspacing;
X += LW + _hspacing; X += LW + _hspacing;
}
else
{
if ( type() == Fl_Pack::HORIZONTAL )
{
X += LW + _hspacing;
}
else
{
Y += LH + _vspacing;
}
}
if ( X > _max_width ) if ( X > _max_width )
_max_width = X; _max_width = X;

View File

@ -110,6 +110,8 @@ Transport::Transport ( int X, int Y, int W, int H, const char *L )
o->when( FL_WHEN_CHANGED ); o->when( FL_WHEN_CHANGED );
o->color2( fl_color_average( FL_GRAY, FL_YELLOW, 0.50 ) ); o->color2( fl_color_average( FL_GRAY, FL_YELLOW, 0.50 ) );
o->tooltip( "Toggle automatic creation of new takes for armed tracks" ); o->tooltip( "Toggle automatic creation of new takes for armed tracks" );
flowdown( true );
} }