summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-02-09 02:06:04 +0100
committerCarl Hetherington <cth@carlh.net>2025-02-09 17:29:16 +0100
commitd0308d53dd9f4d036d8c5fe8023920fcdfd43f39 (patch)
tree5b37c1db5dc50e541a542663390061f743fe815a
parent8d0d9866ae3e0395d899705e27b3806a5de7ef0e (diff)
Remove unnecessary wx_ptr
It was only ever used for wxDialog subclasses, which can be stack-allocated.
-rw-r--r--src/tools/dcpomatic.cc16
-rw-r--r--src/tools/dcpomatic_batch.cc21
-rw-r--r--src/tools/dcpomatic_disk.cc26
-rw-r--r--src/tools/dcpomatic_player.cc39
-rw-r--r--src/tools/dcpomatic_playlist.cc4
-rw-r--r--src/wx/audio_dialog.h7
-rw-r--r--src/wx/audio_mapping_view.cc6
-rw-r--r--src/wx/audio_panel.cc2
-rw-r--r--src/wx/audio_panel.h4
-rw-r--r--src/wx/content_advanced_dialog.cc6
-rw-r--r--src/wx/content_menu.cc26
-rw-r--r--src/wx/content_menu.h3
-rw-r--r--src/wx/content_panel.cc2
-rw-r--r--src/wx/content_panel.h3
-rw-r--r--src/wx/content_timeline.h7
-rw-r--r--src/wx/content_timeline_dialog.h7
-rw-r--r--src/wx/dcp_panel.cc16
-rw-r--r--src/wx/dcp_panel.h20
-rw-r--r--src/wx/dcp_timeline_dialog.h7
-rw-r--r--src/wx/dir_picker_ctrl.cc6
-rw-r--r--src/wx/editable_list.h14
-rw-r--r--src/wx/fonts_dialog.cc12
-rw-r--r--src/wx/fonts_dialog.h8
-rw-r--r--src/wx/interop_metadata_dialog.h8
-rw-r--r--src/wx/kdm_cpl_panel.cc6
-rw-r--r--src/wx/language_tag_widget.cc8
-rw-r--r--src/wx/markers_dialog.h7
-rw-r--r--src/wx/recipient_dialog.cc6
-rw-r--r--src/wx/region_subtag_widget.cc8
-rw-r--r--src/wx/smpte_metadata_dialog.h8
-rw-r--r--src/wx/text_panel.cc12
-rw-r--r--src/wx/text_panel.h14
-rw-r--r--src/wx/text_view.h8
-rw-r--r--src/wx/timing_panel.cc6
-rw-r--r--src/wx/window_metrics.h7
-rw-r--r--src/wx/wx_ptr.h117
-rw-r--r--src/wx/wx_util.cc15
-rw-r--r--src/wx/wx_util.h1
38 files changed, 223 insertions, 270 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 3d9d571af..7048781e3 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -876,7 +876,7 @@ private:
return;
}
- _kdm_dialog.reset(this, _film);
+ _kdm_dialog.emplace(this, _film);
_kdm_dialog->Show ();
}
@@ -886,7 +886,7 @@ private:
return;
}
- _dkdm_dialog.reset(this, _film);
+ _dkdm_dialog.emplace(this, _film);
_dkdm_dialog->Show ();
}
@@ -1083,7 +1083,7 @@ private:
void view_video_waveform ()
{
if (!_video_waveform_dialog) {
- _video_waveform_dialog.reset(this, _film, _film_viewer);
+ _video_waveform_dialog.emplace(this, _film, _film_viewer);
}
_video_waveform_dialog->Show ();
@@ -1130,7 +1130,7 @@ private:
void tools_manage_templates ()
{
if (!_templates_dialog) {
- _templates_dialog.reset(this);
+ _templates_dialog.emplace(this);
}
_templates_dialog->Show ();
@@ -1578,15 +1578,15 @@ private:
wxPanel* _right_panel;
FilmViewer _film_viewer;
StandardControls* _controls;
- wx_ptr<VideoWaveformDialog> _video_waveform_dialog;
+ boost::optional<VideoWaveformDialog> _video_waveform_dialog;
SystemInformationDialog* _system_information_dialog = nullptr;
DCPReferencingDialog* _dcp_referencing_dialog = nullptr;
HintsDialog* _hints_dialog = nullptr;
ServersListDialog* _servers_list_dialog = nullptr;
wxPreferencesEditor* _config_dialog = nullptr;
- wx_ptr<KDMDialog> _kdm_dialog;
- wx_ptr<DKDMDialog> _dkdm_dialog;
- wx_ptr<TemplatesDialog> _templates_dialog;
+ boost::optional<KDMDialog> _kdm_dialog;
+ boost::optional<DKDMDialog> _dkdm_dialog;
+ boost::optional<TemplatesDialog> _templates_dialog;
wxMenu* _file_menu = nullptr;
shared_ptr<Film> _film;
int _history_items = 0;
diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc
index 379a3c074..ed60aae37 100644
--- a/src/tools/dcpomatic_batch.cc
+++ b/src/tools/dcpomatic_batch.cc
@@ -25,7 +25,6 @@
#include "wx/id.h"
#include "wx/job_manager_view.h"
#include "wx/servers_list_dialog.h"
-#include "wx/wx_ptr.h"
#include "wx/wx_signal_manager.h"
#include "wx/wx_util.h"
#include "wx/wx_variant.h"
@@ -274,14 +273,14 @@ private:
return true;
}
- auto d = make_wx<wxMessageDialog>(
+ wxMessageDialog dialog(
nullptr,
_("There are unfinished jobs; are you sure you want to quit?"),
_("Unfinished jobs"),
wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION
);
- return d->ShowModal() == wxID_YES;
+ return dialog.ShowModal() == wxID_YES;
}
void close (wxCloseEvent& ev)
@@ -326,21 +325,21 @@ private:
void help_about ()
{
- auto d = make_wx<AboutDialog>(this);
- d->ShowModal ();
+ AboutDialog dialog(this);
+ dialog.ShowModal();
}
void add_film ()
{
- auto dialog = make_wx<wxDirDialog>(this, _("Select film to open"), wxStandardPaths::Get().GetDocumentsDir(), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST);
+ wxDirDialog dialog(this, _("Select film to open"), wxStandardPaths::Get().GetDocumentsDir(), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST);
if (_last_parent) {
- dialog->SetPath(std_to_wx(_last_parent.get().string()));
+ dialog.SetPath(std_to_wx(_last_parent.get().string()));
}
int r;
while (true) {
- r = dialog->ShowModal();
- if (r == wxID_OK && dialog->GetPath() == wxStandardPaths::Get().GetDocumentsDir()) {
+ r = dialog.ShowModal();
+ if (r == wxID_OK && dialog.GetPath() == wxStandardPaths::Get().GetDocumentsDir()) {
error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open."));
} else {
break;
@@ -348,10 +347,10 @@ private:
}
if (r == wxID_OK) {
- start_job(wx_to_std(dialog->GetPath()));
+ start_job(wx_to_std(dialog.GetPath()));
}
- _last_parent = boost::filesystem::path(wx_to_std(dialog->GetPath())).parent_path();
+ _last_parent = boost::filesystem::path(wx_to_std(dialog.GetPath())).parent_path();
}
void config_changed (Config::Property what)
diff --git a/src/tools/dcpomatic_disk.cc b/src/tools/dcpomatic_disk.cc
index b47addce9..ab603ccad 100644
--- a/src/tools/dcpomatic_disk.cc
+++ b/src/tools/dcpomatic_disk.cc
@@ -262,14 +262,14 @@ private:
return true;
}
- auto d = make_wx<wxMessageDialog>(
+ wxMessageDialog dialog(
nullptr,
_("There are unfinished jobs; are you sure you want to quit?"),
_("Unfinished jobs"),
wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION
);
- return d->ShowModal() == wxID_YES;
+ return dialog.ShowModal() == wxID_YES;
}
@@ -323,20 +323,20 @@ private:
if (!have_writer) {
#if defined(DCPOMATIC_WINDOWS)
- auto m = make_wx<MessageDialog>(
+ MessageDialog dialog(
this,
variant::wx::dcpomatic_disk_writer(),
_("Do you see a 'User Account Control' dialogue asking about dcpomatic2_disk_writer.exe? If so, click 'Yes', then try again.")
);
- m->ShowModal ();
+ dialog.ShowModal();
return;
#elif defined(DCPOMATIC_OSX)
- auto m = make_wx<MessageDialog>(
+ MessageDialog dialog(
this,
variant::wx::dcpomatic_disk_writer(),
variant::wx::insert_dcpomatic(_("Did you install the %s Disk Writer.pkg from the .dmg? Please check and try again."))
);
- m->ShowModal ();
+ dialog.ShowModal();
return;
#else
LOG_DISK_NC ("Failed to ping writer");
@@ -346,8 +346,8 @@ private:
auto const& drive = _drives[_drive->GetSelection()];
if (drive.mounted()) {
- auto d = make_wx<TryUnmountDialog>(this, std_to_wx(drive.description()));
- int const r = d->ShowModal ();
+ TryUnmountDialog dialog(this, std_to_wx(drive.description()));
+ int const r = dialog.ShowModal();
if (r != wxID_OK) {
return;
}
@@ -364,7 +364,7 @@ private:
/* The reply may have to wait for the user to authenticate, so let's wait a while */
auto const reply = DiskWriterBackEndResponse::read_from_nanomsg(_nanomsg, 30000);
if (!reply || reply->type() != DiskWriterBackEndResponse::Type::OK) {
- auto m = make_wx<MessageDialog>(
+ MessageDialog dialog(
this,
variant::wx::dcpomatic_disk_writer(),
wxString::Format(
@@ -373,17 +373,17 @@ private:
std_to_wx(reply->error_message())
)
);
- m->ShowModal ();
+ dialog.ShowModal();
return;
}
}
- auto d = make_wx<DriveWipeWarningDialog>(this, _drive->GetString(_drive->GetSelection()));
- if (d->ShowModal() != wxID_OK) {
+ DriveWipeWarningDialog dialog(this, _drive->GetString(_drive->GetSelection()));
+ if (dialog.ShowModal() != wxID_OK) {
return;
}
- if (!d->confirmed()) {
+ if (!dialog.confirmed()) {
message_dialog(this, _("You did not correctly confirm that you read the warning that was just shown. Please try again."));
return;
}
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index 0a45988a7..043e5f48b 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -34,7 +34,6 @@
#include "wx/update_dialog.h"
#include "wx/verify_dcp_progress_dialog.h"
#include "wx/verify_dcp_result_dialog.h"
-#include "wx/wx_ptr.h"
#include "wx/wx_signal_manager.h"
#include "wx/wx_util.h"
#include "wx/wx_variant.h"
@@ -680,12 +679,12 @@ private:
d = std_to_wx (Config::instance()->last_player_load_directory()->string());
}
- auto c = make_wx<wxDirDialog>(this, _("Select DCP to open"), d, wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST);
+ wxDirDialog dialog(this, _("Select DCP to open"), d, wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST);
int r;
while (true) {
- r = c->ShowModal ();
- if (r == wxID_OK && c->GetPath() == wxStandardPaths::Get().GetDocumentsDir()) {
+ r = dialog.ShowModal();
+ if (r == wxID_OK && dialog.GetPath() == wxStandardPaths::Get().GetDocumentsDir()) {
error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open."));
} else {
break;
@@ -693,7 +692,7 @@ private:
}
if (r == wxID_OK) {
- boost::filesystem::path const dcp (wx_to_std (c->GetPath ()));
+ boost::filesystem::path const dcp(wx_to_std(dialog.GetPath ()));
load_dcp (dcp);
Config::instance()->set_last_player_load_directory (dcp.parent_path());
}
@@ -706,7 +705,7 @@ private:
initial_dir = std_to_wx(Config::instance()->last_player_load_directory()->string());
}
- auto c = make_wx<wxDirDialog>(
+ wxDirDialog dialog(
this,
_("Select DCP to open as OV"),
initial_dir,
@@ -715,8 +714,8 @@ private:
int r;
while (true) {
- r = c->ShowModal ();
- if (r == wxID_OK && c->GetPath() == wxStandardPaths::Get().GetDocumentsDir()) {
+ r = dialog.ShowModal();
+ if (r == wxID_OK && dialog.GetPath() == wxStandardPaths::Get().GetDocumentsDir()) {
error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open."));
} else {
break;
@@ -730,7 +729,7 @@ private:
DCPOMATIC_ASSERT(dcp);
try {
- dcp->add_ov(wx_to_std(c->GetPath()));
+ dcp->add_ov(wx_to_std(dialog.GetPath()));
} catch (DCPError& e) {
error_dialog(this, char_to_wx(e.what()));
return;
@@ -1000,14 +999,14 @@ private:
void tools_timing ()
{
- auto d = make_wx<TimerDisplay>(this, _viewer.state_timer(), _viewer.gets());
- d->ShowModal ();
+ TimerDisplay dialog(this, _viewer.state_timer(), _viewer.gets());
+ dialog.ShowModal();
}
void tools_system_information ()
{
if (!_system_information_dialog) {
- _system_information_dialog = new SystemInformationDialog (this, _viewer);
+ _system_information_dialog.emplace(this, _viewer);
}
_system_information_dialog->Show ();
@@ -1015,15 +1014,15 @@ private:
void help_about ()
{
- auto d = make_wx<AboutDialog>(this);
- d->ShowModal ();
+ AboutDialog dialog(this);
+ dialog.ShowModal();
}
void help_report_a_problem ()
{
- auto d = make_wx<ReportProblemDialog>(this);
- if (d->ShowModal () == wxID_OK) {
- d->report ();
+ ReportProblemDialog dialog(this);
+ if (dialog.ShowModal() == wxID_OK) {
+ dialog.report();
}
}
@@ -1043,8 +1042,8 @@ private:
}
if (uc->state() == UpdateChecker::State::YES) {
- auto dialog = make_wx<UpdateDialog>(this, uc->stable (), uc->test ());
- dialog->ShowModal ();
+ UpdateDialog dialog(this, uc->stable (), uc->test ());
+ dialog.ShowModal();
} else if (uc->state() == UpdateChecker::State::FAILED) {
error_dialog(this, variant::wx::insert_dcpomatic(_("The %s download server could not be contacted.")));
} else {
@@ -1223,7 +1222,7 @@ private:
wxMenuItem* _history_separator = nullptr;
FilmViewer _viewer;
Controls* _controls;
- SystemInformationDialog* _system_information_dialog = nullptr;
+ boost::optional<SystemInformationDialog> _system_information_dialog;
std::shared_ptr<Film> _film;
boost::signals2::scoped_connection _config_changed_connection;
boost::signals2::scoped_connection _examine_job_connection;
diff --git a/src/tools/dcpomatic_playlist.cc b/src/tools/dcpomatic_playlist.cc
index 7798c3278..dfe578194 100644
--- a/src/tools/dcpomatic_playlist.cc
+++ b/src/tools/dcpomatic_playlist.cc
@@ -545,8 +545,8 @@ private:
void help_about ()
{
- auto d = make_wx<AboutDialog>(this);
- d->ShowModal ();
+ AboutDialog dialog(this);
+ dialog.ShowModal();
}
void edit_preferences ()
diff --git a/src/wx/audio_dialog.h b/src/wx/audio_dialog.h
index 8c2001c17..f750d8e13 100644
--- a/src/wx/audio_dialog.h
+++ b/src/wx/audio_dialog.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_AUDIO_DIALOG_H
+#define DCPOMATIC_AUDIO_DIALOG_H
+
+
#include "lib/audio_analysis.h"
#include "lib/constants.h"
#include "lib/film_property.h"
@@ -81,3 +85,6 @@ private:
boost::signals2::scoped_connection _film_content_connection;
boost::signals2::scoped_connection _analysis_finished_connection;
};
+
+
+#endif
diff --git a/src/wx/audio_mapping_view.cc b/src/wx/audio_mapping_view.cc
index 2c743ac7e..f1f008846 100644
--- a/src/wx/audio_mapping_view.cc
+++ b/src/wx/audio_mapping_view.cc
@@ -477,9 +477,9 @@ AudioMappingView::set_gain_from_menu (double linear)
void
AudioMappingView::edit ()
{
- auto dialog = make_wx<AudioGainDialog>(this, _menu_input, _menu_output, _map.get(_menu_input, _menu_output));
- if (dialog->ShowModal() == wxID_OK) {
- _map.set (_menu_input, _menu_output, dialog->value ());
+ AudioGainDialog dialog(this, _menu_input, _menu_output, _map.get(_menu_input, _menu_output));
+ if (dialog.ShowModal() == wxID_OK) {
+ _map.set(_menu_input, _menu_output, dialog.value());
map_values_changed ();
}
}
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc
index 1418f1ff9..d6a4ca130 100644
--- a/src/wx/audio_panel.cc
+++ b/src/wx/audio_panel.cc
@@ -400,7 +400,7 @@ AudioPanel::show_clicked ()
return;
}
- _audio_dialog.reset(this, _parent->film(), _parent->film_viewer(), ac.front());
+ _audio_dialog.emplace(this, _parent->film(), _parent->film_viewer(), ac.front());
_audio_dialog->Show ();
}
diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h
index d25f7e247..56552992d 100644
--- a/src/wx/audio_panel.h
+++ b/src/wx/audio_panel.h
@@ -19,13 +19,13 @@
*/
+#include "audio_dialog.h"
#include "content_sub_panel.h"
#include "content_widget.h"
#include "timecode.h"
#include "lib/audio_mapping.h"
-class AudioDialog;
class AudioMappingView;
class CheckBox;
class LanguageTagWidget;
@@ -76,7 +76,7 @@ private:
CheckBox* _use_same_fades_as_video;
AudioMappingView* _mapping;
wxStaticText* _description;
- wx_ptr<AudioDialog> _audio_dialog;
+ boost::optional<AudioDialog> _audio_dialog;
boost::signals2::scoped_connection _mapping_connection;
boost::signals2::scoped_connection _active_jobs_connection;
diff --git a/src/wx/content_advanced_dialog.cc b/src/wx/content_advanced_dialog.cc
index 8dd5ee78c..cc888aeb1 100644
--- a/src/wx/content_advanced_dialog.cc
+++ b/src/wx/content_advanced_dialog.cc
@@ -178,9 +178,9 @@ ContentAdvancedDialog::edit_filters ()
return;
}
- auto dialog = make_wx<FilterDialog>(this, _filters_list);
- dialog->ActiveChanged.connect(bind(&ContentAdvancedDialog::filters_changed, this, _1));
- dialog->ShowModal();
+ FilterDialog dialog(this, _filters_list);
+ dialog.ActiveChanged.connect(bind(&ContentAdvancedDialog::filters_changed, this, _1));
+ dialog.ShowModal();
}
diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc
index b2010d4bf..1106a10fc 100644
--- a/src/wx/content_menu.cc
+++ b/src/wx/content_menu.cc
@@ -249,8 +249,8 @@ ContentMenu::repeat ()
return;
}
- auto d = make_wx<RepeatDialog>(_parent);
- if (d->ShowModal() != wxID_OK) {
+ RepeatDialog dialog(_parent);
+ if (dialog.ShowModal() != wxID_OK) {
return;
}
@@ -259,7 +259,7 @@ ContentMenu::repeat ()
return;
}
- film->repeat_content (_content, d->number ());
+ film->repeat_content(_content, dialog.number());
_content.clear ();
_views.clear ();
@@ -475,8 +475,8 @@ ContentMenu::properties ()
{
auto film = _film.lock ();
DCPOMATIC_ASSERT (film);
- auto d = make_wx<ContentPropertiesDialog>(_parent, film, _content.front());
- d->ShowModal ();
+ ContentPropertiesDialog dialog(_parent, film, _content.front());
+ dialog.ShowModal();
}
@@ -486,26 +486,26 @@ ContentMenu::advanced ()
DCPOMATIC_ASSERT(!_content.empty());
auto content = _content.front();
- auto dialog = make_wx<ContentAdvancedDialog>(_parent, content);
+ ContentAdvancedDialog dialog(_parent, content);
- if (dialog->ShowModal() == wxID_CANCEL) {
+ if (dialog.ShowModal() == wxID_CANCEL) {
return;
}
if (content->video) {
- content->video->set_use(!dialog->ignore_video());
- content->video->set_burnt_subtitle_language(dialog->burnt_subtitle_language());
+ content->video->set_use(!dialog.ignore_video());
+ content->video->set_burnt_subtitle_language(dialog.burnt_subtitle_language());
}
auto ffmpeg = dynamic_pointer_cast<FFmpegContent>(content);
if (ffmpeg) {
- ffmpeg->set_filters(dialog->filters());
+ ffmpeg->set_filters(dialog.filters());
}
- if (dialog->video_frame_rate()) {
+ if (dialog.video_frame_rate()) {
auto film = _film.lock();
DCPOMATIC_ASSERT(film);
- content->set_video_frame_rate(film, *dialog->video_frame_rate());
+ content->set_video_frame_rate(film, *dialog.video_frame_rate());
} else {
content->unset_video_frame_rate();
}
@@ -570,7 +570,7 @@ ContentMenu::auto_crop ()
auto const crop = guess_crop_for_content ();
update_viewer (crop);
- _auto_crop_dialog.reset(_parent, crop);
+ _auto_crop_dialog.emplace(_parent, crop);
_auto_crop_dialog->Show ();
/* Update the dialog and view when the crop threshold changes */
diff --git a/src/wx/content_menu.h b/src/wx/content_menu.h
index e7f095390..a9348fe29 100644
--- a/src/wx/content_menu.h
+++ b/src/wx/content_menu.h
@@ -25,7 +25,6 @@
#include "auto_crop_dialog.h"
#include "timeline_content_view.h"
-#include "wx_ptr.h"
#include "lib/types.h"
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
@@ -90,7 +89,7 @@ private:
wxMenuItem* _set_dcp_markers;
wxMenuItem* _remove;
- wx_ptr<AutoCropDialog> _auto_crop_dialog;
+ boost::optional<AutoCropDialog> _auto_crop_dialog;
boost::signals2::scoped_connection _auto_crop_config_connection;
boost::signals2::scoped_connection _auto_crop_viewer_connection;
};
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc
index 8938ef0fd..bb8acf664 100644
--- a/src/wx/content_panel.cc
+++ b/src/wx/content_panel.cc
@@ -733,7 +733,7 @@ ContentPanel::timeline_clicked ()
return;
}
- _timeline_dialog.reset(this, _film, _film_viewer);
+ _timeline_dialog.emplace(this, _film, _film_viewer);
_timeline_dialog->set_selection (selected());
_timeline_dialog->Show ();
}
diff --git a/src/wx/content_panel.h b/src/wx/content_panel.h
index f99d518a2..18d740828 100644
--- a/src/wx/content_panel.h
+++ b/src/wx/content_panel.h
@@ -20,6 +20,7 @@
#include "content_menu.h"
+#include "content_timeline_dialog.h"
#include "lib/enum_indexed_vector.h"
#include "lib/film_property.h"
#include "lib/text_type.h"
@@ -133,7 +134,7 @@ private:
EnumIndexedVector<TextPanel*, TextType> _text_panel;
TimingPanel* _timing_panel;
ContentMenu* _menu;
- wx_ptr<ContentTimelineDialog> _timeline_dialog;
+ boost::optional<ContentTimelineDialog> _timeline_dialog;
wxNotebook* _parent;
wxWindow* _last_selected_tab = nullptr;
diff --git a/src/wx/content_timeline.h b/src/wx/content_timeline.h
index 10f880191..c82f31a83 100644
--- a/src/wx/content_timeline.h
+++ b/src/wx/content_timeline.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_CONTENT_TIMELINE_H
+#define DCPOMATIC_CONTENT_TIMELINE_H
+
+
#include "content_menu.h"
#include "timeline.h"
#include "timeline_content_view.h"
@@ -147,3 +151,6 @@ private:
boost::signals2::scoped_connection _film_changed_connection;
boost::signals2::scoped_connection _film_content_change_connection;
};
+
+
+#endif
diff --git a/src/wx/content_timeline_dialog.h b/src/wx/content_timeline_dialog.h
index 2babf0437..160af7df1 100644
--- a/src/wx/content_timeline_dialog.h
+++ b/src/wx/content_timeline_dialog.h
@@ -19,6 +19,9 @@
*/
+#ifndef DCPOMATIC_CONTENT_TIMELINE_DIALOG_H
+#define DCPOMATIC_CONTENT_TIMELINE_DIALOG_H
+
#include "content_timeline.h"
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
@@ -46,3 +49,7 @@ private:
wxToolBar* _toolbar;
boost::signals2::scoped_connection _film_changed_connection;
};
+
+
+#endif
+
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index 5a8d49e02..3d28a3ae5 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -339,7 +339,7 @@ DCPPanel::resolution_changed ()
void
DCPPanel::markers_clicked ()
{
- _markers_dialog.reset(_panel, _film, _viewer);
+ _markers_dialog.emplace(_panel, _film, _viewer);
_markers_dialog->Show();
}
@@ -348,11 +348,11 @@ void
DCPPanel::metadata_clicked ()
{
if (_film->interop()) {
- _interop_metadata_dialog.reset(_panel, _film);
+ _interop_metadata_dialog.emplace(_panel, _film);
_interop_metadata_dialog->setup ();
_interop_metadata_dialog->Show ();
} else {
- _smpte_metadata_dialog.reset(_panel, _film);
+ _smpte_metadata_dialog.emplace(_panel, _film);
_smpte_metadata_dialog->setup ();
_smpte_metadata_dialog->Show ();
}
@@ -362,7 +362,7 @@ DCPPanel::metadata_clicked ()
void
DCPPanel::reels_clicked()
{
- _dcp_timeline.reset(_panel, _film);
+ _dcp_timeline.emplace(_panel, _film);
_dcp_timeline->Show();
}
@@ -1029,7 +1029,7 @@ DCPPanel::show_audio_clicked ()
return;
}
- _audio_dialog.reset(_panel, _film, _viewer);
+ _audio_dialog.emplace(_panel, _film, _viewer);
_audio_dialog->Show();
}
@@ -1062,9 +1062,9 @@ void
DCPPanel::edit_audio_language_clicked ()
{
DCPOMATIC_ASSERT (_film->audio_language());
- auto d = make_wx<LanguageTagDialog>(_panel, *_film->audio_language());
- if (d->ShowModal() == wxID_OK) {
- _film->set_audio_language(d->get());
+ LanguageTagDialog dialog(_panel, *_film->audio_language());
+ if (dialog.ShowModal() == wxID_OK) {
+ _film->set_audio_language(dialog.get());
}
}
diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h
index 4988922a8..25b7d959d 100644
--- a/src/wx/dcp_panel.h
+++ b/src/wx/dcp_panel.h
@@ -19,7 +19,11 @@
*/
-#include "wx_ptr.h"
+#include "audio_dialog.h"
+#include "dcp_timeline_dialog.h"
+#include "interop_metadata_dialog.h"
+#include "markers_dialog.h"
+#include "smpte_metadata_dialog.h"
#include "lib/config.h"
#include "lib/film_property.h"
@@ -37,15 +41,11 @@ class wxSpinCtrl;
class wxSizer;
class wxGridBagSizer;
-class AudioDialog;
class Choice;
-class DCPTimelineDialog;
class Film;
class FilmViewer;
class InteropMetadataDialog;
-class MarkersDialog;
class Ratio;
-class SMPTEMetadataDialog;
class DCPPanel
{
@@ -158,11 +158,11 @@ private:
Button* _reels;
wxSizer* _audio_panel_sizer;
- wx_ptr<AudioDialog> _audio_dialog;
- wx_ptr<MarkersDialog> _markers_dialog;
- wx_ptr<InteropMetadataDialog> _interop_metadata_dialog;
- wx_ptr<SMPTEMetadataDialog> _smpte_metadata_dialog;
- wx_ptr<DCPTimelineDialog> _dcp_timeline;
+ boost::optional<AudioDialog> _audio_dialog;
+ boost::optional<MarkersDialog> _markers_dialog;
+ boost::optional<InteropMetadataDialog> _interop_metadata_dialog;
+ boost::optional<SMPTEMetadataDialog> _smpte_metadata_dialog;
+ boost::optional<DCPTimelineDialog> _dcp_timeline;
std::shared_ptr<Film> _film;
FilmViewer& _viewer;
diff --git a/src/wx/dcp_timeline_dialog.h b/src/wx/dcp_timeline_dialog.h
index d1293ca26..ee2209b13 100644
--- a/src/wx/dcp_timeline_dialog.h
+++ b/src/wx/dcp_timeline_dialog.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_DCP_TIMELINE_DIALOG_H
+#define DCPOMATIC_DCP_TIMELINE_DIALOG_H
+
+
#include "dcp_timeline.h"
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
@@ -37,3 +41,6 @@ private:
DCPTimeline _timeline;
};
+
+#endif
+
diff --git a/src/wx/dir_picker_ctrl.cc b/src/wx/dir_picker_ctrl.cc
index 4c2f5d2f2..034ae5a5e 100644
--- a/src/wx/dir_picker_ctrl.cc
+++ b/src/wx/dir_picker_ctrl.cc
@@ -88,8 +88,8 @@ DirPickerCtrl::GetPath () const
void
DirPickerCtrl::browse_clicked ()
{
- auto d = make_wx<wxDirDialog>(this);
- if (d->ShowModal () == wxID_OK) {
- SetPath (d->GetPath ());
+ wxDirDialog dialog(this);
+ if (dialog.ShowModal() == wxID_OK) {
+ SetPath(dialog.GetPath());
}
}
diff --git a/src/wx/editable_list.h b/src/wx/editable_list.h
index aea15eb90..0cb4c841f 100644
--- a/src/wx/editable_list.h
+++ b/src/wx/editable_list.h
@@ -232,10 +232,10 @@ private:
void add_clicked ()
{
- auto dialog = make_wx<S>(this);
+ S dialog(this);
- if (dialog->ShowModal() == wxID_OK) {
- auto const v = dialog->get ();
+ if (dialog.ShowModal() == wxID_OK) {
+ auto const v = dialog.get();
static_assert(std::is_same<typename std::remove_const<decltype(v)>::type, boost::optional<T>>::value, "get() must return boost::optional<T>");
if (v) {
add_to_control (v.get ());
@@ -256,10 +256,10 @@ private:
std::vector<T> all = _get ();
DCPOMATIC_ASSERT (item >= 0 && item < int (all.size ()));
- auto dialog = make_wx<S>(this);
- dialog->set (all[item]);
- if (dialog->ShowModal() == wxID_OK) {
- auto const v = dialog->get ();
+ S dialog(this);
+ dialog.set(all[item]);
+ if (dialog.ShowModal() == wxID_OK) {
+ auto const v = dialog.get();
static_assert(std::is_same<typename std::remove_const<decltype(v)>::type, boost::optional<T>>::value, "get() must return boost::optional<T>");
if (!v) {
return;
diff --git a/src/wx/fonts_dialog.cc b/src/wx/fonts_dialog.cc
index dc1bb5951..315f0b369 100644
--- a/src/wx/fonts_dialog.cc
+++ b/src/wx/fonts_dialog.cc
@@ -184,13 +184,13 @@ FontsDialog::set_from_file_clicked ()
default_dir = char_to_wx("/System/Library/Fonts");
#endif
- auto d = make_wx<wxFileDialog>(this, _("Choose a font file"), default_dir, wxString{}, char_to_wx("*.ttf;*.otf;*.ttc"), wxFD_CHANGE_DIR);
+ wxFileDialog dialog(this, _("Choose a font file"), default_dir, wxString{}, char_to_wx("*.ttf;*.otf;*.ttc"), wxFD_CHANGE_DIR);
- if (d->ShowModal() != wxID_OK) {
+ if (dialog.ShowModal() != wxID_OK) {
return;
}
- font->set_file (wx_to_std(d->GetPath()));
+ font->set_file(wx_to_std(dialog.GetPath()));
setup ();
}
@@ -203,9 +203,9 @@ FontsDialog::set_from_system_font_clicked()
return;
}
- auto dialog = make_wx<SystemFontDialog>(this);
- if (dialog->ShowModal() == wxID_OK) {
- auto font_file = dialog->get_font();
+ SystemFontDialog dialog(this);
+ if (dialog.ShowModal() == wxID_OK) {
+ auto font_file = dialog.get_font();
if (font_file) {
font->set_file(*font_file);
}
diff --git a/src/wx/fonts_dialog.h b/src/wx/fonts_dialog.h
index c741131c4..3e6150a4f 100644
--- a/src/wx/fonts_dialog.h
+++ b/src/wx/fonts_dialog.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_FONTS_DIALOG_H
+#define DCPOMATIC_FONTS_DIALOG_H
+
+
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/listctrl.h>
@@ -54,3 +58,7 @@ private:
wxButton* _set_from_file;
wxButton* _set_from_system_font = nullptr;
};
+
+
+#endif
+
diff --git a/src/wx/interop_metadata_dialog.h b/src/wx/interop_metadata_dialog.h
index a2423d9bd..ddc8b8939 100644
--- a/src/wx/interop_metadata_dialog.h
+++ b/src/wx/interop_metadata_dialog.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_INTEROP_METADATA_DIALOG_H
+#define DCPOMATIC_INTEROP_METADATA_DIALOG_H
+
+
#include "metadata_dialog.h"
#include <dcp/language_tag.h>
#include <dcp/types.h>
@@ -45,3 +49,7 @@ private:
wxTextCtrl* _content_version;
};
+
+
+#endif
+
diff --git a/src/wx/kdm_cpl_panel.cc b/src/wx/kdm_cpl_panel.cc
index e07df105d..eb02638a2 100644
--- a/src/wx/kdm_cpl_panel.cc
+++ b/src/wx/kdm_cpl_panel.cc
@@ -104,12 +104,12 @@ KDMCPLPanel::update_cpl_summary ()
void
KDMCPLPanel::cpl_browse_clicked ()
{
- auto d = make_wx<wxFileDialog>(this, _("Select CPL XML file"), wxEmptyString, wxEmptyString, char_to_wx("*.xml"));
- if (d->ShowModal() == wxID_CANCEL) {
+ wxFileDialog dialog(this, _("Select CPL XML file"), wxEmptyString, wxEmptyString, char_to_wx("*.xml"));
+ if (dialog.ShowModal() == wxID_CANCEL) {
return;
}
- boost::filesystem::path cpl_file (wx_to_std (d->GetPath ()));
+ boost::filesystem::path cpl_file(wx_to_std(dialog.GetPath()));
boost::filesystem::path dcp_dir = cpl_file.parent_path ();
try {
diff --git a/src/wx/language_tag_widget.cc b/src/wx/language_tag_widget.cc
index c182a8837..cefa4b90c 100644
--- a/src/wx/language_tag_widget.cc
+++ b/src/wx/language_tag_widget.cc
@@ -65,10 +65,10 @@ LanguageTagWidget::~LanguageTagWidget()
void
LanguageTagWidget::edit ()
{
- auto d = make_wx<LanguageTagDialog>(_parent, _tag.get_value_or(dcp::LanguageTag("en")));
- if (d->ShowModal() == wxID_OK) {
- set(d->get());
- Changed(d->get());
+ LanguageTagDialog dialog(_parent, _tag.get_value_or(dcp::LanguageTag("en")));
+ if (dialog.ShowModal() == wxID_OK) {
+ set(dialog.get());
+ Changed(dialog.get());
}
}
diff --git a/src/wx/markers_dialog.h b/src/wx/markers_dialog.h
index e962d4463..c6f76d206 100644
--- a/src/wx/markers_dialog.h
+++ b/src/wx/markers_dialog.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_MARKERS_DIALOG_H
+#define DCPOMATIC_MARKERS_DIALOG_H
+
+
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/wx.h>
@@ -40,3 +44,6 @@ private:
std::list<std::shared_ptr<Marker>> _markers;
std::weak_ptr<Film> _film;
};
+
+
+#endif
diff --git a/src/wx/recipient_dialog.cc b/src/wx/recipient_dialog.cc
index 79856d66e..85c01c97e 100644
--- a/src/wx/recipient_dialog.cc
+++ b/src/wx/recipient_dialog.cc
@@ -168,9 +168,9 @@ RecipientDialog::load_recipient (boost::filesystem::path file)
void
RecipientDialog::get_recipient_from_file ()
{
- auto d = make_wx<wxFileDialog>(this, _("Select Certificate File"));
- if (d->ShowModal () == wxID_OK) {
- load_recipient (boost::filesystem::path (wx_to_std (d->GetPath ())));
+ wxFileDialog dialog(this, _("Select Certificate File"));
+ if (dialog.ShowModal() == wxID_OK) {
+ load_recipient(boost::filesystem::path(wx_to_std(dialog.GetPath())));
}
setup_sensitivity ();
diff --git a/src/wx/region_subtag_widget.cc b/src/wx/region_subtag_widget.cc
index c9556cba9..8b3389c7f 100644
--- a/src/wx/region_subtag_widget.cc
+++ b/src/wx/region_subtag_widget.cc
@@ -59,11 +59,11 @@ RegionSubtagWidget::RegionSubtagWidget(wxWindow* parent, wxString tooltip, optio
void
RegionSubtagWidget::edit()
{
- auto d = make_wx<RegionSubtagDialog>(_parent, _tag.get_value_or(dcp::LanguageTag::RegionSubtag("US")));
+ RegionSubtagDialog dialog(_parent, _tag.get_value_or(dcp::LanguageTag::RegionSubtag("US")));
- if (d->ShowModal() == wxID_OK) {
- set(d->get());
- Changed(d->get());
+ if (dialog.ShowModal() == wxID_OK) {
+ set(dialog.get());
+ Changed(dialog.get());
}
}
diff --git a/src/wx/smpte_metadata_dialog.h b/src/wx/smpte_metadata_dialog.h
index 4ac943f7a..c63efd045 100644
--- a/src/wx/smpte_metadata_dialog.h
+++ b/src/wx/smpte_metadata_dialog.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_SMPTE_METADATA_DIALOG_H
+#define DCPOMATIC_SMPTE_METADATA_DIALOG_H
+
+
#include "editable_list.h"
#include "full_language_tag_dialog.h"
#include "metadata_dialog.h"
@@ -66,3 +70,7 @@ private:
wxTextCtrl* _distributor;
EditableList<std::string, ContentVersionDialog>* _content_versions;
};
+
+
+#endif
+
diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc
index b69f115f7..ddb5bf56d 100644
--- a/src/wx/text_panel.cc
+++ b/src/wx/text_panel.cc
@@ -356,9 +356,9 @@ TextPanel::dcp_track_changed ()
optional<DCPTextTrack> track;
if (_dcp_track->GetSelection() == int(_dcp_track->GetCount()) - 1) {
- auto d = make_wx<DCPTextTrackDialog>(this);
- if (d->ShowModal() == wxID_OK) {
- track = d->get();
+ DCPTextTrackDialog dialog(this);
+ if (dialog.ShowModal() == wxID_OK) {
+ track = dialog.get();
}
} else {
/* Find the DCPTextTrack that was selected */
@@ -689,7 +689,7 @@ TextPanel::text_view_clicked ()
auto decoder = decoder_factory (_parent->film(), c.front(), false, false, shared_ptr<Decoder>());
if (decoder) {
- _text_view.reset(this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type), decoder, _parent->film_viewer());
+ _text_view.emplace(this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type), decoder, _parent->film_viewer());
_text_view->show();
}
}
@@ -701,8 +701,8 @@ TextPanel::fonts_dialog_clicked ()
auto c = _parent->selected_text ();
DCPOMATIC_ASSERT (c.size() == 1);
- _fonts_dialog.reset(this, c.front(), c.front()->text_of_original_type(_original_type));
- _fonts_dialog->Show ();
+ _fonts_dialog.emplace(this, c.front(), c.front()->text_of_original_type(_original_type));
+ _fonts_dialog->Show();
}
diff --git a/src/wx/text_panel.h b/src/wx/text_panel.h
index 3c6e183dc..e89b9a54d 100644
--- a/src/wx/text_panel.h
+++ b/src/wx/text_panel.h
@@ -19,19 +19,19 @@
*/
-#include "lib/job.h"
#include "content_sub_panel.h"
-#include "wx_ptr.h"
+#include "fonts_dialog.h"
+#include "text_view.h"
+#include "lib/job.h"
class CheckBox;
class Choice;
-class wxSpinCtrl;
class LanguageTagWidget;
-class TextView;
-class FontsDialog;
class SpinCtrl;
class SubtitleAnalysis;
+class TextView;
+class wxSpinCtrl;
class TextPanel : public ContentSubPanel
@@ -100,9 +100,9 @@ private:
wxStaticText* _stream_label;
wxChoice* _stream;
wxButton* _text_view_button;
- wx_ptr<TextView> _text_view;
+ boost::optional<TextView> _text_view;
wxButton* _fonts_dialog_button;
- wx_ptr<FontsDialog> _fonts_dialog;
+ boost::optional<FontsDialog> _fonts_dialog;
wxButton* _appearance_dialog_button;
TextType _original_type;
wxStaticText* _language_label = nullptr;
diff --git a/src/wx/text_view.h b/src/wx/text_view.h
index d1271ef26..ee7650673 100644
--- a/src/wx/text_view.h
+++ b/src/wx/text_view.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_TEXT_VIEW_H
+#define DCPOMATIC_TEXT_VIEW_H
+
+
#include "window_metrics.h"
#include "lib/content_text.h"
#include <dcp/warnings.h>
@@ -64,3 +68,7 @@ private:
static WindowMetrics _metrics;
};
+
+
+#endif
+
diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc
index 6c6638c07..482b1ce9c 100644
--- a/src/wx/timing_panel.cc
+++ b/src/wx/timing_panel.cc
@@ -501,11 +501,11 @@ TimingPanel::move_to_start_of_reel_clicked ()
}
}
- auto d = make_wx<MoveToDialog>(this, position, _parent->film());
+ MoveToDialog dialog(this, position, _parent->film());
- if (d->ShowModal() == wxID_OK) {
+ if (dialog.ShowModal() == wxID_OK) {
for (auto i: _parent->selected()) {
- i->set_position (_parent->film(), d->position());
+ i->set_position(_parent->film(), dialog.position());
}
}
}
diff --git a/src/wx/window_metrics.h b/src/wx/window_metrics.h
index 30a921134..9a1e10a66 100644
--- a/src/wx/window_metrics.h
+++ b/src/wx/window_metrics.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_WINDOW_METRICS_H
+#define DCPOMATIC_WINDOW_METRICS_H
+
+
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/gdicmn.h>
@@ -37,3 +41,6 @@ public:
wxSize size = wxDefaultSize;
};
+
+#endif
+
diff --git a/src/wx/wx_ptr.h b/src/wx/wx_ptr.h
deleted file mode 100644
index fcca8b18b..000000000
--- a/src/wx/wx_ptr.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- DCP-o-matic is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-
-#ifndef DCPOMATIC_WX_PTR_H
-#define DCPOMATIC_WX_PTR_H
-
-
-#include "lib/dcpomatic_assert.h"
-#include <utility>
-
-
-template <class T>
-class wx_ptr
-{
-public:
- wx_ptr() {}
-
- explicit wx_ptr(T* wx)
- : _wx(wx)
- {}
-
- wx_ptr(wx_ptr&) = delete;
- wx_ptr& operator=(wx_ptr&) = delete;
-
- wx_ptr(wx_ptr&& other)
- {
- _wx = other._wx;
- other._wx = nullptr;
- }
-
- wx_ptr& operator=(wx_ptr&& other)
- {
- if (this != &other) {
- _wx = other._wx;
- other._wx = nullptr;
- }
- return *this;
- }
-
- ~wx_ptr()
- {
- if (_wx) {
- _wx->Destroy();
- }
- }
-
- wx_ptr& operator=(T* ptr)
- {
- if (_wx) {
- _wx->Destroy();
- }
- _wx = ptr;
- return *this;
- }
-
- T* operator->()
- {
- DCPOMATIC_ASSERT(_wx);
- return _wx;
- }
-
- operator bool() const
- {
- return _wx != nullptr;
- }
-
- void reset()
- {
- if (_wx) {
- _wx->Destroy();
- _wx = nullptr;
- }
- }
-
- template <typename... Args>
- void reset(Args&&... args)
- {
- if (_wx) {
- _wx->Destroy();
- _wx = nullptr;
- }
- _wx = new T(std::forward<Args>(args)...);
- }
-
-private:
- T* _wx = nullptr;
-};
-
-
-
-template <class T, typename... Args>
-wx_ptr<T>
-make_wx(Args... args)
-{
- return wx_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
-
-#endif
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index b1cd873fc..78fa3f544 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -29,7 +29,6 @@
#include "password_entry.h"
#include "region_subtag_widget.h"
#include "static_text.h"
-#include "wx_ptr.h"
#include "wx_util.h"
#include "wx_variant.h"
#include "lib/config.h"
@@ -164,13 +163,13 @@ add_label_to_sizer (wxGridBagSizer* s, wxStaticText* t, bool, wxGBPosition pos,
void
error_dialog (wxWindow* parent, wxString m, optional<wxString> e)
{
- auto d = make_wx<wxMessageDialog>(parent, m, variant::wx::dcpomatic(), wxOK | wxICON_ERROR);
+ wxMessageDialog dialog(parent, m, variant::wx::dcpomatic(), wxOK | wxICON_ERROR);
if (e) {
wxString em = *e;
em[0] = wxToupper (em[0]);
- d->SetExtendedMessage (em);
+ dialog.SetExtendedMessage(em);
}
- d->ShowModal ();
+ dialog.ShowModal();
}
@@ -181,8 +180,8 @@ error_dialog (wxWindow* parent, wxString m, optional<wxString> e)
void
message_dialog (wxWindow* parent, wxString m)
{
- auto d = make_wx<wxMessageDialog>(parent, m, variant::wx::dcpomatic(), wxOK | wxICON_INFORMATION);
- d->ShowModal ();
+ wxMessageDialog dialog(parent, m, variant::wx::dcpomatic(), wxOK | wxICON_INFORMATION);
+ dialog.ShowModal();
}
@@ -190,8 +189,8 @@ message_dialog (wxWindow* parent, wxString m)
bool
confirm_dialog (wxWindow* parent, wxString m)
{
- auto d = make_wx<wxMessageDialog>(parent, m, variant::wx::dcpomatic(), wxYES_NO | wxICON_QUESTION);
- return d->ShowModal() == wxID_YES;
+ wxMessageDialog dialog(parent, m, variant::wx::dcpomatic(), wxYES_NO | wxICON_QUESTION);
+ return dialog.ShowModal() == wxID_YES;
}
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index a101a8498..2968ce9ff 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -28,7 +28,6 @@
#define DCPOMATIC_WX_UTIL_H
-#include "wx_ptr.h"
#include "lib/config.h"
#include "lib/dcpomatic_time.h"
#include <dcp/utc_offset.h>