13#include <unordered_map>
29#include <wx/filename.h>
30#include <wx/wfstream.h>
76 wxDefaultPosition, wxDefaultSize,
77 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
95 constexpr int Margin = 12;
97 static const std::unordered_map<TranslatableString, TranslatableString> extraProviders = {
98 {
XO(
"Builtin Effects"),
XO(
"Native Audacity") }
102 pluginProviderNames.push_back(
XO(
"All"));
106 for(
auto& [
name, provider] : moduleManager.Providers())
109 auto familySymbol = provider->GetOptionalFamilySymbol();
110 if(!familySymbol.empty())
111 pluginProviderNames.push_back(familySymbol.Msgid());
114 auto it = extraProviders.find(provider->GetSymbol().Msgid());
115 if(it != extraProviders.end())
116 pluginProviderNames.push_back(it->second);
123 S.Prop(1).StartPanel(wxEXPAND);
125 S.StartVerticalLay(
true);
127 S.AddSpace(1, Margin);
128 S.StartHorizontalLay(wxEXPAND, 0);
130 S.AddSpace(Margin, 1);
131 S.StartHorizontalLay(wxALIGN_LEFT, 0);
137 std::back_inserter(categoryFilterNames),
138 [](
const auto& p) { return p.second; });
139 const auto selectedCategory =
145 [category =
mPluginsModel->GetFilterCategory()](
const auto& p) {
146 return p.first == category;
152 ->SetMinSize(wxSize(120, -1));
155 .AddChoice(
XXO(
"&Type:"), pluginProviderNames, 0)
156 ->SetMinSize(wxSize(120, -1));
159 .AddChoice(
XXO(
"C&ategory:"), categoryFilterNames, selectedCategory)
160 ->SetMinSize(wxSize(120, -1));
162 S.EndHorizontalLay();
164 S.StartHorizontalLay(wxALIGN_CENTRE, 0);
166 const auto searchCtrl =
S
168 .AddTextBox(
XXO(
"Searc&h:"), wxEmptyString, 0);
169 if(searchCtrl !=
nullptr)
172 S.EndHorizontalLay();
173 S.AddSpace(Margin, 1);
175 S.EndHorizontalLay();
179 S.GetParent(),
ID_List, wxDefaultPosition, wxDefaultSize,
180 wxSUNKEN_BORDER | wxDV_MULTIPLE | wxDV_HORIZ_RULES | wxDV_VERT_RULES,
197 S.AddSpace(1, Margin);
199 S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, 0);
201 S.AddSpace(Margin, 1);
205 S.Id(wxID_OK).AddButton(
XXO(
"&OK"));
206 S.Id(wxID_CANCEL).AddButton(
XXO(
"&Cancel"));
207 S.AddSpace(Margin, 1);
209 S.EndHorizontalLay();
210 S.AddSpace(1, Margin);
216 wxRect r = wxGetClientDisplayRect();
221 wxSize sz = GetSize();
222 sz.SetWidth(wxMin(sz.GetWidth(), r.GetWidth()));
223 sz.SetHeight(wxMin(sz.GetHeight(), r.GetHeight()));
248 mPluginsModel->SetFilterExpr(evt.GetString().Trim().Trim(
true));
253 const auto index = evt.GetInt();
256 index == 2 ? 1 : (index == 1 ? 0 : -1)
262 const auto index = evt.GetInt();
269 const auto index = evt.GetInt();
276 wxTheApp->CallAfter([self = wxWeakRef(
this)] {
277 std::set<PluginPath> disabledPlugins;
278 std::vector<wxString> failedPlugins;
283 for (
auto& plug : pm.AllPlugins())
289 if (!plug.IsEnabled())
290 disabledPlugins.insert(plug.GetPath());
298 self->mPluginList->AssociateModel(
nullptr);
300 pm.ClearEffectPlugins();
303 if (!newPlugins.empty())
308 failedPlugins =
reg.GetFailedPluginsPaths();
312 for (
auto& plug : pm.AllPlugins())
318 const auto& path = plug.GetPath();
319 if (disabledPlugins.find(path) != disabledPlugins.end())
320 plug.SetEnabled(
false);
324 pm.NotifyPluginsChanged();
329 if (!failedPlugins.empty())
346 std::unique_ptr<ProgressDialog> dialog;
348 auto updateProgress = [&](
int num,
int denom,
const wxString& msg)
350 last3.insert(last3.begin(), msg);
355 dialog = std::make_unique<ProgressDialog>(
360 dialog->CenterOnParent();
362 result = dialog->Update(
384 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
const TranslatableString name
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
std::map< wxString, std::vector< wxString > > CheckPluginUpdates()
Ensures that all currently registered plugins still exist and scans for new ones.
static PluginID GetID(PluginProvider *provider)
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 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.
BuiltinCommandsModule::Registration< CompareAudioCommand > reg