Fix play button behaviour.
authorCarl Hetherington <cth@carlh.net>
Mon, 10 Sep 2018 22:47:57 +0000 (23:47 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 11 Sep 2018 10:58:15 +0000 (11:58 +0100)
src/wx/control_film_viewer.cc
src/wx/control_film_viewer.h
src/wx/film_viewer.cc
src/wx/film_viewer.h

index 69b2b5b5cf29ecff55f3656113b85d5e2f8e87f6..739b02765d67ed7438485d2d550e52db15f72de5 100644 (file)
@@ -96,6 +96,8 @@ ControlFilmViewer::ControlFilmViewer (wxWindow* parent, bool outline_content, bo
 
        _viewer->ImageChanged.connect (boost::bind(&ControlFilmViewer::image_changed, this, _1));
        _viewer->PositionChanged.connect (boost::bind(&ControlFilmViewer::position_changed, this));
+       _viewer->Started.connect (boost::bind(&ControlFilmViewer::started, this));
+       _viewer->Stopped.connect (boost::bind(&ControlFilmViewer::stopped, this));
 
        set_film (shared_ptr<Film> ());
 
@@ -106,6 +108,18 @@ ControlFilmViewer::ControlFilmViewer (wxWindow* parent, bool outline_content, bo
                );
 }
 
+void
+ControlFilmViewer::started ()
+{
+       _play_button->SetValue (true);
+}
+
+void
+ControlFilmViewer::stopped ()
+{
+       _play_button->SetValue (false);
+}
+
 void
 ControlFilmViewer::position_changed ()
 {
@@ -380,14 +394,12 @@ ControlFilmViewer::show_closed_captions ()
 void
 ControlFilmViewer::start ()
 {
-       _play_button->SetValue (true);
        _viewer->start ();
 }
 
 bool
 ControlFilmViewer::stop ()
 {
-       _play_button->SetValue (false);
        return _viewer->stop ();
 }
 
index b3ad701d86996a952835406a8207da79ae2f99b6..cef5cb552b8a6d3db1c4fc9e51d897225d79e732 100644 (file)
@@ -58,6 +58,8 @@ private:
        void outline_content_changed ();
        void eye_changed ();
        void position_changed ();
+       void started ();
+       void stopped ();
 
        boost::shared_ptr<Film> _film;
        boost::shared_ptr<FilmViewer> _viewer;
index b7e414444f1baa3b55fb274c47445ea2c3bb24e4..85b0effbee8c223483f9d6bfbcc84ae1552b755a 100644 (file)
@@ -411,6 +411,7 @@ FilmViewer::start ()
        _playing = true;
        _dropped = 0;
        timer ();
+       Started ();
 }
 
 bool
@@ -426,6 +427,7 @@ FilmViewer::stop ()
        }
 
        _playing = false;
+       Stopped ();
        return true;
 }
 
index c68b6ade0b5b0bb63b28b0dcc333875ddd4f6917..d080c79a5957dd08b8639f81ef6c34736d264db9 100644 (file)
@@ -95,6 +95,8 @@ public:
 
        boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
        boost::signals2::signal<void ()> PositionChanged;
+       boost::signals2::signal<void ()> Started;
+       boost::signals2::signal<void ()> Stopped;
 
 private:
        void paint_panel ();