diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index d702a77..aa64607 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -176,7 +176,7 @@ exit( 0 );} } MenuItem {} { label {Delete Selected} - callback {timeline->delete_selected();} selected + callback {timeline->delete_selected();} xywh {20 20 40 25} shortcut 0xffff } } @@ -248,6 +248,11 @@ exit( 0 );} label {&Timeline} open xywh {0 0 74 25} } { + MenuItem {} { + label {&Follow Playhead} + callback {Timeline::follow_playhead = menu_picked_value( o );} selected + xywh {20 20 40 25} type Toggle value 1 + } Submenu {} { label {&Snap to} open xywh {0 0 74 25} diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index eeaf353..ee78380 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -34,6 +34,7 @@ bool Timeline::draw_with_measure_lines = true; Timeline::snap_e Timeline::snap_to = Bars; bool Timeline::snap_magnetic = true; +bool Timeline::follow_playhead = true; const float UPDATE_FREQ = 0.02f; @@ -664,6 +665,9 @@ Timeline::redraw_playhead ( void ) { redraw_overlay(); last_playhead = transport->frame; + + if ( follow_playhead ) + xposition( max( 0, ts_to_x( transport->frame ) - ( ( tracks->w() - Track::width() ) >> 1 ) ) ); } } diff --git a/Timeline/Timeline.H b/Timeline/Timeline.H index 4e3fed9..4ea4c13 100644 --- a/Timeline/Timeline.H +++ b/Timeline/Timeline.H @@ -117,6 +117,7 @@ public: static bool draw_with_measure_lines; static snap_e snap_to; static bool snap_magnetic; + static bool follow_playhead; Tempo_Sequence *tempo_track; Time_Sequence *time_track;