- Timestamp:
- Apr 29, 2001, 12:30:59 PM (24 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 3 added
- 3 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/animate.c
r5418 r5630 4 4 * 5 5 * Copyright 1998, 1999 Eric Kohl 6 * 6 * 1999 Eric Pouech 7 7 * 8 8 * NOTES … … 15 15 */ 16 16 17 17 #include <string.h> 18 18 #include "winbase.h" 19 19 #include "commctrl.h" 20 20 #include "vfw.h" 21 21 #include "mmsystem.h" 22 #include "services.h"23 22 #include "debugtools.h" 24 23 #ifdef __WIN32OS2__ … … 31 30 { 32 31 #ifdef __WIN32OS2__ 33 COMCTL32_HEADER header; 34 #endif 35 36 /* pointer to msvideo functions. it's easier to put them here. 37 * to be correct, they should be defined on a per process basis, but 38 * this would required a per process storage. We're using a per object 39 * storage instead, which is not efficient on memory usage, but 40 * will lead to less bugs in the future 41 */ 42 #ifdef __WIN32OS2__ 43 HIC (* WINAPI fnICOpen)(DWORD, DWORD, UINT); 44 LRESULT (* WINAPI fnICClose)(HIC); 45 LRESULT (* WINAPI fnICSendMessage)(HIC, UINT, DWORD, DWORD); 46 DWORD (* WINAPIV fnICDecompress)(HIC,DWORD,LPBITMAPINFOHEADER,LPVOID,LPBITMAPINFOHEADER,LPVOID); 47 48 HMMIO (* WINAPI fnmmioOpenA)(LPSTR,MMIOINFO*,DWORD); 49 HMMIO (* WINAPI fnmmioOpenW)(LPSTR,MMIOINFO*,DWORD); 50 MMRESULT (* WINAPI fnmmioClose)(HMMIO,UINT); 51 UINT (* WINAPI fnmmioAscend)(HMMIO,MMCKINFO*,UINT); 52 UINT (* WINAPI fnmmioDescend)(HMMIO,MMCKINFO*,const MMCKINFO*,UINT); 53 LONG (* WINAPI fnmmioSeek)(HMMIO,LONG,INT); 54 LONG (* WINAPI fnmmioRead)(HMMIO,HPSTR,LONG); 55 #else 56 HIC WINAPI (*fnICOpen)(DWORD, DWORD, UINT); 57 LRESULT WINAPI (*fnICClose)(HIC); 58 LRESULT WINAPI (*fnICSendMessage)(HIC, UINT, DWORD, DWORD); 59 DWORD WINAPIV (*fnICDecompress)(HIC,DWORD,LPBITMAPINFOHEADER,LPVOID,LPBITMAPINFOHEADER,LPVOID); 60 61 HMMIO WINAPI (*fnmmioOpenA)(LPSTR,MMIOINFO*,DWORD); 62 MMRESULT WINAPI (*fnmmioClose)(HMMIO,UINT); 63 UINT WINAPI (*fnmmioAscend)(HMMIO,MMCKINFO*,UINT); 64 UINT WINAPI (*fnmmioDescend)(HMMIO,MMCKINFO*,const MMCKINFO*,UINT); 65 LONG WINAPI (*fnmmioSeek)(HMMIO,LONG,INT); 66 LONG WINAPI (*fnmmioRead)(HMMIO,HPSTR,LONG); 67 #endif 68 32 COMCTL32_HEADER header; 33 #endif 69 34 /* reference to input stream (file or resource) */ 70 HGLOBAL 71 HMMIO hMMio;/* handle to mmio stream */72 HWND 35 HGLOBAL hRes; 36 HMMIO hMMio; /* handle to mmio stream */ 37 HWND hWnd; 73 38 /* information on the loaded AVI file */ 74 MainAVIHeader 75 AVIStreamHeader 76 LPBITMAPINFOHEADER 77 LPDWORD 39 MainAVIHeader mah; 40 AVIStreamHeader ash; 41 LPBITMAPINFOHEADER inbih; 42 LPDWORD lpIndex; 78 43 /* data for the decompressor */ 79 HIC 80 LPBITMAPINFOHEADER 81 LPVOID 82 LPVOID 44 HIC hic; 45 LPBITMAPINFOHEADER outbih; 46 LPVOID indata; 47 LPVOID outdata; 83 48 /* data for the background mechanism */ 84 CRITICAL_SECTION 85 HANDLE 86 UINT 49 CRITICAL_SECTION cs; 50 HANDLE hThread; 51 UINT uTimer; 87 52 /* data for playing the file */ 88 int 89 int 90 int 91 int 53 int nFromFrame; 54 int nToFrame; 55 int nLoop; 56 int currFrame; 92 57 /* tranparency info*/ 93 COLORREF transparentColor;94 HBRUSH 95 HBITMAP 58 COLORREF transparentColor; 59 HBRUSH hbrushBG; 60 HBITMAP hbmPrevFrame; 96 61 } ANIMATE_INFO; 97 62 98 63 #define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongA(hWnd, 0)) 99 #define ANIMATE_COLOR_NONE 0xffffffff 100 101 HMODULE hModWinmm; 64 #define ANIMATE_COLOR_NONE 0xffffffff 102 65 103 66 static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif) 104 67 { 105 SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND, 106 MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif), 107 68 SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND, 69 MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif), 70 (LPARAM)infoPtr->hWnd); 108 71 } 109 72 … … 114 77 #endif 115 78 { 116 HRSRC 117 MMIOINFO 118 LPVOID 119 79 HRSRC hrsrc; 80 MMIOINFO mminfo; 81 LPVOID lpAvi; 82 120 83 #ifdef __WIN32OS2__ 121 84 if (unicode) … … 127 90 #endif 128 91 if (!hrsrc) 129 130 92 return FALSE; 93 131 94 infoPtr->hRes = LoadResource(hInst, hrsrc); 132 95 if (!infoPtr->hRes) 133 134 96 return FALSE; 97 135 98 lpAvi = LockResource(infoPtr->hRes); 136 99 if (!lpAvi) 137 138 100 return FALSE; 101 139 102 memset(&mminfo, 0, sizeof(mminfo)); 140 103 mminfo.fccIOProc = FOURCC_MEM; 141 104 mminfo.pchBuffer = (LPSTR)lpAvi; 142 105 mminfo.cchBuffer = SizeofResource(hInst, hrsrc); 143 infoPtr->hMMio = infoPtr->fnmmioOpenA(NULL, &mminfo, MMIO_READ); 144 106 infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ); 145 107 if (!infoPtr->hMMio) { 146 147 108 GlobalFree((HGLOBAL)lpAvi); 109 return FALSE; 148 110 } 149 111 … … 160 122 #ifdef __WIN32OS2__ 161 123 if (unicode) 162 infoPtr->hMMio = infoPtr->fnmmioOpenW(lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);124 infoPtr->hMMio = mmioOpenW(lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); 163 125 else 164 infoPtr->hMMio = infoPtr->fnmmioOpenA((LPSTR)lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);126 infoPtr->hMMio = mmioOpenA((LPSTR)lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); 165 127 #else 166 infoPtr->hMMio = infoPtr->fnmmioOpenA((LPSTR)lpName, NULL, 167 MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); 168 #endif 169 128 infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL, 129 MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); 130 #endif 170 131 if (!infoPtr->hMMio) 171 172 132 return FALSE; 133 173 134 return TRUE; 174 135 } … … 180 141 181 142 /* should stop playing */ 182 if (infoPtr->hThread) 143 if (infoPtr->hThread) 183 144 { 184 145 if (!TerminateThread(infoPtr->hThread,0)) 185 146 WARN("could not destroy animation thread!\n"); 186 147 infoPtr->hThread = 0; 187 148 } 188 149 if (infoPtr->uTimer) { 189 190 150 KillTimer(infoPtr->hWnd, infoPtr->uTimer); 151 infoPtr->uTimer = 0; 191 152 } 192 153 … … 202 163 { 203 164 if (infoPtr->hMMio) { 204 205 infoPtr->fnmmioClose(infoPtr->hMMio, 0);206 207 208 209 210 211 212 213 214 215 (infoPtr->fnICClose)(infoPtr->hic);216 217 218 219 220 221 222 223 224 225 165 ANIMATE_DoStop(infoPtr); 166 mmioClose(infoPtr->hMMio, 0); 167 if (infoPtr->hRes) { 168 FreeResource(infoPtr->hRes); 169 infoPtr->hRes = 0; 170 } 171 if (infoPtr->lpIndex) { 172 HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex); 173 infoPtr->lpIndex = NULL; 174 } 175 if (infoPtr->hic) { 176 ICClose(infoPtr->hic); 177 infoPtr->hic = 0; 178 } 179 if (infoPtr->inbih) { 180 HeapFree(GetProcessHeap(), 0, infoPtr->inbih); 181 infoPtr->inbih = NULL; 182 } 183 if (infoPtr->outbih) { 184 HeapFree(GetProcessHeap(), 0, infoPtr->outbih); 185 infoPtr->outbih = NULL; 186 } 226 187 if( infoPtr->indata ) 227 188 { 228 189 HeapFree(GetProcessHeap(), 0, infoPtr->indata); 229 190 infoPtr->indata = NULL; 230 191 } 231 192 if( infoPtr->outdata ) 232 193 { 233 194 HeapFree(GetProcessHeap(), 0, infoPtr->outdata); 234 195 infoPtr->outdata = NULL; 235 196 } 236 197 if( infoPtr->hbmPrevFrame ) 237 198 { 238 199 DeleteObject(infoPtr->hbmPrevFrame); 239 200 infoPtr->hbmPrevFrame = 0; 240 201 } 241 242 243 244 245 246 247 248 } 249 infoPtr->transparentColor = ANIMATE_COLOR_NONE; 202 infoPtr->indata = infoPtr->outdata = NULL; 203 infoPtr->hWnd = 0; 204 infoPtr->hMMio = 0; 205 206 memset(&infoPtr->mah, 0, sizeof(infoPtr->mah)); 207 memset(&infoPtr->ash, 0, sizeof(infoPtr->ash)); 208 infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0; 209 } 210 infoPtr->transparentColor = ANIMATE_COLOR_NONE; 250 211 } 251 212 252 213 static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource) 253 { 214 { 254 215 HDC hdcMask; 255 216 HBITMAP hbmMask; 256 HBITMAP hbmOld; 257 217 HBITMAP hbmOld; 218 258 219 /* create a transparency mask */ 259 220 hdcMask = CreateCompatibleDC(hdcDest); 260 hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL); 261 hbmOld = SelectObject(hdcMask, hbmMask); 221 hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL); 222 hbmOld = SelectObject(hdcMask, hbmMask); 262 223 263 224 SetBkColor(hdcSource,infoPtr->transparentColor); 264 225 BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY); 265 226 266 227 /* mask the source bitmap */ 267 SetBkColor(hdcSource, RGB(0,0,0)); 268 SetTextColor(hdcSource, RGB(255,255,255)); 228 SetBkColor(hdcSource, RGB(0,0,0)); 229 SetTextColor(hdcSource, RGB(255,255,255)); 269 230 BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND); 270 231 271 232 /* mask the destination bitmap */ 272 SetBkColor(hdcDest, RGB(255,255,255)); 273 SetTextColor(hdcDest, RGB(0,0,0)); 233 SetBkColor(hdcDest, RGB(255,255,255)); 234 SetTextColor(hdcDest, RGB(0,0,0)); 274 235 BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND); 275 236 … … 297 258 298 259 if (!hDC || !infoPtr->inbih) 299 260 return TRUE; 300 261 301 262 if (infoPtr->hic ) … … 305 266 306 267 nWidth = infoPtr->outbih->biWidth; 307 nHeight = infoPtr->outbih->biHeight; 268 nHeight = infoPtr->outbih->biHeight; 308 269 } else 309 { 270 { 310 271 pBitmapData = infoPtr->indata; 311 272 pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih; 312 273 313 274 nWidth = infoPtr->inbih->biWidth; 314 nHeight = infoPtr->inbih->biHeight; 315 } 275 nHeight = infoPtr->inbih->biHeight; 276 } 316 277 317 278 if(!infoPtr->hbmPrevFrame) … … 320 281 } 321 282 322 SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS); 323 283 SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS); 284 324 285 hdcMem = CreateCompatibleDC(hDC); 325 286 hbmOld = SelectObject(hdcMem, infoPtr->hbmPrevFrame); 326 287 327 /* 328 * we need to get the transparent color even without ACS_TRANSPARENT, 288 /* 289 * we need to get the transparent color even without ACS_TRANSPARENT, 329 290 * because the style can be changed later on and the color should always 330 * be obtained in the first frame 291 * be obtained in the first frame 331 292 */ 332 293 if(infoPtr->transparentColor == ANIMATE_COLOR_NONE) 333 294 { 334 295 infoPtr->transparentColor = GetPixel(hdcMem,0,0); 335 } 336 337 if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 338 { 296 } 297 298 if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 299 { 339 300 HDC hdcFinal = CreateCompatibleDC(hDC); 340 301 HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight); 341 302 HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal); 342 303 RECT rect; 343 304 344 305 rect.left = 0; 345 306 rect.top = 0; 346 307 rect.right = nWidth; 347 308 rect.bottom = nHeight; 348 309 349 310 if(!infoPtr->hbrushBG) 350 311 infoPtr->hbrushBG = GetCurrentObject(hDC, OBJ_BRUSH); … … 359 320 infoPtr->hbmPrevFrame = hbmFinal; 360 321 } 361 362 if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER) 322 323 if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER) 363 324 { 364 RECT rect; 325 RECT rect; 365 326 366 327 GetWindowRect(infoPtr->hWnd, &rect); 367 nOffsetX = ((rect.right - rect.left) - nWidth)/2; 368 nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; 369 } 370 BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY); 328 nOffsetX = ((rect.right - rect.left) - nWidth)/2; 329 nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; 330 } 331 BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY); 371 332 372 333 SelectObject(hdcMem, hbmOld); … … 377 338 static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr) 378 339 { 379 HDC 340 HDC hDC; 380 341 381 342 TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop); … … 383 344 EnterCriticalSection(&infoPtr->cs); 384 345 385 infoPtr->fnmmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);386 infoPtr->fnmmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);387 346 mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET); 347 mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize); 348 388 349 if (infoPtr->hic && 389 (infoPtr->fnICDecompress)(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, 390 infoPtr->outbih, infoPtr->outdata) != ICERR_OK) { 350 ICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, 351 infoPtr->outbih, infoPtr->outdata) != ICERR_OK) { 352 LeaveCriticalSection(&infoPtr->cs); 353 WARN("Decompression error\n"); 354 return FALSE; 355 } 356 357 if ((hDC = GetDC(infoPtr->hWnd)) != 0) { 358 ANIMATE_PaintFrame(infoPtr, hDC); 359 ReleaseDC(infoPtr->hWnd, hDC); 360 } 361 362 if (infoPtr->currFrame++ >= infoPtr->nToFrame) { 363 infoPtr->currFrame = infoPtr->nFromFrame; 364 if (infoPtr->nLoop != -1) { 365 if (--infoPtr->nLoop == 0) { 366 ANIMATE_DoStop(infoPtr); 367 } 368 } 369 } 391 370 LeaveCriticalSection(&infoPtr->cs); 392 WARN("Decompression error\n");393 return FALSE;394 }395 396 if ((hDC = GetDC(infoPtr->hWnd)) != 0) {397 ANIMATE_PaintFrame(infoPtr, hDC);398 ReleaseDC(infoPtr->hWnd, hDC);399 }400 401 if (infoPtr->currFrame++ >= infoPtr->nToFrame) {402 infoPtr->currFrame = infoPtr->nFromFrame;403 if (infoPtr->nLoop != -1) {404 if (--infoPtr->nLoop == 0) {405 ANIMATE_DoStop(infoPtr);406 }407 }408 }409 LeaveCriticalSection(&infoPtr->cs);410 371 411 372 return TRUE; … … 414 375 static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_) 415 376 { 416 ANIMATE_INFO* 377 ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_; 417 378 HDC hDC; 418 379 419 380 if(!infoPtr) 420 381 { … … 424 385 425 386 while(1) 426 { 427 if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 387 { 388 if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 428 389 { 429 390 hDC = GetDC(infoPtr->hWnd); 391 /* sometimes the animation window will be destroyed in between 392 * by the main program, so a ReleaseDC() error msg is possible */ 430 393 infoPtr->hbrushBG = SendMessageA(GetParent(infoPtr->hWnd),WM_CTLCOLORSTATIC,hDC, infoPtr->hWnd); 431 394 ReleaseDC(infoPtr->hWnd,hDC); 432 395 } 433 434 EnterCriticalSection(&infoPtr->cs);435 ANIMATE_DrawFrame(infoPtr);436 LeaveCriticalSection(&infoPtr->cs);437 396 397 EnterCriticalSection(&infoPtr->cs); 398 ANIMATE_DrawFrame(infoPtr); 399 LeaveCriticalSection(&infoPtr->cs); 400 438 401 /* time is in microseconds, we should convert it to milliseconds */ 439 402 Sleep((infoPtr->mah.dwMicroSecPerFrame+500)/1000); 440 }403 } 441 404 return TRUE; 442 405 } … … 448 411 /* nothing opened */ 449 412 if (!infoPtr->hMMio) 450 413 return FALSE; 451 414 452 415 if (infoPtr->hThread || infoPtr->uTimer) { 453 454 416 FIXME("Already playing ? what should I do ??\n"); 417 ANIMATE_DoStop(infoPtr); 455 418 } 456 419 … … 460 423 461 424 if (infoPtr->nToFrame == 0xFFFF) 462 463 464 TRACE("(repeat=%d from=%d to=%d);\n", 465 425 infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1; 426 427 TRACE("(repeat=%d from=%d to=%d);\n", 428 infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame); 466 429 467 430 if (infoPtr->nFromFrame >= infoPtr->nToFrame || 468 469 431 infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames) 432 return FALSE; 470 433 471 434 infoPtr->currFrame = infoPtr->nFromFrame; 472 435 473 436 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) { 474 475 476 437 TRACE("Using a timer\n"); 438 /* create a timer to display AVI */ 439 infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL); 477 440 } else { 478 441 DWORD threadID; 479 442 480 443 TRACE("Using an animation thread\n"); 481 444 infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr,0,0 &threadID); 482 445 if(!infoPtr->hThread) … … 485 448 return FALSE; 486 449 } 487 488 } 489 450 451 } 452 490 453 ANIMATE_Notify(infoPtr, ACN_START); 491 454 … … 496 459 static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) 497 460 { 498 MMCKINFO 499 MMCKINFO 500 MMCKINFO 501 MMCKINFO 502 DWORD 503 DWORD 504 505 if ( infoPtr->fnmmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {506 507 461 MMCKINFO ckMainRIFF; 462 MMCKINFO mmckHead; 463 MMCKINFO mmckList; 464 MMCKINFO mmckInfo; 465 DWORD numFrame; 466 DWORD insize; 467 468 if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) { 469 WARN("Can't find 'RIFF' chunk\n"); 470 return FALSE; 508 471 } 509 472 510 473 if ((ckMainRIFF.ckid != FOURCC_RIFF) || 511 512 513 474 (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) { 475 WARN("Can't find 'AVI ' chunk\n"); 476 return FALSE; 514 477 } 515 478 516 479 mmckHead.fccType = mmioFOURCC('h', 'd', 'r', 'l'); 517 if ( infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {518 519 480 if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) { 481 WARN("Can't find 'hdrl' list\n"); 482 return FALSE; 520 483 } 521 484 522 485 mmckInfo.ckid = mmioFOURCC('a', 'v', 'i', 'h'); 523 if (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) { 524 WARN("Can't find 'avih' chunk\n"); 525 return FALSE; 526 } 527 528 infoPtr->fnmmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah)); 529 TRACE("mah.dwMicroSecPerFrame=%ld\n", infoPtr->mah.dwMicroSecPerFrame); 530 TRACE("mah.dwMaxBytesPerSec=%ld\n", infoPtr->mah.dwMaxBytesPerSec); 531 TRACE("mah.dwPaddingGranularity=%ld\n", infoPtr->mah.dwPaddingGranularity); 532 TRACE("mah.dwFlags=%ld\n", infoPtr->mah.dwFlags); 533 TRACE("mah.dwTotalFrames=%ld\n", infoPtr->mah.dwTotalFrames); 534 TRACE("mah.dwInitialFrames=%ld\n", infoPtr->mah.dwInitialFrames); 535 TRACE("mah.dwStreams=%ld\n", infoPtr->mah.dwStreams); 536 TRACE("mah.dwSuggestedBufferSize=%ld\n", infoPtr->mah.dwSuggestedBufferSize); 537 TRACE("mah.dwWidth=%ld\n", infoPtr->mah.dwWidth); 538 TRACE("mah.dwHeight=%ld\n", infoPtr->mah.dwHeight); 539 infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckInfo, 0); 486 if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) { 487 WARN("Can't find 'avih' chunk\n"); 488 return FALSE; 489 } 490 491 mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah)); 492 493 TRACE("mah.dwMicroSecPerFrame=%ld\n", infoPtr->mah.dwMicroSecPerFrame); 494 TRACE("mah.dwMaxBytesPerSec=%ld\n", infoPtr->mah.dwMaxBytesPerSec); 495 TRACE("mah.dwPaddingGranularity=%ld\n", infoPtr->mah.dwPaddingGranularity); 496 TRACE("mah.dwFlags=%ld\n", infoPtr->mah.dwFlags); 497 TRACE("mah.dwTotalFrames=%ld\n", infoPtr->mah.dwTotalFrames); 498 TRACE("mah.dwInitialFrames=%ld\n", infoPtr->mah.dwInitialFrames); 499 TRACE("mah.dwStreams=%ld\n", infoPtr->mah.dwStreams); 500 TRACE("mah.dwSuggestedBufferSize=%ld\n", infoPtr->mah.dwSuggestedBufferSize); 501 TRACE("mah.dwWidth=%ld\n", infoPtr->mah.dwWidth); 502 TRACE("mah.dwHeight=%ld\n", infoPtr->mah.dwHeight); 503 504 mmioAscend(infoPtr->hMMio, &mmckInfo, 0); 540 505 541 506 mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l'); 542 if ( infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {543 544 507 if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) { 508 WARN("Can't find 'strl' list\n"); 509 return FALSE; 545 510 } 546 511 547 512 mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'h'); 548 if (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) { 549 WARN("Can't find 'strh' chunk\n"); 550 return FALSE; 551 } 552 553 infoPtr->fnmmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash)); 554 TRACE("ash.fccType='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccType)), 555 HIBYTE(LOWORD(infoPtr->ash.fccType)), 556 LOBYTE(HIWORD(infoPtr->ash.fccType)), 557 HIBYTE(HIWORD(infoPtr->ash.fccType))); 558 TRACE("ash.fccHandler='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccHandler)), 559 HIBYTE(LOWORD(infoPtr->ash.fccHandler)), 560 LOBYTE(HIWORD(infoPtr->ash.fccHandler)), 561 HIBYTE(HIWORD(infoPtr->ash.fccHandler))); 562 TRACE("ash.dwFlags=%ld\n", infoPtr->ash.dwFlags); 563 TRACE("ash.wPriority=%d\n", infoPtr->ash.wPriority); 564 TRACE("ash.wLanguage=%d\n", infoPtr->ash.wLanguage); 565 TRACE("ash.dwInitialFrames=%ld\n", infoPtr->ash.dwInitialFrames); 566 TRACE("ash.dwScale=%ld\n", infoPtr->ash.dwScale); 567 TRACE("ash.dwRate=%ld\n", infoPtr->ash.dwRate); 568 TRACE("ash.dwStart=%ld\n", infoPtr->ash.dwStart); 569 TRACE("ash.dwLength=%ld\n", infoPtr->ash.dwLength); 570 TRACE("ash.dwSuggestedBufferSize=%ld\n", infoPtr->ash.dwSuggestedBufferSize); 571 TRACE("ash.dwQuality=%ld\n", infoPtr->ash.dwQuality); 572 TRACE("ash.dwSampleSize=%ld\n", infoPtr->ash.dwSampleSize); 573 TRACE("ash.rcFrame=(%d,%d,%d,%d)\n", infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left, 574 infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right); 575 infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckInfo, 0); 513 if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) { 514 WARN("Can't find 'strh' chunk\n"); 515 return FALSE; 516 } 517 518 mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash)); 519 520 TRACE("ash.fccType='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccType)), 521 HIBYTE(LOWORD(infoPtr->ash.fccType)), 522 LOBYTE(HIWORD(infoPtr->ash.fccType)), 523 HIBYTE(HIWORD(infoPtr->ash.fccType))); 524 TRACE("ash.fccHandler='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccHandler)), 525 HIBYTE(LOWORD(infoPtr->ash.fccHandler)), 526 LOBYTE(HIWORD(infoPtr->ash.fccHandler)), 527 HIBYTE(HIWORD(infoPtr->ash.fccHandler))); 528 TRACE("ash.dwFlags=%ld\n", infoPtr->ash.dwFlags); 529 TRACE("ash.wPriority=%d\n", infoPtr->ash.wPriority); 530 TRACE("ash.wLanguage=%d\n", infoPtr->ash.wLanguage); 531 TRACE("ash.dwInitialFrames=%ld\n", infoPtr->ash.dwInitialFrames); 532 TRACE("ash.dwScale=%ld\n", infoPtr->ash.dwScale); 533 TRACE("ash.dwRate=%ld\n", infoPtr->ash.dwRate); 534 TRACE("ash.dwStart=%ld\n", infoPtr->ash.dwStart); 535 TRACE("ash.dwLength=%ld\n", infoPtr->ash.dwLength); 536 TRACE("ash.dwSuggestedBufferSize=%ld\n", infoPtr->ash.dwSuggestedBufferSize); 537 TRACE("ash.dwQuality=%ld\n", infoPtr->ash.dwQuality); 538 TRACE("ash.dwSampleSize=%ld\n", infoPtr->ash.dwSampleSize); 539 TRACE("ash.rcFrame=(%d,%d,%d,%d)\n", infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left, 540 infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right); 541 542 mmioAscend(infoPtr->hMMio, &mmckInfo, 0); 576 543 577 544 mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'f'); 578 if ( infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {579 580 545 if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) { 546 WARN("Can't find 'strh' chunk\n"); 547 return FALSE; 581 548 } 582 549 583 550 infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize); 584 551 if (!infoPtr->inbih) { 585 WARN("Can't alloc input BIH\n"); 586 return FALSE; 587 } 588 589 infoPtr->fnmmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize); 590 TRACE("bih.biSize=%ld\n", infoPtr->inbih->biSize); 591 TRACE("bih.biWidth=%ld\n", infoPtr->inbih->biWidth); 592 TRACE("bih.biHeight=%ld\n", infoPtr->inbih->biHeight); 593 TRACE("bih.biPlanes=%d\n", infoPtr->inbih->biPlanes); 594 TRACE("bih.biBitCount=%d\n", infoPtr->inbih->biBitCount); 595 TRACE("bih.biCompression=%ld\n", infoPtr->inbih->biCompression); 596 TRACE("bih.biSizeImage=%ld\n", infoPtr->inbih->biSizeImage); 597 TRACE("bih.biXPelsPerMeter=%ld\n", infoPtr->inbih->biXPelsPerMeter); 598 TRACE("bih.biYPelsPerMeter=%ld\n", infoPtr->inbih->biYPelsPerMeter); 599 TRACE("bih.biClrUsed=%ld\n", infoPtr->inbih->biClrUsed); 600 TRACE("bih.biClrImportant=%ld\n", infoPtr->inbih->biClrImportant); 601 infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckInfo, 0); 602 603 infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckList, 0); 604 552 WARN("Can't alloc input BIH\n"); 553 return FALSE; 554 } 555 556 mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize); 557 558 TRACE("bih.biSize=%ld\n", infoPtr->inbih->biSize); 559 TRACE("bih.biWidth=%ld\n", infoPtr->inbih->biWidth); 560 TRACE("bih.biHeight=%ld\n", infoPtr->inbih->biHeight); 561 TRACE("bih.biPlanes=%d\n", infoPtr->inbih->biPlanes); 562 TRACE("bih.biBitCount=%d\n", infoPtr->inbih->biBitCount); 563 TRACE("bih.biCompression=%ld\n", infoPtr->inbih->biCompression); 564 TRACE("bih.biSizeImage=%ld\n", infoPtr->inbih->biSizeImage); 565 TRACE("bih.biXPelsPerMeter=%ld\n", infoPtr->inbih->biXPelsPerMeter); 566 TRACE("bih.biYPelsPerMeter=%ld\n", infoPtr->inbih->biYPelsPerMeter); 567 TRACE("bih.biClrUsed=%ld\n", infoPtr->inbih->biClrUsed); 568 TRACE("bih.biClrImportant=%ld\n", infoPtr->inbih->biClrImportant); 569 570 mmioAscend(infoPtr->hMMio, &mmckInfo, 0); 571 572 mmioAscend(infoPtr->hMMio, &mmckList, 0); 573 605 574 #if 0 606 575 /* an AVI has 0 or 1 video stream, and to be animated should not contain 607 * an audio stream, so only one strl is allowed 576 * an audio stream, so only one strl is allowed 608 577 */ 609 578 mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l'); 610 if ( infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {611 612 613 } 614 #endif 615 616 infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckHead, 0);579 if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) { 580 WARN("There should be a single 'strl' list\n"); 581 return FALSE; 582 } 583 #endif 584 585 mmioAscend(infoPtr->hMMio, &mmckHead, 0); 617 586 618 587 /* no need to read optional JUNK chunk */ 619 588 620 589 mmckList.fccType = mmioFOURCC('m', 'o', 'v', 'i'); 621 if ( infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {622 623 590 if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) { 591 WARN("Can't find 'movi' list\n"); 592 return FALSE; 624 593 } 625 594 626 595 /* FIXME: should handle the 'rec ' LIST when present */ 627 596 628 infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 629 597 infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 598 infoPtr->mah.dwTotalFrames * sizeof(DWORD)); 630 599 if (!infoPtr->lpIndex) { 631 632 600 WARN("Can't alloc index array\n"); 601 return FALSE; 633 602 } 634 603 635 604 numFrame = insize = 0; 636 while ( infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&637 638 639 640 641 642 infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckInfo, 0);605 while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 && 606 numFrame < infoPtr->mah.dwTotalFrames) { 607 infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset; 608 if (insize < mmckInfo.cksize) 609 insize = mmckInfo.cksize; 610 numFrame++; 611 mmioAscend(infoPtr->hMMio, &mmckInfo, 0); 643 612 } 644 613 if (numFrame != infoPtr->mah.dwTotalFrames) { 645 646 614 WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames); 615 return FALSE; 647 616 } 648 617 if (insize > infoPtr->ash.dwSuggestedBufferSize) { 649 650 618 WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize); 619 infoPtr->ash.dwSuggestedBufferSize = insize; 651 620 } 652 621 653 622 infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize); 654 623 if (!infoPtr->indata) { 655 656 624 WARN("Can't alloc input buffer\n"); 625 return FALSE; 657 626 } 658 627 … … 663 632 static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) 664 633 { 665 DWORD 634 DWORD outSize; 666 635 667 636 /* check uncompressed AVI */ … … 669 638 (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' '))) 670 639 { 671 infoPtr->hic = 0; 672 640 infoPtr->hic = 0; 641 return TRUE; 673 642 } 674 643 675 644 /* try to get a decompressor for that type */ 676 infoPtr->hic = (infoPtr->fnICOpen)(ICTYPE_VIDEO, 677 infoPtr->ash.fccHandler, 678 ICMODE_DECOMPRESS); 645 infoPtr->hic = ICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS); 679 646 if (!infoPtr->hic) { 680 681 682 } 683 684 outSize = (infoPtr->fnICSendMessage)(infoPtr->hic,685 ICM_DECOMPRESS_GET_FORMAT, 686 (DWORD)infoPtr->inbih, 0L); 647 WARN("Can't load codec for the file\n"); 648 return FALSE; 649 } 650 651 outSize = ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, 652 (DWORD)infoPtr->inbih, 0L); 653 687 654 infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize); 688 655 if (!infoPtr->outbih) { 689 WARN("Can't alloc output BIH\n"); 690 return FALSE; 691 } 692 693 if ((infoPtr->fnICSendMessage)(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, 694 (DWORD)infoPtr->inbih, 695 (DWORD)infoPtr->outbih) != ICERR_OK) { 696 WARN("Can't get output BIH\n"); 697 return FALSE; 656 WARN("Can't alloc output BIH\n"); 657 return FALSE; 658 } 659 660 if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, 661 (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { 662 WARN("Can't get output BIH\n"); 663 return FALSE; 698 664 } 699 665 700 666 infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage); 701 667 if (!infoPtr->outdata) { 702 WARN("Can't alloc output buffer\n"); 703 return FALSE; 704 } 705 706 if ((infoPtr->fnICSendMessage)(infoPtr->hic, ICM_DECOMPRESS_BEGIN, 707 (DWORD)infoPtr->inbih, 708 (DWORD)infoPtr->outbih) != ICERR_OK) { 709 WARN("Can't begin decompression\n"); 710 return FALSE; 668 WARN("Can't alloc output buffer\n"); 669 return FALSE; 670 } 671 672 if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, 673 (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { 674 WARN("Can't begin decompression\n"); 675 return FALSE; 711 676 } 712 677 … … 726 691 727 692 if (!lParam) { 728 729 730 } 731 693 TRACE("Closing avi!\n"); 694 return TRUE; 695 } 696 732 697 if (!hInstance) 733 698 hInstance = GetWindowLongA(hWnd, GWL_HINSTANCE); … … 738 703 739 704 if (!ANIMATE_LoadRes(infoPtr, hInstance, (LPWSTR)lParam,unicode)) { 740 //TRACE("No AVI resource found!\n");705 TRACE("No AVI resource found!\n"); 741 706 if (!ANIMATE_LoadFile(infoPtr, (LPWSTR)lParam,unicode)) { 742 //WARN("No AVI file found!\n");707 WARN("No AVI file found!\n"); 743 708 return FALSE; 744 709 } … … 748 713 749 714 if (!ANIMATE_LoadRes(infoPtr,hInstance,unicode ? MAKEINTRESOURCEW((INT)lParam):(LPWSTR)MAKEINTRESOURCEA((INT)lParam),unicode)) { 750 //WARN("No AVI resource found!\n");715 WARN("No AVI resource found!\n"); 751 716 return FALSE; 752 717 } … … 773 738 } 774 739 #endif 775 776 740 if (!ANIMATE_GetAviInfo(infoPtr)) { 777 778 779 741 WARN("Can't get AVI information\n"); 742 ANIMATE_Free(infoPtr); 743 return FALSE; 780 744 } 781 745 782 746 if (!ANIMATE_GetAviCodec(infoPtr)) { 783 784 785 747 WARN("Can't get AVI Codec\n"); 748 ANIMATE_Free(infoPtr); 749 return FALSE; 786 750 } 787 751 788 752 if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { 789 790 753 SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight, 754 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER); 791 755 } 792 756 793 757 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) { 794 758 return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1)); 795 759 } 796 760 … … 807 771 /* nothing opened */ 808 772 if (!infoPtr->hMMio) 809 773 return FALSE; 810 774 811 775 ANIMATE_DoStop(infoPtr); … … 816 780 static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam) 817 781 { 818 ANIMATE_INFO* infoPtr; 819 HMODULE hModule = LoadLibraryA("msvfw32.dll"); 820 821 if (!hModule) 822 return FALSE; 782 ANIMATE_INFO* infoPtr; 823 783 824 784 /* allocate memory for info structure */ … … 829 789 #endif 830 790 if (!infoPtr) { 831 ERR("could not allocate info memory!\n"); 832 return 0; 833 } 834 835 /* Temporary hack until we get dllglue up and running */ 836 infoPtr->fnICOpen = (void*)GetProcAddress(hModule, "ICOpen"); 837 infoPtr->fnICClose = (void*)GetProcAddress(hModule, "ICClose"); 838 infoPtr->fnICSendMessage = (void*)GetProcAddress(hModule, "ICSendMessage"); 839 infoPtr->fnICDecompress = (void*)GetProcAddress(hModule, "ICDecompress"); 791 ERR("could not allocate info memory!\n"); 792 return 0; 793 } 840 794 841 795 TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)GetParent(hWnd)); … … 846 800 infoPtr->transparentColor = ANIMATE_COLOR_NONE; 847 801 infoPtr->hbmPrevFrame = 0; 848 hModWinmm = LoadLibraryA("WINMM");849 850 infoPtr->fnmmioOpenA = (void*)GetProcAddress(hModWinmm, "mmioOpenA");851 #ifdef __WIN32OS2__852 infoPtr->fnmmioOpenW = (void*)GetProcAddress(hModWinmm, "mmioOpenW");853 #endif854 infoPtr->fnmmioClose = (void*)GetProcAddress(hModWinmm, "mmioClose");855 infoPtr->fnmmioAscend = (void*)GetProcAddress(hModWinmm, "mmioAscend");856 infoPtr->fnmmioDescend = (void*)GetProcAddress(hModWinmm, "mmioDescend");857 infoPtr->fnmmioSeek = (void*)GetProcAddress(hModWinmm, "mmioSeek");858 infoPtr->fnmmioRead = (void*)GetProcAddress(hModWinmm, "mmioRead");859 802 860 803 InitializeCriticalSection(&infoPtr->cs); 861 804 862 805 return 0; 863 806 } … … 876 819 SetWindowLongA(hWnd, 0, 0); 877 820 878 FreeLibrary(hModWinmm);879 821 return 0; 880 822 } … … 884 826 { 885 827 RECT rect; 886 HBRUSH hBrush = 0; 887 888 if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 828 HBRUSH hBrush = 0; 829 830 if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 889 831 { 890 hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd); 832 hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd); 891 833 } 892 834 … … 900 842 { 901 843 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { 902 844 InvalidateRect(hWnd, NULL, TRUE); 903 845 } 904 846 return TRUE; … … 909 851 TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam); 910 852 if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE)) 911 853 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 912 854 switch (uMsg) 913 855 { 914 856 #ifdef __WIN32OS2__ 915 916 917 918 919 857 case ACM_OPENA: 858 return ANIMATE_Open(hWnd,wParam,lParam,FALSE); 859 860 case ACM_OPENW: 861 return ANIMATE_Open(hWnd,wParam,lParam,TRUE); 920 862 #else 921 863 case ACM_OPENA: 922 923 924 /*case ACM_OPEN32W: FIXME!! */925 /*return ANIMATE_Open32W(hWnd, wParam, lParam); */926 #endif 927 864 return ANIMATE_OpenA(hWnd, wParam, lParam); 865 866 /* case ACM_OPEN32W: FIXME!! */ 867 /* return ANIMATE_Open32W(hWnd, wParam, lParam); */ 868 #endif 869 928 870 case ACM_PLAY: 929 930 871 return ANIMATE_Play(hWnd, wParam, lParam); 872 931 873 case ACM_STOP: 932 933 874 return ANIMATE_Stop(hWnd, wParam, lParam); 875 934 876 case WM_NCCREATE: 935 936 937 877 ANIMATE_Create(hWnd, wParam, lParam); 878 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 879 938 880 case WM_NCHITTEST: 939 881 return HTTRANSPARENT; 940 882 941 883 case WM_DESTROY: 942 943 944 884 ANIMATE_Destroy(hWnd, wParam, lParam); 885 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 886 945 887 case WM_ERASEBKGND: 946 947 948 949 /* 888 ANIMATE_EraseBackground(hWnd, wParam, lParam); 889 break; 890 891 /* case WM_STYLECHANGED: FIXME shall we do something ?? */ 950 892 951 893 case WM_TIMER: 952 894 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 953 895 { 954 896 ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); 955 897 infoPtr->hbrushBG = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd); 956 898 } 957 958 899 return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd)); 900 959 901 case WM_CLOSE: 960 961 902 ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd)); 903 return TRUE; 962 904 963 905 case WM_PAINT: 964 906 { 965 907 ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); 966 908 967 909 /* the animation isn't playing, don't paint */ 968 969 970 971 910 if(!infoPtr->uTimer && !infoPtr->hThread) 911 /* default paint handling */ 912 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 913 972 914 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 973 915 infoPtr->hbrushBG = SendMessageA(GetParent(hWnd), WM_CTLCOLORSTATIC, 974 975 916 (HDC)wParam, hWnd); 917 976 918 if (wParam) 977 919 { … … 982 924 else 983 925 { 984 985 926 PAINTSTRUCT ps; 927 HDC hDC = BeginPaint(hWnd, &ps); 986 928 987 929 EnterCriticalSection(&infoPtr->cs); 988 930 ANIMATE_PaintFrame(infoPtr, hDC); 989 931 LeaveCriticalSection(&infoPtr->cs); 990 991 EndPaint(hWnd, &ps); 932 933 EndPaint(hWnd, &ps); 934 } 992 935 } 993 } 994 break; 936 break; 995 937 996 938 case WM_SIZE: 997 998 939 ANIMATE_Size(hWnd, wParam, lParam); 940 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 999 941 1000 942 default: 1001 1002 1003 1004 #ifdef __WIN32OS2__ 1005 943 if (uMsg >= WM_USER) 944 ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); 945 946 #ifdef __WIN32OS2__ 947 return defComCtl32ProcA (hWnd, uMsg, wParam, lParam); 1006 948 #else 1007 949 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 1008 950 #endif 1009 951 } … … 1024 966 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); 1025 967 wndClass.lpszClassName = ANIMATE_CLASSA; 1026 968 1027 969 RegisterClassA(&wndClass); 1028 970 } -
trunk/src/comctl32/cctl_De.orc
r3972 r5630 1 1 LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT 2 2 3 IDD_PROPSHEET DIALOG DISCARDABLE 0,0,223,140 4 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE 5 CAPTION "Eigenschaften für:" 3 STRINGTABLE DISCARDABLE 4 { 5 IDS_CLOSE "Schließen" 6 } 7 8 STRINGTABLE DISCARDABLE 9 { 10 IDM_TODAY "Heute:" 11 IDM_GOTODAY "Gehe zu Heute" 12 } 13 14 STRINGTABLE DISCARDABLE 15 { 16 IDS_SEPARATOR "Trennzeichen" 17 } 18 19 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 20 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE 21 CAPTION "Eigenschaften für " 6 22 FONT 8, "MS Sans Serif" 7 23 BEGIN 8 DEFPUSHBUTTON "Ok",IDOK,4,122,50,14 9 PUSHBUTTON "Abbrechen",IDCANCEL,58,122,50,1410 PUSHBUTTON "Ubernehmen",IDC_APPLY_BUTTON,112,122,50,14 11 PUSHBUTTON "Hilfe",IDHELP,166,122,50,14, WS_TABSTOP | WS_GROUP 12 CONTROL "Tabstopp",IDC_TABCONTROL,"SysTabControl32", WS_CLIPSIBLINGS | WS_TABSTOP ,4,4,215,11424 DEFPUSHBUTTON "&OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP 25 PUSHBUTTON "A&bbrechen", IDCANCEL,58,122,50,14 26 PUSHBUTTON "&Anwenden", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED 27 PUSHBUTTON "&Hilfe", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP 28 CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP,4,4,212,114 13 29 END 14 30 15 31 16 IDD_WIZARD DIALOG DISCARDABLE 20,20,292,4617 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE 18 CAPTION " Assistent"32 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 33 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE 34 CAPTION "Wizard" 19 35 FONT 8, "MS Sans Serif" 20 36 BEGIN 21 DEFPUSHBUTTON "Fertig",IDC_FINISH_BUTTON,119,26,50,1422 DEFPUSHBUTTON "&Weiter >",IDC_NEXT_BUTTON,62,26,50,1423 PUSHBUTTON "< &Zurück",IDC_BACK_BUTTON,12,26,50,1424 PUSHBUTTON "Abbrechen",IDCANCEL,176,26,50,1425 PUSHBUTTON "Hilfe",IDHELP,233,26,50,14, WS_GROUP 26 LTEXT "",IDC_SUNKEN_LINE,7,17,276,1, SS_SUNKEN 27 CONTROL "Tabstopp",IDC_TABCONTROL,"SysTabControl32", WS_CLIPSIBLINGS | WS_DISABLED ,7,7,276,3 37 DEFPUSHBUTTON "&Beenden", IDC_FINISH_BUTTON,121,138,50,14 38 DEFPUSHBUTTON "&Weiter >", IDC_NEXT_BUTTON,121,138,50,14 39 PUSHBUTTON "< &Zurück", IDC_BACK_BUTTON,71,138,50,14 40 PUSHBUTTON "Abbrechen", IDCANCEL,178,138,50,14 41 PUSHBUTTON "&Hilfe", IDHELP,235,138,50,14,WS_GROUP 42 LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN 43 CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 28 44 END 29 45 30 46 31 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20,362,12532 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU 33 CAPTION " Symbolleiste anpassen"47 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 48 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU 49 CAPTION "Toolbar einrichten" 34 50 FONT 8, "MS Sans Serif" 35 51 BEGIN 36 DEFPUSHBUTTON "S&chließen",IDCANCEL,309,6,49,1437 PUSHBUTTON "Zurücksetzen",IDC_RESET_BTN,309,23,49,1438 PUSHBUTTON "&Hilfe",IDC_HELP_BTN,309,40,49,1439 PUSHBUTTON "Nach &oben",IDC_MOVEUP_BTN,309,74,49,1440 PUSHBUTTON "&Nach unten",IDC_MOVEDN_BTN,309,91,49,1441 LTEXT "&Verfügbare Schaltflächen:",-1,4,5,84,1042 LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP 43 PUSHBUTTON "Hinz&ufügen ->",IDOK,129,42,49,1444 PUSHBUTTON "<- &Entfernen",IDC_REMOVE_BTN,129,62,49,1445 LTEXT "&Schaltflächen auf Symbolleiste:",-1,183,5,101,1046 LISTBOX IDC_TOOLBARBTN_LBOX,183,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP 52 DEFPUSHBUTTON "&Schließen", IDCANCEL,308,6,44,14 53 PUSHBUTTON "&Zurücksetzen", IDC_RESET_BTN,308,23,44,14 54 PUSHBUTTON "&Hilfe", IDC_HELP_BTN,308,40,44,14 55 PUSHBUTTON "Nach &Oben verschieben", IDC_MOVEUP_BTN,308,74,44,14 56 PUSHBUTTON "Nach &Unten verschieben", IDC_MOVEDN_BTN,308,91,44,14 57 LTEXT "&Vorhandene Knöpfe:", -1,4,5,84,10 58 LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP 59 PUSHBUTTON "H&inzufügen ->", IDOK, 131, 42, 44, 14 60 PUSHBUTTON "<- &Löschen", IDC_REMOVE_BTN,131,62,44,14 61 LTEXT "&Toolbarknöpfe:", -1,182,5,78,10 62 LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP 47 63 END 48 64 … … 66 82 } 67 83 68 STRINGTABLE DISCARDABLE69 {70 IDS_CLOSE "Schließen"71 }72 84 -
trunk/src/comctl32/comboex.c
r5416 r5630 19 19 20 20 /* 21 * ComboBoxEx control v2 (mod 4)21 * ComboBoxEx control v2 (mod5) 22 22 * 23 23 * Copyright 1998, 1999 Eric Kohl … … 59 59 * 5. The LBN_SELCHANGE is just for documentation purposes. 60 60 * 61 * mod 5 62 * 1. Add support for CB_GETITEMDATA to a Comboex. Returns the LPARAM 63 * passed during insert of item. 64 * 2. Remember selected item and don't issue CB_SETCURSEL unless needed. 65 * 3. Add initial support for WM_NCCREATE to remove unwanted window styles 66 * (Currently just WS_VSCROLL and WS_HSCROLL, but probably should be 67 * more.) 68 * 4. Improve some traces. 69 * 5. Add support for CB_SETITEMDATA sets LPARAM value from item. 70 * 61 71 * Test vehicals were the ControlSpy modules (rebar.exe and comboboxex.exe), 62 * and IE 4.0.72 * WinRAR, and IE 4.0. 63 73 * 64 74 */ … … 69 79 #include "debugtools.h" 70 80 #include "wine/unicode.h" 71 72 81 #ifdef __WIN32OS2__ 73 82 #include "ccbase.h" … … 109 118 WNDPROC prevComboWndProc; /* previous Combo WNDPROC value */ 110 119 DWORD dwExtStyle; 120 INT selected; /* index of selected item */ 111 121 DWORD flags; /* WINE internal flags */ 112 122 HFONT font; … … 882 892 883 893 static LRESULT 894 COMBOEX_GetItemData (HWND hwnd, WPARAM wParam, LPARAM lParam) 895 { 896 INT index = wParam; 897 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 898 CBE_ITEMDATA *item1, *item2; 899 LRESULT lret = 0; 900 901 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 902 wParam, lParam); 903 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) { 904 item2 = COMBOEX_FindItem (infoPtr, index); 905 if (item2 != item1) { 906 ERR("data structures damaged!\n"); 907 return CB_ERR; 908 } 909 if (item1->mask & CBEIF_LPARAM) 910 lret = (LRESULT) item1->lParam; 911 TRACE("returning 0x%08lx\n", lret); 912 return lret; 913 } 914 lret = (LRESULT)item1; 915 TRACE("non-valid result from combo, returning 0x%08lx\n", lret); 916 return lret; 917 } 918 919 920 static LRESULT 884 921 COMBOEX_SetCursel (HWND hwnd, WPARAM wParam, LPARAM lParam) 885 922 { … … 896 933 TRACE("selecting item %d text=%s\n", index, (item->pszText) ? 897 934 debugstr_w(item->pszText) : "<null>"); 935 infoPtr->selected = index; 898 936 899 937 lret = SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, wParam, lParam); 900 938 COMBOEX_SetEditText (infoPtr, item); 901 939 return lret; 940 } 941 942 943 static LRESULT 944 COMBOEX_SetItemData (HWND hwnd, WPARAM wParam, LPARAM lParam) 945 { 946 INT index = wParam; 947 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 948 CBE_ITEMDATA *item1, *item2; 949 950 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 951 wParam, lParam); 952 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) { 953 item2 = COMBOEX_FindItem (infoPtr, index); 954 if (item2 != item1) { 955 ERR("data structures damaged!\n"); 956 return CB_ERR; 957 } 958 item1->mask |= CBEIF_LPARAM; 959 item1->lParam = lParam; 960 TRACE("setting lparam to 0x%08lx\n", lParam); 961 return 0; 962 } 963 TRACE("non-valid result from combo 0x%08lx\n", (DWORD)item1); 964 return (LRESULT)item1; 902 965 } 903 966 … … 968 1031 infoPtr->nb_items = 0; 969 1032 infoPtr->hwndSelf = hwnd; 1033 infoPtr->selected = -1; 970 1034 971 1035 SetWindowLongA (hwnd, 0, (DWORD)infoPtr); … … 975 1039 (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD); 976 1040 977 TRACE("combo style=%08lx, additional style=%08lx\n", dwComboStyle, 1041 GetWindowRect(hwnd, &wnrc1); 1042 GetClientRect(hwnd, &clrc1); 1043 TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d)\n", 1044 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 1045 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom); 1046 TRACE("combo style=%08lx, adding style=%08lx\n", dwComboStyle, 978 1047 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 979 1048 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | … … 1077 1146 GetClientRect(hwnd, &clrc1); 1078 1147 GetWindowRect(infoPtr->hwndCombo, &cmbwrc); 1079 TRACE("E x wnd=(%d,%d)-(%d,%d) Ex clt=(%d,%d)-(%d,%d) Cbwnd=(%d,%d)-(%d,%d)\n",1148 TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) CB wnd=(%d,%d)-(%d,%d)\n", 1080 1149 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 1081 1150 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, … … 1086 1155 1087 1156 GetWindowRect(infoPtr->hwndCombo, &cmbwrc); 1088 TRACE(" Ex wnd=(%d,%d)-(%d,%d)\n",1157 TRACE("CB window=(%d,%d)-(%d,%d)\n", 1089 1158 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); 1090 1159 SetWindowPos(hwnd, HWND_TOP, … … 1118 1187 INT cursel, n, oldItem; 1119 1188 NMCBEENDEDITA cbeend; 1189 DWORD oldflags; 1120 1190 1121 1191 TRACE("for command %d\n", command); … … 1171 1241 } 1172 1242 } 1173 if (infoPtr->flags & WCBE_ACTEDIT) { 1243 1244 /* Save flags for testing and reset them */ 1245 oldflags = infoPtr->flags; 1246 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1247 1248 if (oldflags & WCBE_ACTEDIT) { 1174 1249 WideCharToMultiByte (CP_ACP, 0, item->pszText, -1, 1175 1250 cbeend.szText, sizeof(cbeend.szText), 1176 1251 NULL, NULL); 1177 cbeend.fChanged = ( infoPtr->flags & WCBE_EDITCHG);1252 cbeend.fChanged = (oldflags & WCBE_EDITCHG); 1178 1253 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1179 1254 CB_GETCURSEL, 0, 0); 1180 1255 cbeend.iWhy = CBENF_DROPDOWN; 1181 1256 1182 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);1183 1257 if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA, 1184 1258 (NMHDR *)&cbeend, FALSE)) { … … 1188 1262 } 1189 1263 } 1190 SendMessageW (hwnd, CB_SETCURSEL, cursel, 0); 1191 SetFocus(infoPtr->hwndCombo); 1264 1265 /* if selection has changed the set the new current selection */ 1266 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1267 if ((oldflags & WCBE_EDITCHG) || (cursel != infoPtr->selected)) { 1268 infoPtr->selected = cursel; 1269 SendMessageW (hwnd, CB_SETCURSEL, cursel, 0); 1270 SetFocus(infoPtr->hwndCombo); 1271 } 1192 1272 return 0; 1193 1273 … … 1210 1290 ERR("item %d not found. Problem!\n", oldItem); 1211 1291 break; 1212 } 1292 } 1293 infoPtr->selected = oldItem; 1213 1294 COMBOEX_SetEditText (infoPtr, item); 1214 1295 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, … … 1619 1700 1620 1701 static LRESULT 1702 COMBOEX_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) 1703 { 1704 /* WARNING: The COMBOEX_INFO structure is not yet created */ 1705 DWORD oldstyle, newstyle; 1706 1707 oldstyle = (DWORD)GetWindowLongA (hwnd, GWL_STYLE); 1708 newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL); 1709 if (newstyle != oldstyle) { 1710 TRACE("req style %08lx, reseting style %08lx\n", 1711 oldstyle, newstyle); 1712 SetWindowLongA (hwnd, GWL_STYLE, newstyle); 1713 } 1714 return 1; 1715 } 1716 1717 1718 static LRESULT 1621 1719 COMBOEX_Size (HWND hwnd, WPARAM wParam, LPARAM lParam) 1622 1720 { … … 1656 1754 - (cbx_crect.right-cbx_crect.left); 1657 1755 1756 TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n", 1757 wp->x, wp->y, wp->cx, wp->cy, wp->flags); 1658 1758 TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n", 1659 1759 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom, … … 1771 1871 break; 1772 1872 } 1773 1873 infoPtr->selected = oldItem; 1774 1874 COMBOEX_SetEditText (infoPtr, item); 1775 1875 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | … … 2110 2210 { 2111 2211 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam); 2112 if (!COMBOEX_GetInfoPtr (hwnd) && (uMsg != WM_CREATE)) 2212 2213 if (!COMBOEX_GetInfoPtr (hwnd)) { 2214 if (uMsg == WM_CREATE) 2215 return COMBOEX_Create (hwnd, wParam, lParam); 2216 if (uMsg == WM_NCCREATE) 2217 COMBOEX_NCCreate (hwnd, wParam, lParam); 2113 2218 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 2219 } 2114 2220 2115 2221 switch (uMsg) … … 2167 2273 /* Combo messages we are not sure if we need to process or just forward */ 2168 2274 case CB_GETDROPPEDCONTROLRECT: 2169 case CB_GETITEMDATA:2170 2275 case CB_GETITEMHEIGHT: 2171 2276 case CB_GETLBTEXT: … … 2175 2280 case CB_RESETCONTENT: 2176 2281 case CB_SELECTSTRING: 2177 case CB_SETITEMDATA:2178 2282 case WM_SETTEXT: 2179 2283 case WM_GETTEXT: 2180 FIXME("(0x%x 0x%x 0x%lx): possibl e missing fucntion\n",2284 FIXME("(0x%x 0x%x 0x%lx): possibly missing function\n", 2181 2285 uMsg, wParam, lParam); 2182 2286 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam); … … 2196 2300 wParam, lParam); 2197 2301 2302 case CB_GETITEMDATA: 2303 return COMBOEX_GetItemData (hwnd, wParam, lParam); 2304 2198 2305 case CB_SETCURSEL: 2199 2306 return COMBOEX_SetCursel (hwnd, wParam, lParam); 2307 2308 case CB_SETITEMDATA: 2309 return COMBOEX_SetItemData (hwnd, wParam, lParam); 2200 2310 2201 2311 case CB_SETITEMHEIGHT: … … 2213 2323 2214 2324 /* Window messages we need to process */ 2215 case WM_CREATE:2216 return COMBOEX_Create (hwnd, wParam, lParam);2217 2218 2325 case WM_DELETEITEM: 2219 2326 return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam); … … 2241 2348 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 2242 2349 #else 2243 2350 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 2244 2351 #endif 2245 2352 } -
trunk/src/comctl32/comctl32.def
r5416 r5630 1 ; $Id: comctl32.def,v 1.2 1 2001-03-31 13:25:26 sandervl Exp $1 ; $Id: comctl32.def,v 1.22 2001-04-29 10:30:56 sandervl Exp $ 2 2 LIBRARY COMCTL32 INITINSTANCE 3 3 DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library' … … 103 103 ; ordinals???? 104 104 FreeMRUListA = _FreeMRUListA@4 @152 105 AddMRUData = _AddMRUData@12 @153 106 FindMRUData = _FindMRUData@16 @154 107 CreateMRUListLazyA = _CreateMRUListLazyA@16 @155 105 AddMRUStringA = _AddMRUStringA@8 @153 106 EnumMRUListA = _EnumMRUListA@16 @154 107 FindMRUStringA = _FindMRUStringA@12 @155 108 DelMRUString = _DelMRUString@8 @156 109 CreateMRUListLazyA = _CreateMRUListLazyA@16 @157 110 111 AddMRUData = _AddMRUData@12 @167 112 FindMRUData = _FindMRUData@16 @169 108 113 109 114 Str_GetPtrA = _Str_GetPtrA@12 @233 … … 164 169 StrSpnW = _COMCTL32_StrSpnW@8 @364 165 170 166 comctl32_410 = _comctl32_410@16 @410 167 comctl32_411 = _comctl32_411@12 @411 168 comctl32_412 = _comctl32_412@12 @412 169 comctl32_413 = _comctl32_413@16 @413 171 _comctl32_410@16 @410 NONAME 172 _comctl32_411@12 @411 NONAME 173 _comctl32_412@12 @412 NONAME 174 _comctl32_413@16 @413 NONAME 175 _COMCTL32_415@20 @415 NONAME -
trunk/src/comctl32/comctl32.h
r5416 r5630 1 /* $Id: comctl32.h,v 1. 19 2001-03-31 13:25:26 sandervl Exp $ */1 /* $Id: comctl32.h,v 1.20 2001-04-29 10:30:56 sandervl Exp $ */ 2 2 /* 3 3 * Win32 common controls implementation … … 208 208 void UPDOWN_Unregister(void); 209 209 210 211 INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen); 212 BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc); 213 210 214 #ifdef __cplusplus 211 215 } -
trunk/src/comctl32/comctl32undoc.cpp
r5416 r5630 1 /* $Id: comctl32undoc.cpp,v 1. 8 2001-03-31 13:25:26 sandervl Exp $ */1 /* $Id: comctl32undoc.cpp,v 1.9 2001-04-29 10:30:56 sandervl Exp $ */ 2 2 /* 3 3 * Undocumented functions from COMCTL32.DLL … … 2545 2545 } 2546 2546 2547 2547 /************************************************************************** 2548 * COMCTL32_415 [COMCTL32.415] 2549 * 2550 * FIXME: What's this supposed to do? 2551 * Parameter 1 is an HWND, you're on your own for the rest. 2552 */ 2553 2554 BOOL WINAPI COMCTL32_415( HWND hwnd, DWORD b, DWORD c, DWORD d, DWORD e) 2555 { 2556 2557 FIXME("(%x, %lx, %lx, %lx, %lx): stub!\n", hwnd, b, c, d, e); 2558 2559 return TRUE; 2560 } 2561 2562 /************************************************************************** 2563 * Str_GetPtrWtoA [internal] 2564 * 2565 * Converts a unicode string into a multi byte string 2566 * 2567 * PARAMS 2568 * lpSrc [I] Pointer to the unicode source string 2569 * lpDest [O] Pointer to caller supplied storage for the multi byte string 2570 * nMaxLen [I] Size, in bytes, of the destination buffer 2571 * 2572 * RETURNS 2573 * Length, in bytes, of the converted string. 2574 */ 2575 2576 INT 2577 Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen) 2578 { 2579 INT len; 2580 2581 TRACE("(%s %p %d)\n", debugstr_w(lpSrc), lpDest, nMaxLen); 2582 2583 if (!lpDest && lpSrc) 2584 return WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL); 2585 2586 if (nMaxLen == 0) 2587 return 0; 2588 2589 if (lpSrc == NULL) { 2590 lpDest[0] = '\0'; 2591 return 0; 2592 } 2593 2594 len = WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL); 2595 if (len >= nMaxLen) 2596 len = nMaxLen - 1; 2597 2598 WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, lpDest, len, NULL, NULL); 2599 lpDest[len] = '\0'; 2600 2601 return len; 2602 } 2603 2604 2605 /************************************************************************** 2606 * Str_SetPtrAtoW [internal] 2607 * 2608 * Converts a multi byte string to a unicode string. 2609 * If the pointer to the destination buffer is NULL a buffer is allocated. 2610 * If the destination buffer is too small to keep the converted multi byte 2611 * string the destination buffer is reallocated. If the source pointer is 2612 * NULL, the destination buffer is freed. 2613 * 2614 * PARAMS 2615 * lppDest [I/O] pointer to a pointer to the destination buffer 2616 * lpSrc [I] pointer to a multi byte string 2617 * 2618 * RETURNS 2619 * TRUE: conversion successful 2620 * FALSE: error 2621 */ 2622 2623 BOOL 2624 Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) 2625 { 2626 TRACE("(%p %s)\n", lppDest, lpSrc); 2627 2628 if (lpSrc) { 2629 INT len = MultiByteToWideChar(CP_ACP,0,lpSrc,-1,NULL,0); 2630 LPWSTR ptr = (LPWSTR)COMCTL32_ReAlloc (*lppDest, len*sizeof(WCHAR)); 2631 2632 if (!ptr) 2633 return FALSE; 2634 MultiByteToWideChar(CP_ACP,0,lpSrc,-1,ptr,len); 2635 *lppDest = ptr; 2636 } 2637 else { 2638 if (*lppDest) { 2639 COMCTL32_Free (*lppDest); 2640 *lppDest = NULL; 2641 } 2642 } 2643 2644 return TRUE; 2645 } -
trunk/src/comctl32/makefile
r4717 r5630 1 # $Id: makefile,v 1.3 1 2000-12-02 23:37:13 birdExp $1 # $Id: makefile,v 1.32 2001-04-29 10:30:56 sandervl Exp $ 2 2 3 3 # … … 57 57 $(ODIN32_LIB)/user32.lib \ 58 58 $(ODIN32_LIB)/msvfw32.lib \ 59 $(ODIN32_LIB)/winmm.lib \ 59 60 $(ODIN32_LIB)/$(ODINCRT).lib \ 60 61 os2386.lib \
Note:
See TracChangeset
for help on using the changeset viewer.