From 60e54068b3cc9ab0e578dc90243a884c95f2ebb5 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Tue, 26 Jan 2010 08:31:04 -0600 Subject: [PATCH] User can temporarily disable snapping by holding down 's'. --- Timeline/Timeline.C | 13 ++++++++++++- Timeline/Timeline.H | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index 38d4570..20587f3 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -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: diff --git a/Timeline/Timeline.H b/Timeline/Timeline.H index e184543..e72525f 100644 --- a/Timeline/Timeline.H +++ b/Timeline/Timeline.H @@ -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;