Use a dedicated Canvas Group for MRV

This fixes rendering of opaque MIDI regions (previously
MIDI regions were always transparent). This change provides a
way to "flatten" layered MIDI regions, while still allowing
to show the note-line and grid behind the regions.
This commit is contained in:
Robin Gareus 2022-12-09 01:36:15 +01:00
parent 1efa5e9a55
commit f003bee985
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
6 changed files with 24 additions and 12 deletions

View file

@ -74,9 +74,15 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
, _note_lines (0)
, _updates_suspended (false)
{
/* use a group dedicated to MIDI underlays. Audio underlays are not in this group. */
midi_underlay_group = new ArdourCanvas::Container (_canvas_group);
midi_underlay_group->lower_to_bottom();
_midi_underlay = new ArdourCanvas::Container (_canvas_group);
_midi_underlay->lower_to_bottom();
/* use a dedicated group for MIDI regions (on top of the grid and lines) */
_region_group = new ArdourCanvas::Container (_canvas_group);
_region_group->raise_to_top ();
_region_group->set_render_with_alpha (UIConfiguration::instance().modifier ("region alpha").a());
/* put the note lines in the timeaxisview's group, so it
can be put below ghost regions from MIDI underlays
@ -117,11 +123,11 @@ MidiStreamView::create_region_view (boost::shared_ptr<Region> r, bool /*wfd*/, b
RegionView* region_view = NULL;
if (recording) {
region_view = new MidiRegionView (
_canvas_group, _trackview, region,
_region_group, _trackview, region,
_samples_per_pixel, region_color, recording,
TimeAxisViewItem::Visibility(TimeAxisViewItem::ShowFrame));
} else {
region_view = new MidiRegionView (_canvas_group, _trackview, region,
region_view = new MidiRegionView (_region_group, _trackview, region,
_samples_per_pixel, region_color);
}
@ -579,6 +585,7 @@ MidiStreamView::setup_rec_box ()
void
MidiStreamView::color_handler ()
{
_region_group->set_render_with_alpha (UIConfiguration::instance().modifier ("region alpha").a());
draw_note_lines ();
if (_trackview.is_midi_track()) {