summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-08-12 14:41:11 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-08-12 14:41:11 +0000
commitdd55f88d3011554a214e3e016d2241be61e03064 (patch)
treec9132951ac1d7788f12904e894527449c3decb81 /gtk2_ardour
parent61eacc021a1783836f338638594e9bb5594c3d83 (diff)
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
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor_drag.cc12
1 files 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);
}