Make playhead centering optional and disable it while recording.

This commit is contained in:
Jonathan Moore Liles 2008-05-01 01:47:49 -05:00
parent 84af307881
commit aba6910629
4 changed files with 15 additions and 2 deletions

View File

@ -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}

View File

@ -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 ) );
}
}
}

View File

@ -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;

View File

@ -136,6 +136,7 @@ public:
}
bool rolling;
bool recording;
void poll ( void );
void locate ( nframes_t frame );