wxMenu* EditorBase::CreateContextSubMenu(long id) // For context menus { wxMenu* menu = nullptr; if (id == idSwitchTo) { menu = new wxMenu; m_SwitchTo.clear(); for (int i = 0; i < EditorMaxSwitchTo && i < Manager::Get()->GetEditorManager()->GetEditorsCount(); ++i) { EditorBase* other = Manager::Get()->GetEditorManager()->GetEditor(i); if (!other || other == this) continue; id = idSwitchFile1+i; m_SwitchTo[id] = other; menu->Append(id, (other->GetModified() ? wxT("*") : wxEmptyString) + other->GetShortName()); } if (!menu->GetMenuItemCount()) { delete menu; menu = nullptr; } } return menu; }