Move reel markers to the top of the timeline (#846).
[dcpomatic.git] / src / wx / film_viewer.h
index c6b5e7c0c5530ec871f4b04df919a48b97b83de8..04f8b9f7abcb2bfae7910d1d0ac6efbfe58ce62f 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include <wx/wx.h>
 #include "lib/film.h"
-#include "lib/decoder_factory.h"
 
 class wxToggleButton;
 class FFmpegPlayer;
 class Image;
 class RGBPlusAlphaImage;
-class Subtitle;
+class PlayerVideo;
 
 /** @class FilmViewer
  *  @brief A wx widget to view a preview of a Film.
@@ -37,46 +36,73 @@ class Subtitle;
 class FilmViewer : public wxPanel
 {
 public:
-       FilmViewer (boost::shared_ptr<Film>, wxWindow *);
+       FilmViewer (wxWindow *);
 
        void set_film (boost::shared_ptr<Film>);
 
+       DCPTime position () const {
+               return _position;
+       }
+
+       void set_position (DCPTime p);
+       void set_coalesce_player_changes (bool c);
+
+       void refresh ();
+
+       boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
+
 private:
-       void film_changed (Film::Property);
-       void paint_panel (wxPaintEvent &);
+       void paint_panel ();
        void panel_sized (wxSizeEvent &);
-       void slider_moved (wxScrollEvent &);
-       void play_clicked (wxCommandEvent &);
-       void timer (wxTimerEvent &);
-       void process_video (boost::shared_ptr<Image>, bool, boost::shared_ptr<Subtitle>);
+       void slider_moved ();
+       void play_clicked ();
+       void timer ();
        void calculate_sizes ();
        void check_play_state ();
-       void update_from_raw ();
-       void decoder_changed ();
-       void raw_to_display ();
-       void get_frame ();
-       void active_jobs_changed (bool);
+       void active_jobs_changed (boost::optional<std::string>);
+       void back_clicked ();
+       void forward_clicked ();
+       void player_changed (bool);
+       void update_position_label ();
+       void update_position_slider ();
+       void get (DCPTime, bool);
+       void refresh_panel ();
+       void setup_sensitivity ();
+       void film_changed (Film::Property);
 
        boost::shared_ptr<Film> _film;
+       boost::shared_ptr<Player> _player;
 
        wxSizer* _v_sizer;
        wxPanel* _panel;
+       wxCheckBox* _outline_content;
+       wxRadioButton* _left_eye;
+       wxRadioButton* _right_eye;
        wxSlider* _slider;
+       wxButton* _back_button;
+       wxButton* _forward_button;
+       wxStaticText* _frame_number;
+       wxStaticText* _timecode;
        wxToggleButton* _play_button;
        wxTimer _timer;
+       bool _coalesce_player_changes;
+       bool _pending_player_change;
 
-       Decoders _decoders;
-       boost::shared_ptr<Image> _raw_frame;
-       boost::shared_ptr<Subtitle> _raw_sub;
-       boost::shared_ptr<Image> _display_frame;
-       boost::shared_ptr<RGBPlusAlphaImage> _display_sub;
-       Position _display_sub_position;
-       bool _got_frame;
+       boost::shared_ptr<const Image> _frame;
+       DCPTime _position;
+       Position<int> _inter_position;
+       dcp::Size _inter_size;
 
-       int _out_width;
-       int _out_height;
-       int _panel_width;
-       int _panel_height;
+       /** Size of our output (including padding if we have any) */
+       dcp::Size _out_size;
+       /** Size of the panel that we have available */
+       dcp::Size _panel_size;
+       /** true if the last call to ::get() was specified to be accurate;
+        *  this is used so that when re-fetching the current frame we
+        *  can get the same one that we got last time.
+        */
+       bool _last_get_accurate;
 
-       bool _clear_required;
+       boost::signals2::scoped_connection _film_connection;
+       boost::signals2::scoped_connection _player_connection;
 };