Tracks are virtual, so use Fl_Widget instead of Fl_Group as base class.

This commit is contained in:
Jonathan Moore Liles 2008-03-09 16:18:22 -05:00
parent 8a467843d0
commit 7d6121e2d8
7 changed files with 44 additions and 42 deletions

View File

@ -44,7 +44,7 @@ public:
fl_push_clip( x(), y(), w(), h() );
Fl_Group::draw();
draw_box();
int X, Y, W, H;

View File

@ -114,7 +114,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
o->align( FL_ALIGN_LEFT );
tempo_track = o;
o->end();
// o->end();
}
@ -130,7 +130,7 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
o->align( FL_ALIGN_LEFT );
time_track = o;
o->end();
// o->end();
}

23
Track.C
View File

@ -29,6 +29,25 @@ queue <Track_Widget *> Track::_delete_queue;
Track_Widget *Track::_pushed = NULL;
Track_Widget *Track::_belowmouse = NULL;
Track::Track ( int X, int Y, int W, int H ) : Fl_Widget( X, Y, W, H )
{
_name = NULL;
box( FL_DOWN_BOX );
color( fl_darker( FL_GRAY ) );
align( FL_ALIGN_LEFT );
log_create();
}
Track::~Track ( )
{
/* FIXME: what to do with regions? */
parent()->redraw();
parent()->remove( this );
log_destroy();
}
void
Track::sort ( void )
{
@ -61,7 +80,7 @@ Track::draw ( void )
fl_push_clip( x(), y(), w(), h() );
Fl_Group::draw();
draw_box();
int X, Y, W, H;
@ -332,7 +351,7 @@ Track::handle ( int m )
return retval;
}
else
return Fl_Group::handle( m );
return Fl_Widget::handle( m );
}
}
}

39
Track.H
View File

@ -19,6 +19,7 @@
#pragma once
#include <FL/Fl_Widget.H>
#include <FL/Fl_Group.H>
#include <FL/Fl.H>
// #include "Region.H"
@ -36,7 +37,10 @@ using namespace std;
class Region;
class Track_Widget;
class Track : public Fl_Group, public Loggable
/* This is the base class for all track types. */
class Track : public Fl_Widget, public Loggable
{
char *_name;
@ -82,41 +86,14 @@ protected:
public:
Track ( int X, int Y, int W, int H ) : Fl_Group( X, Y, W, H )
{
_name = NULL;
box( FL_DOWN_BOX );
color( fl_darker( FL_GRAY ) );
end();
log_create();
}
/* const Track & operator= ( const Track & rhs ) */
/* { */
/* if ( *this = rhs ) */
/* return; */
/* } */
virtual ~Track ( )
{
/* FIXME: what to do with regions? */
parent()->redraw();
parent()->remove( this );
log_destroy();
}
Track ( int X, int Y, int W, int H );
virtual ~Track ( );
static Track_Widget *pushed ( void ) { return _pushed; };
static Track_Widget *belowmouse ( void ) { return _belowmouse; };
const char * name ( void ) const { return _name; }
void name ( char *s ) { if ( _name ) free( _name ); _name = s; }
void name ( char *s ) { if ( _name ) free( _name ); _name = s; label( _name ); }
void sort ( void );

View File

@ -252,6 +252,8 @@ Track_Header::size ( int v )
resize();
}
void
Track_Header::track( Track * t )
{

View File

@ -212,11 +212,15 @@ public:
void add ( Track * t )
{
takes->add( t );
char pat[20];
snprintf( pat, sizeof( pat ), "%d", takes->children() );
t->name( strdup( pat ) );
take_menu->add( t->name() );
takes->insert( *t, 0 );
if ( ! t->name() )
{
char pat[20];
snprintf( pat, sizeof( pat ), "%d", takes->children() );
t->name( strdup( pat ) );
take_menu->add( t->name() );
}
}
void remote ( Track *t )

View File

@ -139,7 +139,7 @@ public:
int dispatch ( int m );
Fl_Group * parent ( void ) const { return _track; }
Fl_Widget * parent ( void ) const { return _track; }
int scroll_x ( void ) const { return timeline->ts_to_x( timeline->xoffset ); }
nframes_t scroll_ts ( void ) const { return timeline->xoffset; }