diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index 1b3588f263..4835dab9e4 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -208,11 +208,6 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event) case IDM_NOTIFYMAPLOADED: NotifyMapLoaded(); break; - /* - case IDM_UPDATELOGDISPLAY: - if (m_LogWindow) m_LogWindow->NotifyUpdate(); - break; - */ case IDM_UPDATEDISASMDIALOG: Update(); if (m_RegisterWindow) m_RegisterWindow->NotifyUpdate(); @@ -442,7 +437,6 @@ void CCodeWindow::Load() std::string _Section = StringFromFormat("P - %s", (Parent->ActivePerspective < Parent->Perspectives.size()) ? Parent->Perspectives.at(Parent->ActivePerspective).Name.c_str() : ""); - ini.Get(_Section.c_str(), "Log", &iLogWindow, 1); ini.Get(_Section.c_str(), "Console", &iConsoleWindow, 1); ini.Get(_Section.c_str(), "Code", &iCodeWindow, 1); ini.Get(_Section.c_str(), "Registers", &iRegisterWindow, 1); @@ -478,7 +472,6 @@ void CCodeWindow::Save() std::string _Section = StringFromFormat("P - %s", (Parent->ActivePerspective < Parent->Perspectives.size()) ? Parent->Perspectives.at(Parent->ActivePerspective).Name.c_str() : ""); - ini.Set(_Section.c_str(), "Log", iLogWindow); ini.Set(_Section.c_str(), "Console", iConsoleWindow); ini.Set(_Section.c_str(), "Code", iCodeWindow); ini.Set(_Section.c_str(), "Registers", iRegisterWindow); @@ -916,4 +909,4 @@ void CCodeWindow::OnStatusBar_(wxUpdateUIEvent& event) //if(event.GetId() != IDM_ADDRBOX) DoTip(wxEmptyString); #endif } -///////////////////////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file +///////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index 1414e80ef2..b46fe67446 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -1152,14 +1152,6 @@ RelativePath=".\Src\ISOProperties.h" > - - - - diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 0cdfafb87e..9374e2ad38 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -17,22 +17,14 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Windows /* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -CFrame is the main parent window. Inside CFrame there is an m_Panel that is the parent for -the rendering window (when we render to the main window). In Windows the rendering window is -created by giving CreateWindow() m_Panel->GetHandle() as parent window and creating a new -child window to m_Panel. The new child window handle that is returned by CreateWindow() can -be accessed from Core::GetWindowHandle(). - -///////////////////////////////////////////////*/ - - -// ---------------------------------------------------------------------------- -// includes -// ---------------------------------------------------------------------------- +CFrame is the main parent window. Inside CFrame there is an m_Panel that is the +parent for the rendering window (when we render to the main window). In Windows +the rendering window is created by giving CreateWindow() m_Panel->GetHandle() +as parent window and creating a new child window to m_Panel. The new child +window handle that is returned by CreateWindow() can be accessed from +Core::GetWindowHandle(). */ #include "Common.h" // Common #include "FileUtil.h" @@ -54,13 +46,9 @@ be accessed from Core::GetWindowHandle(). #include "HW/DVDInterface.h" #include "State.h" #include "VolumeHandler.h" - +#include "LogManager.h" #include // wxWidgets -// ---------------------------------------------------------------------------- -// resources -// ---------------------------------------------------------------------------- - extern "C" { #include "../resources/Dolphin.c" // Dolphin icon #include "../resources/toolbar_browse.c" @@ -268,7 +256,6 @@ EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore) EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle) EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar) EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar) -EVT_MENU(IDM_LOGWINDOW, CFrame::OnToggleLogWindow) EVT_MENU(IDM_CONSOLEWINDOW, CFrame::OnToggleConsole) EVT_MENU(IDM_LISTDRIVES, CFrame::GameListChanged) @@ -311,14 +298,8 @@ EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, CFrame::OnAllowNotebookDnD) EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, CFrame::OnNotebookPageChanged) END_EVENT_TABLE() -///////////////////////////////////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////////////////////////////////// -// Creation and close, quit functions -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -CFrame::CFrame(bool showLogWindow, - wxFrame* parent, +CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos, @@ -326,10 +307,9 @@ CFrame::CFrame(bool showLogWindow, bool _UseDebugger, long style) : wxFrame(parent, id, title, pos, size, style) - , UseDebugger(_UseDebugger), m_LogWindow(NULL) + , UseDebugger(_UseDebugger) , m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false) , HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL) - , m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow) , m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0) #if wxUSE_TIMER , m_timer(this) @@ -481,7 +461,6 @@ CFrame::CFrame(bool showLogWindow, if (!UseDebugger) { SetSimplePaneSize(); - if (m_bLogWindow) DoToggleWindow(IDM_LOGWINDOW, true); if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true); } @@ -708,7 +687,6 @@ void CFrame::ReloadPanes() // Open notebook pages AddRemoveBlankPage(); g_pCodeWindow->OpenPages(); - if (m_bLogWindow) DoToggleWindow(IDM_LOGWINDOW, true); if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true); } void CFrame::DoLoadPerspective() diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 64118e30f3..ee9bd26058 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -28,7 +28,6 @@ #include "CDUtils.h" #include "CodeWindow.h" -#include "LogWindow.h" // A shortcut to access the bitmaps #define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name)) @@ -40,15 +39,13 @@ inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length) // Class declarations class CGameListCtrl; -class CLogWindow; class CFrame : public wxFrame { public: - CFrame(bool showLogWindow, - wxFrame* parent, - wxWindowID id = wxID_ANY, + CFrame(wxFrame* parent, + wxWindowID id = wxID_ANY, const wxString& title = wxT("Dolphin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -74,7 +71,6 @@ class CFrame : public wxFrame void DoStop(); bool bRenderToMain; void UpdateGUI(); - void ToggleLogWindow(bool, int i = -1); void ToggleConsole(bool, int i = -1); void PostEvent(wxCommandEvent& event); void PostMenuEvent(wxMenuEvent& event); @@ -159,8 +155,6 @@ class CFrame : public wxFrame CGameListCtrl* m_GameListCtrl; wxPanel* m_Panel; wxToolBarToolBase* m_ToolPlay; - bool m_bLogWindow; - CLogWindow* m_LogWindow; char **drives; @@ -258,7 +252,6 @@ class CFrame : public wxFrame void OnToggleToolbar(wxCommandEvent& event); void DoToggleToolbar(bool); void OnToggleStatusbar(wxCommandEvent& event); - void OnToggleLogWindow(wxCommandEvent& event); void OnToggleConsole(wxCommandEvent& event); void OnKeyDown(wxKeyEvent& event); void OnKeyUp(wxKeyEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 0c32fb18e5..e6614fe4b9 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -54,8 +54,8 @@ Core::GetWindowHandle(). #include "AboutDolphin.h" #include "GameListCtrl.h" #include "BootManager.h" -#include "LogWindow.h" #include "WxUtils.h" +#include "LogManager.h" #include "ConfigManager.h" // Core #include "Core.h" @@ -198,8 +198,6 @@ void CFrame::CreateMenu() viewMenu->Check(IDM_TOGGLE_TOOLBAR, SConfig::GetInstance().m_InterfaceToolbar); viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("Show &Statusbar")); viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar); - viewMenu->AppendCheckItem(IDM_LOGWINDOW, _T("Show &Logwindow")); - viewMenu->Check(IDM_LOGWINDOW, m_bLogWindow); viewMenu->AppendCheckItem(IDM_CONSOLEWINDOW, _T("Show &Console")); viewMenu->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole); viewMenu->AppendSeparator(); @@ -1087,7 +1085,6 @@ int CFrame::GetNootebookAffiliation(wxString Name) } void CFrame::ClosePages() { - DoToggleWindow(IDM_LOGWINDOW, false); //DoToggleWindow(IDM_CONSOLEWINDOW, false); DoToggleWindow(IDM_CODEWINDOW, false); DoToggleWindow(IDM_REGISTERWINDOW, false); @@ -1101,7 +1098,6 @@ void CFrame::DoToggleWindow(int Id, bool Show) { switch (Id) { - case IDM_LOGWINDOW: ToggleLogWindow(Show, UseDebugger ? g_pCodeWindow->iLogWindow : 0); break; case IDM_CONSOLEWINDOW: ToggleConsole(Show, UseDebugger ? g_pCodeWindow->iConsoleWindow : 0); break; case IDM_CODEWINDOW: g_pCodeWindow->OnToggleCodeWindow(Show, g_pCodeWindow->iCodeWindow); break; case IDM_REGISTERWINDOW: g_pCodeWindow->OnToggleRegisterWindow(Show, g_pCodeWindow->iRegisterWindow); break; @@ -1121,7 +1117,6 @@ void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event) AddRemoveBlankPage(); // Update the notebook affiliation - if(GetNootebookAffiliation(wxT("Log")) >= 0) g_pCodeWindow->iLogWindow = GetNootebookAffiliation(wxT("Log")); if(GetNootebookAffiliation(wxT("Console")) >= 0) g_pCodeWindow->iConsoleWindow = GetNootebookAffiliation(wxT("Console")); if(GetNootebookAffiliation(wxT("Code")) >= 0) g_pCodeWindow->iCodeWindow = GetNootebookAffiliation(wxT("Code")); if(GetNootebookAffiliation(wxT("Registers")) >= 0) g_pCodeWindow->iRegisterWindow = GetNootebookAffiliation(wxT("Registers")); @@ -1138,7 +1133,6 @@ void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event) wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject(); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Log"))) { GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(false); DoToggleWindow(IDM_LOGWINDOW, false); } if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Console"))) { GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(false); DoToggleWindow(IDM_CONSOLEWINDOW, false); } if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) { GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(false); DoToggleWindow(IDM_REGISTERWINDOW, false); } if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) { GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(false); DoToggleWindow(IDM_BREAKPOINTWINDOW, false); } @@ -1268,31 +1262,6 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event) this->SendSizeEvent(); } -// Enable and disable the log window -void CFrame::OnToggleLogWindow(wxCommandEvent& event) -{ - DoToggleWindow(event.GetId(), event.IsChecked()); -} -void CFrame::ToggleLogWindow(bool Show, int i) -{ - SConfig::GetInstance().m_InterfaceLogWindow = Show; - if (Show) - { - if (!m_LogWindow) m_LogWindow = new CLogWindow(this); - DoAddPage(m_LogWindow, i, "Log"); - } - else - { - DoRemovePage(m_LogWindow); - } - - // Hide pane - if (!UseDebugger) HidePane(); - - // Make sure the check is updated (if wxw isn't calling this func) - //GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(Show); -} -// Enable and disable the console void CFrame::OnToggleConsole(wxCommandEvent& event) { DoToggleWindow(event.GetId(), event.IsChecked()); diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp deleted file mode 100644 index 2235f0db3e..0000000000 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ /dev/null @@ -1,436 +0,0 @@ -// 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/ - - -#include -#include -#include -#include -#include - -#include "Core.h" // for Core::GetState() -#include "LogWindow.h" -#include "Console.h" - -// milliseconds between msgQueue flushes to wxTextCtrl -#define UPDATETIME 200 - -BEGIN_EVENT_TABLE(CLogWindow, wxDialog) - EVT_CLOSE(CLogWindow::OnClose) - 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) - EVT_CHECKBOX(IDM_WRITEFILE, CLogWindow::OnOptionsCheck) - EVT_CHECKBOX(IDM_WRITECONSOLE, CLogWindow::OnOptionsCheck) - EVT_CHECKBOX(IDM_WRITEWINDOW, CLogWindow::OnOptionsCheck) - EVT_CHECKLISTBOX(IDM_LOGCHECKS, CLogWindow::OnLogCheck) - EVT_TIMER(IDTM_UPDATELOG, CLogWindow::OnLogTimer) -END_EVENT_TABLE() - -CLogWindow::CLogWindow(wxWindow* parent) - : wxDialog(parent, wxID_ANY, wxT("Log"), - wxPoint(100, 700), wxSize(800, 270), - wxNO_BORDER) - , m_logSection(1) -{ - m_logManager = LogManager::GetInstance(); - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - m_logManager->addListener((LogTypes::LOG_TYPE)i, this); - m_fileLog = m_logManager->getFileListener(); - m_console = m_logManager->getConsoleListener(); - - CreateGUIControls(); - - LoadSettings(); -} - -void CLogWindow::CreateGUIControls() -{ - wxBoxSizer* sUber = new wxBoxSizer(wxHORIZONTAL), // whole plane - * sLeft = new wxBoxSizer(wxVERTICAL), // LEFT sizer - * sRight = new wxBoxSizer(wxVERTICAL), // RIGHT sizer - * sRightBottom = new wxBoxSizer(wxHORIZONTAL); // submit row - - // Left side: buttons (-submit), options, and log type selection - wxStaticBoxSizer* sbLeftOptions = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Options")); - - wxArrayString wxLevels; - for (int i = 1; i <= MAX_LOGLEVEL; ++i) - wxLevels.Add(wxString::Format(wxT("%i"), i)); - m_verbosity = new wxRadioBox(this, IDM_VERBOSITY, wxT("Verbosity"), wxDefaultPosition, wxDefaultSize, wxLevels, 0, wxRA_SPECIFY_COLS, wxDefaultValidator); - sbLeftOptions->Add(m_verbosity); - - m_writeFileCB = new wxCheckBox(this, IDM_WRITEFILE, wxT("Write to File"), wxDefaultPosition, wxDefaultSize, 0); - sbLeftOptions->Add(m_writeFileCB); - - m_writeConsoleCB = new wxCheckBox(this, IDM_WRITECONSOLE, wxT("Write to Console"), wxDefaultPosition, wxDefaultSize, 0); - sbLeftOptions->Add(m_writeConsoleCB); - - m_writeWindowCB = new wxCheckBox(this, IDM_WRITEWINDOW, wxT("Write to Window ->"), wxDefaultPosition, wxDefaultSize, 0); - sbLeftOptions->Add(m_writeWindowCB); - - sLeft->Add(sbLeftOptions, 0, wxEXPAND); - - wxBoxSizer* sLogCtrl = new wxBoxSizer(wxHORIZONTAL); - sLogCtrl->Add(new wxButton(this, IDM_TOGGLEALL, wxT("Toggle all"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT), 1); - sLogCtrl->Add(new wxButton(this, IDM_CLEARLOG, wxT("Clear"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT), 1); - sLeft->Add(sLogCtrl, 0, wxEXPAND); - - m_checks = new wxCheckListBox(this, IDM_LOGCHECKS, wxDefaultPosition, wxDefaultSize); - sLeft->Add(m_checks, 1, wxEXPAND); - - // Right side: Log viewer and submit row - m_log = new wxTextCtrl(this, IDM_LOG, wxEmptyString, wxDefaultPosition, wxDefaultSize, - wxTE_RICH2 | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP); - // FIXME See note in UpdateLog() - //m_log->SetBackgroundColour(*wxBLACK); - //m_log->SetFont(DebuggerFont); - - 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); - sRight->Add(m_log, 1, wxEXPAND | wxSHRINK); - sRight->Add(sRightBottom, 0, wxEXPAND); - - // Take care of the main sizer and some settings - sUber->Add(sLeft, 0, wxEXPAND); - sUber->Add(sRight, 1, wxEXPAND); - - SetSizer(sUber); - SetAffirmativeId(IDM_SUBMITCMD); - UpdateChecks(); - m_cmdline->SetFocus(); - - m_logTimer = new wxTimer(this, IDTM_UPDATELOG); - m_logTimer->Start(UPDATETIME); -} - -CLogWindow::~CLogWindow() -{ - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - { - m_logManager->removeListener((LogTypes::LOG_TYPE)i, this); - } - m_logTimer->Stop(); - delete m_logTimer; - - SaveSettings(); -} - -void CLogWindow::OnClose(wxCloseEvent& event) -{ - wxGetApp().GetCFrame()->ToggleLogWindow(false); - event.Skip(); -} - -void CLogWindow::SaveSettings() -{ - IniFile ini; - ini.Set("LogWindow", "x", GetPosition().x); - ini.Set("LogWindow", "y", GetPosition().y); - ini.Set("LogWindow", "w", GetSize().GetWidth()); - ini.Set("LogWindow", "h", GetSize().GetHeight()); - ini.Set("Options", "Verbosity", m_verbosity->GetSelection() + 1); - ini.Set("Options", "WriteToFile", m_writeFile); - ini.Set("Options", "WriteToConsole", m_writeConsole); - ini.Set("Options", "WriteToWindow", m_writeWindow); - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - ini.Set("Logs", m_logManager->getShortName((LogTypes::LOG_TYPE)i), m_checks->IsChecked(i)); - ini.Save(LOGGER_CONFIG_FILE); -} - -void CLogWindow::LoadSettings() -{ - IniFile ini; - ini.Load(LOGGER_CONFIG_FILE); - int x,y,w,h,verbosity; - ini.Get("LogWindow", "x", &x, GetPosition().x); - ini.Get("LogWindow", "y", &y, GetPosition().y); - ini.Get("LogWindow", "w", &w, GetSize().GetWidth()); - ini.Get("LogWindow", "h", &h, GetSize().GetHeight()); - SetSize(x, y, w, h); - ini.Get("Options", "Verbosity", &verbosity, 0); - if (verbosity < 1) verbosity = 1; - if (verbosity > DEBUG_LEVEL) verbosity = DEBUG_LEVEL; - m_verbosity->SetSelection(verbosity - 1); - ini.Get("Options", "WriteToFile", &m_writeFile, true); - m_writeFileCB->SetValue(m_writeFile); - ini.Get("Options", "WriteToConsole", &m_writeConsole, true); - m_writeConsoleCB->SetValue(m_writeConsole); - ini.Get("Options", "WriteToWindow", &m_writeWindow, true); - m_writeWindowCB->SetValue(m_writeWindow); - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - { - bool enable; - ini.Get("Logs", m_logManager->getShortName((LogTypes::LOG_TYPE)i), &enable, true); - - if (m_writeWindow && enable) - m_logManager->addListener((LogTypes::LOG_TYPE)i, this); - else - m_logManager->removeListener((LogTypes::LOG_TYPE)i, this); - - if (m_writeFile && enable) - m_logManager->addListener((LogTypes::LOG_TYPE)i, m_fileLog); - else - m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog); - - if (m_writeConsole && enable) - m_logManager->addListener((LogTypes::LOG_TYPE)i, m_console); - else - m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_console); - m_logManager->setLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)(verbosity)); - } - UpdateChecks(); -} - -void CLogWindow::OnSubmit(wxCommandEvent& WXUNUSED (event)) -{ - Console_Submit(m_cmdline->GetValue().To8BitData()); - m_cmdline->SetValue(wxEmptyString); - NotifyUpdate(); -} - -void CLogWindow::OnClear(wxCommandEvent& WXUNUSED (event)) -{ - m_log->Clear(); - - m_logSection.Enter(); - int msgQueueSize = (int)msgQueue.size(); - for (int i = 0; i < msgQueueSize; i++) - msgQueue.pop(); - m_logSection.Leave(); - - m_console->ClearScreen(); - NOTICE_LOG(CONSOLE, "Console cleared"); - NotifyUpdate(); -} - -// Enable or disable all boxes for the current verbosity level and save the changes. -void CLogWindow::OnToggleAll(wxCommandEvent& WXUNUSED (event)) -{ - static bool enableAll = false; - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - { - ToggleLog(i, enableAll); - } - - SaveSettings(); - enableAll = !enableAll; -} - -// Append checkboxes and update checked groups. -void CLogWindow::UpdateChecks() -{ - // This is only run once to append checkboxes to the wxCheckListBox. - if (m_checks->GetCount() == 0) - { - // [F|RES] hide the window while we fill it... wxwidgets gets trouble - // if you don't do it (at least the win version) - m_checks->Freeze(); - - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) - { - m_checks->Append(wxString::FromAscii(m_logManager->getFullName( (LogTypes::LOG_TYPE)i ))); - } - m_checks->Thaw(); - } - - m_checks->Freeze(); - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) - { - m_checks->Check(i, - m_logManager->isListener((LogTypes::LOG_TYPE)i, this) || - m_logManager->isListener((LogTypes::LOG_TYPE)i, m_console) || - m_logManager->isListener((LogTypes::LOG_TYPE)i, m_fileLog)); - } - m_checks->Thaw(); -} - -// When an option is changed, save the change -void CLogWindow::OnOptionsCheck(wxCommandEvent& event) -{ - switch (event.GetId()) - { - case IDM_VERBOSITY: - { - // get selection - int v = m_verbosity->GetSelection() + 1; - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) - { - m_logManager->setLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)v); - } - } - break; - - case IDM_WRITEFILE: - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - { - m_writeFile = event.IsChecked(); - if (m_checks->IsChecked(i)) - { - if (m_writeFile) - m_logManager->addListener((LogTypes::LOG_TYPE)i, m_fileLog); - else - m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog); - } - } - break; - - case IDM_WRITEWINDOW: - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - { - m_writeWindow = event.IsChecked(); - if (m_checks->IsChecked(i)) - { - if (m_writeWindow) - m_logManager->addListener((LogTypes::LOG_TYPE)i, this); - else - m_logManager->removeListener((LogTypes::LOG_TYPE)i, this); - } - } - break; - - case IDM_WRITECONSOLE: - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - { - m_writeConsole = event.IsChecked(); - if (m_checks->IsChecked(i)) - { - if (m_writeConsole) - m_logManager->addListener((LogTypes::LOG_TYPE)i, m_console); - else - m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_console); - } - } - if (m_writeConsole && !m_console->IsOpen()) - wxGetApp().GetCFrame()->ToggleConsole(true); - else if (!m_writeConsole && m_console->IsOpen()) - wxGetApp().GetCFrame()->ToggleConsole(false); - break; - } - SaveSettings(); -} - -// When a checkbox is changed -void CLogWindow::OnLogCheck(wxCommandEvent& event) -{ - int i = event.GetInt(); - ToggleLog(i, m_checks->IsChecked(i)); - - SaveSettings(); -} - -void CLogWindow::ToggleLog(int _logType, bool enable) -{ - LogTypes::LOG_TYPE logType = (LogTypes::LOG_TYPE)_logType; - - m_checks->Check(_logType, enable); - - m_logManager->setEnable(logType, enable); - - if (enable) - { - if (m_writeWindow) - m_logManager->addListener(logType, this); - if (m_writeFile) - m_logManager->addListener(logType, m_fileLog); - if (m_writeConsole) - m_logManager->addListener(logType, m_console); - } - else - { - m_logManager->removeListener(logType, this); - m_logManager->removeListener(logType, m_fileLog); - m_logManager->removeListener(logType, m_console); - } -} - -void CLogWindow::OnLogTimer(wxTimerEvent& WXUNUSED(event)) -{ - UpdateLog(); -} - -void CLogWindow::NotifyUpdate() -{ - UpdateChecks(); - //UpdateLog(); -} - -void CLogWindow::UpdateLog() -{ - m_logTimer->Stop(); - wxString collected_text; - - m_logSection.Enter(); - // rough estimate - collected_text.reserve(100 * msgQueue.size()); - int msgQueueSize = (int)msgQueue.size(); - for (int i = 0; i < msgQueueSize; i++) - { -#ifndef _WIN32 - // FIXME This looks horrible on windows: SetForegroundColour changes - // ALL text in the control, and SetDefaultStyle doesn't work at all - switch (msgQueue.front().first) - { - // red - case ERROR_LEVEL: - m_log->SetForegroundColour(*wxRED); - break; - // yellow - case WARNING_LEVEL: - m_log->SetForegroundColour(wxColour(255, 255, 0)); - break; - // green - case NOTICE_LEVEL: - m_log->SetForegroundColour(*wxGREEN); - break; - // cyan - case INFO_LEVEL: - m_log->SetForegroundColour(*wxCYAN); - break; - // light gray - case DEBUG_LEVEL: - m_log->SetForegroundColour(wxColour(211, 211, 211)); - break; - // white - default: - m_log->SetForegroundColour(*wxWHITE); - break; - } -#endif - collected_text.Append(msgQueue.front().second); - msgQueue.pop(); - } - m_logSection.Leave(); - - if (collected_text.size()) { - m_log->AppendText(collected_text); - } - m_logTimer->Start(UPDATETIME); -} - -void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char *text) -{ - m_logSection.Enter(); - if (msgQueue.size() >= 100) - msgQueue.pop(); - msgQueue.push(std::pair((u8)level, wxString::FromAscii(text))); - m_logSection.Leave(); -} diff --git a/Source/Core/DolphinWX/Src/LogWindow.h b/Source/Core/DolphinWX/Src/LogWindow.h deleted file mode 100644 index 1bb5403116..0000000000 --- a/Source/Core/DolphinWX/Src/LogWindow.h +++ /dev/null @@ -1,90 +0,0 @@ -// 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_ -#include "Main.h" // for wxGetApp -#include "LogManager.h" -#include "IniFile.h" -#include "Thread.h" -#include - -enum -{ - IDM_LOG, - IDM_CLEARLOG, - IDM_LOGCHECKS, - IDM_OPTIONS, - IDM_TOGGLEALL, - IDM_WRITEFILE, - IDM_WRITECONSOLE, - IDM_WRITEWINDOW, - IDTM_UPDATELOG, - IDM_VERBOSITY, - IDM_SUBMITCMD -}; - -class wxTextCtrl; -class wxCheckListBox; -class wxString; - -// Uses multiple inheritance - only sane because LogListener is a pure virtual interface. -class CLogWindow : public wxDialog, LogListener -{ -public: - CLogWindow(wxWindow* parent); - ~CLogWindow(); - void NotifyUpdate(); - - void SaveSettings(); - void LoadSettings(); - void Log(LogTypes::LOG_LEVELS, const char *text); - -private: - wxTextCtrl *m_log, *m_cmdline; - bool m_writeFile, m_writeConsole, m_writeWindow; - wxCheckBox *m_writeFileCB, *m_writeConsoleCB, *m_writeWindowCB; - wxTimer *m_logTimer; - wxCheckListBox* m_checks; - wxRadioBox *m_verbosity; - FileLogListener *m_fileLog; - ConsoleListener *m_console; - LogManager *m_logManager; - std::queue > msgQueue; - - Common::CriticalSection m_logSection; - - DECLARE_EVENT_TABLE() - - void CreateGUIControls(); - void OnClose(wxCloseEvent& event); - 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_*/ diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index ca4843aee0..0f2aa0c2d4 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -36,7 +36,7 @@ #include "Main.h" #include "ConfigManager.h" #include "CodeWindow.h" -#include "LogWindow.h" +#include "LogManager.h" #include "JitWindow.h" #include "ExtendedTrace.h" #include "BootManager.h" @@ -89,7 +89,6 @@ bool DolphinApp::OnInit() NOTICE_LOG(BOOT, "Starting application"); // Declarations and definitions bool UseDebugger = false; - bool UseLogger = false; bool LoadElf = false; wxString ElfFile; @@ -259,7 +258,6 @@ bool DolphinApp::OnInit() } UseDebugger = parser.Found(_T("debugger")); - UseLogger = parser.Found(_T("logger")); LoadElf = parser.Found(_T("elf"), &ElfFile); if( LoadElf && ElfFile == wxEmptyString ) @@ -294,12 +292,12 @@ bool DolphinApp::OnInit() if (UseDebugger) { - main_frame = new CFrame(UseLogger, (wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title), + main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title), wxPoint(x, y), wxSize(w, h), true); } else { - main_frame = new CFrame(UseLogger, (wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title), + main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title), wxPoint(100, 100), wxSize(800, 600)); } diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index e1aaee59e8..eab6201a69 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -27,7 +27,6 @@ if wxenv['HAVE_WX']: 'ARCodeAddEdit.cpp', 'ConfigMain.cpp', 'Frame.cpp', - 'LogWindow.cpp', 'FrameTools.cpp', 'GameListCtrl.cpp', 'Globals.cpp',