+
+ _sign_language_video_language->Changed.connect (boost::bind(&MetadataDialog::sign_language_video_language_changed, this));
+ _edit_release_territory->Bind (wxEVT_BUTTON, boost::bind(&MetadataDialog::edit_release_territory, this));
+ _enable_release_territory->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_release_territory_changed, this));
+ _enable_facility->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_facility_changed, this));
+ _facility->Bind (wxEVT_TEXT, boost::bind(&MetadataDialog::facility_changed, this));
+ _enable_studio->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_studio_changed, this));
+ _studio->Bind (wxEVT_TEXT, boost::bind(&MetadataDialog::studio_changed, this));
+ _enable_chain->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_chain_changed, this));
+ _chain->Bind (wxEVT_TEXT, boost::bind(&MetadataDialog::chain_changed, this));
+ _temp_version->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::temp_version_changed, this));
+ _pre_release->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::pre_release_changed, this));
+ _red_band->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::red_band_changed, this));
+ _two_d_version_of_three_d->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::two_d_version_of_three_d_changed, this));
+ _enable_luminance->Bind (wxEVT_CHECKBOX, boost::bind(&MetadataDialog::enable_luminance_changed, this));
+ _luminance_value->Bind (wxEVT_SPINCTRLDOUBLE, boost::bind(&MetadataDialog::luminance_changed, this));
+ _luminance_unit->Bind (wxEVT_CHOICE, boost::bind(&MetadataDialog::luminance_changed, this));
+
+ _film_changed_connection = film()->Change.connect(boost::bind(&MetadataDialog::film_changed, this, _1, _2));
+
+ film_changed (ChangeType::DONE, Film::Property::RELEASE_TERRITORY);
+ film_changed (ChangeType::DONE, Film::Property::SIGN_LANGUAGE_VIDEO_LANGUAGE);
+ film_changed (ChangeType::DONE, Film::Property::FACILITY);
+ film_changed (ChangeType::DONE, Film::Property::STUDIO);
+ film_changed (ChangeType::DONE, Film::Property::TEMP_VERSION);
+ film_changed (ChangeType::DONE, Film::Property::PRE_RELEASE);
+ film_changed (ChangeType::DONE, Film::Property::RED_BAND);
+ film_changed (ChangeType::DONE, Film::Property::TWO_D_VERSION_OF_THREE_D);
+ film_changed (ChangeType::DONE, Film::Property::CHAIN);
+ film_changed (ChangeType::DONE, Film::Property::LUMINANCE);
+
+ setup_sensitivity ();
+}
+
+
+void
+MetadataDialog::film_changed (ChangeType type, Film::Property property)
+{
+ if (type != ChangeType::DONE) {
+ return;
+ }
+
+ if (property == Film::Property::SIGN_LANGUAGE_VIDEO_LANGUAGE) {
+ _sign_language_video_language->set (film()->sign_language_video_language());
+ } else if (property == Film::Property::RELEASE_TERRITORY) {
+ auto rt = film()->release_territory();
+ checked_set (_enable_release_territory, static_cast<bool>(rt));
+ if (rt) {
+ _release_territory = *rt;
+ checked_set (_release_territory_text, std_to_wx(*dcp::LanguageTag::get_subtag_description(*_release_territory)));
+ }
+ } else if (property == Film::Property::FACILITY) {
+ checked_set (_enable_facility, static_cast<bool>(film()->facility()));
+ if (film()->facility()) {
+ checked_set (_facility, *film()->facility());
+ }
+ } else if (property == Film::Property::STUDIO) {
+ checked_set (_enable_studio, static_cast<bool>(film()->studio()));
+ if (film()->studio()) {
+ checked_set (_studio, *film()->studio());
+ }
+ } else if (property == Film::Property::CHAIN) {
+ checked_set (_enable_chain, static_cast<bool>(film()->chain()));
+ if (film()->chain()) {
+ checked_set (_chain, *film()->chain());
+ }
+ } else if (property == Film::Property::TEMP_VERSION) {
+ checked_set (_temp_version, film()->temp_version());
+ } else if (property == Film::Property::PRE_RELEASE) {
+ checked_set (_pre_release, film()->pre_release());
+ } else if (property == Film::Property::RED_BAND) {
+ checked_set (_red_band, film()->red_band());
+ } else if (property == Film::Property::TWO_D_VERSION_OF_THREE_D) {
+ checked_set (_two_d_version_of_three_d, film()->two_d_version_of_three_d());
+ } else if (property == Film::Property::LUMINANCE) {
+ auto lum = film()->luminance();
+ checked_set (_enable_luminance, static_cast<bool>(lum));
+ if (lum) {
+ checked_set (_luminance_value, lum->value());
+ switch (lum->unit()) {
+ case dcp::Luminance::Unit::CANDELA_PER_SQUARE_METRE:
+ checked_set (_luminance_unit, 0);
+ break;
+ case dcp::Luminance::Unit::FOOT_LAMBERT:
+ checked_set (_luminance_unit, 1);
+ break;
+ }
+ } else {
+ checked_set (_luminance_unit, 1);
+ }
+ }
+}
+
+
+void
+MetadataDialog::setup_standard (wxPanel* panel, wxSizer* sizer)
+{
+ _enable_release_territory = new wxCheckBox (panel, wxID_ANY, _("Release territory"));
+ sizer->Add (_enable_release_territory, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
+ {
+ auto s = new wxBoxSizer (wxHORIZONTAL);
+ _release_territory_text = new wxStaticText (panel, wxID_ANY, wxT(""));
+ s->Add (_release_territory_text, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
+ _edit_release_territory = new Button (panel, _("Edit..."));
+ s->Add (_edit_release_territory, 0, wxLEFT, DCPOMATIC_SIZER_GAP);
+ sizer->Add (s, 0, wxEXPAND);
+ }
+}
+
+
+void
+MetadataDialog::edit_release_territory ()
+{
+ DCPOMATIC_ASSERT (film()->release_territory());
+ auto d = new RegionSubtagDialog(this, *film()->release_territory());
+ d->ShowModal ();
+ auto tag = d->get();
+ if (tag) {
+ _release_territory = *tag;
+ film()->set_release_territory(*tag);
+ }
+ d->Destroy ();