1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-06 19:52:19 +01:00

Enh 66 again: do not make duplicate About dialogs on Mac

This commit is contained in:
Paul Licameli
2016-06-20 19:12:03 -04:00
parent 41f9f506c0
commit 5e95491bfc
4 changed files with 31 additions and 14 deletions

View File

@@ -223,11 +223,23 @@ END_EVENT_TABLE()
IMPLEMENT_CLASS(AboutDialog, wxDialog)
namespace {
AboutDialog *sActiveInstance{};
}
AboutDialog *AboutDialog::ActiveIntance()
{
return sActiveInstance;
}
AboutDialog::AboutDialog(wxWindow * parent)
: wxDialog(parent, -1, _("About Audacity"),
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
wxASSERT(!sActiveInstance);
sActiveInstance = this;
SetName(GetTitle());
this->SetBackgroundColour(theTheme.Colour( clrAboutBoxBackground ));
icon = NULL;
@@ -964,12 +976,16 @@ void AboutDialog::AddBuildinfoRow( wxString* htmlstring, const wxChar * libname,
*htmlstring += wxT("</td></tr>");
}
AboutDialog::~AboutDialog()
{
sActiveInstance = {};
}
void AboutDialog::OnOK(wxCommandEvent & WXUNUSED(event))
{
#ifdef __WXMAC__
Destroy();
#else
EndModal(wxID_OK);
#endif
}