Tidy up sized emissions from VideoView.
authorCarl Hetherington <cth@carlh.net>
Thu, 9 May 2019 16:59:10 +0000 (17:59 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 10 May 2019 22:43:55 +0000 (23:43 +0100)
src/wx/film_viewer.cc
src/wx/gl_video_view.cc
src/wx/simple_video_view.cc
src/wx/video_view.h

index 4066710e7e90936c5dbd86ca9d74293c4fc11c64..c83db56dec89279b75aab65e0ef24ea51df958e4 100644 (file)
@@ -106,9 +106,8 @@ FilmViewer::FilmViewer (wxWindow* p)
                break;
        }
 
-       /* XXX: maybe this should be proxied through the VideoView */
-       _video_view->get()->Bind (wxEVT_SIZE, boost::bind (&FilmViewer::video_view_sized, this));
-       _timer.Bind  (wxEVT_TIMER, boost::bind (&FilmViewer::timer, this));
+       _video_view->Sized.connect (boost::bind(&FilmViewer::video_view_sized, this));
+       _timer.Bind (wxEVT_TIMER, boost::bind(&FilmViewer::timer, this));
 
        set_film (shared_ptr<Film> ());
 
index f5b8ef68a3275b14d29f3d2c710eba50d090fef2..d1e7c7326e3d43a90554f28eb61163639e17ee29 100644 (file)
@@ -41,6 +41,7 @@ GLVideoView::GLVideoView (wxWindow *parent)
        _canvas = new wxGLCanvas (parent, wxID_ANY, 0, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE);
        _context = new wxGLContext (_canvas);
        _canvas->Bind (wxEVT_PAINT, boost::bind(&GLVideoView::paint, this, _1));
+       _canvas->Bind (wxEVT_SIZE, boost::bind(boost::ref(Sized)));
 
        glGenTextures (1, &_id);
        glBindTexture (GL_TEXTURE_2D, _id);
index 6435e0226b0bb9f0e41c77f11a5fddf957b655a2..d0b18d42102bcfa11462796243014bacc8824149 100644 (file)
@@ -40,6 +40,7 @@ SimpleVideoView::SimpleVideoView (FilmViewer* viewer, wxWindow* parent)
        _panel->SetBackgroundColour (*wxBLACK);
 
        _panel->Bind (wxEVT_PAINT, boost::bind (&SimpleVideoView::paint, this));
+       _panel->Bind (wxEVT_SIZE, boost::bind(boost::ref(Sized)));
 }
 
 void
index f4dec9c6873d8323a49fd9e51cd20a91012dcf8a..060d982f737c31499fb608f10d3145924a6dcb46 100644 (file)
@@ -22,6 +22,7 @@
 #define DCPOMATIC_VIDEO_VIEW_H
 
 #include <boost/shared_ptr.hpp>
+#include <boost/signals2.hpp>
 
 class Image;
 class wxWindow;
@@ -33,6 +34,8 @@ public:
 
        virtual void set_image (boost::shared_ptr<const Image> image) = 0;
        virtual wxWindow* get () const = 0;
+
+       boost::signals2::signal<void()> Sized;
 };
 
 #endif