diff options
author | Carl Hetherington <carl@carlh.net> | 2010-12-22 23:16:39 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-12-22 23:16:39 +0000 |
commit | 039adb4c6b8dfea99e9b8eab7ca667ad4b3953d7 (patch) | |
tree | fb5bdcbedd7907cf716673c955e554c692133314 /gtk2_ardour/editor_drag.cc | |
parent | 9eca7915e2ea5003c92d9d741b44af207933f688 (diff) |
Account for the fact that CursorDrag only ever drags the playhead. Fix playhead misbehaviour when you start a drag from outside it.
git-svn-id: svn://localhost/ardour2/branches/3.0@8327 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 73 |
1 files changed, 29 insertions, 44 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index ec480c4501..dd27b04171 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1981,9 +1981,6 @@ CursorDrag::CursorDrag (Editor* e, ArdourCanvas::Item* i, bool s) _stop (s) { DEBUG_TRACE (DEBUG::Drags, "New CursorDrag\n"); - - _cursor = reinterpret_cast<EditorCursor*> (_item->get_data ("cursor")); - assert (_cursor); } void @@ -1992,48 +1989,38 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c) Drag::start_grab (event, c); if (!_stop) { - framepos_t where = _editor->event_frame (event, 0, 0); _editor->snap_to_with_modifier (where, event); _editor->playhead_cursor->set_position (where); - } - if (_cursor == _editor->playhead_cursor) { - _editor->_dragging_playhead = true; - - Session* s = _editor->session (); - - if (s) { - if (_was_rolling && _stop) { - s->request_stop (); - } - - if (s->is_auditioning()) { - s->cancel_audition (); - } - - s->request_suspend_timecode_transmission (); + _editor->_dragging_playhead = true; + + Session* s = _editor->session (); + + if (s) { + if (_was_rolling && _stop) { + s->request_stop (); + } + + if (s->is_auditioning()) { + s->cancel_audition (); + } + + s->request_suspend_timecode_transmission (); - if (s->timecode_transmission_suspended ()) { - framepos_t const f = _editor->playhead_cursor->current_frame; - s->send_mmc_locate (f); - s->send_full_time_code (f); - } + if (s->timecode_transmission_suspended ()) { + framepos_t const f = _editor->playhead_cursor->current_frame; + s->send_mmc_locate (f); + s->send_full_time_code (f); } } - _editor->show_verbose_time_cursor (_cursor->current_frame, 10); + _editor->show_verbose_time_cursor (_editor->playhead_cursor->current_frame, 10); } void -CursorDrag::setup_pointer_frame_offset () -{ - _pointer_frame_offset = raw_grab_frame() - _cursor->current_frame; -} - -void CursorDrag::motion (GdkEvent* event, bool) { framepos_t const adjusted_frame = adjusted_current_frame (event); @@ -2042,12 +2029,12 @@ CursorDrag::motion (GdkEvent* event, bool) return; } - _cursor->set_position (adjusted_frame); + _editor->playhead_cursor->set_position (adjusted_frame); - _editor->show_verbose_time_cursor (_cursor->current_frame, 10); + _editor->show_verbose_time_cursor (_editor->playhead_cursor->current_frame, 10); Session* s = _editor->session (); - if (s && _item == &_editor->playhead_cursor->canvas_item && s->timecode_transmission_suspended ()) { + if (s && s->timecode_transmission_suspended ()) { framepos_t const f = _editor->playhead_cursor->current_frame; s->send_mmc_locate (f); s->send_full_time_code (f); @@ -2057,7 +2044,7 @@ CursorDrag::motion (GdkEvent* event, bool) #ifdef GTKOSX _editor->update_canvas_now (); #endif - _editor->UpdateAllTransportClocks (_cursor->current_frame); + _editor->UpdateAllTransportClocks (_editor->playhead_cursor->current_frame); } void @@ -2071,13 +2058,11 @@ CursorDrag::finished (GdkEvent* event, bool movement_occurred) motion (event, false); - if (_item == &_editor->playhead_cursor->canvas_item) { - Session* s = _editor->session (); - if (s) { - s->request_locate (_editor->playhead_cursor->current_frame, _was_rolling); - _editor->_pending_locate_request = true; - s->request_resume_timecode_transmission (); - } + Session* s = _editor->session (); + if (s) { + s->request_locate (_editor->playhead_cursor->current_frame, _was_rolling); + _editor->_pending_locate_request = true; + s->request_resume_timecode_transmission (); } } @@ -2089,7 +2074,7 @@ CursorDrag::aborted () _editor->_dragging_playhead = false; } - _cursor->set_position (adjusted_frame (grab_frame (), 0, false)); + _editor->playhead_cursor->set_position (adjusted_frame (grab_frame (), 0, false)); } FadeInDrag::FadeInDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v) |