X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Fwx_util.cc;h=d264f8b20b761cea3c3a335a016112e0cbc33cc9;hp=1f2afb4f548693ac9be99ae399b01cb881dbfe43;hb=4e4968464eeef1956cb82392e1fc3b27a792ab89;hpb=0ecea9f4d1a772e99f396e47364e68abfbfe9f7f diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 1f2afb4f5..d264f8b20 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -29,12 +29,12 @@ #include "password_entry.h" #include "region_subtag_widget.h" #include "static_text.h" +#include "wx_ptr.h" #include "wx_util.h" #include "lib/config.h" #include "lib/cross.h" #include "lib/job.h" #include "lib/job_manager.h" -#include "lib/scope_guard.h" #include "lib/util.h" #include "lib/version.h" #include @@ -161,8 +161,7 @@ add_label_to_sizer (wxGridBagSizer* s, wxStaticText* t, bool, wxGBPosition pos, void error_dialog (wxWindow* parent, wxString m, optional e) { - auto d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK | wxICON_ERROR); - ScopeGuard sg = [d]() { d->Destroy(); }; + auto d = make_wx(parent, m, _("DCP-o-matic"), wxOK | wxICON_ERROR); if (e) { wxString em = *e; em[0] = wxToupper (em[0]); @@ -179,8 +178,7 @@ error_dialog (wxWindow* parent, wxString m, optional e) void message_dialog (wxWindow* parent, wxString m) { - auto d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK | wxICON_INFORMATION); - ScopeGuard sg = [d]() { d->Destroy(); }; + auto d = make_wx(parent, m, _("DCP-o-matic"), wxOK | wxICON_INFORMATION); d->ShowModal (); } @@ -189,8 +187,7 @@ message_dialog (wxWindow* parent, wxString m) bool confirm_dialog (wxWindow* parent, wxString m) { - auto d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxYES_NO | wxICON_QUESTION); - ScopeGuard sg = [d]() { d->Destroy(); }; + auto d = make_wx(parent, m, _("DCP-o-matic"), wxYES_NO | wxICON_QUESTION); return d->ShowModal() == wxID_YES; }