}
region_view->enable_display (true);
+ region_view->set_height (child_height());
boost::shared_ptr<MidiSource> source(region_view->midi_region()->midi_source(0));
+ if (!source) {
+ error << _("attempt to display MIDI region with no source") << endmsg;
+ return;
+ }
if (load_model) {
source->load_model();
}
+ if (!source->model()) {
+ error << _("attempt to display MIDI region with no model") << endmsg;
+ return;
+ }
+
_range_dirty = update_data_note_range(
source->model()->lowest_note(),
source->model()->highest_note());
// Display region contents
- region_view->set_height (child_height());
region_view->display_model(source->model());
}
}
double y;
- double prev_y = 0;
+ double prev_y = .5;
uint32_t color;
_note_lines->clear();
* coordinate system in which y=0 is at the top
*/
- for (int i = highest_note(); i >= lowest_note(); --i) {
+ for (int i = highest_note() + 1; i >= lowest_note(); --i) {
- y = note_to_y (i);
+ y = floor(note_to_y (i)) + .5;
/* this is the line actually corresponding to the division
* between notes
*/
- _note_lines->add (y, 1.0, ARDOUR_UI::config()->get_canvasvar_PianoRollBlackOutline());
+ if (i <= highest_note()) {
+ _note_lines->add (y, 1.0, ARDOUR_UI::config()->color ("piano roll black outline"));
+ }
/* now add a thicker line/bar which covers the entire vertical
* height of this note.
case 6:
case 8:
case 10:
- color = ARDOUR_UI::config()->get_canvasvar_PianoRollBlack();
+ color = ARDOUR_UI::config()->color_mod ("piano roll black", "piano roll black");
break;
default:
- color = ARDOUR_UI::config()->get_canvasvar_PianoRollWhite();
+ color = ARDOUR_UI::config()->color_mod ("piano roll white", "piano roll white");
break;
}
double h = y - prev_y;
double mid = y + (h/2.0);
- if (height > 1.0) {
+ if (height > 1.0) { // XXX ? should that not be h >= 1 ?
_note_lines->add (mid, h, color);
}
gdouble const xend = xstart;
uint32_t fill_color;
- fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
+ fill_color = ARDOUR_UI::config()->color ("recording rect");
ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::Rectangle (_canvas_group);
rec_rect->set (ArdourCanvas::Rect (xstart, 1, xend, _trackview.current_height() - 1));
- rec_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RecordingRect());
+ rec_rect->set_outline_color (ARDOUR_UI::config()->color ("recording rect"));
rec_rect->set_fill_color (fill_color);
rec_rect->lower_to_bottom();
draw_note_lines ();
if (_trackview.is_midi_track()) {
- canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_MidiTrackBase());
+ canvas_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("midi track base", "midi track base"));
} else {
- canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_MidiBusBase());
+ canvas_rect->set_fill_color (ARDOUR_UI::config()->color ("midi bus base"));
}
}