@@ -124,6 +124,17 @@ public: | |||
log_create(); | |||
} | |||
Control_Point ( const Control_Point &rhs ) | |||
{ | |||
_offset = rhs._offset; | |||
_y = rhs._y; | |||
} | |||
Track_Widget *clone ( const Track_Widget *r ) | |||
{ | |||
return new Control_Point( *(Control_Point*)r ); | |||
} | |||
~Control_Point ( ) | |||
{ | |||
// if ( _label ) delete[] _label; | |||
@@ -107,6 +107,12 @@ Region::Region ( const Region & rhs ) | |||
log_create(); | |||
} | |||
Track_Widget * | |||
Region::clone ( const Track_Widget *r ) | |||
{ | |||
return new Region( *(Region*)r ); | |||
} | |||
/* */ | |||
Region::Region ( Audio_File *c ) | |||
{ | |||
@@ -171,7 +171,7 @@ class Region : public Region_Base | |||
init(); | |||
} | |||
bool current ( void ) const { return this == Track::belowmouse(); } | |||
bool current ( void ) const { return this == belowmouse(); } | |||
public: | |||
@@ -185,6 +185,9 @@ public: | |||
return (Loggable *)r; | |||
} | |||
Track_Widget *clone ( const Track_Widget *r ); | |||
~Region ( ) | |||
{ | |||
log_destroy(); | |||
@@ -123,6 +123,17 @@ public: | |||
log_create(); | |||
} | |||
Tempo_Point ( const Tempo_Point &rhs ) | |||
{ | |||
_offset = rhs._offset; | |||
_tempo = rhs._tempo; | |||
} | |||
Track_Widget *clone ( const Track_Widget *r ) | |||
{ | |||
return new Tempo_Point( *(Tempo_Point*)r ); | |||
} | |||
~Tempo_Point ( ) | |||
{ | |||
if ( _label ) delete[] _label; | |||
@@ -27,6 +27,12 @@ struct time_sig | |||
int beats_per_bar; | |||
int beat_type; | |||
time_sig ( ) | |||
{ | |||
beats_per_bar = 0; | |||
beat_type = 0; | |||
} | |||
time_sig ( int bpb, int note ) | |||
{ | |||
beats_per_bar = bpb; | |||
@@ -118,7 +124,6 @@ protected: | |||
} | |||
public: | |||
/* for loggable */ | |||
@@ -140,6 +145,17 @@ public: | |||
log_create(); | |||
} | |||
Time_Point ( const Time_Point &rhs ) | |||
{ | |||
_offset = rhs._offset; | |||
_time = rhs._time; | |||
} | |||
Track_Widget *clone ( const Track_Widget *r ) | |||
{ | |||
return new Time_Point( *(Time_Point*)r ); | |||
} | |||
~Time_Point ( ) | |||
{ | |||
if ( _label ) delete[] _label; | |||
@@ -26,8 +26,6 @@ | |||
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 ) | |||
{ | |||
@@ -87,11 +85,11 @@ Track::draw ( void ) | |||
fl_clip_box( x(), y(), w(), h(), X, Y, W, H ); | |||
if ( pushed() && pushed()->track() == this ) | |||
if ( Track_Widget::pushed() && Track_Widget::pushed()->track() == this ) | |||
{ | |||
/* make sure the pushed widget is above all others */ | |||
remove( pushed() ); | |||
add( pushed() ); | |||
/* make sure the Track_Widget::pushed widget is above all others */ | |||
remove( Track_Widget::pushed() ); | |||
add( Track_Widget::pushed() ); | |||
} | |||
int xfades = 0; | |||
@@ -338,9 +336,9 @@ Track::handle ( int m ) | |||
{ | |||
case FL_DND_ENTER: | |||
printf( "enter\n" ); | |||
if ( pushed() && pushed()->track()->class_name() == class_name() ) | |||
if ( Track_Widget::pushed() && Track_Widget::pushed()->track()->class_name() == class_name() ) | |||
{ | |||
add( pushed() ); | |||
add( Track_Widget::pushed() ); | |||
redraw(); | |||
} | |||
case FL_DND_LEAVE: | |||
@@ -349,11 +347,11 @@ Track::handle ( int m ) | |||
{ | |||
Track_Widget *r = event_widget(); | |||
if ( r != belowmouse() ) | |||
if ( r != Track_Widget::belowmouse() ) | |||
{ | |||
if ( belowmouse() ) | |||
belowmouse()->handle( FL_LEAVE ); | |||
_belowmouse = r; | |||
if ( Track_Widget::belowmouse() ) | |||
Track_Widget::belowmouse()->handle( FL_LEAVE ); | |||
Track_Widget::belowmouse( r ); | |||
if ( r ) | |||
r->handle( FL_ENTER ); | |||
@@ -363,17 +361,24 @@ Track::handle ( int m ) | |||
} | |||
default: | |||
{ | |||
Track_Widget *r = pushed() ? pushed() : event_widget(); | |||
Track_Widget *r = Track_Widget::pushed() ? Track_Widget::pushed() : event_widget(); | |||
if ( r ) | |||
{ | |||
int retval = r->dispatch( m ); | |||
if ( retval && m == FL_PUSH ) | |||
_pushed = r; | |||
{ | |||
Track_Widget::original( r ); | |||
Track_Widget::pushed( r->clone( r ) ); | |||
} | |||
if ( retval && m == FL_RELEASE ) | |||
_pushed = NULL; | |||
{ | |||
/* FIXME: copy here */ | |||
Track_Widget::pushed( NULL ); | |||
Track_Widget::original( NULL ); | |||
} | |||
Loggable::block_start(); | |||
@@ -384,12 +389,12 @@ Track::handle ( int m ) | |||
_delete_queue.pop(); | |||
if ( pushed() == t ) | |||
_pushed = NULL; | |||
if ( belowmouse() == t ) | |||
if ( Track_Widget::pushed() == t ) | |||
Track_Widget::pushed( NULL ); | |||
if ( Track_Widget::belowmouse() == t ) | |||
{ | |||
belowmouse()->handle( FL_LEAVE ); | |||
_belowmouse = NULL; | |||
Track_Widget::belowmouse()->handle( FL_LEAVE ); | |||
Track_Widget::belowmouse( NULL ); | |||
} | |||
delete t; | |||
@@ -46,8 +46,6 @@ class Track : public Fl_Widget, public Loggable | |||
char *_name; | |||
static queue <Track_Widget *> _delete_queue; | |||
static Track_Widget *_pushed; | |||
static Track_Widget *_belowmouse; | |||
protected: | |||
@@ -91,9 +89,6 @@ public: | |||
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; label( _name ); } | |||
@@ -17,10 +17,21 @@ | |||
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |||
/*******************************************************************************/ | |||
/* TODO: | |||
What if we solve the continuous-modification/sync issue by making a | |||
copy of the 'pushed' widget, and operating on that instead (hiding | |||
the original), then when the widget is released, copy its data into | |||
the original? | |||
*/ | |||
#include "Track_Widget.H" | |||
list <Track_Widget *> Track_Widget::_selection; | |||
Track_Widget * Track_Widget::_current; | |||
Track_Widget * Track_Widget::_current = NULL; | |||
Track_Widget * Track_Widget::_pushed = NULL; | |||
Track_Widget * Track_Widget::_original = NULL; | |||
Track_Widget * Track_Widget::_belowmouse = NULL; | |||
void | |||
Track_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color ) | |||
@@ -41,8 +41,15 @@ class Track_Widget : public Loggable | |||
{ | |||
static list <Track_Widget *> _selection; /* all the widgets making up the selection */ | |||
/* FIXME: is this not the same as /pushed/? */ | |||
static Track_Widget * _current; /* the widget initiating events that affect the selection */ | |||
/* these are actually managed in the Track classes */ | |||
static Track_Widget * _pushed; /* the widget receiving drag events (a copy) */ | |||
static Track_Widget * _original; /* the original of the /pushed/ widget */ | |||
static Track_Widget * _belowmouse; /* the widget below the mouse cursor */ | |||
protected: | |||
Track *_track; /* track this region belongs to */ | |||
@@ -77,6 +84,15 @@ public: | |||
_selection.remove( this ); | |||
} | |||
Track_Widget ( const Track_Widget &rhs ) | |||
{ | |||
_offset = rhs._offset; | |||
_track = rhs._track; | |||
} | |||
virtual Track_Widget *clone ( const Track_Widget *r ) = 0; | |||
bool selected ( void ) | |||
{ | |||
return ::find( _selection.begin(), _selection.end(), this ) != _selection.end(); | |||
@@ -107,7 +123,17 @@ public: | |||
delete _selection.front(); | |||
} | |||
static Track_Widget *current ( void ) { return _current; } | |||
static Track_Widget *current ( void ) { return Track_Widget::_current; } | |||
static Track_Widget *pushed ( void ) { return Track_Widget::_pushed; } | |||
static Track_Widget *original ( void ) { return Track_Widget::_original; } | |||
static Track_Widget *belowmouse ( void ) { return Track_Widget::_belowmouse; } | |||
static void pushed ( Track_Widget *w ) { Track_Widget::_pushed = w; } | |||
static void original ( Track_Widget *w ) { Track_Widget::_original = w; } | |||
static void belowmouse ( Track_Widget *w ) { Track_Widget::_belowmouse = w; } | |||
// static void pushed ( Track_Widget *w ) { Track_Widget::_pushed = w; } | |||
void | |||
offset ( nframes_t where ) | |||
@@ -49,7 +49,7 @@ | |||
#include "Loggable.H" | |||
#include "Track_Header.H" | |||
#include "const.h" | |||
// #include "const.h" | |||
Timeline *timeline; | |||