diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 2419169c7f..020953211f 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -160,6 +160,14 @@ DragManager::end_grab (GdkEvent* e) return r; } +void +DragManager::mark_double_click () +{ + for (list::const_iterator i = _drags.begin(); i != _drags.end(); ++i) { + (*i)->set_double_click (true); + } +} + bool DragManager::motion_handler (GdkEvent* e, bool from_autoscroll) { @@ -212,6 +220,7 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i) , _item (i) , _pointer_frame_offset (0) , _move_threshold_passed (false) + , _was_double_click (false) , _raw_grab_frame (0) , _grab_frame (0) , _last_pointer_frame (0) @@ -2974,6 +2983,10 @@ void MarkerDrag::finished (GdkEvent* event, bool movement_occurred) { if (!movement_occurred) { + + if (was_double_click()) { + cerr << "End of marker double click\n"; + } /* just a click, do nothing but finish off the selection process diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 4497cd025d..df55270e54 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -63,6 +63,8 @@ public: bool end_grab (GdkEvent *); bool have_item (ArdourCanvas::Item *) const; + void mark_double_click (); + /** @return true if an end drag or abort is in progress */ bool ending () const { return _ending; @@ -101,7 +103,7 @@ private: class Drag { public: - Drag (Editor *, ArdourCanvas::Item *); + Drag (Editor *, ArdourCanvas::Item *); virtual ~Drag () {} void set_manager (DragManager* m) { @@ -120,6 +122,9 @@ public: ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const; ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const; + bool was_double_click() const { return _was_double_click; } + void set_double_click (bool yn) { _was_double_click = yn; } + /** Called to start a grab of an item. * @param e Event that caused the grab to start. * @param c Cursor to use, or 0. @@ -225,6 +230,7 @@ protected: private: bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false + bool _was_double_click; ///< true if drag initiated by a double click event double _grab_x; ///< trackview x of the grab start position double _grab_y; ///< trackview y of the grab start position double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred @@ -694,7 +700,7 @@ public: class MarkerDrag : public Drag { public: - MarkerDrag (Editor *, ArdourCanvas::Item *); + MarkerDrag (Editor *, ArdourCanvas::Item *); ~MarkerDrag (); void start_grab (GdkEvent *, Gdk::Cursor* c = 0); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index cb23e7d2d1..c769cdb4af 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1293,6 +1293,11 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT bool Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type) { + if (event->type == GDK_2BUTTON_PRESS) { + _drags->mark_double_click (); + return false; + } + if (event->type != GDK_BUTTON_PRESS) { return false; }