}
RegionView*
-MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wfd, bool recording)
+MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wait_for_data, bool recording)
{
boost::shared_ptr<MidiRegion> region = boost::dynamic_pointer_cast<MidiRegion> (r);
- if (region == 0) {
+ if (!region) {
return 0;
}
(*i)->set_valid (true);
- display_region(dynamic_cast<MidiRegionView*>(*i), wfd);
+ display_region(dynamic_cast<MidiRegionView*>(*i), wait_for_data);
return 0;
}
}
- MidiRegionView* region_view = dynamic_cast<MidiRegionView*> (create_region_view (r, wfd, recording));
+ MidiRegionView* region_view = dynamic_cast<MidiRegionView*> (create_region_view (r, wait_for_data, recording));
if (region_view == 0) {
return 0;
}
}
/* display events and find note range */
- display_region (region_view, wfd);
+ display_region (region_view, wait_for_data);
/* fit note range if we are importing */
if (_trackview.session()->operation_in_progress (Operations::insert_file)) {
return;
}
- region_view->enable_display(true);
+ region_view->enable_display (true);
boost::shared_ptr<MidiSource> source(region_view->midi_region()->midi_source(0));
region_view->display_model(source->model());
}
+
void
MidiStreamView::display_track (boost::shared_ptr<Track> tr)
{
}
double y;
- double prev_y = contents_height();
+ double prev_y = 0;
uint32_t color;
_note_lines->clear();
return;
}
- for (int i = lowest_note(); i <= highest_note(); ++i) {
- y = floor(note_to_y(i));
+ /* do this is order of highest ... lowest since that matches the
+ * coordinate system in which y=0 is at the top
+ */
+
+ for (int i = highest_note(); i >= lowest_note(); --i) {
+
+ y = note_to_y (i);
+
+ /* this is the line actually corresponding to the division
+ * between notes
+ */
- _note_lines->add (prev_y, 1.0, ARDOUR_UI::config()->get_canvasvar_PianoRollBlackOutline());
+ _note_lines->add (y, 1.0, ARDOUR_UI::config()->get_canvasvar_PianoRollBlackOutline());
+
+ /* now add a thicker line/bar which covers the entire vertical
+ * height of this note.
+ */
switch (i % 12) {
case 1:
break;
}
- if (i == highest_note()) {
- _note_lines->add (y, prev_y - y, color);
- } else {
- _note_lines->add (y + 1.0, prev_y - y - 1.0, color);
+ double h = y - prev_y;
+ double mid = y + (h/2.0);
+
+ if (height > 1.0) {
+ _note_lines->add (mid, h, color);
}
prev_y = y;
MidiStreamView::resume_updates ()
{
_updates_suspended = false;
-
+
draw_note_lines ();
apply_note_range_to_regions ();
+
+ _canvas_group->redraw ();
}
void