Make sequence jumping and duplication work for all sequence widgets.

This commit is contained in:
Jonathan Moore Liles 2008-05-26 22:49:27 -05:00
parent 424b1b9b8f
commit 622a4a68dc
2 changed files with 25 additions and 30 deletions

View File

@ -219,36 +219,6 @@ Sequence_Region::handle ( int m )
else
return 0;
}
else if ( Fl::event_button1() )
{
if ( Fl::event_state() & FL_CTRL )
{
/* duplication */
if ( _drag->state == 0 )
{
// sequence()->add( new Audio_Region( *this ) );
sequence()->add( this->clone() );
_drag->state = 1;
return 1;
}
}
else if ( test_press( FL_BUTTON1 ) && ! selected() )
{
/* track jumping */
if ( Y > y() + h() || Y < y() )
{
Track *t = timeline->track_under( Y );
fl_cursor( (Fl_Cursor)1 );
if ( t )
t->handle( FL_ENTER );
return 0;
}
}
}
return Sequence_Widget::handle( m );
}

View File

@ -20,6 +20,7 @@
#include <FL/fl_draw.H>
#include "Sequence_Widget.H"
#include "Track.H"
using namespace std;
@ -339,6 +340,14 @@ Sequence_Widget::handle ( int m )
_log.hold();
}
if ( test_press( FL_BUTTON1 + FL_CTRL ) && ! _drag->state )
{
/* duplication */
sequence()->add( this->clone() );
_drag->state = 1;
return 1;
}
else if ( test_press( FL_BUTTON1 ) || test_press( FL_BUTTON1 + FL_CTRL ) )
{
redraw();
@ -380,6 +389,22 @@ Sequence_Widget::handle ( int m )
timeline->redraw();
}
if ( ! selected() )
{
/* track jumping */
if ( Y > y() + h() || Y < y() )
{
Track *t = timeline->track_under( Y );
fl_cursor( (Fl_Cursor)1 );
if ( t )
t->handle( FL_ENTER );
return 0;
}
}
return 1;
}
else