Improve takes menu functionality.

This commit is contained in:
Jonathan Moore Liles 2008-03-08 13:04:26 -06:00
parent faebcc48ae
commit 65e251360f
3 changed files with 28 additions and 16 deletions

View File

@ -165,11 +165,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
t->add( o );
t->add( new Control_Track( 0, 0, 1, 100 ) );
t->show_all_takes();
t->color( (Fl_Color)rand() );
}
{

View File

@ -58,9 +58,15 @@ Track_Header::cb_button ( Fl_Widget *w )
else
if ( w == take_menu )
{
printf( "%d\n", take_menu->value() );
int v = take_menu->value();
const char *s = take_menu->menu()[ take_menu->value() ].text;
if ( v == 0 )
{
show_all_takes( take_menu->menu()[ v ].value() );
return;
}
const char *s = take_menu->menu()[ v ].text;
for ( int i = takes->children(); i--; )
{
@ -140,6 +146,7 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) :
o->color( FL_LIGHT1 );
o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
o->callback( cb_button, this );
o->add( "Show all takes", 0, 0, 0, FL_MENU_TOGGLE );
}
o->end();
}
@ -180,6 +187,6 @@ Track_Header::width()
void
Track_Header::track( Track * t )
{
t->size( 1, h() );
// t->size( 1, h() );
takes->insert( *t, 0 );
}

View File

@ -168,14 +168,9 @@ public:
int size ( void ) const { return _size; }
void size ( int v )
/* adjust size of widget and children */
void resize ( void )
{
if ( v < 0 || v > 3 )
return;
_size = v;
for ( int i = takes->children(); i--; )
{
takes->child( i )->size( w(), height() );
@ -186,7 +181,7 @@ public:
else
Fl_Group::size( w(), height() );
if ( _size == 0 )
if ( controls->y() + controls->h() > y() + h() )
controls->hide();
else
controls->show();
@ -194,6 +189,16 @@ public:
parent()->redraw();
}
void size ( int v )
{
if ( v < 0 || v > 3 )
return;
_size = v;
resize();
}
int height ( void ) const
{
static int table[] = { 30, 80, 150, 300 };
@ -201,7 +206,11 @@ public:
return table[ _size ];
}
void show_all_takes ( void ) { Fl_Group::size( w(), height() * takes->children() ); _show_all_takes = true; }
void show_all_takes ( bool b )
{
_show_all_takes = b;
resize();
}
const char * name ( void ) const { return _name; }
bool mute ( void ) const { return mute_button->value(); }