Timeline: Add more more keybindings, particularly of performing actions at the location of the playhead.

This commit is contained in:
Jonathan Moore Liles 2014-06-07 16:44:36 -07:00
parent 9790201fd8
commit 9d39699950
2 changed files with 47 additions and 6 deletions

View File

@ -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 },
};

View File

@ -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 <Sequence_Widget*>::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() )