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 4066710..c83db56 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 f5b8ef6..d1e7c73 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 6435e02..d0b18d4 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 f4dec9c..060d982 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