Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
[dcpomatic.git] / src / wx / kdm_output_panel.cc
index 6cd1af2681e5ba137a1df9e17351387954c68768..3befd702562e2254c5f45bfecff1263a3b1ba72b 100644 (file)
@@ -52,6 +52,7 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
        add_label_to_sizer (table, this, _("KDM type"), true);
        _type = new wxChoice (this, wxID_ANY);
        _type->Append ("Modified Transitional 1", ((void *) dcp::MODIFIED_TRANSITIONAL_1));
+       _type->Append ("Multiple Modified Transitional 1", ((void *) dcp::MULTIPLE_MODIFIED_TRANSITIONAL_1));
        _type->Append ("Modified Transitional 1 (without AuthorizedDeviceInfo)", ((void *) dcp::MODIFIED_TRANSITIONAL_TEST));
        if (!interop) {
                _type->Append ("DCI Any", ((void *) dcp::DCI_ANY));
@@ -132,10 +133,25 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
        table->Add (_email, 1, wxEXPAND);
        table->AddSpacer (0);
 
+       switch (Config::instance()->last_kdm_write_type().get_value_or(Config::KDM_WRITE_FLAT)) {
+       case Config::KDM_WRITE_FLAT:
+               _write_flat->SetValue (true);
+               break;
+       case Config::KDM_WRITE_FOLDER:
+               _write_folder->SetValue (true);
+               break;
+       case Config::KDM_WRITE_ZIP:
+               _write_zip->SetValue (true);
+               break;
+       }
+
        _write_to->SetValue (true);
 
-       _write_to->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
-       _email->Bind    (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+       _write_to->Bind     (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+       _email->Bind        (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+       _write_flat->Bind   (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
+       _write_folder->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
+       _write_zip->Bind    (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
 
        SetSizer (table);
 }
@@ -150,6 +166,18 @@ KDMOutputPanel::setup_sensitivity ()
        _write_zip->Enable (write);
 }
 
+void
+KDMOutputPanel::kdm_write_type_changed ()
+{
+       if (_write_flat->GetValue()) {
+               Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_FLAT);
+       } else if (_write_folder->GetValue()) {
+               Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_FOLDER);
+       } else if (_write_zip->GetValue()) {
+               Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_ZIP);
+       }
+}
+
 pair<shared_ptr<Job>, int>
 KDMOutputPanel::make (
        list<ScreenKDM> screen_kdms, string name, KDMTimingPanel* timing, function<bool (boost::filesystem::path)> confirm_overwrite, shared_ptr<Log> log
@@ -260,7 +288,7 @@ KDMOutputPanel::make (
        } catch (dcp::NotEncryptedError& e) {
                error_dialog (this, _("CPL's content is not encrypted."));
        } catch (exception& e) {
-               error_dialog (this, e.what ());
+               error_dialog (this, std_to_wx(e.what()));
        } catch (...) {
                error_dialog (this, _("An unknown exception occurred."));
        }