2009-08-31 23:09:50 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#ifndef LOGWINDOW_H_
|
|
|
|
#define LOGWINDOW_H_
|
2010-08-03 03:20:44 +00:00
|
|
|
|
2009-08-31 23:09:50 +00:00
|
|
|
#include "LogManager.h"
|
2009-09-02 12:09:51 +00:00
|
|
|
#include "Frame.h"
|
2009-08-31 23:09:50 +00:00
|
|
|
#include "Thread.h"
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2010-07-27 22:12:19 +00:00
|
|
|
IDM_LOG,
|
|
|
|
IDM_CLEARLOG,
|
|
|
|
IDM_LOGCHECKS,
|
|
|
|
IDM_OPTIONS,
|
|
|
|
IDM_TOGGLEALL,
|
2009-09-02 12:09:51 +00:00
|
|
|
IDM_WRAPLINE,
|
2010-07-27 22:12:19 +00:00
|
|
|
IDM_WRITEFILE,
|
|
|
|
IDM_WRITECONSOLE,
|
|
|
|
IDM_WRITEWINDOW,
|
2009-08-31 23:09:50 +00:00
|
|
|
IDTM_UPDATELOG,
|
|
|
|
IDM_VERBOSITY,
|
2009-09-02 12:09:51 +00:00
|
|
|
IDM_FONT,
|
2010-07-27 22:12:19 +00:00
|
|
|
IDM_SUBMITCMD
|
2009-08-31 23:09:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class wxTextCtrl;
|
|
|
|
class wxCheckListBox;
|
|
|
|
class wxString;
|
2009-09-02 12:09:51 +00:00
|
|
|
class CFrame;
|
2009-08-31 23:09:50 +00:00
|
|
|
|
|
|
|
// Uses multiple inheritance - only sane because LogListener is a pure virtual interface.
|
2009-09-07 21:37:27 +00:00
|
|
|
class CLogWindow : public wxPanel, LogListener
|
2009-08-31 23:09:50 +00:00
|
|
|
{
|
|
|
|
public:
|
2009-09-02 12:09:51 +00:00
|
|
|
CLogWindow(CFrame *parent,
|
2009-09-01 02:41:48 +00:00
|
|
|
wxWindowID id = wxID_ANY,
|
2010-07-22 02:05:28 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxTAB_TRAVERSAL,
|
2011-01-05 04:35:46 +00:00
|
|
|
const wxString& name = _("Log")
|
2010-07-22 02:05:28 +00:00
|
|
|
);
|
2009-08-31 23:09:50 +00:00
|
|
|
~CLogWindow();
|
|
|
|
|
|
|
|
void SaveSettings();
|
|
|
|
void LoadSettings();
|
2010-12-14 17:52:01 +00:00
|
|
|
void Log(LogTypes::LOG_LEVELS, const char *text);
|
2009-08-31 23:09:50 +00:00
|
|
|
|
2010-07-27 22:12:19 +00:00
|
|
|
int x, y, winpos;
|
|
|
|
|
2009-08-31 23:09:50 +00:00
|
|
|
private:
|
2009-09-02 12:09:51 +00:00
|
|
|
CFrame *Parent;
|
2009-09-03 22:52:58 +00:00
|
|
|
wxFont DefaultFont, MonoSpaceFont;
|
2010-08-03 03:20:44 +00:00
|
|
|
std::vector<wxFont> LogFont;
|
2009-09-02 12:09:51 +00:00
|
|
|
wxTimer *m_LogTimer;
|
2009-08-31 23:09:50 +00:00
|
|
|
FileLogListener *m_fileLog;
|
|
|
|
ConsoleListener *m_console;
|
2009-09-02 12:09:51 +00:00
|
|
|
LogManager *m_LogManager;
|
2009-08-31 23:09:50 +00:00
|
|
|
std::queue<std::pair<u8, wxString> > msgQueue;
|
2009-09-03 22:52:58 +00:00
|
|
|
bool m_writeFile, m_writeConsole, m_writeWindow, m_LogAccess;
|
|
|
|
|
|
|
|
// Controls
|
|
|
|
wxBoxSizer *sUber, *sLeft, *sRight, *sRightBottom;
|
|
|
|
wxTextCtrl *m_Log, *m_cmdline;
|
|
|
|
wxChoice * m_FontChoice;
|
|
|
|
wxCheckBox *m_writeFileCB, *m_writeConsoleCB, *m_writeWindowCB;
|
|
|
|
wxCheckListBox* m_checks;
|
|
|
|
wxRadioBox *m_verbosity;
|
2009-08-31 23:09:50 +00:00
|
|
|
|
2009-09-02 12:09:51 +00:00
|
|
|
Common::CriticalSection m_LogSection;
|
2009-08-31 23:09:50 +00:00
|
|
|
|
2011-01-27 23:59:12 +00:00
|
|
|
wxCSConv m_SJISConv;
|
2009-12-29 12:00:48 +00:00
|
|
|
|
2009-08-31 23:09:50 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
2009-09-07 21:37:27 +00:00
|
|
|
wxTextCtrl * CreateTextCtrl(wxPanel* parent, wxWindowID id = wxID_ANY, long Style = NULL);
|
2009-08-31 23:09:50 +00:00
|
|
|
void CreateGUIControls();
|
2009-09-02 12:09:51 +00:00
|
|
|
void PopulateRight(); void UnPopulateRight();
|
2009-08-31 23:09:50 +00:00
|
|
|
void OnClose(wxCloseEvent& event);
|
2010-07-31 14:14:01 +00:00
|
|
|
void OnSize(wxSizeEvent& event);
|
2009-08-31 23:09:50 +00:00
|
|
|
void OnSubmit(wxCommandEvent& event);
|
|
|
|
void OnOptionsCheck(wxCommandEvent& event);
|
|
|
|
void OnLogCheck(wxCommandEvent& event);
|
|
|
|
void OnClear(wxCommandEvent& event);
|
|
|
|
void OnToggleAll(wxCommandEvent& event);
|
|
|
|
void OnLogTimer(wxTimerEvent& WXUNUSED(event));
|
|
|
|
|
|
|
|
void ToggleLog(int _logType, bool enable);
|
|
|
|
void UpdateChecks();
|
|
|
|
void UpdateLog();
|
|
|
|
|
|
|
|
// LogListener
|
|
|
|
const char *getName() const { return "LogWindow"; }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /*LOGWINDOW_H_*/
|