2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file src/film_viewer.h
21 * @brief A wx widget to view `thumbnails' of a Film.
30 class RGBPlusAlphaImage;
34 * @brief A wx widget to view a preview of a Film.
36 * The film takes the following path through the viewer:
38 * 1. fetch_next_frame() asks our _player to decode some data. If it does, process_video()
41 * 2. process_video() takes the image from the player (_frame).
43 * 3. fetch_next_frame() calls _panel->Refresh() and _panel->Update() which results in
44 * paint_panel() being called; this creates frame_bitmap from _frame and blits it to the display.
46 * fetch_current_frame_again() asks the player to re-emit its current frame on the next pass(), and then
47 * starts from step #1.
49 class FilmViewer : public wxPanel
52 FilmViewer (boost::shared_ptr<Film>, wxWindow *);
54 void set_film (boost::shared_ptr<Film>);
58 void panel_sized (wxSizeEvent &);
62 void process_video (boost::shared_ptr<PlayerImage>, Eyes, Time);
63 void calculate_sizes ();
64 void check_play_state ();
65 void fetch_current_frame_again ();
66 void fetch_next_frame ();
67 void active_jobs_changed (bool);
69 void forward_clicked ();
70 void player_changed (bool);
71 void set_position_text (Time);
73 boost::shared_ptr<Film> _film;
74 boost::shared_ptr<Player> _player;
79 wxButton* _back_button;
80 wxButton* _forward_button;
81 wxStaticText* _frame_number;
82 wxStaticText* _timecode;
83 wxToggleButton* _play_button;
86 boost::shared_ptr<const Image> _frame;
89 /** Size of our output (including padding if we have any) */
90 libdcp::Size _out_size;
91 /** Size of the panel that we have available */
92 libdcp::Size _panel_size;