+
+ note_range_adjustment.set_page_size(_highest_note - _lowest_note);
+ note_range_adjustment.set_value(_lowest_note);
+ NoteRangeChanged();
+ draw_note_lines();
+}
+
+
+void
+MidiStreamView::update_contents_y_position_and_height ()
+{
+ StreamView::update_contents_y_position_and_height();
+ _note_lines->property_y2() = height;
+ draw_note_lines();
+}
+
+void
+MidiStreamView::draw_note_lines()
+{
+ double y;
+ double prev_y = contents_height();
+ uint32_t color;
+
+ _note_lines->clear();
+
+ for(int i = _lowest_note; i <= _highest_note; ++i) {
+ y = floor(note_to_y(i));
+
+ _note_lines->add_line(prev_y, 1.0, ARDOUR_UI::config()->canvasvar_PianoRollBlackOutline.get());
+
+ switch(i % 12) {
+ case 1:
+ case 3:
+ case 6:
+ case 8:
+ case 10:
+ color = ARDOUR_UI::config()->canvasvar_PianoRollBlack.get();
+ break;
+ default:
+ color = ARDOUR_UI::config()->canvasvar_PianoRollWhite.get();
+ break;
+ }
+
+ if(i == _highest_note) {
+ _note_lines->add_line(y, prev_y - y, color);
+ }
+ else {
+ _note_lines->add_line(y + 1.0, prev_y - y - 1.0, color);
+ }
+
+ prev_y = y;
+ }
+}
+
+
+void
+MidiStreamView::set_note_range(VisibleNoteRange r)
+{
+ _range = r;
+ if (r == FullRange) {
+ _lowest_note = 0;
+ _highest_note = 127;
+ } else {
+ _lowest_note = 60;
+ _highest_note = 60;
+ }
+ redisplay_diskstream();
+}
+
+void
+MidiStreamView::set_note_range(uint8_t lowest, uint8_t highest) {
+ if(_range == ContentsRange) {
+ _lowest_note = lowest;
+ _highest_note = highest;
+
+ list<RegionView *>::iterator i;
+ for (i = region_views.begin(); i != region_views.end(); ++i) {
+ (*i)->set_y_position_and_height(0, height); // apply note range
+ }
+ }
+
+ draw_note_lines();
+ NoteRangeChanged();