diff --git a/Source/Core/DebuggerUICommon/Src/DebuggerUIUtil.h b/Source/Core/DebuggerUICommon/Src/DebuggerUIUtil.h index ff571cb0a0..42cc2a7599 100644 --- a/Source/Core/DebuggerUICommon/Src/DebuggerUIUtil.h +++ b/Source/Core/DebuggerUICommon/Src/DebuggerUIUtil.h @@ -20,17 +20,6 @@ #include -#define wxUSE_XPM_IN_MSW 1 -#define USE_XPM_BITMAPS 1 - -// Defined in CodeWindow.cpp extern wxFont DebuggerFont; -// define this to use XPMs everywhere (by default, BMPs are used under Win) -// BMPs use less space, but aren't compiled into the executable on other platforms - -#if USE_XPM_BITMAPS && defined (__WXMSW__) && !wxUSE_XPM_IN_MSW -#error You need to enable XPM support to use XPM bitmaps with toolbar! -#endif // USE_XPM_BITMAPS - #endif diff --git a/Source/Core/DolphinWX/Src/BootManager.cpp b/Source/Core/DolphinWX/Src/BootManager.cpp index 2bbde55ee1..6b4e11c21d 100644 --- a/Source/Core/DolphinWX/Src/BootManager.cpp +++ b/Source/Core/DolphinWX/Src/BootManager.cpp @@ -35,7 +35,6 @@ #include #include -#include "Globals.h" #include "Common.h" #include "IniFile.h" #include "BootManager.h" @@ -46,6 +45,7 @@ #include "SysConf.h" #include "Core.h" #if defined(HAVE_WX) && HAVE_WX + #include "Globals.h" #include "ConfigMain.h" #include "Frame.h" #include "CodeWindow.h" diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index aef75b1fae..0069bd6508 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -717,6 +717,8 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event)) m_GameListCtrl->Update(); } + else if (!m_GameListCtrl->GetGameNames().size()) + m_GameListCtrl->BrowseForDirectory(); else // Game started by double click BootGame(std::string("")); diff --git a/Source/Core/DolphinWX/Src/FrameAui.cpp b/Source/Core/DolphinWX/Src/FrameAui.cpp index 0a8a4069e6..86649273bc 100644 --- a/Source/Core/DolphinWX/Src/FrameAui.cpp +++ b/Source/Core/DolphinWX/Src/FrameAui.cpp @@ -789,8 +789,6 @@ void CFrame::ReloadPanes() // Open notebook pages AddRemoveBlankPage(); g_pCodeWindow->OpenPages(); - if (g_pCodeWindow->bShowOnStart[0]) ToggleLogWindow(true); - if (g_pCodeWindow->bShowOnStart[1]) ToggleConsole(true); } void CFrame::DoLoadPerspective() diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 64f6a99887..38785c9db5 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -16,19 +16,14 @@ // http://code.google.com/p/dolphin-emu/ - // This file holds global data for DolphinWx and DebuggerWx - #ifndef _GLOBALS_H #define _GLOBALS_H #include "Common.h" -// Constant Colors -const unsigned long COLOR_GRAY = 0xDCDCDC; - enum { Toolbar_DebugGo, @@ -248,49 +243,31 @@ enum LIST_CTRL = 1000 }; -#define wxUSE_XPM_IN_MSW 1 -#define USE_XPM_BITMAPS 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -// For compilers that support precompilation, includes . -//#include - -//#ifndef WX_PRECOMP -#if defined(HAVE_WX) && HAVE_WX - #include - //#endif - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - // Define this to use XPMs everywhere (by default, BMPs are used under Win) - // BMPs use less space, but aren't compiled into the executable on other platforms - #if USE_XPM_BITMAPS && defined (__WXMSW__) && !wxUSE_XPM_IN_MSW - #error You need to enable XPM support to use XPM bitmaps with toolbar! - #endif // USE_XPM_BITMAPS - - // custom message macro - #define EVT_HOST_COMMAND(id, fn) \ - DECLARE_EVENT_TABLE_ENTRY(\ +// custom message macro +#define EVT_HOST_COMMAND(id, fn) \ + DECLARE_EVENT_TABLE_ENTRY(\ wxEVT_HOST_COMMAND, id, wxID_ANY, \ (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent(wxCommandEventFunction, &fn), \ (wxObject*) NULL \ ), - extern const wxEventType wxEVT_HOST_COMMAND; +extern const wxEventType wxEVT_HOST_COMMAND; -#endif // HAVE_WX #endif // _GLOBALS_H - diff --git a/Source/Core/DolphinWX/Src/ISOFile.h b/Source/Core/DolphinWX/Src/ISOFile.h index 439caba66d..80ff0096d1 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.h +++ b/Source/Core/DolphinWX/Src/ISOFile.h @@ -21,6 +21,10 @@ #include "Volume.h" #include "VolumeCreator.h" +#if defined(HAVE_WX) && HAVE_WX +#include +#endif + class PointerWrap; class GameListItem { diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp index 38d43b0d66..acbbd23095 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ b/Source/Core/DolphinWX/Src/LogWindow.cpp @@ -15,20 +15,12 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ - -#include -#include -#include -#include -#include -#include - -#include "Core.h" // for Core::GetState() #include "LogWindow.h" #include "ConsoleListener.h" #include "Console.h" +#include "IniFile.h" #include "FileUtil.h" - +#include "DebuggerUIUtil.h" // Milliseconds between msgQueue flushes to wxTextCtrl #define UPDATETIME 200 @@ -71,6 +63,9 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos, CreateGUIControls(); LoadSettings(); + + m_LogTimer = new wxTimer(this, IDTM_UPDATELOG); + m_LogTimer->Start(UPDATETIME); } void CLogWindow::CreateGUIControls() @@ -91,23 +86,27 @@ void CLogWindow::CreateGUIControls() m_verbosity->SetFont(wxFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); // Font - m_FontChoice = new wxChoice(this, IDM_FONT, wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator); + m_FontChoice = new wxChoice(this, IDM_FONT, + wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator); m_FontChoice->Append(wxT("Default font")); m_FontChoice->Append(wxT("Monospaced font")); m_FontChoice->Append(wxT("Selected font")); m_FontChoice->SetSelection(0); DefaultFont = GetFont(); - MonoSpaceFont.SetNativeFontInfoUserDesc(wxString::FromAscii("lucida console windows-1252")); - Font.push_back(DefaultFont); - Font.push_back(MonoSpaceFont); - Font.push_back(DebuggerFont); + MonoSpaceFont.SetNativeFontInfoUserDesc(wxT("lucida console windows-1252")); + LogFont.push_back(DefaultFont); + LogFont.push_back(MonoSpaceFont); + LogFont.push_back(DebuggerFont); // Options wxCheckBox * m_WrapLine = new wxCheckBox(this, IDM_WRAPLINE, wxT("Word Wrap")); - m_writeFileCB = new wxCheckBox(this, IDM_WRITEFILE, wxT("Write to File"), wxDefaultPosition, wxDefaultSize, 0); - m_writeConsoleCB = new wxCheckBox(this, IDM_WRITECONSOLE, wxT("Write to Console"), wxDefaultPosition, wxDefaultSize, 0); - m_writeWindowCB = new wxCheckBox(this, IDM_WRITEWINDOW, wxT("Write to Window ->"), wxDefaultPosition, wxDefaultSize, 0); + m_writeFileCB = new wxCheckBox(this, IDM_WRITEFILE, + wxT("Write to File"), wxDefaultPosition, wxDefaultSize, 0); + m_writeConsoleCB = new wxCheckBox(this, IDM_WRITECONSOLE, + wxT("Write to Console"), wxDefaultPosition, wxDefaultSize, 0); + m_writeWindowCB = new wxCheckBox(this, IDM_WRITEWINDOW, + wxT("Write to Window ->"), wxDefaultPosition, wxDefaultSize, 0); m_checks = new wxCheckListBox(this, IDM_LOGCHECKS, wxDefaultPosition, wxDefaultSize); @@ -115,7 +114,6 @@ void CLogWindow::CreateGUIControls() m_Log = CreateTextCtrl(this, IDM_LOG, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP); m_cmdline = new wxTextCtrl(this, IDM_SUBMITCMD, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB); - //m_cmdline->SetFont(DebuggerFont); // Sizers sUber = new wxBoxSizer(wxHORIZONTAL); // whole plane @@ -126,8 +124,10 @@ void CLogWindow::CreateGUIControls() wxStaticBoxSizer* sbLeftOptions = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Options")); 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); + 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); sbLeftOptions->Add(m_FontChoice, 0, (wxDOWN), 1); sbLeftOptions->Add(m_WrapLine, 0, (wxDOWN), 1); @@ -146,13 +146,7 @@ void CLogWindow::CreateGUIControls() sUber->Add(sRight, 1, wxEXPAND); this->SetSizer(sUber); - // Settings - // SetAffirmativeId(IDM_SUBMITCMD); - UpdateChecks(); m_cmdline->SetFocus(); - - m_LogTimer = new wxTimer(this, IDTM_UPDATELOG); - m_LogTimer->Start(UPDATETIME); } CLogWindow::~CLogWindow() @@ -220,8 +214,8 @@ void CLogWindow::LoadSettings() m_verbosity->SetSelection(verbosity - 1); ini.Get("Options", "Font", &font, 0); m_FontChoice->SetSelection(font); - if (m_FontChoice->GetSelection() < (int)Font.size()) - m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font[m_FontChoice->GetSelection()])); + if (m_FontChoice->GetSelection() < (int)LogFont.size()) + m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, LogFont[m_FontChoice->GetSelection()])); ini.Get("Options", "WriteToFile", &m_writeFile, true); m_writeFileCB->SetValue(m_writeFile); ini.Get("Options", "WriteToConsole", &m_writeConsole, true); @@ -257,7 +251,6 @@ void CLogWindow::OnSubmit(wxCommandEvent& WXUNUSED (event)) if (!m_cmdline) return; Console_Submit(m_cmdline->GetValue().To8BitData()); m_cmdline->SetValue(wxEmptyString); - NotifyUpdate(); } void CLogWindow::OnClear(wxCommandEvent& WXUNUSED (event)) @@ -271,8 +264,6 @@ void CLogWindow::OnClear(wxCommandEvent& WXUNUSED (event)) 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. @@ -336,8 +327,8 @@ wxTextCtrl* CLogWindow::CreateTextCtrl(wxPanel* parent, wxWindowID id, long Styl TC->SetBackgroundColour(*wxBLACK); if (m_FontChoice) { - if (m_FontChoice->GetSelection() < (int)Font.size()) - TC->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font[m_FontChoice->GetSelection()])); + if (m_FontChoice->GetSelection() < (int)LogFont.size()) + TC->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, LogFont[m_FontChoice->GetSelection()])); } return TC; } @@ -361,31 +352,36 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event) break; case IDM_WRAPLINE: - // SetWindowStyleFlag doesn't fully work, we need to redraw the window - //m_Log->SetWindowStyleFlag(m_Log->GetWindowStyleFlag() ^ wxTE_DONTWRAP); - /* Notice: To retain the colors when changing word wrapping we need to - loop through every letter with GetStyle and then reapply them letter by letter */ +#ifdef __WXGTK__ + m_Log->SetWindowStyleFlag(m_Log->GetWindowStyleFlag() ^ (wxTE_WORDWRAP | wxTE_DONTWRAP)); +#else + // Unfortunately wrapping styles can only be changed dynamically with wxGTK + // Notice: To retain the colors when changing word wrapping we need to + // loop through every letter with GetStyle and then reapply them letter by letter // Prevent m_Log access while it's being destroyed m_LogAccess = false; UnPopulateRight(); Text = m_Log->GetValue(); m_Log->Destroy(); - switch (event.IsChecked()) - { - case 0: m_Log = CreateTextCtrl(this, IDM_LOG, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP); break; - case 1: m_Log = CreateTextCtrl(this, IDM_LOG, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_WORDWRAP); break; - } + if (event.IsChecked()) + m_Log = CreateTextCtrl(this, IDM_LOG, + wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_WORDWRAP); + else + m_Log = CreateTextCtrl(this, IDM_LOG, + wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP); m_Log->SetDefaultStyle(wxTextAttr(*wxWHITE)); m_Log->AppendText(Text); PopulateRight(); m_LogAccess = true; +#endif break; case IDM_FONT: // Update selected font - Font[Font.size()-1] = DebuggerFont; - m_Log->SetStyle(0, m_Log->GetLastPosition(), wxTextAttr(wxNullColour, wxNullColour, Font[event.GetSelection()])); - m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font[event.GetSelection()])); + LogFont[LogFont.size()-1] = DebuggerFont; + m_Log->SetStyle(0, m_Log->GetLastPosition(), + wxTextAttr(wxNullColour, wxNullColour, LogFont[event.GetSelection()])); + m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, LogFont[event.GetSelection()])); break; case IDM_WRITEFILE: @@ -471,21 +467,13 @@ void CLogWindow::OnLogTimer(wxTimerEvent& WXUNUSED(event)) { if (!m_LogAccess) return; - //m_Log->Freeze(); UpdateLog(); - // Better auto scroll than wxTE_AUTO_SCROLL + // Scroll to the last line if (msgQueue.size() > 0) { m_Log->ScrollLines(1); m_Log->ShowPosition( m_Log->GetLastPosition() ); } - //m_Log->Thaw(); -} - -void CLogWindow::NotifyUpdate() -{ - UpdateChecks(); - //UpdateLog(); } void CLogWindow::UpdateLog() @@ -494,11 +482,8 @@ void CLogWindow::UpdateLog() if (!m_Log) return; 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++) { @@ -536,13 +521,10 @@ void CLogWindow::UpdateLog() // White timestamp m_Log->SetStyle(j, j + 9, wxTextAttr(*wxWHITE)); } - collected_text.Append(msgQueue.front().second); msgQueue.pop(); } m_LogSection.Leave(); - // Write all text at once, needs multiple SetStyle, may not be better - //if (collected_text.size()) m_Log->AppendText(collected_text); - // Return in 0.2 seconds + m_LogTimer->Start(UPDATETIME); } diff --git a/Source/Core/DolphinWX/Src/LogWindow.h b/Source/Core/DolphinWX/Src/LogWindow.h index be77d9c206..68c2f4d439 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.h +++ b/Source/Core/DolphinWX/Src/LogWindow.h @@ -17,12 +17,9 @@ #ifndef LOGWINDOW_H_ #define LOGWINDOW_H_ -#include "Main.h" // for wxGetApp + #include "LogManager.h" #include "Frame.h" -#include "DebuggerUIUtil.h" - -#include "IniFile.h" // Common #include "Thread.h" #include @@ -60,7 +57,6 @@ public: const wxString& name = wxT("Log") ); ~CLogWindow(); - void NotifyUpdate(); void SaveSettings(); void LoadSettings(); @@ -71,7 +67,7 @@ public: private: CFrame *Parent; wxFont DefaultFont, MonoSpaceFont; - std::vector Font; + std::vector LogFont; wxTimer *m_LogTimer; FileLogListener *m_fileLog; ConsoleListener *m_console; diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 1c620bbbb2..ccf8063b59 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -37,7 +37,6 @@ #include "Main.h" #include "ConfigManager.h" #include "CodeWindow.h" -#include "LogWindow.h" #include "JitWindow.h" #include "ExtendedTrace.h" #include "BootManager.h" diff --git a/Source/Core/DolphinWX/Src/MainNoGUI.cpp b/Source/Core/DolphinWX/Src/MainNoGUI.cpp index 0668020b68..81ce6852fd 100644 --- a/Source/Core/DolphinWX/Src/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/Src/MainNoGUI.cpp @@ -37,9 +37,7 @@ #endif #include "Core.h" -#include "Globals.h" #include "Host.h" -#include "ISOFile.h" #include "CPUDetect.h" #include "cmdline.h" #include "Thread.h"