MCPcopy Create free account
hub / github.com/audacity/audacity / AddLocation

Method AddLocation

src/prefs/EffectsPrefs.cpp:93–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 }
92
93 void AddLocation(const PluginPath& path, bool setFocus = false)
94 {
95 const auto baseId = BaseRowIdForIndex(mPathCtrls.size());
96
97 auto rowSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
98 wxTextCtrl* text;
99 wxButton* remove;
100 wxButton* browse;
101 rowSizer->Add(
102 text = safenew wxTextCtrl(this, baseId, path),
103 1, wxEXPAND | wxALL, 3
104 );
105 rowSizer->Add(
106 browse = safenew wxButton(this, baseId + 1, _("Browse...")),
107 0, wxALL, 3
108 );
109 rowSizer->Add(
110 remove = safenew wxButton(this, baseId + 2, _("Remove")),
111 0, wxALL, 3
112 );
113 text->Bind(wxEVT_TEXT, [this](wxCommandEvent& evt)
114 {
115 const auto index = IndexForId(evt.GetId());
116 mPaths[index] = evt.GetString();
117 evt.Skip();
118 });
119
120 browse->Bind(wxEVT_BUTTON, &EffectsLocationPanel::OnBrowseClicked, this);
121 remove->Bind(wxEVT_BUTTON, &EffectsLocationPanel::OnRemoveClicked, this);
122 mPathCtrls.push_back(text);
123 mPaths.push_back(path);
124
125 mRows->Add(rowSizer.release(), 0, wxEXPAND);
126
127 mAddNewLocation->MoveAfterInTabOrder(remove);
128
129 if(setFocus)
130 text->SetFocus();
131
132 wxPostEvent(this, wxCommandEvent(EVT_PLUGIN_LOCATIONS_CHANGED));
133 }
134
135 void AddLocations(const PluginPaths& paths)
136 {

Callers

nothing calls this directly

Calls 12

BindMethod · 0.80
GetIdMethod · 0.80
SkipMethod · 0.80
wxTextCtrlClass · 0.70
wxButtonClass · 0.70
wxCommandEventClass · 0.50
sizeMethod · 0.45
AddMethod · 0.45
GetStringMethod · 0.45
push_backMethod · 0.45
releaseMethod · 0.45
SetFocusMethod · 0.45

Tested by

no test coverage detected