X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ftiming_panel.cc;h=bf987e51e1fc412483bce9a0a2a7e40f33716d7d;hb=df17bbd25da69fc38eb2dcd8b4a2531cf0bab0bc;hp=bd4177ffbaaae51f21926b9c3ebaedd31be44dfd;hpb=51468148d3dde7cb4be3dae6442e5ef6bcafda2b;p=dcpomatic.git diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index bd4177ffb..bf987e51e 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -26,10 +26,10 @@ #include "move_to_dialog.h" #include "lib/content.h" #include "lib/image_content.h" -#include "lib/subtitle_content.h" +#include "lib/text_content.h" #include "lib/dcp_subtitle_content.h" #include "lib/audio_content.h" -#include "lib/text_subtitle_content.h" +#include "lib/string_text_file_content.h" #include "lib/video_content.h" #include #include @@ -282,7 +282,7 @@ TimingPanel::film_content_changed (int property) ++count_ac; content = i; } - if (i->subtitle && i->video_frame_rate()) { + if (!i->caption.empty() && i->video_frame_rate()) { ++count_sc; content = i; } @@ -395,7 +395,7 @@ TimingPanel::play_length_changed () BOOST_FOREACH (shared_ptr i, _parent->selected ()) { FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ()); i->set_trim_end ( - ContentTime (i->full_length() - play_length, frc) - i->trim_start () + ContentTime (max(DCPTime(), i->full_length() - play_length), frc) - i->trim_start () ); } } @@ -409,9 +409,16 @@ TimingPanel::video_frame_rate_changed () void TimingPanel::set_video_frame_rate () { - double const fr = locale_convert (wx_to_std (_video_frame_rate->GetValue ())); + optional fr; + if (_video_frame_rate->GetValue() != wxT("")) { + fr = locale_convert (wx_to_std (_video_frame_rate->GetValue ())); + } BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - i->set_video_frame_rate (fr); + if (fr) { + i->set_video_frame_rate (*fr); + } else { + i->unset_video_frame_rate (); + } } _set_video_frame_rate->Enable (false); @@ -441,14 +448,15 @@ TimingPanel::film_changed (Film::Property p) void TimingPanel::trim_start_to_playhead_clicked () { - DCPTime const ph = _viewer->position (); + shared_ptr film = _parent->film (); + DCPTime const ph = _viewer->position().floor (film->video_frame_rate ()); optional new_ph; _viewer->set_coalesce_player_changes (true); BOOST_FOREACH (shared_ptr i, _parent->selected ()) { if (i->position() < ph && ph < i->end ()) { - FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ()); + FrameRateChange const frc = film->active_frame_rate_change (i->position ()); i->set_trim_start (i->trim_start() + ContentTime (ph - i->position (), frc)); new_ph = i->position (); } @@ -464,10 +472,11 @@ TimingPanel::trim_start_to_playhead_clicked () void TimingPanel::trim_end_to_playhead_clicked () { - DCPTime const ph = _viewer->position (); + shared_ptr film = _parent->film (); + DCPTime const ph = _viewer->position().floor (film->video_frame_rate ()); BOOST_FOREACH (shared_ptr i, _parent->selected ()) { if (i->position() < ph && ph < i->end ()) { - FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ()); + FrameRateChange const frc = film->active_frame_rate_change (i->position ()); i->set_trim_end (ContentTime (i->position() + i->full_length() - ph - DCPTime::from_frames (1, frc.dcp), frc) - i->trim_start()); } }