Ignore:
Timestamp:
Sep 15, 2001, 11:26:26 AM (24 years ago)
Author:
sandervl
Message:

restored old version

File:
1 edited

Legend:

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

    r6705 r6709  
    44 *
    55 * Copyright 1998, 1999 Eric Kohl
    6  *         1999 Eric Pouech
     6 *                 1999 Eric Pouech
    77 *
    88 * NOTES
     
    3333#endif
    3434   /* reference to input stream (file or resource) */
    35    HGLOBAL      hRes;
    36    HMMIO        hMMio;  /* handle to mmio stream */
    37    HWND         hWnd;
     35   HGLOBAL              hRes;
     36   HMMIO                hMMio;  /* handle to mmio stream */
     37   HWND                 hWnd;
    3838   /* information on the loaded AVI file */
    39    MainAVIHeader    mah;
    40    AVIStreamHeader  ash;
    41    LPBITMAPINFOHEADER   inbih;
    42    LPDWORD      lpIndex;
     39   MainAVIHeader        mah;
     40   AVIStreamHeader      ash;
     41   LPBITMAPINFOHEADER   inbih;
     42   LPDWORD              lpIndex;
    4343   /* data for the decompressor */
    44    HIC          hic;
    45    LPBITMAPINFOHEADER   outbih;
    46    LPVOID       indata;
    47    LPVOID       outdata;
     44   HIC                  hic;
     45   LPBITMAPINFOHEADER   outbih;
     46   LPVOID               indata;
     47   LPVOID               outdata;
    4848   /* data for the background mechanism */
    49    CRITICAL_SECTION cs;
    50    HANDLE       hThread;
    51    UINT         uTimer;
     49   CRITICAL_SECTION     cs;
     50   HANDLE               hThread;
     51   UINT                 uTimer;
    5252   /* data for playing the file */
    53    int          nFromFrame;
    54    int          nToFrame;
    55    int          nLoop;
    56    int          currFrame;
     53   int                  nFromFrame;
     54   int                  nToFrame;
     55   int                  nLoop;
     56   int                  currFrame;
    5757   /* tranparency info*/
    58    COLORREF             transparentColor;
    59    HBRUSH               hbrushBG;
    60    HBITMAP              hbmPrevFrame;
     58   COLORREF             transparentColor;   
     59   HBRUSH               hbrushBG;
     60   HBITMAP              hbmPrevFrame;
    6161} ANIMATE_INFO;
    6262
    6363#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongA(hWnd, 0))
    64 #define ANIMATE_COLOR_NONE      0xffffffff
     64#define ANIMATE_COLOR_NONE      0xffffffff
    6565
    6666static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
    6767{
    68     SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND,
    69          MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif),
    70         (LPARAM)infoPtr->hWnd);
     68    SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND, 
     69                 MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif),
     70                (LPARAM)infoPtr->hWnd);
    7171}
    7272
     
    7777#endif
    7878{
    79     HRSRC   hrsrc;
    80     MMIOINFO    mminfo;
    81     LPVOID  lpAvi;
    82 
     79    HRSRC       hrsrc;
     80    MMIOINFO    mminfo;
     81    LPVOID      lpAvi;
     82   
    8383#ifdef __WIN32OS2__
    8484    if (unicode)
     
    9090#endif
    9191    if (!hrsrc)
    92     return FALSE;
    93 
     92        return FALSE;
     93   
    9494    infoPtr->hRes = LoadResource(hInst, hrsrc);
    9595    if (!infoPtr->hRes)
    96     return FALSE;
    97 
     96        return FALSE;
     97   
    9898    lpAvi = LockResource(infoPtr->hRes);
    9999    if (!lpAvi)
    100     return FALSE;
    101 
     100        return FALSE;
     101   
    102102    memset(&mminfo, 0, sizeof(mminfo));
    103103    mminfo.fccIOProc = FOURCC_MEM;
     
    106106    infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ);
    107107    if (!infoPtr->hMMio) {
    108     GlobalFree((HGLOBAL)lpAvi);
    109     return FALSE;
     108        GlobalFree((HGLOBAL)lpAvi);
     109        return FALSE;
    110110    }
    111111
     
    127127#else
    128128    infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL,
    129                    MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
     129                               MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    130130#endif
    131131    if (!infoPtr->hMMio)
    132     return FALSE;
    133 
     132        return FALSE;
     133   
    134134    return TRUE;
    135135}
     
    141141
    142142    /* should stop playing */
    143     if (infoPtr->hThread)
     143    if (infoPtr->hThread) 
    144144    {
    145145        if (!TerminateThread(infoPtr->hThread,0))
    146146            WARN("could not destroy animation thread!\n");
    147         infoPtr->hThread = 0;
     147            infoPtr->hThread = 0;
    148148    }
    149149    if (infoPtr->uTimer) {
    150     KillTimer(infoPtr->hWnd, infoPtr->uTimer);
    151     infoPtr->uTimer = 0;
     150        KillTimer(infoPtr->hWnd, infoPtr->uTimer);
     151        infoPtr->uTimer = 0;
    152152    }
    153153
     
    163163{
    164164    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     }
     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        }
    187187        if( infoPtr->indata )
    188188        {
    189     HeapFree(GetProcessHeap(), 0, infoPtr->indata);
     189        HeapFree(GetProcessHeap(), 0, infoPtr->indata);
    190190            infoPtr->indata = NULL;
    191191        }
    192         if( infoPtr->outdata )
     192        if( infoPtr->outdata )
    193193        {
    194     HeapFree(GetProcessHeap(), 0, infoPtr->outdata);
     194        HeapFree(GetProcessHeap(), 0, infoPtr->outdata);
    195195            infoPtr->outdata = NULL;
    196196        }
    197         if( infoPtr->hbmPrevFrame )
     197        if( infoPtr->hbmPrevFrame )
    198198        {
    199         DeleteObject(infoPtr->hbmPrevFrame);
     199            DeleteObject(infoPtr->hbmPrevFrame);
    200200            infoPtr->hbmPrevFrame = 0;
    201201        }
    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;
     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;   
    211211}
    212212
    213213static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource)
    214 {
     214{       
    215215    HDC hdcMask;
    216216    HBITMAP hbmMask;
    217     HBITMAP hbmOld;
    218 
     217    HBITMAP hbmOld;           
     218   
    219219    /* create a transparency mask */
    220220    hdcMask = CreateCompatibleDC(hdcDest);
    221     hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);
    222     hbmOld = SelectObject(hdcMask, hbmMask);
     221    hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);   
     222    hbmOld = SelectObject(hdcMask, hbmMask);             
    223223
    224224    SetBkColor(hdcSource,infoPtr->transparentColor);
    225225    BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY);
    226 
     226           
    227227    /* mask the source bitmap */
    228     SetBkColor(hdcSource, RGB(0,0,0));
    229     SetTextColor(hdcSource, RGB(255,255,255));
     228    SetBkColor(hdcSource, RGB(0,0,0));         
     229    SetTextColor(hdcSource, RGB(255,255,255)); 
    230230    BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
    231231
    232232    /* mask the destination bitmap */
    233     SetBkColor(hdcDest, RGB(255,255,255));
    234     SetTextColor(hdcDest, RGB(0,0,0));
     233    SetBkColor(hdcDest, RGB(255,255,255));   
     234    SetTextColor(hdcDest, RGB(0,0,0));         
    235235    BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
    236236
     
    258258
    259259    if (!hDC || !infoPtr->inbih)
    260     return TRUE;
     260        return TRUE;
    261261
    262262    if (infoPtr->hic )
     
    266266
    267267        nWidth = infoPtr->outbih->biWidth;
    268         nHeight = infoPtr->outbih->biHeight;
     268        nHeight = infoPtr->outbih->biHeight; 
    269269    } else
    270     {
     270    { 
    271271        pBitmapData = infoPtr->indata;
    272272        pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih;
    273273
    274274        nWidth = infoPtr->inbih->biWidth;
    275         nHeight = infoPtr->inbih->biHeight;
    276     }
     275        nHeight = infoPtr->inbih->biHeight; 
     276    } 
    277277
    278278    if(!infoPtr->hbmPrevFrame)
     
    281281    }
    282282
    283     SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS);
    284 
     283    SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS); 
     284   
    285285    hdcMem = CreateCompatibleDC(hDC);
    286286    hbmOld = SelectObject(hdcMem, infoPtr->hbmPrevFrame);
    287287
    288     /*
    289      * we need to get the transparent color even without ACS_TRANSPARENT,
     288    /* 
     289     * we need to get the transparent color even without ACS_TRANSPARENT, 
    290290     * because the style can be changed later on and the color should always
    291      * be obtained in the first frame
     291     * be obtained in the first frame 
    292292     */
    293293    if(infoPtr->transparentColor == ANIMATE_COLOR_NONE)
    294294    {
    295295        infoPtr->transparentColor = GetPixel(hdcMem,0,0);
    296     }
    297 
    298     if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
    299     {
     296    } 
     297
     298    if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 
     299    { 
    300300        HDC hdcFinal = CreateCompatibleDC(hDC);
    301301        HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
    302302        HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal);
    303303        RECT rect;
    304 
     304       
    305305        rect.left = 0;
    306306        rect.top = 0;
    307307        rect.right = nWidth;
    308308        rect.bottom = nHeight;
    309 
     309       
    310310        if(!infoPtr->hbrushBG)
    311311            infoPtr->hbrushBG = GetCurrentObject(hDC, OBJ_BRUSH);
     
    320320        infoPtr->hbmPrevFrame = hbmFinal;
    321321         }
    322 
    323     if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER)
     322   
     323    if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER) 
    324324    {
    325        RECT rect;
     325       RECT rect;   
    326326
    327327       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);
     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);   
    332332
    333333    SelectObject(hdcMem, hbmOld);
     
    338338static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
    339339{
    340     HDC     hDC;
     340    HDC         hDC;
    341341
    342342    TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop);
     
    346346    mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
    347347    mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
    348 
     348   
    349349    if (infoPtr->hic &&
    350     ICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
    351              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    }
    352370    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     }
    370     LeaveCriticalSection(&infoPtr->cs);
    371371
    372372    return TRUE;
     
    375375static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
    376376{
    377     ANIMATE_INFO*   infoPtr = (ANIMATE_INFO*)ptr_;
     377    ANIMATE_INFO*       infoPtr = (ANIMATE_INFO*)ptr_;
    378378    HDC hDC;
    379 
     379   
    380380    if(!infoPtr)
    381381    {
     
    385385
    386386    while(1)
    387     {
    388         if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     387    {   
     388        if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 
    389389        {
    390390            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 */
     391            /* sometimes the animation window will be destroyed in between
     392             * by the main program, so a ReleaseDC() error msg is possible */
    393393            infoPtr->hbrushBG = SendMessageA(GetParent(infoPtr->hWnd),WM_CTLCOLORSTATIC,hDC, infoPtr->hWnd);
    394394            ReleaseDC(infoPtr->hWnd,hDC);
    395395        }
    396 
     396       
    397397        EnterCriticalSection(&infoPtr->cs);
    398398        ANIMATE_DrawFrame(infoPtr);
    399399        LeaveCriticalSection(&infoPtr->cs);
    400 
     400   
    401401        /* time is in microseconds, we should convert it to milliseconds */
    402402        Sleep((infoPtr->mah.dwMicroSecPerFrame+500)/1000);
     
    411411    /* nothing opened */
    412412    if (!infoPtr->hMMio)
    413     return FALSE;
     413        return FALSE;
    414414
    415415    if (infoPtr->hThread || infoPtr->uTimer) {
    416     FIXME("Already playing ? what should I do ??\n");
    417     ANIMATE_DoStop(infoPtr);
     416        FIXME("Already playing ? what should I do ??\n");
     417        ANIMATE_DoStop(infoPtr);
    418418    }
    419419
     
    423423
    424424    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);
     425        infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;
     426
     427    TRACE("(repeat=%d from=%d to=%d);\n", 
     428          infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame);
    429429
    430430    if (infoPtr->nFromFrame >= infoPtr->nToFrame ||
    431     infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
    432     return FALSE;
     431        infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
     432        return FALSE;
    433433
    434434    infoPtr->currFrame = infoPtr->nFromFrame;
    435435
    436436    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);
     437        TRACE("Using a timer\n");
     438        /* create a timer to display AVI */
     439        infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
    440440    } else {
    441441        DWORD threadID;
    442442
    443     TRACE("Using an animation thread\n");
     443        TRACE("Using an animation thread\n");
    444444        infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr,0,0 &threadID);
    445445        if(!infoPtr->hThread)
     
    448448           return FALSE;
    449449    }
    450 
    451     }
    452 
     450       
     451    }
     452       
    453453    ANIMATE_Notify(infoPtr, ACN_START);
    454454
     
    459459static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
    460460{
    461     MMCKINFO        ckMainRIFF;
    462     MMCKINFO        mmckHead;
    463     MMCKINFO        mmckList;
    464     MMCKINFO        mmckInfo;
    465     DWORD       numFrame;
    466     DWORD       insize;
     461    MMCKINFO            ckMainRIFF;
     462    MMCKINFO            mmckHead;
     463    MMCKINFO            mmckList;
     464    MMCKINFO            mmckInfo;
     465    DWORD               numFrame;
     466    DWORD               insize;
    467467
    468468    if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {
    469     WARN("Can't find 'RIFF' chunk\n");
    470     return FALSE;
     469        WARN("Can't find 'RIFF' chunk\n");
     470        return FALSE;
    471471    }
    472472
    473473    if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
    474     (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {
    475     WARN("Can't find 'AVI ' chunk\n");
    476     return FALSE;
     474        (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {
     475        WARN("Can't find 'AVI ' chunk\n");
     476        return FALSE;
    477477    }
    478478
    479479    mmckHead.fccType = mmioFOURCC('h', 'd', 'r', 'l');
    480480    if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {
    481     WARN("Can't find 'hdrl' list\n");
    482     return FALSE;
     481        WARN("Can't find 'hdrl' list\n");
     482        return FALSE;
    483483    }
    484484
    485485    mmckInfo.ckid = mmioFOURCC('a', 'v', 'i', 'h');
    486486    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) {
    487     WARN("Can't find 'avih' chunk\n");
    488     return FALSE;
     487        WARN("Can't find 'avih' chunk\n");
     488        return FALSE;
    489489    }
    490490
    491491    mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah));
    492492
    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);
     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);
    503503
    504504    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     
    506506    mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
    507507    if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {
    508     WARN("Can't find 'strl' list\n");
    509     return FALSE;
     508        WARN("Can't find 'strl' list\n");
     509        return FALSE;
    510510    }
    511511
    512512    mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'h');
    513513    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
    514     WARN("Can't find 'strh' chunk\n");
    515     return FALSE;
     514        WARN("Can't find 'strh' chunk\n");
     515        return FALSE;
    516516    }
    517517
    518518    mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));
    519519
    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);
     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);
    541541
    542542    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     
    544544    mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'f');
    545545    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
    546     WARN("Can't find 'strh' chunk\n");
    547     return FALSE;
     546        WARN("Can't find 'strh' chunk\n");
     547        return FALSE;
    548548    }
    549549
    550550    infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
    551551    if (!infoPtr->inbih) {
    552     WARN("Can't alloc input BIH\n");
    553     return FALSE;
     552        WARN("Can't alloc input BIH\n");
     553        return FALSE;
    554554    }
    555555
    556556    mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize);
    557557
    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);
     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);
    569569
    570570    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    571571
    572572    mmioAscend(infoPtr->hMMio, &mmckList, 0);
    573 
     573   
    574574#if 0
    575575    /* 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
     576     * an audio stream, so only one strl is allowed 
    577577     */
    578578    mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
    579579    if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {
    580     WARN("There should be a single 'strl' list\n");
    581     return FALSE;
     580        WARN("There should be a single 'strl' list\n");
     581        return FALSE;
    582582    }
    583583#endif
     
    589589    mmckList.fccType = mmioFOURCC('m', 'o', 'v', 'i');
    590590    if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {
    591     WARN("Can't find 'movi' list\n");
    592     return FALSE;
     591        WARN("Can't find 'movi' list\n");
     592        return FALSE;
    593593    }
    594594
    595595    /* FIXME: should handle the 'rec ' LIST when present */
    596596
    597     infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
    598                 infoPtr->mah.dwTotalFrames * sizeof(DWORD));
     597    infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
     598                                infoPtr->mah.dwTotalFrames * sizeof(DWORD));
    599599    if (!infoPtr->lpIndex) {
    600     WARN("Can't alloc index array\n");
    601     return FALSE;
     600        WARN("Can't alloc index array\n");
     601        return FALSE;
    602602    }
    603603
    604604    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);
     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);
    612612    }
    613613    if (numFrame != infoPtr->mah.dwTotalFrames) {
    614     WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames);
    615     return FALSE;
     614        WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames);
     615        return FALSE;
    616616    }
    617617    if (insize > infoPtr->ash.dwSuggestedBufferSize) {
    618     WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize);
    619     infoPtr->ash.dwSuggestedBufferSize = insize;
     618        WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize);
     619        infoPtr->ash.dwSuggestedBufferSize = insize;
    620620    }
    621621
    622622    infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize);
    623623    if (!infoPtr->indata) {
    624     WARN("Can't alloc input buffer\n");
    625     return FALSE;
     624        WARN("Can't alloc input buffer\n");
     625        return FALSE;
    626626    }
    627627
     
    632632static BOOL    ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
    633633{
    634     DWORD   outSize;
     634    DWORD       outSize;
    635635
    636636    /* check uncompressed AVI */
     
    638638       (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' ')))
    639639    {
    640         infoPtr->hic = 0;
    641     return TRUE;
     640        infoPtr->hic = 0;             
     641        return TRUE;
    642642    }
    643643
     
    645645    infoPtr->hic = ICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS);
    646646    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);
     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);
    653653
    654654    infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize);
    655655    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;
     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;
    664664    }
    665665
    666666    infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage);
    667667    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;
     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;
    676676    }
    677677
     
    691691
    692692    if (!lParam) {
    693     TRACE("Closing avi!\n");
    694     return TRUE;
    695     }
    696 
     693        TRACE("Closing avi!\n");
     694        return TRUE;
     695    }
     696   
    697697    if (!hInstance)
    698698       hInstance = GetWindowLongA(hWnd, GWL_HINSTANCE);
     
    719719#else
    720720    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     }
     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        }
    730730    } 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     }
     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        }
    738738    }
    739739#endif
    740740    if (!ANIMATE_GetAviInfo(infoPtr)) {
    741     WARN("Can't get AVI information\n");
    742     ANIMATE_Free(infoPtr);
    743     return FALSE;
     741        WARN("Can't get AVI information\n");
     742        ANIMATE_Free(infoPtr);
     743        return FALSE;
    744744    }
    745745
    746746    if (!ANIMATE_GetAviCodec(infoPtr)) {
    747     WARN("Can't get AVI Codec\n");
    748     ANIMATE_Free(infoPtr);
    749     return FALSE;
     747        WARN("Can't get AVI Codec\n");
     748        ANIMATE_Free(infoPtr);
     749        return FALSE;
    750750    }
    751751
    752752    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);
     753        SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
     754                     SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
    755755    }
    756756
    757757    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) {
    758     return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1));
     758        return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1));
    759759    }
    760760
     
    771771    /* nothing opened */
    772772    if (!infoPtr->hMMio)
    773     return FALSE;
     773        return FALSE;
    774774
    775775    ANIMATE_DoStop(infoPtr);
     
    780780static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
    781781{
    782     ANIMATE_INFO*   infoPtr;
     782    ANIMATE_INFO*       infoPtr;
    783783
    784784    /* allocate memory for info structure */
     
    789789#endif
    790790    if (!infoPtr) {
    791     ERR("could not allocate info memory!\n");
    792     return 0;
     791        ERR("could not allocate info memory!\n");
     792        return 0;
    793793    }
    794794
     
    802802
    803803    InitializeCriticalSection(&infoPtr->cs);
    804 
     804   
    805805    return 0;
    806806}
     
    826826{
    827827    RECT rect;
    828     HBRUSH hBrush = 0;
    829 
    830     if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     828    HBRUSH hBrush = 0;       
     829
     830    if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 
    831831    {
    832         hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);
     832        hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);   
    833833    }
    834834
     
    842842{
    843843    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
    844     InvalidateRect(hWnd, NULL, TRUE);
     844        InvalidateRect(hWnd, NULL, TRUE);
    845845    }
    846846    return TRUE;
     
    851851    TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam);
    852852    if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE))
    853     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     853        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    854854    switch (uMsg)
    855855    {
     
    862862#else
    863863    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 
     864        return ANIMATE_OpenA(hWnd, wParam, lParam);
     865       
     866        /*      case ACM_OPEN32W: FIXME!! */
     867        /*          return ANIMATE_Open32W(hWnd, wParam, lParam); */
     868#endif
     869       
    870870    case ACM_PLAY:
    871     return ANIMATE_Play(hWnd, wParam, lParam);
    872 
     871        return ANIMATE_Play(hWnd, wParam, lParam);
     872       
    873873    case ACM_STOP:
    874     return ANIMATE_Stop(hWnd, wParam, lParam);
    875 
     874        return ANIMATE_Stop(hWnd, wParam, lParam);
     875       
    876876    case WM_NCCREATE:
    877     ANIMATE_Create(hWnd, wParam, lParam);
    878     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    879 
     877        ANIMATE_Create(hWnd, wParam, lParam);
     878        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     879       
    880880    case WM_NCHITTEST:
    881     return HTTRANSPARENT;
     881        return HTTRANSPARENT;
    882882
    883883    case WM_DESTROY:
    884     ANIMATE_Destroy(hWnd, wParam, lParam);
    885     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    886 
     884        ANIMATE_Destroy(hWnd, wParam, lParam);
     885        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     886       
    887887    case WM_ERASEBKGND:
    888     ANIMATE_EraseBackground(hWnd, wParam, lParam);
    889     break;
    890 
    891     /*  case WM_STYLECHANGED: FIXME shall we do something ?? */
     888        ANIMATE_EraseBackground(hWnd, wParam, lParam);
     889        break;
     890
     891    /*  case WM_STYLECHANGED: FIXME shall we do something ?? */
    892892
    893893    case WM_TIMER:
    894         if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     894        if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
    895895        {
    896896            ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
    897897            infoPtr->hbrushBG = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);
    898898        }
    899     return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));
    900 
     899        return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));
     900       
    901901    case WM_CLOSE:
    902     ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd));
    903     return TRUE;
     902        ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd));
     903        return TRUE;
    904904
    905905    case WM_PAINT:
    906906        {
    907907            ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
    908 
     908               
    909909            /* 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 
     910            if(!infoPtr->uTimer && !infoPtr->hThread)
     911                /* default paint handling */
     912                return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     913           
    914914            if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
    915915                infoPtr->hbrushBG = SendMessageA(GetParent(hWnd), WM_CTLCOLORSTATIC,
    916                                          (HDC)wParam, hWnd);
    917 
     916                                                 (HDC)wParam, hWnd);
     917   
    918918            if (wParam)
    919919            {
     
    924924            else
    925925            {
    926             PAINTSTRUCT ps;
    927             HDC hDC = BeginPaint(hWnd, &ps);
     926                PAINTSTRUCT ps;
     927                HDC hDC = BeginPaint(hWnd, &ps);
    928928
    929929                EnterCriticalSection(&infoPtr->cs);
    930930                ANIMATE_PaintFrame(infoPtr, hDC);
    931931                LeaveCriticalSection(&infoPtr->cs);
    932 
    933             EndPaint(hWnd, &ps);
     932   
     933                EndPaint(hWnd, &ps);
     934            }
    934935        }
    935         }
    936     break;
     936        break;
    937937
    938938    case WM_SIZE:
    939     ANIMATE_Size(hWnd, wParam, lParam);
    940     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     939        ANIMATE_Size(hWnd, wParam, lParam);
     940        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    941941
    942942    default:
    943     if (uMsg >= WM_USER)
    944         ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
    945 
     943        if (uMsg >= WM_USER)
     944            ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
     945       
    946946#ifdef __WIN32OS2__
    947947        return defComCtl32ProcA (hWnd, uMsg, wParam, lParam);
    948948#else
    949     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     949        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    950950#endif
    951951    }
     
    966966    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
    967967    wndClass.lpszClassName = ANIMATE_CLASSA;
    968 
     968 
    969969    RegisterClassA(&wndClass);
    970970}
Note: See TracChangeset for help on using the changeset viewer.