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/>.
21 #include "kdm_advanced_dialog.h"
22 #include "check_box.h"
24 #include <wx/spinctrl.h>
26 using boost::optional;
28 KDMAdvancedDialog::KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio, optional<int> forensic_mark_audio_up_to)
29 : TableDialog (parent, _("Advanced KDM options"), 2, 1, false)
31 _forensic_mark_video = new CheckBox (this, _("Forensically mark video"));
32 _forensic_mark_video->SetValue (forensic_mark_video);
33 add (_forensic_mark_video);
35 _forensic_mark_audio = new CheckBox (this, _("Forensically mark audio"));
36 _forensic_mark_audio->SetValue (forensic_mark_audio);
37 add (_forensic_mark_audio);
40 _forensic_mark_all_audio = new wxRadioButton (this, wxID_ANY, _("Mark all audio channels"));
41 _table->Add (_forensic_mark_all_audio, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
43 wxBoxSizer* hbox = new wxBoxSizer (wxHORIZONTAL);
44 _forensic_mark_some_audio = new wxRadioButton (this, wxID_ANY, _("Mark audio channels up to (and including)"));
45 hbox->Add (_forensic_mark_some_audio, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
46 _forensic_mark_audio_up_to = new wxSpinCtrl (this, wxID_ANY);
47 hbox->Add (_forensic_mark_audio_up_to, 0, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
48 _table->Add (hbox, 0, wxLEFT, DCPOMATIC_SIZER_GAP);
51 if (forensic_mark_audio_up_to) {
52 _forensic_mark_audio_up_to->SetValue (*forensic_mark_audio_up_to);
53 _forensic_mark_some_audio->SetValue (true);
59 _forensic_mark_audio_up_to->SetRange (1, 15);
60 _forensic_mark_audio->Bind (wxEVT_CHECKBOX, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this));
61 _forensic_mark_all_audio->Bind (wxEVT_RADIOBUTTON, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this));
62 _forensic_mark_some_audio->Bind (wxEVT_RADIOBUTTON, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this));
66 KDMAdvancedDialog::forensic_mark_video () const
68 return _forensic_mark_video->GetValue ();
72 KDMAdvancedDialog::forensic_mark_audio () const
74 return _forensic_mark_audio->GetValue ();
78 KDMAdvancedDialog::forensic_mark_audio_up_to () const
80 if (!_forensic_mark_some_audio->GetValue()) {
81 return optional<int>();
84 return _forensic_mark_audio_up_to->GetValue();
88 KDMAdvancedDialog::setup_sensitivity ()
90 _forensic_mark_all_audio->Enable (_forensic_mark_audio->GetValue());
91 _forensic_mark_some_audio->Enable (_forensic_mark_audio->GetValue());
92 _forensic_mark_audio_up_to->Enable (_forensic_mark_audio->GetValue() && _forensic_mark_some_audio->GetValue());