Extract colours to VideoView.
[dcpomatic.git] / src / wx / simple_video_view.cc
index 2b86ea68884194b0711ee75e3a95bdf9d0b5f254..f5499ad9d4f6b93aa27113f7ed8d19992acd1abe 100644 (file)
@@ -32,7 +32,7 @@
 using std::max;
 using std::string;
 using boost::optional;
-using boost::shared_ptr;
+using std::shared_ptr;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
@@ -69,24 +69,24 @@ SimpleVideoView::paint ()
        if (!out_size.width || !out_size.height || !_image || out_size != _image->size()) {
                dc.Clear ();
        } else {
-
                wxImage frame (out_size.width, out_size.height, _image->data()[0], true);
                wxBitmap frame_bitmap (frame);
                dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2));
        }
 
+       auto pad = pad_colour();
+
        if (out_size.width < panel_size.GetWidth()) {
-               /* XXX: these colours are right for GNOME; may need adjusting for other OS */
-               wxPen   p (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
-               wxBrush b (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
+               wxPen   p (pad);
+               wxBrush b (pad);
                dc.SetPen (p);
                dc.SetBrush (b);
                dc.DrawRectangle (out_size.width, 0, panel_size.GetWidth() - out_size.width, panel_size.GetHeight());
        }
 
        if (out_size.height < panel_size.GetHeight()) {
-               wxPen   p (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
-               wxBrush b (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
+               wxPen   p (pad);
+               wxBrush b (pad);
                dc.SetPen (p);
                dc.SetBrush (b);
                int const gap = (panel_size.GetHeight() - out_size.height) / 2;
@@ -95,15 +95,15 @@ SimpleVideoView::paint ()
        }
 
        if (_viewer->outline_content()) {
-               wxPen p (wxColour (255, 0, 0), 2);
+               wxPen p (outline_content_colour(), 2);
                dc.SetPen (p);
                dc.SetBrush (*wxTRANSPARENT_BRUSH);
                dc.DrawRectangle (_inter_position.x, _inter_position.y + (panel_size.GetHeight() - out_size.height) / 2, _inter_size.width, _inter_size.height);
        }
 
-       optional<dcpomatic::Rect<double> > subs = _viewer->outline_subtitles();
+       auto subs = _viewer->outline_subtitles();
        if (subs) {
-               wxPen p (wxColour(0, 255, 0), 2);
+               wxPen p (outline_subtitles_colour(), 2);
                dc.SetPen (p);
                dc.SetBrush (*wxTRANSPARENT_BRUSH);
                dc.DrawRectangle (subs->x * out_size.width, subs->y * out_size.height, subs->width * out_size.width, subs->height * out_size.height);
@@ -129,7 +129,7 @@ SimpleVideoView::timer ()
        }
 
        display_next_frame (false);
-       DCPTime const next = position() + _viewer->one_video_frame();
+       auto const next = position() + _viewer->one_video_frame();
 
        if (next >= length()) {
                _viewer->finished ();
@@ -159,7 +159,7 @@ SimpleVideoView::start ()
 VideoView::NextFrameResult
 SimpleVideoView::display_next_frame (bool non_blocking)
 {
-       NextFrameResult const r = get_next_frame (non_blocking);
+       auto const r = get_next_frame (non_blocking);
        if (r != SUCCESS) {
                return r;
        }
@@ -213,7 +213,7 @@ SimpleVideoView::update ()
        _state_timer.set ("get image");
 
        set_image (
-               player_video().first->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VIDEO_RANGE_FULL, false, true)
+               player_video().first->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true)
                );
 
        _state_timer.set ("ImageChanged");