+ void file_duplicate ()
+ {
+ FilmNameLocationDialog* d = new FilmNameLocationDialog (this, _("Duplicate Film"), false);
+ int const r = d->ShowModal ();
+
+ if (r == wxID_OK && d->check_path() && maybe_save_film<FilmChangedDuplicatingDialog>()) {
+ shared_ptr<Film> film (new Film (d->path()));
+ film->copy_from (_film);
+ film->set_name (d->path().filename().generic_string());
+ film->write_metadata ();
+ }
+
+ d->Destroy ();
+ }
+
+ void file_duplicate_and_open ()
+ {
+ FilmNameLocationDialog* d = new FilmNameLocationDialog (this, _("Duplicate Film"), false);
+ int const r = d->ShowModal ();
+
+ if (r == wxID_OK && d->check_path() && maybe_save_film<FilmChangedDuplicatingDialog>()) {
+ shared_ptr<Film> film (new Film (d->path()));
+ film->copy_from (_film);
+ film->set_name (d->path().filename().generic_string());
+ film->write_metadata ();
+ set_film (film);
+ }
+
+ d->Destroy ();
+ }
+
+ void file_close ()
+ {
+ if (_film && _film->dirty ()) {
+
+ FilmChangedClosingDialog* dialog = new FilmChangedClosingDialog (_film->name ());
+ int const r = dialog->run ();
+ delete dialog;
+
+ switch (r) {
+ case wxID_NO:
+ /* Don't save and carry on to close */
+ break;
+ case wxID_YES:
+ /* Save and carry on to close */
+ _film->write_metadata ();
+ break;
+ case wxID_CANCEL:
+ /* Stop */
+ return;
+ }
+ }
+
+ set_film (shared_ptr<Film>());
+ }
+