Cleanup: use auto.
[dcpomatic.git] / src / wx / screen_dialog.cc
index 6d7fb4f031c530a33e7bad64b7cc16a74daa16b4..bc39193fba395d790f11a95594e52c18e745a864 100644 (file)
@@ -25,6 +25,7 @@
 #include "screen_dialog.h"
 #include "static_text.h"
 #include "table_dialog.h"
+#include "wx_ptr.h"
 #include "wx_util.h"
 #include "lib/compose.hpp"
 #include "lib/scope_guard.h"
@@ -64,8 +65,7 @@ public:
 
        void load_certificate ()
        {
-               auto dialog = new FileDialog(this, _("Trusted Device certificate"), wxEmptyString, wxFD_DEFAULT_STYLE, "SelectCertificatePath");
-               ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+               auto dialog = make_wx<FileDialog>(this, _("Trusted Device certificate"), wxEmptyString, wxFD_DEFAULT_STYLE, "SelectCertificatePath");
                if (!dialog->show()) {
                        return;
                }
@@ -154,8 +154,8 @@ ScreenDialog::ScreenDialog (
        ++r;
 
        add_label_to_sizer (_sizer, this, _("Filename"), true, wxGBPosition(r, 0));
-       _recipient_file = new wxStaticText (this, wxID_ANY, wxT(""));
        checked_set (_recipient_file, recipient_file.get_value_or(""));
+       _recipient_file = new wxStaticText(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(600, -1), wxST_ELLIPSIZE_MIDDLE | wxST_NO_AUTORESIZE);
        _sizer->Add (_recipient_file, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP);
        ++r;
 
@@ -194,7 +194,7 @@ ScreenDialog::ScreenDialog (
 
        overall_sizer->Add (_sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
 
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
+       auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
        if (buttons) {
                overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
@@ -259,8 +259,7 @@ ScreenDialog::load_recipient (boost::filesystem::path file)
 void
 ScreenDialog::get_recipient_from_file ()
 {
-       auto dialog = new FileDialog(this, _("Select Certificate File"), wxEmptyString, wxFD_DEFAULT_STYLE , "SelectCertificatePath");
-       ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+       auto dialog = make_wx<FileDialog>(this, _("Select Certificate File"), wxEmptyString, wxFD_DEFAULT_STYLE , "SelectCertificatePath");
        if (dialog->show()) {
                load_recipient(dialog->paths()[0]);
        }
@@ -272,8 +271,7 @@ ScreenDialog::get_recipient_from_file ()
 void
 ScreenDialog::download_recipient ()
 {
-       auto dialog = new DownloadCertificateDialog (this);
-       ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+       auto dialog = make_wx<DownloadCertificateDialog>(this);
        if (dialog->ShowModal() == wxID_OK) {
                set_recipient(dialog->certificate());
                checked_set(_recipient_file, dialog->url());