13
0

Delete key can now be used to remove tempo/meter markers

git-svn-id: svn://localhost/ardour2/branches/3.0@9996 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-08-15 15:08:37 +00:00
parent 82f8214277
commit b500497812
2 changed files with 52 additions and 0 deletions

View File

@ -1055,6 +1055,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
bool key_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
bool key_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
Gtkmm2ext::Bindings* button_bindings;
XMLNode* button_settings () const;

View File

@ -212,6 +212,14 @@ Editor::typed_event (ArdourCanvas::Item* item, GdkEvent *event, ItemType type)
ret = leave_handler (item, event, type);
break;
case GDK_KEY_PRESS:
ret = key_press_handler (item, event, type);
break;
case GDK_KEY_RELEASE:
ret = key_release_handler (item, event, type);
break;
default:
break;
}
@ -1074,3 +1082,45 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const & /*c*/,
return true;
}
bool
Editor::key_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType type)
{
return false;
}
bool
Editor::key_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType type)
{
bool handled = false;
switch (type) {
case TempoMarkerItem:
switch (event->key.keyval) {
case GDK_Delete:
remove_tempo_marker (item);
handled = true;
break;
default:
break;
}
break;
case MeterMarkerItem:
switch (event->key.keyval) {
case GDK_Delete:
remove_meter_marker (item);
handled = true;
break;
default:
break;
}
break;
default:
break;
}
return handled;
}