/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
_remove_screen->Enable (ss);
wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK));
- ok->Enable ((selected_cinemas().size() > 0 || selected_screens().size() > 0) && sd);
+ if (ok) {
+ ok->Enable ((selected_cinemas().size() > 0 || selected_screens().size() > 0) && sd);
+ }
_folder->Enable (_write_to->GetValue ());
}
KDMDialog::add_cinema_clicked ()
{
CinemaDialog* d = new CinemaDialog (this, "Add Cinema");
- d->ShowModal ();
-
- shared_ptr<Cinema> c (new Cinema (d->name(), d->email()));
- Config::instance()->add_cinema (c);
- add_cinema (c);
+ if (d->ShowModal () == wxID_OK) {
+ shared_ptr<Cinema> c (new Cinema (d->name(), d->email()));
+ Config::instance()->add_cinema (c);
+ add_cinema (c);
+ }
d->Destroy ();
}
pair<wxTreeItemId, shared_ptr<Cinema> > c = selected_cinemas().front();
CinemaDialog* d = new CinemaDialog (this, "Edit cinema", c.second->name, c.second->email);
- d->ShowModal ();
-
- c.second->name = d->name ();
- c.second->email = d->email ();
- _targets->SetItemText (c.first, std_to_wx (d->name()));
-
- Config::instance()->changed ();
+ if (d->ShowModal () == wxID_OK) {
+ c.second->name = d->name ();
+ c.second->email = d->email ();
+ _targets->SetItemText (c.first, std_to_wx (d->name()));
+ Config::instance()->changed ();
+ }
d->Destroy ();
}
pair<wxTreeItemId, shared_ptr<Screen> > s = selected_screens().front();
ScreenDialog* d = new ScreenDialog (this, "Edit screen", s.second->name, s.second->certificate);
- d->ShowModal ();
-
- s.second->name = d->name ();
- s.second->certificate = d->certificate ();
- _targets->SetItemText (s.first, std_to_wx (d->name()));
-
- Config::instance()->changed ();
+ if (d->ShowModal () == wxID_OK) {
+ s.second->name = d->name ();
+ s.second->certificate = d->certificate ();
+ _targets->SetItemText (s.first, std_to_wx (d->name()));
+ Config::instance()->changed ();
+ }
d->Destroy ();
}
KDMDialog::cpl () const
{
int const item = _cpl->GetSelection ();
- assert (item >= 0);
+ DCPOMATIC_ASSERT (item >= 0);
return _cpls[item].cpl_file;
}
void
KDMDialog::cpl_browse_clicked ()
{
- wxFileDialog d (this, _("Select CPL XML file"), wxEmptyString, wxEmptyString, "*.xml");
- if (d.ShowModal() == wxID_CANCEL) {
+ wxFileDialog* d = new wxFileDialog (this, _("Select CPL XML file"), wxEmptyString, wxEmptyString, "*.xml");
+ if (d->ShowModal() == wxID_CANCEL) {
+ d->Destroy ();
return;
}
- boost::filesystem::path cpl_file (wx_to_std (d.GetPath ()));
+ boost::filesystem::path cpl_file (wx_to_std (d->GetPath ()));
boost::filesystem::path dcp_dir = cpl_file.parent_path ();
+ d->Destroy ();
+
/* XXX: hack alert */
cxml::Document cpl_document ("CompositionPlaylist");
cpl_document.read_file (cpl_file);