2 Copyright (C) 2012-2020 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 "isdcf_metadata_dialog.h"
24 #include "audio_dialog.h"
25 #include "focus_manager.h"
26 #include "check_box.h"
27 #include "static_text.h"
28 #include "check_box.h"
29 #include "dcpomatic_button.h"
30 #include "markers_dialog.h"
31 #include "metadata_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>
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 boost::weak_ptr;
62 #if BOOST_VERSION >= 106100
63 using namespace boost::placeholders;
65 using dcp::locale_convert;
67 DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> viewer)
70 , _metadata_dialog (0)
73 , _generally_sensitive (true)
75 _panel = new wxPanel (n);
76 _sizer = new wxBoxSizer (wxVERTICAL);
77 _panel->SetSizer (_sizer);
79 _grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
80 _sizer->Add (_grid, 0, wxEXPAND | wxALL, 8);
82 _name_label = create_label (_panel, _("Name"), true);
83 _name = new wxTextCtrl (_panel, wxID_ANY);
84 FocusManager::instance()->add(_name);
86 _use_isdcf_name = new CheckBox (_panel, _("Use ISDCF name"));
87 _edit_isdcf_button = new Button (_panel, _("Details..."));
88 _copy_isdcf_name_button = new Button (_panel, _("Copy as name"));
90 /* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see
91 http://trac.wxwidgets.org/ticket/12539
93 _dcp_name = new StaticText (
94 _panel, wxT (""), wxDefaultPosition, wxDefaultSize,
95 wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE
98 _dcp_content_type_label = create_label (_panel, _("Content Type"), true);
99 _dcp_content_type = new wxChoice (_panel, wxID_ANY);
101 _encrypted = new CheckBox (_panel, _("Encrypted"));
103 wxClientDC dc (_panel);
104 wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
107 _reels_label = create_label (_panel, _("Reels"), true);
108 _reel_type = new wxChoice (_panel, wxID_ANY);
110 _reel_length_label = create_label (_panel, _("Reel length"), true);
111 _reel_length = new wxSpinCtrl (_panel, wxID_ANY);
112 _reel_length_gb_label = create_label (_panel, _("GB"), false);
114 _standard_label = create_label (_panel, _("Standard"), true);
115 _standard = new wxChoice (_panel, wxID_ANY);
117 _markers = new Button (_panel, _("Markers..."));
118 _metadata = new Button (_panel, _("Metadata..."));
120 _notebook = new wxNotebook (_panel, wxID_ANY);
121 _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
123 _notebook->AddPage (make_video_panel (), _("Video"), false);
124 _notebook->AddPage (make_audio_panel (), _("Audio"), false);
126 _name->Bind (wxEVT_TEXT, boost::bind (&DCPPanel::name_changed, this));
127 _use_isdcf_name->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
128 _edit_isdcf_button->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
129 _copy_isdcf_name_button->Bind(wxEVT_BUTTON, boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
130 _dcp_content_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::dcp_content_type_changed, this));
131 _encrypted->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::encrypted_toggled, this));
132 _reel_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::reel_type_changed, this));
133 _reel_length->Bind (wxEVT_SPINCTRL, boost::bind (&DCPPanel::reel_length_changed, this));
134 _standard->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::standard_changed, this));
135 _markers->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::markers_clicked, this));
136 _metadata->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::metadata_clicked, this));
138 BOOST_FOREACH (DCPContentType const * i, DCPContentType::all()) {
139 _dcp_content_type->Append (std_to_wx (i->pretty_name ()));
142 _reel_type->Append (_("Single reel"));
143 _reel_type->Append (_("Split by video content"));
144 /// TRANSLATORS: translate the word "Custom" here; do not include the "Reel|" prefix
145 _reel_type->Append (S_("Reel|Custom"));
147 _reel_length->SetRange (1, 64);
149 _standard->Append (_("SMPTE"));
150 _standard->Append (_("Interop"));
152 Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this, _1));
158 DCPPanel::add_to_grid ()
160 Config::Interface interface = Config::instance()->interface_complexity ();
164 add_label_to_sizer (_grid, _name_label, true, wxGBPosition (r, 0));
165 _grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
168 int flags = wxALIGN_CENTER_VERTICAL;
170 flags |= wxALIGN_RIGHT;
173 bool const full = interface == Config::INTERFACE_FULL;
175 _use_isdcf_name->Show (full);
176 _edit_isdcf_button->Show (full);
177 _copy_isdcf_name_button->Show (full);
180 _grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
182 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
183 s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
184 s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
185 _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
190 _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
193 add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition (r, 0));
194 _grid->Add (_dcp_content_type, wxGBPosition (r, 1));
197 _grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
201 _reels_label->Show (full);
202 _reel_type->Show (full);
203 _reel_length_label->Show (full);
204 _reel_length->Show (full);
205 _reel_length_gb_label->Show (full);
206 _standard_label->Show (full);
207 _standard->Show (full);
208 _markers->Show (full);
209 _metadata->Show (full);
210 _reencode_j2k->Show (full);
211 _encrypted->Show (full);
214 add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
215 _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
218 add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition (r, 0));
220 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
221 s->Add (_reel_length);
222 add_label_to_sizer (s, _reel_length_gb_label, false);
223 _grid->Add (s, wxGBPosition (r, 1));
227 add_label_to_sizer (_grid, _standard_label, true, wxGBPosition (r, 0));
228 _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
231 wxBoxSizer* extra = new wxBoxSizer (wxHORIZONTAL);
232 extra->Add (_markers, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
233 extra->Add (_metadata, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
234 _grid->Add (extra, wxGBPosition(r, 0), wxGBSpan(1, 2));
240 DCPPanel::name_changed ()
246 _film->set_name (string (_name->GetValue().mb_str()));
250 DCPPanel::j2k_bandwidth_changed ()
256 _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
260 DCPPanel::encrypted_toggled ()
266 _film->set_encrypted (_encrypted->GetValue ());
269 /** Called when the frame rate choice widget has been changed */
271 DCPPanel::frame_rate_choice_changed ()
277 _film->set_video_frame_rate (
278 boost::lexical_cast<int>(
279 wx_to_std(_frame_rate_choice->GetString(_frame_rate_choice->GetSelection()))
285 /** Called when the frame rate spin widget has been changed */
287 DCPPanel::frame_rate_spin_changed ()
293 _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
297 DCPPanel::audio_channels_changed ()
303 _film->set_audio_channels (locale_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
307 DCPPanel::resolution_changed ()
313 _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
317 DCPPanel::standard_changed ()
323 _film->set_interop (_standard->GetSelection() == 1);
327 DCPPanel::markers_clicked ()
329 if (_markers_dialog) {
330 _markers_dialog->Destroy ();
334 _markers_dialog = new MarkersDialog (_panel, _film, _viewer);
335 _markers_dialog->Show();
339 DCPPanel::metadata_clicked ()
341 if (_metadata_dialog) {
342 _metadata_dialog->Destroy ();
343 _metadata_dialog = 0;
346 _metadata_dialog = new MetadataDialog (_panel, _film);
347 _metadata_dialog->Show ();
351 DCPPanel::film_changed (int p)
356 case Film::CONTAINER:
360 checked_set (_name, _film->name());
363 case Film::DCP_CONTENT_TYPE:
364 checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
367 case Film::ENCRYPTED:
368 checked_set (_encrypted, _film->encrypted ());
370 case Film::RESOLUTION:
371 checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
375 case Film::J2K_BANDWIDTH:
376 checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
378 case Film::USE_ISDCF_NAME:
380 checked_set (_use_isdcf_name, _film->use_isdcf_name ());
381 if (_film->use_isdcf_name()) {
382 /* We are going back to using an ISDCF name. Remove anything after a _ in the current name,
383 in case the user has clicked 'Copy as name' then re-ticked 'Use ISDCF name' (#1513).
385 string const name = _film->name ();
386 string::size_type const u = name.find("_");
387 if (u != string::npos) {
388 _film->set_name (name.substr(0, u));
392 _edit_isdcf_button->Enable (_film->use_isdcf_name ());
395 case Film::ISDCF_METADATA:
398 case Film::VIDEO_FRAME_RATE:
401 for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
402 if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
403 checked_set (_frame_rate_choice, i);
410 checked_set (_frame_rate_choice, -1);
413 checked_set (_frame_rate_spin, _film->video_frame_rate ());
415 _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
419 case Film::AUDIO_CHANNELS:
420 if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
421 _film->set_audio_channels (minimum_allowed_audio_channels ());
423 checked_set (_audio_channels, locale_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
428 checked_set (_three_d, _film->three_d ());
431 case Film::REENCODE_J2K:
432 checked_set (_reencode_j2k, _film->reencode_j2k());
435 checked_set (_standard, _film->interop() ? 1 : 0);
437 _markers->Enable (!_film->interop());
439 case Film::AUDIO_PROCESSOR:
440 if (_film->audio_processor ()) {
441 checked_set (_audio_processor, _film->audio_processor()->id());
443 checked_set (_audio_processor, 0);
445 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
446 film_changed (Film::AUDIO_CHANNELS);
448 case Film::REEL_TYPE:
449 checked_set (_reel_type, _film->reel_type ());
450 _reel_length->Enable (_film->reel_type() == REELTYPE_BY_LENGTH);
452 case Film::REEL_LENGTH:
453 checked_set (_reel_length, _film->reel_length() / 1000000000LL);
457 setup_sensitivity ();
465 DCPPanel::film_content_changed (int property)
467 if (property == AudioContentProperty::STREAMS ||
468 property == TextContentProperty::USE ||
469 property == TextContentProperty::BURN ||
470 property == VideoContentProperty::SCALE ||
471 property == DCPContentProperty::REFERENCE_VIDEO ||
472 property == DCPContentProperty::REFERENCE_AUDIO ||
473 property == DCPContentProperty::REFERENCE_TEXT) {
475 setup_sensitivity ();
481 DCPPanel::setup_container ()
484 vector<Ratio const *> ratios = Ratio::containers ();
485 vector<Ratio const *>::iterator i = ratios.begin ();
486 while (i != ratios.end() && *i != _film->container ()) {
491 if (i == ratios.end()) {
492 checked_set (_container, -1);
493 checked_set (_container_size, wxT (""));
495 checked_set (_container, n);
496 dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
497 checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height));
503 /** Called when the container widget has been changed */
505 DCPPanel::container_changed ()
511 int const n = _container->GetSelection ();
513 vector<Ratio const *> ratios = Ratio::containers ();
514 DCPOMATIC_ASSERT (n < int (ratios.size()));
515 _film->set_container (ratios[n]);
519 /** Called when the DCP content type widget has been changed */
521 DCPPanel::dcp_content_type_changed ()
527 int const n = _dcp_content_type->GetSelection ();
528 if (n != wxNOT_FOUND) {
529 _film->set_dcp_content_type (DCPContentType::from_index (n));
534 DCPPanel::set_film (shared_ptr<Film> film)
536 /* We are changing film, so destroy any dialogs for the old one */
538 _audio_dialog->Destroy ();
541 if (_markers_dialog) {
542 _markers_dialog->Destroy ();
545 if (_metadata_dialog) {
546 _metadata_dialog->Destroy ();
547 _metadata_dialog = 0;
553 /* Really should all the film_changed below but this might be enough */
554 checked_set (_dcp_name, wxT(""));
555 set_general_sensitivity (false);
559 film_changed (Film::NAME);
560 film_changed (Film::USE_ISDCF_NAME);
561 film_changed (Film::CONTENT);
562 film_changed (Film::DCP_CONTENT_TYPE);
563 film_changed (Film::CONTAINER);
564 film_changed (Film::RESOLUTION);
565 film_changed (Film::ENCRYPTED);
566 film_changed (Film::J2K_BANDWIDTH);
567 film_changed (Film::ISDCF_METADATA);
568 film_changed (Film::VIDEO_FRAME_RATE);
569 film_changed (Film::AUDIO_CHANNELS);
570 film_changed (Film::SEQUENCE);
571 film_changed (Film::THREE_D);
572 film_changed (Film::INTEROP);
573 film_changed (Film::AUDIO_PROCESSOR);
574 film_changed (Film::REEL_TYPE);
575 film_changed (Film::REEL_LENGTH);
576 film_changed (Film::REENCODE_J2K);
578 set_general_sensitivity(static_cast<bool>(_film));
582 DCPPanel::set_general_sensitivity (bool s)
584 _generally_sensitive = s;
585 setup_sensitivity ();
589 DCPPanel::setup_sensitivity ()
591 _name->Enable (_generally_sensitive);
592 _use_isdcf_name->Enable (_generally_sensitive);
593 _edit_isdcf_button->Enable (_generally_sensitive);
594 _dcp_content_type->Enable (_generally_sensitive);
595 _copy_isdcf_name_button->Enable (_generally_sensitive);
596 _encrypted->Enable (_generally_sensitive);
597 _reel_type->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
598 _reel_length->Enable (_generally_sensitive && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
599 _markers->Enable (_generally_sensitive && _film && !_film->interop());
600 _metadata->Enable (_generally_sensitive);
601 _frame_rate_choice->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->contains_atmos_content());
602 _frame_rate_spin->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->contains_atmos_content());
603 _audio_channels->Enable (_generally_sensitive && _film && !_film->references_dcp_audio() && !_film->contains_atmos_content());
604 _audio_processor->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
605 _j2k_bandwidth->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
606 _container->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
607 _best_frame_rate->Enable (
608 _generally_sensitive &&
610 _film->best_video_frame_rate () != _film->video_frame_rate() &&
611 !_film->references_dcp_video() &&
612 !_film->contains_atmos_content()
614 _resolution->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
615 _three_d->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
618 _generally_sensitive &&
620 !_film->references_dcp_video() &&
621 !_film->references_dcp_audio() &&
622 !_film->contains_atmos_content()
625 _reencode_j2k->Enable (_generally_sensitive && _film);
626 _show_audio->Enable (_generally_sensitive && _film);
630 DCPPanel::use_isdcf_name_toggled ()
636 _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
640 DCPPanel::edit_isdcf_button_clicked ()
646 ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
648 _film->set_isdcf_metadata (d->isdcf_metadata ());
653 DCPPanel::setup_dcp_name ()
655 _dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
656 _dcp_name->SetToolTip (std_to_wx (_film->dcp_name (true)));
660 DCPPanel::best_frame_rate_clicked ()
666 _film->set_video_frame_rate (_film->best_video_frame_rate ());
670 DCPPanel::three_d_changed ()
676 _film->set_three_d (_three_d->GetValue ());
680 DCPPanel::reencode_j2k_changed ()
686 _film->set_reencode_j2k (_reencode_j2k->GetValue());
690 DCPPanel::config_changed (Config::Property p)
692 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
693 setup_frame_rate_widget ();
695 if (p == Config::INTERFACE_COMPLEXITY) {
701 _video_grid->Clear ();
702 add_video_panel_to_grid ();
703 _video_grid->Layout ();
705 _audio_grid->Clear ();
706 add_audio_panel_to_grid ();
707 _audio_grid->Layout ();
708 } else if (p == Config::SHOW_EXPERIMENTAL_AUDIO_PROCESSORS) {
709 _audio_processor->Clear ();
710 add_audio_processors ();
712 film_changed (Film::AUDIO_PROCESSOR);
718 DCPPanel::setup_frame_rate_widget ()
720 if (Config::instance()->allow_any_dcp_frame_rate ()) {
721 _frame_rate_choice->Hide ();
722 _frame_rate_spin->Show ();
724 _frame_rate_choice->Show ();
725 _frame_rate_spin->Hide ();
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_spin = new wxSpinCtrl (panel, wxID_ANY);
748 setup_frame_rate_widget ();
749 _best_frame_rate = new Button (panel, _("Use best"));
751 _three_d = new CheckBox (panel, _("3D"));
753 _j2k_bandwidth_label = create_label (panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true);
754 _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
755 _mbits_label = create_label (panel, _("Mbit/s"), false);
757 _reencode_j2k = new CheckBox (panel, _("Re-encode JPEG2000 data from input"));
759 _container->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::container_changed, this));
760 _frame_rate_choice->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::frame_rate_choice_changed, this));
761 _frame_rate_spin->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::frame_rate_spin_changed, this));
762 _best_frame_rate->Bind (wxEVT_BUTTON, boost::bind(&DCPPanel::best_frame_rate_clicked, this));
763 _j2k_bandwidth->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
764 /* Also listen to wxEVT_TEXT so that typing numbers directly in is always noticed */
765 _j2k_bandwidth->Bind (wxEVT_TEXT, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
766 _resolution->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::resolution_changed, this));
767 _three_d->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::three_d_changed, this));
768 _reencode_j2k->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::reencode_j2k_changed, this));
770 BOOST_FOREACH (Ratio const * i, Ratio::containers()) {
771 _container->Append (std_to_wx(i->container_nickname()));
774 BOOST_FOREACH (int i, Config::instance()->allowed_dcp_frame_rates()) {
775 _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (i)));
778 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
779 _frame_rate_spin->SetRange (1, 480);
781 _resolution->Append (_("2K"));
782 _resolution->Append (_("4K"));
784 add_video_panel_to_grid ();
790 DCPPanel::add_video_panel_to_grid ()
792 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
796 add_label_to_sizer (_video_grid, _container_label, true, wxGBPosition (r, 0));
798 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
799 s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
800 s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
801 _video_grid->Add (s, wxGBPosition(r, 1));
805 add_label_to_sizer (_video_grid, _resolution_label, true, wxGBPosition (r, 0));
806 _video_grid->Add (_resolution, wxGBPosition (r, 1));
809 add_label_to_sizer (_video_grid, _frame_rate_label, true, wxGBPosition (r, 0));
811 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
812 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
813 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
814 _frame_rate_sizer->Add (_best_frame_rate, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
815 _video_grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
819 _video_grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
822 _j2k_bandwidth_label->Show (full);
823 _j2k_bandwidth->Show (full);
824 _mbits_label->Show (full);
827 add_label_to_sizer (_video_grid, _j2k_bandwidth_label, true, wxGBPosition (r, 0));
828 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
829 s->Add (_j2k_bandwidth, 1);
830 add_label_to_sizer (s, _mbits_label, false);
831 _video_grid->Add (s, wxGBPosition (r, 1));
833 _video_grid->Add (_reencode_j2k, wxGBPosition(r, 0), wxGBSpan(1, 2));
838 DCPPanel::minimum_allowed_audio_channels () const
841 if (_film && _film->audio_processor ()) {
842 min = _film->audio_processor()->out_channels ();
853 DCPPanel::make_audio_panel ()
855 wxPanel* panel = new wxPanel (_notebook);
856 _audio_panel_sizer = new wxBoxSizer (wxVERTICAL);
857 _audio_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
858 _audio_panel_sizer->Add (_audio_grid, 0, wxALL, 8);
859 panel->SetSizer (_audio_panel_sizer);
861 _channels_label = create_label (panel, _("Channels"), true);
862 _audio_channels = new wxChoice (panel, wxID_ANY);
863 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
865 _processor_label = create_label (panel, _("Processor"), true);
866 _audio_processor = new wxChoice (panel, wxID_ANY);
867 add_audio_processors ();
869 _show_audio = new Button (panel, _("Show audio..."));
871 _audio_channels->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_channels_changed, this));
872 _audio_processor->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_processor_changed, this));
873 _show_audio->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::show_audio_clicked, this));
875 add_audio_panel_to_grid ();
881 DCPPanel::add_audio_panel_to_grid ()
883 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
887 _channels_label->Show (full);
888 _audio_channels->Show (full);
891 add_label_to_sizer (_audio_grid, _channels_label, true, wxGBPosition (r, 0));
892 _audio_grid->Add (_audio_channels, wxGBPosition (r, 1));
896 _processor_label->Show (full);
897 _audio_processor->Show (full);
900 add_label_to_sizer (_audio_grid, _processor_label, true, wxGBPosition (r, 0));
901 _audio_grid->Add (_audio_processor, wxGBPosition (r, 1));
905 _audio_grid->Add (_show_audio, wxGBPosition (r, 0), wxGBSpan (1, 2));
910 DCPPanel::copy_isdcf_name_button_clicked ()
912 _film->set_name (_film->isdcf_name (true));
913 _film->set_use_isdcf_name (false);
917 DCPPanel::audio_processor_changed ()
923 string const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
924 _film->set_audio_processor (AudioProcessor::from_id (s));
928 DCPPanel::show_audio_clicked ()
935 _audio_dialog->Destroy ();
939 AudioDialog* d = new AudioDialog (_panel, _film, _viewer);
944 DCPPanel::reel_type_changed ()
950 _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
954 DCPPanel::reel_length_changed ()
960 _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);
964 DCPPanel::add_audio_processors ()
966 _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
967 BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::visible()) {
968 _audio_processor->Append (std_to_wx(ap->name()), new wxStringClientData(std_to_wx(ap->id())));
970 _audio_panel_sizer->Layout();