2003-02-16 04:02:21 +00:00
|
|
|
#include "../../global.h"
|
2002-11-18 21:37:58 +00:00
|
|
|
#include "../../RageUtil.h"
|
|
|
|
|
|
|
|
|
|
#include "LoadingWindow_Win32.h"
|
2004-03-04 01:35:42 +00:00
|
|
|
#include "RageFileManager.h"
|
|
|
|
|
#include "resource.h"
|
2002-11-18 21:37:58 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
2003-09-05 08:22:06 +00:00
|
|
|
HBITMAP g_hBitmap = NULL;
|
|
|
|
|
|
|
|
|
|
|
2002-11-18 21:37:58 +00:00
|
|
|
BOOL CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
|
|
|
|
{
|
2003-09-05 08:22:06 +00:00
|
|
|
AppInstance handle;
|
|
|
|
|
|
|
|
|
|
switch( msg )
|
|
|
|
|
{
|
|
|
|
|
case WM_INITDIALOG:
|
2003-12-12 08:55:50 +00:00
|
|
|
/* XXX: Figure out how to use SDL_LoadImage here. */
|
2003-09-05 08:22:06 +00:00
|
|
|
g_hBitmap =
|
|
|
|
|
(HBITMAP)LoadImage(
|
|
|
|
|
handle.Get(),
|
2003-12-12 08:55:50 +00:00
|
|
|
DirOfExecutable + "\\..\\Data\\splash.bmp",
|
2003-09-05 08:22:06 +00:00
|
|
|
IMAGE_BITMAP,
|
|
|
|
|
0, 0,
|
|
|
|
|
LR_LOADFROMFILE );
|
2003-09-13 19:09:01 +00:00
|
|
|
SendMessage(
|
|
|
|
|
GetDlgItem(hWnd,IDC_SPLASH),
|
|
|
|
|
STM_SETIMAGE,
|
|
|
|
|
(WPARAM) IMAGE_BITMAP,
|
|
|
|
|
(LPARAM) (HANDLE) g_hBitmap );
|
2003-09-05 08:22:06 +00:00
|
|
|
break;
|
2003-09-13 19:09:01 +00:00
|
|
|
|
2003-09-05 08:22:06 +00:00
|
|
|
case WM_DESTROY:
|
|
|
|
|
DeleteObject( g_hBitmap );
|
|
|
|
|
g_hBitmap = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-18 21:37:58 +00:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LoadingWindow_Win32::LoadingWindow_Win32()
|
|
|
|
|
{
|
2002-12-16 02:08:58 +00:00
|
|
|
hwnd = CreateDialog(handle.Get(), MAKEINTRESOURCE(IDD_LOADING_DIALOG), NULL, WndProc);
|
2003-12-30 02:00:16 +00:00
|
|
|
for( unsigned i = 0; i < 3; ++i )
|
|
|
|
|
text[i] = "XXX"; /* always set on first call */
|
2002-11-18 21:37:58 +00:00
|
|
|
SetText("Initializing hardware...");
|
|
|
|
|
Paint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LoadingWindow_Win32::~LoadingWindow_Win32()
|
|
|
|
|
{
|
|
|
|
|
if(hwnd)
|
2003-03-14 22:47:42 +00:00
|
|
|
DestroyWindow( hwnd );
|
2002-11-18 21:37:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LoadingWindow_Win32::Paint()
|
|
|
|
|
{
|
|
|
|
|
SendMessage( hwnd, WM_PAINT, 0, 0 );
|
|
|
|
|
|
|
|
|
|
/* Process all queued messages since the last paint. This allows the window to
|
|
|
|
|
* come back if it loses focus during load. */
|
|
|
|
|
MSG msg;
|
|
|
|
|
while( PeekMessage( &msg, hwnd, 0, 0, PM_NOREMOVE ) ) {
|
|
|
|
|
GetMessage(&msg, hwnd, 0, 0 );
|
|
|
|
|
DispatchMessage( &msg );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LoadingWindow_Win32::SetText(CString str)
|
|
|
|
|
{
|
|
|
|
|
CStringArray asMessageLines;
|
|
|
|
|
split( str, "\n", asMessageLines, false );
|
2003-12-30 02:00:16 +00:00
|
|
|
while( asMessageLines.size() < 3 )
|
|
|
|
|
asMessageLines.push_back( "" );
|
|
|
|
|
|
|
|
|
|
const int msgs[] = { IDC_STATIC_MESSAGE1, IDC_STATIC_MESSAGE2, IDC_STATIC_MESSAGE3 };
|
|
|
|
|
for( unsigned i = 0; i < 3; ++i )
|
|
|
|
|
{
|
|
|
|
|
if( text[i] == asMessageLines[i] )
|
|
|
|
|
continue;
|
|
|
|
|
text[i] = asMessageLines[i];
|
2002-11-18 21:37:58 +00:00
|
|
|
|
2003-12-30 02:00:16 +00:00
|
|
|
SendDlgItemMessage( hwnd, msgs[i], WM_SETTEXT, 0,
|
|
|
|
|
(LPARAM)asMessageLines[i].c_str());
|
|
|
|
|
}
|
2002-11-18 21:37:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2003-12-30 02:00:16 +00:00
|
|
|
* Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
|
2002-11-18 21:37:58 +00:00
|
|
|
*
|
|
|
|
|
* Chris Danford
|
|
|
|
|
* Glenn Maynard
|
|
|
|
|
*/
|