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);
210 if (interface == Config::INTERFACE_FULL) {
211 add_label_to_sizer (_grid, _key_label, true, wxGBPosition (r, 0));
213 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
214 s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
216 _grid->Add (s, wxGBPosition (r, 1));
220 add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
221 _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
224 add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition (r, 0));
226 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
227 s->Add (_reel_length);
228 add_label_to_sizer (s, _reel_length_gb_label, false);
229 _grid->Add (s, wxGBPosition (r, 1));
233 add_label_to_sizer (_grid, _standard_label, true, wxGBPosition (r, 0));
234 _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
237 _grid->Add (_upload_after_make_dcp, wxGBPosition (r, 0), wxGBSpan (1, 2));
243 DCPPanel::edit_key_clicked ()
245 KeyDialog* d = new KeyDialog (_panel, _film->key ());
246 if (d->ShowModal () == wxID_OK) {
247 _film->set_key (d->key ());
253 DCPPanel::name_changed ()
259 _film->set_name (string (_name->GetValue().mb_str()));
263 DCPPanel::j2k_bandwidth_changed ()
269 _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
273 DCPPanel::signed_toggled ()
279 _film->set_signed (_signed->GetValue ());
283 DCPPanel::encrypted_toggled ()
289 _film->set_encrypted (_encrypted->GetValue ());
292 /** Called when the frame rate choice widget has been changed */
294 DCPPanel::frame_rate_choice_changed ()
300 _film->set_video_frame_rate (
301 boost::lexical_cast<int> (
302 wx_to_std (_frame_rate_choice->GetString (_frame_rate_choice->GetSelection ()))
307 /** Called when the frame rate spin widget has been changed */
309 DCPPanel::frame_rate_spin_changed ()
315 _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
319 DCPPanel::audio_channels_changed ()
325 _film->set_audio_channels (locale_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
329 DCPPanel::resolution_changed ()
335 _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
339 DCPPanel::standard_changed ()
345 _film->set_interop (_standard->GetSelection() == 1);
349 DCPPanel::upload_after_make_dcp_changed ()
355 _film->set_upload_after_make_dcp (_upload_after_make_dcp->GetValue ());
359 DCPPanel::film_changed (int p)
364 case Film::CONTAINER:
368 checked_set (_name, _film->name());
371 case Film::DCP_CONTENT_TYPE:
372 checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
376 checked_set (_signed, _film->is_signed ());
378 case Film::ENCRYPTED:
379 checked_set (_encrypted, _film->encrypted ());
380 if (_film->encrypted ()) {
381 _film->set_signed (true);
382 _signed->Enable (false);
383 _key->Enable (_generally_sensitive);
384 _edit_key->Enable (_generally_sensitive);
386 _signed->Enable (_generally_sensitive);
387 _key->Enable (false);
388 _edit_key->Enable (false);
392 checked_set (_key, _film->key().hex().substr (0, 8) + "...");
394 case Film::RESOLUTION:
395 checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
399 case Film::J2K_BANDWIDTH:
400 checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
402 case Film::USE_ISDCF_NAME:
404 checked_set (_use_isdcf_name, _film->use_isdcf_name ());
406 _edit_isdcf_button->Enable (_film->use_isdcf_name ());
409 case Film::ISDCF_METADATA:
412 case Film::VIDEO_FRAME_RATE:
415 for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
416 if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
417 checked_set (_frame_rate_choice, i);
424 checked_set (_frame_rate_choice, -1);
427 checked_set (_frame_rate_spin, _film->video_frame_rate ());
429 _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
433 case Film::AUDIO_CHANNELS:
434 if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
435 _film->set_audio_channels (minimum_allowed_audio_channels ());
437 checked_set (_audio_channels, locale_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
442 checked_set (_three_d, _film->three_d ());
446 checked_set (_standard, _film->interop() ? 1 : 0);
449 case Film::AUDIO_PROCESSOR:
450 if (_film->audio_processor ()) {
451 checked_set (_audio_processor, _film->audio_processor()->id());
453 checked_set (_audio_processor, 0);
455 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
456 film_changed (Film::AUDIO_CHANNELS);
458 case Film::REEL_TYPE:
459 checked_set (_reel_type, _film->reel_type ());
460 _reel_length->Enable (_film->reel_type() == REELTYPE_BY_LENGTH);
462 case Film::REEL_LENGTH:
463 checked_set (_reel_length, _film->reel_length() / 1000000000LL);
465 case Film::UPLOAD_AFTER_MAKE_DCP:
466 checked_set (_upload_after_make_dcp, _film->upload_after_make_dcp ());
477 DCPPanel::film_content_changed (int property)
479 if (property == AudioContentProperty::STREAMS ||
480 property == TextContentProperty::USE ||
481 property == TextContentProperty::BURN ||
482 property == VideoContentProperty::SCALE ||
483 property == DCPContentProperty::REFERENCE_VIDEO ||
484 property == DCPContentProperty::REFERENCE_AUDIO ||
485 property == DCPContentProperty::REFERENCE_TEXT) {
487 setup_sensitivity ();
493 DCPPanel::setup_container ()
496 vector<Ratio const *> ratios = Ratio::containers ();
497 vector<Ratio const *>::iterator i = ratios.begin ();
498 while (i != ratios.end() && *i != _film->container ()) {
503 if (i == ratios.end()) {
504 checked_set (_container, -1);
505 checked_set (_container_size, wxT (""));
507 checked_set (_container, n);
508 dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
509 checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height));
515 /** Called when the container widget has been changed */
517 DCPPanel::container_changed ()
523 int const n = _container->GetSelection ();
525 vector<Ratio const *> ratios = Ratio::containers ();
526 DCPOMATIC_ASSERT (n < int (ratios.size()));
527 _film->set_container (ratios[n]);
531 /** Called when the DCP content type widget has been changed */
533 DCPPanel::dcp_content_type_changed ()
539 int const n = _dcp_content_type->GetSelection ();
540 if (n != wxNOT_FOUND) {
541 _film->set_dcp_content_type (DCPContentType::from_index (n));
546 DCPPanel::set_film (shared_ptr<Film> film)
548 /* We are changing film, so destroy any audio dialog for the old one */
550 _audio_dialog->Destroy ();
556 film_changed (Film::NAME);
557 film_changed (Film::USE_ISDCF_NAME);
558 film_changed (Film::CONTENT);
559 film_changed (Film::DCP_CONTENT_TYPE);
560 film_changed (Film::CONTAINER);
561 film_changed (Film::RESOLUTION);
562 film_changed (Film::SIGNED);
563 film_changed (Film::ENCRYPTED);
564 film_changed (Film::KEY);
565 film_changed (Film::J2K_BANDWIDTH);
566 film_changed (Film::ISDCF_METADATA);
567 film_changed (Film::VIDEO_FRAME_RATE);
568 film_changed (Film::AUDIO_CHANNELS);
569 film_changed (Film::SEQUENCE);
570 film_changed (Film::THREE_D);
571 film_changed (Film::INTEROP);
572 film_changed (Film::AUDIO_PROCESSOR);
573 film_changed (Film::REEL_TYPE);
574 film_changed (Film::REEL_LENGTH);
575 film_changed (Film::UPLOAD_AFTER_MAKE_DCP);
577 set_general_sensitivity(static_cast<bool>(_film));
581 DCPPanel::set_general_sensitivity (bool s)
583 _generally_sensitive = s;
584 setup_sensitivity ();
588 DCPPanel::setup_sensitivity ()
590 _name->Enable (_generally_sensitive);
591 _use_isdcf_name->Enable (_generally_sensitive);
592 _edit_isdcf_button->Enable (_generally_sensitive);
593 _dcp_content_type->Enable (_generally_sensitive);
594 _copy_isdcf_name_button->Enable (_generally_sensitive);
596 bool si = _generally_sensitive;
597 if (_film && _film->encrypted ()) {
600 _signed->Enable (si);
602 _encrypted->Enable (_generally_sensitive);
603 _key->Enable (_generally_sensitive && _film && _film->encrypted ());
604 _edit_key->Enable (_generally_sensitive && _film && _film->encrypted ());
605 _reel_type->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
606 _reel_length->Enable (_generally_sensitive && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
607 _upload_after_make_dcp->Enable (_generally_sensitive);
608 _frame_rate_choice->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
609 _frame_rate_spin->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
610 _audio_channels->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
611 _audio_processor->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
612 _j2k_bandwidth->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
613 _container->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
614 _best_frame_rate->Enable (_generally_sensitive && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
615 _resolution->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
616 _three_d->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
617 _standard->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
621 DCPPanel::use_isdcf_name_toggled ()
627 _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
631 DCPPanel::edit_isdcf_button_clicked ()
637 ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
639 _film->set_isdcf_metadata (d->isdcf_metadata ());
644 DCPPanel::setup_dcp_name ()
646 _dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
647 _dcp_name->SetToolTip (std_to_wx (_film->dcp_name (true)));
651 DCPPanel::best_frame_rate_clicked ()
657 _film->set_video_frame_rate (_film->best_video_frame_rate ());
661 DCPPanel::three_d_changed ()
667 _film->set_three_d (_three_d->GetValue ());
671 DCPPanel::config_changed (Config::Property p)
673 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
674 setup_frame_rate_widget ();
676 if (p == Config::INTERFACE_COMPLEXITY) {
682 _video_grid->Clear ();
683 add_video_panel_to_grid ();
684 _video_grid->Layout ();
686 _audio_grid->Clear ();
687 add_audio_panel_to_grid ();
688 _audio_grid->Layout ();
693 DCPPanel::setup_frame_rate_widget ()
695 if (Config::instance()->allow_any_dcp_frame_rate ()) {
696 _frame_rate_choice->Hide ();
697 _frame_rate_spin->Show ();
699 _frame_rate_choice->Show ();
700 _frame_rate_spin->Hide ();
703 _frame_rate_sizer->Layout ();
707 DCPPanel::make_video_panel ()
709 wxPanel* panel = new wxPanel (_notebook);
710 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
711 _video_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
712 sizer->Add (_video_grid, 0, wxALL, 8);
713 panel->SetSizer (sizer);
717 _container_label = create_label (panel, _("Container"), true);
718 _container = new wxChoice (panel, wxID_ANY);
719 _container_size = new wxStaticText (panel, wxID_ANY, wxT (""));
721 _resolution_label = create_label (panel, _("Resolution"), true);
722 _resolution = new wxChoice (panel, wxID_ANY);
724 _frame_rate_label = create_label (panel, _("Frame Rate"), true);
725 _frame_rate_choice = new wxChoice (panel, wxID_ANY);
726 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
727 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
728 _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY);
729 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
730 setup_frame_rate_widget ();
731 _best_frame_rate = new wxButton (panel, wxID_ANY, _("Use best"));
732 _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
734 _three_d = new wxCheckBox (panel, wxID_ANY, _("3D"));
737 _j2k_bandwidth_label = create_label (panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true);
738 _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
739 _mbits_label = create_label (panel, _("Mbit/s"), false);
741 _container->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::container_changed, this));
742 _frame_rate_choice->Bind(wxEVT_CHOICE, boost::bind (&DCPPanel::frame_rate_choice_changed, this));
743 _frame_rate_spin->Bind (wxEVT_SPINCTRL, boost::bind (&DCPPanel::frame_rate_spin_changed, this));
744 _best_frame_rate->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::best_frame_rate_clicked, this));
745 _j2k_bandwidth->Bind (wxEVT_SPINCTRL, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
746 /* Also listen to wxEVT_TEXT so that typing numbers directly in is always noticed */
747 _j2k_bandwidth->Bind (wxEVT_TEXT, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
748 _resolution->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::resolution_changed, this));
749 _three_d->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::three_d_changed, this));
751 BOOST_FOREACH (Ratio const * i, Ratio::containers()) {
752 _container->Append (std_to_wx(i->container_nickname()));
755 BOOST_FOREACH (int i, Config::instance()->allowed_dcp_frame_rates()) {
756 _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (i)));
759 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
760 _frame_rate_spin->SetRange (1, 480);
762 _resolution->Append (_("2K"));
763 _resolution->Append (_("4K"));
765 add_video_panel_to_grid ();
771 DCPPanel::add_video_panel_to_grid ()
773 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
777 add_label_to_sizer (_video_grid, _container_label, true, wxGBPosition (r, 0));
779 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
780 s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
781 s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
782 _video_grid->Add (s, wxGBPosition(r, 1));
786 add_label_to_sizer (_video_grid, _resolution_label, true, wxGBPosition (r, 0));
787 _video_grid->Add (_resolution, wxGBPosition (r, 1));
790 add_label_to_sizer (_video_grid, _frame_rate_label, true, wxGBPosition (r, 0));
792 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
793 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
794 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
795 _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
796 _video_grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
800 _video_grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
803 _j2k_bandwidth_label->Show (full);
804 _j2k_bandwidth->Show (full);
805 _mbits_label->Show (full);
808 add_label_to_sizer (_video_grid, _j2k_bandwidth_label, true, wxGBPosition (r, 0));
809 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
810 s->Add (_j2k_bandwidth, 1);
811 add_label_to_sizer (s, _mbits_label, false);
812 _video_grid->Add (s, wxGBPosition (r, 1));
818 DCPPanel::minimum_allowed_audio_channels () const
821 if (_film && _film->audio_processor ()) {
822 min = _film->audio_processor()->out_channels ();
833 DCPPanel::make_audio_panel ()
835 wxPanel* panel = new wxPanel (_notebook);
836 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
837 _audio_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
838 sizer->Add (_audio_grid, 0, wxALL, 8);
839 panel->SetSizer (sizer);
841 _channels_label = create_label (panel, _("Channels"), true);
842 _audio_channels = new wxChoice (panel, wxID_ANY);
843 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
845 _processor_label = create_label (panel, _("Processor"), true);
846 _audio_processor = new wxChoice (panel, wxID_ANY);
847 _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
848 BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::all ()) {
849 _audio_processor->Append (std_to_wx (ap->name ()), new wxStringClientData (std_to_wx (ap->id ())));
852 _show_audio = new wxButton (panel, wxID_ANY, _("Show audio..."));
854 _audio_channels->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_channels_changed, this));
855 _audio_processor->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_processor_changed, this));
856 _show_audio->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::show_audio_clicked, this));
858 add_audio_panel_to_grid ();
864 DCPPanel::add_audio_panel_to_grid ()
866 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
870 _channels_label->Show (full);
871 _audio_channels->Show (full);
874 add_label_to_sizer (_audio_grid, _channels_label, true, wxGBPosition (r, 0));
875 _audio_grid->Add (_audio_channels, wxGBPosition (r, 1));
879 _processor_label->Show (full);
880 _audio_processor->Show (full);
883 add_label_to_sizer (_audio_grid, _processor_label, true, wxGBPosition (r, 0));
884 _audio_grid->Add (_audio_processor, wxGBPosition (r, 1));
888 _audio_grid->Add (_show_audio, wxGBPosition (r, 0), wxGBSpan (1, 2));
893 DCPPanel::copy_isdcf_name_button_clicked ()
895 _film->set_name (_film->isdcf_name (true));
896 _film->set_use_isdcf_name (false);
900 DCPPanel::audio_processor_changed ()
906 string const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
907 _film->set_audio_processor (AudioProcessor::from_id (s));
911 DCPPanel::show_audio_clicked ()
918 _audio_dialog->Destroy ();
922 AudioDialog* d = new AudioDialog (_panel, _film);
927 DCPPanel::reel_type_changed ()
933 _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
937 DCPPanel::reel_length_changed ()
943 _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);