2013-10-23 18:08:12 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
AudacityLogger.h
|
|
|
|
|
|
|
|
Dominic Mazzoni
|
|
|
|
|
|
|
|
This is the main source file for Audacity which handles
|
|
|
|
initialization and termination by subclassing wxApp.
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_LOGGER__
|
|
|
|
#define __AUDACITY_LOGGER__
|
|
|
|
|
2021-05-09 15:16:56 +00:00
|
|
|
|
2013-10-23 18:08:12 +00:00
|
|
|
|
2020-06-19 19:43:09 +00:00
|
|
|
|
2018-11-11 17:27:44 +00:00
|
|
|
|
2016-08-13 02:45:20 +00:00
|
|
|
#include "MemoryX.h"
|
2021-02-14 07:25:52 +00:00
|
|
|
#include "Prefs.h"
|
2018-11-14 20:23:25 +00:00
|
|
|
#include <wx/log.h> // to inherit
|
2019-03-28 07:29:15 +00:00
|
|
|
#include <wx/event.h> // to inherit wxEvtHandler
|
2018-11-11 21:11:18 +00:00
|
|
|
|
2019-03-28 07:29:15 +00:00
|
|
|
class wxFrame;
|
2018-11-11 21:11:18 +00:00
|
|
|
class wxTextCtrl;
|
2013-10-23 18:08:12 +00:00
|
|
|
|
2020-09-28 12:50:18 +00:00
|
|
|
class AUDACITY_DLL_API AudacityLogger final : public wxEvtHandler,
|
2021-02-14 07:25:52 +00:00
|
|
|
public wxLog,
|
|
|
|
public PrefsListener
|
|
|
|
{
|
2013-10-23 18:08:12 +00:00
|
|
|
public:
|
2020-09-29 12:54:22 +00:00
|
|
|
|
|
|
|
~AudacityLogger() override;
|
2019-04-26 14:20:49 +00:00
|
|
|
|
|
|
|
// Get the singleton instance or null
|
|
|
|
static AudacityLogger *Get();
|
2013-10-23 18:08:12 +00:00
|
|
|
|
|
|
|
void Show(bool show = true);
|
|
|
|
|
2020-08-11 06:48:32 +00:00
|
|
|
bool SaveLog(const wxString &fileName) const;
|
2020-08-11 14:06:15 +00:00
|
|
|
bool ClearLog();
|
2020-08-11 05:14:56 +00:00
|
|
|
|
2021-04-01 06:13:15 +00:00
|
|
|
wxString GetLog(int count = 0);
|
2015-04-18 10:06:28 +00:00
|
|
|
|
2013-10-23 18:08:12 +00:00
|
|
|
protected:
|
2016-02-24 06:06:47 +00:00
|
|
|
void Flush() override;
|
|
|
|
void DoLogText(const wxString & msg) override;
|
2013-10-23 18:08:12 +00:00
|
|
|
|
|
|
|
private:
|
2019-04-26 14:20:49 +00:00
|
|
|
AudacityLogger();
|
|
|
|
|
2013-10-23 18:08:12 +00:00
|
|
|
void OnCloseWindow(wxCloseEvent & e);
|
|
|
|
void OnClose(wxCommandEvent & e);
|
|
|
|
void OnClear(wxCommandEvent & e);
|
|
|
|
void OnSave(wxCommandEvent & e);
|
|
|
|
|
2021-02-14 07:25:52 +00:00
|
|
|
// PrefsListener implementation
|
|
|
|
void UpdatePrefs() override;
|
|
|
|
|
2016-08-13 02:45:20 +00:00
|
|
|
Destroy_ptr<wxFrame> mFrame;
|
2013-10-23 18:08:12 +00:00
|
|
|
wxTextCtrl *mText;
|
|
|
|
wxString mBuffer;
|
|
|
|
bool mUpdated;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|