diff options
author | Colin Fletcher <colin.m.fletcher@googlemail.com> | 2013-08-09 15:57:37 +0100 |
---|---|---|
committer | Colin Fletcher <colin.m.fletcher@googlemail.com> | 2013-10-25 17:03:45 +0100 |
commit | 89193dc40ba85cd4c388dd33776f7b28ea98a848 (patch) | |
tree | 35aa91bcce4463fbdf4b00f857cfeaf86120ec97 /gtk2_ardour | |
parent | 0bf241257bc9ab13487deaaacdccea257de98482 (diff) |
Add a double-click handler for items in the editor window.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index e9269841ff..13902a111f 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1085,6 +1085,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool button_press_handler_1 (ArdourCanvas::Item *, GdkEvent *, ItemType); bool button_press_handler_2 (ArdourCanvas::Item *, GdkEvent *, ItemType); bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); + bool button_double_click_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); bool button_press_dispatch (GdkEventButton*); bool button_release_dispatch (GdkEventButton*); bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index be716d64d0..c91e9d1b34 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1269,6 +1269,10 @@ bool Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type) { if (event->type != GDK_BUTTON_PRESS) { + if (event->type == GDK_2BUTTON_PRESS) { + gdk_pointer_ungrab (GDK_CURRENT_TIME); + return button_double_click_handler (item, event, item_type); + } return false; } @@ -1393,6 +1397,37 @@ Editor::button_release_dispatch (GdkEventButton* ev) } bool +Editor::button_double_click_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type) { + + if (event->button.button != 1) { + return false; + } + + switch (item_type) { + case RegionItem: + case NoteItem: + case PlayheadCursorItem: + case MarkerItem: + case RangeMarkerBarItem: + case CdMarkerBarItem: + case TempoMarkerItem: + case MeterMarkerItem: + case MarkerBarItem: + case TempoBarItem: + case MeterBarItem: + case TransportMarkerBarItem: + case StreamItem: + break; + + default: + break; + } + return false; +} + + + +bool Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type) { framepos_t where = event_frame (event, 0, 0); |