Move _state_timer into VideoView.
[dcpomatic.git] / src / wx / self_dkdm_dialog.cc
index 99f4142678888875626167b929e85e31908f4218..5eae05de40f7cfdbadd59e2179f1f31c83df0b09 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 #include "wx_util.h"
 #include "kdm_output_panel.h"
 #include "kdm_cpl_panel.h"
+#include "static_text.h"
 #include "lib/film.h"
 #include "lib/screen.h"
+#include "lib/config.h"
 #include <libcxml/cxml.h>
 #ifdef DCPOMATIC_USE_OWN_PICKER
 #include "dir_picker_ctrl.h"
@@ -56,18 +58,18 @@ SelfDKDMDialog::SelfDKDMDialog (wxWindow* parent, boost::shared_ptr<const Film>
        subheading_font.SetWeight (wxFONTWEIGHT_BOLD);
 
        /* Sub-heading: CPL */
-       wxStaticText* h = new wxStaticText (this, wxID_ANY, _("CPL"));
+       wxStaticText* h = new StaticText (this, _("CPL"));
        h->SetFont (subheading_font);
        vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP * 2);
        _cpl = new KDMCPLPanel (this, film->cpls ());
        vertical->Add (_cpl);
 
        /* Sub-heading: output */
-       h = new wxStaticText (this, wxID_ANY, _("Output"));
+       h = new StaticText (this, _("Output"));
        h->SetFont (subheading_font);
        vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2);
 
-       _internal = new wxRadioButton (this, wxID_ANY, _("Save to KDM creator tool's list"));
+       _internal = new wxRadioButton (this, wxID_ANY, _("Save to KDM Creator tool's list"));
        vertical->Add (_internal, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP);
 
        wxBoxSizer* w = new wxBoxSizer (wxHORIZONTAL);
@@ -97,14 +99,34 @@ SelfDKDMDialog::SelfDKDMDialog (wxWindow* parent, boost::shared_ptr<const Film>
                overall_sizer->Add (buttons, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_Y_GAP);
        }
 
-       setup_sensitivity ();
-
        SetSizer (overall_sizer);
        overall_sizer->Layout ();
        overall_sizer->SetSizeHints (this);
 
-       _internal->Bind (wxEVT_COMMAND_RADIOBUTTON_SELECTED, bind (&SelfDKDMDialog::setup_sensitivity, this));
-       _write_to->Bind (wxEVT_COMMAND_RADIOBUTTON_SELECTED, bind (&SelfDKDMDialog::setup_sensitivity, this));
+       switch (Config::instance()->last_dkdm_write_type().get_value_or(Config::DKDM_WRITE_INTERNAL)) {
+       case Config::DKDM_WRITE_INTERNAL:
+               _internal->SetValue (true);
+               break;
+       case Config::DKDM_WRITE_FILE:
+               _write_to->SetValue (true);
+               break;
+       }
+       setup_sensitivity ();
+
+       _internal->Bind (wxEVT_RADIOBUTTON, bind (&SelfDKDMDialog::dkdm_write_type_changed, this));
+       _write_to->Bind (wxEVT_RADIOBUTTON, bind (&SelfDKDMDialog::dkdm_write_type_changed, this));
+}
+
+void
+SelfDKDMDialog::dkdm_write_type_changed ()
+{
+       setup_sensitivity ();
+
+       if (_internal->GetValue ()) {
+               Config::instance()->set_last_dkdm_write_type (Config::DKDM_WRITE_INTERNAL);
+       } else if (_write_to->GetValue ()) {
+               Config::instance()->set_last_dkdm_write_type (Config::DKDM_WRITE_FILE);
+       }
 }
 
 void