From: Carl Hetherington Date: Wed, 3 Apr 2024 21:26:50 +0000 (+0200) Subject: Update available containers whenever they change, always adding the one that the... X-Git-Tag: v2.17.16^2~10 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=32053c222183e17c7c662e6d3f95b9a203461061 Update available containers whenever they change, always adding the one that the film is currently using. --- diff --git a/src/lib/config.h b/src/lib/config.h index 05421c20a..ff71f8a38 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -97,6 +97,7 @@ public: AUTO_CROP_THRESHOLD, ALLOW_SMPTE_BV20, ISDCF_NAME_PART_LENGTH, + ALLOW_ANY_CONTAINER, #ifdef DCPOMATIC_GROK GROK, #endif @@ -742,7 +743,7 @@ public: } void set_allow_any_container (bool a) { - maybe_set (_allow_any_container, a); + maybe_set(_allow_any_container, a, ALLOW_ANY_CONTAINER); } void set_allow_96hhz_audio (bool a) { diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 5ad719abc..2d4e9b3d3 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -458,6 +458,7 @@ DCPPanel::film_changed(FilmProperty p) break; case FilmProperty::VIDEO_ENCODING: set_standard(); + setup_container(); break; case FilmProperty::LIMIT_TO_SMPTE_BV20: set_standard(); @@ -540,24 +541,28 @@ DCPPanel::film_content_changed (int property) void DCPPanel::setup_container () { - int n = 0; - auto ratios = Ratio::containers (); - auto i = ratios.begin (); - while (i != ratios.end() && *i != _film->container()) { - ++i; - ++n; + auto ratios = Ratio::containers(); + if (std::find(ratios.begin(), ratios.end(), _film->container()) == ratios.end()) { + ratios.push_back(_film->container()); } - if (i == ratios.end()) { - checked_set (_container, -1); - checked_set (_container_size, wxT("")); - } else { - checked_set (_container, n); - auto const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ()); - checked_set (_container_size, wxString::Format("%dx%d", size.width, size.height)); + wxArrayString new_ratios; + for (auto ratio: ratios) { + new_ratios.Add(std_to_wx(ratio->container_nickname())); } + _container->set_entries(new_ratios); + + auto iter = std::find_if(ratios.begin(), ratios.end(), [this](Ratio const* ratio) { return ratio == _film->container(); }); + DCPOMATIC_ASSERT(iter != ratios.end()); + + checked_set(_container, iter - ratios.begin()); + auto const size = fit_ratio_within(_film->container()->ratio(), _film->full_frame ()); + checked_set(_container_size, wxString::Format("%dx%d", size.width, size.height)); + setup_dcp_name (); + + _video_grid->Layout(); } @@ -822,10 +827,6 @@ DCPPanel::make_video_panel () _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()); - } - for (auto i: Config::instance()->allowed_dcp_frame_rates()) { _frame_rate_choice->add_entry(boost::lexical_cast(i)); } diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index 2947d98eb..092c9ab26 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -1559,13 +1559,7 @@ private: _allow_any_container = new CheckBox(_panel, _("Allow full-frame and non-standard container ratios")); table->Add(_allow_any_container, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP); - auto restart = new StaticText(_panel, variant::wx::insert_dcpomatic(_("(restart %s to see all ratios)"))); - auto font = restart->GetFont(); - font.SetStyle(wxFONTSTYLE_ITALIC); - font.SetPointSize(font.GetPointSize() - 1); - restart->SetFont(font); - table->Add(restart, 1, wxALIGN_CENTRE_VERTICAL | wxBOTTOM, DCPOMATIC_CHECKBOX_BOTTOM_PAD); - restart->SetFont(font); + table->AddSpacer(0); checkbox(_("Allow creation of DCPs with 96kHz audio"), _allow_96khz_audio); checkbox(_("Allow mapping to all audio channels"), _use_all_audio_channels);