forked from mia/Aegisub
Only bind wxEVT_COMMAND_MENU_SELECTED once rather than once per command as large numbers of event handlers make wx explode
Originally committed to SVN as r5263.
This commit is contained in:
parent
88be46c657
commit
10c3a2ca16
1 changed files with 3 additions and 5 deletions
|
@ -151,10 +151,7 @@ FrameMain::FrameMain (wxArrayString args)
|
||||||
|
|
||||||
StartupLog("Binding commands");
|
StartupLog("Binding commands");
|
||||||
// XXX: This is a hack for now, it will need to be dealt with when other frames are involved.
|
// XXX: This is a hack for now, it will need to be dealt with when other frames are involved.
|
||||||
int count = cmd::count();
|
Bind(wxEVT_COMMAND_MENU_SELECTED, &FrameMain::cmd_call, this);
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
Bind(wxEVT_COMMAND_MENU_SELECTED, &FrameMain::cmd_call, this, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
// Bind(FrameMain::OnAbout, &FrameMain::cmd_call, this, cmd::id("app/about"));
|
// Bind(FrameMain::OnAbout, &FrameMain::cmd_call, this, cmd::id("app/about"));
|
||||||
|
@ -242,7 +239,8 @@ FrameMain::~FrameMain () {
|
||||||
void FrameMain::cmd_call(wxCommandEvent& event) {
|
void FrameMain::cmd_call(wxCommandEvent& event) {
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
LOG_D("event/select") << "Id: " << id;
|
LOG_D("event/select") << "Id: " << id;
|
||||||
cmd::call(context.get(), id);
|
if (id < cmd::count())
|
||||||
|
cmd::call(context.get(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Initialize toolbar
|
/// @brief Initialize toolbar
|
||||||
|
|
Loading…
Reference in a new issue