Emit no audio from DCPs if none is mapped
[dcpomatic.git] / src / wx / smpte_metadata_dialog.cc
index e4d2d96224a9a4cd02a468417d1c5f80b2aa6b98..8471199bdf590e7a4591f02e67dfcc7908c0fb59 100644 (file)
 */
 
 
+#include "check_box.h"
 #include "content_version_dialog.h"
 #include "editable_list.h"
 #include "language_tag_dialog.h"
 #include "language_tag_widget.h"
-#include "smpte_metadata_dialog.h"
 #include "rating_dialog.h"
+#include "smpte_metadata_dialog.h"
 #include "lib/film.h"
 #include <dcp/types.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <wx/gbsizer.h>
 #include <wx/spinctrl.h>
+LIBDCP_ENABLE_WARNINGS
 
 
+using std::shared_ptr;
 using std::string;
 using std::vector;
-using boost::optional;
-using std::shared_ptr;
 using std::weak_ptr;
+using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 
 
-static string
-ratings_column (dcp::Rating r, int c)
-{
-       if (c == 0) {
-               return r.agency;
-       }
-
-       return r.label;
-}
-
-
 static string
 content_versions_column (string v, int)
 {
@@ -81,18 +74,6 @@ SMPTEMetadataDialog::setup_standard (wxPanel* panel, wxSizer* sizer)
                sizer->Add (m, 0, flags, DCPOMATIC_SIZER_GAP);
        }
 
-       vector<EditableListColumn> columns;
-       columns.push_back (EditableListColumn("Agency", 200, true));
-       columns.push_back (EditableListColumn("Label", 50, true));
-       _ratings = new EditableList<dcp::Rating, RatingDialog> (
-               panel,
-               columns,
-               boost::bind(&SMPTEMetadataDialog::ratings, this),
-               boost::bind(&SMPTEMetadataDialog::set_ratings, this, _1),
-               boost::bind(&ratings_column, _1, _2),
-               true,
-               false
-               );
        sizer->Add (_ratings, 1, wxEXPAND);
 }
 
@@ -110,7 +91,7 @@ SMPTEMetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
        _status = new wxChoice (panel, wxID_ANY);
        sizer->Add (_status, 0);
 
-       _enable_distributor = new wxCheckBox (panel, wxID_ANY, _("Distributor"));
+       _enable_distributor = new CheckBox(panel, _("Distributor"));
        sizer->Add (_enable_distributor, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL);
        _distributor = new wxTextCtrl (panel, wxID_ANY);
        sizer->Add (_distributor, 1, wxEXPAND);
@@ -132,8 +113,8 @@ SMPTEMetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
                boost::bind(&SMPTEMetadataDialog::content_versions, this),
                boost::bind(&SMPTEMetadataDialog::set_content_versions, this, _1),
                boost::bind(&content_versions_column, _1, _2),
-               true,
-               false
+               EditableListTitle::INVISIBLE,
+               EditableListButton::NEW | EditableListButton::REMOVE
                );
        sizer->Add (_content_versions, 1, wxEXPAND);
 }
@@ -158,21 +139,21 @@ SMPTEMetadataDialog::setup ()
        _name_language->Changed.connect (boost::bind(&SMPTEMetadataDialog::name_language_changed, this, _1));
        _version_number->Bind (wxEVT_SPINCTRL, boost::bind(&SMPTEMetadataDialog::version_number_changed, this));
        _status->Bind (wxEVT_CHOICE, boost::bind(&SMPTEMetadataDialog::status_changed, this));
-       _enable_distributor->Bind (wxEVT_CHECKBOX, boost::bind(&SMPTEMetadataDialog::enable_distributor_changed, this));
+       _enable_distributor->bind(&SMPTEMetadataDialog::enable_distributor_changed, this);
        _distributor->Bind (wxEVT_TEXT, boost::bind(&SMPTEMetadataDialog::distributor_changed, this));
 
-       film_changed (ChangeType::DONE, Film::Property::NAME_LANGUAGE);
-       film_changed (ChangeType::DONE, Film::Property::VERSION_NUMBER);
-       film_changed (ChangeType::DONE, Film::Property::STATUS);
-       film_changed (ChangeType::DONE, Film::Property::DISTRIBUTOR);
-       film_changed (ChangeType::DONE, Film::Property::CONTENT_VERSIONS);
+       film_changed(ChangeType::DONE, FilmProperty::NAME_LANGUAGE);
+       film_changed(ChangeType::DONE, FilmProperty::VERSION_NUMBER);
+       film_changed(ChangeType::DONE, FilmProperty::STATUS);
+       film_changed(ChangeType::DONE, FilmProperty::DISTRIBUTOR);
+       film_changed(ChangeType::DONE, FilmProperty::CONTENT_VERSIONS);
 
        setup_sensitivity ();
 }
 
 
 void
-SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
+SMPTEMetadataDialog::film_changed(ChangeType type, FilmProperty property)
 {
        MetadataDialog::film_changed (type, property);
 
@@ -180,11 +161,11 @@ SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
                return;
        }
 
-       if (property == Film::Property::NAME_LANGUAGE) {
+       if (property == FilmProperty::NAME_LANGUAGE) {
                _name_language->set (film()->name_language());
-       } else if (property == Film::Property::VERSION_NUMBER) {
+       } else if (property == FilmProperty::VERSION_NUMBER) {
                checked_set (_version_number, film()->version_number());
-       } else if (property == Film::Property::STATUS) {
+       } else if (property == FilmProperty::STATUS) {
                switch (film()->status()) {
                case dcp::Status::TEMP:
                        checked_set (_status, 0);
@@ -196,7 +177,7 @@ SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
                        checked_set (_status, 2);
                        break;
                }
-       } else if (property == Film::Property::DISTRIBUTOR) {
+       } else if (property == FilmProperty::DISTRIBUTOR) {
                checked_set (_enable_distributor, static_cast<bool>(film()->distributor()));
                if (film()->distributor()) {
                        checked_set (_distributor, *film()->distributor());
@@ -205,20 +186,6 @@ SMPTEMetadataDialog::film_changed (ChangeType type, Film::Property property)
 }
 
 
-vector<dcp::Rating>
-SMPTEMetadataDialog::ratings () const
-{
-       return film()->ratings ();
-}
-
-
-void
-SMPTEMetadataDialog::set_ratings (vector<dcp::Rating> r)
-{
-       film()->set_ratings (r);
-}
-
-
 vector<string>
 SMPTEMetadataDialog::content_versions () const
 {