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 #include "dcp_range_dialog.h"
23 DCPRangeDialog::DCPRangeDialog (Film* f)
25 , _whole ("Whole film")
27 , _cut ("Cut remainder")
28 , _black_out ("Black-out remainder")
30 set_title ("DCP range");
32 Gtk::Table* table = Gtk::manage (new Gtk::Table ());
33 table->set_border_width (6);
34 table->set_row_spacings (6);
35 table->set_col_spacings (6);
36 table->attach (_whole, 0, 4, 0, 1);
37 table->attach (_first, 0, 1, 1, 2);
38 table->attach (_n_frames, 1, 2, 1, 2);
39 table->attach (*manage (new Gtk::Label ("frames")), 2, 3, 1, 2);
40 table->attach (_cut, 1, 2, 2, 3);
41 table->attach (_black_out, 1, 2, 3, 4);
43 Gtk::RadioButtonGroup g = _whole.get_group ();
46 g = _black_out.get_group ();
49 _n_frames.set_range (1, INT_MAX - 1);
50 _n_frames.set_increments (24, 24 * 60);
51 if (_film->dcp_frames() > 0) {
52 _whole.set_active (false);
53 _first.set_active (true);
54 _n_frames.set_value (_film->dcp_frames ());
56 _whole.set_active (true);
57 _first.set_active (false);
58 _n_frames.set_value (24);
61 _black_out.set_active (_film->dcp_trim_action() == BLACK_OUT);
62 _cut.set_active (_film->dcp_trim_action() == CUT);
64 _whole.signal_toggled().connect (sigc::mem_fun (*this, &DCPRangeDialog::whole_toggled));
65 _cut.signal_toggled().connect (sigc::mem_fun (*this, &DCPRangeDialog::cut_toggled));
66 _n_frames.signal_value_changed().connect (sigc::mem_fun (*this, &DCPRangeDialog::n_frames_changed));
68 get_vbox()->pack_start (*table);
70 add_button ("Close", Gtk::RESPONSE_CLOSE);
77 DCPRangeDialog::whole_toggled ()
84 DCPRangeDialog::set_sensitivity ()
86 _n_frames.set_sensitive (_first.get_active ());
87 _black_out.set_sensitive (_first.get_active ());
88 _cut.set_sensitive (_first.get_active ());
92 DCPRangeDialog::cut_toggled ()
98 DCPRangeDialog::n_frames_changed ()
104 DCPRangeDialog::emit_changed ()
107 if (!_whole.get_active ()) {
108 frames = _n_frames.get_value_as_int ();
111 TrimAction action = CUT;
112 if (_black_out.get_active ()) {
116 Changed (frames, action);