From: Carl Hetherington Date: Tue, 4 Oct 2022 22:03:09 +0000 (+0200) Subject: Add a Cancel button to the LanguageTagDialog. X-Git-Tag: v2.16.29~4 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=c3802179cb922adc58232dcd5a29fc3962494293 Add a Cancel button to the LanguageTagDialog. --- 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 (); }