Use studio and facility from Interop/SMPTE metadata rather than ISDCF.
[dcpomatic.git] / src / wx / metadata_dialog.cc
index 376591ca23760977457b23f8e767c3bfa1b21ba8..17151161ca7d0463f7e302a1ff2419632f49feb8 100644 (file)
@@ -72,9 +72,18 @@ MetadataDialog::setup ()
        overall_sizer->Layout ();
        overall_sizer->SetSizeHints (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));
+
        _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::FACILITY);
+       film_changed (ChangeType::DONE, Film::Property::STUDIO);
+
+       setup_sensitivity ();
 }
 
 
@@ -92,6 +101,16 @@ MetadataDialog::film_changed (ChangeType type, Film::Property property)
                        _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());
+               }
        }
 }
 
@@ -136,6 +155,8 @@ MetadataDialog::setup_sensitivity ()
        auto const enabled = _enable_release_territory->GetValue();
        _release_territory_text->Enable (enabled);
        _edit_release_territory->Enable (enabled);
+       _facility->Enable (_enable_facility->GetValue());
+       _studio->Enable (_enable_studio->GetValue());
 }
 
 
@@ -150,3 +171,57 @@ MetadataDialog::enable_release_territory_changed ()
        }
 }
 
+
+void
+MetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
+{
+       _enable_facility = new wxCheckBox (panel, wxID_ANY, _("Facility"));
+       sizer->Add (_enable_facility, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
+       _facility = new wxTextCtrl (panel, wxID_ANY);
+       sizer->Add (_facility, 1, wxEXPAND);
+
+       _enable_studio = new wxCheckBox (panel, wxID_ANY, _("Studio"));
+       sizer->Add (_enable_studio, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
+       _studio = new wxTextCtrl (panel, wxID_ANY);
+       sizer->Add (_studio, 1, wxEXPAND);
+}
+
+
+void
+MetadataDialog::facility_changed ()
+{
+       film()->set_facility (wx_to_std(_facility->GetValue()));
+}
+
+
+void
+MetadataDialog::enable_facility_changed ()
+{
+       setup_sensitivity ();
+       if (_enable_facility->GetValue()) {
+               film()->set_facility (wx_to_std(_facility->GetValue()));
+       } else {
+               film()->set_facility ();
+       }
+}
+
+
+void
+MetadataDialog::studio_changed ()
+{
+       film()->set_studio (wx_to_std(_studio->GetValue()));
+}
+
+
+void
+MetadataDialog::enable_studio_changed ()
+{
+       setup_sensitivity ();
+       if (_enable_studio->GetValue()) {
+               film()->set_studio (wx_to_std(_studio->GetValue()));
+       } else {
+               film()->set_studio ();
+       }
+}
+
+