Some code cleanup, disabled listchilren as it seems to move Pods where

they should be causing crashes (until someone feels like fixing it)


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4123 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-08-31 21:46:29 +00:00
parent 0eb989431f
commit 62ab5cf0e5
6 changed files with 20 additions and 67 deletions

View File

@ -16,9 +16,6 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
////////////////////////////////////////////////////////////////////////////////////////////////////////
// Include
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#include <algorithm> // min #include <algorithm> // min
#include <string> // System: To be able to add strings with "+" #include <string> // System: To be able to add strings with "+"
#include <stdio.h> #include <stdio.h>
@ -31,12 +28,7 @@
#include "Common.h" #include "Common.h"
#include "LogManager.h" // Common #include "LogManager.h" // Common
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
// Main
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ConsoleListener::ConsoleListener() ConsoleListener::ConsoleListener()
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -87,16 +79,10 @@ bool ConsoleListener::IsOpen()
return true; return true;
#endif #endif
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
// Size
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/* /*
Short documentation: LetterSpace: SetConsoleScreenBufferSize and SetConsoleWindowInfo are
LetterSpace: SetConsoleScreenBufferSize and SetConsoleWindowInfo are dependent on each other, that's the dependent on each other, that's the reason for the additional checks.
reason for the additional checks.
*/ */
void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst) void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst)
{ {
@ -211,12 +197,6 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
coordScreen = GetCoordinates(BytesRead, ConInfo.dwSize.X); coordScreen = GetCoordinates(BytesRead, ConInfo.dwSize.X);
LastAttrRead = cAttrRead; LastAttrRead = cAttrRead;
} }
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Modify the buffer proportions
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Letter space // Letter space
int LWidth = floor((float)Width / 8.0) - 1.0; int LWidth = floor((float)Width / 8.0) - 1.0;
int LHeight = floor((float)Height / 12.0) - 1.0; int LHeight = floor((float)Height / 12.0) - 1.0;
@ -224,12 +204,8 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
int LBufHeight = floor((float)BufferSize / (float)LBufWidth); int LBufHeight = floor((float)BufferSize / (float)LBufWidth);
// Change screen buffer size // Change screen buffer size
LetterSpace(LBufWidth, LBufHeight); LetterSpace(LBufWidth, LBufHeight);
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Redraw the text
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ClearScreen(true); ClearScreen(true);
coordScreen.Y = 0; coordScreen.Y = 0;
coordScreen.X = 0; coordScreen.X = 0;
@ -247,16 +223,10 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
BytesWritten += cAttrWritten; BytesWritten += cAttrWritten;
coordScreen = GetCoordinates(BytesWritten, LBufWidth); coordScreen = GetCoordinates(BytesWritten, LBufWidth);
} }
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Update cursor
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int OldCursor = ConInfo.dwCursorPosition.Y * ConInfo.dwSize.X + ConInfo.dwCursorPosition.X; int OldCursor = ConInfo.dwCursorPosition.Y * ConInfo.dwSize.X + ConInfo.dwCursorPosition.X;
COORD Coo = GetCoordinates(OldCursor, LBufWidth); COORD Coo = GetCoordinates(OldCursor, LBufWidth);
SetConsoleCursorPosition(hConsole, Coo); SetConsoleCursorPosition(hConsole, Coo);
// ---------------------------------------------------------------------
if (SLog.length() > 0) Log(LogTypes::LNOTICE, SLog.c_str()); if (SLog.length() > 0) Log(LogTypes::LNOTICE, SLog.c_str());
@ -264,13 +234,7 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
if (Resize) MoveWindow(GetConsoleWindow(), Left,Top, (Width + 100),Height, true); if (Resize) MoveWindow(GetConsoleWindow(), Left,Top, (Width + 100),Height, true);
#endif #endif
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
// Write
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text, ...)
void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text) void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
{ {
#if defined(_WIN32) #if defined(_WIN32)
@ -307,7 +271,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
break; break;
} }
if (Level != CUSTOM_LEVEL && strlen(Text) > 10) if (strlen(Text) > 10)
{ {
// First 10 chars white // First 10 chars white
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
@ -320,7 +284,6 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
fprintf(stderr, "%s", Text); fprintf(stderr, "%s", Text);
#endif #endif
} }
// Clear console screen // Clear console screen
void ConsoleListener::ClearScreen(bool Cursor) void ConsoleListener::ClearScreen(bool Cursor)
{ {
@ -342,5 +305,5 @@ void ConsoleListener::ClearScreen(bool Cursor)
if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen); if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen);
#endif #endif
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -23,7 +23,6 @@
#define WARNING_LEVEL 3 // Something is suspicious. #define WARNING_LEVEL 3 // Something is suspicious.
#define INFO_LEVEL 4 // General information. #define INFO_LEVEL 4 // General information.
#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow. #define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
#define CUSTOM_LEVEL 6 // Custom log
namespace LogTypes namespace LogTypes
{ {
@ -82,7 +81,6 @@ enum LOG_LEVELS {
LWARNING = WARNING_LEVEL, LWARNING = WARNING_LEVEL,
LINFO = INFO_LEVEL, LINFO = INFO_LEVEL,
LDEBUG = DEBUG_LEVEL, LDEBUG = DEBUG_LEVEL,
LCUSTOM = CUSTOM_LEVEL,
}; };
} // namespace } // namespace

View File

@ -28,8 +28,7 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char*
LogManager *LogManager::m_logManager = NULL; LogManager *LogManager::m_logManager = NULL;
LogManager::LogManager()\ LogManager::LogManager() : logMutex(1) {
: logMutex(1) {
// create log files // create log files
m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log"); m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot"); m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot");

View File

@ -84,7 +84,6 @@ public:
COORD GetCoordinates(int BytesRead, int BufferWidth); COORD GetCoordinates(int BytesRead, int BufferWidth);
#endif #endif
void Log(LogTypes::LOG_LEVELS, const char *Text); void Log(LogTypes::LOG_LEVELS, const char *Text);
//void Log(LogTypes::LOG_LEVELS, const char *Text, ...);
void ClearScreen(bool Cursor = true); void ClearScreen(bool Cursor = true);
const char *getName() const { return "Console"; } const char *getName() const { return "Console"; }

View File

@ -509,14 +509,12 @@ CFrame::CFrame(bool showLogWindow,
wxAuiManagerEventHandler(CFrame::OnManagerResize), wxAuiManagerEventHandler(CFrame::OnManagerResize),
(wxObject*)0, this); (wxObject*)0, this);
#ifdef _WIN32 // The functions are only tested in Windows so far
wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DOWN, wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DOWN,
wxMouseEventHandler(CFrame::OnDoubleClick), wxMouseEventHandler(CFrame::OnDoubleClick),
(wxObject*)0, this); (wxObject*)0, this);
wxTheApp->Connect(wxID_ANY, wxEVT_MOTION, wxTheApp->Connect(wxID_ANY, wxEVT_MOTION,
wxMouseEventHandler(CFrame::OnMotion), wxMouseEventHandler(CFrame::OnMotion),
(wxObject*)0, this); (wxObject*)0, this);
#endif
// ---------- // ----------
// Update controls // Update controls
@ -655,20 +653,21 @@ void CFrame::SetPaneSize()
// Debugging, show loose windows // Debugging, show loose windows
void CFrame::ListChildren() void CFrame::ListChildren()
{ {
return;
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
for (int i = 0; i < this->GetChildren().size(); i++) for (int i = 0; i < this->GetChildren().size(); i++)
{ {
wxWindow * Win = this->GetChildren().Item(i)->GetData(); wxWindow * Win = this->GetChildren().Item(i)->GetData();
Console->Log(LogTypes::LCUSTOM, StringFromFormat( // Console->Log(LogTypes::LDEBUG, StringFromFormat(
"%i: %s (%s) :: % s\n", i, // "%i: %s (%s) :: % s\n", i,
Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str()); // Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str());
Win = this->GetChildren().Item(i)->GetData(); Win = this->GetChildren().Item(i)->GetData();
for (int j = 0; j < Win->GetChildren().size(); j++) for (int j = 0; j < Win->GetChildren().size(); j++)
{ {
Console->Log(LogTypes::LCUSTOM, StringFromFormat( // Console->Log(LogTypes::LDEBUG, StringFromFormat(
" %i.%i: %s (%s) :: % s\n", i, j, // " %i.%i: %s (%s) :: % s\n", i, j,
Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str()); // Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str());
} }
} }
} }
@ -1127,4 +1126,4 @@ void CFrame::Update()
} }
} }
#endif #endif
///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -172,10 +172,8 @@ void CFrame::CreateMenu()
pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP Settings")); pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP Settings"));
pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _T("&Pad Settings")); pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _T("&Pad Settings"));
pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _T("&Wiimote Settings")); pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _T("&Wiimote Settings"));
#ifdef _WIN32 pOptionsMenu->AppendSeparator();
pOptionsMenu->AppendSeparator(); pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
#endif
menuBar->Append(pOptionsMenu, _T("&Options")); menuBar->Append(pOptionsMenu, _T("&Options"));
// Tools menu // Tools menu
@ -218,10 +216,8 @@ void CFrame::CreateMenu()
viewMenu->Check(IDM_LISTPAL, SConfig::GetInstance().m_ListPal); viewMenu->Check(IDM_LISTPAL, SConfig::GetInstance().m_ListPal);
viewMenu->AppendCheckItem(IDM_LISTUSA, _T("Show USA")); viewMenu->AppendCheckItem(IDM_LISTUSA, _T("Show USA"));
viewMenu->Check(IDM_LISTUSA, SConfig::GetInstance().m_ListUsa); viewMenu->Check(IDM_LISTUSA, SConfig::GetInstance().m_ListUsa);
#ifdef _WIN32 //TODO test drive loading on linux, I cannot load from drive on my linux system Dolphin just crashes
viewMenu->AppendCheckItem(IDM_LISTDRIVES, _T("Show Drives")); viewMenu->AppendCheckItem(IDM_LISTDRIVES, _T("Show Drives"));
viewMenu->Check(IDM_LISTDRIVES, SConfig::GetInstance().m_ListDrives); viewMenu->Check(IDM_LISTDRIVES, SConfig::GetInstance().m_ListDrives);
#endif
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
viewMenu->Append(IDM_PURGECACHE, _T("Purge Cache")); viewMenu->Append(IDM_PURGECACHE, _T("Purge Cache"));
menuBar->Append(viewMenu, _T("&View")); menuBar->Append(viewMenu, _T("&View"));
@ -259,9 +255,7 @@ void CFrame::PopulateToolbar(wxAuiToolBar* ToolBar)
ToolBar->AddSeparator(); ToolBar->AddSeparator();
ToolBar->AddTool(IDM_PLAY, wxT(""), m_Bitmaps[Toolbar_Play], _T("Play")); ToolBar->AddTool(IDM_PLAY, wxT(""), m_Bitmaps[Toolbar_Play], _T("Play"));
ToolBar->AddTool(IDM_STOP, _T("Stop"), m_Bitmaps[Toolbar_Stop], _T("Stop")); ToolBar->AddTool(IDM_STOP, _T("Stop"), m_Bitmaps[Toolbar_Stop], _T("Stop"));
#ifdef _WIN32
ToolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _T("Fullscr."), m_Bitmaps[Toolbar_FullScreen], _T("Toggle Fullscreen")); ToolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _T("Fullscr."), m_Bitmaps[Toolbar_FullScreen], _T("Toggle Fullscreen"));
#endif
ToolBar->AddTool(IDM_SCREENSHOT, _T("Scr.Shot"), m_Bitmaps[Toolbar_FullScreen], _T("Take Screenshot")); ToolBar->AddTool(IDM_SCREENSHOT, _T("Scr.Shot"), m_Bitmaps[Toolbar_FullScreen], _T("Take Screenshot"));
ToolBar->AddSeparator(); ToolBar->AddSeparator();
ToolBar->AddTool(IDM_CONFIG_MAIN, _T("Config"), m_Bitmaps[Toolbar_PluginOptions], _T("Configure...")); ToolBar->AddTool(IDM_CONFIG_MAIN, _T("Config"), m_Bitmaps[Toolbar_PluginOptions], _T("Configure..."));
@ -1342,12 +1336,13 @@ void CFrame::ToggleConsole(bool Show, int i)
//wxWindow *Win = GetWxWindowHwnd(GetConsoleWindow()); //wxWindow *Win = GetWxWindowHwnd(GetConsoleWindow());
//DoRemovePage (Win, true); //DoRemovePage (Win, true);
DoRemovePageString(wxT("Console"), true); DoRemovePageString(wxT("Console"), true);
if(GetConsoleWindow()) ShowWindow(GetConsoleWindow(),SW_HIDE);
#else #else
Console->Close(); Console->Close();
#endif #endif
#ifdef _WIN32
if(GetConsoleWindow()) ShowWindow(GetConsoleWindow(),SW_HIDE);
#endif
} }
// Hide pane // Hide pane
@ -1511,4 +1506,4 @@ void CFrame::GameListChanged(wxCommandEvent& event)
m_GameListCtrl->Update(); m_GameListCtrl->Update();
} }
} }
///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////