From: Carl Hetherington Date: Wed, 18 Jan 2023 22:13:02 +0000 (+0100) Subject: Cleanup: stack-allocated dialogs. X-Git-Tag: v2.16.41~8 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=6a4a63310445bd5554f0df1b290b0c1af3f73779 Cleanup: stack-allocated dialogs. --- diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 456dbcb56..fd1315747 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -595,7 +595,7 @@ ContentPanel::add_file_clicked () /* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using non-Latin filenames or paths. */ - auto dialog = make_wx( + FileDialog dialog( _splitter, _("Choose a file or files"), wxT("All files|*.*|Subtitle files|*.srt;*.xml|Audio files|*.wav;*.w64;*.flac;*.aif;*.aiff"), @@ -604,8 +604,8 @@ ContentPanel::add_file_clicked () add_files_override_path() ); - if (dialog->show()) { - add_files(dialog->paths()); + if (dialog.show()) { + add_files(dialog.paths()); } } @@ -613,9 +613,9 @@ ContentPanel::add_file_clicked () void ContentPanel::add_folder_clicked () { - auto d = make_wx(_splitter, _("Choose a folder"), wxDD_DIR_MUST_EXIST, "AddFilesPath", add_files_override_path()); - if (d->show()) { - add_folder(d->path()); + DirDialog dialog(_splitter, _("Choose a folder"), wxDD_DIR_MUST_EXIST, "AddFilesPath", add_files_override_path()); + if (dialog.show()) { + add_folder(dialog.path()); } } @@ -640,12 +640,12 @@ ContentPanel::add_folder(boost::filesystem::path folder) for (auto i: content) { auto ic = dynamic_pointer_cast (i); if (ic) { - auto e = make_wx(_splitter); + ImageSequenceDialog dialog(_splitter); - if (e->ShowModal() != wxID_OK) { + if (dialog.ShowModal() != wxID_OK) { return; } - ic->set_video_frame_rate(_film, e->frame_rate()); + ic->set_video_frame_rate(_film, dialog.frame_rate()); } _film->examine_and_add_content (i); @@ -656,9 +656,9 @@ ContentPanel::add_folder(boost::filesystem::path folder) void ContentPanel::add_dcp_clicked () { - auto d = make_wx(_splitter, _("Choose a DCP folder"), wxDD_DIR_MUST_EXIST, "AddFilesPath", add_files_override_path()); - if (d->show()) { - add_dcp(d->path()); + DirDialog dialog(_splitter, _("Choose a DCP folder"), wxDD_DIR_MUST_EXIST, "AddFilesPath", add_files_override_path()); + if (dialog.show()) { + add_dcp(dialog.path()); } }