From 51468148d3dde7cb4be3dae6442e5ef6bcafda2b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 25 Nov 2016 21:01:18 +0000 Subject: [PATCH] Enable mysteriously disabled multi-selected-content edit of timing and fix a couple of problems with it (#1010). --- ChangeLog | 4 ++++ src/wx/content_panel.cc | 2 +- src/wx/timing_panel.cc | 20 +++++++++++++------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2d9aaf62..d983bca8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-11-25 Carl Hetherington + + * Allow multi-edit of content timing details (#1010). + 2016-11-23 Carl Hetherington * Fix crash on pressing enter in a crop control on Windows (#1009). diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 1b74f4c36..b67bdb4eb 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -397,7 +397,7 @@ ContentPanel::setup_sensitivity () _video_panel->Enable (video_selection.size() > 0 && _generally_sensitive); _audio_panel->Enable (audio_selection.size() > 0 && _generally_sensitive); _subtitle_panel->Enable (selection.size() == 1 && selection.front()->subtitle && _generally_sensitive); - _timing_panel->Enable (selection.size() == 1 && _generally_sensitive); + _timing_panel->Enable (_generally_sensitive); } void diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index a8ff247f9..bd4177ffb 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -317,19 +317,21 @@ TimingPanel::film_content_changed (int property) void TimingPanel::position_changed () { + DCPTime const pos = _position->get (_parent->film()->video_frame_rate ()); BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - i->set_position (_position->get (_parent->film()->video_frame_rate ())); + i->set_position (pos); } } void TimingPanel::full_length_changed () { + int const vfr = _parent->film()->video_frame_rate (); + Frame const len = _full_length->get (vfr).frames_round (vfr); BOOST_FOREACH (shared_ptr i, _parent->selected ()) { shared_ptr ic = dynamic_pointer_cast (i); if (ic && ic->still ()) { - int const vfr = _parent->film()->video_frame_rate (); - ic->video->set_length (_full_length->get (vfr).frames_round (vfr)); + ic->video->set_length (len); } } } @@ -344,6 +346,9 @@ TimingPanel::trim_start_changed () shared_ptr ref; optional ref_frc; optional ref_ph; + + ContentTime const trim = _trim_start->get (_parent->film()->video_frame_rate ()); + BOOST_FOREACH (shared_ptr i, _parent->selected ()) { if (i->position() <= ph && ph < i->end()) { /* The playhead is in i. Use it as a reference to work out @@ -355,7 +360,7 @@ TimingPanel::trim_start_changed () ref_ph = ph - i->position() + DCPTime (i->trim_start(), ref_frc.get()); } - i->set_trim_start (_trim_start->get (_parent->film()->video_frame_rate ())); + i->set_trim_start (trim); } if (ref) { @@ -370,8 +375,9 @@ TimingPanel::trim_end_changed () { _viewer->set_coalesce_player_changes (true); + ContentTime const trim = _trim_end->get (_parent->film()->video_frame_rate ()); BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - i->set_trim_end (_trim_end->get (_parent->film()->video_frame_rate ())); + i->set_trim_end (trim); } /* XXX: maybe playhead-off-the-end-of-the-film should be handled elsewhere */ @@ -385,11 +391,11 @@ TimingPanel::trim_end_changed () void TimingPanel::play_length_changed () { + DCPTime const play_length = _play_length->get (_parent->film()->video_frame_rate()); 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->get (_parent->film()->video_frame_rate()), frc) - - i->trim_start () + ContentTime (i->full_length() - play_length, frc) - i->trim_start () ); } } -- 2.30.2