diff --git a/timeline/src/Audio_Region.C b/timeline/src/Audio_Region.C index 15968bd..5b103e0 100644 --- a/timeline/src/Audio_Region.C +++ b/timeline/src/Audio_Region.C @@ -296,6 +296,41 @@ Audio_Region::menu_cb ( const Fl_Menu_ *m ) _scale = 1.0; else if ( ! strcmp( picked, "/Range from" ) ) timeline->range( start(), length() ); + else if ( ! strcmp( picked, "/Trim left to playhead" ) ) + { + redraw(); + trim_left( transport->frame ); + } + else if ( ! strcmp( picked, "/Trim right to playhead" ) ) + { + redraw(); + trim_right( transport->frame ); + } + else if ( ! strcmp( picked, "/Split at playhead" ) ) + { + redraw(); + split( transport->frame ); + } + else if ( ! strcmp( picked, "/Loop point at playhead" ) ) + { + nframes_t f = transport->frame; + + _loop = f - _r->start; + } + else if ( ! strcmp( picked, "/Fade in to playhead" ) ) + { + nframes_t offset = transport->frame - _r->start; + + if ( offset < length() ) + _fade_in.length = offset; + } + else if ( ! strcmp( picked, "/Fade out to playhead" ) ) + { + nframes_t offset = _r->start + _r->length - transport->frame; + + if ( offset > 0 ) + _fade_out.length = offset; + } else if ( ! strcmp( picked, "/Remove" ) ) remove(); else @@ -333,16 +368,22 @@ Audio_Region::menu ( void ) { 0 }, { 0 }, { "Color", 0, 0, 0, inherit_track_color ? FL_MENU_INACTIVE : 0 }, + { "Crop to range", 'c', 0, 0, FL_MENU_DIVIDER }, { "Split at mouse", 's', 0, 0 }, - { "Crop to range", 'c', 0, 0 }, { "Gain with mouse vertical drag", 'g', 0, 0 }, { "Fade in to mouse", FL_F + 3, 0, 0 }, { "Fade out to mouse", FL_F + 4, 0, 0 }, { "Loop point to mouse", 'l', 0, 0 }, - { "Clear loop point", FL_SHIFT + 'l', 0, 0, 0 == _loop ? FL_MENU_INACTIVE : 0 }, + { "Clear loop point", 0, 0, 0, 0 == _loop ? FL_MENU_INACTIVE : 0 }, { "Normalize", 'n', 0, 0 }, { "Denormalize", FL_SHIFT + 'n', 0, 0, 1.0 == _scale ? FL_MENU_INACTIVE : 0 }, - { "Range from", FL_CTRL + 'r', 0, 0 }, + { "Range from", FL_CTRL + 'r', 0, 0, FL_MENU_DIVIDER }, + { "Trim left to playhead", '{', 0, 0 }, + { "Trim right to playhead", '}', 0, 0 }, + { "Split at playhead", FL_SHIFT + 's', 0, 0 }, + { "Loop point at playhead", FL_SHIFT + 'l', 0, 0 }, + { "Fade in to playhead", FL_F + 3 + FL_SHIFT, 0, 0 }, + { "Fade out to playhead", FL_F + 4 + FL_SHIFT, 0, 0 }, { "Remove", 0, 0, 0 }, { 0 }, }; diff --git a/timeline/src/Sequence.C b/timeline/src/Sequence.C index 28eaba2..fae4fa4 100644 --- a/timeline/src/Sequence.C +++ b/timeline/src/Sequence.C @@ -331,7 +331,7 @@ Sequence::handle ( int m ) case FL_SHORTCUT: if ( Fl::test_shortcut( FL_CTRL + FL_Right ) ) { - const Sequence_Widget *w = next( transport->frame + 1 ); + const Sequence_Widget *w = next( transport->frame ); if ( w ) transport->locate( w->start() ); @@ -564,8 +564,8 @@ const Sequence_Widget * Sequence::next ( nframes_t from ) const { for ( list ::const_iterator i = _widgets.begin(); i != _widgets.end(); i++ ) - if ( (*i)->start() >= from ) -// if ( (*i)->start() > from ) +// if ( (*i)->start() >= from ) + if ( (*i)->start() > from ) return *i; if ( _widgets.size() )