From 0cc02b1a10a6d6f24e0346af1a6ec18e93dc37fa Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 13 Jun 2025 00:17:18 +0200 Subject: Move check for returning to ISDCF name mode. film_changed() is used on startup to set things up, so it's not a reliable way to know when the user has clicked the checkbox. Move the check into the click handler instead. This prevents film names like Fred_Jim_Sheila being truncated to Fred on loading a project. --- src/wx/dcp_panel.cc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 7a0613a5f..9d6eafe13 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -407,13 +407,6 @@ DCPPanel::film_changed(FilmProperty p) case FilmProperty::USE_ISDCF_NAME: { checked_set(_use_isdcf_name, _film->use_isdcf_name()); - if (_film->use_isdcf_name()) { - /* We are going back to using an ISDCF name. Remove anything after a _ in the current name, - in case the user has clicked 'Copy as name' then re-ticked 'Use ISDCF name' (#1513). - */ - string const name = _film->name(); - _film->set_name(name.substr(0, name.find("_"))); - } setup_dcp_name(); break; } @@ -709,9 +702,20 @@ DCPPanel::use_isdcf_name_toggled() return; } - _film->set_use_isdcf_name(_use_isdcf_name->GetValue()); + auto const new_value = _use_isdcf_name->GetValue(); + + _film->set_use_isdcf_name(new_value); + + if (new_value) { + /* We are going back to using an ISDCF name. Remove anything after a _ in the current name, + in case the user has clicked 'Copy as name' then re-ticked 'Use ISDCF name' (#1513). + */ + string const name = _film->name(); + _film->set_name(name.substr(0, name.find("_"))); + } } + void DCPPanel::setup_dcp_name() { -- cgit v1.2.3