summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-15 00:16:30 +0100
committerCarl Hetherington <cth@carlh.net>2023-01-15 00:16:30 +0100
commitfcaf62b405f6379e7030ddc2a38426c5f9ffb081 (patch)
tree2399fc7e4b3b33083ce55b299def818731065df7
parente6c2c489924fbe2f8db70030f1774541a819d46c (diff)
Use wx_ptr some more.
-rw-r--r--src/wx/text_panel.cc14
-rw-r--r--src/wx/text_panel.h5
2 files changed, 5 insertions, 14 deletions
diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc
index 94ec8506d..ba6c07e76 100644
--- a/src/wx/text_panel.cc
+++ b/src/wx/text_panel.cc
@@ -735,18 +735,13 @@ TextPanel::content_selection_changed ()
void
TextPanel::text_view_clicked ()
{
- if (_text_view) {
- _text_view->Destroy ();
- _text_view = nullptr;
- }
-
auto c = _parent->selected_text ();
DCPOMATIC_ASSERT (c.size() == 1);
auto decoder = decoder_factory (_parent->film(), c.front(), false, false, shared_ptr<Decoder>());
if (decoder) {
- _text_view = new TextView (this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type), decoder, _parent->film_viewer());
+ _text_view.reset(this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type), decoder, _parent->film_viewer());
_text_view->Show ();
}
}
@@ -755,15 +750,10 @@ TextPanel::text_view_clicked ()
void
TextPanel::fonts_dialog_clicked ()
{
- if (_fonts_dialog) {
- _fonts_dialog->Destroy ();
- _fonts_dialog = nullptr;
- }
-
auto c = _parent->selected_text ();
DCPOMATIC_ASSERT (c.size() == 1);
- _fonts_dialog = new FontsDialog (this, c.front(), c.front()->text_of_original_type(_original_type));
+ _fonts_dialog.reset(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 dc8f685f1..52ef4d1fc 100644
--- a/src/wx/text_panel.h
+++ b/src/wx/text_panel.h
@@ -20,6 +20,7 @@
#include "content_sub_panel.h"
+#include "wx_ptr.h"
class CheckBox;
@@ -100,9 +101,9 @@ private:
wxStaticText* _stream_label;
wxChoice* _stream;
wxButton* _text_view_button;
- TextView* _text_view = nullptr;
+ wx_ptr<TextView> _text_view;
wxButton* _fonts_dialog_button;
- FontsDialog* _fonts_dialog = nullptr;
+ wx_ptr<FontsDialog> _fonts_dialog;
wxButton* _appearance_dialog_button;
TextType _original_type;
wxStaticText* _language_label = nullptr;