From e1ec5b2c81ec2e15d4c1d97cce8252fa34c7116a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 24 Feb 2016 00:17:26 +0000 Subject: An unfortunately large set of timeline-related changes: - Rename sequence_video to sequence, and sequence subtitle content like we do video content (i.e. adding multiple subtitle contents will result in them sequenced in time rather than overlaid). - Stop doing selection-changed related stuff in ContentPanel if no selection change has actually happened. - Attempt to tidy up event handling in the timeline a bit. --- src/lib/playlist.cc | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'src/lib/playlist.cc') diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index b5faec567..4c07a0d52 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -51,8 +51,8 @@ using boost::weak_ptr; using boost::dynamic_pointer_cast; Playlist::Playlist () - : _sequence_video (true) - , _sequencing_video (false) + : _sequence (true) + , _sequencing (false) { } @@ -72,7 +72,7 @@ Playlist::content_changed (weak_ptr content, int property, bool frequen - any other position changes will be timeline drags which should not result in content being sequenced. */ - maybe_sequence_video (); + maybe_sequence (); } if ( @@ -92,13 +92,15 @@ Playlist::content_changed (weak_ptr content, int property, bool frequen } void -Playlist::maybe_sequence_video () +Playlist::maybe_sequence () { - if (!_sequence_video || _sequencing_video) { + if (!_sequence || _sequencing) { return; } - _sequencing_video = true; + _sequencing = true; + + /* Video */ DCPTime next_left; DCPTime next_right; @@ -117,9 +119,23 @@ Playlist::maybe_sequence_video () } } + /* Subtitles */ + + DCPTime next; + BOOST_FOREACH (shared_ptr i, _content) { + shared_ptr sc = dynamic_pointer_cast (i); + if (!sc) { + continue; + } + + sc->set_position (next); + next = sc->end(); + } + + /* This won't change order, so it does not need a sort */ - _sequencing_video = false; + _sequencing = false; } string @@ -333,6 +349,19 @@ Playlist::video_end () const return end; } +DCPTime +Playlist::subtitle_end () const +{ + DCPTime end; + BOOST_FOREACH (shared_ptr i, _content) { + if (dynamic_pointer_cast (i)) { + end = max (end, i->end ()); + } + } + + return end; +} + FrameRateChange Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const { @@ -354,9 +383,9 @@ Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const } void -Playlist::set_sequence_video (bool s) +Playlist::set_sequence (bool s) { - _sequence_video = s; + _sequence = s; } bool -- cgit v1.2.3