Add config option for default KDM type.
[dcpomatic.git] / src / wx / kdm_choice.cc
index 64a43f76562d6e558c3f00612504c008dba3bffd..c8685e22c741d54844dd668d73322658b8673f23 100644 (file)
@@ -32,9 +32,31 @@ KDMChoice::KDMChoice (wxWindow* parent)
 }
 
 
+dcp::Formulation
+KDMChoice::get_formulation (unsigned int n) const
+{
+       return static_cast<dcp::Formulation>(reinterpret_cast<intptr_t>(GetClientData(n)));
+}
+
+
 dcp::Formulation
 KDMChoice::get () const
 {
-       return static_cast<dcp::Formulation>(reinterpret_cast<intptr_t>(GetClientData(GetSelection())));
+       return get_formulation(GetSelection());
+}
+
+
+void
+KDMChoice::set (dcp::Formulation type)
+{
+       for (unsigned int i = 0; i < GetCount(); ++i) {
+               if (get_formulation(i) == type) {
+                       SetSelection(i);
+                       return;
+               }
+       }
 }
 
+
+
+