Move more timeline keybindings into menu.

This commit is contained in:
Jonathan Moore Liles 2008-05-25 01:18:30 -05:00
parent 06a0518463
commit 26b9f2cf6b
1 changed files with 36 additions and 38 deletions

View File

@ -195,6 +195,39 @@ Timeline::menu_cb ( Fl_Widget *w )
p2 = p1; p2 = p1;
} }
} }
else if ( ! strcmp( picked, "Playhead to mouse" ) )
{
int X = Fl::event_x() - Track::width();
if ( X > 0 )
{
transport->locate( xoffset + x_to_ts( X ) );
}
}
else if ( ! strcmp( picked, "P1 to mouse" ) )
{
int X = Fl::event_x() - Track::width();
if ( X > 0 )
{
p1 = xoffset + x_to_ts( X );
}
/* FIXME: only needs to damage the location of the old cursor! */
redraw();
}
else if ( ! strcmp( picked, "P2 to mouse" ) )
{
int X = Fl::event_x() - Track::width();
if ( X > 0 )
{
p2 = xoffset + x_to_ts( X );
}
/* FIXME: only needs to damage the location of the old cursor! */
redraw();
}
else else
WARNING( "programming error: Unknown menu item" ); WARNING( "programming error: Unknown menu item" );
} }
@ -219,6 +252,9 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
menu->add( "Add Audio Track", 'a', &Timeline::menu_cb, this ); menu->add( "Add Audio Track", 'a', &Timeline::menu_cb, this );
menu->add( "Tempo from range", 't', &Timeline::menu_cb, this ); menu->add( "Tempo from range", 't', &Timeline::menu_cb, this );
menu->add( "Playhead to mouse", 'p', &Timeline::menu_cb, this );
menu->add( "P1 to mouse", '[', &Timeline::menu_cb, this );
menu->add( "P2 to mouse", ']', &Timeline::menu_cb, this );
{ {
Scalebar *o = new Scalebar( X, Y + H - 18, W - 18, 18 ); Scalebar *o = new Scalebar( X, Y + H - 18, W - 18, 18 );
@ -951,44 +987,6 @@ Timeline::handle ( int m )
case FL_End: case FL_End:
/* keep scrollbar from eating these. */ /* keep scrollbar from eating these. */
return 0; return 0;
case 'p':
{
int X = Fl::event_x() - Track::width();
if ( X > 0 )
{
transport->locate( xoffset + x_to_ts( X ) );
}
return 1;
}
case '[':
{
int X = Fl::event_x() - Track::width();
if ( X > 0 )
{
p1 = xoffset + x_to_ts( X );
}
/* FIXME: only needs to damage the location of the old cursor! */
redraw();
return 1;
}
case ']':
{
int X = Fl::event_x() - Track::width();
if ( X > 0 )
{
p2 = xoffset + x_to_ts( X );
}
/* FIXME: only needs to damage the location of the old cursor! */
redraw();
return 1;
}
default: default:
return Fl_Overlay_Window::handle( m ); return Fl_Overlay_Window::handle( m );
} }