Emit no audio from DCPs if none is mapped
[dcpomatic.git] / src / wx / language_tag_dialog.cc
index ca08996c681d01a5d2c47b24ecbfd9000948316b..b472edab07d1a5fda88d417129b23189ebe5b833 100644 (file)
 #include "language_tag_dialog.h"
 #include "wx_util.h"
 #include "lib/config.h"
+#include <dcp/language_tag.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <wx/listctrl.h>
 #include <wx/wx.h>
-#include <dcp/language_tag.h>
+LIBDCP_ENABLE_WARNINGS
 
 
 using std::vector;
@@ -43,7 +46,7 @@ LanguageTagDialog::LanguageTagDialog (wxWindow* parent, dcp::LanguageTag tag)
        overall_sizer->Add (_list, 0, wxALL, DCPOMATIC_SIZER_GAP);
        overall_sizer->Add (add, 0, wxALL, DCPOMATIC_SIZER_GAP);
 
-       auto buttons = CreateSeparatedButtonSizer (wxOK);
+       auto buttons = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
        if (buttons) {
                overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
@@ -65,19 +68,18 @@ LanguageTagDialog::LanguageTagDialog (wxWindow* parent, dcp::LanguageTag tag)
        set (tag);
 
        add->Bind (wxEVT_BUTTON, boost::bind(&LanguageTagDialog::add_language, this));
+       _list->Bind(wxEVT_LIST_ITEM_ACTIVATED, boost::bind(&LanguageTagDialog::EndModal, this, wxID_OK));
 }
 
 
 void
 LanguageTagDialog::add_language ()
 {
-       auto full = new FullLanguageTagDialog (GetParent());
-       auto r = full->ShowModal ();
-       if (r == wxID_OK) {
-               Config::instance()->add_custom_language (full->get());
-               set (full->get());
+       FullLanguageTagDialog full(GetParent());
+       if (full.ShowModal() == wxID_OK) {
+               Config::instance()->add_custom_language(full.get());
+               set(full.get());
        }
-       full->Destroy ();
 }