Disable follow-playhead during drags. Fixes #3647.

git-svn-id: svn://localhost/ardour2/branches/3.0@8444 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-01-05 02:28:28 +00:00
parent d13cb3bd40
commit 85acf35337
5 changed files with 17 additions and 4 deletions

View file

@ -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 ();
}

View file

@ -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; }

View file

@ -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;
}

View file

@ -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 */

View file

@ -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;