From aba69106295d9c4e8e349aca5851b5b046170f6b Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Thu, 1 May 2008 01:47:49 -0500 Subject: [PATCH] Make playhead centering optional and disable it while recording. --- Timeline/TLE.fl | 7 ++++++- Timeline/Timeline.C | 8 +++++++- Timeline/Timeline.H | 1 + Timeline/Transport.H | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index aa64607..c1f1e3a 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -250,9 +250,14 @@ exit( 0 );} } { MenuItem {} { label {&Follow Playhead} - callback {Timeline::follow_playhead = menu_picked_value( o );} selected + callback {Timeline::follow_playhead = menu_picked_value( o );} xywh {20 20 40 25} type Toggle value 1 } + MenuItem {} { + label {&Center Playhead} + callback {Timeline::center_playhead = menu_picked_value( o );} selected + xywh {30 30 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 9f21cb7..0a627e4 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -35,6 +35,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; +bool Timeline::center_playhead = true; const float UPDATE_FREQ = 0.02f; @@ -744,7 +745,12 @@ Timeline::redraw_playhead ( void ) last_playhead = transport->frame; if ( follow_playhead ) - xposition( max( 0, ts_to_x( transport->frame ) - ( ( tracks->w() - Track::width() ) >> 1 ) ) ); + { + if ( center_playhead && active() ) + xposition( max( 0, ts_to_x( transport->frame ) - ( ( tracks->w() - Track::width() ) >> 1 ) ) ); + else if ( ts_to_x( transport->frame ) > ts_to_x( xoffset ) + ( tracks->w() - Track::width() ) ) + xposition( ts_to_x( transport->frame ) ); + } } } diff --git a/Timeline/Timeline.H b/Timeline/Timeline.H index ed2ec94..3efcf3f 100644 --- a/Timeline/Timeline.H +++ b/Timeline/Timeline.H @@ -118,6 +118,7 @@ public: static snap_e snap_to; static bool snap_magnetic; static bool follow_playhead; + static bool center_playhead; Tempo_Sequence *tempo_track; Time_Sequence *time_track; diff --git a/Timeline/Transport.H b/Timeline/Transport.H index 7971841..66a139d 100644 --- a/Timeline/Transport.H +++ b/Timeline/Transport.H @@ -136,6 +136,7 @@ public: } bool rolling; + bool recording; void poll ( void ); void locate ( nframes_t frame );