2 Copyright (C) 2012-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 "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 "markers_dialog.h"
32 #include "lib/ratio.h"
33 #include "lib/config.h"
34 #include "lib/dcp_content_type.h"
37 #include "lib/ffmpeg_content.h"
38 #include "lib/audio_processor.h"
39 #include "lib/video_content.h"
40 #include "lib/text_content.h"
41 #include "lib/dcp_content.h"
42 #include "lib/audio_content.h"
43 #include <dcp/locale_convert.h>
46 #include <wx/notebook.h>
47 #include <wx/gbsizer.h>
48 #include <wx/spinctrl.h>
49 #include <boost/lexical_cast.hpp>
50 #include <boost/foreach.hpp>
60 using boost::lexical_cast;
61 using boost::shared_ptr;
62 using boost::weak_ptr;
63 using dcp::locale_convert;
65 DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> viewer)
70 , _generally_sensitive (true)
72 _panel = new wxPanel (n);
73 _sizer = new wxBoxSizer (wxVERTICAL);
74 _panel->SetSizer (_sizer);
76 _grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
77 _sizer->Add (_grid, 0, wxEXPAND | wxALL, 8);
79 _name_label = create_label (_panel, _("Name"), true);
80 _name = new wxTextCtrl (_panel, wxID_ANY);
81 FocusManager::instance()->add(_name);
83 _use_isdcf_name = new CheckBox (_panel, _("Use ISDCF name"));
84 _edit_isdcf_button = new Button (_panel, _("Details..."));
85 _copy_isdcf_name_button = new Button (_panel, _("Copy as name"));
87 /* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see
88 http://trac.wxwidgets.org/ticket/12539
90 _dcp_name = new StaticText (
91 _panel, wxT (""), wxDefaultPosition, wxDefaultSize,
92 wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE
95 _dcp_content_type_label = create_label (_panel, _("Content Type"), true);
96 _dcp_content_type = new wxChoice (_panel, wxID_ANY);
98 _signed = new CheckBox (_panel, _("Signed"));
99 _encrypted = new CheckBox (_panel, _("Encrypted"));
101 wxClientDC dc (_panel);
102 wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
105 _key_label = create_label (_panel, _("Key"), true);
106 _key = new StaticText (_panel, "", wxDefaultPosition, size);
107 _edit_key = new Button (_panel, _("Edit..."));
109 _reels_label = create_label (_panel, _("Reels"), true);
110 _reel_type = new wxChoice (_panel, wxID_ANY);
112 _reel_length_label = create_label (_panel, _("Reel length"), true);
113 _reel_length = new wxSpinCtrl (_panel, wxID_ANY);
114 _reel_length_gb_label = create_label (_panel, _("GB"), false);
116 _standard_label = create_label (_panel, _("Standard"), true);
117 _standard = new wxChoice (_panel, wxID_ANY);
119 _upload_after_make_dcp = new CheckBox (_panel, _("Upload DCP to TMS after it is made"));
121 _markers = new Button (_panel, _("Edit markers..."));
123 _notebook = new wxNotebook (_panel, wxID_ANY);
124 _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
126 _notebook->AddPage (make_video_panel (), _("Video"), false);
127 _notebook->AddPage (make_audio_panel (), _("Audio"), false);
129 _name->Bind (wxEVT_TEXT, boost::bind (&DCPPanel::name_changed, this));
130 _use_isdcf_name->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
131 _edit_isdcf_button->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
132 _copy_isdcf_name_button->Bind(wxEVT_BUTTON, boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
133 _dcp_content_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::dcp_content_type_changed, this));
134 _signed->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::signed_toggled, this));
135 _encrypted->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::encrypted_toggled, this));
136 _edit_key->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::edit_key_clicked, this));
137 _reel_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::reel_type_changed, this));
138 _reel_length->Bind (wxEVT_SPINCTRL, boost::bind (&DCPPanel::reel_length_changed, this));
139 _standard->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::standard_changed, this));
140 _upload_after_make_dcp->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::upload_after_make_dcp_changed, this));
141 _markers->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::markers_clicked, this));
143 BOOST_FOREACH (DCPContentType const * i, DCPContentType::all()) {
144 _dcp_content_type->Append (std_to_wx (i->pretty_name ()));
147 _reel_type->Append (_("Single reel"));
148 _reel_type->Append (_("Split by video content"));
149 /// TRANSLATORS: translate the word "Custom" here; do not include the "Reel|" prefix
150 _reel_type->Append (S_("Reel|Custom"));
152 _reel_length->SetRange (1, 64);
154 _standard->Append (_("SMPTE"));
155 _standard->Append (_("Interop"));
157 Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this, _1));
163 DCPPanel::add_to_grid ()
165 Config::Interface interface = Config::instance()->interface_complexity ();
169 add_label_to_sizer (_grid, _name_label, true, wxGBPosition (r, 0));
170 _grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
173 int flags = wxALIGN_CENTER_VERTICAL;
175 flags |= wxALIGN_RIGHT;
178 bool const full = interface == Config::INTERFACE_FULL;
180 _use_isdcf_name->Show (full);
181 _edit_isdcf_button->Show (full);
182 _copy_isdcf_name_button->Show (full);
185 _grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
187 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
188 s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
189 s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
190 _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
195 _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
198 add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition (r, 0));
199 _grid->Add (_dcp_content_type, wxGBPosition (r, 1));
202 _signed->Show (full);
204 _grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
208 _grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
212 _key_label->Show (full);
214 _edit_key->Show (full);
215 _reels_label->Show (full);
216 _reel_type->Show (full);
217 _reel_length_label->Show (full);
218 _reel_length->Show (full);
219 _reel_length_gb_label->Show (full);
220 _standard_label->Show (full);
221 _standard->Show (full);
222 _upload_after_make_dcp->Show (full);
223 _markers->Show (full);
224 _reencode_j2k->Show (full);
225 _encrypted->Show (full);
228 add_label_to_sizer (_grid, _key_label, true, wxGBPosition (r, 0));
230 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
231 s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
233 _grid->Add (s, wxGBPosition (r, 1));
237 add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
238 _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
241 add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition (r, 0));
243 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
244 s->Add (_reel_length);
245 add_label_to_sizer (s, _reel_length_gb_label, false);
246 _grid->Add (s, wxGBPosition (r, 1));
250 add_label_to_sizer (_grid, _standard_label, true, wxGBPosition (r, 0));
251 _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
254 _grid->Add (_upload_after_make_dcp, wxGBPosition (r, 0), wxGBSpan (1, 2));
257 _grid->Add (_markers, wxGBPosition(r, 0), wxGBSpan(1, 2));
263 DCPPanel::edit_key_clicked ()
265 KeyDialog* d = new KeyDialog (_panel, _film->key ());
266 if (d->ShowModal () == wxID_OK) {
267 _film->set_key (d->key ());
273 DCPPanel::name_changed ()
279 _film->set_name (string (_name->GetValue().mb_str()));
283 DCPPanel::j2k_bandwidth_changed ()
289 _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
293 DCPPanel::signed_toggled ()
299 _film->set_signed (_signed->GetValue ());
303 DCPPanel::encrypted_toggled ()
309 _film->set_encrypted (_encrypted->GetValue ());
312 /** Called when the frame rate choice widget has been changed */
314 DCPPanel::frame_rate_choice_changed ()
320 _film->set_video_frame_rate (
321 boost::lexical_cast<int>(
322 wx_to_std(_frame_rate_choice->GetString(_frame_rate_choice->GetSelection()))
328 /** Called when the frame rate spin widget has been changed */
330 DCPPanel::frame_rate_spin_changed ()
336 _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
340 DCPPanel::audio_channels_changed ()
346 _film->set_audio_channels (locale_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
350 DCPPanel::resolution_changed ()
356 _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
360 DCPPanel::standard_changed ()
366 _film->set_interop (_standard->GetSelection() == 1);
370 DCPPanel::upload_after_make_dcp_changed ()
376 _film->set_upload_after_make_dcp (_upload_after_make_dcp->GetValue ());
380 DCPPanel::markers_clicked ()
382 if (_markers_dialog) {
383 _markers_dialog->Destroy ();
387 _markers_dialog = new MarkersDialog (_panel, _film, _viewer);
388 _markers_dialog->Show();
392 DCPPanel::film_changed (int p)
397 case Film::CONTAINER:
401 checked_set (_name, _film->name());
404 case Film::DCP_CONTENT_TYPE:
405 checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
409 checked_set (_signed, _film->is_signed ());
411 case Film::ENCRYPTED:
412 checked_set (_encrypted, _film->encrypted ());
413 if (_film->encrypted ()) {
414 _film->set_signed (true);
415 _signed->Enable (false);
416 _key->Enable (_generally_sensitive);
417 _edit_key->Enable (_generally_sensitive);
419 _signed->Enable (_generally_sensitive);
420 _key->Enable (false);
421 _edit_key->Enable (false);
425 checked_set (_key, _film->key().hex().substr (0, 8) + "...");
427 case Film::RESOLUTION:
428 checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
432 case Film::J2K_BANDWIDTH:
433 checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
435 case Film::USE_ISDCF_NAME:
437 checked_set (_use_isdcf_name, _film->use_isdcf_name ());
439 _edit_isdcf_button->Enable (_film->use_isdcf_name ());
442 case Film::ISDCF_METADATA:
445 case Film::VIDEO_FRAME_RATE:
448 for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
449 if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
450 checked_set (_frame_rate_choice, i);
457 checked_set (_frame_rate_choice, -1);
460 checked_set (_frame_rate_spin, _film->video_frame_rate ());
462 _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
466 case Film::AUDIO_CHANNELS:
467 if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
468 _film->set_audio_channels (minimum_allowed_audio_channels ());
470 checked_set (_audio_channels, locale_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
475 checked_set (_three_d, _film->three_d ());
478 case Film::REENCODE_J2K:
479 checked_set (_reencode_j2k, _film->reencode_j2k());
482 checked_set (_standard, _film->interop() ? 1 : 0);
484 _markers->Enable (!_film->interop());
486 case Film::AUDIO_PROCESSOR:
487 if (_film->audio_processor ()) {
488 checked_set (_audio_processor, _film->audio_processor()->id());
490 checked_set (_audio_processor, 0);
492 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
493 film_changed (Film::AUDIO_CHANNELS);
495 case Film::REEL_TYPE:
496 checked_set (_reel_type, _film->reel_type ());
497 _reel_length->Enable (_film->reel_type() == REELTYPE_BY_LENGTH);
499 case Film::REEL_LENGTH:
500 checked_set (_reel_length, _film->reel_length() / 1000000000LL);
502 case Film::UPLOAD_AFTER_MAKE_DCP:
503 checked_set (_upload_after_make_dcp, _film->upload_after_make_dcp ());
514 DCPPanel::film_content_changed (int property)
516 if (property == AudioContentProperty::STREAMS ||
517 property == TextContentProperty::USE ||
518 property == TextContentProperty::BURN ||
519 property == VideoContentProperty::SCALE ||
520 property == DCPContentProperty::REFERENCE_VIDEO ||
521 property == DCPContentProperty::REFERENCE_AUDIO ||
522 property == DCPContentProperty::REFERENCE_TEXT) {
524 setup_sensitivity ();
530 DCPPanel::setup_container ()
533 vector<Ratio const *> ratios = Ratio::containers ();
534 vector<Ratio const *>::iterator i = ratios.begin ();
535 while (i != ratios.end() && *i != _film->container ()) {
540 if (i == ratios.end()) {
541 checked_set (_container, -1);
542 checked_set (_container_size, wxT (""));
544 checked_set (_container, n);
545 dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
546 checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height));
552 /** Called when the container widget has been changed */
554 DCPPanel::container_changed ()
560 int const n = _container->GetSelection ();
562 vector<Ratio const *> ratios = Ratio::containers ();
563 DCPOMATIC_ASSERT (n < int (ratios.size()));
564 _film->set_container (ratios[n]);
568 /** Called when the DCP content type widget has been changed */
570 DCPPanel::dcp_content_type_changed ()
576 int const n = _dcp_content_type->GetSelection ();
577 if (n != wxNOT_FOUND) {
578 _film->set_dcp_content_type (DCPContentType::from_index (n));
583 DCPPanel::set_film (shared_ptr<Film> film)
585 /* We are changing film, so destroy any dialogs for the old one */
587 _audio_dialog->Destroy ();
590 if (_markers_dialog) {
591 _markers_dialog->Destroy ();
598 /* Really should all the film_changed below but this might be enough */
599 checked_set (_dcp_name, wxT(""));
600 set_general_sensitivity (false);
604 film_changed (Film::NAME);
605 film_changed (Film::USE_ISDCF_NAME);
606 film_changed (Film::CONTENT);
607 film_changed (Film::DCP_CONTENT_TYPE);
608 film_changed (Film::CONTAINER);
609 film_changed (Film::RESOLUTION);
610 film_changed (Film::SIGNED);
611 film_changed (Film::ENCRYPTED);
612 film_changed (Film::KEY);
613 film_changed (Film::J2K_BANDWIDTH);
614 film_changed (Film::ISDCF_METADATA);
615 film_changed (Film::VIDEO_FRAME_RATE);
616 film_changed (Film::AUDIO_CHANNELS);
617 film_changed (Film::SEQUENCE);
618 film_changed (Film::THREE_D);
619 film_changed (Film::INTEROP);
620 film_changed (Film::AUDIO_PROCESSOR);
621 film_changed (Film::REEL_TYPE);
622 film_changed (Film::REEL_LENGTH);
623 film_changed (Film::UPLOAD_AFTER_MAKE_DCP);
624 film_changed (Film::REENCODE_J2K);
626 set_general_sensitivity(static_cast<bool>(_film));
630 DCPPanel::set_general_sensitivity (bool s)
632 _generally_sensitive = s;
633 setup_sensitivity ();
637 DCPPanel::setup_sensitivity ()
639 _name->Enable (_generally_sensitive);
640 _use_isdcf_name->Enable (_generally_sensitive);
641 _edit_isdcf_button->Enable (_generally_sensitive);
642 _dcp_content_type->Enable (_generally_sensitive);
643 _copy_isdcf_name_button->Enable (_generally_sensitive);
645 bool si = _generally_sensitive;
646 if (_film && _film->encrypted ()) {
649 _signed->Enable (si);
651 _encrypted->Enable (_generally_sensitive);
652 _key->Enable (_generally_sensitive && _film && _film->encrypted ());
653 _edit_key->Enable (_generally_sensitive && _film && _film->encrypted ());
654 _reel_type->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
655 _reel_length->Enable (_generally_sensitive && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
656 _upload_after_make_dcp->Enable (_generally_sensitive);
657 _markers->Enable (_generally_sensitive);
658 _frame_rate_choice->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
659 _frame_rate_spin->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
660 _audio_channels->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
661 _audio_processor->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
662 _j2k_bandwidth->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
663 _container->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
664 _best_frame_rate->Enable (_generally_sensitive && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
665 _resolution->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
666 _three_d->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
667 _standard->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
668 _reencode_j2k->Enable (_generally_sensitive && _film);
669 _show_audio->Enable (_generally_sensitive && _film);
673 DCPPanel::use_isdcf_name_toggled ()
679 _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
683 DCPPanel::edit_isdcf_button_clicked ()
689 ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
691 _film->set_isdcf_metadata (d->isdcf_metadata ());
696 DCPPanel::setup_dcp_name ()
698 _dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
699 _dcp_name->SetToolTip (std_to_wx (_film->dcp_name (true)));
703 DCPPanel::best_frame_rate_clicked ()
709 _film->set_video_frame_rate (_film->best_video_frame_rate ());
713 DCPPanel::three_d_changed ()
719 _film->set_three_d (_three_d->GetValue ());
723 DCPPanel::reencode_j2k_changed ()
729 _film->set_reencode_j2k (_reencode_j2k->GetValue());
733 DCPPanel::config_changed (Config::Property p)
735 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
736 setup_frame_rate_widget ();
738 if (p == Config::INTERFACE_COMPLEXITY) {
744 _video_grid->Clear ();
745 add_video_panel_to_grid ();
746 _video_grid->Layout ();
748 _audio_grid->Clear ();
749 add_audio_panel_to_grid ();
750 _audio_grid->Layout ();
755 DCPPanel::setup_frame_rate_widget ()
757 if (Config::instance()->allow_any_dcp_frame_rate ()) {
758 _frame_rate_choice->Hide ();
759 _frame_rate_spin->Show ();
761 _frame_rate_choice->Show ();
762 _frame_rate_spin->Hide ();
765 _frame_rate_sizer->Layout ();
769 DCPPanel::make_video_panel ()
771 wxPanel* panel = new wxPanel (_notebook);
772 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
773 _video_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
774 sizer->Add (_video_grid, 0, wxALL, 8);
775 panel->SetSizer (sizer);
777 _container_label = create_label (panel, _("Container"), true);
778 _container = new wxChoice (panel, wxID_ANY);
779 _container_size = new StaticText (panel, wxT (""));
781 _resolution_label = create_label (panel, _("Resolution"), true);
782 _resolution = new wxChoice (panel, wxID_ANY);
784 _frame_rate_label = create_label (panel, _("Frame Rate"), true);
785 _frame_rate_choice = new wxChoice (panel, wxID_ANY);
786 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
787 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
788 _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY);
789 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
790 setup_frame_rate_widget ();
791 _best_frame_rate = new Button (panel, _("Use best"));
792 _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
794 _three_d = new CheckBox (panel, _("3D"));
796 _j2k_bandwidth_label = create_label (panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true);
797 _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
798 _mbits_label = create_label (panel, _("Mbit/s"), false);
800 _reencode_j2k = new CheckBox (panel, _("Re-encode JPEG2000 data from input"));
802 _container->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::container_changed, this));
803 _frame_rate_choice->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::frame_rate_choice_changed, this));
804 _frame_rate_spin->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::frame_rate_spin_changed, this));
805 _best_frame_rate->Bind (wxEVT_BUTTON, boost::bind(&DCPPanel::best_frame_rate_clicked, this));
806 _j2k_bandwidth->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
807 /* Also listen to wxEVT_TEXT so that typing numbers directly in is always noticed */
808 _j2k_bandwidth->Bind (wxEVT_TEXT, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
809 _resolution->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::resolution_changed, this));
810 _three_d->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::three_d_changed, this));
811 _reencode_j2k->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::reencode_j2k_changed, this));
813 BOOST_FOREACH (Ratio const * i, Ratio::containers()) {
814 _container->Append (std_to_wx(i->container_nickname()));
817 BOOST_FOREACH (int i, Config::instance()->allowed_dcp_frame_rates()) {
818 _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (i)));
821 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
822 _frame_rate_spin->SetRange (1, 480);
824 _resolution->Append (_("2K"));
825 _resolution->Append (_("4K"));
827 add_video_panel_to_grid ();
833 DCPPanel::add_video_panel_to_grid ()
835 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
839 add_label_to_sizer (_video_grid, _container_label, true, wxGBPosition (r, 0));
841 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
842 s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
843 s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
844 _video_grid->Add (s, wxGBPosition(r, 1));
848 add_label_to_sizer (_video_grid, _resolution_label, true, wxGBPosition (r, 0));
849 _video_grid->Add (_resolution, wxGBPosition (r, 1));
852 add_label_to_sizer (_video_grid, _frame_rate_label, true, wxGBPosition (r, 0));
854 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
855 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
856 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
857 _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
858 _video_grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
862 _video_grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
865 _j2k_bandwidth_label->Show (full);
866 _j2k_bandwidth->Show (full);
867 _mbits_label->Show (full);
870 add_label_to_sizer (_video_grid, _j2k_bandwidth_label, true, wxGBPosition (r, 0));
871 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
872 s->Add (_j2k_bandwidth, 1);
873 add_label_to_sizer (s, _mbits_label, false);
874 _video_grid->Add (s, wxGBPosition (r, 1));
876 _video_grid->Add (_reencode_j2k, wxGBPosition(r, 0), wxGBSpan(1, 2));
881 DCPPanel::minimum_allowed_audio_channels () const
884 if (_film && _film->audio_processor ()) {
885 min = _film->audio_processor()->out_channels ();
896 DCPPanel::make_audio_panel ()
898 wxPanel* panel = new wxPanel (_notebook);
899 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
900 _audio_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
901 sizer->Add (_audio_grid, 0, wxALL, 8);
902 panel->SetSizer (sizer);
904 _channels_label = create_label (panel, _("Channels"), true);
905 _audio_channels = new wxChoice (panel, wxID_ANY);
906 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
908 _processor_label = create_label (panel, _("Processor"), true);
909 _audio_processor = new wxChoice (panel, wxID_ANY);
910 _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
911 BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::all ()) {
912 _audio_processor->Append (std_to_wx (ap->name ()), new wxStringClientData (std_to_wx (ap->id ())));
915 _show_audio = new Button (panel, _("Show audio..."));
917 _audio_channels->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_channels_changed, this));
918 _audio_processor->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_processor_changed, this));
919 _show_audio->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::show_audio_clicked, this));
921 add_audio_panel_to_grid ();
927 DCPPanel::add_audio_panel_to_grid ()
929 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
933 _channels_label->Show (full);
934 _audio_channels->Show (full);
937 add_label_to_sizer (_audio_grid, _channels_label, true, wxGBPosition (r, 0));
938 _audio_grid->Add (_audio_channels, wxGBPosition (r, 1));
942 _processor_label->Show (full);
943 _audio_processor->Show (full);
946 add_label_to_sizer (_audio_grid, _processor_label, true, wxGBPosition (r, 0));
947 _audio_grid->Add (_audio_processor, wxGBPosition (r, 1));
951 _audio_grid->Add (_show_audio, wxGBPosition (r, 0), wxGBSpan (1, 2));
956 DCPPanel::copy_isdcf_name_button_clicked ()
958 _film->set_name (_film->isdcf_name (true));
959 _film->set_use_isdcf_name (false);
963 DCPPanel::audio_processor_changed ()
969 string const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
970 _film->set_audio_processor (AudioProcessor::from_id (s));
974 DCPPanel::show_audio_clicked ()
981 _audio_dialog->Destroy ();
985 AudioDialog* d = new AudioDialog (_panel, _film);
990 DCPPanel::reel_type_changed ()
996 _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
1000 DCPPanel::reel_length_changed ()
1006 _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);