From d2e8a683eed6fb82d4d255fffaf571ff27057132 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 25 Feb 2016 17:06:44 +0000 Subject: Plot video and subtitle on one track and audio on the rest in the timeline. --- src/wx/timeline.cc | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'src/wx/timeline.cc') diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 62b812c8b..de2070531 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -89,8 +89,26 @@ Timeline::paint () return; } - for (TimelineViewList::iterator i = _views.begin(); i != _views.end(); ++i) { - (*i)->paint (gc); + + BOOST_FOREACH (shared_ptr i, _views) { + + shared_ptr ic = dynamic_pointer_cast (i); + + /* Find areas of overlap */ + list > overlaps; + BOOST_FOREACH (shared_ptr j, _views) { + shared_ptr jc = dynamic_pointer_cast (j); + if (!ic || !jc || i == j || ic->track() != jc->track() || !ic->active() || !jc->active()) { + continue; + } + + optional > r = j->bbox().intersection (i->bbox()); + if (r) { + overlaps.push_back (r.get ()); + } + } + + i->paint (gc, overlaps); } delete gc; @@ -169,14 +187,12 @@ Timeline::assign_tracks () continue; } - shared_ptr content = cv->content(); - - if (dynamic_pointer_cast (content)) { + if (dynamic_pointer_cast (*i)) { /* Video on track 0 */ cv->set_track (0); _tracks = max (_tracks, 1); continue; - } else if (dynamic_pointer_cast (content)) { + } else if (dynamic_pointer_cast (*i)) { /* Subtitles on track 1 */ cv->set_track (1); _tracks = max (_tracks, 2); @@ -186,6 +202,7 @@ Timeline::assign_tracks () /* Audio on tracks 2 and up */ int t = 2; + shared_ptr content = cv->content(); DCPTimePeriod content_period (content->position(), content->end()); while (true) { -- cgit v1.2.3