2 Copyright (C) 2018-2019 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include "check_box.h"
23 #include "kdm_advanced_dialog.h"
25 #include <dcp/warnings.h>
26 LIBDCP_DISABLE_WARNINGS
27 #include <wx/spinctrl.h>
28 LIBDCP_ENABLE_WARNINGS
31 using boost::optional;
34 KDMAdvancedDialog::KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio, optional<int> forensic_mark_audio_up_to)
35 : TableDialog (parent, _("Advanced KDM options"), 2, 1, false)
37 _forensic_mark_video = new CheckBox (this, _("Forensically mark video"));
38 _forensic_mark_video->SetValue (forensic_mark_video);
39 add (_forensic_mark_video);
41 _forensic_mark_audio = new CheckBox (this, _("Forensically mark audio"));
42 _forensic_mark_audio->SetValue (forensic_mark_audio);
43 add (_forensic_mark_audio);
46 _forensic_mark_all_audio = new wxRadioButton (this, wxID_ANY, _("Mark all audio channels"));
47 _table->Add (_forensic_mark_all_audio, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
49 wxBoxSizer* hbox = new wxBoxSizer (wxHORIZONTAL);
50 _forensic_mark_some_audio = new wxRadioButton (this, wxID_ANY, _("Mark audio channels up to (and including)"));
51 hbox->Add (_forensic_mark_some_audio, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
52 _forensic_mark_audio_up_to = new wxSpinCtrl (this, wxID_ANY);
53 hbox->Add (_forensic_mark_audio_up_to, 0, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
54 _table->Add (hbox, 0, wxLEFT, DCPOMATIC_SIZER_GAP);
57 if (forensic_mark_audio_up_to) {
58 _forensic_mark_audio_up_to->SetValue (*forensic_mark_audio_up_to);
59 _forensic_mark_some_audio->SetValue (true);
65 _forensic_mark_audio_up_to->SetRange (1, 15);
66 _forensic_mark_audio->bind(&KDMAdvancedDialog::setup_sensitivity, this);
67 _forensic_mark_all_audio->Bind (wxEVT_RADIOBUTTON, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this));
68 _forensic_mark_some_audio->Bind (wxEVT_RADIOBUTTON, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this));
72 KDMAdvancedDialog::forensic_mark_video () const
74 return _forensic_mark_video->GetValue ();
78 KDMAdvancedDialog::forensic_mark_audio () const
80 return _forensic_mark_audio->GetValue ();
84 KDMAdvancedDialog::forensic_mark_audio_up_to () const
86 if (!_forensic_mark_some_audio->GetValue()) {
87 return optional<int>();
90 return _forensic_mark_audio_up_to->GetValue();
94 KDMAdvancedDialog::setup_sensitivity ()
96 _forensic_mark_all_audio->Enable (_forensic_mark_audio->GetValue());
97 _forensic_mark_some_audio->Enable (_forensic_mark_audio->GetValue());
98 _forensic_mark_audio_up_to->Enable (_forensic_mark_audio->GetValue() && _forensic_mark_some_audio->GetValue());