From 26b9f2cf6bd6e99bc3aae32b6030c98a381ce101 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sun, 25 May 2008 01:18:30 -0500 Subject: [PATCH] Move more timeline keybindings into menu. --- Timeline/Timeline.C | 74 ++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index ab5955c..b2fa79a 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -195,6 +195,39 @@ Timeline::menu_cb ( Fl_Widget *w ) 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 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( "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 ); @@ -951,44 +987,6 @@ Timeline::handle ( int m ) case FL_End: /* keep scrollbar from eating these. */ 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: return Fl_Overlay_Window::handle( m ); }