| 42 | } |
| 43 | |
| 44 | AudacityCommand* |
| 45 | EffectAndCommandPluginManager::GetAudacityCommand(const PluginID& ID) |
| 46 | { |
| 47 | // Must have a "valid" ID |
| 48 | if (ID.empty()) |
| 49 | { |
| 50 | return NULL; |
| 51 | } |
| 52 | |
| 53 | if (mCommands.find(ID) == mCommands.end()) |
| 54 | { |
| 55 | // This will instantiate the command if it hasn't already been done |
| 56 | auto command = |
| 57 | dynamic_cast<AudacityCommand*>(PluginManager::Get().Load(ID)); |
| 58 | if (command) |
| 59 | { |
| 60 | command->Init(); |
| 61 | mCommands[ID] = command; |
| 62 | return command; |
| 63 | } |
| 64 | |
| 65 | BasicUI::ShowMessageBox( |
| 66 | XO("Attempting to initialize the following command failed:\n\n%s\n\nMore information may be available in 'Help > Diagnostics > Show Log'") |
| 67 | .Format(PluginManager::Get().GetName(ID)), |
| 68 | BasicUI::MessageBoxOptions {}.Caption( |
| 69 | XO("Command failed to initialize"))); |
| 70 | |
| 71 | return NULL; |
| 72 | } |
| 73 | |
| 74 | return mCommands[ID]; |
| 75 | } |
| 76 | |
| 77 | ManualPageID EffectAndCommandPluginManager::GetCommandUrl(const PluginID& ID) |
| 78 | { |