/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "kdm_advanced_dialog.h"
#include "check_box.h"
+#include "wx_util.h"
+#include <wx/spinctrl.h>
-KDMAdvancedDialog::KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio)
+using boost::optional;
+
+KDMAdvancedDialog::KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio, optional<int> forensic_mark_audio_up_to)
: TableDialog (parent, _("Advanced KDM options"), 2, 1, false)
{
_forensic_mark_video = new CheckBox (this, _("Forensically mark video"));
add (_forensic_mark_audio);
add_spacer ();
+ _forensic_mark_all_audio = new wxRadioButton (this, wxID_ANY, _("Mark all audio channels"));
+ _table->Add (_forensic_mark_all_audio, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
+ add_spacer ();
+ wxBoxSizer* hbox = new wxBoxSizer (wxHORIZONTAL);
+ _forensic_mark_some_audio = new wxRadioButton (this, wxID_ANY, _("Mark audio channels up to (and including)"));
+ hbox->Add (_forensic_mark_some_audio, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
+ _forensic_mark_audio_up_to = new wxSpinCtrl (this, wxID_ANY);
+ hbox->Add (_forensic_mark_audio_up_to, 0, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
+ _table->Add (hbox, 0, wxLEFT, DCPOMATIC_SIZER_GAP);
+ add_spacer ();
+
+ if (forensic_mark_audio_up_to) {
+ _forensic_mark_audio_up_to->SetValue (*forensic_mark_audio_up_to);
+ _forensic_mark_some_audio->SetValue (true);
+ }
+
layout ();
+ setup_sensitivity ();
+
+ _forensic_mark_audio_up_to->SetRange (1, 15);
+ _forensic_mark_audio->Bind (wxEVT_CHECKBOX, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this));
+ _forensic_mark_all_audio->Bind (wxEVT_RADIOBUTTON, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this));
+ _forensic_mark_some_audio->Bind (wxEVT_RADIOBUTTON, boost::bind(&KDMAdvancedDialog::setup_sensitivity, this));
}
bool
{
return _forensic_mark_audio->GetValue ();
}
+
+optional<int>
+KDMAdvancedDialog::forensic_mark_audio_up_to () const
+{
+ if (!_forensic_mark_some_audio->GetValue()) {
+ return optional<int>();
+ }
+
+ return _forensic_mark_audio_up_to->GetValue();
+}
+
+void
+KDMAdvancedDialog::setup_sensitivity ()
+{
+ _forensic_mark_all_audio->Enable (_forensic_mark_audio->GetValue());
+ _forensic_mark_some_audio->Enable (_forensic_mark_audio->GetValue());
+ _forensic_mark_audio_up_to->Enable (_forensic_mark_audio->GetValue() && _forensic_mark_some_audio->GetValue());
+}
*/
#include "table_dialog.h"
+#include <boost/optional.hpp>
+
+class wxSpinCtrl;
class KDMAdvancedDialog : public TableDialog
{
public:
- KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio);
+ KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio, boost::optional<int> forensic_mark_audio_up_to);
bool forensic_mark_video () const;
bool forensic_mark_audio () const;
+ boost::optional<int> forensic_mark_audio_up_to () const;
private:
+ void setup_sensitivity ();
+
wxCheckBox* _forensic_mark_video;
wxCheckBox* _forensic_mark_audio;
+ wxRadioButton* _forensic_mark_all_audio;
+ wxRadioButton* _forensic_mark_some_audio;
+ wxSpinCtrl* _forensic_mark_audio_up_to;
};
/*
- Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
using std::runtime_error;
using boost::shared_ptr;
using boost::bind;
+using boost::optional;
KDMDialog::KDMDialog (wxWindow* parent, shared_ptr<const Film> film)
: wxDialog (parent, wxID_ANY, _("Make KDMs"))
list<shared_ptr<ScreenKDM> > screen_kdms;
try {
-
+ /* Start off by enabling forensic marking for all */
+ optional<int> for_audio;
+ if (!_output->forensic_mark_audio()) {
+ /* No forensic marking for audio */
+ for_audio = 0;
+ } else if (_output->forensic_mark_audio_up_to()) {
+ /* Forensic mark up to this channel; disabled on channels greater than this */
+ for_audio = _output->forensic_mark_audio_up_to();
+ }
screen_kdms = film->make_kdms (
_screens->screens(), _cpl->cpl(), _timing->from(), _timing->until(), _output->formulation(),
- !_output->forensic_mark_video(), _output->forensic_mark_audio() ? boost::optional<int>() : 0
+ !_output->forensic_mark_video(), for_audio
);
} catch (runtime_error& e) {
KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
: wxPanel (parent, wxID_ANY)
- , _forensic_mark_video (false)
- , _forensic_mark_audio (false)
+ , _forensic_mark_video (true)
+ , _forensic_mark_audio (true)
+ , _forensic_mark_audio_up_to (12)
{
wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0);
void
KDMOutputPanel::advanced_clicked ()
{
- KDMAdvancedDialog* d = new KDMAdvancedDialog (this, _forensic_mark_video, _forensic_mark_audio);
+ KDMAdvancedDialog* d = new KDMAdvancedDialog (this, _forensic_mark_video, _forensic_mark_audio, _forensic_mark_audio_up_to);
d->ShowModal ();
_forensic_mark_video = d->forensic_mark_video ();
_forensic_mark_audio = d->forensic_mark_audio ();
+ _forensic_mark_audio_up_to = d->forensic_mark_audio_up_to ();
d->Destroy ();
}
bool forensic_mark_audio () const {
return _forensic_mark_audio;
}
+ boost::optional<int> forensic_mark_audio_up_to () const {
+ return _forensic_mark_audio_up_to;
+ }
std::pair<boost::shared_ptr<Job>, int> make (
std::list<boost::shared_ptr<ScreenKDM> > screen_kdms,
wxCheckBox* _email;
bool _forensic_mark_video;
bool _forensic_mark_audio;
+ boost::optional<int> _forensic_mark_audio_up_to;
};