Fix MRU menus (#48)

Broken in 9bbfdddde0. I don't understand
why the author made such a change, so I left their solution with #ifdef
guard.
This commit is contained in:
Marcin Kurczewski 2018-05-28 21:24:23 +02:00 committed by Thomas Goyne
parent a32bf7acdc
commit a4bde47c5c

View file

@ -419,7 +419,7 @@ class AutomationMenu final : public wxMenu {
WorkItem *FindOrMakeSubitem(std::string const &name) { WorkItem *FindOrMakeSubitem(std::string const &name) {
auto sub = std::find_if(subitems.begin(), subitems.end(), [&](WorkItem const &item) { return item.displayname == name; }); auto sub = std::find_if(subitems.begin(), subitems.end(), [&](WorkItem const &item) { return item.displayname == name; });
if (sub != subitems.end()) return &*sub; if (sub != subitems.end()) return &*sub;
subitems.emplace_back(name); subitems.emplace_back(name);
return &subitems.back(); return &subitems.back();
} }
@ -529,8 +529,13 @@ namespace menu {
} }
} }
#ifdef __WXMAC__
menu->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm); menu->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm);
menu->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm); menu->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm);
#else
window->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm);
window->Bind(wxEVT_MENU, &CommandManager::OnMenuClick, &menu->cm);
#endif
#ifdef __WXMAC__ #ifdef __WXMAC__
bind_events(menu.get()); bind_events(menu.get());