/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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"
-class ThumbPanel;
+class wxToggleButton;
+class FFmpegPlayer;
+class Image;
+class RGBPlusAlphaImage;
+class PlayerVideo;
/** @class FilmViewer
- * @brief A wx widget to view `thumbnails' of a Film.
+ * @brief A wx widget to view a preview of a Film.
*/
class FilmViewer : public wxPanel
{
public:
- FilmViewer (Film *, wxWindow *);
+ FilmViewer (boost::shared_ptr<Film>, wxWindow *);
- void set_film (Film *);
- void setup_visibility ();
+ void set_film (boost::shared_ptr<Film>);
private:
- void slider_changed (wxCommandEvent &);
- void update_thumbs ();
- std::string format_position_slider_value (double) const;
- void load_thumbnail (int);
- void film_changed (Film::Property);
- void reload_current_thumbnail ();
- void update_scaled_pixbuf ();
- std::pair<int, int> scaled_pixbuf_size () const;
-// void scroller_size_allocate (Gtk::Allocation);
-
- Film* _film;
- wxBoxSizer* _sizer;
- ThumbPanel* _thumb_panel;
+ void paint_panel ();
+ void panel_sized (wxSizeEvent &);
+ void slider_moved ();
+ void play_clicked ();
+ void timer ();
+ void calculate_sizes ();
+ void check_play_state ();
+ void active_jobs_changed (bool);
+ void back_clicked ();
+ void forward_clicked ();
+ void player_changed (bool);
+ void set_position_text ();
+ void get (DCPTime, bool);
+
+ boost::shared_ptr<Film> _film;
+ boost::shared_ptr<Player> _player;
+
+ wxSizer* _v_sizer;
+ wxPanel* _panel;
wxSlider* _slider;
-// Gtk::VBox _vbox;
-// Gtk::ScrolledWindow _scroller;
-// Gtk::Image _image;
-// Glib::RefPtr<Gdk::Pixbuf> _pixbuf;
-// Glib::RefPtr<Gdk::Pixbuf> _cropped_pixbuf;
-// Glib::RefPtr<Gdk::Pixbuf> _scaled_pixbuf;
-// Gtk::HScale _position_slider;
-// Gtk::Allocation _last_scroller_allocation;
+ wxButton* _back_button;
+ wxButton* _forward_button;
+ wxStaticText* _frame_number;
+ wxStaticText* _timecode;
+ wxToggleButton* _play_button;
+ wxTimer _timer;
+
+ boost::shared_ptr<const Image> _frame;
+ DCPTime _position;
+
+ /** 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;
};