| 154 | } |
| 155 | |
| 156 | bool AudacityCommand::DoAudacityCommand( |
| 157 | const CommandContext& context, bool shouldPrompt /* = true */) |
| 158 | { |
| 159 | // Note: Init may read parameters from preferences |
| 160 | if (!Init()) |
| 161 | { |
| 162 | return false; |
| 163 | } |
| 164 | |
| 165 | // Prompting will be bypassed when applying a command that has already |
| 166 | // been configured, e.g. repeating the last effect on a different selection. |
| 167 | // Prompting may call AudacityCommand::Preview |
| 168 | if (shouldPrompt && /*IsInteractive() && */!PromptUser(context.project)) |
| 169 | { |
| 170 | return false; |
| 171 | } |
| 172 | |
| 173 | auto cleanup = finally( [&] { |
| 174 | End(); |
| 175 | } ); |
| 176 | |
| 177 | bool returnVal = true; |
| 178 | bool skipFlag = CheckWhetherSkipAudacityCommand(); |
| 179 | if (skipFlag == false) |
| 180 | { |
| 181 | auto name = GetName(); |
| 182 | ProgressDialog progress{ |
| 183 | name, |
| 184 | XO("Applying %s...").Format( name ), |
| 185 | pdlgHideStopButton |
| 186 | }; |
| 187 | auto vr = valueRestorer( mProgress, &progress ); |
| 188 | |
| 189 | returnVal = Apply(context); |
| 190 | } |
| 191 | return returnVal; |
| 192 | } |
| 193 | |
| 194 | // This is used from Macros. |
| 195 | bool AudacityCommand::PromptUser(AudacityProject& project) |
nothing calls this directly
no test coverage detected