diff --git a/src/Prefs.cpp b/src/Prefs.cpp index 97268379a..e47313638 100755 --- a/src/Prefs.cpp +++ b/src/Prefs.cpp @@ -69,6 +69,8 @@ std::unique_ptr ugPrefs {}; AudacityPrefs *gPrefs = NULL; int gMenusDirty = 0; +wxDEFINE_EVENT(EVT_PREFS_UPDATE, wxCommandEvent); + #if 0 // Copy one entry from one wxConfig object to another static void CopyEntry(wxString path, wxConfigBase *src, wxConfigBase *dst, wxString entry) diff --git a/src/Prefs.h b/src/Prefs.h index 7afa5ef27..17a6f41f8 100644 --- a/src/Prefs.h +++ b/src/Prefs.h @@ -34,6 +34,7 @@ #include "../include/audacity/ComponentInterface.h" #include // to inherit wxFileConfig +#include // to declare custom event types void InitPreferences(); void FinishPreferences(); @@ -159,4 +160,8 @@ private: const wxString mOldKey; }; +// An event emitted by the application when the Preference dialog commits +// changes +wxDECLARE_EVENT(EVT_PREFS_UPDATE, wxCommandEvent); + #endif diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index cb62197c4..2c05d88f3 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -844,6 +844,9 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event)) } #endif + // PRL: Is the following concern still valid, now that prefs update is + // handled instead by delayed event processing? + // LL: wxMac can't handle recreating the menus when this dialog is still active, // so AudacityProject::UpdatePrefs() or any of the routines it calls must // not cause MenuCreator::RebuildMenuBar() to be executed. @@ -851,6 +854,8 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event)) gAudacityProjects[i]->UpdatePrefs(); } + wxTheApp->AddPendingEvent(wxCommandEvent{ EVT_PREFS_UPDATE }); + WaveformSettings::defaults().LoadPrefs(); SpectrogramSettings::defaults().LoadPrefs();