summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-10-05 00:03:09 +0200
committerCarl Hetherington <cth@carlh.net>2022-10-05 00:03:09 +0200
commitc3802179cb922adc58232dcd5a29fc3962494293 (patch)
tree67f543e1c509f533dbd341f39cc5d0e2105e96d1
parent8833ea90cf818e87da7a8f31698a04da54987521 (diff)
Add a Cancel button to the LanguageTagDialog.
-rw-r--r--src/wx/dcp_panel.cc5
-rw-r--r--src/wx/language_tag_dialog.cc2
-rw-r--r--src/wx/language_tag_widget.cc7
3 files changed, 8 insertions, 6 deletions
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index 8a3e57304..895aed9c9 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -1039,8 +1039,9 @@ DCPPanel::edit_audio_language_clicked ()
{
DCPOMATIC_ASSERT (_film->audio_language());
auto d = new LanguageTagDialog (_panel, *_film->audio_language());
- d->ShowModal ();
- _film->set_audio_language(d->get());
+ if (d->ShowModal() == wxID_OK) {
+ _film->set_audio_language(d->get());
+ }
d->Destroy ();
}
diff --git a/src/wx/language_tag_dialog.cc b/src/wx/language_tag_dialog.cc
index 6fdcdba78..a3ad847d5 100644
--- a/src/wx/language_tag_dialog.cc
+++ b/src/wx/language_tag_dialog.cc
@@ -46,7 +46,7 @@ LanguageTagDialog::LanguageTagDialog (wxWindow* parent, dcp::LanguageTag tag)
overall_sizer->Add (_list, 0, wxALL, DCPOMATIC_SIZER_GAP);
overall_sizer->Add (add, 0, wxALL, DCPOMATIC_SIZER_GAP);
- auto buttons = CreateSeparatedButtonSizer (wxOK);
+ auto buttons = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
if (buttons) {
overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
}
diff --git a/src/wx/language_tag_widget.cc b/src/wx/language_tag_widget.cc
index 567b1fefa..37b7f6209 100644
--- a/src/wx/language_tag_widget.cc
+++ b/src/wx/language_tag_widget.cc
@@ -66,9 +66,10 @@ void
LanguageTagWidget::edit ()
{
auto d = new LanguageTagDialog(_parent, _tag.get_value_or(dcp::LanguageTag("en")));
- d->ShowModal ();
- set (d->get());
- Changed (d->get());
+ if (d->ShowModal() == wxID_OK) {
+ set(d->get());
+ Changed(d->get());
+ }
d->Destroy ();
}