2 Copyright (C) 2012-2018 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 "dcp_panel.h"
23 #include "key_dialog.h"
24 #include "isdcf_metadata_dialog.h"
25 #include "audio_dialog.h"
26 #include "focus_manager.h"
27 #include "check_box.h"
28 #include "static_text.h"
29 #include "check_box.h"
30 #include "dcpomatic_button.h"
31 #include "lib/ratio.h"
32 #include "lib/config.h"
33 #include "lib/dcp_content_type.h"
36 #include "lib/ffmpeg_content.h"
37 #include "lib/audio_processor.h"
38 #include "lib/video_content.h"
39 #include "lib/text_content.h"
40 #include "lib/dcp_content.h"
41 #include "lib/audio_content.h"
42 #include <dcp/locale_convert.h>
45 #include <wx/notebook.h>
46 #include <wx/gbsizer.h>
47 #include <wx/spinctrl.h>
48 #include <boost/lexical_cast.hpp>
49 #include <boost/foreach.hpp>
59 using boost::lexical_cast;
60 using boost::shared_ptr;
61 using dcp::locale_convert;
63 DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
66 , _generally_sensitive (true)
68 _panel = new wxPanel (n);
69 _sizer = new wxBoxSizer (wxVERTICAL);
70 _panel->SetSizer (_sizer);
72 _grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
73 _sizer->Add (_grid, 0, wxEXPAND | wxALL, 8);
75 _name_label = create_label (_panel, _("Name"), true);
76 _name = new wxTextCtrl (_panel, wxID_ANY);
77 FocusManager::instance()->add(_name);
79 _use_isdcf_name = new CheckBox (_panel, _("Use ISDCF name"));
80 _edit_isdcf_button = new Button (_panel, _("Details..."));
81 _copy_isdcf_name_button = new Button (_panel, _("Copy as name"));
83 /* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see
84 http://trac.wxwidgets.org/ticket/12539
86 _dcp_name = new StaticText (
87 _panel, wxT (""), wxDefaultPosition, wxDefaultSize,
88 wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE
91 _dcp_content_type_label = create_label (_panel, _("Content Type"), true);
92 _dcp_content_type = new wxChoice (_panel, wxID_ANY);
94 _signed = new CheckBox (_panel, _("Signed"));
95 _encrypted = new CheckBox (_panel, _("Encrypted"));
97 wxClientDC dc (_panel);
98 wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
101 _key_label = create_label (_panel, _("Key"), true);
102 _key = new StaticText (_panel, "", wxDefaultPosition, size);
103 _edit_key = new Button (_panel, _("Edit..."));
105 _reels_label = create_label (_panel, _("Reels"), true);
106 _reel_type = new wxChoice (_panel, wxID_ANY);
108 _reel_length_label = create_label (_panel, _("Reel length"), true);
109 _reel_length = new wxSpinCtrl (_panel, wxID_ANY);
110 _reel_length_gb_label = create_label (_panel, _("GB"), false);
112 _standard_label = create_label (_panel, _("Standard"), true);
113 _standard = new wxChoice (_panel, wxID_ANY);
115 _upload_after_make_dcp = new CheckBox (_panel, _("Upload DCP to TMS after it is made"));
117 _notebook = new wxNotebook (_panel, wxID_ANY);
118 _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
120 _notebook->AddPage (make_video_panel (), _("Video"), false);
121 _notebook->AddPage (make_audio_panel (), _("Audio"), false);
123 _name->Bind (wxEVT_TEXT, boost::bind (&DCPPanel::name_changed, this));
124 _use_isdcf_name->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
125 _edit_isdcf_button->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
126 _copy_isdcf_name_button->Bind(wxEVT_BUTTON, boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
127 _dcp_content_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::dcp_content_type_changed, this));
128 _signed->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::signed_toggled, this));
129 _encrypted->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::encrypted_toggled, this));
130 _edit_key->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::edit_key_clicked, this));
131 _reel_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::reel_type_changed, this));
132 _reel_length->Bind (wxEVT_SPINCTRL, boost::bind (&DCPPanel::reel_length_changed, this));
133 _standard->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::standard_changed, this));
134 _upload_after_make_dcp->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::upload_after_make_dcp_changed, this));
136 BOOST_FOREACH (DCPContentType const * i, DCPContentType::all()) {
137 _dcp_content_type->Append (std_to_wx (i->pretty_name ()));
140 _reel_type->Append (_("Single reel"));
141 _reel_type->Append (_("Split by video content"));
142 /// TRANSLATORS: translate the word "Custom" here; do not include the "Reel|" prefix
143 _reel_type->Append (S_("Reel|Custom"));
145 _reel_length->SetRange (1, 64);
147 _standard->Append (_("SMPTE"));
148 _standard->Append (_("Interop"));
150 Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this, _1));
156 DCPPanel::add_to_grid ()
158 Config::Interface interface = Config::instance()->interface_complexity ();
162 add_label_to_sizer (_grid, _name_label, true, wxGBPosition (r, 0));
163 _grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
166 int flags = wxALIGN_CENTER_VERTICAL;
168 flags |= wxALIGN_RIGHT;
171 bool const full = interface == Config::INTERFACE_FULL;
173 _use_isdcf_name->Show (full);
174 _edit_isdcf_button->Show (full);
175 _copy_isdcf_name_button->Show (full);
178 _grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
180 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
181 s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
182 s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
183 _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
188 _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
191 add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition (r, 0));
192 _grid->Add (_dcp_content_type, wxGBPosition (r, 1));
195 _signed->Show (full);
197 _grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
201 _grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
205 _key_label->Show (full);
207 _edit_key->Show (full);
208 _reels_label->Show (full);
209 _reel_type->Show (full);
210 _reel_length_label->Show (full);
211 _reel_length->Show (full);
212 _reel_length_gb_label->Show (full);
213 _standard_label->Show (full);
214 _standard->Show (full);
215 _upload_after_make_dcp->Show (full);
216 _reencode_j2k->Show (full);
217 _encrypted->Show (full);
220 add_label_to_sizer (_grid, _key_label, true, wxGBPosition (r, 0));
222 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
223 s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
225 _grid->Add (s, wxGBPosition (r, 1));
229 add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
230 _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
233 add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition (r, 0));
235 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
236 s->Add (_reel_length);
237 add_label_to_sizer (s, _reel_length_gb_label, false);
238 _grid->Add (s, wxGBPosition (r, 1));
242 add_label_to_sizer (_grid, _standard_label, true, wxGBPosition (r, 0));
243 _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
246 _grid->Add (_upload_after_make_dcp, wxGBPosition (r, 0), wxGBSpan (1, 2));
252 DCPPanel::edit_key_clicked ()
254 KeyDialog* d = new KeyDialog (_panel, _film->key ());
255 if (d->ShowModal () == wxID_OK) {
256 _film->set_key (d->key ());
262 DCPPanel::name_changed ()
268 _film->set_name (string (_name->GetValue().mb_str()));
272 DCPPanel::j2k_bandwidth_changed ()
278 _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
282 DCPPanel::signed_toggled ()
288 _film->set_signed (_signed->GetValue ());
292 DCPPanel::encrypted_toggled ()
298 _film->set_encrypted (_encrypted->GetValue ());
301 /** Called when the frame rate choice widget has been changed */
303 DCPPanel::frame_rate_choice_changed ()
309 _film->set_video_frame_rate (
310 boost::lexical_cast<int> (
311 wx_to_std (_frame_rate_choice->GetString (_frame_rate_choice->GetSelection ()))
316 /** Called when the frame rate spin widget has been changed */
318 DCPPanel::frame_rate_spin_changed ()
324 _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
328 DCPPanel::audio_channels_changed ()
334 _film->set_audio_channels (locale_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
338 DCPPanel::resolution_changed ()
344 _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
348 DCPPanel::standard_changed ()
354 _film->set_interop (_standard->GetSelection() == 1);
358 DCPPanel::upload_after_make_dcp_changed ()
364 _film->set_upload_after_make_dcp (_upload_after_make_dcp->GetValue ());
368 DCPPanel::film_changed (int p)
373 case Film::CONTAINER:
377 checked_set (_name, _film->name());
380 case Film::DCP_CONTENT_TYPE:
381 checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
385 checked_set (_signed, _film->is_signed ());
387 case Film::ENCRYPTED:
388 checked_set (_encrypted, _film->encrypted ());
389 if (_film->encrypted ()) {
390 _film->set_signed (true);
391 _signed->Enable (false);
392 _key->Enable (_generally_sensitive);
393 _edit_key->Enable (_generally_sensitive);
395 _signed->Enable (_generally_sensitive);
396 _key->Enable (false);
397 _edit_key->Enable (false);
401 checked_set (_key, _film->key().hex().substr (0, 8) + "...");
403 case Film::RESOLUTION:
404 checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
408 case Film::J2K_BANDWIDTH:
409 checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
411 case Film::USE_ISDCF_NAME:
413 checked_set (_use_isdcf_name, _film->use_isdcf_name ());
415 _edit_isdcf_button->Enable (_film->use_isdcf_name ());
418 case Film::ISDCF_METADATA:
421 case Film::VIDEO_FRAME_RATE:
424 for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
425 if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
426 checked_set (_frame_rate_choice, i);
433 checked_set (_frame_rate_choice, -1);
436 checked_set (_frame_rate_spin, _film->video_frame_rate ());
438 _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
442 case Film::AUDIO_CHANNELS:
443 if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
444 _film->set_audio_channels (minimum_allowed_audio_channels ());
446 checked_set (_audio_channels, locale_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
451 checked_set (_three_d, _film->three_d ());
454 case Film::REENCODE_J2K:
455 checked_set (_reencode_j2k, _film->reencode_j2k());
458 checked_set (_standard, _film->interop() ? 1 : 0);
461 case Film::AUDIO_PROCESSOR:
462 if (_film->audio_processor ()) {
463 checked_set (_audio_processor, _film->audio_processor()->id());
465 checked_set (_audio_processor, 0);
467 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
468 film_changed (Film::AUDIO_CHANNELS);
470 case Film::REEL_TYPE:
471 checked_set (_reel_type, _film->reel_type ());
472 _reel_length->Enable (_film->reel_type() == REELTYPE_BY_LENGTH);
474 case Film::REEL_LENGTH:
475 checked_set (_reel_length, _film->reel_length() / 1000000000LL);
477 case Film::UPLOAD_AFTER_MAKE_DCP:
478 checked_set (_upload_after_make_dcp, _film->upload_after_make_dcp ());
489 DCPPanel::film_content_changed (int property)
491 if (property == AudioContentProperty::STREAMS ||
492 property == TextContentProperty::USE ||
493 property == TextContentProperty::BURN ||
494 property == VideoContentProperty::SCALE ||
495 property == DCPContentProperty::REFERENCE_VIDEO ||
496 property == DCPContentProperty::REFERENCE_AUDIO ||
497 property == DCPContentProperty::REFERENCE_TEXT) {
499 setup_sensitivity ();
505 DCPPanel::setup_container ()
508 vector<Ratio const *> ratios = Ratio::containers ();
509 vector<Ratio const *>::iterator i = ratios.begin ();
510 while (i != ratios.end() && *i != _film->container ()) {
515 if (i == ratios.end()) {
516 checked_set (_container, -1);
517 checked_set (_container_size, wxT (""));
519 checked_set (_container, n);
520 dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
521 checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height));
527 /** Called when the container widget has been changed */
529 DCPPanel::container_changed ()
535 int const n = _container->GetSelection ();
537 vector<Ratio const *> ratios = Ratio::containers ();
538 DCPOMATIC_ASSERT (n < int (ratios.size()));
539 _film->set_container (ratios[n]);
543 /** Called when the DCP content type widget has been changed */
545 DCPPanel::dcp_content_type_changed ()
551 int const n = _dcp_content_type->GetSelection ();
552 if (n != wxNOT_FOUND) {
553 _film->set_dcp_content_type (DCPContentType::from_index (n));
558 DCPPanel::set_film (shared_ptr<Film> film)
560 /* We are changing film, so destroy any audio dialog for the old one */
562 _audio_dialog->Destroy ();
568 film_changed (Film::NAME);
569 film_changed (Film::USE_ISDCF_NAME);
570 film_changed (Film::CONTENT);
571 film_changed (Film::DCP_CONTENT_TYPE);
572 film_changed (Film::CONTAINER);
573 film_changed (Film::RESOLUTION);
574 film_changed (Film::SIGNED);
575 film_changed (Film::ENCRYPTED);
576 film_changed (Film::KEY);
577 film_changed (Film::J2K_BANDWIDTH);
578 film_changed (Film::ISDCF_METADATA);
579 film_changed (Film::VIDEO_FRAME_RATE);
580 film_changed (Film::AUDIO_CHANNELS);
581 film_changed (Film::SEQUENCE);
582 film_changed (Film::THREE_D);
583 film_changed (Film::INTEROP);
584 film_changed (Film::AUDIO_PROCESSOR);
585 film_changed (Film::REEL_TYPE);
586 film_changed (Film::REEL_LENGTH);
587 film_changed (Film::UPLOAD_AFTER_MAKE_DCP);
588 film_changed (Film::REENCODE_J2K);
590 set_general_sensitivity(static_cast<bool>(_film));
594 DCPPanel::set_general_sensitivity (bool s)
596 _generally_sensitive = s;
597 setup_sensitivity ();
601 DCPPanel::setup_sensitivity ()
603 _name->Enable (_generally_sensitive);
604 _use_isdcf_name->Enable (_generally_sensitive);
605 _edit_isdcf_button->Enable (_generally_sensitive);
606 _dcp_content_type->Enable (_generally_sensitive);
607 _copy_isdcf_name_button->Enable (_generally_sensitive);
609 bool si = _generally_sensitive;
610 if (_film && _film->encrypted ()) {
613 _signed->Enable (si);
615 _encrypted->Enable (_generally_sensitive);
616 _key->Enable (_generally_sensitive && _film && _film->encrypted ());
617 _edit_key->Enable (_generally_sensitive && _film && _film->encrypted ());
618 _reel_type->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
619 _reel_length->Enable (_generally_sensitive && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
620 _upload_after_make_dcp->Enable (_generally_sensitive);
621 _frame_rate_choice->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
622 _frame_rate_spin->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
623 _audio_channels->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
624 _audio_processor->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
625 _j2k_bandwidth->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
626 _container->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
627 _best_frame_rate->Enable (_generally_sensitive && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
628 _resolution->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
629 _three_d->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
630 _standard->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
634 DCPPanel::use_isdcf_name_toggled ()
640 _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
644 DCPPanel::edit_isdcf_button_clicked ()
650 ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
652 _film->set_isdcf_metadata (d->isdcf_metadata ());
657 DCPPanel::setup_dcp_name ()
659 _dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
660 _dcp_name->SetToolTip (std_to_wx (_film->dcp_name (true)));
664 DCPPanel::best_frame_rate_clicked ()
670 _film->set_video_frame_rate (_film->best_video_frame_rate ());
674 DCPPanel::three_d_changed ()
680 _film->set_three_d (_three_d->GetValue ());
684 DCPPanel::reencode_j2k_changed ()
690 _film->set_reencode_j2k (_reencode_j2k->GetValue());
694 DCPPanel::config_changed (Config::Property p)
696 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
697 setup_frame_rate_widget ();
699 if (p == Config::INTERFACE_COMPLEXITY) {
705 _video_grid->Clear ();
706 add_video_panel_to_grid ();
707 _video_grid->Layout ();
709 _audio_grid->Clear ();
710 add_audio_panel_to_grid ();
711 _audio_grid->Layout ();
716 DCPPanel::setup_frame_rate_widget ()
718 if (Config::instance()->allow_any_dcp_frame_rate ()) {
719 _frame_rate_choice->Hide ();
720 _frame_rate_spin->Show ();
722 _frame_rate_choice->Show ();
723 _frame_rate_spin->Hide ();
726 _frame_rate_sizer->Layout ();
730 DCPPanel::make_video_panel ()
732 wxPanel* panel = new wxPanel (_notebook);
733 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
734 _video_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
735 sizer->Add (_video_grid, 0, wxALL, 8);
736 panel->SetSizer (sizer);
738 _container_label = create_label (panel, _("Container"), true);
739 _container = new wxChoice (panel, wxID_ANY);
740 _container_size = new StaticText (panel, wxT (""));
742 _resolution_label = create_label (panel, _("Resolution"), true);
743 _resolution = new wxChoice (panel, wxID_ANY);
745 _frame_rate_label = create_label (panel, _("Frame Rate"), true);
746 _frame_rate_choice = new wxChoice (panel, wxID_ANY);
747 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
748 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
749 _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY);
750 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
751 setup_frame_rate_widget ();
752 _best_frame_rate = new Button (panel, _("Use best"));
753 _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
755 _three_d = new CheckBox (panel, _("3D"));
757 _j2k_bandwidth_label = create_label (panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true);
758 _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
759 _mbits_label = create_label (panel, _("Mbit/s"), false);
761 _reencode_j2k = new CheckBox (panel, _("Re-encode JPEG2000 data from input"));
763 _container->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::container_changed, this));
764 _frame_rate_choice->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::frame_rate_choice_changed, this));
765 _frame_rate_spin->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::frame_rate_spin_changed, this));
766 _best_frame_rate->Bind (wxEVT_BUTTON, boost::bind(&DCPPanel::best_frame_rate_clicked, this));
767 _j2k_bandwidth->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
768 /* Also listen to wxEVT_TEXT so that typing numbers directly in is always noticed */
769 _j2k_bandwidth->Bind (wxEVT_TEXT, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
770 _resolution->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::resolution_changed, this));
771 _three_d->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::three_d_changed, this));
772 _reencode_j2k->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::reencode_j2k_changed, this));
774 BOOST_FOREACH (Ratio const * i, Ratio::containers()) {
775 _container->Append (std_to_wx(i->container_nickname()));
778 BOOST_FOREACH (int i, Config::instance()->allowed_dcp_frame_rates()) {
779 _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (i)));
782 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
783 _frame_rate_spin->SetRange (1, 480);
785 _resolution->Append (_("2K"));
786 _resolution->Append (_("4K"));
788 add_video_panel_to_grid ();
794 DCPPanel::add_video_panel_to_grid ()
796 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
800 add_label_to_sizer (_video_grid, _container_label, true, wxGBPosition (r, 0));
802 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
803 s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
804 s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
805 _video_grid->Add (s, wxGBPosition(r, 1));
809 add_label_to_sizer (_video_grid, _resolution_label, true, wxGBPosition (r, 0));
810 _video_grid->Add (_resolution, wxGBPosition (r, 1));
813 add_label_to_sizer (_video_grid, _frame_rate_label, true, wxGBPosition (r, 0));
815 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
816 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
817 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
818 _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
819 _video_grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
823 _video_grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
826 _j2k_bandwidth_label->Show (full);
827 _j2k_bandwidth->Show (full);
828 _mbits_label->Show (full);
831 add_label_to_sizer (_video_grid, _j2k_bandwidth_label, true, wxGBPosition (r, 0));
832 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
833 s->Add (_j2k_bandwidth, 1);
834 add_label_to_sizer (s, _mbits_label, false);
835 _video_grid->Add (s, wxGBPosition (r, 1));
837 _video_grid->Add (_reencode_j2k, wxGBPosition(r, 0), wxGBSpan(1, 2));
842 DCPPanel::minimum_allowed_audio_channels () const
845 if (_film && _film->audio_processor ()) {
846 min = _film->audio_processor()->out_channels ();
857 DCPPanel::make_audio_panel ()
859 wxPanel* panel = new wxPanel (_notebook);
860 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
861 _audio_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
862 sizer->Add (_audio_grid, 0, wxALL, 8);
863 panel->SetSizer (sizer);
865 _channels_label = create_label (panel, _("Channels"), true);
866 _audio_channels = new wxChoice (panel, wxID_ANY);
867 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
869 _processor_label = create_label (panel, _("Processor"), true);
870 _audio_processor = new wxChoice (panel, wxID_ANY);
871 _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
872 BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::all ()) {
873 _audio_processor->Append (std_to_wx (ap->name ()), new wxStringClientData (std_to_wx (ap->id ())));
876 _show_audio = new Button (panel, _("Show audio..."));
878 _audio_channels->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_channels_changed, this));
879 _audio_processor->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_processor_changed, this));
880 _show_audio->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::show_audio_clicked, this));
882 add_audio_panel_to_grid ();
888 DCPPanel::add_audio_panel_to_grid ()
890 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
894 _channels_label->Show (full);
895 _audio_channels->Show (full);
898 add_label_to_sizer (_audio_grid, _channels_label, true, wxGBPosition (r, 0));
899 _audio_grid->Add (_audio_channels, wxGBPosition (r, 1));
903 _processor_label->Show (full);
904 _audio_processor->Show (full);
907 add_label_to_sizer (_audio_grid, _processor_label, true, wxGBPosition (r, 0));
908 _audio_grid->Add (_audio_processor, wxGBPosition (r, 1));
912 _audio_grid->Add (_show_audio, wxGBPosition (r, 0), wxGBSpan (1, 2));
917 DCPPanel::copy_isdcf_name_button_clicked ()
919 _film->set_name (_film->isdcf_name (true));
920 _film->set_use_isdcf_name (false);
924 DCPPanel::audio_processor_changed ()
930 string const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
931 _film->set_audio_processor (AudioProcessor::from_id (s));
935 DCPPanel::show_audio_clicked ()
942 _audio_dialog->Destroy ();
946 AudioDialog* d = new AudioDialog (_panel, _film);
951 DCPPanel::reel_type_changed ()
957 _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
961 DCPPanel::reel_length_changed ()
967 _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);