diff --git a/Audio_Track.C b/Audio_Track.C index 3c1cee9..055ce22 100644 --- a/Audio_Track.C +++ b/Audio_Track.C @@ -55,18 +55,24 @@ Audio_Track::handle ( int m ) { switch ( m ) { - case FL_DND_DRAG: - case FL_DND_ENTER: - case FL_ENTER: -// dump(); - return 1; - case FL_DND_LEAVE: + + case FL_DND_DRAG: + return Track::handle( m ) | 1; + +/* case FL_DND_ENTER: */ +/* case FL_DND_LEAVE: */ + case FL_DND_RELEASE: return 1; + case FL_PASTE: { const char *text = Fl::event_text(); + + if ( ! strcmp( text, "Region" ) ) + return 0; + char *file; if ( ! sscanf( text, "file://%a[^\r\n]\n", &file ) ) diff --git a/Audio_Track.H b/Audio_Track.H index de2b7a0..fdc8e39 100644 --- a/Audio_Track.H +++ b/Audio_Track.H @@ -33,6 +33,8 @@ public: { } + const char *class_name ( void ) { return "Audio_Track"; } + int handle ( int m ); void dump ( void ); void remove_selected ( void ); diff --git a/Control_Track.H b/Control_Track.H index 6f01f02..4543054 100644 --- a/Control_Track.H +++ b/Control_Track.H @@ -27,11 +27,14 @@ class Control_Track : public Track public: + Control_Track ( int X, int Y, int W, int H ) : Track( X, Y, W, H ) { color( fl_darker( FL_GREEN ) ); } + const char *class_name ( void ) { return "Control_Track"; } + void draw ( void ) { diff --git a/Region.C b/Region.C index 39b6bee..eb37a5a 100644 --- a/Region.C +++ b/Region.C @@ -380,16 +380,14 @@ Region::handle ( int m ) { if ( Y > y() + h() ) { - if ( _track->next() ) - if ( Y > _track->next()->y() ) - _track->next()->add( this ); + Fl::copy( class_name(), strlen( class_name() ), 0 ); + Fl::dnd(); } else if ( Y < y() ) { - if ( _track->prev() ) - if ( Y < _track->prev()->y() + _track->prev()->h() ) - _track->prev()->add( this ); + Fl::copy( class_name(), strlen( class_name() ), 0 ); + Fl::dnd(); } } diff --git a/Timeline.C b/Timeline.C index 4fbd583..95e5154 100644 --- a/Timeline.C +++ b/Timeline.C @@ -151,17 +151,11 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi o->type( Fl_Pack::VERTICAL ); o->spacing( 0 ); - Track *l = NULL; for ( int i = 8; i--; ) { // Track_Header *t = new Track_Header( 0, 0, W, 75 ); Track_Header *t = new Track_Header( 0, 0, W, 30 ); Track *o = new Audio_Track( 0, 0, 1, 100 ); - o->prev( l ); - if ( l ) - l->next( o ); - l = o; -// o->end(); t->track( o ); t->add( new Audio_Track( 0, 0, 1, 100 ) ); diff --git a/Track.C b/Track.C index d36484c..c8f3d02 100644 --- a/Track.C +++ b/Track.C @@ -26,6 +26,7 @@ queue Track::_delete_queue; +Track_Widget *Track::pushed = NULL; void Track::sort ( void ) @@ -240,17 +241,23 @@ done: int Track::handle ( int m ) { - static Track_Widget *pushed; +// static Track_Widget *pushed; static Track_Widget *belowmouse; switch ( m ) { - case FL_ENTER: - case FL_LEAVE: + case FL_DND_ENTER: + printf( "enter\n" ); + if ( pushed && pushed->track()->class_name() == class_name() ) + { + printf( "%s -> %s\n", pushed->track()->class_name(), class_name() ); + add( pushed ); + redraw(); + } + case FL_DND_LEAVE: return 1; case FL_MOVE: { - /* these aren't used, so don't bother doing lookups for them */ Track_Widget *r = event_widget(); if ( r != belowmouse ) @@ -263,7 +270,7 @@ Track::handle ( int m ) r->handle( FL_ENTER ); } - return 1; + return 0; } default: { diff --git a/Track.H b/Track.H index 12fc30e..2fa6cdb 100644 --- a/Track.H +++ b/Track.H @@ -38,18 +38,18 @@ class Track_Widget; class Track : public Fl_Group, public Loggable { - Track *_next; - Track *_prev; + char *_name; static queue _delete_queue; + static Track_Widget *pushed; protected: list _widgets; Track_Widget *event_widget ( void ); - const char *class_name ( void ) { return "Track"; } + virtual const char *class_name ( void ) { return "Track"; } void set ( char ** ) { return; } @@ -83,7 +83,6 @@ public: Track ( int X, int Y, int W, int H ) : Fl_Group( X, Y, W, H ) { - _next = _prev = NULL; _name = NULL; box( FL_DOWN_BOX ); @@ -102,11 +101,6 @@ public: log_destroy(); } - Track *next ( void ) const { return _next; } - Track *prev ( void ) const { return _prev; } - void prev ( Track *t ) { _prev = t; } - void next ( Track *t ) { _next = t; } - const char * name ( void ) const { return _name; } void name ( char *s ) { if ( _name ) free( _name ); _name = s; } diff --git a/Track_Widget.C b/Track_Widget.C index 8434ab1..e05d01f 100644 --- a/Track_Widget.C +++ b/Track_Widget.C @@ -169,6 +169,7 @@ Track_Widget::handle ( int m ) return 1; case FL_DRAG: + case FL_DND_DRAG: { if ( ! _drag ) {