User can temporarily disable snapping by holding down 's'.

This commit is contained in:
Jonathan Moore Liles 2010-01-26 08:31:04 -06:00
parent 80f24ba2d1
commit 60e54068b3
2 changed files with 13 additions and 1 deletions

View File

@ -67,6 +67,7 @@
bool Timeline::draw_with_measure_lines = true;
Timeline::snap_e Timeline::snap_to = Bars;
bool Timeline::snapping_on_hold = false;
bool Timeline::snap_magnetic = true;
bool Timeline::follow_playhead = true;
bool Timeline::center_playhead = true;
@ -597,7 +598,7 @@ prev_next_line_cb ( nframes_t frame, const BBT &bbt, void *arg )
bool
Timeline::nearest_line ( nframes_t *frame, bool snap ) const
{
if ( snap && None == Timeline::snap_to )
if ( snap && ( snapping_on_hold || None == Timeline::snap_to ) )
return false;
nframes_t when = *frame;
@ -1192,6 +1193,11 @@ Timeline::handle ( int m )
range = true;
return 1;
}
else if ( Fl::event_key() == 's' )
{
snapping_on_hold = true;
return 1;
}
return 0;
case FL_KEYUP:
if ( Fl::event_key() == 'r' )
@ -1199,6 +1205,11 @@ Timeline::handle ( int m )
range = false;
return 1;
}
else if ( Fl::event_key() == 's' )
{
snapping_on_hold = false;
return 1;
}
return 0;
// case FL_KEYBOARD:
case FL_SHORTCUT:

View File

@ -124,6 +124,7 @@ public:
static bool draw_with_measure_lines;
static snap_e snap_to;
static bool snapping_on_hold;
static bool snap_magnetic;
static bool follow_playhead;
static bool center_playhead;