Ignore:
Timestamp:
Sep 5, 2001, 2:05:03 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/animate.c

    r5630 r6644  
    11/* -*- tab-width: 8; c-basic-offset: 4 -*- */
     2/* $Id: animate.c,v 1.14 2001-09-05 12:04:56 bird Exp $ */
    23/*
    34 * Animation control
    45 *
    56 * Copyright 1998, 1999 Eric Kohl
    6  *                 1999 Eric Pouech
     7 *         1999 Eric Pouech
    78 *
    89 * NOTES
     
    3334#endif
    3435   /* reference to input stream (file or resource) */
    35    HGLOBAL              hRes;
    36    HMMIO                hMMio;  /* handle to mmio stream */
    37    HWND                 hWnd;
     36   HGLOBAL      hRes;
     37   HMMIO        hMMio;  /* handle to mmio stream */
     38   HWND         hWnd;
    3839   /* information on the loaded AVI file */
    39    MainAVIHeader        mah;
    40    AVIStreamHeader      ash;
    41    LPBITMAPINFOHEADER   inbih;
    42    LPDWORD              lpIndex;
     40   MainAVIHeader    mah;
     41   AVIStreamHeader  ash;
     42   LPBITMAPINFOHEADER   inbih;
     43   LPDWORD      lpIndex;
    4344   /* data for the decompressor */
    44    HIC                  hic;
    45    LPBITMAPINFOHEADER   outbih;
    46    LPVOID               indata;
    47    LPVOID               outdata;
     45   HIC          hic;
     46   LPBITMAPINFOHEADER   outbih;
     47   LPVOID       indata;
     48   LPVOID       outdata;
    4849   /* data for the background mechanism */
    49    CRITICAL_SECTION     cs;
    50    HANDLE               hThread;
    51    UINT                 uTimer;
     50   CRITICAL_SECTION cs;
     51   HANDLE       hThread;
     52   UINT         uTimer;
    5253   /* data for playing the file */
    53    int                  nFromFrame;
    54    int                  nToFrame;
    55    int                  nLoop;
    56    int                  currFrame;
     54   int          nFromFrame;
     55   int          nToFrame;
     56   int          nLoop;
     57   int          currFrame;
    5758   /* tranparency info*/
    58    COLORREF             transparentColor;   
    59    HBRUSH               hbrushBG;
    60    HBITMAP              hbmPrevFrame;
     59   COLORREF             transparentColor;
     60   HBRUSH               hbrushBG;
     61   HBITMAP              hbmPrevFrame;
    6162} ANIMATE_INFO;
    6263
    6364#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongA(hWnd, 0))
    64 #define ANIMATE_COLOR_NONE      0xffffffff
     65#define ANIMATE_COLOR_NONE      0xffffffff
    6566
    6667static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
    6768{
    68     SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND, 
    69                  MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif),
    70                 (LPARAM)infoPtr->hWnd);
     69    SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND,
     70         MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif),
     71        (LPARAM)infoPtr->hWnd);
    7172}
    7273
     
    7778#endif
    7879{
    79     HRSRC       hrsrc;
    80     MMIOINFO    mminfo;
    81     LPVOID      lpAvi;
    82    
     80    HRSRC   hrsrc;
     81    MMIOINFO    mminfo;
     82    LPVOID  lpAvi;
     83
    8384#ifdef __WIN32OS2__
    8485    if (unicode)
     
    9091#endif
    9192    if (!hrsrc)
    92         return FALSE;
    93    
     93    return FALSE;
     94
    9495    infoPtr->hRes = LoadResource(hInst, hrsrc);
    9596    if (!infoPtr->hRes)
    96         return FALSE;
    97    
     97    return FALSE;
     98
    9899    lpAvi = LockResource(infoPtr->hRes);
    99100    if (!lpAvi)
    100         return FALSE;
    101    
     101    return FALSE;
     102
    102103    memset(&mminfo, 0, sizeof(mminfo));
    103104    mminfo.fccIOProc = FOURCC_MEM;
     
    106107    infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ);
    107108    if (!infoPtr->hMMio) {
    108         GlobalFree((HGLOBAL)lpAvi);
    109         return FALSE;
     109    GlobalFree((HGLOBAL)lpAvi);
     110    return FALSE;
    110111    }
    111112
     
    127128#else
    128129    infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL,
    129                                MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
     130                   MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    130131#endif
    131132    if (!infoPtr->hMMio)
    132         return FALSE;
    133    
     133    return FALSE;
     134
    134135    return TRUE;
    135136}
     
    141142
    142143    /* should stop playing */
    143     if (infoPtr->hThread) 
     144    if (infoPtr->hThread)
    144145    {
    145146        if (!TerminateThread(infoPtr->hThread,0))
    146147            WARN("could not destroy animation thread!\n");
    147             infoPtr->hThread = 0;
     148        infoPtr->hThread = 0;
    148149    }
    149150    if (infoPtr->uTimer) {
    150         KillTimer(infoPtr->hWnd, infoPtr->uTimer);
    151         infoPtr->uTimer = 0;
     151    KillTimer(infoPtr->hWnd, infoPtr->uTimer);
     152    infoPtr->uTimer = 0;
    152153    }
    153154
     
    163164{
    164165    if (infoPtr->hMMio) {
    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         }
     166    ANIMATE_DoStop(infoPtr);
     167    mmioClose(infoPtr->hMMio, 0);
     168    if (infoPtr->hRes) {
     169        FreeResource(infoPtr->hRes);
     170        infoPtr->hRes = 0;
     171    }
     172    if (infoPtr->lpIndex) {
     173        HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex);
     174        infoPtr->lpIndex = NULL;
     175    }
     176    if (infoPtr->hic) {
     177        ICClose(infoPtr->hic);
     178        infoPtr->hic = 0;
     179    }
     180    if (infoPtr->inbih) {
     181        HeapFree(GetProcessHeap(), 0, infoPtr->inbih);
     182        infoPtr->inbih = NULL;
     183    }
     184    if (infoPtr->outbih) {
     185        HeapFree(GetProcessHeap(), 0, infoPtr->outbih);
     186        infoPtr->outbih = NULL;
     187    }
    187188        if( infoPtr->indata )
    188189        {
    189         HeapFree(GetProcessHeap(), 0, infoPtr->indata);
     190    HeapFree(GetProcessHeap(), 0, infoPtr->indata);
    190191            infoPtr->indata = NULL;
    191192        }
    192         if( infoPtr->outdata )
     193        if( infoPtr->outdata )
    193194        {
    194         HeapFree(GetProcessHeap(), 0, infoPtr->outdata);
     195    HeapFree(GetProcessHeap(), 0, infoPtr->outdata);
    195196            infoPtr->outdata = NULL;
    196197        }
    197         if( infoPtr->hbmPrevFrame )
     198        if( infoPtr->hbmPrevFrame )
    198199        {
    199             DeleteObject(infoPtr->hbmPrevFrame);
     200        DeleteObject(infoPtr->hbmPrevFrame);
    200201            infoPtr->hbmPrevFrame = 0;
    201202        }
    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;   
     203    infoPtr->indata = infoPtr->outdata = NULL;
     204    infoPtr->hWnd = 0;
     205    infoPtr->hMMio = 0;
     206
     207    memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
     208    memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
     209    infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
     210    }
     211    infoPtr->transparentColor = ANIMATE_COLOR_NONE;
    211212}
    212213
    213214static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource)
    214 {       
     215{
    215216    HDC hdcMask;
    216217    HBITMAP hbmMask;
    217     HBITMAP hbmOld;           
    218    
     218    HBITMAP hbmOld;
     219
    219220    /* create a transparency mask */
    220221    hdcMask = CreateCompatibleDC(hdcDest);
    221     hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);   
    222     hbmOld = SelectObject(hdcMask, hbmMask);             
     222    hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);
     223    hbmOld = SelectObject(hdcMask, hbmMask);
    223224
    224225    SetBkColor(hdcSource,infoPtr->transparentColor);
    225226    BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY);
    226            
     227
    227228    /* mask the source bitmap */
    228     SetBkColor(hdcSource, RGB(0,0,0));         
    229     SetTextColor(hdcSource, RGB(255,255,255)); 
     229    SetBkColor(hdcSource, RGB(0,0,0));
     230    SetTextColor(hdcSource, RGB(255,255,255));
    230231    BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
    231232
    232233    /* mask the destination bitmap */
    233     SetBkColor(hdcDest, RGB(255,255,255));   
    234     SetTextColor(hdcDest, RGB(0,0,0));         
     234    SetBkColor(hdcDest, RGB(255,255,255));
     235    SetTextColor(hdcDest, RGB(0,0,0));
    235236    BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
    236237
     
    258259
    259260    if (!hDC || !infoPtr->inbih)
    260         return TRUE;
     261    return TRUE;
    261262
    262263    if (infoPtr->hic )
     
    266267
    267268        nWidth = infoPtr->outbih->biWidth;
    268         nHeight = infoPtr->outbih->biHeight; 
     269        nHeight = infoPtr->outbih->biHeight;
    269270    } else
    270     { 
     271    {
    271272        pBitmapData = infoPtr->indata;
    272273        pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih;
    273274
    274275        nWidth = infoPtr->inbih->biWidth;
    275         nHeight = infoPtr->inbih->biHeight; 
    276     } 
     276        nHeight = infoPtr->inbih->biHeight;
     277    }
    277278
    278279    if(!infoPtr->hbmPrevFrame)
     
    281282    }
    282283
    283     SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS); 
    284    
     284    SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS);
     285
    285286    hdcMem = CreateCompatibleDC(hDC);
    286287    hbmOld = SelectObject(hdcMem, infoPtr->hbmPrevFrame);
    287288
    288     /* 
    289      * we need to get the transparent color even without ACS_TRANSPARENT, 
     289    /*
     290     * we need to get the transparent color even without ACS_TRANSPARENT,
    290291     * because the style can be changed later on and the color should always
    291      * be obtained in the first frame 
     292     * be obtained in the first frame
    292293     */
    293294    if(infoPtr->transparentColor == ANIMATE_COLOR_NONE)
    294295    {
    295296        infoPtr->transparentColor = GetPixel(hdcMem,0,0);
    296     } 
    297 
    298     if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 
    299     { 
     297    }
     298
     299    if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     300    {
    300301        HDC hdcFinal = CreateCompatibleDC(hDC);
    301302        HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
    302303        HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal);
    303304        RECT rect;
    304        
     305
    305306        rect.left = 0;
    306307        rect.top = 0;
    307308        rect.right = nWidth;
    308309        rect.bottom = nHeight;
    309        
     310
    310311        if(!infoPtr->hbrushBG)
    311312            infoPtr->hbrushBG = GetCurrentObject(hDC, OBJ_BRUSH);
     
    320321        infoPtr->hbmPrevFrame = hbmFinal;
    321322         }
    322    
    323     if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER) 
    324     {
    325        RECT rect;   
     323
     324    if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER)
     325    {
     326       RECT rect;
    326327
    327328       GetWindowRect(infoPtr->hWnd, &rect);
    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);   
     329       nOffsetX = ((rect.right - rect.left) - nWidth)/2;
     330       nOffsetY = ((rect.bottom - rect.top) - nHeight)/2;
     331    }
     332    BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);
    332333
    333334    SelectObject(hdcMem, hbmOld);
     
    338339static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
    339340{
    340     HDC         hDC;
     341    HDC     hDC;
    341342
    342343    TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop);
     
    346347    mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
    347348    mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
    348    
     349
    349350    if (infoPtr->hic &&
    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;
     351    ICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
     352             infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
     353    LeaveCriticalSection(&infoPtr->cs);
     354    WARN("Decompression error\n");
     355    return FALSE;
    355356    }
    356357
    357358    if ((hDC = GetDC(infoPtr->hWnd)) != 0) {
    358         ANIMATE_PaintFrame(infoPtr, hDC);
    359         ReleaseDC(infoPtr->hWnd, hDC);
     359    ANIMATE_PaintFrame(infoPtr, hDC);
     360    ReleaseDC(infoPtr->hWnd, hDC);
    360361    }
    361362
    362363    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         }
     364    infoPtr->currFrame = infoPtr->nFromFrame;
     365    if (infoPtr->nLoop != -1) {
     366        if (--infoPtr->nLoop == 0) {
     367        ANIMATE_DoStop(infoPtr);
     368        }
     369    }
    369370    }
    370371    LeaveCriticalSection(&infoPtr->cs);
     
    375376static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
    376377{
    377     ANIMATE_INFO*       infoPtr = (ANIMATE_INFO*)ptr_;
     378    ANIMATE_INFO*   infoPtr = (ANIMATE_INFO*)ptr_;
    378379    HDC hDC;
    379    
     380
    380381    if(!infoPtr)
    381382    {
     
    385386
    386387    while(1)
    387     {   
    388         if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 
     388    {
     389        if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
    389390        {
    390391            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 */
     392        /* sometimes the animation window will be destroyed in between
     393         * by the main program, so a ReleaseDC() error msg is possible */
    393394            infoPtr->hbrushBG = SendMessageA(GetParent(infoPtr->hWnd),WM_CTLCOLORSTATIC,hDC, infoPtr->hWnd);
    394395            ReleaseDC(infoPtr->hWnd,hDC);
    395396        }
    396        
     397
    397398        EnterCriticalSection(&infoPtr->cs);
    398399        ANIMATE_DrawFrame(infoPtr);
    399400        LeaveCriticalSection(&infoPtr->cs);
    400    
     401
    401402        /* time is in microseconds, we should convert it to milliseconds */
    402403        Sleep((infoPtr->mah.dwMicroSecPerFrame+500)/1000);
     
    411412    /* nothing opened */
    412413    if (!infoPtr->hMMio)
    413         return FALSE;
     414    return FALSE;
    414415
    415416    if (infoPtr->hThread || infoPtr->uTimer) {
    416         FIXME("Already playing ? what should I do ??\n");
    417         ANIMATE_DoStop(infoPtr);
     417    FIXME("Already playing ? what should I do ??\n");
     418    ANIMATE_DoStop(infoPtr);
    418419    }
    419420
     
    423424
    424425    if (infoPtr->nToFrame == 0xFFFF)
    425         infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;
    426 
    427     TRACE("(repeat=%d from=%d to=%d);\n", 
    428           infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame);
     426    infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;
     427
     428    TRACE("(repeat=%d from=%d to=%d);\n",
     429      infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame);
    429430
    430431    if (infoPtr->nFromFrame >= infoPtr->nToFrame ||
    431         infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
    432         return FALSE;
     432    infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
     433    return FALSE;
    433434
    434435    infoPtr->currFrame = infoPtr->nFromFrame;
    435436
    436437    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) {
    437         TRACE("Using a timer\n");
    438         /* create a timer to display AVI */
    439         infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
     438    TRACE("Using a timer\n");
     439    /* create a timer to display AVI */
     440    infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
    440441    } else {
    441442        DWORD threadID;
    442443
    443         TRACE("Using an animation thread\n");
     444    TRACE("Using an animation thread\n");
    444445        infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr,0,0 &threadID);
    445446        if(!infoPtr->hThread)
     
    448449           return FALSE;
    449450    }
    450        
    451     }
    452        
     451
     452    }
     453
    453454    ANIMATE_Notify(infoPtr, ACN_START);
    454455
     
    459460static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
    460461{
    461     MMCKINFO            ckMainRIFF;
    462     MMCKINFO            mmckHead;
    463     MMCKINFO            mmckList;
    464     MMCKINFO            mmckInfo;
    465     DWORD               numFrame;
    466     DWORD               insize;
     462    MMCKINFO        ckMainRIFF;
     463    MMCKINFO        mmckHead;
     464    MMCKINFO        mmckList;
     465    MMCKINFO        mmckInfo;
     466    DWORD       numFrame;
     467    DWORD       insize;
    467468
    468469    if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {
    469         WARN("Can't find 'RIFF' chunk\n");
    470         return FALSE;
     470    WARN("Can't find 'RIFF' chunk\n");
     471    return FALSE;
    471472    }
    472473
    473474    if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
    474         (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {
    475         WARN("Can't find 'AVI ' chunk\n");
    476         return FALSE;
     475    (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {
     476    WARN("Can't find 'AVI ' chunk\n");
     477    return FALSE;
    477478    }
    478479
    479480    mmckHead.fccType = mmioFOURCC('h', 'd', 'r', 'l');
    480481    if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {
    481         WARN("Can't find 'hdrl' list\n");
    482         return FALSE;
     482    WARN("Can't find 'hdrl' list\n");
     483    return FALSE;
    483484    }
    484485
    485486    mmckInfo.ckid = mmioFOURCC('a', 'v', 'i', 'h');
    486487    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) {
    487         WARN("Can't find 'avih' chunk\n");
    488         return FALSE;
     488    WARN("Can't find 'avih' chunk\n");
     489    return FALSE;
    489490    }
    490491
    491492    mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah));
    492493
    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);
     494    TRACE("mah.dwMicroSecPerFrame=%ld\n",   infoPtr->mah.dwMicroSecPerFrame);
     495    TRACE("mah.dwMaxBytesPerSec=%ld\n",     infoPtr->mah.dwMaxBytesPerSec);
     496    TRACE("mah.dwPaddingGranularity=%ld\n",     infoPtr->mah.dwPaddingGranularity);
     497    TRACE("mah.dwFlags=%ld\n",          infoPtr->mah.dwFlags);
     498    TRACE("mah.dwTotalFrames=%ld\n",        infoPtr->mah.dwTotalFrames);
     499    TRACE("mah.dwInitialFrames=%ld\n",      infoPtr->mah.dwInitialFrames);
     500    TRACE("mah.dwStreams=%ld\n",        infoPtr->mah.dwStreams);
     501    TRACE("mah.dwSuggestedBufferSize=%ld\n",    infoPtr->mah.dwSuggestedBufferSize);
     502    TRACE("mah.dwWidth=%ld\n",          infoPtr->mah.dwWidth);
     503    TRACE("mah.dwHeight=%ld\n",         infoPtr->mah.dwHeight);
    503504
    504505    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     
    506507    mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
    507508    if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {
    508         WARN("Can't find 'strl' list\n");
    509         return FALSE;
     509    WARN("Can't find 'strl' list\n");
     510    return FALSE;
    510511    }
    511512
    512513    mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'h');
    513514    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
    514         WARN("Can't find 'strh' chunk\n");
    515         return FALSE;
     515    WARN("Can't find 'strh' chunk\n");
     516    return FALSE;
    516517    }
    517518
    518519    mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));
    519520
    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);
     521    TRACE("ash.fccType='%c%c%c%c'\n",       LOBYTE(LOWORD(infoPtr->ash.fccType)),
     522                                            HIBYTE(LOWORD(infoPtr->ash.fccType)),
     523                                            LOBYTE(HIWORD(infoPtr->ash.fccType)),
     524                                            HIBYTE(HIWORD(infoPtr->ash.fccType)));
     525    TRACE("ash.fccHandler='%c%c%c%c'\n",    LOBYTE(LOWORD(infoPtr->ash.fccHandler)),
     526                                            HIBYTE(LOWORD(infoPtr->ash.fccHandler)),
     527                                            LOBYTE(HIWORD(infoPtr->ash.fccHandler)),
     528                                            HIBYTE(HIWORD(infoPtr->ash.fccHandler)));
     529    TRACE("ash.dwFlags=%ld\n",          infoPtr->ash.dwFlags);
     530    TRACE("ash.wPriority=%d\n",         infoPtr->ash.wPriority);
     531    TRACE("ash.wLanguage=%d\n",         infoPtr->ash.wLanguage);
     532    TRACE("ash.dwInitialFrames=%ld\n",      infoPtr->ash.dwInitialFrames);
     533    TRACE("ash.dwScale=%ld\n",          infoPtr->ash.dwScale);
     534    TRACE("ash.dwRate=%ld\n",           infoPtr->ash.dwRate);
     535    TRACE("ash.dwStart=%ld\n",          infoPtr->ash.dwStart);
     536    TRACE("ash.dwLength=%ld\n",         infoPtr->ash.dwLength);
     537    TRACE("ash.dwSuggestedBufferSize=%ld\n",    infoPtr->ash.dwSuggestedBufferSize);
     538    TRACE("ash.dwQuality=%ld\n",        infoPtr->ash.dwQuality);
     539    TRACE("ash.dwSampleSize=%ld\n",         infoPtr->ash.dwSampleSize);
     540    TRACE("ash.rcFrame=(%d,%d,%d,%d)\n",    infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left,
     541      infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right);
    541542
    542543    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     
    544545    mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'f');
    545546    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
    546         WARN("Can't find 'strh' chunk\n");
    547         return FALSE;
     547    WARN("Can't find 'strh' chunk\n");
     548    return FALSE;
    548549    }
    549550
    550551    infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
    551552    if (!infoPtr->inbih) {
    552         WARN("Can't alloc input BIH\n");
    553         return FALSE;
     553    WARN("Can't alloc input BIH\n");
     554    return FALSE;
    554555    }
    555556
    556557    mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize);
    557558
    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);
     559    TRACE("bih.biSize=%ld\n",       infoPtr->inbih->biSize);
     560    TRACE("bih.biWidth=%ld\n",      infoPtr->inbih->biWidth);
     561    TRACE("bih.biHeight=%ld\n",     infoPtr->inbih->biHeight);
     562    TRACE("bih.biPlanes=%d\n",      infoPtr->inbih->biPlanes);
     563    TRACE("bih.biBitCount=%d\n",    infoPtr->inbih->biBitCount);
     564    TRACE("bih.biCompression=%ld\n",    infoPtr->inbih->biCompression);
     565    TRACE("bih.biSizeImage=%ld\n",  infoPtr->inbih->biSizeImage);
     566    TRACE("bih.biXPelsPerMeter=%ld\n",  infoPtr->inbih->biXPelsPerMeter);
     567    TRACE("bih.biYPelsPerMeter=%ld\n",  infoPtr->inbih->biYPelsPerMeter);
     568    TRACE("bih.biClrUsed=%ld\n",    infoPtr->inbih->biClrUsed);
     569    TRACE("bih.biClrImportant=%ld\n",   infoPtr->inbih->biClrImportant);
    569570
    570571    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    571572
    572573    mmioAscend(infoPtr->hMMio, &mmckList, 0);
    573    
     574
    574575#if 0
    575576    /* an AVI has 0 or 1 video stream, and to be animated should not contain
    576      * an audio stream, so only one strl is allowed 
     577     * an audio stream, so only one strl is allowed
    577578     */
    578579    mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
    579580    if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {
    580         WARN("There should be a single 'strl' list\n");
    581         return FALSE;
     581    WARN("There should be a single 'strl' list\n");
     582    return FALSE;
    582583    }
    583584#endif
     
    589590    mmckList.fccType = mmioFOURCC('m', 'o', 'v', 'i');
    590591    if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {
    591         WARN("Can't find 'movi' list\n");
    592         return FALSE;
     592    WARN("Can't find 'movi' list\n");
     593    return FALSE;
    593594    }
    594595
    595596    /* FIXME: should handle the 'rec ' LIST when present */
    596597
    597     infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
    598                                 infoPtr->mah.dwTotalFrames * sizeof(DWORD));
     598    infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
     599                infoPtr->mah.dwTotalFrames * sizeof(DWORD));
    599600    if (!infoPtr->lpIndex) {
    600         WARN("Can't alloc index array\n");
    601         return FALSE;
     601    WARN("Can't alloc index array\n");
     602    return FALSE;
    602603    }
    603604
    604605    numFrame = insize = 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);
     606    while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
     607       numFrame < infoPtr->mah.dwTotalFrames) {
     608    infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset;
     609    if (insize < mmckInfo.cksize)
     610        insize = mmckInfo.cksize;
     611    numFrame++;
     612    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    612613    }
    613614    if (numFrame != infoPtr->mah.dwTotalFrames) {
    614         WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames);
    615         return FALSE;
     615    WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames);
     616    return FALSE;
    616617    }
    617618    if (insize > infoPtr->ash.dwSuggestedBufferSize) {
    618         WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize);
    619         infoPtr->ash.dwSuggestedBufferSize = insize;
     619    WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize);
     620    infoPtr->ash.dwSuggestedBufferSize = insize;
    620621    }
    621622
    622623    infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize);
    623624    if (!infoPtr->indata) {
    624         WARN("Can't alloc input buffer\n");
    625         return FALSE;
     625    WARN("Can't alloc input buffer\n");
     626    return FALSE;
    626627    }
    627628
     
    632633static BOOL    ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
    633634{
    634     DWORD       outSize;
     635    DWORD   outSize;
    635636
    636637    /* check uncompressed AVI */
     
    638639       (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' ')))
    639640    {
    640         infoPtr->hic = 0;             
    641         return TRUE;
     641        infoPtr->hic = 0;
     642    return TRUE;
    642643    }
    643644
     
    645646    infoPtr->hic = ICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS);
    646647    if (!infoPtr->hic) {
    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);
     648    WARN("Can't load codec for the file\n");
     649    return FALSE;
     650    }
     651
     652    outSize = ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
     653                (DWORD)infoPtr->inbih, 0L);
    653654
    654655    infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize);
    655656    if (!infoPtr->outbih) {
    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;
     657    WARN("Can't alloc output BIH\n");
     658    return FALSE;
     659    }
     660
     661    if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
     662              (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
     663    WARN("Can't get output BIH\n");
     664    return FALSE;
    664665    }
    665666
    666667    infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage);
    667668    if (!infoPtr->outdata) {
    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;
     669    WARN("Can't alloc output buffer\n");
     670    return FALSE;
     671    }
     672
     673    if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
     674              (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
     675    WARN("Can't begin decompression\n");
     676    return FALSE;
    676677    }
    677678
     
    691692
    692693    if (!lParam) {
    693         TRACE("Closing avi!\n");
    694         return TRUE;
    695     }
    696    
     694    TRACE("Closing avi!\n");
     695    return TRUE;
     696    }
     697
    697698    if (!hInstance)
    698699       hInstance = GetWindowLongA(hWnd, GWL_HINSTANCE);
     
    719720#else
    720721    if (HIWORD(lParam)) {
    721         TRACE("(\"%s\");\n", (LPSTR)lParam);
    722 
    723         if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) {
    724             TRACE("No AVI resource found!\n");
    725             if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) {
    726                 WARN("No AVI file found!\n");
    727                 return FALSE;
    728             }
    729         }
     722    TRACE("(\"%s\");\n", (LPSTR)lParam);
     723
     724    if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) {
     725        TRACE("No AVI resource found!\n");
     726        if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) {
     727        WARN("No AVI file found!\n");
     728        return FALSE;
     729        }
     730    }
    730731    } else {
    731         TRACE("(%u);\n", (WORD)LOWORD(lParam));
    732 
    733         if (!ANIMATE_LoadResA(infoPtr, hInstance,
    734                               MAKEINTRESOURCEA((INT)lParam))) {
    735             WARN("No AVI resource found!\n");
    736             return FALSE;
    737         }
     732    TRACE("(%u);\n", (WORD)LOWORD(lParam));
     733
     734    if (!ANIMATE_LoadResA(infoPtr, hInstance,
     735                  MAKEINTRESOURCEA((INT)lParam))) {
     736        WARN("No AVI resource found!\n");
     737        return FALSE;
     738    }
    738739    }
    739740#endif
    740741    if (!ANIMATE_GetAviInfo(infoPtr)) {
    741         WARN("Can't get AVI information\n");
    742         ANIMATE_Free(infoPtr);
    743         return FALSE;
     742    WARN("Can't get AVI information\n");
     743    ANIMATE_Free(infoPtr);
     744    return FALSE;
    744745    }
    745746
    746747    if (!ANIMATE_GetAviCodec(infoPtr)) {
    747         WARN("Can't get AVI Codec\n");
    748         ANIMATE_Free(infoPtr);
    749         return FALSE;
     748    WARN("Can't get AVI Codec\n");
     749    ANIMATE_Free(infoPtr);
     750    return FALSE;
    750751    }
    751752
    752753    if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
    753         SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
    754                      SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
     754    SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
     755             SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
    755756    }
    756757
    757758    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) {
    758         return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1));
     759    return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1));
    759760    }
    760761
     
    771772    /* nothing opened */
    772773    if (!infoPtr->hMMio)
    773         return FALSE;
     774    return FALSE;
    774775
    775776    ANIMATE_DoStop(infoPtr);
     
    780781static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
    781782{
    782     ANIMATE_INFO*       infoPtr;
     783    ANIMATE_INFO*   infoPtr;
    783784
    784785    /* allocate memory for info structure */
     
    789790#endif
    790791    if (!infoPtr) {
    791         ERR("could not allocate info memory!\n");
    792         return 0;
     792    ERR("could not allocate info memory!\n");
     793    return 0;
    793794    }
    794795
     
    802803
    803804    InitializeCriticalSection(&infoPtr->cs);
    804    
     805
    805806    return 0;
    806807}
     
    826827{
    827828    RECT rect;
    828     HBRUSH hBrush = 0;       
    829 
    830     if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 
    831     {
    832         hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);   
     829    HBRUSH hBrush = 0;
     830
     831    if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     832    {
     833        hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);
    833834    }
    834835
     
    842843{
    843844    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
    844         InvalidateRect(hWnd, NULL, TRUE);
     845    InvalidateRect(hWnd, NULL, TRUE);
    845846    }
    846847    return TRUE;
     
    851852    TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam);
    852853    if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE))
    853         return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     854    return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    854855    switch (uMsg)
    855856    {
     
    862863#else
    863864    case ACM_OPENA:
    864         return ANIMATE_OpenA(hWnd, wParam, lParam);
    865        
    866         /*      case ACM_OPEN32W: FIXME!! */
    867         /*          return ANIMATE_Open32W(hWnd, wParam, lParam); */
    868 #endif
    869        
     865    return ANIMATE_OpenA(hWnd, wParam, lParam);
     866
     867    /*  case ACM_OPEN32W: FIXME!! */
     868    /*      return ANIMATE_Open32W(hWnd, wParam, lParam); */
     869#endif
     870
    870871    case ACM_PLAY:
    871         return ANIMATE_Play(hWnd, wParam, lParam);
    872        
     872    return ANIMATE_Play(hWnd, wParam, lParam);
     873
    873874    case ACM_STOP:
    874         return ANIMATE_Stop(hWnd, wParam, lParam);
    875        
     875    return ANIMATE_Stop(hWnd, wParam, lParam);
     876
    876877    case WM_NCCREATE:
    877         ANIMATE_Create(hWnd, wParam, lParam);
    878         return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    879        
     878    ANIMATE_Create(hWnd, wParam, lParam);
     879    return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     880
    880881    case WM_NCHITTEST:
    881         return HTTRANSPARENT;
     882    return HTTRANSPARENT;
    882883
    883884    case WM_DESTROY:
    884         ANIMATE_Destroy(hWnd, wParam, lParam);
    885         return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    886        
     885    ANIMATE_Destroy(hWnd, wParam, lParam);
     886    return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     887
    887888    case WM_ERASEBKGND:
    888         ANIMATE_EraseBackground(hWnd, wParam, lParam);
    889         break;
    890 
    891     /*  case WM_STYLECHANGED: FIXME shall we do something ?? */
     889    ANIMATE_EraseBackground(hWnd, wParam, lParam);
     890    break;
     891
     892    /*  case WM_STYLECHANGED: FIXME shall we do something ?? */
    892893
    893894    case WM_TIMER:
    894         if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     895        if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
    895896        {
    896897            ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
    897898            infoPtr->hbrushBG = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);
    898899        }
    899         return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));
    900        
     900    return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));
     901
    901902    case WM_CLOSE:
    902         ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd));
    903         return TRUE;
     903    ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd));
     904    return TRUE;
    904905
    905906    case WM_PAINT:
    906907        {
    907908            ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
    908                
     909
    909910            /* the animation isn't playing, don't paint */
    910             if(!infoPtr->uTimer && !infoPtr->hThread)
    911                 /* default paint handling */
    912                 return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    913            
     911        if(!infoPtr->uTimer && !infoPtr->hThread)
     912        /* default paint handling */
     913            return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     914
    914915            if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
    915916                infoPtr->hbrushBG = SendMessageA(GetParent(hWnd), WM_CTLCOLORSTATIC,
    916                                                  (HDC)wParam, hWnd);
    917    
     917                                         (HDC)wParam, hWnd);
     918
    918919            if (wParam)
    919920            {
     
    924925            else
    925926            {
    926                 PAINTSTRUCT ps;
    927                 HDC hDC = BeginPaint(hWnd, &ps);
     927            PAINTSTRUCT ps;
     928            HDC hDC = BeginPaint(hWnd, &ps);
    928929
    929930                EnterCriticalSection(&infoPtr->cs);
    930931                ANIMATE_PaintFrame(infoPtr, hDC);
    931932                LeaveCriticalSection(&infoPtr->cs);
    932    
    933                 EndPaint(hWnd, &ps);
    934             }
    935         }
    936         break;
     933
     934            EndPaint(hWnd, &ps);
     935        }
     936        }
     937    break;
    937938
    938939    case WM_SIZE:
    939         ANIMATE_Size(hWnd, wParam, lParam);
    940         return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     940    ANIMATE_Size(hWnd, wParam, lParam);
     941    return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    941942
    942943    default:
    943         if (uMsg >= WM_USER)
    944             ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
    945        
     944    if (uMsg >= WM_USER)
     945        ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
     946
    946947#ifdef __WIN32OS2__
    947948        return defComCtl32ProcA (hWnd, uMsg, wParam, lParam);
    948949#else
    949         return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     950    return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    950951#endif
    951952    }
     
    966967    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
    967968    wndClass.lpszClassName = ANIMATE_CLASSA;
    968  
     969
    969970    RegisterClassA(&wndClass);
    970971}
Note: See TracChangeset for help on using the changeset viewer.