Add a double-click handler for items in the editor window.

This commit is contained in:
Colin Fletcher 2013-08-09 15:57:37 +01:00
parent 0bf241257b
commit 89193dc40b
2 changed files with 36 additions and 0 deletions

View File

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

View File

@ -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;
}
@ -1392,6 +1396,37 @@ Editor::button_release_dispatch (GdkEventButton* ev)
return button_bindings->activate (b, Gtkmm2ext::Bindings::Release);
}
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)
{