diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-11-09 00:22:46 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-11-09 00:22:46 +0000 |
| commit | b6a281b4ba1d5e2b91ae3d54e073ee88308f61b6 (patch) | |
| tree | 354ef21df18133fc3617fc4599093258093f1b4f /src | |
| parent | 48f8d36316253f5ac05a6517ef08a66fa85a62fe (diff) | |
Keep current frame visible when trimming start. Don't trim the current
frame with "trim after current position" (#737).
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/film_viewer.cc | 18 | ||||
| -rw-r--r-- | src/wx/film_viewer.h | 4 | ||||
| -rw-r--r-- | src/wx/timing_panel.cc | 14 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index ead1cf9ae..e3f76cbc7 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -70,6 +70,7 @@ FilmViewer::FilmViewer (wxWindow* p) , _frame_number (new wxStaticText (this, wxID_ANY, wxT(""))) , _timecode (new wxStaticText (this, wxID_ANY, wxT(""))) , _play_button (new wxToggleButton (this, wxID_ANY, _("Play"))) + , _ignore_player_changes (false) , _last_get_accurate (true) { #ifndef __WXOSX__ @@ -431,7 +432,7 @@ FilmViewer::forward_clicked () void FilmViewer::player_changed (bool frequent) { - if (frequent) { + if (frequent || _ignore_player_changes) { return; } @@ -469,3 +470,18 @@ FilmViewer::refresh () { get (_position, _last_get_accurate); } + +void +FilmViewer::set_position (DCPTime p) +{ + _position = p; + get (_position, true); + update_position_label (); + update_position_slider (); +} + +void +FilmViewer::set_ignore_player_changes (bool i) +{ + _ignore_player_changes = i; +} diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 4776d24b4..4c7e3ba33 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -44,6 +44,9 @@ public: return _position; } + void set_position (DCPTime p); + void set_ignore_player_changes (bool i); + void refresh (); boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged; @@ -80,6 +83,7 @@ private: wxStaticText* _timecode; wxToggleButton* _play_button; wxTimer _timer; + bool _ignore_player_changes; boost::shared_ptr<const Image> _frame; DCPTime _position; 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()); } } |
