diff options
author | Robin Gareus <robin@gareus.org> | 2015-03-28 18:00:31 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-03-28 18:22:37 +0100 |
commit | 74b3d0b6024ee49f9476f6d6d314ca87f2729aea (patch) | |
tree | f1e6adebec46920e25b4dc4bba1b585a08c49b4f /gtk2_ardour/midi_region_view.cc | |
parent | 8962bfba619626bc1aa0a289e63d24576d428eeb (diff) |
Drag/Drop work-around midi note bleeding
During DnD, the region uses the 'old/current'
midi_stream_view()'s range and its position/height calculation.
Ideally DnD would decouple the midi_stream_view() for the
region(s) being dragged and set it to the target's range
(or in case of the drop-zone, FullRange).
but I don't see how this can be done without major rework.
For now, just prevent visual bleeding of events in case
the target-track is smaller.
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 0426495fb3..7bed675ac3 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -1498,6 +1498,21 @@ MidiRegionView::apply_note_range (uint8_t min, uint8_t max, bool force) const double y0 = 1. + floor (midi_stream_view()->note_to_y(note->note())); const double y1 = y0 + std::max(1., floor(midi_stream_view()->note_height()) - 1.); + if (y0 < 0 || y1 >= _height) { + /* During DnD, the region uses the 'old/current' + * midi_stream_view()'s range and its position/height calculation. + * + * Ideally DnD would decouple the midi_stream_view() for the + * region(s) being dragged and set it to the target's range + * (or in case of the drop-zone, FullRange). + * but I don't see how this can be done without major rework. + * + * For now, just prevent visual bleeding of events in case + * the target-track is smaller. + */ + event->hide(); + continue; + } cnote->set_y0 (y0); cnote->set_y1 (y1); @@ -1754,6 +1769,13 @@ MidiRegionView::update_hit (Hit* ev, bool update_ghost_regions) const double diamond_size = std::max(1., floor(midi_stream_view()->note_height()) - 2.); const double y = 1.5 + floor(midi_stream_view()->note_to_y(note->note())) + diamond_size * .5; + // see DnD note in MidiRegionView::apply_note_range() above + if (y <= 0 || y >= _height) { + ev->hide(); + } else { + ev->show(); + } + ev->set_position (ArdourCanvas::Duple (x, y)); ev->set_height (diamond_size); |