Hand-apply 9e173bdda26f32a1da7afc38d5dcf8ed63e7d3cf; fix a few missing checks on...
authorCarl Hetherington <cth@carlh.net>
Mon, 15 Dec 2014 11:04:45 +0000 (11:04 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 15 Dec 2014 11:04:45 +0000 (11:04 +0000)
TO_PORT
src/wx/audio_panel.cc
src/wx/kdm_dialog.cc

diff --git a/TO_PORT b/TO_PORT
index 7ed2707565d5df3908f76947de318027c1b77c85..ed0afee5ba787acc2313f9295ff7470bd558282b 100644 (file)
--- a/TO_PORT
+++ b/TO_PORT
@@ -1,4 +1,3 @@
-df4337db7d2f94f430caaf1b89f41dfae777799b
 46db828eab42862bf950b4690d9ad191faf9393e
 6921fc71f40fcebe76dad45ffc6204f2e3313e17
 f9e5452c8e07e7c6eed91141532db7c341414d07
 46db828eab42862bf950b4690d9ad191faf9393e
 6921fc71f40fcebe76dad45ffc6204f2e3313e17
 f9e5452c8e07e7c6eed91141532db7c341414d07
index a2de484c0d91e1f7fb99c38fcdf1a639f2276394..f1d832d869d80ae7b3d514c8055fbce1f22f249f 100644 (file)
@@ -178,9 +178,9 @@ void
 AudioPanel::gain_calculate_button_clicked ()
 {
        GainCalculatorDialog* d = new GainCalculatorDialog (this);
 AudioPanel::gain_calculate_button_clicked ()
 {
        GainCalculatorDialog* d = new GainCalculatorDialog (this);
-       d->ShowModal ();
+       int const r = d->ShowModal ();
 
 
-       if (d->wanted_fader() == 0 || d->actual_fader() == 0) {
+       if (r == wxID_CANCEL || d->wanted_fader() == 0 || d->actual_fader() == 0) {
                d->Destroy ();
                return;
        }
                d->Destroy ();
                return;
        }
index 4334fd446ce99ae7dad7665fc4dc471072f2903c..6a1f8051f90955938ea817534e120e0c2dd1ffff 100644 (file)
@@ -309,11 +309,11 @@ void
 KDMDialog::add_cinema_clicked ()
 {
        CinemaDialog* d = new CinemaDialog (this, "Add Cinema");
 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 ();
 }
 
        d->Destroy ();
 }
@@ -328,13 +328,12 @@ KDMDialog::edit_cinema_clicked ()
        pair<wxTreeItemId, shared_ptr<Cinema> > c = selected_cinemas().front();
        
        CinemaDialog* d = new CinemaDialog (this, "Edit cinema", c.second->name, c.second->email);
        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 ();  
 }
 
        d->Destroy ();  
 }
@@ -385,13 +384,12 @@ KDMDialog::edit_screen_clicked ()
        pair<wxTreeItemId, shared_ptr<Screen> > s = selected_screens().front();
        
        ScreenDialog* d = new ScreenDialog (this, "Edit screen", s.second->name, s.second->certificate);
        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 ();
 }
 
        d->Destroy ();
 }
@@ -528,14 +526,17 @@ KDMDialog::update_cpl_summary ()
 void
 KDMDialog::cpl_browse_clicked ()
 {
 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;
        }
 
                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 ();
 
        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);
        /* XXX: hack alert */
        cxml::Document cpl_document ("CompositionPlaylist");
        cpl_document.read_file (cpl_file);