1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Emit an event when the preferences dialog closes

This commit is contained in:
Paul Licameli 2018-02-17 15:05:39 -05:00
parent a78ad42399
commit cc635e0498
3 changed files with 12 additions and 0 deletions

View File

@ -69,6 +69,8 @@ std::unique_ptr<AudacityPrefs> 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)

View File

@ -34,6 +34,7 @@
#include "../include/audacity/ComponentInterface.h"
#include <wx/fileconf.h> // to inherit wxFileConfig
#include <wx/event.h> // 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

View File

@ -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();