audacia/src/AudacityLogger.h

69 lines
1.4 KiB
C
Raw Normal View History

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__
2013-10-23 18:08:12 +00:00
#include "MemoryX.h"
#include "Prefs.h"
#include <wx/log.h> // to inherit
#include <wx/event.h> // to inherit wxEvtHandler
2018-11-11 21:11:18 +00:00
class wxFrame;
2018-11-11 21:11:18 +00:00
class wxTextCtrl;
2013-10-23 18:08:12 +00:00
class AUDACITY_DLL_API AudacityLogger final : public wxEvtHandler,
public wxLog,
public PrefsListener
{
2013-10-23 18:08:12 +00:00
public:
~AudacityLogger() override;
// 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;
bool ClearLog();
wxString GetLog(int count = 0);
2013-10-23 18:08:12 +00:00
protected:
void Flush() override;
void DoLogText(const wxString & msg) override;
2013-10-23 18:08:12 +00:00
private:
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);
// PrefsListener implementation
void UpdatePrefs() override;
Destroy_ptr<wxFrame> mFrame;
2013-10-23 18:08:12 +00:00
wxTextCtrl *mText;
wxString mBuffer;
bool mUpdated;
};
#endif