diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-10-23 10:38:09 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-10-23 10:38:09 -0400 |
commit | fca33f903db7786cb69435cda6ea34871faae921 (patch) | |
tree | c3e302da36e5f000b93decda4195be05e1452b41 /gtk2_ardour/midi_streamview.cc | |
parent | 192f22d89e53abe321e1301c5d15b25db533f02d (diff) |
fix up drawing of MIDI note "lines" on track canvas, which were in the wrong places
Diffstat (limited to 'gtk2_ardour/midi_streamview.cc')
-rw-r--r-- | gtk2_ardour/midi_streamview.cc | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 640c0263e1..f192607da4 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -285,7 +285,7 @@ MidiStreamView::draw_note_lines() } double y; - double prev_y = contents_height(); + double prev_y = 0; uint32_t color; _note_lines->clear(); @@ -295,10 +295,23 @@ MidiStreamView::draw_note_lines() 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 + */ - _note_lines->add (prev_y, 1.0, ARDOUR_UI::config()->get_canvasvar_PianoRollBlackOutline()); + for (int i = highest_note(); i >= lowest_note(); --i) { + + y = floor (note_to_y(i)); + + /* this is the line actually corresponding to the division + * between notes + */ + + _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: @@ -313,10 +326,11 @@ MidiStreamView::draw_note_lines() 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; |