@@ -65,9 +65,9 @@ public: | |||||
/* for loggable */ | /* for loggable */ | ||||
LOG_CREATE_FUNC( Annotation_Point ); | LOG_CREATE_FUNC( Annotation_Point ); | ||||
Annotation_Point ( Sequence *track, nframes_t when, const char *name ) | |||||
Annotation_Point ( Sequence *sequence, nframes_t when, const char *name ) | |||||
{ | { | ||||
_track = track; | |||||
_sequence = sequence; | |||||
_r->offset = when; | _r->offset = when; | ||||
@@ -112,7 +112,7 @@ public: | |||||
if ( m == FL_RELEASE ) | if ( m == FL_RELEASE ) | ||||
{ | { | ||||
_track->sort(); | |||||
sequence()->sort(); | |||||
timeline->redraw(); | timeline->redraw(); | ||||
} | } | ||||
@@ -48,9 +48,9 @@ Annotation_Region::set ( Log_Entry &e ) | |||||
// timeline->redraw(); | // timeline->redraw(); | ||||
} | } | ||||
Annotation_Region::Annotation_Region ( Sequence *track, nframes_t when, const char *name ) | |||||
Annotation_Region::Annotation_Region ( Sequence *sequence, nframes_t when, const char *name ) | |||||
{ | { | ||||
_track = track; | |||||
_sequence = sequence; | |||||
_r->offset = when; | _r->offset = when; | ||||
@@ -110,7 +110,7 @@ Annotation_Region::handle ( int m ) | |||||
if ( m == FL_RELEASE ) | if ( m == FL_RELEASE ) | ||||
{ | { | ||||
_track->sort(); | |||||
sequence()->sort(); | |||||
timeline->redraw(); | timeline->redraw(); | ||||
} | } | ||||
@@ -87,7 +87,7 @@ void | |||||
Audio_Region::init ( void ) | Audio_Region::init ( void ) | ||||
{ | { | ||||
_track = NULL; | |||||
_sequence = NULL; | |||||
_r->offset = 0; | _r->offset = 0; | ||||
_r->start = 0; | _r->start = 0; | ||||
_r->end = 0; | _r->end = 0; | ||||
@@ -140,10 +140,10 @@ Audio_Region::Audio_Region ( Audio_File *c, Sequence *t, nframes_t o ) | |||||
init(); | init(); | ||||
_clip = c; | _clip = c; | ||||
_r->end = _clip->length(); | _r->end = _clip->length(); | ||||
_track = t; | |||||
_sequence = t; | |||||
_r->offset = o; | _r->offset = o; | ||||
_track->add( this ); | |||||
sequence()->add( this ); | |||||
int sum = 0; | int sum = 0; | ||||
const char *s = rindex( _clip->name(), '/' ); | const char *s = rindex( _clip->name(), '/' ); | ||||
@@ -204,7 +204,7 @@ Audio_Region::handle ( int m ) | |||||
if ( offset < length() ) | if ( offset < length() ) | ||||
_fade_in.length = offset; | _fade_in.length = offset; | ||||
printf( "setting fade in length to %lu\n", _fade_in.length ); | |||||
DMESSAGE( "setting fade in length to %lu", _fade_in.length ); | |||||
redraw(); | redraw(); | ||||
@@ -217,7 +217,7 @@ Audio_Region::handle ( int m ) | |||||
if ( offset > 0 ) | if ( offset > 0 ) | ||||
_fade_out.length = offset; | _fade_out.length = offset; | ||||
printf( "setting fade out length to %lu\n", _fade_in.length ); | |||||
DMESSAGE( "setting fade out length to %lu", _fade_in.length ); | |||||
redraw(); | redraw(); | ||||
@@ -246,7 +246,7 @@ Audio_Region::handle ( int m ) | |||||
trim( RIGHT, X ); | trim( RIGHT, X ); | ||||
copy->trim( LEFT, X ); | copy->trim( LEFT, X ); | ||||
_track->add( copy ); | |||||
sequence()->add( copy ); | |||||
log_end(); | log_end(); | ||||
@@ -369,7 +369,7 @@ Audio_Region::handle ( int m ) | |||||
_r->end = _r->start + W; | _r->end = _r->start + W; | ||||
_track->redraw(); | |||||
sequence()->redraw(); | |||||
return 1; | return 1; | ||||
} | } | ||||
@@ -378,7 +378,7 @@ Audio_Region::handle ( int m ) | |||||
{ | { | ||||
if ( _drag->state == 0 ) | if ( _drag->state == 0 ) | ||||
{ | { | ||||
_track->add( new Audio_Region( *this ) ); | |||||
sequence()->add( new Audio_Region( *this ) ); | |||||
_drag->state = 1; | _drag->state = 1; | ||||
return 1; | return 1; | ||||
} | } | ||||
@@ -468,11 +468,11 @@ Audio_Region::draw_box( void ) | |||||
Fl_Color selection_color = _selection_color; | Fl_Color selection_color = _selection_color; | ||||
Fl_Color color = Audio_Region::inherit_track_color ? track()->track()->color() : _box_color; | |||||
Fl_Color color = Audio_Region::inherit_track_color ? sequence()->track()->color() : _box_color; | |||||
color = fl_color_average( color, track()->color(), 0.75f ); | |||||
color = fl_color_average( color, sequence()->color(), 0.75f ); | |||||
if ( this == ((Audio_Sequence*)track())->capture() ) | |||||
if ( this == ((Audio_Sequence*)sequence())->capture() ) | |||||
{ | { | ||||
color = FL_RED; | color = FL_RED; | ||||
} | } | ||||
@@ -515,7 +515,7 @@ Audio_Region::draw ( void ) | |||||
int OX = scroll_x(); | int OX = scroll_x(); | ||||
int ox = timeline->ts_to_x( _r->offset ); | int ox = timeline->ts_to_x( _r->offset ); | ||||
if ( ox > OX + _track->w() || | |||||
if ( ox > OX + sequence()->w() || | |||||
ox < OX && ox + abs_w() < OX ) | ox < OX && ox + abs_w() < OX ) | ||||
/* not in viewport */ | /* not in viewport */ | ||||
return; | return; | ||||
@@ -532,7 +532,7 @@ Audio_Region::draw ( void ) | |||||
rw -= OX - ox; | rw -= OX - ox; | ||||
} | } | ||||
rw = min( rw, _track->w() ); | |||||
rw = min( rw, sequence()->w() ); | |||||
int rx = x(); | int rx = x(); | ||||
@@ -823,7 +823,7 @@ Audio_Region::write ( nframes_t nframes ) | |||||
if ( W ) | if ( W ) | ||||
{ | { | ||||
++W; | ++W; | ||||
track()->damage( FL_DAMAGE_ALL, x() + w() - W, y(), W, h() ); | |||||
sequence()->damage( FL_DAMAGE_ALL, x() + w() - W, y(), W, h() ); | |||||
} | } | ||||
} | } | ||||
@@ -21,7 +21,7 @@ | |||||
Control_Point::Control_Point ( Sequence *t, nframes_t when, float y ) | Control_Point::Control_Point ( Sequence *t, nframes_t when, float y ) | ||||
{ | { | ||||
_track = t; | |||||
_sequence = t; | |||||
_y = y; | _y = y; | ||||
_r->offset = when; | _r->offset = when; | ||||
_box_color = FL_WHITE; | _box_color = FL_WHITE; | ||||
@@ -87,12 +87,12 @@ Control_Point::handle ( int m ) | |||||
{ | { | ||||
case FL_RELEASE: | case FL_RELEASE: | ||||
_track->sort(); | |||||
sequence()->sort(); | |||||
redraw(); | redraw(); | ||||
break; | break; | ||||
case FL_DRAG: | case FL_DRAG: | ||||
{ | { | ||||
track()->sort(); | |||||
sequence()->sort(); | |||||
if ( selected() ) | if ( selected() ) | ||||
break; | break; | ||||
@@ -121,7 +121,7 @@ Sequence::draw ( void ) | |||||
fl_clip_box( x(), y(), w(), h(), X, Y, W, H ); | fl_clip_box( x(), y(), w(), h(), X, Y, W, H ); | ||||
if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->track() == this ) | |||||
if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->sequence() == this ) | |||||
{ | { | ||||
/* make sure the Sequence_Widget::pushed widget is above all others */ | /* make sure the Sequence_Widget::pushed widget is above all others */ | ||||
remove( Sequence_Widget::pushed() ); | remove( Sequence_Widget::pushed() ); | ||||
@@ -198,14 +198,14 @@ Sequence::add ( Sequence_Widget *r ) | |||||
{ | { | ||||
// Logger _log( this ); | // Logger _log( this ); | ||||
if ( r->track() ) | |||||
if ( r->sequence() ) | |||||
{ | { | ||||
r->redraw(); | r->redraw(); | ||||
r->track()->remove( r ); | |||||
r->sequence()->remove( r ); | |||||
// r->track()->redraw(); | // r->track()->redraw(); | ||||
} | } | ||||
r->track( this ); | |||||
r->sequence( this ); | |||||
_widgets.push_back( r ); | _widgets.push_back( r ); | ||||
sort(); | sort(); | ||||
@@ -254,7 +254,7 @@ Sequence::snap ( Sequence_Widget *r ) | |||||
if ( timeline->nearest_line( r->offset(), &f ) ) | if ( timeline->nearest_line( r->offset(), &f ) ) | ||||
{ | { | ||||
printf( "snap frame is %lu\n", f ); | |||||
// printf( "snap frame is %lu\n", f ); | |||||
r->offset( f ); | r->offset( f ); | ||||
} | } | ||||
} | } | ||||
@@ -276,7 +276,7 @@ Sequence::handle ( int m ) | |||||
if ( Sequence_Widget::pushed() ) | if ( Sequence_Widget::pushed() ) | ||||
{ | { | ||||
if ( Sequence_Widget::pushed()->track()->class_name() == class_name() ) | |||||
if ( Sequence_Widget::pushed()->sequence()->class_name() == class_name() ) | |||||
{ | { | ||||
/* accept objects dragged from other sequences of this type */ | /* accept objects dragged from other sequences of this type */ | ||||
add( Sequence_Widget::pushed() ); | add( Sequence_Widget::pushed() ); | ||||
@@ -23,7 +23,7 @@ void | |||||
Sequence_Point::get ( Log_Entry &e ) const | Sequence_Point::get ( Log_Entry &e ) const | ||||
{ | { | ||||
e.add( ":x", _r->offset ); | e.add( ":x", _r->offset ); | ||||
e.add( ":t", _track ); | |||||
e.add( ":t", _sequence ); | |||||
} | } | ||||
void | void | ||||
@@ -39,7 +39,7 @@ Sequence_Point::set ( Log_Entry &e ) | |||||
if ( ! strcmp( ":x", s ) ) | if ( ! strcmp( ":x", s ) ) | ||||
{ | { | ||||
_track->sort(); | |||||
sequence()->sort(); | |||||
} | } | ||||
} | } | ||||
@@ -52,8 +52,8 @@ public: | |||||
{ | { | ||||
const int x = Sequence_Widget::x(); | const int x = Sequence_Widget::x(); | ||||
if ( x >= _track->x() + _track->w() ) | |||||
return _track->x() + _track->w() + abs_w(); | |||||
if ( x >= sequence()->x() + sequence()->w() ) | |||||
return sequence()->x() + sequence()->w() + abs_w(); | |||||
else | else | ||||
return x; | return x; | ||||
@@ -36,7 +36,7 @@ void | |||||
Sequence_Region::trim ( enum trim_e t, int X ) | Sequence_Region::trim ( enum trim_e t, int X ) | ||||
{ | { | ||||
X -= _track->x(); | |||||
X -= sequence()->x(); | |||||
redraw(); | redraw(); | ||||
switch ( t ) | switch ( t ) | ||||
@@ -151,7 +151,7 @@ Sequence_Widget::handle ( int m ) | |||||
fl_cursor( FL_CURSOR_HAND ); | fl_cursor( FL_CURSOR_HAND ); | ||||
return 1; | return 1; | ||||
case FL_LEAVE: | case FL_LEAVE: | ||||
fl_cursor( _track->cursor() ); | |||||
fl_cursor( sequence()->cursor() ); | |||||
return 1; | return 1; | ||||
case FL_PUSH: | case FL_PUSH: | ||||
{ | { | ||||
@@ -160,7 +160,7 @@ Sequence_Widget::handle ( int m ) | |||||
Fl::event_button3() ) | Fl::event_button3() ) | ||||
{ | { | ||||
redraw(); | redraw(); | ||||
_track->queue_delete( this ); | |||||
sequence()->queue_delete( this ); | |||||
return 1; | return 1; | ||||
} | } | ||||
else | else | ||||
@@ -199,15 +199,15 @@ Sequence_Widget::handle ( int m ) | |||||
_r->offset = of - _drag->offset; | _r->offset = of - _drag->offset; | ||||
if ( Sequence_Widget::_current == this ) | if ( Sequence_Widget::_current == this ) | ||||
_track->snap( this ); | |||||
sequence()->snap( this ); | |||||
} | } | ||||
else | else | ||||
_r->offset = 0; | _r->offset = 0; | ||||
} | } | ||||
if ( X >= _track->x() + _track->w() || | |||||
X <= _track->x() ) | |||||
if ( X >= sequence()->x() + sequence()->w() || | |||||
X <= sequence()->x() ) | |||||
{ | { | ||||
/* this drag needs to scroll */ | /* this drag needs to scroll */ | ||||
@@ -215,7 +215,7 @@ Sequence_Widget::handle ( int m ) | |||||
nframes_t d = timeline->x_to_ts( 100 ); | nframes_t d = timeline->x_to_ts( 100 ); | ||||
if ( X <= _track->x() ) | |||||
if ( X <= sequence()->x() ) | |||||
{ | { | ||||
if ( pos > d ) | if ( pos > d ) | ||||
@@ -229,7 +229,7 @@ Sequence_Widget::handle ( int m ) | |||||
timeline->xposition( timeline->ts_to_x( pos ) ); | timeline->xposition( timeline->ts_to_x( pos ) ); | ||||
/* FIXME: why isn't this enough? */ | /* FIXME: why isn't this enough? */ | ||||
// _track->redraw(); | |||||
// sequence()->redraw(); | |||||
timeline->redraw(); | timeline->redraw(); | ||||
} | } | ||||
@@ -69,7 +69,7 @@ class Sequence_Widget : public Loggable | |||||
protected: | protected: | ||||
Sequence *_track; /* track this region belongs to */ | |||||
Sequence *_sequence; /* track this region belongs to */ | |||||
Range _range; /* range for playback */ | Range _range; /* range for playback */ | ||||
Range *_r; /* range for editing / display (points to the same thing as above, except for when dragging etc) */ | Range *_r; /* range for editing / display (points to the same thing as above, except for when dragging etc) */ | ||||
@@ -85,7 +85,7 @@ protected: | |||||
e.add( ":x", _r->offset ); | e.add( ":x", _r->offset ); | ||||
e.add( ":l", _r->start ); | e.add( ":l", _r->start ); | ||||
e.add( ":r", _r->end ); | e.add( ":r", _r->end ); | ||||
e.add( ":sequence", _track ); | |||||
e.add( ":sequence", _sequence ); | |||||
e.add( ":selected", selected() ); | e.add( ":selected", selected() ); | ||||
} | } | ||||
@@ -125,8 +125,8 @@ protected: | |||||
// e.erase( i ); | // e.erase( i ); | ||||
} | } | ||||
if ( _track ) | |||||
_track->redraw(); | |||||
if ( _sequence ) | |||||
_sequence->redraw(); | |||||
} | } | ||||
@@ -134,7 +134,7 @@ public: | |||||
Sequence_Widget ( ) | Sequence_Widget ( ) | ||||
{ | { | ||||
_track = NULL; | |||||
_sequence = NULL; | |||||
_r = &_range; | _r = &_range; | ||||
@@ -150,7 +150,7 @@ public: | |||||
{ | { | ||||
redraw(); | redraw(); | ||||
_track->remove( this ); | |||||
_sequence->remove( this ); | |||||
_selection.remove( this ); | _selection.remove( this ); | ||||
} | } | ||||
@@ -163,7 +163,7 @@ public: | |||||
_r = &_range; | _r = &_range; | ||||
_range = rhs._range; | _range = rhs._range; | ||||
_track = rhs._track; | |||||
_sequence = rhs._sequence; | |||||
_box_color = rhs._box_color; | _box_color = rhs._box_color; | ||||
_color = rhs._color; | _color = rhs._color; | ||||
@@ -273,24 +273,24 @@ public: | |||||
int dispatch ( int m ); | int dispatch ( int m ); | ||||
Fl_Widget * parent ( void ) const { return _track; } | |||||
Fl_Widget * parent ( void ) const { return _sequence; } | |||||
int scroll_x ( void ) const { return timeline->ts_to_x( timeline->xoffset ); } | int scroll_x ( void ) const { return timeline->ts_to_x( timeline->xoffset ); } | ||||
nframes_t scroll_ts ( void ) const { return timeline->xoffset; } | nframes_t scroll_ts ( void ) const { return timeline->xoffset; } | ||||
virtual int y ( void ) const { return _track->y(); } | |||||
virtual int h ( void ) const { return _track->h(); } | |||||
virtual int y ( void ) const { return _sequence->y(); } | |||||
virtual int h ( void ) const { return _sequence->h(); } | |||||
/* used by regions */ | /* used by regions */ | ||||
virtual int x ( void ) const | virtual int x ( void ) const | ||||
{ | { | ||||
return _r->offset < timeline->xoffset ? _track->x() : min( _track->x() + _track->w(), _track->x() + timeline->ts_to_x( _r->offset - timeline->xoffset ) ); | |||||
return _r->offset < timeline->xoffset ? _sequence->x() : min( _sequence->x() + _sequence->w(), _sequence->x() + timeline->ts_to_x( _r->offset - timeline->xoffset ) ); | |||||
} | } | ||||
/* use this as x() when you need to draw lines between widgets */ | /* use this as x() when you need to draw lines between widgets */ | ||||
int line_x ( void ) const | int line_x ( void ) const | ||||
{ | { | ||||
return _r->offset < timeline->xoffset ? max( -32768, _track->x() - timeline->ts_to_x( timeline->xoffset - _r->offset )) : min( 32767, _track->x() + timeline->ts_to_x( _r->offset - timeline->xoffset ) ); | |||||
return _r->offset < timeline->xoffset ? max( -32768, _sequence->x() - timeline->ts_to_x( timeline->xoffset - _r->offset )) : min( 32767, _sequence->x() + timeline->ts_to_x( _r->offset - timeline->xoffset ) ); | |||||
} | } | ||||
virtual int w ( void ) const | virtual int w ( void ) const | ||||
@@ -303,7 +303,7 @@ public: | |||||
else | else | ||||
rw = abs_w(); | rw = abs_w(); | ||||
return min( rw, _track->w() ); | |||||
return min( rw, _sequence->w() ); | |||||
} | } | ||||
int abs_x ( void ) const { return timeline->ts_to_x( _r->offset ); } | int abs_x ( void ) const { return timeline->ts_to_x( _r->offset ); } | ||||
@@ -315,8 +315,8 @@ public: | |||||
virtual Fl_Color selection_color ( void ) const { return _selection_color; } | virtual Fl_Color selection_color ( void ) const { return _selection_color; } | ||||
virtual void selection_color ( Fl_Color v ) { _selection_color = v; } | virtual void selection_color ( Fl_Color v ) { _selection_color = v; } | ||||
Sequence * track ( void ) const { return _track; } | |||||
void track ( Sequence *t ) { _track = t; } | |||||
Sequence * sequence ( void ) const { return _sequence; } | |||||
void sequence ( Sequence *t ) { _sequence = t; } | |||||
nframes_t offset ( void ) const { return _r->offset; } | nframes_t offset ( void ) const { return _r->offset; } | ||||
// void offset ( nframes_t o ) { _r->offset = o; } | // void offset ( nframes_t o ) { _r->offset = o; } | ||||
@@ -329,10 +329,10 @@ public: | |||||
/** convert a screen x coord into an offset into the region */ | /** convert a screen x coord into an offset into the region */ | ||||
nframes_t x_to_offset ( int X ) | nframes_t x_to_offset ( int X ) | ||||
{ | { | ||||
return timeline->x_to_ts( scroll_x() + ( X - _track->x() ) ) - _r->offset; | |||||
return timeline->x_to_ts( scroll_x() + ( X - _sequence->x() ) ) - _r->offset; | |||||
} | } | ||||
int active_r ( void ) const { return _track->active_r(); } | |||||
int active_r ( void ) const { return _sequence->active_r(); } | |||||
virtual nframes_t length ( void ) const { return _r->end - _r->start; } | virtual nframes_t length ( void ) const { return _r->end - _r->start; } | ||||
virtual Fl_Boxtype box ( void ) const { return FL_UP_BOX; } | virtual Fl_Boxtype box ( void ) const { return FL_UP_BOX; } | ||||
@@ -344,10 +344,10 @@ public: | |||||
if ( ! (align() & FL_ALIGN_INSIDE) ) | if ( ! (align() & FL_ALIGN_INSIDE) ) | ||||
{ | { | ||||
// FIXME: to better.. | // FIXME: to better.. | ||||
_track->redraw(); | |||||
_sequence->redraw(); | |||||
} | } | ||||
else | else | ||||
_track->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() ); | |||||
_sequence->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() ); | |||||
} | } | ||||
/* just draw a simple box */ | /* just draw a simple box */ | ||||
@@ -87,7 +87,7 @@ Tempo_Point::handle ( int m ) | |||||
if ( m == FL_RELEASE ) | if ( m == FL_RELEASE ) | ||||
{ | { | ||||
_track->sort(); | |||||
sequence()->sort(); | |||||
timeline->redraw(); | timeline->redraw(); | ||||
} | } | ||||
return r; | return r; | ||||