Disable OK in export dialogue until a filename has been specified (#1260).
authorCarl Hetherington <cth@carlh.net>
Thu, 12 Apr 2018 21:51:00 +0000 (22:51 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 12 Apr 2018 21:51:00 +0000 (22:51 +0100)
ChangeLog
src/wx/export_dialog.cc
src/wx/export_dialog.h

index d9681488adaa6d8f21e9169423bcbfd2783fe5f5..167bf0a15543031c7b15681c5df29c8ce569b1c6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-04-12  Carl Hetherington  <cth@carlh.net>
+
+       * Prevent error when starting export without specifying a filename (#1260).
+
 2018-04-11  Carl Hetherington  <cth@carlh.net>
 
        * Fix 3D DCP handling in the player.
index 712ef4a7e9a96cf7b281574da48ccfdbb0f0b1a4..9f6207e660e98429361691ed1a99840680c4c8ce 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -21,6 +21,7 @@
 #include "export_dialog.h"
 #include "file_picker_ctrl.h"
 #include "wx_util.h"
+#include <wx/filepicker.h>
 #include <boost/bind.hpp>
 
 using boost::bind;
@@ -61,8 +62,12 @@ ExportDialog::ExportDialog (wxWindow* parent)
        _format->SetSelection (0);
 
        _format->Bind (wxEVT_CHOICE, bind (&ExportDialog::format_changed, this));
+       _file->Bind (wxEVT_FILEPICKER_CHANGED, bind (&ExportDialog::file_changed, this));
 
        layout ();
+
+       wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+       ok->Enable (false);
 }
 
 void
@@ -91,3 +96,10 @@ ExportDialog::mixdown_to_stereo () const
 {
        return _mixdown->GetValue ();
 }
+
+void
+ExportDialog::file_changed ()
+{
+       wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+       ok->Enable (true);
+}
index d785d910d6577c051c8ccc7bbb8337a595c9d615..c2498d6a149498ded640a002ad633125d52e34e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -36,6 +36,7 @@ public:
 
 private:
        void format_changed ();
+       void file_changed ();
 
        wxChoice* _format;
        wxCheckBox* _mixdown;