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