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

Method OnItemSelected

src/BatchCommandDialog.cpp:176–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void MacroCommandDialog::OnItemSelected(wxListEvent &event)
177{
178 const auto &command = mCatalog[ event.GetIndex() ];
179
180 EffectManager & em = EffectManager::Get();
181 PluginID ID =
182 PluginManager::Get().GetByCommandIdentifier(command.name.Internal());
183
184 // If ID is empty, then the effect wasn't found, in which case, the user must have
185 // selected one of the "special" commands.
186 mEditParams->Enable(!ID.empty());
187 mUsePreset->Enable(em.HasPresets(ID));
188
189 auto value = command.name.StrippedTranslation();
190 if ( value == mCommand->GetValue() )
191 // This uses the assumption of uniqueness of translated names!
192 return;
193
194 mCommand->SetValue(value);
195 mInternalCommandName = command.name.Internal();
196
197 wxString params = MacroCommands::GetCurrentParamsFor(mInternalCommandName);
198 if (params.empty())
199 {
200 params = em.GetDefaultPreset(ID);
201 }
202
203 // using GET to expose a CommandID to the user!
204 // Cryptic command and category.
205 // Later we can put help information there, perhaps.
206 // Macro command details are one place that we do expose Identifier
207 // to (more sophisticated) users
208 mDetails->SetValue(
209 mInternalCommandName.GET() + "\r\n" + command.category.Translation() );
210 mParameters->SetValue(params);
211}
212
213void MacroCommandDialog::OnEditParams(wxCommandEvent & WXUNUSED(event))
214{

Callers

nothing calls this directly

Calls 10

GetFunction · 0.85
GetIndexMethod · 0.80
HasPresetsMethod · 0.80
StrippedTranslationMethod · 0.80
GetDefaultPresetMethod · 0.80
TranslationMethod · 0.80
EnableMethod · 0.45
emptyMethod · 0.45
GetValueMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected