Fix markers view for RTL languages (part of #2696).
[dcpomatic.git] / src / wx / kdm_dialog.cc
index f01c47ffbba3ad86636295695b4a0f16b70adf9d..c15156eee436e11b24eb02155f7f87691ec20703 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "confirm_kdm_email_dialog.h"
 #include "dcpomatic_button.h"
+#include "invalid_certificate_period_dialog.h"
 #include "kdm_cpl_panel.h"
 #include "kdm_dialog.h"
 #include "kdm_output_panel.h"
@@ -126,6 +127,7 @@ 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::setup_sensitivity, this));
 
        setup_sensitivity ();
 
@@ -185,26 +187,23 @@ KDMDialog::make_clicked ()
                        }
                }
 
-               if (find(period_checks.begin(), period_checks.end(), KDMCertificatePeriod::KDM_OUTSIDE_CERTIFICATE) != period_checks.end()) {
-                       error_dialog(
-                               this,
-                               _("Some KDMs would have validity periods which are completely outside the recipient certificate periods.  Such KDMs are very unlikely to work, so will not be created.")
-                               );
-                       return;
-               }
-
-               if (find(period_checks.begin(), period_checks.end(), KDMCertificatePeriod::KDM_OVERLAPS_CERTIFICATE) != period_checks.end()) {
-                       message_dialog(
-                               this,
-                               _("For some of these KDMs the recipient certificate's validity period will not cover the whole of the KDM validity period.  This might cause problems with the KDMs.")
-                               );
+               if (
+                       find_if(
+                               period_checks.begin(),
+                               period_checks.end(),
+                               [](KDMCertificatePeriod const& p) { return p.overlap != KDMCertificateOverlap::KDM_WITHIN_CERTIFICATE; }
+                              ) != period_checks.end()) {
+                       InvalidCertificatePeriodDialog dialog(this, period_checks);
+                       if (dialog.ShowModal() == wxID_CANCEL) {
+                               return;
+                       }
                }
 
        } catch (dcp::BadKDMDateError& e) {
                if (e.starts_too_early()) {
                        error_dialog (this, _("The KDM start period is before (or close to) the start of the signing certificate's validity period.  Use a later start time for this KDM."));
                } else {
-                       error_dialog (this, _("The KDM end period is after (or close to) the end of the signing certficates' validity period.  Either use an earlier end time for this KDM or re-create your signing certificates in the DCP-o-matic preferences window."));
+                       error_dialog (this, _("The KDM end period is after (or close to) the end of the signing certificates' validity period.  Either use an earlier end time for this KDM or re-create your signing certificates in the DCP-o-matic preferences window."));
                }
                return;
        } catch (runtime_error& e) {