From dd55f88d3011554a214e3e016d2241be61e03064 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 12 Aug 2011 14:41:11 +0000 Subject: [PATCH] when showing a note value during a drag, clamp first to the actual range. note that the canvas object can still be dragged out of the region (above/below) but fixing this requires some kind of fancy auto-scroll that i'm not up for implementing at this time git-svn-id: svn://localhost/ardour2/branches/3.0@9983 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_drag.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index deffee2ecd..fee9ffeccb 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3916,9 +3916,17 @@ NoteDrag::motion (GdkEvent *, bool) _region->move_selection (tdx, tdy, note_delta); + /* the new note value may be the same as the old one, but we + * don't know what that means because the selection may have + * involved more than one note and we might be doing something + * odd with them. so show the note value anyway, always. + */ + char buf[12]; - snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (_primary->note()->note() + note_delta).c_str(), - (int) floor (_primary->note()->note() + note_delta)); + uint8_t new_note = min (max (_primary->note()->note() + note_delta, 0), 127); + + snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (new_note).c_str(), + (int) floor (new_note)); show_verbose_cursor_text (buf); }