X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fstandard_controls.cc;h=a2914d77ba0727f866bf1b874e63e9babd2b50a2;hb=25eb7aa723af004162fc7f95995df250c4e4571b;hp=e73e2f6f6aa314dd20740fdda5056717b854d6b2;hpb=942f2c6ae6be33fb17ec46931bbe071a9d2e6f17;p=dcpomatic.git diff --git a/src/wx/standard_controls.cc b/src/wx/standard_controls.cc index e73e2f6f6..a2914d77b 100644 --- a/src/wx/standard_controls.cc +++ b/src/wx/standard_controls.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,12 +18,18 @@ */ -#include "standard_controls.h" + #include "film_viewer.h" -#include +#include "standard_controls.h" +#include +LIBDCP_DISABLE_WARNINGS #include +#include +LIBDCP_ENABLE_WARNINGS + + +using std::shared_ptr; -using boost::shared_ptr; StandardControls::StandardControls (wxWindow* parent, shared_ptr viewer, bool editor_controls) : Controls (parent, viewer, editor_controls) @@ -33,6 +39,7 @@ StandardControls::StandardControls (wxWindow* parent, shared_ptr vie _play_button->Bind (wxEVT_TOGGLEBUTTON, boost::bind(&StandardControls::play_clicked, this)); } + void StandardControls::started () { @@ -40,6 +47,7 @@ StandardControls::started () _play_button->SetValue (true); } + void StandardControls::stopped () { @@ -47,26 +55,30 @@ StandardControls::stopped () _play_button->SetValue (false); } + void StandardControls::play_clicked () { check_play_state (); } + void StandardControls::check_play_state () { - if (!_film || _film->video_frame_rate() == 0) { + auto viewer = _viewer.lock (); + if (!_film || _film->video_frame_rate() == 0 || !viewer) { return; } if (_play_button->GetValue()) { - _viewer->start (); + viewer->start (); } else { - _viewer->stop (); + viewer->stop (); } } + void StandardControls::setup_sensitivity () { @@ -75,6 +87,7 @@ StandardControls::setup_sensitivity () _play_button->Enable (_film && !_film->content().empty() && !active_job); } + void StandardControls::play () { @@ -82,6 +95,7 @@ StandardControls::play () play_clicked (); } + void StandardControls::stop () {