C++11 tidying.
[dcpomatic.git] / src / wx / film_name_location_dialog.cc
index 0cc406d022168b9d430ec7368ae9bd7fac1b41e2..2ef6c9955714e474f1e3a40e116a63d4371d811f 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -28,7 +28,6 @@
 #include "lib/compose.hpp"
 #include <wx/stdpaths.h>
 #include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
 
 using namespace std;
 using namespace boost;
@@ -68,7 +67,7 @@ FilmNameLocationDialog::FilmNameLocationDialog (wxWindow* parent, wxString title
        if (offer_templates) {
                _template_name->Enable (false);
 
-               BOOST_FOREACH (string i, Config::instance()->templates ()) {
+               for (auto i: Config::instance()->templates ()) {
                        _template_name->Append (std_to_wx (i));
                }
 
@@ -76,8 +75,22 @@ FilmNameLocationDialog::FilmNameLocationDialog (wxWindow* parent, wxString title
        }
 
        layout ();
+
+       _name->Bind (wxEVT_TEXT, bind(&FilmNameLocationDialog::setup_sensitivity, this));
+       setup_sensitivity ();
+}
+
+
+void
+FilmNameLocationDialog::setup_sensitivity ()
+{
+       wxButton* ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this));
+       if (ok) {
+               ok->Enable (!_name->GetValue().IsEmpty());
+       }
 }
 
+
 void
 FilmNameLocationDialog::use_template_clicked ()
 {