Unicodification and typesafe interfaces.

oldstable
Dimitrie O. Paun 2005-03-14 10:09:24 +00:00 committed by Alexandre Julliard
parent 232760ded0
commit 5294ba5816
1 changed files with 139 additions and 137 deletions

View File

@ -3,7 +3,8 @@
* Animation control
*
* Copyright 1998, 1999 Eric Kohl
* 1999 Eric Pouech
* Copyright 1999 Eric Pouech
* Copyright 2005 Dimitrie O. Paun
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -86,23 +87,23 @@ typedef struct
HBITMAP hbmPrevFrame;
} ANIMATE_INFO;
#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0))
#define ANIMATE_COLOR_NONE 0xffffffff
static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
static void ANIMATE_Notify(ANIMATE_INFO *infoPtr, UINT notif)
{
SendMessageA(infoPtr->hwndNotify, WM_COMMAND,
SendMessageW(infoPtr->hwndNotify, WM_COMMAND,
MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif),
(LPARAM)infoPtr->hwndSelf);
}
static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName)
static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPWSTR lpName)
{
static const WCHAR aviW[] = { 'A', 'V', 'I', 0 };
HRSRC hrsrc;
MMIOINFO mminfo;
LPVOID lpAvi;
hrsrc = FindResourceA(hInst, lpName, "AVI");
hrsrc = FindResourceW(hInst, lpName, aviW);
if (!hrsrc)
return FALSE;
@ -118,8 +119,9 @@ static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpNam
mminfo.fccIOProc = FOURCC_MEM;
mminfo.pchBuffer = (LPSTR)lpAvi;
mminfo.cchBuffer = SizeofResource(hInst, hrsrc);
infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ);
if (!infoPtr->hMMio) {
infoPtr->hMMio = mmioOpenW(NULL, &mminfo, MMIO_READ);
if (!infoPtr->hMMio)
{
FreeResource(infoPtr->hRes);
return FALSE;
}
@ -128,19 +130,15 @@ static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpNam
}
static BOOL ANIMATE_LoadFileA(ANIMATE_INFO *infoPtr, LPSTR lpName)
static BOOL ANIMATE_LoadFileW(ANIMATE_INFO *infoPtr, LPWSTR lpName)
{
infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL,
MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
infoPtr->hMMio = mmioOpenW(lpName, 0, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
if (!infoPtr->hMMio)
return FALSE;
return TRUE;
return (BOOL)infoPtr->hMMio;
}
static LRESULT ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
{
EnterCriticalSection(&infoPtr->cs);
@ -206,9 +204,6 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
DeleteObject(infoPtr->hbmPrevFrame);
infoPtr->hbmPrevFrame = 0;
}
infoPtr->indata = infoPtr->outdata = NULL;
infoPtr->hwndSelf = 0;
infoPtr->hMMio = 0;
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
@ -217,7 +212,7 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
infoPtr->transparentColor = ANIMATE_COLOR_NONE;
}
static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource)
static void ANIMATE_TransparentBlt(ANIMATE_INFO *infoPtr, HDC hdcDest, HDC hdcSource)
{
HDC hdcMask;
HBITMAP hbmMask;
@ -249,7 +244,7 @@ static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSo
DeleteDC(hdcMask);
}
static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
static BOOL ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
{
void* pBitmapData = NULL;
LPBITMAPINFO pBitmapInfo = NULL;
@ -302,7 +297,7 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
infoPtr->transparentColor = GetPixel(hdcMem,0,0);
}
if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
{
HDC hdcFinal = CreateCompatibleDC(hDC);
HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
@ -327,7 +322,7 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
infoPtr->hbmPrevFrame = hbmFinal;
}
if (GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER)
if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER)
{
RECT rect;
@ -342,7 +337,7 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
return TRUE;
}
static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr)
{
HDC hDC;
@ -381,7 +376,7 @@ static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
{
ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_;
ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)ptr_;
HANDLE event;
DWORD timeout;
@ -400,10 +395,8 @@ static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
return TRUE;
}
static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WORD wTo)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
/* nothing opened */
if (!infoPtr->hMMio)
return FALSE;
@ -413,9 +406,9 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
return TRUE;
}
infoPtr->nFromFrame = (INT)LOWORD(lParam);
infoPtr->nToFrame = (INT)HIWORD(lParam);
infoPtr->nLoop = (INT)wParam;
infoPtr->nFromFrame = wFrom;
infoPtr->nToFrame = wTo;
infoPtr->nLoop = cRepeat;
if (infoPtr->nToFrame == 0xFFFF)
infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;
@ -429,24 +422,30 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
infoPtr->currFrame = infoPtr->nFromFrame;
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) {
if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_TIMER)
{
TRACE("Using a timer\n");
/* create a timer to display AVI */
infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
} else {
if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
infoPtr->uTimer = SetTimer(infoPtr->hwndSelf, 1,
infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
}
else
{
if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
{
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC, 0, (LPARAM)hWnd);
infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC, 0,
(LPARAM)infoPtr->hwndSelf);
}
TRACE("Using an animation thread\n");
infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL );
infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &infoPtr->threadId);
infoPtr->hThread = CreateThread(0, 0, ANIMATE_AnimationThread,
(LPVOID)infoPtr, 0, &infoPtr->threadId);
if(!infoPtr->hThread)
{
ERR("Could not create animation thread!\n");
return FALSE;
ERR("Could not create animation thread!\n");
return FALSE;
}
}
@ -597,10 +596,8 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
infoPtr->mah.dwTotalFrames * sizeof(DWORD));
if (!infoPtr->lpIndex) {
WARN("Can't alloc index array\n");
if (!infoPtr->lpIndex)
return FALSE;
}
numFrame = insize = 0;
while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
@ -621,16 +618,14 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
}
infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize);
if (!infoPtr->indata) {
WARN("Can't alloc input buffer\n");
if (!infoPtr->indata)
return FALSE;
}
return TRUE;
}
static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
{
DWORD outSize;
@ -654,22 +649,19 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
(DWORD)infoPtr->inbih, 0L);
infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize);
if (!infoPtr->outbih) {
WARN("Can't alloc output BIH\n");
if (!infoPtr->outbih)
return FALSE;
}
if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
(DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize) {
(DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize)
{
WARN("Can't get output BIH\n");
return FALSE;
}
infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage);
if (!infoPtr->outdata) {
WARN("Can't alloc output buffer\n");
if (!infoPtr->outdata)
return FALSE;
}
if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
(DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
@ -680,74 +672,92 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
return TRUE;
}
static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam)
static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lpszName)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
HINSTANCE hInstance = (HINSTANCE)wParam;
ANIMATE_Free(infoPtr);
infoPtr->hwndSelf = hWnd;
if (!lParam) {
if (!lpszName)
{
TRACE("Closing avi!\n");
/* installer of thebat! v1.62 requires FALSE here */
return (infoPtr->hMMio != 0);
}
if (!hInstance)
hInstance = (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE);
hInstance = (HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE);
if (HIWORD(lParam)) {
TRACE("(\"%s\");\n", (LPSTR)lParam);
if (HIWORD(lpszName))
{
TRACE("(\"%s\");\n", debugstr_w(lpszName));
if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) {
if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName))
{
TRACE("No AVI resource found!\n");
if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) {
if (!ANIMATE_LoadFileW(infoPtr, lpszName))
{
WARN("No AVI file found!\n");
return FALSE;
}
}
} else {
TRACE("(%u);\n", (WORD)LOWORD(lParam));
}
else
{
TRACE("(%u);\n", (WORD)(DWORD)lpszName);
if (!ANIMATE_LoadResA(infoPtr, hInstance,
MAKEINTRESOURCEA((INT)lParam))) {
if (!ANIMATE_LoadResW(infoPtr, hInstance, MAKEINTRESOURCEW((INT)lpszName)))
{
WARN("No AVI resource found!\n");
return FALSE;
}
}
if (!ANIMATE_GetAviInfo(infoPtr)) {
if (!ANIMATE_GetAviInfo(infoPtr))
{
WARN("Can't get AVI information\n");
ANIMATE_Free(infoPtr);
return FALSE;
}
if (!ANIMATE_GetAviCodec(infoPtr)) {
if (!ANIMATE_GetAviCodec(infoPtr))
{
WARN("Can't get AVI Codec\n");
ANIMATE_Free(infoPtr);
return FALSE;
}
if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
if (!GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER)
SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
}
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) {
return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1));
}
if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_AUTOPLAY)
return ANIMATE_Play(infoPtr, -1, 0, infoPtr->mah.dwTotalFrames - 1);
return TRUE;
}
/* << ANIMATE_Open32W >> */
static LRESULT ANIMATE_Stop(HWND hWnd, WPARAM wParam, LPARAM lParam)
static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpszName)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
LPWSTR lpwszName;
LRESULT result;
INT len;
if (!HIWORD(lpszName))
return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName);
len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0);
lpwszName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!lpwszName) return FALSE;
MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len);
result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName);
HeapFree(GetProcessHeap(), 0, lpwszName);
return result;
}
static BOOL ANIMATE_Stop(ANIMATE_INFO *infoPtr)
{
/* nothing opened */
if (!infoPtr->hMMio)
return FALSE;
@ -757,9 +767,10 @@ static LRESULT ANIMATE_Stop(HWND hWnd, WPARAM wParam, LPARAM lParam)
}
static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
static BOOL ANIMATE_Create(HWND hWnd, LPCREATESTRUCTW lpcs)
{
ANIMATE_INFO* infoPtr;
static const WCHAR msvfw32W[] = { 'm', 's', 'v', 'f', 'w', '3', '2', '.', 'd', 'l', 'l', 0 };
ANIMATE_INFO *infoPtr;
if (!fnIC.hModule) /* FIXME: not thread safe */
{
@ -768,7 +779,7 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
* - handle it by hand
* AJ wants the latter :-(
*/
fnIC.hModule = LoadLibraryA("msvfw32.dll");
fnIC.hModule = LoadLibraryW(msvfw32W);
if (!fnIC.hModule) return FALSE;
fnIC.fnICOpen = (void*)GetProcAddress(fnIC.hModule, "ICOpen");
@ -779,19 +790,16 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
/* allocate memory for info structure */
infoPtr = (ANIMATE_INFO *)Alloc(sizeof(ANIMATE_INFO));
if (!infoPtr) {
ERR("could not allocate info memory!\n");
return 0;
}
if (!infoPtr) return FALSE;
/* store crossref hWnd <-> info structure */
SetWindowLongPtrW(hWnd, 0, (DWORD_PTR)infoPtr);
infoPtr->hwndSelf = hWnd;
infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
infoPtr->hwndNotify = lpcs->hwndParent;
infoPtr->transparentColor = ANIMATE_COLOR_NONE;
infoPtr->hbmPrevFrame = 0;
TRACE("Animate style=0x%08lx, parent=%p\n", GetWindowLongA(hWnd, GWL_STYLE), infoPtr->hwndNotify);
TRACE("Animate style=0x%08lx, parent=%p\n", GetWindowLongW(hWnd, GWL_STYLE), infoPtr->hwndNotify);
InitializeCriticalSection(&infoPtr->cs);
@ -799,97 +807,91 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
}
static LRESULT ANIMATE_Destroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
/* free avi data */
ANIMATE_Free(infoPtr);
/* free animate info data */
SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
Free(infoPtr);
SetWindowLongPtrW(hWnd, 0, 0);
return 0;
}
static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam)
static BOOL ANIMATE_EraseBackground(ANIMATE_INFO *infoPtr, HDC hdc)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
RECT rect;
HBRUSH hBrush = 0;
if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
{
hBrush = (HBRUSH)SendMessageA(infoPtr->hwndNotify,WM_CTLCOLORSTATIC,
wParam, (LPARAM)hWnd);
hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
(WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
}
GetClientRect(hWnd, &rect);
FillRect((HDC)wParam, &rect, hBrush ? hBrush : GetCurrentObject((HDC)wParam, OBJ_BRUSH));
GetClientRect(infoPtr->hwndSelf, &rect);
FillRect(hdc, &rect, hBrush ? hBrush : GetCurrentObject(hdc, OBJ_BRUSH));
return TRUE;
}
static LRESULT WINAPI ANIMATE_Size(HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT WINAPI ANIMATE_Size(ANIMATE_INFO *infoPtr, INT flags, WORD width, WORD height)
{
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
InvalidateRect(hWnd, NULL, TRUE);
if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER)
{
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
}
return TRUE;
}
static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0);
TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam);
if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE))
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
if (!infoPtr && (uMsg != WM_NCCREATE))
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
switch (uMsg)
{
case ACM_OPENA:
return ANIMATE_OpenA(hWnd, wParam, lParam);
return ANIMATE_OpenA(infoPtr, (HINSTANCE)wParam, (LPSTR)lParam);
case ACM_OPENW:
FIXME("ACM_OPENW: stub!\n");
/* return ANIMATE_Open32W(hWnd, wParam, lParam); */
return 0;
return ANIMATE_OpenW(infoPtr, (HINSTANCE)wParam, (LPWSTR)lParam);
case ACM_PLAY:
return ANIMATE_Play(hWnd, wParam, lParam);
return ANIMATE_Play(infoPtr, (INT)wParam, LOWORD(lParam), HIWORD(lParam));
case ACM_STOP:
return ANIMATE_Stop(hWnd, wParam, lParam);
return ANIMATE_Stop(infoPtr);
case WM_NCCREATE:
return ANIMATE_Create(hWnd, wParam, lParam);
return ANIMATE_Create(hWnd, (LPCREATESTRUCTW)lParam);
case WM_NCHITTEST:
return HTTRANSPARENT;
case WM_DESTROY:
return ANIMATE_Destroy(hWnd, wParam, lParam);
return ANIMATE_Destroy(infoPtr);
case WM_ERASEBKGND:
return ANIMATE_EraseBackground(hWnd, wParam, lParam);
return ANIMATE_EraseBackground(infoPtr, (HDC)wParam);
/* case WM_STYLECHANGED: FIXME shall we do something ?? */
case WM_TIMER:
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
{
ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC,
wParam, (LPARAM)hWnd);
wParam, (LPARAM)infoPtr->hwndSelf);
}
return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));
return ANIMATE_DrawFrame(infoPtr);
case WM_PAINT:
{
ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
/* the animation isn't playing, or has not decompressed
* (and displayed) the first frame yet, don't paint
*/
@ -897,13 +899,13 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
!infoPtr->hbmPrevFrame)
{
/* default paint handling */
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC,
wParam, (LPARAM)hWnd);
wParam, (LPARAM)infoPtr->hwndSelf);
if (wParam)
{
@ -914,47 +916,47 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
else
{
PAINTSTRUCT ps;
HDC hDC = BeginPaint(hWnd, &ps);
HDC hDC = BeginPaint(infoPtr->hwndSelf, &ps);
EnterCriticalSection(&infoPtr->cs);
ANIMATE_PaintFrame(infoPtr, hDC);
LeaveCriticalSection(&infoPtr->cs);
EndPaint(hWnd, &ps);
EndPaint(infoPtr->hwndSelf, &ps);
}
}
break;
case WM_SIZE:
return ANIMATE_Size(hWnd, wParam, lParam);
return ANIMATE_Size(infoPtr, (INT)wParam, LOWORD(lParam), HIWORD(lParam));
default:
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
return 0;
}
void ANIMATE_Register(void)
{
WNDCLASSA wndClass;
WNDCLASSW wndClass;
ZeroMemory(&wndClass, sizeof(WNDCLASSA));
ZeroMemory(&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = ANIMATE_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(ANIMATE_INFO *);
wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
wndClass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = ANIMATE_CLASSA;
wndClass.lpszClassName = ANIMATE_CLASSW;
RegisterClassA(&wndClass);
RegisterClassW(&wndClass);
}
void ANIMATE_Unregister(void)
{
UnregisterClassA(ANIMATE_CLASSA, NULL);
UnregisterClassW(ANIMATE_CLASSW, NULL);
}