2 Copyright (C) 2012-2013 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 #include "lib/content.h"
21 #include "lib/still_image_content.h"
22 #include "timing_panel.h"
25 #include "film_editor.h"
27 using boost::shared_ptr;
28 using boost::dynamic_pointer_cast;
30 TimingPanel::TimingPanel (FilmEditor* e)
31 : FilmEditorPanel (e, _("Timing"))
33 wxFlexGridSizer* grid = new wxFlexGridSizer (2, 4, 4);
34 _sizer->Add (grid, 0, wxALL, 8);
36 add_label_to_sizer (grid, this, _("Start time"), true);
37 _start = new Timecode (this);
39 add_label_to_sizer (grid, this, _("Length"), true);
40 _length = new Timecode (this);
43 _start->Changed.connect (boost::bind (&TimingPanel::start_changed, this));
44 _length->Changed.connect (boost::bind (&TimingPanel::length_changed, this));
48 TimingPanel::film_content_changed (shared_ptr<Content> content, int property)
50 if (property == ContentProperty::START) {
52 _start->set (content->start (), _editor->film()->dcp_video_frame_rate ());
56 } else if (property == ContentProperty::LENGTH) {
58 _length->set (content->length (), _editor->film()->dcp_video_frame_rate ());
66 TimingPanel::start_changed ()
68 shared_ptr<Content> c = _editor->selected_content ();
73 c->set_start (_start->get (_editor->film()->dcp_video_frame_rate ()));
77 TimingPanel::length_changed ()
79 shared_ptr<Content> c = _editor->selected_content ();
84 shared_ptr<StillImageContent> ic = dynamic_pointer_cast<StillImageContent> (c);
86 ic->set_video_length (_length->get (_editor->film()->dcp_video_frame_rate()) * ic->video_frame_rate() / TIME_HZ);