X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Fdcp_panel.cc;h=6574bcdb314397c14f388397fc218857b9200671;hp=ea1dd6d612ab9221014eef9e02e23e25edca1dcf;hb=4ec9f7096050e9d1107628ffc28b785fba3020a0;hpb=d9b398b33716d5f28fd8d6e22cb723c2fbb635a0 diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index ea1dd6d61..6574bcdb3 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -70,7 +70,7 @@ using namespace boost::placeholders; using dcp::locale_convert; -DCPPanel::DCPPanel (wxNotebook* n, shared_ptr film, weak_ptr viewer) +DCPPanel::DCPPanel(wxNotebook* n, shared_ptr film, FilmViewer& viewer) : _film (film) , _viewer (viewer) , _generally_sensitive (true) @@ -97,7 +97,7 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr film, weak_ptr v wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE ); - _enable_audio_language = new wxCheckBox (_panel, wxID_ANY, _("Audio language")); + _enable_audio_language = new CheckBox(_panel, _("Audio language")); _audio_language = new wxStaticText (_panel, wxID_ANY, wxT("")); _edit_audio_language = new Button (_panel, _("Edit...")); @@ -130,16 +130,16 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr film, weak_ptr v _notebook->AddPage (make_audio_panel (), _("Audio"), false); _name->Bind (wxEVT_TEXT, boost::bind(&DCPPanel::name_changed, this)); - _use_isdcf_name->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::use_isdcf_name_toggled, this)); + _use_isdcf_name->bind(&DCPPanel::use_isdcf_name_toggled, this); _copy_isdcf_name_button->Bind(wxEVT_BUTTON, boost::bind(&DCPPanel::copy_isdcf_name_button_clicked, this)); _dcp_content_type->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::dcp_content_type_changed, this)); - _encrypted->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::encrypted_toggled, this)); + _encrypted->bind(&DCPPanel::encrypted_toggled, this); _reel_type->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::reel_type_changed, this)); _reel_length->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::reel_length_changed, this)); _standard->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::standard_changed, this)); _markers->Bind (wxEVT_BUTTON, boost::bind(&DCPPanel::markers_clicked, this)); _metadata->Bind (wxEVT_BUTTON, boost::bind(&DCPPanel::metadata_clicked, this)); - _enable_audio_language->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::enable_audio_language_toggled, this)); + _enable_audio_language->bind(&DCPPanel::enable_audio_language_toggled, this); _edit_audio_language->Bind (wxEVT_BUTTON, boost::bind(&DCPPanel::edit_audio_language_clicked, this)); for (auto i: DCPContentType::all()) { @@ -150,17 +150,70 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr film, weak_ptr v _reel_type->add(_("Split by video content")); /// TRANSLATORS: translate the word "Custom" here; do not include the "Reel|" prefix _reel_type->add(S_("Reel|Custom")); + _reel_type->SetToolTip(_("How the DCP should be split into parts internally. If in doubt, choose 'Single reel'")); _reel_length->SetRange (1, 64); - _standard->add(_("SMPTE")); - _standard->add(_("Interop")); + add_standards(); + _standard->SetToolTip(_("Which standard the DCP should use. Interop is older and SMPTE is the modern standard. If in doubt, choose 'SMPTE'")); Config::instance()->Changed.connect (boost::bind(&DCPPanel::config_changed, this, _1)); add_to_grid (); } + +void +DCPPanel::add_standards() +{ + _standard->add(_("SMPTE"), N_("smpte")); + if (Config::instance()->allow_smpte_bv20() || (_film && _film->limit_to_smpte_bv20())) { + _standard->add(_("SMPTE (Bv2.0 only)"), N_("smpte-bv20")); + } + _standard->add(_("Interop"), N_("interop")); + _sizer->Layout(); +} + + +void +DCPPanel::set_standard() +{ + DCPOMATIC_ASSERT(_film); + DCPOMATIC_ASSERT(!_film->limit_to_smpte_bv20() || _standard->GetCount() == 3); + + if (_film->interop()) { + checked_set(_standard, "interop"); + } else { + checked_set(_standard, _film->limit_to_smpte_bv20() ? "smpte-bv20" : "smpte"); + } +} + + +void +DCPPanel::standard_changed () +{ + if (!_film || !_standard->get()) { + return; + } + + auto const data = _standard->get_data(); + if (!data) { + return; + } + + if (*data == N_("interop")) { + _film->set_interop(true); + _film->set_limit_to_smpte_bv20(false); + } else if (*data == N_("smpte")) { + _film->set_interop(false); + _film->set_limit_to_smpte_bv20(false); + } else if (*data == N_("smpte-bv20")) { + _film->set_interop(false); + _film->set_limit_to_smpte_bv20(true); + } +} + + void DCPPanel::add_to_grid () { @@ -313,26 +366,10 @@ DCPPanel::resolution_changed () } -void -DCPPanel::standard_changed () -{ - if (!_film || !_standard->get()) { - return; - } - - _film->set_interop(*_standard->get() == 1); - -} - void DCPPanel::markers_clicked () { - if (_markers_dialog) { - _markers_dialog->Destroy (); - _markers_dialog = nullptr; - } - - _markers_dialog = new MarkersDialog (_panel, _film, _viewer); + _markers_dialog.reset(_panel, _film, _viewer); _markers_dialog->Show(); } @@ -341,21 +378,11 @@ void DCPPanel::metadata_clicked () { if (_film->interop()) { - if (_interop_metadata_dialog) { - _interop_metadata_dialog->Destroy (); - _interop_metadata_dialog = nullptr; - } - - _interop_metadata_dialog = new InteropMetadataDialog (_panel, _film); + _interop_metadata_dialog.reset(_panel, _film); _interop_metadata_dialog->setup (); _interop_metadata_dialog->Show (); } else { - if (_smpte_metadata_dialog) { - _smpte_metadata_dialog->Destroy (); - _smpte_metadata_dialog = nullptr; - } - - _smpte_metadata_dialog = new SMPTEMetadataDialog (_panel, _film); + _smpte_metadata_dialog.reset(_panel, _film); _smpte_metadata_dialog->setup (); _smpte_metadata_dialog->Show (); } @@ -447,10 +474,13 @@ DCPPanel::film_changed (Film::Property p) checked_set (_reencode_j2k, _film->reencode_j2k()); break; case Film::Property::INTEROP: - checked_set (_standard, _film->interop() ? 1 : 0); + set_standard(); setup_dcp_name (); _markers->Enable (!_film->interop()); break; + case Film::Property::LIMIT_TO_SMPTE_BV20: + set_standard(); + break; case Film::Property::AUDIO_PROCESSOR: if (_film->audio_processor()) { checked_set (_audio_processor, _film->audio_processor()->id()); @@ -586,22 +616,10 @@ void DCPPanel::set_film (shared_ptr film) { /* We are changing film, so destroy any dialogs for the old one */ - if (_audio_dialog) { - _audio_dialog->Destroy (); - _audio_dialog = nullptr; - } - if (_markers_dialog) { - _markers_dialog->Destroy (); - _markers_dialog = nullptr; - } - if (_interop_metadata_dialog) { - _interop_metadata_dialog->Destroy (); - _interop_metadata_dialog = nullptr; - } - if (_smpte_metadata_dialog) { - _smpte_metadata_dialog->Destroy (); - _smpte_metadata_dialog = nullptr; - } + _audio_dialog.reset(); + _markers_dialog.reset(); + _interop_metadata_dialog.reset(); + _smpte_metadata_dialog.reset(); _film = film; @@ -612,6 +630,9 @@ DCPPanel::set_film (shared_ptr film) return; } + _standard->Clear(); + add_standards(); + film_changed (Film::Property::NAME); film_changed (Film::Property::USE_ISDCF_NAME); film_changed (Film::Property::CONTENT); @@ -631,6 +652,7 @@ DCPPanel::set_film (shared_ptr film) film_changed (Film::Property::REENCODE_J2K); film_changed (Film::Property::AUDIO_LANGUAGE); film_changed (Film::Property::AUDIO_FRAME_RATE); + film_changed (Film::Property::LIMIT_TO_SMPTE_BV20); set_general_sensitivity(static_cast(_film)); } @@ -751,6 +773,13 @@ DCPPanel::config_changed (Config::Property p) if (_film) { film_changed (Film::Property::AUDIO_PROCESSOR); } + } else if (p == Config::ALLOW_SMPTE_BV20) { + _standard->Clear(); + add_standards(); + if (_film) { + film_changed(Film::Property::INTEROP); + film_changed(Film::Property::LIMIT_TO_SMPTE_BV20); + } } } @@ -765,6 +794,7 @@ DCPPanel::setup_frame_rate_widget () _frame_rate_choice->Show (); _frame_rate_spin->Hide (); } + _frame_rate_sizer->Layout(); } @@ -787,7 +817,6 @@ DCPPanel::make_video_panel () _frame_rate_label = create_label (panel, _("Frame Rate"), true); _frame_rate_choice = new Choice(panel); _frame_rate_spin = new SpinCtrl (panel, DCPOMATIC_SPIN_CTRL_WIDTH); - setup_frame_rate_widget (); _best_frame_rate = new Button (panel, _("Use best")); _three_d = new CheckBox (panel, _("3D")); @@ -806,8 +835,8 @@ DCPPanel::make_video_panel () /* Also listen to wxEVT_TEXT so that typing numbers directly in is always noticed */ _j2k_bandwidth->Bind (wxEVT_TEXT, boost::bind(&DCPPanel::j2k_bandwidth_changed, this)); _resolution->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::resolution_changed, this)); - _three_d->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::three_d_changed, this)); - _reencode_j2k->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::reencode_j2k_changed, this)); + _three_d->bind(&DCPPanel::three_d_changed, this); + _reencode_j2k->bind(&DCPPanel::reencode_j2k_changed, this); for (auto i: Ratio::containers()) { _container->add(i->container_nickname()); @@ -824,6 +853,7 @@ DCPPanel::make_video_panel () _resolution->add(_("4K")); add_video_panel_to_grid (); + setup_frame_rate_widget(); return panel; } @@ -979,13 +1009,8 @@ DCPPanel::show_audio_clicked () return; } - if (_audio_dialog) { - _audio_dialog->Destroy (); - _audio_dialog = nullptr; - } - - auto d = new AudioDialog (_panel, _film, _viewer); - d->Show (); + _audio_dialog.reset(_panel, _film, _viewer); + _audio_dialog->Show(); } @@ -1014,7 +1039,7 @@ DCPPanel::reel_length_changed () void DCPPanel::add_audio_processors () { - _audio_processor->Append (_("None"), new wxStringClientData(N_("none"))); + _audio_processor->add(_("None"), new wxStringClientData(N_("none"))); for (auto ap: AudioProcessor::visible()) { _audio_processor->add(std_to_wx(ap->name()), new wxStringClientData(std_to_wx(ap->id()))); } @@ -1039,11 +1064,10 @@ void DCPPanel::edit_audio_language_clicked () { DCPOMATIC_ASSERT (_film->audio_language()); - auto d = new LanguageTagDialog (_panel, *_film->audio_language()); + auto d = make_wx(_panel, *_film->audio_language()); if (d->ShowModal() == wxID_OK) { _film->set_audio_language(d->get()); } - d->Destroy (); }