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

Method PromptUser

src/EffectAndCommandPluginManager.cpp:253–287  ·  view source on GitHub ↗

Shows an effect or command dialog so the user can specify settings for later ! It is used when defining a macro. It does not invoke the effect or command. */

Source from the content-addressed store, hash-verified

251 It is used when defining a macro. It does not invoke the effect or command.
252 */
253bool EffectAndCommandPluginManager::PromptUser(
254 const PluginID& ID, AudacityProject& project, DialogInvoker dialogInvoker)
255{
256 bool result = false;
257 if (auto effect = dynamic_cast<Effect*>(EffectManager::Get().GetEffect(ID)))
258 {
259 auto empty = TrackList::Create(nullptr);
260 auto pEffectBase = dynamic_cast<EffectBase*>(effect);
261 if (pEffectBase)
262 // This allows effects to call Init() safely
263 pEffectBase->SetTracks(empty.get());
264 Finally Do([&] {
265 // reverse the side-effect
266 if (pEffectBase)
267 pEffectBase->SetTracks(nullptr);
268 });
269
270 std::shared_ptr<EffectInstance> pInstance;
271 //! Show the effect dialog, only so that the user can choose settings,
272 //! for instance to define a macro.
273 if (const auto pSettings = EffectManager::Get().GetDefaultSettings(ID))
274 result = dialogInvoker(*effect, *pSettings, pInstance);
275 return result;
276 }
277
278 AudacityCommand* command = GetAudacityCommand(ID);
279
280 if (command)
281 {
282 result = command->PromptUser(project);
283 return result;
284 }
285
286 return result;
287}

Callers

nothing calls this directly

Calls 6

GetFunction · 0.85
CreateFunction · 0.85
SetTracksMethod · 0.80
GetDefaultSettingsMethod · 0.80
GetEffectMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected