using boost::shared_ptr;
using boost::weak_ptr;
using boost::dynamic_pointer_cast;
+using namespace dcpomatic;
Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor_controls)
: wxPanel (parent)
_slider->Bind (wxEVT_SCROLL_PAGEUP, boost::bind(&Controls::slider_moved, this, true));
_slider->Bind (wxEVT_SCROLL_PAGEDOWN, boost::bind(&Controls::slider_moved, this, true));
_slider->Bind (wxEVT_SCROLL_CHANGED, boost::bind(&Controls::slider_released, this));
+#ifdef DCPOMATIC_OSX
+ /* _CHANGED is not received on OS X (at least, not when the
+ slider is dragged), so use this instead. Perhaps all
+ platforms could just use _THUMBRELEASE.
+ */
+ _slider->Bind (wxEVT_SCROLL_THUMBRELEASE, boost::bind(&Controls::slider_released, this));
+#endif
_rewind_button->Bind (wxEVT_LEFT_DOWN, boost::bind(&Controls::rewind_clicked, this, _1));
_back_button->Bind (wxEVT_LEFT_DOWN, boost::bind(&Controls::back_clicked, this, _1));
_forward_button->Bind (wxEVT_LEFT_DOWN, boost::bind(&Controls::forward_clicked, this, _1));
DCPTime t (_slider->GetValue() * _film->length().get() / 4096);
t = t.round (_film->video_frame_rate());
- /* Ensure that we hit the end of the film at the end of the slider */
+ /* Ensure that we hit the end of the film at the end of the slider. In particular, we
+ need to do an accurate seek in case there isn't a keyframe near the end.
+ */
+ bool accurate = false;
if (t >= _film->length ()) {
t = _film->length() - _viewer->one_video_frame();
+ accurate = true;
}
- _viewer->seek (t, false);
+ _viewer->seek (t, accurate);
update_position_label ();
log (
}
_film = film;
- _film_change_connection = _film->Change.connect (boost::bind(&Controls::film_change, this, _1, _2));
+
+ if (_film) {
+ _film_change_connection = _film->Change.connect (boost::bind(&Controls::film_change, this, _1, _2));
+ }
setup_sensitivity ();
void
Controls::film_change (ChangeType type, Film::Property p)
{
- if (type == CHANGE_TYPE_DONE && p == Film::CONTENT) {
- setup_sensitivity ();
- update_position_label ();
- update_position_slider ();
+ if (type == CHANGE_TYPE_DONE) {
+ if (p == Film::CONTENT) {
+ setup_sensitivity ();
+ update_position_label ();
+ update_position_slider ();
+ } else if (p == Film::THREE_D) {
+ setup_sensitivity ();
+ }
}
}