frame with "trim after current position" (#737).
+2015-11-09 Carl Hetherington <cth@carlh.net>
+
+ * Keep same frame visible after trimming content start (#737).
+
+ * Trim frames after the current one with "trim after current", leaving
+ the current frame in (#737).
+
2015-11-08 Carl Hetherington <cth@carlh.net>
* Fix bad layout in the audio tab (#738).
, _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__
void
FilmViewer::player_changed (bool frequent)
{
- if (frequent) {
+ if (frequent || _ignore_player_changes) {
return;
}
{
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;
+}
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;
wxStaticText* _timecode;
wxToggleButton* _play_button;
wxTimer _timer;
+ bool _ignore_player_changes;
boost::shared_ptr<const Image> _frame;
DCPTime _position;
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 */
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
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());
}
}