diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-06-17 13:37:52 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-06-17 13:37:52 +0000 |
commit | 2863640a52ddaea45ebe5bdd8aceb5567fe8989c (patch) | |
tree | e9bf16066afd70d5ad39ecfea6cad3fde49574d3 /gtk2_ardour/midi_region_view.cc | |
parent | 2e71cb2e26371b41f0715c8d659218afa742dd33 (diff) |
make it possible for canvas patch changes to receive kbd events, and along the way clean up a couple of related issues, providing noevent-pixbuf (which we should probably use for regionview names too)
git-svn-id: svn://localhost/ardour2/branches/3.0@12745 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index c2d706382e..99a7bf38f7 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -277,8 +277,7 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd) reset_width_dependent_items (_pixel_width); group->raise_to_top(); - group->signal_event().connect( - sigc::mem_fun(this, &MidiRegionView::canvas_event), false); + group->signal_event().connect (sigc::mem_fun (this, &MidiRegionView::canvas_event), false); midi_view()->signal_channel_mode_changed().connect( sigc::mem_fun(this, &MidiRegionView::midi_channel_mode_changed)); @@ -322,7 +321,7 @@ bool MidiRegionView::canvas_event(GdkEvent* ev) { bool r; - + switch (ev->type) { case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: @@ -714,7 +713,11 @@ MidiRegionView::key_press (GdkEventKey* ev) return true; - } else if (ev->keyval == GDK_Delete && unmodified) { + } else if ((ev->keyval == GDK_BackSpace || ev->keyval == GDK_Delete) && unmodified) { + + if (_selection.empty()) { + return false; + } delete_selection(); return true; @@ -1798,7 +1801,7 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const double const height = midi_stream_view()->contents_height(); boost::shared_ptr<CanvasPatchChange> patch_change = boost::shared_ptr<CanvasPatchChange>( - new CanvasPatchChange(*this, *_note_group, + new CanvasPatchChange(*this, *group, displaytext, height, x, 1.0, @@ -3139,18 +3142,24 @@ MidiRegionView::note_left (ArdourCanvas::CanvasNoteEvent*) } void -MidiRegionView::patch_entered (ArdourCanvas::CanvasPatchChange* ev) +MidiRegionView::patch_entered (ArdourCanvas::CanvasPatchChange* p) { ostringstream s; /* XXX should get patch name if we can */ - s << _("Bank:") << (ev->patch()->bank() + MIDI_BP_ZERO) << '\n' << _("Program:") << ((int) ev->patch()->program()) + MIDI_BP_ZERO << '\n' << _("Channel:") << ((int) ev->patch()->channel() + 1); + s << _("Bank:") << (p->patch()->bank() + MIDI_BP_ZERO) << '\n' + << _("Program:") << ((int) p->patch()->program()) + MIDI_BP_ZERO << '\n' + << _("Channel:") << ((int) p->patch()->channel() + 1); show_verbose_cursor (s.str(), 10, 20); + p->grab_focus(); } void MidiRegionView::patch_left (ArdourCanvas::CanvasPatchChange *) { trackview.editor().verbose_cursor()->hide (); + /* focus will transfer back via the enter-notify event sent to this + * midi region view. + */ } void |