Supporters update.
[dcpomatic.git] / src / wx / kdm_dialog.cc
index 9135baf236a08fe20805e26cf9be68bc010d24d5..5ab13b4ce7410905f41b5581e9290bbdd57446a8 100644 (file)
@@ -37,6 +37,7 @@
 #include "lib/kdm_util.h"
 #include "lib/screen.h"
 #include <libcxml/cxml.h>
+#include <dcp/cpl.h>
 #include <dcp/exceptions.h>
 #include <dcp/warnings.h>
 LIBDCP_DISABLE_WARNINGS
@@ -127,7 +128,9 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr<const Film> film)
        _screens->ScreensChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this));
        _timing->TimingChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this));
        _make->Bind (wxEVT_BUTTON, boost::bind (&KDMDialog::make_clicked, this));
+       _cpl->Changed.connect(boost::bind(&KDMDialog::cpl_changed, this));
 
+       cpl_changed();
        setup_sensitivity ();
 
        SetSizer (overall_sizer);
@@ -136,6 +139,20 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr<const Film> film)
 }
 
 
+void
+KDMDialog::cpl_changed()
+{
+       try {
+               dcp::CPL cpl(_cpl->cpl());
+               if (auto text = cpl.annotation_text()) {
+                       _output->set_annotation_text(*text);
+               }
+       } catch (...) {}
+
+       setup_sensitivity();
+}
+
+
 void
 KDMDialog::setup_sensitivity ()
 {
@@ -210,7 +227,7 @@ KDMDialog::make_clicked ()
                return;
        }
 
-       auto result = _output->make (kdms, film->name(), bind (&KDMDialog::confirm_overwrite, this, _1));
+       auto result = _output->make(kdms, film->dcp_name(), bind (&KDMDialog::confirm_overwrite, this, _1));
        if (result.first) {
                JobManager::instance()->add (result.first);
        }