1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 00:19:27 +02:00

Limit message output while macro tracing is enabled

This commit is contained in:
Leland Lucius 2020-08-11 09:42:59 -05:00
parent 7b8a977f15
commit b0367049b9

View File

@ -15,6 +15,7 @@ processing. See also MacrosWindow and ApplyMacroDialog.
*//*******************************************************************/
#define wxLOG_COMPONENT "MacroCommands"
#include "Audacity.h" // for USE_* macros
#include "BatchCommands.h"
@ -734,9 +735,17 @@ bool MacroCommands::ApplyMacro(
mAbort = false;
// Is tracing enabled?
bool trace;
gPrefs->Read(wxT("/EnableMacroTracing"), &trace, false);
// If so, then block most other messages while running the macro
wxLogLevel prevLevel = wxLog::GetComponentLevel("");
if (trace) {
wxLog::SetComponentLevel("", wxLOG_FatalError);
wxLog::SetComponentLevel(wxLOG_COMPONENT, wxLOG_Info);
}
size_t i = 0;
for (; i < mCommandMacro.size(); i++) {
const auto &command = mCommandMacro[i];
@ -768,6 +777,11 @@ bool MacroCommands::ApplyMacro(
break;
}
// Restore message level
if (trace) {
wxLog::SetComponentLevel("", prevLevel);
}
res = (i == mCommandMacro.size());
if (!res)
return false;