+uint8_t
+MidiStreamView::y_to_note (double y) const
+{
+ int const n = ((contents_height() - y - 1) / contents_height() * (double)contents_note_range())
+ + lowest_note();
+
+ if (n < 0) {
+ return 0;
+ } else if (n > 127) {
+ return 127;
+ }
+
+ return n;
+}
+
+/** Suspend updates to the regions' note ranges and our
+ * note lines until resume_updates() is called.
+ */
+void
+MidiStreamView::suspend_updates ()
+{
+ _updates_suspended = true;
+}
+
+/** Resume updates to region note ranges and note lines,
+ * and update them now.
+ */
+void
+MidiStreamView::resume_updates ()
+{
+ _updates_suspended = false;
+
+ draw_note_lines ();
+ apply_note_range_to_regions ();
+}