summaryrefslogtreecommitdiff
path: root/src/wx/dcp_panel.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-04-03 23:26:50 +0200
committerCarl Hetherington <cth@carlh.net>2024-04-22 13:03:04 +0200
commit32053c222183e17c7c662e6d3f95b9a203461061 (patch)
treea848417a1380c054754f2c90b38b6c2edbf37fdd /src/wx/dcp_panel.cc
parentbd9594a3b9958076734c3c6b3e4105d142cde6f4 (diff)
Update available containers whenever they change, always adding the one that the film is currently using.
Diffstat (limited to 'src/wx/dcp_panel.cc')
-rw-r--r--src/wx/dcp_panel.cc35
1 files changed, 18 insertions, 17 deletions
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<string>(i));
}