X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ftimeline.cc;h=8ce811c28c3f668ea913008e16ce4c09fd631a21;hb=0a2d40420813403a96352c6dc895d23fcd9994c0;hp=de20705316d04419df7c389e04d02b28735f97f5;hpb=d2e8a683eed6fb82d4d255fffaf571ff27057132;p=dcpomatic.git diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index de2070531..8ce811c28 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -21,6 +21,7 @@ #include "timeline.h" #include "timeline_time_axis_view.h" #include "timeline_reels_view.h" +#include "timeline_labels_view.h" #include "timeline_video_content_view.h" #include "timeline_audio_content_view.h" #include "timeline_subtitle_content_view.h" @@ -32,6 +33,7 @@ #include "lib/timer.h" #include "lib/audio_content.h" #include "lib/subtitle_content.h" +#include "lib/video_content.h" #include #include #include @@ -53,6 +55,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr film) , _film (film) , _time_axis_view (new TimelineTimeAxisView (*this, 64)) , _reels_view (new TimelineReelsView (*this, 32)) + , _labels_view (new TimelineLabelsView (*this)) , _tracks (0) , _left_down (false) , _down_view_position (0) @@ -75,6 +78,8 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr film) SetMinSize (wxSize (640, tracks() * track_height() + 96)); + _tracks_position = Position (_labels_view->bbox().width, 32); + _film_changed_connection = film->Changed.connect (bind (&Timeline::film_changed, this, _1)); _film_content_changed_connection = film->ContentChanged.connect (bind (&Timeline::film_content_changed, this, _2, _3)); } @@ -89,6 +94,7 @@ Timeline::paint () return; } + gc->SetAntialiasMode (wxANTIALIAS_DEFAULT); BOOST_FOREACH (shared_ptr i, _views) { @@ -98,7 +104,8 @@ Timeline::paint () 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()) { + /* No overlap with non-content views, views no different tracks, audio views or non-active views */ + if (!ic || !jc || i == j || ic->track() != jc->track() || ic->track().get_value_or(2) >= 2 || !ic->active() || !jc->active()) { continue; } @@ -136,20 +143,19 @@ Timeline::recreate_views () _views.clear (); _views.push_back (_time_axis_view); _views.push_back (_reels_view); + _views.push_back (_labels_view); BOOST_FOREACH (shared_ptr i, film->content ()) { - if (dynamic_pointer_cast (i)) { + if (i->video) { _views.push_back (shared_ptr (new TimelineVideoContentView (*this, i))); } - shared_ptr ac = dynamic_pointer_cast (i); - if (ac && !ac->audio_mapping().mapped_output_channels().empty ()) { + if (i->audio && !i->audio->mapping().mapped_output_channels().empty ()) { _views.push_back (shared_ptr (new TimelineAudioContentView (*this, i))); } - shared_ptr sc = dynamic_pointer_cast (i); - if (sc && sc->has_subtitles ()) { - _views.push_back (shared_ptr (new TimelineSubtitleContentView (*this, sc))); + if (i->subtitle) { + _views.push_back (shared_ptr (new TimelineSubtitleContentView (*this, i))); } } @@ -163,7 +169,7 @@ Timeline::film_content_changed (int property, bool frequent) { ensure_ui_thread (); - if (property == AudioContentProperty::AUDIO_STREAMS) { + if (property == AudioContentProperty::STREAMS) { recreate_views (); } else if (!frequent) { setup_pixels_per_second (); @@ -188,19 +194,19 @@ Timeline::assign_tracks () } if (dynamic_pointer_cast (*i)) { - /* Video on track 0 */ - cv->set_track (0); - _tracks = max (_tracks, 1); + /* Video on tracks 0 and 1 (left and right eye) */ + cv->set_track (cv->content()->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT ? 1 : 0); + _tracks = max (_tracks, 2); continue; } else if (dynamic_pointer_cast (*i)) { - /* Subtitles on track 1 */ - cv->set_track (1); - _tracks = max (_tracks, 2); + /* Subtitles on track 2 */ + cv->set_track (2); + _tracks = max (_tracks, 3); continue; } - /* Audio on tracks 2 and up */ - int t = 2; + /* Audio on tracks 3 and up */ + int t = 3; shared_ptr content = cv->content(); DCPTimePeriod content_period (content->position(), content->end()); @@ -238,7 +244,7 @@ Timeline::assign_tracks () } _time_axis_view->set_y (tracks() * track_height() + 64); - _reels_view->set_y (tracks() * track_height() + 32); + _reels_view->set_y (8); } int @@ -255,7 +261,7 @@ Timeline::setup_pixels_per_second () return; } - _pixels_per_second = static_cast(width() - x_offset() * 2) / film->length().seconds (); + _pixels_per_second = static_cast(width() - tracks_position().x * 2) / film->length().seconds (); } shared_ptr