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.cc
21 * @brief A wx widget to view a preview of a Film.
26 #include <wx/tglbtn.h>
28 #include "lib/format.h"
30 #include "lib/job_manager.h"
31 #include "lib/options.h"
32 #include "lib/subtitle.h"
33 #include "film_viewer.h"
35 #include "ffmpeg_player.h"
40 using boost::shared_ptr;
42 FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
44 , _player (new FFmpegPlayer (this))
46 wxBoxSizer* v_sizer = new wxBoxSizer (wxVERTICAL);
49 v_sizer->Add (_player->panel(), 1, wxEXPAND);
51 wxBoxSizer* h_sizer = new wxBoxSizer (wxHORIZONTAL);
52 h_sizer->Add (_player->play_button(), 0, wxEXPAND);
53 h_sizer->Add (_player->slider(), 1, wxEXPAND);
55 v_sizer->Add (h_sizer, 0, wxEXPAND);
61 FilmViewer::film_changed (Film::Property p)
68 _player->set_file (_film->content_path ());
73 Crop c = _film->crop ();
74 _player->set_left_crop (c.left);
75 _player->set_right_crop (c.right);
76 _player->set_top_crop (c.top);
77 _player->set_bottom_crop (c.bottom);
82 if (_film->format()) {
83 _player->set_ratio (_film->format()->ratio_as_float(_film));
93 FilmViewer::set_film (shared_ptr<Film> f)
105 _film->Changed.connect (bind (&FilmViewer::film_changed, this, _1));
106 film_changed (Film::CONTENT);
107 film_changed (Film::CROP);
108 film_changed (Film::FORMAT);