diff options
author | Carl Hetherington <carl@carlh.net> | 2011-01-05 02:28:28 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-01-05 02:28:28 +0000 |
commit | 85acf35337e73a1382a1ce3f1fa02470d75e487a (patch) | |
tree | 5fc10c780a9298fd7adff4e498e32592e9ba09ff /gtk2_ardour | |
parent | d13cb3bd40b5d5ae54c3adfcf952e6f965e51d08 (diff) |
Disable follow-playhead during drags. Fixes #3647.
git-svn-id: svn://localhost/ardour2/branches/3.0@8444 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 3 |
5 files changed, 17 insertions, 4 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 9c9444e3fc..881074f258 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -3637,11 +3637,14 @@ Editor::toggle_follow_playhead () } } +/** @param yn true to follow playhead, otherwise false. + * @param catch_up true to reset the editor view to show the playhead (if yn == true), otherwise false. + */ void -Editor::set_follow_playhead (bool yn) +Editor::set_follow_playhead (bool yn, bool catch_up) { if (_follow_playhead != yn) { - if ((_follow_playhead = yn) == true) { + if ((_follow_playhead = yn) == true && catch_up) { /* catch up */ reset_x_origin_to_follow_playhead (); } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index c46b305c27..c4d3edeef7 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -344,7 +344,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void toggle_stationary_playhead (); bool stationary_playhead() const { return _stationary_playhead; } - void set_follow_playhead (bool yn); + void set_follow_playhead (bool yn, bool catch_up = true); void toggle_follow_playhead (); bool follow_playhead() const { return _follow_playhead; } bool dragging_playhead () const { return _dragging_playhead; } diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 809f797175..77c68faf96 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -91,6 +91,8 @@ DragManager::abort () _drags.clear (); + _editor->set_follow_playhead (_old_follow_playhead); + _ending = false; } @@ -112,6 +114,10 @@ DragManager::set (Drag* d, GdkEvent* e, Gdk::Cursor* c) void DragManager::start_grab (GdkEvent* e, Gdk::Cursor* c) { + /* Prevent follow playhead during the drag to be nice to the user */ + _old_follow_playhead = _editor->follow_playhead (); + _editor->set_follow_playhead (false); + _current_pointer_frame = _editor->event_frame (e, &_current_pointer_x, &_current_pointer_y); for (list<Drag*>::const_iterator i = _drags.begin(); i != _drags.end(); ++i) { @@ -139,6 +145,8 @@ DragManager::end_grab (GdkEvent* e) _drags.clear (); _ending = false; + + _editor->set_follow_playhead (_old_follow_playhead, false); return r; } diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 1268cbf8c4..ab81db5a63 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -100,6 +100,7 @@ private: double _current_pointer_x; ///< trackview x of the current pointer double _current_pointer_y; ///< trackview y of the current pointer ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at + bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started }; /** Abstract base class for dragging of things within the editor */ diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index f0c2ca3f91..2667d031b6 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -238,8 +238,9 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { /** Set whether the editor should follow the playhead. * @param yn true to follow playhead, otherwise false. + * @param catch_up true to reset the editor view to show the playhead (if yn == true), otherwise false. */ - virtual void set_follow_playhead (bool yn) = 0; + virtual void set_follow_playhead (bool yn, bool catch_up = false) = 0; /** Toggle whether the editor is following the playhead */ virtual void toggle_follow_playhead () = 0; |