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;
33 * @brief A wx widget to view a preview of a Film.
35 * The film takes the following path through the viewer:
37 * 1. fetch_next_frame() asks our _player to decode some data. If it does, process_video()
40 * 2. process_video() takes the image from the player (_frame).
42 * 3. fetch_next_frame() calls _panel->Refresh() and _panel->Update() which results in
43 * paint_panel() being called; this creates frame_bitmap from _frame and blits it to the display.
45 * fetch_current_frame_again() asks the player to re-emit its current frame on the next pass(), and then
46 * starts from step #1.
48 class FilmViewer : public wxPanel
51 FilmViewer (boost::shared_ptr<Film>, wxWindow *);
53 void set_film (boost::shared_ptr<Film>);
57 void panel_sized (wxSizeEvent &);
61 void process_video (boost::shared_ptr<const Image>, Eyes, Time);
62 void calculate_sizes ();
63 void check_play_state ();
64 void fetch_current_frame_again ();
65 void fetch_next_frame ();
66 void active_jobs_changed (bool);
68 void forward_clicked ();
69 void player_changed (bool);
70 void set_position_text (Time);
72 boost::shared_ptr<Film> _film;
73 boost::shared_ptr<Player> _player;
78 wxButton* _back_button;
79 wxButton* _forward_button;
80 wxStaticText* _frame_number;
81 wxStaticText* _timecode;
82 wxToggleButton* _play_button;
85 boost::shared_ptr<const Image> _frame;
88 /** Size of our output (including padding if we have any) */
89 libdcp::Size _out_size;
90 /** Size of the panel that we have available */
91 libdcp::Size _panel_size;