Audacity 3.2.0
LibraryPrefs.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 LibraryPrefs.cpp
6
7 Joshua Haberman
8 Dominic Mazzoni
9 James Crook
10
11*******************************************************************//*******************************************************************/
18
19
20#include "LibraryPrefs.h"
21
22#include "ShuttleGui.h"
23
24#include <wx/defs.h>
25#include <wx/stattext.h>
26
28static const auto PathStart = wxT("LibraryPreferences");
29
31{
32 static Registry::GroupItem<Traits> registry{ PathStart };
33 return registry;
34}
35
37 const Identifier &id, Populator populator)
38 : SingleItem{ id }
39 , mPopulator{ move(populator) }
40{}
41
43 const Identifier &id, Populator populator,
44 const Registry::Placement &placement )
45 : RegisteredItem{
46 std::make_unique< PopulatorItem >( id, move(populator) ),
47 placement
48 }
49{}
50
52{
53 return !PopulatorItem::Registry().empty();
54}
55
56LibraryPrefs::LibraryPrefs(wxWindow * parent, wxWindowID winid)
57/* i18n-hint: refers to optional plug-in software libraries */
58: PrefsPanel(parent, winid, XO("Libraries"))
59{
60 Populate();
61}
62
64{
65}
66
68{
70}
71
73{
74 return XO("Preferences for Library");
75}
76
78{
79 return "Libraries_Preferences";
80}
81
84{
85 //------------------------- Main section --------------------
86 // Now construct the GUI itself.
87 // Use 'eIsCreatingFromPrefs' so that the GUI is
88 // initialised with values from gPrefs.
91 // ----------------------- End of main section --------------
92}
93
100{
101 using namespace Registry;
103 PathStart,
104 { {wxT(""), wxT("MP3,FFmpeg") } },
105 };
106
107 S.SetBorder(2);
108 S.StartScroller();
109
110 // visit the registry to collect the plug-ins properly
111 // sorted
114 [&](const PopulatorItem &item, auto &) { item.mPopulator(S); },
115 &top, &PopulatorItem::Registry());
116
117 S.EndScroller();
118}
119
121{
124
125 return true;
126}
127
128namespace{
130 [](wxWindow *parent, wxWindowID winid, AudacityProject *) -> PrefsPanel *
131 {
132 wxASSERT(parent); // to justify safenew
134 return safenew LibraryPrefs(parent, winid);
135 else
136 return nullptr;
137 },
138 false,
139 // Register with an explicit ordering hint because this one might be
140 // absent
141 { "", { Registry::OrderingHint::Before, "Directories" } }
142};
143}
144
146{
148}
wxT("CloseDown"))
XO("Cut/Copy/Paste")
static const auto PathStart
#define LIBRARY_PREFS_PLUGIN_SYMBOL
Definition: LibraryPrefs.h:25
#define safenew
Definition: MemoryX.h:10
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
#define S(N)
Definition: ToChars.cpp:64
int id
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
A PrefsPanel used to select manage external libraries like the MP3 and FFmpeg encoding libraries.
Definition: LibraryPrefs.h:28
bool Commit() override
ComponentInterfaceSymbol GetSymbol() const override
std::function< void(ShuttleGui &) > Populator
Type of function that adds to the Library preference page.
Definition: LibraryPrefs.h:33
TranslatableString GetDescription() const override
void Populate()
Creates the dialog and its contents.
void PopulateOrExchange(ShuttleGui &S) override
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
LibraryPrefs(wxWindow *parent, wxWindowID winid)
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Definition: PrefsPanel.h:51
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.
void Visit(const Visitors &visitors, const GroupItem< RegistryTraits > *pTopItem, const GroupItem< RegistryTraits > *pRegistry={}, typename RegistryTraits::ComputedItemContextType &computedItemContext=RegistryTraits::ComputedItemContextType::Instance)
Definition: Registry.h:609
PrefsPanel::Registration sAttachment
STL namespace.
PopulatorItem(const Identifier &id, Populator populator)
static Registry::GroupItem< Traits > & Registry()
RegisteredControls(const Identifier &id, Populator populator, const Registry::Placement &placement={ wxEmptyString, {} })