GUI: Bugfixes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4137 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-09-01 12:44:02 +00:00
parent bd227d3831
commit 478ed4b11e
10 changed files with 299 additions and 112 deletions

View File

@ -47,14 +47,29 @@ ConsoleListener::~ConsoleListener()
void ConsoleListener::Open(int Width, int Height, const char *Title)
{
#ifdef _WIN32
// Open the console window and create the window handle for GetStdHandle()
AllocConsole();
// Save the window handle that AllocConsole() created
if (!GetConsoleWindow())
{
// Open the console window and create the window handle for GetStdHandle()
AllocConsole();
// Save the window handle that AllocConsole() created
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// Set the console window title
SetConsoleTitle(Title);
// Set letter space
LetterSpace(80, 1000);
MoveWindow(GetConsoleWindow(), 200,200, 800,800, true);
}
else
{
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
}
#endif
}
void ConsoleListener::UpdateHandle()
{
#ifdef _WIN32
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// Set the console window title
SetConsoleTitle(Title);
// Set letter space
LetterSpace(80, 4000);
#endif
}
@ -271,7 +286,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
break;
}
if (strlen(Text) > 10)
if (Level != CUSTOM_LEVEL && strlen(Text) > 10)
{
// First 10 chars white
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);

View File

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

View File

@ -73,8 +73,8 @@ public:
ConsoleListener();
~ConsoleListener();
void Open(int Width = 100, int Height = 100,
const char * Name = "Console");
void Open(int Width = 100, int Height = 100, const char * Name = "Console");
void UpdateHandle();
void Close();
bool IsOpen();
void LetterSpace(int Width, int Height);