summaryrefslogtreecommitdiff
path: root/src/wx/timing_panel.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-11-09 00:22:46 +0000
committerCarl Hetherington <cth@carlh.net>2015-11-09 00:22:46 +0000
commitb6a281b4ba1d5e2b91ae3d54e073ee88308f61b6 (patch)
tree354ef21df18133fc3617fc4599093258093f1b4f /src/wx/timing_panel.cc
parent48f8d36316253f5ac05a6517ef08a66fa85a62fe (diff)
Keep current frame visible when trimming start. Don't trim the current
frame with "trim after current position" (#737).
Diffstat (limited to 'src/wx/timing_panel.cc')
-rw-r--r--src/wx/timing_panel.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc
index f05268f92..bb0547b9c 100644
--- a/src/wx/timing_panel.cc
+++ b/src/wx/timing_panel.cc
@@ -37,6 +37,7 @@ using std::string;
using std::set;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
+using boost::optional;
TimingPanel::TimingPanel (ContentPanel* p, FilmViewer* viewer)
/* horrid hack for apparent lack of context support with wxWidgets i18n code */
@@ -401,12 +402,23 @@ void
TimingPanel::trim_start_to_playhead_clicked ()
{
DCPTime const ph = _viewer->position ();
+ optional<DCPTime> new_ph;
+
+ _viewer->set_ignore_player_changes (true);
+
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
if (i->position() < ph && ph < i->end ()) {
FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ());
i->set_trim_start (i->trim_start() + ContentTime (ph - i->position (), frc));
+ new_ph = i->position ();
}
}
+
+ _viewer->set_ignore_player_changes (false);
+
+ if (new_ph) {
+ _viewer->set_position (new_ph.get());
+ }
}
void
@@ -416,7 +428,7 @@ TimingPanel::trim_end_to_playhead_clicked ()
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
if (i->position() < ph && ph < i->end ()) {
FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ());
- i->set_trim_end (ContentTime (i->position() + i->full_length() - ph, frc) - i->trim_start());
+ i->set_trim_end (ContentTime (i->position() + i->full_length() - ph - DCPTime::from_frames (1, frc.dcp), frc) - i->trim_start());
}
}