X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fstandard_controls.cc;h=cef06d29cf695c1af92e8e9e1255b2fc7ac2b2f0;hb=b9a1ad3df5f9d85fb7439efd93fede72b9b078af;hp=c78844ca1bc3ddd14e1d463519b88d440ece9d42;hpb=dd9be86db6cde0afa5da0d1d1ac43b42e05dca26;p=dcpomatic.git diff --git a/src/wx/standard_controls.cc b/src/wx/standard_controls.cc index c78844ca1..cef06d29c 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,13 +18,19 @@ */ -#include "standard_controls.h" + #include "film_viewer.h" -#include +#include "standard_controls.h" +#include "lib/warnings.h" +DCPOMATIC_DISABLE_WARNINGS #include +#include +DCPOMATIC_ENABLE_WARNINGS + using std::shared_ptr; + StandardControls::StandardControls (wxWindow* parent, shared_ptr viewer, bool editor_controls) : Controls (parent, viewer, editor_controls) , _play_button (new wxToggleButton(this, wxID_ANY, _("Play"))) @@ -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 () {