13#include <unordered_map>
30#include <wx/filename.h>
31#include <wx/wfstream.h>
79 wxDefaultPosition, wxDefaultSize,
80 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
100 static const std::unordered_map<TranslatableString, TranslatableString> extraProviders = {
101 {
XO(
"Builtin Effects"),
XO(
"Native Audacity") }
105 pluginProviderNames.push_back(
XO(
"All"));
109 for(
auto& [
name, provider] : moduleManager.Providers())
112 auto familySymbol = provider->GetOptionalFamilySymbol();
113 if(!familySymbol.empty())
114 pluginProviderNames.push_back(familySymbol.Msgid());
117 auto it = extraProviders.find(provider->GetSymbol().Msgid());
118 if(it != extraProviders.end())
119 pluginProviderNames.push_back(it->second);
126 S.Prop(1).StartPanel(wxEXPAND);
128 S.StartVerticalLay(
true);
131 S.StartHorizontalLay(wxEXPAND, 0);
134 S.StartHorizontalLay(wxALIGN_LEFT, 0);
140 std::back_inserter(categoryFilterNames),
141 [](
const auto& p) { return p.second; });
142 const auto selectedCategory =
148 [category =
mPluginsModel->GetFilterCategory()](
const auto& p) {
149 return p.first == category;
155 ->SetMinSize(wxSize(120, -1));
158 .AddChoice(
XXO(
"&Type:"), pluginProviderNames, 0)
159 ->SetMinSize(wxSize(120, -1));
162 .AddChoice(
XXO(
"C&ategory:"), categoryFilterNames, selectedCategory)
163 ->SetMinSize(wxSize(120, -1));
165 S.EndHorizontalLay();
167 S.StartHorizontalLay(wxALIGN_CENTRE, 0);
169 const auto searchCtrl =
S
171 .AddTextBox(
XXO(
"Searc&h:"), wxEmptyString, 0);
172 if(searchCtrl !=
nullptr)
175 S.EndHorizontalLay();
178 S.EndHorizontalLay();
182 S.GetParent(),
ID_List, wxDefaultPosition, wxDefaultSize,
183 wxDV_MULTIPLE | wxDV_HORIZ_RULES | wxDV_VERT_RULES,
202 S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, 0);
206#if defined(__WXMSW__) || defined(__WXMAC__)
211 S.Id(wxID_OK).AddButton(
XXO(
"&OK"));
212 S.Id(wxID_CANCEL).AddButton(
XXO(
"&Cancel"));
215 S.EndHorizontalLay();
222 wxRect r = wxGetClientDisplayRect();
227 wxSize sz = GetSize();
228 sz.SetWidth(wxMin(sz.GetWidth(), r.GetWidth()));
229 sz.SetHeight(wxMin(sz.GetHeight(), r.GetHeight()));
254 mPluginsModel->SetFilterExpr(evt.GetString().Trim().Trim(
true));
259 const auto index = evt.GetInt();
262 index == 2 ? 1 : (index == 1 ? 0 : -1)
268 const auto index = evt.GetInt();
275 const auto index = evt.GetInt();
282 wxTheApp->CallAfter([self = wxWeakRef(
this)] {
283 std::set<PluginPath> disabledPlugins;
284 std::vector<wxString> failedPlugins;
289 for (
auto& plug : pm.AllPlugins())
295 if (!plug.IsEnabled())
296 disabledPlugins.insert(plug.GetPath());
304 self->mPluginList->AssociateModel(
nullptr);
306 pm.ClearEffectPlugins();
309 if (!newPlugins.empty())
314 failedPlugins =
reg.GetFailedPluginsPaths();
318 for (
auto& plug : pm.AllPlugins())
324 const auto& path = plug.GetPath();
325 if (disabledPlugins.find(path) != disabledPlugins.end())
326 plug.SetEnabled(
false);
330 pm.NotifyPluginsChanged();
335 if (!failedPlugins.empty())
357 std::unique_ptr<ProgressDialog> dialog;
359 auto updateProgress = [&](
int num,
int denom,
const wxString& msg)
361 last3.insert(last3.begin(), msg);
366 dialog = std::make_unique<ProgressDialog>(
371 dialog->CenterOnParent();
373 result = dialog->Update(
395 EndModal(wxID_CANCEL);
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
XXO("&Cut/Copy/Paste Toolbar")
static const std::vector< std::pair< int, TranslatableString > > CategoryFilterValues
static const TranslatableStrings ShowFilterValues
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
static ModuleManager & Get()
!brief A plugins list model that can be attached to wxDataViewCtrl
static PluginID GetID(const PluginProvider *provider)
std::map< wxString, std::vector< wxString > > CheckPluginUpdates()
Ensures that all currently registered plugins still exist and scans for new ones.
static PluginManager & Get()
void PopulateOrExchange(ShuttleGui &S)
Defines the dialog and does data exchange with it.
void OnStateFilterValueChanged(wxCommandEvent &evt)
wxArrayString mPluginProviderIDs
void OnCategoryFilterValueChanged(wxCommandEvent &evt)
wxObjectDataPtr< PluginDataModel > mPluginsModel
void OnTypeFilterValueChanged(wxCommandEvent &evt)
void OnGetMoreEffects(wxCommandEvent &evt)
void OnCancel(wxCommandEvent &evt)
PluginRegistrationDialog(wxWindow *parent, int defaultEffectCategory=-1)
void OnRescan(wxCommandEvent &evt)
void OnOK(wxCommandEvent &evt)
wxDataViewCtrl * mPluginList
void OnSearchTextChanged(wxCommandEvent &evt)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Holds a msgid for the translation catalog; may also bind format arguments.
bool OpenInDefaultBrowser(const wxString &url)
Open an URL in default browser.
static constexpr auto Margin
BuiltinCommandsModule::Registration< CompareAudioCommand > reg