Hand-apply 6a3cd511559433554ab40ed72ff94b7d8dc2c5bd from master;
[dcpomatic.git] / src / wx / image_sequence_dialog.cc
1 /*
2     Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
3
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.
8
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.
13
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.
17
18 */
19
20 #include <libdcp/raw_convert.h>
21 #include "wx_util.h"
22 #include "image_sequence_dialog.h"
23
24 using libdcp::raw_convert;
25
26 ImageSequenceDialog::ImageSequenceDialog (wxWindow* parent)
27         : TableDialog (parent, _("Add image sequence"), 2, true)
28 {
29         add (_("Frame rate"), true);
30         _frame_rate = add (new wxTextCtrl (this, wxID_ANY, N_("24")));
31         _digest = new wxCheckBox (this, wxID_ANY, _("Calculate digests"));
32         _digest->SetValue (true);
33         _digest->SetToolTip (_("By default DCP-o-matic will calculate digests (hashes) of your image files so that it knows if they change.  Turning this off will speed up import but you must not alter the image files after import or strange things may happen."));
34         add (_digest);
35
36         layout ();
37 }
38
39 float
40 ImageSequenceDialog::frame_rate () const
41 {
42         try {
43                 return raw_convert<float> (wx_to_std (_frame_rate->GetValue ()));
44         } catch (...) {
45
46         }
47
48         return 0;
49 }
50
51 bool
52 ImageSequenceDialog::digest () const
53 {
54         return _digest->GetValue ();
55 }