mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 08:59:28 +02:00
Add ClearLog macro command and parameters to tracing
This commit is contained in:
parent
da75a7edde
commit
7b8a977f15
@ -124,6 +124,14 @@ bool AudacityLogger::SaveLog(const wxString &fileName) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AudacityLogger::ClearLog()
|
||||||
|
{
|
||||||
|
mBuffer = wxEmptyString;
|
||||||
|
DoLogText(wxT("Log Cleared."));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void AudacityLogger::Show(bool show)
|
void AudacityLogger::Show(bool show)
|
||||||
{
|
{
|
||||||
// Hide the frame if created, otherwise do nothing
|
// Hide the frame if created, otherwise do nothing
|
||||||
@ -256,8 +264,7 @@ void AudacityLogger::OnClose(wxCommandEvent & WXUNUSED(e))
|
|||||||
|
|
||||||
void AudacityLogger::OnClear(wxCommandEvent & WXUNUSED(e))
|
void AudacityLogger::OnClear(wxCommandEvent & WXUNUSED(e))
|
||||||
{
|
{
|
||||||
mBuffer = wxEmptyString;
|
ClearLog();
|
||||||
DoLogText(wxT("Log Cleared."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityLogger::OnSave(wxCommandEvent & WXUNUSED(e))
|
void AudacityLogger::OnSave(wxCommandEvent & WXUNUSED(e))
|
||||||
|
@ -34,6 +34,7 @@ class AudacityLogger final : public wxEvtHandler, public wxLog {
|
|||||||
void Show(bool show = true);
|
void Show(bool show = true);
|
||||||
|
|
||||||
bool SaveLog(const wxString &fileName) const;
|
bool SaveLog(const wxString &fileName) const;
|
||||||
|
bool ClearLog();
|
||||||
|
|
||||||
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
||||||
wxString GetLog();
|
wxString GetLog();
|
||||||
|
@ -757,10 +757,11 @@ bool MacroCommands::ApplyMacro(
|
|||||||
|
|
||||||
if (trace) {
|
if (trace) {
|
||||||
auto after = wxTimeSpan(0, 0, 0, wxGetUTCTimeMillis());
|
auto after = wxTimeSpan(0, 0, 0, wxGetUTCTimeMillis());
|
||||||
wxLogMessage(wxT("Macro line #%ld \"%s\" took %s"),
|
wxLogMessage(wxT("Macro line #%ld took %s : %s:%s"),
|
||||||
i + 1,
|
i + 1,
|
||||||
|
(after - before).Format(wxT("%H:%M:%S.%l")),
|
||||||
command.GET(),
|
command.GET(),
|
||||||
(after - before).Format(wxT("%H:%M:%S.%l")));
|
mParamsMacro[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success || mAbort)
|
if (!success || mAbort)
|
||||||
|
@ -139,7 +139,8 @@ const ComponentInterfaceSymbol SaveLogCommand::Symbol
|
|||||||
|
|
||||||
namespace{ BuiltinCommandsModule::Registration< SaveLogCommand > reg4; }
|
namespace{ BuiltinCommandsModule::Registration< SaveLogCommand > reg4; }
|
||||||
|
|
||||||
bool SaveLogCommand::DefineParams( ShuttleParams & S ){
|
bool SaveLogCommand::DefineParams(ShuttleParams & S)
|
||||||
|
{
|
||||||
S.Define( mFileName, wxT("Filename"), "log.txt" );
|
S.Define( mFileName, wxT("Filename"), "log.txt" );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -160,3 +161,24 @@ bool SaveLogCommand::Apply(const CommandContext &context)
|
|||||||
auto logger = AudacityLogger::Get();
|
auto logger = AudacityLogger::Get();
|
||||||
return logger->SaveLog(mFileName);
|
return logger->SaveLog(mFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ComponentInterfaceSymbol ClearLogCommand::Symbol
|
||||||
|
{ XO("Clear Log") };
|
||||||
|
|
||||||
|
namespace{ BuiltinCommandsModule::Registration< ClearLogCommand > reg5; }
|
||||||
|
|
||||||
|
bool ClearLogCommand::DefineParams(ShuttleParams & S)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ClearLogCommand::PromptUser(wxWindow *parent)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ClearLogCommand::Apply(const CommandContext &context)
|
||||||
|
{
|
||||||
|
auto logger = AudacityLogger::Get();
|
||||||
|
return logger->ClearLog();
|
||||||
|
}
|
||||||
|
@ -102,3 +102,21 @@ public:
|
|||||||
public:
|
public:
|
||||||
wxString mFileName;
|
wxString mFileName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ClearLogCommand : public AudacityCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const ComponentInterfaceSymbol Symbol;
|
||||||
|
|
||||||
|
// ComponentInterface overrides
|
||||||
|
ComponentInterfaceSymbol GetSymbol() override {return Symbol;};
|
||||||
|
TranslatableString GetDescription() override {return XO("Clears the log contents.");};
|
||||||
|
bool DefineParams( ShuttleParams & S ) override;
|
||||||
|
bool PromptUser(wxWindow *parent) override;
|
||||||
|
bool Apply(const CommandContext & context) override;
|
||||||
|
|
||||||
|
// AudacityCommand overrides
|
||||||
|
wxString ManualPage() override {return wxT("Extra_Menu:_Scriptables_II#Clear_log");};
|
||||||
|
public:
|
||||||
|
wxString mFileName;
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user