2013-04-17 21:43:35 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2009-08-31 17:09:50 -06:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2010-08-02 21:20:44 -06:00
|
|
|
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <mutex>
|
2009-08-31 17:09:50 -06:00
|
|
|
#include <queue>
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/font.h>
|
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/translation.h>
|
|
|
|
#include <wx/windowid.h>
|
2009-08-31 17:09:50 -06:00
|
|
|
|
2014-02-22 15:36:30 -07:00
|
|
|
#include "Common/Common.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/LogManager.h"
|
2014-02-22 15:36:30 -07:00
|
|
|
|
|
|
|
class CFrame;
|
|
|
|
class wxBoxSizer;
|
|
|
|
class wxCheckBox;
|
|
|
|
class wxChoice;
|
|
|
|
class wxTextCtrl;
|
|
|
|
class wxTimer;
|
|
|
|
class wxTimerEvent;
|
2014-02-17 03:18:15 -07:00
|
|
|
|
2009-08-31 17:09:50 -06:00
|
|
|
enum
|
|
|
|
{
|
2010-07-27 16:12:19 -06:00
|
|
|
IDM_LOG,
|
|
|
|
IDM_CLEARLOG,
|
|
|
|
IDM_TOGGLEALL,
|
2009-09-02 06:09:51 -06:00
|
|
|
IDM_WRAPLINE,
|
2009-08-31 17:09:50 -06:00
|
|
|
IDTM_UPDATELOG,
|
2009-09-02 06:09:51 -06:00
|
|
|
IDM_FONT,
|
2010-07-27 16:12:19 -06:00
|
|
|
IDM_SUBMITCMD
|
2009-08-31 17:09:50 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
// Uses multiple inheritance - only sane because LogListener is a pure virtual interface.
|
2009-09-07 15:37:27 -06:00
|
|
|
class CLogWindow : public wxPanel, LogListener
|
2009-08-31 17:09:50 -06:00
|
|
|
{
|
|
|
|
public:
|
2009-09-02 06:09:51 -06:00
|
|
|
CLogWindow(CFrame *parent,
|
2009-08-31 20:41:48 -06:00
|
|
|
wxWindowID id = wxID_ANY,
|
2010-07-21 20:05:28 -06:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxTAB_TRAVERSAL,
|
2011-01-04 21:35:46 -07:00
|
|
|
const wxString& name = _("Log")
|
2010-07-21 20:05:28 -06:00
|
|
|
);
|
2009-08-31 17:09:50 -06:00
|
|
|
~CLogWindow();
|
|
|
|
|
|
|
|
void SaveSettings();
|
2014-03-07 17:54:44 -07:00
|
|
|
void Log(LogTypes::LOG_LEVELS, const char *text) override;
|
2009-08-31 17:09:50 -06:00
|
|
|
|
2010-07-27 16:12:19 -06:00
|
|
|
int x, y, winpos;
|
|
|
|
|
2009-08-31 17:09:50 -06:00
|
|
|
private:
|
2009-09-02 06:09:51 -06:00
|
|
|
CFrame *Parent;
|
2009-09-03 16:52:58 -06:00
|
|
|
wxFont DefaultFont, MonoSpaceFont;
|
2010-08-02 21:20:44 -06:00
|
|
|
std::vector<wxFont> LogFont;
|
2009-09-02 06:09:51 -06:00
|
|
|
wxTimer *m_LogTimer;
|
2011-12-30 21:51:17 -07:00
|
|
|
bool m_ignoreLogTimer;
|
2009-09-02 06:09:51 -06:00
|
|
|
LogManager *m_LogManager;
|
2009-08-31 17:09:50 -06:00
|
|
|
std::queue<std::pair<u8, wxString> > msgQueue;
|
2014-02-23 00:38:46 -07:00
|
|
|
bool m_writeFile, m_writeWindow, m_writeDebugger, m_LogAccess;
|
2009-09-03 16:52:58 -06:00
|
|
|
|
|
|
|
// Controls
|
2011-02-18 05:34:24 -07:00
|
|
|
wxBoxSizer *sBottom;
|
2009-09-03 16:52:58 -06:00
|
|
|
wxTextCtrl *m_Log, *m_cmdline;
|
2011-02-18 21:43:51 -07:00
|
|
|
wxChoice *m_FontChoice;
|
|
|
|
wxCheckBox *m_WrapLine;
|
2009-08-31 17:09:50 -06:00
|
|
|
|
2011-03-04 23:11:26 -07:00
|
|
|
std::mutex m_LogSection;
|
2009-08-31 17:09:50 -06:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
2013-07-05 20:39:18 -06:00
|
|
|
wxTextCtrl * CreateTextCtrl(wxPanel* parent, wxWindowID id, long Style);
|
2009-08-31 17:09:50 -06:00
|
|
|
void CreateGUIControls();
|
2011-03-03 15:47:48 -07:00
|
|
|
void PopulateBottom();
|
|
|
|
void UnPopulateBottom();
|
2009-08-31 17:09:50 -06:00
|
|
|
void OnClose(wxCloseEvent& event);
|
2011-02-18 05:34:24 -07:00
|
|
|
void OnFontChange(wxCommandEvent& event);
|
|
|
|
void OnWrapLineCheck(wxCommandEvent& event);
|
2009-08-31 17:09:50 -06:00
|
|
|
void OnClear(wxCommandEvent& event);
|
|
|
|
void OnLogTimer(wxTimerEvent& WXUNUSED(event));
|
|
|
|
void UpdateLog();
|
|
|
|
|
|
|
|
// LogListener
|
|
|
|
const char *getName() const { return "LogWindow"; }
|
|
|
|
};
|