when showing a note value during a drag, clamp first to the actual range. note that...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 12 Aug 2011 14:41:11 +0000 (14:41 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 12 Aug 2011 14:41:11 +0000 (14:41 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9983 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_drag.cc

index deffee2ecd9d3f6aed23669650aab3fe7afb66c3..fee9ffeccb1f50941472abb6d8048ff1378c7837 100644 (file)
@@ -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);
        }