Snap loop points and add menu action to clear them.

This commit is contained in:
Jonathan Moore Liles 2008-05-31 16:12:21 -05:00
parent 801c1c484c
commit 18800a97d9
1 changed files with 13 additions and 3 deletions

View File

@ -247,13 +247,22 @@ Audio_Region::menu_cb ( const Fl_Menu_ *m )
if ( offset > 0 )
_fade_out.length = offset;
}
else if ( ! strcmp( picked, "/Loop to mouse" ) )
else if ( ! strcmp( picked, "/Loop point to mouse" ) )
{
nframes_t offset = x_to_offset( Fl::event_x() );
if ( offset > 0 )
_loop = offset;
{
nframes_t f = offset + _r->start;
if ( timeline->nearest_line( &f ) )
_loop = f - _r->start;
else
_loop = offset;
}
}
else if ( ! strcmp( picked, "/Clear loop point" ) )
_loop = 0;
else
FATAL( "Unknown menu choice \"%s\"", picked );
@ -291,7 +300,8 @@ Audio_Region::menu ( void )
{ "Color", 0, 0, 0, inherit_track_color ? FL_MENU_INACTIVE : 0 },
{ "Fade in to mouse", FL_F + 3, 0, 0 },
{ "Fade out to mouse", FL_F + 4, 0, 0 },
{ "Loop to mouse", 'l', 0, 0 },
{ "Loop point to mouse", 'l', 0, 0 },
{ "Clear loop point", FL_SHIFT + 'l', 0, 0 },
{ 0 },
};