Separate track, control tracks, and takes.
This commit is contained in:
parent
decd7d107b
commit
9a01389624
14
Timeline.C
14
Timeline.C
|
@ -163,17 +163,11 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
|
|||
l = o;
|
||||
// o->end();
|
||||
|
||||
t->add( o );
|
||||
t->add( new Control_Track( 0, 0, 1, 100 ) );
|
||||
t->color( (Fl_Color)rand() );
|
||||
}
|
||||
|
||||
{
|
||||
Track_Header *t = new Track_Header( 0, 0, W, 30 );
|
||||
Track *o = new Control_Track( 0, 0, 1, 100 );
|
||||
o->color( FL_BLUE );
|
||||
t->color( FL_RED );
|
||||
t->track( o );
|
||||
t->add( new Audio_Track( 0, 0, 1, 100 ) );
|
||||
t->add( new Audio_Track( 0, 0, 1, 100 ) );
|
||||
t->add_control( new Control_Track( 0, 0, 1, 100 ) );
|
||||
t->color( (Fl_Color)rand() );
|
||||
}
|
||||
|
||||
tracks = o;
|
||||
|
|
|
@ -86,6 +86,7 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) :
|
|||
Fl_Group ( X, Y, W, H, L )
|
||||
{
|
||||
|
||||
_track = NULL;
|
||||
_name = NULL;
|
||||
_selected = false;
|
||||
_show_all_takes = false;
|
||||
|
@ -161,12 +162,23 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) :
|
|||
o->end();
|
||||
}
|
||||
{
|
||||
Fl_Pack *o = takes = new Fl_Pack( 150, 0, 1006, 115 );
|
||||
Fl_Pack *o = pack = new Fl_Pack( width(), 0, 1006, 115 );
|
||||
o->labeltype( FL_NO_LABEL );
|
||||
o->align( FL_ALIGN_CLIP );
|
||||
o->resize( x() + width(), y(), w() - width(), h() );
|
||||
o->end();
|
||||
Fl_Group::current()->resizable( o );
|
||||
|
||||
{
|
||||
Fl_Pack *o = control = new Fl_Pack( width(), 0, pack->w(), 115 );
|
||||
o->end();
|
||||
}
|
||||
|
||||
{
|
||||
Fl_Pack *o = takes = new Fl_Pack( width(), 0, pack->w(), 115 );
|
||||
o->end();
|
||||
o->hide();
|
||||
}
|
||||
|
||||
o->end();
|
||||
}
|
||||
end();
|
||||
|
||||
|
@ -178,15 +190,80 @@ Track_Header::~Track_Header ( )
|
|||
log_destroy();
|
||||
}
|
||||
|
||||
int
|
||||
Track_Header::width()
|
||||
|
||||
static int pack_visible( Fl_Pack *p )
|
||||
{
|
||||
return 150;
|
||||
int v = 0;
|
||||
for ( int i = p->children(); i--; )
|
||||
if ( p->child( i )->visible() )
|
||||
v++;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
/* adjust size of widget and children */
|
||||
void
|
||||
Track_Header::resize ( void )
|
||||
{
|
||||
for ( int i = takes->children(); i--; )
|
||||
takes->child( i )->size( w(), height() );
|
||||
|
||||
for ( int i = control->children(); i--; )
|
||||
control->child( i )->size( w(), height() );
|
||||
|
||||
if ( _show_all_takes )
|
||||
{
|
||||
takes->show();
|
||||
Fl_Group::size( w(), height() * ( 1 + takes->children() + pack_visible( control ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
takes->hide();
|
||||
Fl_Group::size( w(), height() * ( 1 + pack_visible( control ) ) );
|
||||
}
|
||||
|
||||
if ( track() )
|
||||
track()->size( w(), height() );
|
||||
|
||||
|
||||
if ( controls->y() + controls->h() > y() + h() )
|
||||
controls->hide();
|
||||
else
|
||||
controls->show();
|
||||
|
||||
parent()->redraw();
|
||||
}
|
||||
|
||||
void
|
||||
Track_Header::size ( int v )
|
||||
{
|
||||
if ( v < 0 || v > 3 )
|
||||
return;
|
||||
|
||||
_size = v;
|
||||
|
||||
resize();
|
||||
}
|
||||
|
||||
void
|
||||
Track_Header::track( Track * t )
|
||||
{
|
||||
// t->size( 1, h() );
|
||||
takes->insert( *t, 0 );
|
||||
if ( track() )
|
||||
add( track() );
|
||||
|
||||
// takes->insert( *track(), 0 );
|
||||
|
||||
_track = t;
|
||||
pack->insert( *t, 0 );
|
||||
|
||||
resize();
|
||||
}
|
||||
|
||||
void
|
||||
Track_Header::add_control( Track *t )
|
||||
{
|
||||
control->add( t );
|
||||
|
||||
resize();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,8 @@ private:
|
|||
|
||||
enum { AUDIO } _type;
|
||||
|
||||
Track *_track;
|
||||
|
||||
public:
|
||||
|
||||
Fl_Input * name_field;
|
||||
|
@ -60,8 +62,13 @@ public:
|
|||
Fl_Button *solo_button;
|
||||
Fl_Menu_Button *take_menu;
|
||||
Fl_Group *controls;
|
||||
|
||||
Fl_Pack *pack;
|
||||
Fl_Pack *control;
|
||||
Fl_Pack *takes;
|
||||
|
||||
|
||||
|
||||
const char *class_name ( void ) { return "Track_Header"; }
|
||||
|
||||
void set ( char **sa )
|
||||
|
@ -166,38 +173,12 @@ public:
|
|||
Fl_Group::draw();
|
||||
}
|
||||
|
||||
void add_control( Track *t );
|
||||
|
||||
int size ( void ) const { return _size; }
|
||||
|
||||
/* adjust size of widget and children */
|
||||
void resize ( void )
|
||||
{
|
||||
for ( int i = takes->children(); i--; )
|
||||
{
|
||||
takes->child( i )->size( w(), height() );
|
||||
}
|
||||
|
||||
if ( _show_all_takes )
|
||||
Fl_Group::size( w(), height() * takes->children() );
|
||||
else
|
||||
Fl_Group::size( w(), height() );
|
||||
|
||||
if ( controls->y() + controls->h() > y() + h() )
|
||||
controls->hide();
|
||||
else
|
||||
controls->show();
|
||||
|
||||
parent()->redraw();
|
||||
}
|
||||
|
||||
void size ( int v )
|
||||
{
|
||||
if ( v < 0 || v > 3 )
|
||||
return;
|
||||
|
||||
_size = v;
|
||||
|
||||
resize();
|
||||
}
|
||||
void resize ( void );
|
||||
void size ( int v );
|
||||
|
||||
int height ( void ) const
|
||||
{
|
||||
|
@ -224,10 +205,10 @@ public:
|
|||
void cb_button ( Fl_Widget *w );
|
||||
|
||||
|
||||
static int width();
|
||||
static int width ( void ) { return 150; }
|
||||
|
||||
void track( Track * t );
|
||||
Track * track ( void ) { return (Track*)takes->child( 0 ); }
|
||||
Track * track ( void ) { return _track; }
|
||||
|
||||
void add ( Track * t )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue