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

Method DoAudacityCommand

src/commands/AudacityCommand.cpp:156–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156bool 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.
195bool AudacityCommand::PromptUser(AudacityProject& project)

Callers

nothing calls this directly

Calls 7

InitClass · 0.85
PromptUserFunction · 0.85
finallyFunction · 0.85
valueRestorerFunction · 0.85
EndFunction · 0.70
ApplyFunction · 0.70

Tested by

no test coverage detected