| 129 | public: |
| 130 | |
| 131 | static std::optional<wxString> PickEffect(AudacityProject& project, wxWindow* parent, const wxString& selectedEffectID) |
| 132 | { |
| 133 | wxMenu menu; |
| 134 | if(!selectedEffectID.empty()) |
| 135 | { |
| 136 | //no need to handle language change since menu creates its own event loop |
| 137 | menu.Append(wxID_REMOVE, _("No Effect")); |
| 138 | menu.AppendSeparator(); |
| 139 | } |
| 140 | |
| 141 | RealtimeEffectsMenuVisitor visitor { menu }; |
| 142 | |
| 143 | Get().Populate(project, visitor); |
| 144 | |
| 145 | int commandId = wxID_NONE; |
| 146 | |
| 147 | #if defined(__WXMSW__) || defined(__WXMAC__) |
| 148 | menu.AppendSeparator(); |
| 149 | menu.Append(wxID_MORE, _("Get more effects...")); |
| 150 | #endif |
| 151 | menu.Bind(wxEVT_MENU, [&](wxCommandEvent evt) { commandId = evt.GetId(); }); |
| 152 | |
| 153 | if(parent->PopupMenu(&menu, parent->GetClientRect().GetLeftBottom()) && commandId != wxID_NONE) |
| 154 | { |
| 155 | if(commandId == wxID_REMOVE) |
| 156 | return wxString {}; |
| 157 | if(commandId == wxID_MORE) |
| 158 | GetEffectsHelper::Get().GetEffects(); |
| 159 | else |
| 160 | return visitor.GetPluginID(commandId).GET(); |
| 161 | } |
| 162 | |
| 163 | return {}; |
| 164 | } |
| 165 | |
| 166 | private: |
| 167 |
nothing calls this directly
no test coverage detected