@@ -55,18 +55,24 @@ Audio_Track::handle ( int m ) | |||||
{ | { | ||||
switch ( 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: | case FL_DND_RELEASE: | ||||
return 1; | return 1; | ||||
case FL_PASTE: | case FL_PASTE: | ||||
{ | { | ||||
const char *text = Fl::event_text(); | const char *text = Fl::event_text(); | ||||
if ( ! strcmp( text, "Region" ) ) | |||||
return 0; | |||||
char *file; | char *file; | ||||
if ( ! sscanf( text, "file://%a[^\r\n]\n", &file ) ) | if ( ! sscanf( text, "file://%a[^\r\n]\n", &file ) ) | ||||
@@ -33,6 +33,8 @@ public: | |||||
{ | { | ||||
} | } | ||||
const char *class_name ( void ) { return "Audio_Track"; } | |||||
int handle ( int m ); | int handle ( int m ); | ||||
void dump ( void ); | void dump ( void ); | ||||
void remove_selected ( void ); | void remove_selected ( void ); | ||||
@@ -27,11 +27,14 @@ class Control_Track : public Track | |||||
public: | public: | ||||
Control_Track ( int X, int Y, int W, int H ) : Track( X, Y, W, H ) | Control_Track ( int X, int Y, int W, int H ) : Track( X, Y, W, H ) | ||||
{ | { | ||||
color( fl_darker( FL_GREEN ) ); | color( fl_darker( FL_GREEN ) ); | ||||
} | } | ||||
const char *class_name ( void ) { return "Control_Track"; } | |||||
void | void | ||||
draw ( void ) | draw ( void ) | ||||
{ | { | ||||
@@ -380,16 +380,14 @@ Region::handle ( int m ) | |||||
{ | { | ||||
if ( Y > y() + h() ) | 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 | else | ||||
if ( Y < y() ) | 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(); | |||||
} | } | ||||
} | } | ||||
@@ -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->type( Fl_Pack::VERTICAL ); | ||||
o->spacing( 0 ); | o->spacing( 0 ); | ||||
Track *l = NULL; | |||||
for ( int i = 8; i--; ) | for ( int i = 8; i--; ) | ||||
{ | { | ||||
// Track_Header *t = new Track_Header( 0, 0, W, 75 ); | // Track_Header *t = new Track_Header( 0, 0, W, 75 ); | ||||
Track_Header *t = new Track_Header( 0, 0, W, 30 ); | Track_Header *t = new Track_Header( 0, 0, W, 30 ); | ||||
Track *o = new Audio_Track( 0, 0, 1, 100 ); | 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->track( o ); | ||||
t->add( new Audio_Track( 0, 0, 1, 100 ) ); | t->add( new Audio_Track( 0, 0, 1, 100 ) ); | ||||
@@ -26,6 +26,7 @@ | |||||
queue <Track_Widget *> Track::_delete_queue; | queue <Track_Widget *> Track::_delete_queue; | ||||
Track_Widget *Track::pushed = NULL; | |||||
void | void | ||||
Track::sort ( void ) | Track::sort ( void ) | ||||
@@ -240,17 +241,23 @@ done: | |||||
int | int | ||||
Track::handle ( int m ) | Track::handle ( int m ) | ||||
{ | { | ||||
static Track_Widget *pushed; | |||||
// static Track_Widget *pushed; | |||||
static Track_Widget *belowmouse; | static Track_Widget *belowmouse; | ||||
switch ( m ) | 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; | return 1; | ||||
case FL_MOVE: | case FL_MOVE: | ||||
{ | { | ||||
/* these aren't used, so don't bother doing lookups for them */ | |||||
Track_Widget *r = event_widget(); | Track_Widget *r = event_widget(); | ||||
if ( r != belowmouse ) | if ( r != belowmouse ) | ||||
@@ -263,7 +270,7 @@ Track::handle ( int m ) | |||||
r->handle( FL_ENTER ); | r->handle( FL_ENTER ); | ||||
} | } | ||||
return 1; | |||||
return 0; | |||||
} | } | ||||
default: | default: | ||||
{ | { | ||||
@@ -38,18 +38,18 @@ class Track_Widget; | |||||
class Track : public Fl_Group, public Loggable | class Track : public Fl_Group, public Loggable | ||||
{ | { | ||||
Track *_next; | |||||
Track *_prev; | |||||
char *_name; | char *_name; | ||||
static queue <Track_Widget *> _delete_queue; | static queue <Track_Widget *> _delete_queue; | ||||
static Track_Widget *pushed; | |||||
protected: | protected: | ||||
list <Track_Widget *> _widgets; | list <Track_Widget *> _widgets; | ||||
Track_Widget *event_widget ( void ); | Track_Widget *event_widget ( void ); | ||||
const char *class_name ( void ) { return "Track"; } | |||||
virtual const char *class_name ( void ) { return "Track"; } | |||||
void set ( char ** ) { return; } | void set ( char ** ) { return; } | ||||
@@ -83,7 +83,6 @@ public: | |||||
Track ( int X, int Y, int W, int H ) : Fl_Group( X, Y, W, H ) | Track ( int X, int Y, int W, int H ) : Fl_Group( X, Y, W, H ) | ||||
{ | { | ||||
_next = _prev = NULL; | |||||
_name = NULL; | _name = NULL; | ||||
box( FL_DOWN_BOX ); | box( FL_DOWN_BOX ); | ||||
@@ -102,11 +101,6 @@ public: | |||||
log_destroy(); | 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; } | 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; } | ||||
@@ -169,6 +169,7 @@ Track_Widget::handle ( int m ) | |||||
return 1; | return 1; | ||||
case FL_DRAG: | case FL_DRAG: | ||||
case FL_DND_DRAG: | |||||
{ | { | ||||
if ( ! _drag ) | if ( ! _drag ) | ||||
{ | { | ||||