1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-17 16:50:26 +02:00

Fix event types used in PrefsListener singalling...

... which broke at a2f109d
This commit is contained in:
Paul Licameli 2021-08-04 07:39:06 -04:00 committed by Dmitry Vedenko
parent 60f0820916
commit cf09f0ad60

View File

@ -70,15 +70,17 @@ std::unique_ptr<FileConfig> ugPrefs {};
FileConfig *gPrefs = nullptr; FileConfig *gPrefs = nullptr;
int gMenusDirty = 0; int gMenusDirty = 0;
struct MyEvent;
wxDECLARE_EVENT(EVT_PREFS_UPDATE, MyEvent);
struct MyEvent : wxEvent struct MyEvent : wxEvent
{ {
public: public:
explicit MyEvent(int id) : mId{id} {} explicit MyEvent(int id) : wxEvent{ 0, EVT_PREFS_UPDATE }, mId{id} {}
virtual wxEvent *Clone() const override { return new MyEvent{mId}; } virtual wxEvent *Clone() const override { return new MyEvent{mId}; }
int mId; int mId;
}; };
wxDECLARE_EVENT(EVT_PREFS_UPDATE, MyEvent);
wxDEFINE_EVENT(EVT_PREFS_UPDATE, MyEvent); wxDEFINE_EVENT(EVT_PREFS_UPDATE, MyEvent);
struct PrefsListener::Impl : wxEvtHandler struct PrefsListener::Impl : wxEvtHandler
@ -89,20 +91,24 @@ struct PrefsListener::Impl : wxEvtHandler
PrefsListener &mOwner; PrefsListener &mOwner;
}; };
static wxEvtHandler hub; static wxEvtHandler &hub()
{
static wxEvtHandler theHub;
return theHub;
}
void PrefsListener::Broadcast(int id) void PrefsListener::Broadcast(int id)
{ {
BasicUI::CallAfter([id]{ BasicUI::CallAfter([id]{
MyEvent event{ id }; MyEvent event{ id };
hub.ProcessEvent(event); hub().ProcessEvent(event);
}); });
} }
PrefsListener::Impl::Impl( PrefsListener &owner ) PrefsListener::Impl::Impl( PrefsListener &owner )
: mOwner{ owner } : mOwner{ owner }
{ {
hub.Bind(EVT_PREFS_UPDATE, &PrefsListener::Impl::OnEvent, this); hub().Bind(EVT_PREFS_UPDATE, &PrefsListener::Impl::OnEvent, this);
} }
PrefsListener::Impl::~Impl() PrefsListener::Impl::~Impl()