diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-10-13 11:30:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-10-13 11:30:30 +0100 |
| commit | 6f23b55a7783f93549115a133ca2e6e938bd0cd1 (patch) | |
| tree | 6c674d088eb37dd9d91992366cfa6ddb3e0e69e5 /src/wx | |
| parent | f9068dcbfbb09082e29e2a779ef1a7a2f6ee849e (diff) | |
Some attempts to block referencing of DCPs when it is not possible.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/audio_panel.cc | 21 | ||||
| -rw-r--r-- | src/wx/subtitle_panel.cc | 27 | ||||
| -rw-r--r-- | src/wx/timeline.cc | 15 | ||||
| -rw-r--r-- | src/wx/video_panel.cc | 21 |
4 files changed, 68 insertions, 16 deletions
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index a4976b8c1..9632b5235 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -141,6 +141,8 @@ AudioPanel::film_changed (Film::Property property) case Film::VIDEO_FRAME_RATE: setup_description (); break; + case Film::REEL_TYPE: + setup_sensitivity (); default: break; } @@ -238,7 +240,24 @@ void AudioPanel::setup_sensitivity () { AudioContentList sel = _parent->selected_audio (); - _reference->Enable (sel.size() == 1 && dynamic_pointer_cast<DCPContent> (sel.front ())); + + shared_ptr<DCPContent> dcp; + if (sel.size() == 1) { + dcp = dynamic_pointer_cast<DCPContent> (sel.front ()); + } + + list<string> why_not; + bool const can_reference = dcp && dcp->can_reference_audio (why_not); + _reference->Enable (can_reference); + + wxString s; + if (!can_reference) { + s = _("Cannot reference this DCP. "); + BOOST_FOREACH (string i, why_not) { + s += std_to_wx(i) + wxT(" "); + } + } + _reference->SetToolTip (s); if (_reference->GetValue ()) { _gain->wrapped()->Enable (false); diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc index f3083b194..757a302a1 100644 --- a/src/wx/subtitle_panel.cc +++ b/src/wx/subtitle_panel.cc @@ -36,6 +36,7 @@ using std::vector; using std::string; +using std::list; using boost::shared_ptr; using boost::lexical_cast; using boost::dynamic_pointer_cast; @@ -133,7 +134,7 @@ SubtitlePanel::SubtitlePanel (ContentPanel* p) void SubtitlePanel::film_changed (Film::Property property) { - if (property == Film::CONTENT) { + if (property == Film::CONTENT || property == Film::REEL_TYPE) { setup_sensitivity (); } } @@ -219,7 +220,8 @@ SubtitlePanel::setup_sensitivity () int ffmpeg_subs = 0; int subrip_or_dcp_subs = 0; int image_subs = 0; - BOOST_FOREACH (shared_ptr<SubtitleContent> i, _parent->selected_subtitle ()) { + SubtitleContentList sel = _parent->selected_subtitle (); + BOOST_FOREACH (shared_ptr<SubtitleContent> i, sel) { shared_ptr<const FFmpegContent> fc = boost::dynamic_pointer_cast<const FFmpegContent> (i); shared_ptr<const SubRipContent> sc = boost::dynamic_pointer_cast<const SubRipContent> (i); shared_ptr<const DCPSubtitleContent> dsc = boost::dynamic_pointer_cast<const DCPSubtitleContent> (i); @@ -242,6 +244,24 @@ SubtitlePanel::setup_sensitivity () } } + shared_ptr<DCPContent> dcp; + if (sel.size() == 1) { + dcp = dynamic_pointer_cast<DCPContent> (sel.front ()); + } + + list<string> why_not; + bool const can_reference = dcp && dcp->can_reference_subtitle (why_not); + _reference->Enable (can_reference); + + wxString s; + if (!can_reference) { + s = _("Cannot reference this DCP. "); + BOOST_FOREACH (string i, why_not) { + s += std_to_wx(i) + wxT(" "); + } + } + _reference->SetToolTip (s); + bool const reference = _reference->GetValue (); _use->Enable (!reference && any_subs > 0); @@ -255,9 +275,6 @@ SubtitlePanel::setup_sensitivity () _stream->Enable (!reference && ffmpeg_subs == 1); _subtitle_view_button->Enable (!reference && subrip_or_dcp_subs == 1); _fonts_dialog_button->Enable (!reference && subrip_or_dcp_subs == 1); - - ContentList sel = _parent->selected (); - _reference->Enable (sel.size() == 1 && dynamic_pointer_cast<DCPContent> (sel.front ())); } void diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index c1afdd369..f91d2937f 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -168,6 +168,7 @@ Timeline::assign_tracks () } shared_ptr<Content> content = cv->content(); + DCPTimePeriod content_period (content->position(), content->end()); int t = 0; while (true) { @@ -182,11 +183,7 @@ Timeline::assign_tracks () shared_ptr<Content> test_content = test->content(); if (test && test->track() && test->track().get() == t) { - bool const no_overlap = - (content->position() < test_content->position() && content->end() < test_content->position()) || - (content->position() > test_content->end() && content->end() > test_content->end()); - - if (!no_overlap) { + if (content_period.overlaps (DCPTimePeriod(test_content->position(), test_content->end()))) { /* we have an overlap on track `t' */ ++t; break; @@ -367,7 +364,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) if (_snap) { - DCPTime const new_end = new_position + _down_view->content()->length_after_trim () - DCPTime (1); + DCPTime const new_end = new_position + _down_view->content()->length_after_trim(); /* Signed `distance' to nearest thing (i.e. negative is left on the timeline, positive is right). */ @@ -381,9 +378,9 @@ Timeline::set_position_from_event (wxMouseEvent& ev) } maybe_snap (cv->content()->position(), new_position, nearest_distance); - maybe_snap (cv->content()->position(), new_end + DCPTime (1), nearest_distance); - maybe_snap (cv->content()->end() + DCPTime (1), new_position, nearest_distance); - maybe_snap (cv->content()->end() + DCPTime (1), new_end, nearest_distance); + maybe_snap (cv->content()->position(), new_end, nearest_distance); + maybe_snap (cv->content()->end(), new_position, nearest_distance); + maybe_snap (cv->content()->end(), new_end, nearest_distance); } if (nearest_distance) { diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index dd9bb5848..79ea9dbfa 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -246,6 +246,8 @@ VideoPanel::film_changed (Film::Property property) case Film::RESOLUTION: setup_description (); break; + case Film::REEL_TYPE: + setup_sensitivity (); default: break; } @@ -434,7 +436,24 @@ void VideoPanel::setup_sensitivity () { ContentList sel = _parent->selected (); - _reference->Enable (sel.size() == 1 && dynamic_pointer_cast<DCPContent> (sel.front ())); + + shared_ptr<DCPContent> dcp; + if (sel.size() == 1) { + dcp = dynamic_pointer_cast<DCPContent> (sel.front ()); + } + + list<string> why_not; + bool const can_reference = dcp && dcp->can_reference_video(why_not); + _reference->Enable (can_reference); + + wxString s; + if (!can_reference) { + s = _("Cannot reference this DCP. "); + BOOST_FOREACH (string i, why_not) { + s += std_to_wx(i) + wxT(" "); + } + } + _reference->SetToolTip (s); if (_reference->GetValue ()) { _frame_type->wrapped()->Enable (false); |
