Timeline: Allow recording in punch mode when playhead is in the middle of a punch cursor.

This commit is contained in:
Jonathan Moore Liles 2013-10-05 21:12:43 -07:00
parent 7770610d32
commit e6313394cd
1 changed files with 21 additions and 6 deletions

View File

@ -60,14 +60,29 @@ Timeline::record ( void )
{ {
DMESSAGE( "Finding next punch region following frame %lu...", (unsigned long)frame); DMESSAGE( "Finding next punch region following frame %lu...", (unsigned long)frame);
const Sequence_Widget *w = punch_cursor_track->next( frame ); const Sequence_Widget *p = punch_cursor_track->prev( frame );
const Sequence_Widget *n = punch_cursor_track->next( frame );
if ( w && w->start() >= frame ) if (p || n )
{ {
frame = w->start(); if ( p && frame > p->start() && frame < p->start() + p->length() )
_punch_out_frame = w->start() + w->length(); {
/* recording started in the middle of a punch
* cursor... Just start recording and punch out at the
* end of it */
_punch_out_frame = p->start() + p->length();
}
else if ( n && n->start() >= frame )
{
/* recording started outside of a punch cursor, set
* punch in frame to beginning of next cursor */
frame = n->start();
_punch_out_frame = n->start() + n->length();
}
DMESSAGE( "Punch enabled... Will punch in at frame %lu.", (unsigned long)frame ); DMESSAGE( "Punch enabled... Range %lu:%lu",
(unsigned long)frame,
(unsigned long)_punch_out_frame);
} }
} }