mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-02 02:52:30 +02:00
logwindow: cmdline now gets enter key event, no need for the submit button. some code which is supposed to color the textctrl, but it mysteriously doesn't. fun
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2682 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c5bb835154
commit
5402fa67af
@ -26,10 +26,11 @@
|
||||
#include "LogWindow.h"
|
||||
#include "Console.h"
|
||||
|
||||
// milliseconds between msgQueue flushes to wxTextCtrl
|
||||
#define UPDATETIME 100
|
||||
|
||||
BEGIN_EVENT_TABLE(CLogWindow, wxDialog)
|
||||
EVT_BUTTON(IDM_SUBMITCMD, CLogWindow::OnSubmit)
|
||||
EVT_TEXT_ENTER(IDM_SUBMITCMD, CLogWindow::OnSubmit)
|
||||
EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear)
|
||||
EVT_BUTTON(IDM_TOGGLEALL, CLogWindow::OnToggleAll)
|
||||
EVT_RADIOBOX(IDM_VERBOSITY, CLogWindow::OnOptionsCheck)
|
||||
@ -90,14 +91,14 @@ void CLogWindow::CreateGUIControls()
|
||||
|
||||
// Right side: Log viewer and submit row
|
||||
m_log = new wxTextCtrl(this, IDM_LOG, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
|
||||
wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
|
||||
//m_log->SetFont(DebuggerFont);
|
||||
|
||||
m_cmdline = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition);
|
||||
m_cmdline = new wxTextCtrl(this, IDM_SUBMITCMD, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
|
||||
//m_cmdline->SetFont(DebuggerFont);
|
||||
|
||||
sRightBottom->Add(m_cmdline, 1, wxEXPAND);
|
||||
sRightBottom->Add(new wxButton(this, IDM_SUBMITCMD, wxT("Submit"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT));
|
||||
sRight->Add(m_log, 1, wxEXPAND | wxSHRINK);
|
||||
sRight->Add(sRightBottom, 0, wxEXPAND);
|
||||
|
||||
@ -340,7 +341,29 @@ void CLogWindow::UpdateLog()
|
||||
m_logTimer->Stop();
|
||||
for (unsigned int i = 0; i < msgQueue.size(); i++)
|
||||
{
|
||||
m_log->AppendText(msgQueue.front());
|
||||
switch (msgQueue.front().first)
|
||||
{
|
||||
// AGGH why is this not working
|
||||
case ERROR_LEVEL: // red
|
||||
m_log->SetDefaultStyle(wxTextAttr(wxColour(255, 0, 0), wxColour(0, 0, 0)));
|
||||
break;
|
||||
case WARNING_LEVEL: // yellow
|
||||
m_log->SetDefaultStyle(wxTextAttr(wxColour(255, 255, 0), wxColour(0, 0, 0)));
|
||||
break;
|
||||
case NOTICE_LEVEL: // green
|
||||
m_log->SetDefaultStyle(wxTextAttr(wxColour(0, 255, 0), wxColour(0, 0, 0)));
|
||||
break;
|
||||
case INFO_LEVEL: // cyan
|
||||
m_log->SetDefaultStyle(wxTextAttr(wxColour(0, 255, 255), wxColour(0, 0, 0)));
|
||||
break;
|
||||
case DEBUG_LEVEL: // light gray
|
||||
m_log->SetDefaultStyle(wxTextAttr(wxColour(211, 211, 211), wxColour(0, 0, 0)));
|
||||
break;
|
||||
default: // white
|
||||
m_log->SetDefaultStyle(wxTextAttr(wxColour(255, 255, 255), wxColour(0, 0, 0)));
|
||||
break;
|
||||
}
|
||||
m_log->AppendText(msgQueue.front().second);
|
||||
msgQueue.pop();
|
||||
}
|
||||
m_logTimer->Start(UPDATETIME);
|
||||
@ -353,5 +376,5 @@ void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char *text)
|
||||
|
||||
if (msgQueue.size() >= 100)
|
||||
msgQueue.pop();
|
||||
msgQueue.push(wxString::FromAscii(text));
|
||||
msgQueue.push(std::pair<u8, wxString>((u8)level, wxString::FromAscii(text)));
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ enum
|
||||
IDM_WRITECONSOLE,
|
||||
IDTM_UPDATELOG,
|
||||
IDM_VERBOSITY,
|
||||
IDM_SUBMITCMD = 300,
|
||||
IDM_SUBMITCMD
|
||||
};
|
||||
|
||||
class wxTextCtrl;
|
||||
@ -60,7 +60,7 @@ private:
|
||||
FileLogListener *m_fileLog;
|
||||
ConsoleListener *m_console;
|
||||
LogManager *m_logManager;
|
||||
std::queue<wxString> msgQueue;
|
||||
std::queue<std::pair<u8, wxString>> msgQueue;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user