Browse Source

Quit using FLTK's weird DND system for inter-track drags.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
821a3feedc
5 changed files with 45 additions and 29 deletions
  1. +0
    -11
      Timeline/Audio_Sequence.C
  2. +12
    -10
      Timeline/Region.C
  3. +16
    -8
      Timeline/Sequence.C
  4. +16
    -0
      Timeline/Timeline.C
  5. +1
    -0
      Timeline/Timeline.H

+ 0
- 11
Timeline/Audio_Sequence.C View File

@@ -142,21 +142,10 @@ Audio_Sequence::handle ( int m )
{
switch ( m )
{

case FL_DND_DRAG:
return Sequence::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 1;



+ 12
- 10
Timeline/Region.C View File

@@ -407,7 +407,6 @@ Region::handle ( int m )
break;
}
case FL_RELEASE:

{
Sequence_Widget::handle( m );

@@ -466,20 +465,23 @@ Region::handle ( int m )
}
}


/* track jumping */
if ( ! selected() )
{
if ( Y > y() + h() )
if ( Y > y() + h() || Y < y() )
{
Fl::copy( class_name(), strlen( class_name() ), 0 );
Fl::dnd();
printf( "wants to jump tracks\n" );

Track *t = timeline->track_under( Y );

fl_cursor( (Fl_Cursor)1 );

if ( t )
t->handle( FL_ENTER );

return 0;
}
else
if ( Y < y() )
{
Fl::copy( class_name(), strlen( class_name() ), 0 );
Fl::dnd();
}
}

ret = Sequence_Widget::handle( m );


+ 16
- 8
Timeline/Sequence.C View File

@@ -255,20 +255,28 @@ Sequence::handle ( int m )
switch ( m )
{
case FL_FOCUS:
return 1;
case FL_UNFOCUS:
return 1;
case FL_ENTER:
case FL_LEAVE:
case FL_DND_DRAG:
return 1;
case FL_DND_ENTER:
printf( "enter\n" );
if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->track()->class_name() == class_name() )
case FL_ENTER:
if ( Sequence_Widget::pushed() )
{
add( Sequence_Widget::pushed() );
redraw();

if ( Sequence_Widget::pushed()->track()->class_name() == class_name() )
{
/* accept objects dragged from other sequences of this type */
add( Sequence_Widget::pushed() );
redraw();

fl_cursor( FL_CURSOR_MOVE );
}
else
fl_cursor( (Fl_Cursor)1 );
}
case FL_DND_ENTER:
case FL_DND_LEAVE:
case FL_DND_RELEASE:
return 1;
case FL_MOVE:
{


+ 16
- 0
Timeline/Timeline.C View File

@@ -854,6 +854,22 @@ Timeline::select_none ( void )
Sequence_Widget::select_none();
}


/** An unfortunate necessity for implementing our own DND aside from
* the (bogus) native FLTK system */
Track *
Timeline::track_under ( int Y )
{
for ( int i = tracks->children(); i-- ; )
{
Track *t = (Track*)tracks->child( i );

if ( ! ( t->y() > Y || t->y() + t->h() < Y ) )
return t;
}
}


int
Timeline::handle ( int m )
{


+ 1
- 0
Timeline/Timeline.H View File

@@ -160,6 +160,7 @@ public:
static void update_cb ( void *arg );

void select( const Rectangle &r );
Track * track_under ( int Y );


void delete_selected ( void );


Loading…
Cancel
Save