2 Copyright (C) 2012-2016 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 "lib/ratio.h"
28 #include "lib/config.h"
29 #include "lib/dcp_content_type.h"
32 #include "lib/ffmpeg_content.h"
33 #include "lib/audio_processor.h"
34 #include "lib/video_content.h"
35 #include "lib/text_content.h"
36 #include "lib/dcp_content.h"
37 #include "lib/audio_content.h"
38 #include <dcp/locale_convert.h>
41 #include <wx/notebook.h>
42 #include <wx/gbsizer.h>
43 #include <wx/spinctrl.h>
44 #include <boost/lexical_cast.hpp>
45 #include <boost/foreach.hpp>
55 using boost::lexical_cast;
56 using boost::shared_ptr;
57 using dcp::locale_convert;
59 DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
62 , _generally_sensitive (true)
64 _panel = new wxPanel (n);
65 _sizer = new wxBoxSizer (wxVERTICAL);
66 _panel->SetSizer (_sizer);
68 _grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
69 _sizer->Add (_grid, 0, wxEXPAND | wxALL, 8);
71 _name_label = create_label (_panel, _("Name"), true);
72 _name = new wxTextCtrl (_panel, wxID_ANY);
73 FocusManager::instance()->add(_name);
75 _use_isdcf_name = new wxCheckBox (_panel, wxID_ANY, _("Use ISDCF name"));
76 _edit_isdcf_button = new wxButton (_panel, wxID_ANY, _("Details..."));
77 _copy_isdcf_name_button = new wxButton (_panel, wxID_ANY, _("Copy as name"));
79 /* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see
80 http://trac.wxwidgets.org/ticket/12539
82 _dcp_name = new wxStaticText (
83 _panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize,
84 wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE
87 _dcp_content_type_label = create_label (_panel, _("Content Type"), true);
88 _dcp_content_type = new wxChoice (_panel, wxID_ANY);
90 _signed = new wxCheckBox (_panel, wxID_ANY, _("Signed"));
91 _encrypted = new wxCheckBox (_panel, wxID_ANY, _("Encrypted"));
93 wxClientDC dc (_panel);
94 wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
97 _key_label = create_label (_panel, _("Key"), true);
98 _key = new wxStaticText (_panel, wxID_ANY, "", wxDefaultPosition, size);
99 _edit_key = new wxButton (_panel, wxID_ANY, _("Edit..."));
101 _reels_label = create_label (_panel, _("Reels"), true);
102 _reel_type = new wxChoice (_panel, wxID_ANY);
104 _reel_length_label = create_label (_panel, _("Reel length"), true);
105 _reel_length = new wxSpinCtrl (_panel, wxID_ANY);
106 _reel_length_gb_label = create_label (_panel, _("GB"), false);
108 _standard_label = create_label (_panel, _("Standard"), true);
109 _standard = new wxChoice (_panel, wxID_ANY);
111 _upload_after_make_dcp = new wxCheckBox (_panel, wxID_ANY, _("Upload DCP to TMS after it is made"));
113 _notebook = new wxNotebook (_panel, wxID_ANY);
114 _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
116 _notebook->AddPage (make_video_panel (), _("Video"), false);
117 _notebook->AddPage (make_audio_panel (), _("Audio"), false);
119 _name->Bind (wxEVT_TEXT, boost::bind (&DCPPanel::name_changed, this));
120 _use_isdcf_name->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
121 _edit_isdcf_button->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
122 _copy_isdcf_name_button->Bind(wxEVT_BUTTON, boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
123 _dcp_content_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::dcp_content_type_changed, this));
124 _signed->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::signed_toggled, this));
125 _encrypted->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::encrypted_toggled, this));
126 _edit_key->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::edit_key_clicked, this));
127 _reel_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::reel_type_changed, this));
128 _reel_length->Bind (wxEVT_SPINCTRL, boost::bind (&DCPPanel::reel_length_changed, this));
129 _standard->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::standard_changed, this));
130 _upload_after_make_dcp->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::upload_after_make_dcp_changed, this));
132 BOOST_FOREACH (DCPContentType const * i, DCPContentType::all()) {
133 _dcp_content_type->Append (std_to_wx (i->pretty_name ()));
136 _reel_type->Append (_("Single reel"));
137 _reel_type->Append (_("Split by video content"));
138 /// TRANSLATORS: translate the word "Custom" here; do not include the "Reel|" prefix
139 _reel_type->Append (S_("Reel|Custom"));
141 _reel_length->SetRange (1, 64);
143 _standard->Append (_("SMPTE"));
144 _standard->Append (_("Interop"));
146 Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this, _1));
152 DCPPanel::add_to_grid ()
154 Config::Interface interface = Config::instance()->interface_complexity ();
158 add_label_to_sizer (_grid, _name_label, true, wxGBPosition (r, 0));
159 _grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
162 int flags = wxALIGN_CENTER_VERTICAL;
164 flags |= wxALIGN_RIGHT;
167 _use_isdcf_name->Show (interface == Config::INTERFACE_FULL);
168 _edit_isdcf_button->Show (interface == Config::INTERFACE_FULL);
169 _copy_isdcf_name_button->Show (interface == Config::INTERFACE_FULL);
171 if (interface == Config::INTERFACE_FULL) {
172 _grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
174 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
175 s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
176 s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
177 _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
182 _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
185 add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition (r, 0));
186 _grid->Add (_dcp_content_type, wxGBPosition (r, 1));
189 _signed->Show (interface == Config::INTERFACE_FULL);
190 if (interface == Config::INTERFACE_FULL) {
191 _grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
195 _grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
198 _key_label->Show (interface == Config::INTERFACE_FULL);
199 _key->Show (interface == Config::INTERFACE_FULL);
200 _edit_key->Show (interface == Config::INTERFACE_FULL);
201 _reels_label->Show (interface == Config::INTERFACE_FULL);
202 _reel_type->Show (interface == Config::INTERFACE_FULL);
203 _reel_length_label->Show (interface == Config::INTERFACE_FULL);
204 _reel_length->Show (interface == Config::INTERFACE_FULL);
205 _reel_length_gb_label->Show (interface == Config::INTERFACE_FULL);
206 _standard_label->Show (interface == Config::INTERFACE_FULL);
207 _standard->Show (interface == Config::INTERFACE_FULL);
208 _upload_after_make_dcp->Show (interface == Config::INTERFACE_FULL);
209 _reencode_j2k->Show (interface == Config::INTERFACE_FULL);
211 if (interface == Config::INTERFACE_FULL) {
212 add_label_to_sizer (_grid, _key_label, true, wxGBPosition (r, 0));
214 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
215 s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
217 _grid->Add (s, wxGBPosition (r, 1));
221 add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
222 _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
225 add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition (r, 0));
227 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
228 s->Add (_reel_length);
229 add_label_to_sizer (s, _reel_length_gb_label, false);
230 _grid->Add (s, wxGBPosition (r, 1));
234 add_label_to_sizer (_grid, _standard_label, true, wxGBPosition (r, 0));
235 _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
238 _grid->Add (_upload_after_make_dcp, wxGBPosition (r, 0), wxGBSpan (1, 2));
244 DCPPanel::edit_key_clicked ()
246 KeyDialog* d = new KeyDialog (_panel, _film->key ());
247 if (d->ShowModal () == wxID_OK) {
248 _film->set_key (d->key ());
254 DCPPanel::name_changed ()
260 _film->set_name (string (_name->GetValue().mb_str()));
264 DCPPanel::j2k_bandwidth_changed ()
270 _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
274 DCPPanel::signed_toggled ()
280 _film->set_signed (_signed->GetValue ());
284 DCPPanel::encrypted_toggled ()
290 _film->set_encrypted (_encrypted->GetValue ());
293 /** Called when the frame rate choice widget has been changed */
295 DCPPanel::frame_rate_choice_changed ()
301 _film->set_video_frame_rate (
302 boost::lexical_cast<int> (
303 wx_to_std (_frame_rate_choice->GetString (_frame_rate_choice->GetSelection ()))
308 /** Called when the frame rate spin widget has been changed */
310 DCPPanel::frame_rate_spin_changed ()
316 _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
320 DCPPanel::audio_channels_changed ()
326 _film->set_audio_channels (locale_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
330 DCPPanel::resolution_changed ()
336 _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
340 DCPPanel::standard_changed ()
346 _film->set_interop (_standard->GetSelection() == 1);
350 DCPPanel::upload_after_make_dcp_changed ()
356 _film->set_upload_after_make_dcp (_upload_after_make_dcp->GetValue ());
360 DCPPanel::film_changed (int p)
365 case Film::CONTAINER:
369 checked_set (_name, _film->name());
372 case Film::DCP_CONTENT_TYPE:
373 checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
377 checked_set (_signed, _film->is_signed ());
379 case Film::ENCRYPTED:
380 checked_set (_encrypted, _film->encrypted ());
381 if (_film->encrypted ()) {
382 _film->set_signed (true);
383 _signed->Enable (false);
384 _key->Enable (_generally_sensitive);
385 _edit_key->Enable (_generally_sensitive);
387 _signed->Enable (_generally_sensitive);
388 _key->Enable (false);
389 _edit_key->Enable (false);
393 checked_set (_key, _film->key().hex().substr (0, 8) + "...");
395 case Film::RESOLUTION:
396 checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
400 case Film::J2K_BANDWIDTH:
401 checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
403 case Film::USE_ISDCF_NAME:
405 checked_set (_use_isdcf_name, _film->use_isdcf_name ());
407 _edit_isdcf_button->Enable (_film->use_isdcf_name ());
410 case Film::ISDCF_METADATA:
413 case Film::VIDEO_FRAME_RATE:
416 for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
417 if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
418 checked_set (_frame_rate_choice, i);
425 checked_set (_frame_rate_choice, -1);
428 checked_set (_frame_rate_spin, _film->video_frame_rate ());
430 _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
434 case Film::AUDIO_CHANNELS:
435 if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
436 _film->set_audio_channels (minimum_allowed_audio_channels ());
438 checked_set (_audio_channels, locale_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
443 checked_set (_three_d, _film->three_d ());
446 case Film::REENCODE_J2K:
447 checked_set (_reencode_j2k, _film->reencode_j2k());
450 checked_set (_standard, _film->interop() ? 1 : 0);
453 case Film::AUDIO_PROCESSOR:
454 if (_film->audio_processor ()) {
455 checked_set (_audio_processor, _film->audio_processor()->id());
457 checked_set (_audio_processor, 0);
459 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
460 film_changed (Film::AUDIO_CHANNELS);
462 case Film::REEL_TYPE:
463 checked_set (_reel_type, _film->reel_type ());
464 _reel_length->Enable (_film->reel_type() == REELTYPE_BY_LENGTH);
466 case Film::REEL_LENGTH:
467 checked_set (_reel_length, _film->reel_length() / 1000000000LL);
469 case Film::UPLOAD_AFTER_MAKE_DCP:
470 checked_set (_upload_after_make_dcp, _film->upload_after_make_dcp ());
481 DCPPanel::film_content_changed (int property)
483 if (property == AudioContentProperty::STREAMS ||
484 property == TextContentProperty::USE ||
485 property == TextContentProperty::BURN ||
486 property == VideoContentProperty::SCALE ||
487 property == DCPContentProperty::REFERENCE_VIDEO ||
488 property == DCPContentProperty::REFERENCE_AUDIO ||
489 property == DCPContentProperty::REFERENCE_TEXT) {
491 setup_sensitivity ();
497 DCPPanel::setup_container ()
500 vector<Ratio const *> ratios = Ratio::containers ();
501 vector<Ratio const *>::iterator i = ratios.begin ();
502 while (i != ratios.end() && *i != _film->container ()) {
507 if (i == ratios.end()) {
508 checked_set (_container, -1);
509 checked_set (_container_size, wxT (""));
511 checked_set (_container, n);
512 dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
513 checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height));
519 /** Called when the container widget has been changed */
521 DCPPanel::container_changed ()
527 int const n = _container->GetSelection ();
529 vector<Ratio const *> ratios = Ratio::containers ();
530 DCPOMATIC_ASSERT (n < int (ratios.size()));
531 _film->set_container (ratios[n]);
535 /** Called when the DCP content type widget has been changed */
537 DCPPanel::dcp_content_type_changed ()
543 int const n = _dcp_content_type->GetSelection ();
544 if (n != wxNOT_FOUND) {
545 _film->set_dcp_content_type (DCPContentType::from_index (n));
550 DCPPanel::set_film (shared_ptr<Film> film)
552 /* We are changing film, so destroy any audio dialog for the old one */
554 _audio_dialog->Destroy ();
560 film_changed (Film::NAME);
561 film_changed (Film::USE_ISDCF_NAME);
562 film_changed (Film::CONTENT);
563 film_changed (Film::DCP_CONTENT_TYPE);
564 film_changed (Film::CONTAINER);
565 film_changed (Film::RESOLUTION);
566 film_changed (Film::SIGNED);
567 film_changed (Film::ENCRYPTED);
568 film_changed (Film::KEY);
569 film_changed (Film::J2K_BANDWIDTH);
570 film_changed (Film::ISDCF_METADATA);
571 film_changed (Film::VIDEO_FRAME_RATE);
572 film_changed (Film::AUDIO_CHANNELS);
573 film_changed (Film::SEQUENCE);
574 film_changed (Film::THREE_D);
575 film_changed (Film::INTEROP);
576 film_changed (Film::AUDIO_PROCESSOR);
577 film_changed (Film::REEL_TYPE);
578 film_changed (Film::REEL_LENGTH);
579 film_changed (Film::UPLOAD_AFTER_MAKE_DCP);
580 film_changed (Film::REENCODE_J2K);
582 set_general_sensitivity(static_cast<bool>(_film));
586 DCPPanel::set_general_sensitivity (bool s)
588 _generally_sensitive = s;
589 setup_sensitivity ();
593 DCPPanel::setup_sensitivity ()
595 _name->Enable (_generally_sensitive);
596 _use_isdcf_name->Enable (_generally_sensitive);
597 _edit_isdcf_button->Enable (_generally_sensitive);
598 _dcp_content_type->Enable (_generally_sensitive);
599 _copy_isdcf_name_button->Enable (_generally_sensitive);
601 bool si = _generally_sensitive;
602 if (_film && _film->encrypted ()) {
605 _signed->Enable (si);
607 _encrypted->Enable (_generally_sensitive);
608 _key->Enable (_generally_sensitive && _film && _film->encrypted ());
609 _edit_key->Enable (_generally_sensitive && _film && _film->encrypted ());
610 _reel_type->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
611 _reel_length->Enable (_generally_sensitive && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
612 _upload_after_make_dcp->Enable (_generally_sensitive);
613 _frame_rate_choice->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
614 _frame_rate_spin->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
615 _audio_channels->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
616 _audio_processor->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
617 _j2k_bandwidth->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
618 _container->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
619 _best_frame_rate->Enable (_generally_sensitive && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
620 _resolution->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
621 _three_d->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
622 _standard->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
626 DCPPanel::use_isdcf_name_toggled ()
632 _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
636 DCPPanel::edit_isdcf_button_clicked ()
642 ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
644 _film->set_isdcf_metadata (d->isdcf_metadata ());
649 DCPPanel::setup_dcp_name ()
651 _dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
652 _dcp_name->SetToolTip (std_to_wx (_film->dcp_name (true)));
656 DCPPanel::best_frame_rate_clicked ()
662 _film->set_video_frame_rate (_film->best_video_frame_rate ());
666 DCPPanel::three_d_changed ()
672 _film->set_three_d (_three_d->GetValue ());
676 DCPPanel::reencode_j2k_changed ()
682 _film->set_reencode_j2k (_reencode_j2k->GetValue());
686 DCPPanel::config_changed (Config::Property p)
688 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
689 setup_frame_rate_widget ();
691 if (p == Config::INTERFACE_COMPLEXITY) {
697 _video_grid->Clear ();
698 add_video_panel_to_grid ();
699 _video_grid->Layout ();
701 _audio_grid->Clear ();
702 add_audio_panel_to_grid ();
703 _audio_grid->Layout ();
708 DCPPanel::setup_frame_rate_widget ()
710 if (Config::instance()->allow_any_dcp_frame_rate ()) {
711 _frame_rate_choice->Hide ();
712 _frame_rate_spin->Show ();
714 _frame_rate_choice->Show ();
715 _frame_rate_spin->Hide ();
718 _frame_rate_sizer->Layout ();
722 DCPPanel::make_video_panel ()
724 wxPanel* panel = new wxPanel (_notebook);
725 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
726 _video_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
727 sizer->Add (_video_grid, 0, wxALL, 8);
728 panel->SetSizer (sizer);
730 _container_label = create_label (panel, _("Container"), true);
731 _container = new wxChoice (panel, wxID_ANY);
732 _container_size = new wxStaticText (panel, wxID_ANY, wxT (""));
734 _resolution_label = create_label (panel, _("Resolution"), true);
735 _resolution = new wxChoice (panel, wxID_ANY);
737 _frame_rate_label = create_label (panel, _("Frame Rate"), true);
738 _frame_rate_choice = new wxChoice (panel, wxID_ANY);
739 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
740 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
741 _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY);
742 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
743 setup_frame_rate_widget ();
744 _best_frame_rate = new wxButton (panel, wxID_ANY, _("Use best"));
745 _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
747 _three_d = new wxCheckBox (panel, wxID_ANY, _("3D"));
749 _j2k_bandwidth_label = create_label (panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true);
750 _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
751 _mbits_label = create_label (panel, _("Mbit/s"), false);
753 _reencode_j2k = new wxCheckBox (panel, wxID_ANY, _("Re-encode JPEG2000 data from input"));
755 _container->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::container_changed, this));
756 _frame_rate_choice->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::frame_rate_choice_changed, this));
757 _frame_rate_spin->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::frame_rate_spin_changed, this));
758 _best_frame_rate->Bind (wxEVT_BUTTON, boost::bind(&DCPPanel::best_frame_rate_clicked, this));
759 _j2k_bandwidth->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
760 /* Also listen to wxEVT_TEXT so that typing numbers directly in is always noticed */
761 _j2k_bandwidth->Bind (wxEVT_TEXT, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
762 _resolution->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::resolution_changed, this));
763 _three_d->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::three_d_changed, this));
764 _reencode_j2k->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::reencode_j2k_changed, this));
766 BOOST_FOREACH (Ratio const * i, Ratio::containers()) {
767 _container->Append (std_to_wx(i->container_nickname()));
770 BOOST_FOREACH (int i, Config::instance()->allowed_dcp_frame_rates()) {
771 _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (i)));
774 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
775 _frame_rate_spin->SetRange (1, 480);
777 _resolution->Append (_("2K"));
778 _resolution->Append (_("4K"));
780 add_video_panel_to_grid ();
786 DCPPanel::add_video_panel_to_grid ()
788 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
792 add_label_to_sizer (_video_grid, _container_label, true, wxGBPosition (r, 0));
794 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
795 s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
796 s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
797 _video_grid->Add (s, wxGBPosition(r, 1));
801 add_label_to_sizer (_video_grid, _resolution_label, true, wxGBPosition (r, 0));
802 _video_grid->Add (_resolution, wxGBPosition (r, 1));
805 add_label_to_sizer (_video_grid, _frame_rate_label, true, wxGBPosition (r, 0));
807 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
808 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
809 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
810 _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
811 _video_grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
815 _video_grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
818 _j2k_bandwidth_label->Show (full);
819 _j2k_bandwidth->Show (full);
820 _mbits_label->Show (full);
823 add_label_to_sizer (_video_grid, _j2k_bandwidth_label, true, wxGBPosition (r, 0));
824 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
825 s->Add (_j2k_bandwidth, 1);
826 add_label_to_sizer (s, _mbits_label, false);
827 _video_grid->Add (s, wxGBPosition (r, 1));
829 _video_grid->Add (_reencode_j2k, wxGBPosition(r, 0), wxGBSpan(1, 2));
834 DCPPanel::minimum_allowed_audio_channels () const
837 if (_film && _film->audio_processor ()) {
838 min = _film->audio_processor()->out_channels ();
849 DCPPanel::make_audio_panel ()
851 wxPanel* panel = new wxPanel (_notebook);
852 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
853 _audio_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
854 sizer->Add (_audio_grid, 0, wxALL, 8);
855 panel->SetSizer (sizer);
857 _channels_label = create_label (panel, _("Channels"), true);
858 _audio_channels = new wxChoice (panel, wxID_ANY);
859 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
861 _processor_label = create_label (panel, _("Processor"), true);
862 _audio_processor = new wxChoice (panel, wxID_ANY);
863 _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
864 BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::all ()) {
865 _audio_processor->Append (std_to_wx (ap->name ()), new wxStringClientData (std_to_wx (ap->id ())));
868 _show_audio = new wxButton (panel, wxID_ANY, _("Show audio..."));
870 _audio_channels->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_channels_changed, this));
871 _audio_processor->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_processor_changed, this));
872 _show_audio->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::show_audio_clicked, this));
874 add_audio_panel_to_grid ();
880 DCPPanel::add_audio_panel_to_grid ()
882 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
886 _channels_label->Show (full);
887 _audio_channels->Show (full);
890 add_label_to_sizer (_audio_grid, _channels_label, true, wxGBPosition (r, 0));
891 _audio_grid->Add (_audio_channels, wxGBPosition (r, 1));
895 _processor_label->Show (full);
896 _audio_processor->Show (full);
899 add_label_to_sizer (_audio_grid, _processor_label, true, wxGBPosition (r, 0));
900 _audio_grid->Add (_audio_processor, wxGBPosition (r, 1));
904 _audio_grid->Add (_show_audio, wxGBPosition (r, 0), wxGBSpan (1, 2));
909 DCPPanel::copy_isdcf_name_button_clicked ()
911 _film->set_name (_film->isdcf_name (true));
912 _film->set_use_isdcf_name (false);
916 DCPPanel::audio_processor_changed ()
922 string const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
923 _film->set_audio_processor (AudioProcessor::from_id (s));
927 DCPPanel::show_audio_clicked ()
934 _audio_dialog->Destroy ();
938 AudioDialog* d = new AudioDialog (_panel, _film);
943 DCPPanel::reel_type_changed ()
949 _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
953 DCPPanel::reel_length_changed ()
959 _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);