Make region duplication work again.
This commit is contained in:
parent
edb9be37ab
commit
9bf7183696
|
@ -304,11 +304,6 @@ Audio_Region::handle ( int m )
|
|||
redraw();
|
||||
return 1;
|
||||
}
|
||||
else if ( Fl::event_button1() && Fl::event_ctrl() )
|
||||
{
|
||||
/* duplication */
|
||||
return 1;
|
||||
}
|
||||
else if ( Fl::test_shortcut( FL_BUTTON3 ) && ! Fl::event_shift() )
|
||||
{
|
||||
/* context menu */
|
||||
|
@ -350,13 +345,13 @@ Audio_Region::handle ( int m )
|
|||
return 0;
|
||||
}
|
||||
else
|
||||
return Sequence_Widget::handle( m );
|
||||
return Sequence_Region::handle( m );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FL_RELEASE:
|
||||
{
|
||||
Sequence_Widget::handle( m );
|
||||
Sequence_Region::handle( m );
|
||||
|
||||
copied = false;
|
||||
|
||||
|
@ -369,38 +364,28 @@ Audio_Region::handle ( int m )
|
|||
begin_drag( Drag( x() - X, y() - Y, x_to_offset( X ) ) );
|
||||
_log.hold();
|
||||
}
|
||||
|
||||
/* panning */
|
||||
if ( Fl::event_state() & FL_SHIFT &&
|
||||
Fl::event_state() & FL_CTRL )
|
||||
if ( Fl::event_button1() )
|
||||
{
|
||||
int d = (ox + X) - x();
|
||||
long td = timeline->x_to_ts( d );
|
||||
|
||||
if ( td > 0 && os < (nframes_t)td )
|
||||
_r->offset = 0;
|
||||
else
|
||||
_r->offset = os - td;
|
||||
|
||||
sequence()->redraw();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* duplication */
|
||||
if ( Fl::event_state() & FL_CTRL )
|
||||
{
|
||||
if ( _drag->state == 0 )
|
||||
if ( Fl::event_state() & ( FL_SHIFT | FL_CTRL ) )
|
||||
{
|
||||
sequence()->add( new Audio_Region( *this ) );
|
||||
_drag->state = 1;
|
||||
/* panning */
|
||||
int d = (ox + X) - x();
|
||||
long td = timeline->x_to_ts( d );
|
||||
|
||||
if ( td > 0 && os < (nframes_t)td )
|
||||
_r->offset = 0;
|
||||
else
|
||||
_r->offset = os - td;
|
||||
|
||||
sequence()->redraw();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
ret = Sequence_Widget::handle( m );
|
||||
ret = Sequence_Region::handle( m );
|
||||
return ret | 1;
|
||||
default:
|
||||
return Sequence_Widget::handle( m );
|
||||
return Sequence_Region::handle( m );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,23 @@ private:
|
|||
|
||||
static bool snapshot( FILE * fp );
|
||||
|
||||
void init ( bool loggable=true )
|
||||
{
|
||||
if ( loggable )
|
||||
{
|
||||
_id = ++_log_id;
|
||||
_old_state = NULL;
|
||||
_nest = 0;
|
||||
|
||||
ensure_size( _id );
|
||||
|
||||
_loggables[ _id - 1 ] = this;
|
||||
}
|
||||
else
|
||||
_id = 0;
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
static const char *escape ( const char *s );
|
||||
|
@ -176,19 +193,7 @@ public:
|
|||
|
||||
Loggable ( bool loggable=true )
|
||||
{
|
||||
if ( loggable )
|
||||
{
|
||||
_id = ++_log_id;
|
||||
_old_state = NULL;
|
||||
_nest = 0;
|
||||
|
||||
ensure_size( _id );
|
||||
|
||||
_loggables[ _id - 1 ] = this;
|
||||
}
|
||||
else
|
||||
_id = 0;
|
||||
|
||||
init( loggable );
|
||||
}
|
||||
|
||||
void update_id ( int id );
|
||||
|
@ -226,8 +231,9 @@ protected:
|
|||
/* leaf subclasses *must* call log_create() at the end of their copy contructors */
|
||||
Loggable ( const Loggable &rhs )
|
||||
{
|
||||
init( true );
|
||||
/* FIXME: get a real id here!!! */
|
||||
_id = 0;
|
||||
// _id = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -215,22 +215,36 @@ Sequence_Region::handle ( int m )
|
|||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
/* track jumping */
|
||||
if ( ! selected() )
|
||||
else if ( Fl::event_button1() )
|
||||
{
|
||||
if ( Y > y() + h() || Y < y() )
|
||||
if ( Fl::event_state() & FL_CTRL )
|
||||
{
|
||||
printf( "wants to jump tracks\n" );
|
||||
/* duplication */
|
||||
if ( _drag->state == 0 )
|
||||
{
|
||||
// sequence()->add( new Audio_Region( *this ) );
|
||||
sequence()->add( this->clone() );
|
||||
|
||||
Track *t = timeline->track_under( Y );
|
||||
_drag->state = 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if ( ! selected() )
|
||||
{
|
||||
/* track jumping */
|
||||
if ( Y > y() + h() || Y < y() )
|
||||
{
|
||||
printf( "wants to jump tracks\n" );
|
||||
|
||||
fl_cursor( (Fl_Cursor)1 );
|
||||
Track *t = timeline->track_under( Y );
|
||||
|
||||
if ( t )
|
||||
t->handle( FL_ENTER );
|
||||
fl_cursor( (Fl_Cursor)1 );
|
||||
|
||||
return 0;
|
||||
if ( t )
|
||||
t->handle( FL_ENTER );
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue