Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor_controls)
: wxPanel (parent)
, _slider (new wxSlider (this, wxID_ANY, 0, 0, 4096))
, _viewer (viewer)
, _slider_being_moved (false)
Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor_controls)
: wxPanel (parent)
, _slider (new wxSlider (this, wxID_ANY, 0, 0, 4096))
, _viewer (viewer)
, _slider_being_moved (false)
, _forward_button (new Button (this, wxT(">")))
, _frame_number (new StaticText (this, wxT("")))
, _timecode (new StaticText (this, wxT("")))
, _forward_button (new Button (this, wxT(">")))
, _frame_number (new StaticText (this, wxT("")))
, _timecode (new StaticText (this, wxT("")))
time_sizer->Add (_timecode, 0, wxEXPAND);
h_sizer->Add (_rewind_button, 0, wxALL, 2);
time_sizer->Add (_timecode, 0, wxEXPAND);
h_sizer->Add (_rewind_button, 0, wxALL, 2);
h_sizer->Add (_forward_button, 0, wxALL, 2);
_button_sizer = new wxBoxSizer (wxHORIZONTAL);
h_sizer->Add (_forward_button, 0, wxALL, 2);
_button_sizer = new wxBoxSizer (wxHORIZONTAL);
_slider->Bind (wxEVT_SCROLL_THUMBTRACK, boost::bind(&Controls::slider_moved, this, false));
_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_THUMBTRACK, boost::bind(&Controls::slider_moved, this, false));
_slider->Bind (wxEVT_SCROLL_PAGEUP, boost::bind(&Controls::slider_moved, this, true));
_slider->Bind (wxEVT_SCROLL_PAGEDOWN, boost::bind(&Controls::slider_moved, this, true));
_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));
_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));
_viewer->Started.connect (boost::bind(&Controls::started, this));
_viewer->Stopped.connect (boost::bind(&Controls::stopped, this));
_viewer->Started.connect (boost::bind(&Controls::started, this));
_viewer->Stopped.connect (boost::bind(&Controls::stopped, this));
if (!page && !_slider_being_moved) {
/* This is the first event of a drag; stop playback for the duration of the drag */
if (!page && !_slider_being_moved) {
/* This is the first event of a drag; stop playback for the duration of the drag */
_slider_being_moved = true;
}
DCPTime t (_slider->GetValue() * _film->length().get() / 4096);
t = t.round (_film->video_frame_rate());
_slider_being_moved = true;
}
DCPTime t (_slider->GetValue() * _film->length().get() / 4096);
t = t.round (_film->video_frame_rate());
- _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));
+ }