Changeset 5630 for trunk/src


Ignore:
Timestamp:
Apr 29, 2001, 12:30:59 PM (24 years ago)
Author:
sandervl
Message:

wine resync

Location:
trunk/src/comctl32
Files:
3 added
3 deleted
7 edited

Legend:

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

    r5418 r5630  
    44 *
    55 * Copyright 1998, 1999 Eric Kohl
    6  *         1999 Eric Pouech
     6 *                 1999 Eric Pouech
    77 *
    88 * NOTES
     
    1515 */
    1616
    17 
     17#include <string.h>
    1818#include "winbase.h"
    1919#include "commctrl.h"
    2020#include "vfw.h"
    2121#include "mmsystem.h"
    22 #include "services.h"
    2322#include "debugtools.h"
    2423#ifdef __WIN32OS2__
     
    3130{
    3231#ifdef __WIN32OS2__
    33     COMCTL32_HEADER header;
    34 #endif
    35 
    36    /* pointer to msvideo functions. it's easier to put them here.
    37     * to be correct, they should be defined on a per process basis, but
    38     * this would required a per process storage. We're using a per object
    39     * storage instead, which is not efficient on memory usage, but
    40     * will lead to less bugs in the future
    41     */
    42 #ifdef __WIN32OS2__
    43    HIC      (* WINAPI fnICOpen)(DWORD, DWORD, UINT);
    44    LRESULT  (* WINAPI fnICClose)(HIC);
    45    LRESULT  (* WINAPI fnICSendMessage)(HIC, UINT, DWORD, DWORD);
    46    DWORD    (* WINAPIV fnICDecompress)(HIC,DWORD,LPBITMAPINFOHEADER,LPVOID,LPBITMAPINFOHEADER,LPVOID);
    47 
    48     HMMIO (* WINAPI fnmmioOpenA)(LPSTR,MMIOINFO*,DWORD);
    49     HMMIO (* WINAPI fnmmioOpenW)(LPSTR,MMIOINFO*,DWORD);
    50     MMRESULT (* WINAPI fnmmioClose)(HMMIO,UINT);
    51     UINT  (* WINAPI fnmmioAscend)(HMMIO,MMCKINFO*,UINT);
    52     UINT  (* WINAPI fnmmioDescend)(HMMIO,MMCKINFO*,const MMCKINFO*,UINT);
    53     LONG  (* WINAPI fnmmioSeek)(HMMIO,LONG,INT);
    54     LONG  (* WINAPI fnmmioRead)(HMMIO,HPSTR,LONG);
    55 #else
    56    HIC      WINAPI  (*fnICOpen)(DWORD, DWORD, UINT);
    57    LRESULT  WINAPI  (*fnICClose)(HIC);
    58    LRESULT  WINAPI  (*fnICSendMessage)(HIC, UINT, DWORD, DWORD);
    59    DWORD    WINAPIV (*fnICDecompress)(HIC,DWORD,LPBITMAPINFOHEADER,LPVOID,LPBITMAPINFOHEADER,LPVOID);
    60 
    61     HMMIO WINAPI (*fnmmioOpenA)(LPSTR,MMIOINFO*,DWORD);
    62     MMRESULT WINAPI (*fnmmioClose)(HMMIO,UINT);
    63     UINT  WINAPI (*fnmmioAscend)(HMMIO,MMCKINFO*,UINT);
    64     UINT  WINAPI (*fnmmioDescend)(HMMIO,MMCKINFO*,const MMCKINFO*,UINT);
    65     LONG  WINAPI (*fnmmioSeek)(HMMIO,LONG,INT);
    66     LONG  WINAPI (*fnmmioRead)(HMMIO,HPSTR,LONG);
    67 #endif
    68 
     32   COMCTL32_HEADER      header;
     33#endif
    6934   /* reference to input stream (file or resource) */
    70    HGLOBAL      hRes;
    71    HMMIO            hMMio;  /* handle to mmio stream */
    72    HWND         hWnd;
     35   HGLOBAL              hRes;
     36   HMMIO                hMMio;  /* handle to mmio stream */
     37   HWND                 hWnd;
    7338   /* information on the loaded AVI file */
    74    MainAVIHeader    mah;
    75    AVIStreamHeader  ash;
    76    LPBITMAPINFOHEADER   inbih;
    77    LPDWORD      lpIndex;
     39   MainAVIHeader        mah;
     40   AVIStreamHeader      ash;
     41   LPBITMAPINFOHEADER   inbih;
     42   LPDWORD              lpIndex;
    7843   /* data for the decompressor */
    79    HIC          hic;
    80    LPBITMAPINFOHEADER   outbih;
    81    LPVOID       indata;
    82    LPVOID       outdata;
     44   HIC                  hic;
     45   LPBITMAPINFOHEADER   outbih;
     46   LPVOID               indata;
     47   LPVOID               outdata;
    8348   /* data for the background mechanism */
    84    CRITICAL_SECTION cs;
    85    HANDLE       hThread;
    86    UINT         uTimer;
     49   CRITICAL_SECTION     cs;
     50   HANDLE               hThread;
     51   UINT                 uTimer;
    8752   /* data for playing the file */
    88    int          nFromFrame;
    89    int          nToFrame;
    90    int          nLoop;
    91    int          currFrame;
     53   int                  nFromFrame;
     54   int                  nToFrame;
     55   int                  nLoop;
     56   int                  currFrame;
    9257   /* tranparency info*/
    93    COLORREF             transparentColor;
    94    HBRUSH               hbrushBG;
    95    HBITMAP              hbmPrevFrame;
     58   COLORREF             transparentColor;   
     59   HBRUSH               hbrushBG;
     60   HBITMAP              hbmPrevFrame;
    9661} ANIMATE_INFO;
    9762
    9863#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongA(hWnd, 0))
    99 #define ANIMATE_COLOR_NONE      0xffffffff
    100 
    101 HMODULE hModWinmm;
     64#define ANIMATE_COLOR_NONE      0xffffffff
    10265
    10366static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
    10467{
    105     SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND,
    106          MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif),
    107         (LPARAM)infoPtr->hWnd);
     68    SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND, 
     69                 MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif),
     70                (LPARAM)infoPtr->hWnd);
    10871}
    10972
     
    11477#endif
    11578{
    116     HRSRC   hrsrc;
    117     MMIOINFO    mminfo;
    118     LPVOID  lpAvi;
    119 
     79    HRSRC       hrsrc;
     80    MMIOINFO    mminfo;
     81    LPVOID      lpAvi;
     82   
    12083#ifdef __WIN32OS2__
    12184    if (unicode)
     
    12790#endif
    12891    if (!hrsrc)
    129     return FALSE;
    130 
     92        return FALSE;
     93   
    13194    infoPtr->hRes = LoadResource(hInst, hrsrc);
    13295    if (!infoPtr->hRes)
    133     return FALSE;
    134 
     96        return FALSE;
     97   
    13598    lpAvi = LockResource(infoPtr->hRes);
    13699    if (!lpAvi)
    137     return FALSE;
    138 
     100        return FALSE;
     101   
    139102    memset(&mminfo, 0, sizeof(mminfo));
    140103    mminfo.fccIOProc = FOURCC_MEM;
    141104    mminfo.pchBuffer = (LPSTR)lpAvi;
    142105    mminfo.cchBuffer = SizeofResource(hInst, hrsrc);
    143     infoPtr->hMMio = infoPtr->fnmmioOpenA(NULL, &mminfo, MMIO_READ);
    144 
     106    infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ);
    145107    if (!infoPtr->hMMio) {
    146     GlobalFree((HGLOBAL)lpAvi);
    147     return FALSE;
     108        GlobalFree((HGLOBAL)lpAvi);
     109        return FALSE;
    148110    }
    149111
     
    160122#ifdef __WIN32OS2__
    161123    if (unicode)
    162       infoPtr->hMMio = infoPtr->fnmmioOpenW(lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
     124      infoPtr->hMMio = mmioOpenW(lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    163125    else
    164       infoPtr->hMMio = infoPtr->fnmmioOpenA((LPSTR)lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
     126      infoPtr->hMMio = mmioOpenA((LPSTR)lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    165127#else
    166     infoPtr->hMMio = infoPtr->fnmmioOpenA((LPSTR)lpName, NULL,
    167                    MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    168 #endif
    169 
     128    infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL,
     129                               MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
     130#endif
    170131    if (!infoPtr->hMMio)
    171     return FALSE;
    172 
     132        return FALSE;
     133   
    173134    return TRUE;
    174135}
     
    180141
    181142    /* should stop playing */
    182     if (infoPtr->hThread)
     143    if (infoPtr->hThread) 
    183144    {
    184145        if (!TerminateThread(infoPtr->hThread,0))
    185146            WARN("could not destroy animation thread!\n");
    186         infoPtr->hThread = 0;
     147            infoPtr->hThread = 0;
    187148    }
    188149    if (infoPtr->uTimer) {
    189     KillTimer(infoPtr->hWnd, infoPtr->uTimer);
    190     infoPtr->uTimer = 0;
     150        KillTimer(infoPtr->hWnd, infoPtr->uTimer);
     151        infoPtr->uTimer = 0;
    191152    }
    192153
     
    202163{
    203164    if (infoPtr->hMMio) {
    204     ANIMATE_DoStop(infoPtr);
    205     infoPtr->fnmmioClose(infoPtr->hMMio, 0);
    206     if (infoPtr->hRes) {
    207         FreeResource(infoPtr->hRes);
    208         infoPtr->hRes = 0;
    209     }
    210     if (infoPtr->lpIndex) {
    211         HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex);
    212         infoPtr->lpIndex = NULL;
    213     }
    214     if (infoPtr->hic) {
    215         (infoPtr->fnICClose)(infoPtr->hic);
    216         infoPtr->hic = 0;
    217     }
    218     if (infoPtr->inbih) {
    219         HeapFree(GetProcessHeap(), 0, infoPtr->inbih);
    220         infoPtr->inbih = NULL;
    221     }
    222     if (infoPtr->outbih) {
    223         HeapFree(GetProcessHeap(), 0, infoPtr->outbih);
    224         infoPtr->outbih = NULL;
    225     }
     165        ANIMATE_DoStop(infoPtr);
     166        mmioClose(infoPtr->hMMio, 0);
     167        if (infoPtr->hRes) {
     168            FreeResource(infoPtr->hRes);
     169            infoPtr->hRes = 0;
     170        }
     171        if (infoPtr->lpIndex) {
     172            HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex);
     173            infoPtr->lpIndex = NULL;
     174        }
     175        if (infoPtr->hic) {
     176            ICClose(infoPtr->hic);
     177            infoPtr->hic = 0;
     178        }
     179        if (infoPtr->inbih) {
     180            HeapFree(GetProcessHeap(), 0, infoPtr->inbih);
     181            infoPtr->inbih = NULL;
     182        }
     183        if (infoPtr->outbih) {
     184            HeapFree(GetProcessHeap(), 0, infoPtr->outbih);
     185            infoPtr->outbih = NULL;
     186        }
    226187        if( infoPtr->indata )
    227188        {
    228     HeapFree(GetProcessHeap(), 0, infoPtr->indata);
     189        HeapFree(GetProcessHeap(), 0, infoPtr->indata);
    229190            infoPtr->indata = NULL;
    230191        }
    231         if( infoPtr->outdata )
     192        if( infoPtr->outdata )
    232193        {
    233     HeapFree(GetProcessHeap(), 0, infoPtr->outdata);
     194        HeapFree(GetProcessHeap(), 0, infoPtr->outdata);
    234195            infoPtr->outdata = NULL;
    235196        }
    236         if( infoPtr->hbmPrevFrame )
     197        if( infoPtr->hbmPrevFrame )
    237198        {
    238         DeleteObject(infoPtr->hbmPrevFrame);
     199            DeleteObject(infoPtr->hbmPrevFrame);
    239200            infoPtr->hbmPrevFrame = 0;
    240201        }
    241     infoPtr->indata = infoPtr->outdata = NULL;
    242     infoPtr->hWnd = 0;
    243     infoPtr->hMMio = 0;
    244 
    245     memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
    246     memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
    247     infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
    248     }
    249     infoPtr->transparentColor = ANIMATE_COLOR_NONE;
     202        infoPtr->indata = infoPtr->outdata = NULL;
     203        infoPtr->hWnd = 0;
     204        infoPtr->hMMio = 0;
     205       
     206        memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
     207        memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
     208        infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
     209    }
     210    infoPtr->transparentColor = ANIMATE_COLOR_NONE;   
    250211}
    251212
    252213static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource)
    253 {
     214{       
    254215    HDC hdcMask;
    255216    HBITMAP hbmMask;
    256     HBITMAP hbmOld;
    257 
     217    HBITMAP hbmOld;           
     218   
    258219    /* create a transparency mask */
    259220    hdcMask = CreateCompatibleDC(hdcDest);
    260     hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);
    261     hbmOld = SelectObject(hdcMask, hbmMask);
     221    hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);   
     222    hbmOld = SelectObject(hdcMask, hbmMask);             
    262223
    263224    SetBkColor(hdcSource,infoPtr->transparentColor);
    264225    BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY);
    265 
     226           
    266227    /* mask the source bitmap */
    267     SetBkColor(hdcSource, RGB(0,0,0));
    268     SetTextColor(hdcSource, RGB(255,255,255));
     228    SetBkColor(hdcSource, RGB(0,0,0));         
     229    SetTextColor(hdcSource, RGB(255,255,255)); 
    269230    BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
    270231
    271232    /* mask the destination bitmap */
    272     SetBkColor(hdcDest, RGB(255,255,255));
    273     SetTextColor(hdcDest, RGB(0,0,0));
     233    SetBkColor(hdcDest, RGB(255,255,255));   
     234    SetTextColor(hdcDest, RGB(0,0,0));         
    274235    BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
    275236
     
    297258
    298259    if (!hDC || !infoPtr->inbih)
    299     return TRUE;
     260        return TRUE;
    300261
    301262    if (infoPtr->hic )
     
    305266
    306267        nWidth = infoPtr->outbih->biWidth;
    307         nHeight = infoPtr->outbih->biHeight;
     268        nHeight = infoPtr->outbih->biHeight; 
    308269    } else
    309     {
     270    { 
    310271        pBitmapData = infoPtr->indata;
    311272        pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih;
    312273
    313274        nWidth = infoPtr->inbih->biWidth;
    314         nHeight = infoPtr->inbih->biHeight;
    315     }
     275        nHeight = infoPtr->inbih->biHeight; 
     276    } 
    316277
    317278    if(!infoPtr->hbmPrevFrame)
     
    320281    }
    321282
    322     SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS);
    323 
     283    SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS); 
     284   
    324285    hdcMem = CreateCompatibleDC(hDC);
    325286    hbmOld = SelectObject(hdcMem, infoPtr->hbmPrevFrame);
    326287
    327     /*
    328      * we need to get the transparent color even without ACS_TRANSPARENT,
     288    /* 
     289     * we need to get the transparent color even without ACS_TRANSPARENT, 
    329290     * because the style can be changed later on and the color should always
    330      * be obtained in the first frame
     291     * be obtained in the first frame 
    331292     */
    332293    if(infoPtr->transparentColor == ANIMATE_COLOR_NONE)
    333294    {
    334295        infoPtr->transparentColor = GetPixel(hdcMem,0,0);
    335     }
    336 
    337     if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
    338     {
     296    } 
     297
     298    if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 
     299    { 
    339300        HDC hdcFinal = CreateCompatibleDC(hDC);
    340301        HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
    341302        HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal);
    342303        RECT rect;
    343 
     304       
    344305        rect.left = 0;
    345306        rect.top = 0;
    346307        rect.right = nWidth;
    347308        rect.bottom = nHeight;
    348 
     309       
    349310        if(!infoPtr->hbrushBG)
    350311            infoPtr->hbrushBG = GetCurrentObject(hDC, OBJ_BRUSH);
     
    359320        infoPtr->hbmPrevFrame = hbmFinal;
    360321         }
    361 
    362     if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER)
     322   
     323    if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER) 
    363324    {
    364        RECT rect;
     325       RECT rect;   
    365326
    366327       GetWindowRect(infoPtr->hWnd, &rect);
    367        nOffsetX = ((rect.right - rect.left) - nWidth)/2;
    368        nOffsetY = ((rect.bottom - rect.top) - nHeight)/2;
    369     }
    370     BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);
     328       nOffsetX = ((rect.right - rect.left) - nWidth)/2; 
     329       nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; 
     330    }
     331    BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);   
    371332
    372333    SelectObject(hdcMem, hbmOld);
     
    377338static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
    378339{
    379     HDC     hDC;
     340    HDC         hDC;
    380341
    381342    TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop);
     
    383344    EnterCriticalSection(&infoPtr->cs);
    384345
    385     infoPtr->fnmmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
    386     infoPtr->fnmmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
    387 
     346    mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
     347    mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
     348   
    388349    if (infoPtr->hic &&
    389     (infoPtr->fnICDecompress)(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
    390                   infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
     350        ICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
     351                     infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
     352        LeaveCriticalSection(&infoPtr->cs);
     353        WARN("Decompression error\n");
     354        return FALSE;
     355    }
     356
     357    if ((hDC = GetDC(infoPtr->hWnd)) != 0) {
     358        ANIMATE_PaintFrame(infoPtr, hDC);
     359        ReleaseDC(infoPtr->hWnd, hDC);
     360    }
     361
     362    if (infoPtr->currFrame++ >= infoPtr->nToFrame) {
     363        infoPtr->currFrame = infoPtr->nFromFrame;
     364        if (infoPtr->nLoop != -1) {
     365            if (--infoPtr->nLoop == 0) {
     366                ANIMATE_DoStop(infoPtr);
     367            }
     368        }
     369    }
    391370    LeaveCriticalSection(&infoPtr->cs);
    392     WARN("Decompression error\n");
    393     return FALSE;
    394     }
    395 
    396     if ((hDC = GetDC(infoPtr->hWnd)) != 0) {
    397     ANIMATE_PaintFrame(infoPtr, hDC);
    398     ReleaseDC(infoPtr->hWnd, hDC);
    399     }
    400 
    401     if (infoPtr->currFrame++ >= infoPtr->nToFrame) {
    402     infoPtr->currFrame = infoPtr->nFromFrame;
    403     if (infoPtr->nLoop != -1) {
    404         if (--infoPtr->nLoop == 0) {
    405         ANIMATE_DoStop(infoPtr);
    406         }
    407     }
    408     }
    409     LeaveCriticalSection(&infoPtr->cs);
    410371
    411372    return TRUE;
     
    414375static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
    415376{
    416     ANIMATE_INFO*   infoPtr = (ANIMATE_INFO*)ptr_;
     377    ANIMATE_INFO*       infoPtr = (ANIMATE_INFO*)ptr_;
    417378    HDC hDC;
    418 
     379   
    419380    if(!infoPtr)
    420381    {
     
    424385
    425386    while(1)
    426     {
    427         if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     387    {   
     388        if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 
    428389        {
    429390            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 */
    430393            infoPtr->hbrushBG = SendMessageA(GetParent(infoPtr->hWnd),WM_CTLCOLORSTATIC,hDC, infoPtr->hWnd);
    431394            ReleaseDC(infoPtr->hWnd,hDC);
    432395        }
    433 
    434     EnterCriticalSection(&infoPtr->cs);
    435     ANIMATE_DrawFrame(infoPtr);
    436     LeaveCriticalSection(&infoPtr->cs);
    437 
     396       
     397        EnterCriticalSection(&infoPtr->cs);
     398        ANIMATE_DrawFrame(infoPtr);
     399        LeaveCriticalSection(&infoPtr->cs);
     400   
    438401        /* time is in microseconds, we should convert it to milliseconds */
    439402        Sleep((infoPtr->mah.dwMicroSecPerFrame+500)/1000);
    440 }
     403    }
    441404    return TRUE;
    442405}
     
    448411    /* nothing opened */
    449412    if (!infoPtr->hMMio)
    450     return FALSE;
     413        return FALSE;
    451414
    452415    if (infoPtr->hThread || infoPtr->uTimer) {
    453     FIXME("Already playing ? what should I do ??\n");
    454     ANIMATE_DoStop(infoPtr);
     416        FIXME("Already playing ? what should I do ??\n");
     417        ANIMATE_DoStop(infoPtr);
    455418    }
    456419
     
    460423
    461424    if (infoPtr->nToFrame == 0xFFFF)
    462     infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;
    463 
    464     TRACE("(repeat=%d from=%d to=%d);\n",
    465       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);
    466429
    467430    if (infoPtr->nFromFrame >= infoPtr->nToFrame ||
    468     infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
    469     return FALSE;
     431        infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
     432        return FALSE;
    470433
    471434    infoPtr->currFrame = infoPtr->nFromFrame;
    472435
    473436    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) {
    474     TRACE("Using a timer\n");
    475     /* create a timer to display AVI */
    476     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);
    477440    } else {
    478441        DWORD threadID;
    479442
    480     TRACE("Using an animation thread\n");
     443        TRACE("Using an animation thread\n");
    481444        infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr,0,0 &threadID);
    482445        if(!infoPtr->hThread)
     
    485448           return FALSE;
    486449    }
    487 
    488     }
    489 
     450       
     451    }
     452       
    490453    ANIMATE_Notify(infoPtr, ACN_START);
    491454
     
    496459static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
    497460{
    498     MMCKINFO        ckMainRIFF;
    499     MMCKINFO        mmckHead;
    500     MMCKINFO        mmckList;
    501     MMCKINFO        mmckInfo;
    502     DWORD       numFrame;
    503     DWORD       insize;
    504 
    505     if (infoPtr->fnmmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {
    506     WARN("Can't find 'RIFF' chunk\n");
    507     return FALSE;
     461    MMCKINFO            ckMainRIFF;
     462    MMCKINFO            mmckHead;
     463    MMCKINFO            mmckList;
     464    MMCKINFO            mmckInfo;
     465    DWORD               numFrame;
     466    DWORD               insize;
     467
     468    if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {
     469        WARN("Can't find 'RIFF' chunk\n");
     470        return FALSE;
    508471    }
    509472
    510473    if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
    511     (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {
    512     WARN("Can't find 'AVI ' chunk\n");
    513     return FALSE;
     474        (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {
     475        WARN("Can't find 'AVI ' chunk\n");
     476        return FALSE;
    514477    }
    515478
    516479    mmckHead.fccType = mmioFOURCC('h', 'd', 'r', 'l');
    517     if (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {
    518     WARN("Can't find 'hdrl' list\n");
    519     return FALSE;
     480    if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {
     481        WARN("Can't find 'hdrl' list\n");
     482        return FALSE;
    520483    }
    521484
    522485    mmckInfo.ckid = mmioFOURCC('a', 'v', 'i', 'h');
    523     if (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) {
    524     WARN("Can't find 'avih' chunk\n");
    525     return FALSE;
    526     }
    527 
    528     infoPtr->fnmmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah));
    529     TRACE("mah.dwMicroSecPerFrame=%ld\n",   infoPtr->mah.dwMicroSecPerFrame);
    530     TRACE("mah.dwMaxBytesPerSec=%ld\n",     infoPtr->mah.dwMaxBytesPerSec);
    531     TRACE("mah.dwPaddingGranularity=%ld\n",     infoPtr->mah.dwPaddingGranularity);
    532     TRACE("mah.dwFlags=%ld\n",          infoPtr->mah.dwFlags);
    533     TRACE("mah.dwTotalFrames=%ld\n",        infoPtr->mah.dwTotalFrames);
    534     TRACE("mah.dwInitialFrames=%ld\n",      infoPtr->mah.dwInitialFrames);
    535     TRACE("mah.dwStreams=%ld\n",        infoPtr->mah.dwStreams);
    536     TRACE("mah.dwSuggestedBufferSize=%ld\n",    infoPtr->mah.dwSuggestedBufferSize);
    537     TRACE("mah.dwWidth=%ld\n",          infoPtr->mah.dwWidth);
    538     TRACE("mah.dwHeight=%ld\n",         infoPtr->mah.dwHeight);
    539     infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     486    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) {
     487        WARN("Can't find 'avih' chunk\n");
     488        return FALSE;
     489    }
     490
     491    mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah));
     492
     493    TRACE("mah.dwMicroSecPerFrame=%ld\n",       infoPtr->mah.dwMicroSecPerFrame);
     494    TRACE("mah.dwMaxBytesPerSec=%ld\n",         infoPtr->mah.dwMaxBytesPerSec);
     495    TRACE("mah.dwPaddingGranularity=%ld\n",     infoPtr->mah.dwPaddingGranularity);
     496    TRACE("mah.dwFlags=%ld\n",                  infoPtr->mah.dwFlags);
     497    TRACE("mah.dwTotalFrames=%ld\n",            infoPtr->mah.dwTotalFrames);
     498    TRACE("mah.dwInitialFrames=%ld\n",          infoPtr->mah.dwInitialFrames);
     499    TRACE("mah.dwStreams=%ld\n",                infoPtr->mah.dwStreams);
     500    TRACE("mah.dwSuggestedBufferSize=%ld\n",    infoPtr->mah.dwSuggestedBufferSize);
     501    TRACE("mah.dwWidth=%ld\n",                  infoPtr->mah.dwWidth);
     502    TRACE("mah.dwHeight=%ld\n",                 infoPtr->mah.dwHeight);
     503
     504    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    540505
    541506    mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
    542     if (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {
    543     WARN("Can't find 'strl' list\n");
    544     return FALSE;
     507    if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {
     508        WARN("Can't find 'strl' list\n");
     509        return FALSE;
    545510    }
    546511
    547512    mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'h');
    548     if (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
    549     WARN("Can't find 'strh' chunk\n");
    550     return FALSE;
    551     }
    552 
    553     infoPtr->fnmmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));
    554     TRACE("ash.fccType='%c%c%c%c'\n",       LOBYTE(LOWORD(infoPtr->ash.fccType)),
    555                                             HIBYTE(LOWORD(infoPtr->ash.fccType)),
    556                                             LOBYTE(HIWORD(infoPtr->ash.fccType)),
    557                                             HIBYTE(HIWORD(infoPtr->ash.fccType)));
    558     TRACE("ash.fccHandler='%c%c%c%c'\n",    LOBYTE(LOWORD(infoPtr->ash.fccHandler)),
    559                                             HIBYTE(LOWORD(infoPtr->ash.fccHandler)),
    560                                             LOBYTE(HIWORD(infoPtr->ash.fccHandler)),
    561                                             HIBYTE(HIWORD(infoPtr->ash.fccHandler)));
    562     TRACE("ash.dwFlags=%ld\n",          infoPtr->ash.dwFlags);
    563     TRACE("ash.wPriority=%d\n",         infoPtr->ash.wPriority);
    564     TRACE("ash.wLanguage=%d\n",         infoPtr->ash.wLanguage);
    565     TRACE("ash.dwInitialFrames=%ld\n",      infoPtr->ash.dwInitialFrames);
    566     TRACE("ash.dwScale=%ld\n",          infoPtr->ash.dwScale);
    567     TRACE("ash.dwRate=%ld\n",           infoPtr->ash.dwRate);
    568     TRACE("ash.dwStart=%ld\n",          infoPtr->ash.dwStart);
    569     TRACE("ash.dwLength=%ld\n",         infoPtr->ash.dwLength);
    570     TRACE("ash.dwSuggestedBufferSize=%ld\n",    infoPtr->ash.dwSuggestedBufferSize);
    571     TRACE("ash.dwQuality=%ld\n",        infoPtr->ash.dwQuality);
    572     TRACE("ash.dwSampleSize=%ld\n",         infoPtr->ash.dwSampleSize);
    573     TRACE("ash.rcFrame=(%d,%d,%d,%d)\n",    infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left,
    574       infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right);
    575     infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     513    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
     514        WARN("Can't find 'strh' chunk\n");
     515        return FALSE;
     516    }
     517
     518    mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));
     519
     520    TRACE("ash.fccType='%c%c%c%c'\n",           LOBYTE(LOWORD(infoPtr->ash.fccType)),
     521                                                HIBYTE(LOWORD(infoPtr->ash.fccType)),
     522                                                LOBYTE(HIWORD(infoPtr->ash.fccType)),
     523                                                HIBYTE(HIWORD(infoPtr->ash.fccType)));
     524    TRACE("ash.fccHandler='%c%c%c%c'\n",        LOBYTE(LOWORD(infoPtr->ash.fccHandler)),
     525                                                HIBYTE(LOWORD(infoPtr->ash.fccHandler)),
     526                                                LOBYTE(HIWORD(infoPtr->ash.fccHandler)),
     527                                                HIBYTE(HIWORD(infoPtr->ash.fccHandler)));
     528    TRACE("ash.dwFlags=%ld\n",                  infoPtr->ash.dwFlags);
     529    TRACE("ash.wPriority=%d\n",                 infoPtr->ash.wPriority);
     530    TRACE("ash.wLanguage=%d\n",                 infoPtr->ash.wLanguage);
     531    TRACE("ash.dwInitialFrames=%ld\n",          infoPtr->ash.dwInitialFrames);
     532    TRACE("ash.dwScale=%ld\n",                  infoPtr->ash.dwScale);
     533    TRACE("ash.dwRate=%ld\n",                   infoPtr->ash.dwRate);
     534    TRACE("ash.dwStart=%ld\n",                  infoPtr->ash.dwStart);
     535    TRACE("ash.dwLength=%ld\n",                 infoPtr->ash.dwLength);
     536    TRACE("ash.dwSuggestedBufferSize=%ld\n",    infoPtr->ash.dwSuggestedBufferSize);
     537    TRACE("ash.dwQuality=%ld\n",                infoPtr->ash.dwQuality);
     538    TRACE("ash.dwSampleSize=%ld\n",             infoPtr->ash.dwSampleSize);
     539    TRACE("ash.rcFrame=(%d,%d,%d,%d)\n",        infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left,
     540          infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right);
     541
     542    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    576543
    577544    mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'f');
    578     if (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
    579     WARN("Can't find 'strh' chunk\n");
    580     return FALSE;
     545    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
     546        WARN("Can't find 'strh' chunk\n");
     547        return FALSE;
    581548    }
    582549
    583550    infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
    584551    if (!infoPtr->inbih) {
    585     WARN("Can't alloc input BIH\n");
    586     return FALSE;
    587     }
    588 
    589     infoPtr->fnmmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize);
    590     TRACE("bih.biSize=%ld\n",       infoPtr->inbih->biSize);
    591     TRACE("bih.biWidth=%ld\n",      infoPtr->inbih->biWidth);
    592     TRACE("bih.biHeight=%ld\n",     infoPtr->inbih->biHeight);
    593     TRACE("bih.biPlanes=%d\n",      infoPtr->inbih->biPlanes);
    594     TRACE("bih.biBitCount=%d\n",    infoPtr->inbih->biBitCount);
    595     TRACE("bih.biCompression=%ld\n",    infoPtr->inbih->biCompression);
    596     TRACE("bih.biSizeImage=%ld\n",  infoPtr->inbih->biSizeImage);
    597     TRACE("bih.biXPelsPerMeter=%ld\n",  infoPtr->inbih->biXPelsPerMeter);
    598     TRACE("bih.biYPelsPerMeter=%ld\n",  infoPtr->inbih->biYPelsPerMeter);
    599     TRACE("bih.biClrUsed=%ld\n",    infoPtr->inbih->biClrUsed);
    600     TRACE("bih.biClrImportant=%ld\n",   infoPtr->inbih->biClrImportant);
    601     infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    602 
    603     infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckList, 0);
    604 
     552        WARN("Can't alloc input BIH\n");
     553        return FALSE;
     554    }
     555
     556    mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize);
     557
     558    TRACE("bih.biSize=%ld\n",           infoPtr->inbih->biSize);
     559    TRACE("bih.biWidth=%ld\n",          infoPtr->inbih->biWidth);
     560    TRACE("bih.biHeight=%ld\n",         infoPtr->inbih->biHeight);
     561    TRACE("bih.biPlanes=%d\n",          infoPtr->inbih->biPlanes);
     562    TRACE("bih.biBitCount=%d\n",        infoPtr->inbih->biBitCount);
     563    TRACE("bih.biCompression=%ld\n",    infoPtr->inbih->biCompression);
     564    TRACE("bih.biSizeImage=%ld\n",      infoPtr->inbih->biSizeImage);
     565    TRACE("bih.biXPelsPerMeter=%ld\n",  infoPtr->inbih->biXPelsPerMeter);
     566    TRACE("bih.biYPelsPerMeter=%ld\n",  infoPtr->inbih->biYPelsPerMeter);
     567    TRACE("bih.biClrUsed=%ld\n",        infoPtr->inbih->biClrUsed);
     568    TRACE("bih.biClrImportant=%ld\n",   infoPtr->inbih->biClrImportant);
     569
     570    mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     571
     572    mmioAscend(infoPtr->hMMio, &mmckList, 0);
     573   
    605574#if 0
    606575    /* an AVI has 0 or 1 video stream, and to be animated should not contain
    607      * an audio stream, so only one strl is allowed
     576     * an audio stream, so only one strl is allowed 
    608577     */
    609578    mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
    610     if (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {
    611     WARN("There should be a single 'strl' list\n");
    612     return FALSE;
    613     }
    614 #endif
    615 
    616     infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckHead, 0);
     579    if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {
     580        WARN("There should be a single 'strl' list\n");
     581        return FALSE;
     582    }
     583#endif
     584
     585    mmioAscend(infoPtr->hMMio, &mmckHead, 0);
    617586
    618587    /* no need to read optional JUNK chunk */
    619588
    620589    mmckList.fccType = mmioFOURCC('m', 'o', 'v', 'i');
    621     if (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {
    622     WARN("Can't find 'movi' list\n");
    623     return FALSE;
     590    if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {
     591        WARN("Can't find 'movi' list\n");
     592        return FALSE;
    624593    }
    625594
    626595    /* FIXME: should handle the 'rec ' LIST when present */
    627596
    628     infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
    629                 infoPtr->mah.dwTotalFrames * sizeof(DWORD));
     597    infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
     598                                infoPtr->mah.dwTotalFrames * sizeof(DWORD));
    630599    if (!infoPtr->lpIndex) {
    631     WARN("Can't alloc index array\n");
    632     return FALSE;
     600        WARN("Can't alloc index array\n");
     601        return FALSE;
    633602    }
    634603
    635604    numFrame = insize = 0;
    636     while (infoPtr->fnmmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
    637        numFrame < infoPtr->mah.dwTotalFrames) {
    638     infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset;
    639     if (insize < mmckInfo.cksize)
    640         insize = mmckInfo.cksize;
    641     numFrame++;
    642     infoPtr->fnmmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     605    while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
     606           numFrame < infoPtr->mah.dwTotalFrames) {
     607        infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset;
     608        if (insize < mmckInfo.cksize)
     609            insize = mmckInfo.cksize;
     610        numFrame++;
     611        mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    643612    }
    644613    if (numFrame != infoPtr->mah.dwTotalFrames) {
    645     WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames);
    646     return FALSE;
     614        WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames);
     615        return FALSE;
    647616    }
    648617    if (insize > infoPtr->ash.dwSuggestedBufferSize) {
    649     WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize);
    650     infoPtr->ash.dwSuggestedBufferSize = insize;
     618        WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize);
     619        infoPtr->ash.dwSuggestedBufferSize = insize;
    651620    }
    652621
    653622    infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize);
    654623    if (!infoPtr->indata) {
    655     WARN("Can't alloc input buffer\n");
    656     return FALSE;
     624        WARN("Can't alloc input buffer\n");
     625        return FALSE;
    657626    }
    658627
     
    663632static BOOL    ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
    664633{
    665     DWORD   outSize;
     634    DWORD       outSize;
    666635
    667636    /* check uncompressed AVI */
     
    669638       (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' ')))
    670639    {
    671         infoPtr->hic = 0;
    672     return TRUE;
     640        infoPtr->hic = 0;             
     641        return TRUE;
    673642    }
    674643
    675644    /* try to get a decompressor for that type */
    676     infoPtr->hic = (infoPtr->fnICOpen)(ICTYPE_VIDEO,
    677                        infoPtr->ash.fccHandler,
    678                        ICMODE_DECOMPRESS);
     645    infoPtr->hic = ICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS);
    679646    if (!infoPtr->hic) {
    680     WARN("Can't load codec for the file\n");
    681     return FALSE;
    682     }
    683 
    684     outSize = (infoPtr->fnICSendMessage)(infoPtr->hic,
    685                      ICM_DECOMPRESS_GET_FORMAT,
    686                      (DWORD)infoPtr->inbih, 0L);
     647        WARN("Can't load codec for the file\n");
     648        return FALSE;
     649    }
     650   
     651    outSize = ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
     652                            (DWORD)infoPtr->inbih, 0L);
     653
    687654    infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize);
    688655    if (!infoPtr->outbih) {
    689     WARN("Can't alloc output BIH\n");
    690     return FALSE;
    691     }
    692 
    693     if ((infoPtr->fnICSendMessage)(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
    694                    (DWORD)infoPtr->inbih,
    695                    (DWORD)infoPtr->outbih) != ICERR_OK) {
    696     WARN("Can't get output BIH\n");
    697     return FALSE;
     656        WARN("Can't alloc output BIH\n");
     657        return FALSE;
     658    }
     659
     660    if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
     661                      (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
     662        WARN("Can't get output BIH\n");
     663        return FALSE;
    698664    }
    699665
    700666    infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage);
    701667    if (!infoPtr->outdata) {
    702     WARN("Can't alloc output buffer\n");
    703     return FALSE;
    704     }
    705 
    706     if ((infoPtr->fnICSendMessage)(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
    707                    (DWORD)infoPtr->inbih,
    708                    (DWORD)infoPtr->outbih) != ICERR_OK) {
    709     WARN("Can't begin decompression\n");
    710     return FALSE;
     668        WARN("Can't alloc output buffer\n");
     669        return FALSE;
     670    }
     671
     672    if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
     673                      (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
     674        WARN("Can't begin decompression\n");
     675        return FALSE;
    711676    }
    712677
     
    726691
    727692    if (!lParam) {
    728     TRACE("Closing avi!\n");
    729     return TRUE;
    730     }
    731 
     693        TRACE("Closing avi!\n");
     694        return TRUE;
     695    }
     696   
    732697    if (!hInstance)
    733698       hInstance = GetWindowLongA(hWnd, GWL_HINSTANCE);
     
    738703
    739704        if (!ANIMATE_LoadRes(infoPtr, hInstance, (LPWSTR)lParam,unicode)) {
    740             //TRACE("No AVI resource found!\n");
     705            TRACE("No AVI resource found!\n");
    741706            if (!ANIMATE_LoadFile(infoPtr, (LPWSTR)lParam,unicode)) {
    742                 //WARN("No AVI file found!\n");
     707                WARN("No AVI file found!\n");
    743708                return FALSE;
    744709            }
     
    748713
    749714        if (!ANIMATE_LoadRes(infoPtr,hInstance,unicode ? MAKEINTRESOURCEW((INT)lParam):(LPWSTR)MAKEINTRESOURCEA((INT)lParam),unicode)) {
    750             //WARN("No AVI resource found!\n");
     715            WARN("No AVI resource found!\n");
    751716            return FALSE;
    752717        }
     
    773738    }
    774739#endif
    775 
    776740    if (!ANIMATE_GetAviInfo(infoPtr)) {
    777     WARN("Can't get AVI information\n");
    778     ANIMATE_Free(infoPtr);
    779     return FALSE;
     741        WARN("Can't get AVI information\n");
     742        ANIMATE_Free(infoPtr);
     743        return FALSE;
    780744    }
    781745
    782746    if (!ANIMATE_GetAviCodec(infoPtr)) {
    783     WARN("Can't get AVI Codec\n");
    784     ANIMATE_Free(infoPtr);
    785     return FALSE;
     747        WARN("Can't get AVI Codec\n");
     748        ANIMATE_Free(infoPtr);
     749        return FALSE;
    786750    }
    787751
    788752    if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
    789     SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
    790              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);
    791755    }
    792756
    793757    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) {
    794     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));
    795759    }
    796760
     
    807771    /* nothing opened */
    808772    if (!infoPtr->hMMio)
    809     return FALSE;
     773        return FALSE;
    810774
    811775    ANIMATE_DoStop(infoPtr);
     
    816780static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
    817781{
    818     ANIMATE_INFO*   infoPtr;
    819     HMODULE     hModule = LoadLibraryA("msvfw32.dll");
    820 
    821     if (!hModule)
    822         return FALSE;
     782    ANIMATE_INFO*       infoPtr;
    823783
    824784    /* allocate memory for info structure */
     
    829789#endif
    830790    if (!infoPtr) {
    831         ERR("could not allocate info memory!\n");
    832         return 0;
    833     }
    834 
    835     /* Temporary hack until we get dllglue up and running */
    836     infoPtr->fnICOpen        = (void*)GetProcAddress(hModule, "ICOpen");
    837     infoPtr->fnICClose       = (void*)GetProcAddress(hModule, "ICClose");
    838     infoPtr->fnICSendMessage = (void*)GetProcAddress(hModule, "ICSendMessage");
    839     infoPtr->fnICDecompress  = (void*)GetProcAddress(hModule, "ICDecompress");
     791        ERR("could not allocate info memory!\n");
     792        return 0;
     793    }
    840794
    841795    TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)GetParent(hWnd));
     
    846800    infoPtr->transparentColor = ANIMATE_COLOR_NONE;
    847801    infoPtr->hbmPrevFrame = 0;
    848     hModWinmm = LoadLibraryA("WINMM");
    849 
    850     infoPtr->fnmmioOpenA = (void*)GetProcAddress(hModWinmm, "mmioOpenA");
    851 #ifdef __WIN32OS2__
    852     infoPtr->fnmmioOpenW = (void*)GetProcAddress(hModWinmm, "mmioOpenW");
    853 #endif
    854     infoPtr->fnmmioClose = (void*)GetProcAddress(hModWinmm, "mmioClose");
    855     infoPtr->fnmmioAscend = (void*)GetProcAddress(hModWinmm, "mmioAscend");
    856     infoPtr->fnmmioDescend = (void*)GetProcAddress(hModWinmm, "mmioDescend");
    857     infoPtr->fnmmioSeek = (void*)GetProcAddress(hModWinmm, "mmioSeek");
    858     infoPtr->fnmmioRead = (void*)GetProcAddress(hModWinmm, "mmioRead");
    859802
    860803    InitializeCriticalSection(&infoPtr->cs);
    861 
     804   
    862805    return 0;
    863806}
     
    876819    SetWindowLongA(hWnd, 0, 0);
    877820
    878     FreeLibrary(hModWinmm);
    879821    return 0;
    880822}
     
    884826{
    885827    RECT rect;
    886     HBRUSH hBrush = 0;
    887 
    888     if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     828    HBRUSH hBrush = 0;       
     829
     830    if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 
    889831    {
    890         hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);
     832        hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);   
    891833    }
    892834
     
    900842{
    901843    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
    902     InvalidateRect(hWnd, NULL, TRUE);
     844        InvalidateRect(hWnd, NULL, TRUE);
    903845    }
    904846    return TRUE;
     
    909851    TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam);
    910852    if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE))
    911     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     853        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    912854    switch (uMsg)
    913855    {
    914856#ifdef __WIN32OS2__
    915         case ACM_OPENA:
    916           return ANIMATE_Open(hWnd,wParam,lParam,FALSE);
    917 
    918         case ACM_OPENW:
    919           return ANIMATE_Open(hWnd,wParam,lParam,TRUE);
     857    case ACM_OPENA:
     858        return ANIMATE_Open(hWnd,wParam,lParam,FALSE);
     859
     860    case ACM_OPENW:
     861        return ANIMATE_Open(hWnd,wParam,lParam,TRUE);
    920862#else
    921863    case ACM_OPENA:
    922     return ANIMATE_OpenA(hWnd, wParam, lParam);
    923 
    924     /*  case ACM_OPEN32W: FIXME!! */
    925     /*      return ANIMATE_Open32W(hWnd, wParam, lParam); */
    926 #endif
    927 
     864        return ANIMATE_OpenA(hWnd, wParam, lParam);
     865       
     866        /*      case ACM_OPEN32W: FIXME!! */
     867        /*          return ANIMATE_Open32W(hWnd, wParam, lParam); */
     868#endif
     869       
    928870    case ACM_PLAY:
    929     return ANIMATE_Play(hWnd, wParam, lParam);
    930 
     871        return ANIMATE_Play(hWnd, wParam, lParam);
     872       
    931873    case ACM_STOP:
    932     return ANIMATE_Stop(hWnd, wParam, lParam);
    933 
     874        return ANIMATE_Stop(hWnd, wParam, lParam);
     875       
    934876    case WM_NCCREATE:
    935     ANIMATE_Create(hWnd, wParam, lParam);
    936     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    937 
     877        ANIMATE_Create(hWnd, wParam, lParam);
     878        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     879       
    938880    case WM_NCHITTEST:
    939     return HTTRANSPARENT;
     881        return HTTRANSPARENT;
    940882
    941883    case WM_DESTROY:
    942     ANIMATE_Destroy(hWnd, wParam, lParam);
    943     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    944 
     884        ANIMATE_Destroy(hWnd, wParam, lParam);
     885        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     886       
    945887    case WM_ERASEBKGND:
    946     ANIMATE_EraseBackground(hWnd, wParam, lParam);
    947     break;
    948 
    949     /*  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 ?? */
    950892
    951893    case WM_TIMER:
    952         if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
     894        if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
    953895        {
    954896            ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
    955897            infoPtr->hbrushBG = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);
    956898        }
    957     return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));
    958 
     899        return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));
     900       
    959901    case WM_CLOSE:
    960     ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd));
    961     return TRUE;
     902        ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd));
     903        return TRUE;
    962904
    963905    case WM_PAINT:
    964906        {
    965907            ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
    966 
     908               
    967909            /* the animation isn't playing, don't paint */
    968         if(!infoPtr->uTimer && !infoPtr->hThread)
    969         /* default paint handling */
    970             return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    971 
     910            if(!infoPtr->uTimer && !infoPtr->hThread)
     911                /* default paint handling */
     912                return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     913           
    972914            if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
    973915                infoPtr->hbrushBG = SendMessageA(GetParent(hWnd), WM_CTLCOLORSTATIC,
    974                                          (HDC)wParam, hWnd);
    975 
     916                                                 (HDC)wParam, hWnd);
     917   
    976918            if (wParam)
    977919            {
     
    982924            else
    983925            {
    984             PAINTSTRUCT ps;
    985             HDC hDC = BeginPaint(hWnd, &ps);
     926                PAINTSTRUCT ps;
     927                HDC hDC = BeginPaint(hWnd, &ps);
    986928
    987929                EnterCriticalSection(&infoPtr->cs);
    988930                ANIMATE_PaintFrame(infoPtr, hDC);
    989931                LeaveCriticalSection(&infoPtr->cs);
    990 
    991             EndPaint(hWnd, &ps);
     932   
     933                EndPaint(hWnd, &ps);
     934            }
    992935        }
    993         }
    994     break;
     936        break;
    995937
    996938    case WM_SIZE:
    997     ANIMATE_Size(hWnd, wParam, lParam);
    998     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     939        ANIMATE_Size(hWnd, wParam, lParam);
     940        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    999941
    1000942    default:
    1001     if (uMsg >= WM_USER)
    1002         ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
    1003 
    1004 #ifdef __WIN32OS2__
    1005             return defComCtl32ProcA (hWnd, uMsg, wParam, lParam);
     943        if (uMsg >= WM_USER)
     944            ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
     945       
     946#ifdef __WIN32OS2__
     947        return defComCtl32ProcA (hWnd, uMsg, wParam, lParam);
    1006948#else
    1007     return DefWindowProcA(hWnd, uMsg, wParam, lParam);
     949        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    1008950#endif
    1009951    }
     
    1024966    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
    1025967    wndClass.lpszClassName = ANIMATE_CLASSA;
    1026 
     968 
    1027969    RegisterClassA(&wndClass);
    1028970}
  • trunk/src/comctl32/cctl_De.orc

    r3972 r5630  
    11LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
    22
    3 IDD_PROPSHEET DIALOG DISCARDABLE 0,0,223,140
    4 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
    5 CAPTION "Eigenschaften für:"
     3STRINGTABLE DISCARDABLE
     4{
     5     IDS_CLOSE    "Schließen"
     6}
     7 
     8STRINGTABLE DISCARDABLE
     9{
     10     IDM_TODAY    "Heute:"
     11     IDM_GOTODAY  "Gehe zu Heute"
     12}
     13
     14STRINGTABLE DISCARDABLE
     15{
     16    IDS_SEPARATOR "Trennzeichen"
     17}
     18
     19IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
     20STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
     21CAPTION "Eigenschaften für "
    622FONT 8, "MS Sans Serif"
    723BEGIN
    8         DEFPUSHBUTTON "Ok",IDOK,4,122,50,14
    9         PUSHBUTTON "Abbrechen",IDCANCEL,58,122,50,14
    10         PUSHBUTTON "Ubernehmen",IDC_APPLY_BUTTON,112,122,50,14
    11         PUSHBUTTON "Hilfe",IDHELP,166,122,50,14, WS_TABSTOP | WS_GROUP
    12         CONTROL "Tabstopp",IDC_TABCONTROL,"SysTabControl32", WS_CLIPSIBLINGS | WS_TABSTOP ,4,4,215,114
     24  DEFPUSHBUTTON "&OK",        IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
     25  PUSHBUTTON    "A&bbrechen", IDCANCEL,58,122,50,14
     26  PUSHBUTTON    "&Anwenden",  IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED
     27  PUSHBUTTON    "&Hilfe",     IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP
     28  CONTROL       "Tab",        IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP,4,4,212,114
    1329END
    1430
    1531
    16 IDD_WIZARD DIALOG DISCARDABLE 20,20,292,46
    17 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE 
    18 CAPTION "Assistent"
     32IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
     33STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
     34CAPTION "Wizard"
    1935FONT 8, "MS Sans Serif"
    2036BEGIN
    21         DEFPUSHBUTTON "Fertig",IDC_FINISH_BUTTON,119,26,50,14
    22         DEFPUSHBUTTON "&Weiter >",IDC_NEXT_BUTTON,62,26,50,14
    23         PUSHBUTTON "< &Zurück",IDC_BACK_BUTTON,12,26,50,14
    24         PUSHBUTTON "Abbrechen",IDCANCEL,176,26,50,14
    25         PUSHBUTTON "Hilfe",IDHELP,233,26,50,14, WS_GROUP
    26         LTEXT "",IDC_SUNKEN_LINE,7,17,276,1, SS_SUNKEN
    27         CONTROL "Tabstopp",IDC_TABCONTROL,"SysTabControl32", WS_CLIPSIBLINGS | WS_DISABLED ,7,7,276,3
     37  DEFPUSHBUTTON "&Beenden",   IDC_FINISH_BUTTON,121,138,50,14
     38  DEFPUSHBUTTON "&Weiter >", IDC_NEXT_BUTTON,121,138,50,14
     39  PUSHBUTTON    "< &Zurück", IDC_BACK_BUTTON,71,138,50,14
     40  PUSHBUTTON    "Abbrechen", IDCANCEL,178,138,50,14
     41  PUSHBUTTON    "&Hilfe",     IDHELP,235,138,50,14,WS_GROUP
     42  LTEXT         "",          IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN
     43  CONTROL       "Tab",       IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5
    2844END
    2945
    3046
    31 IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10,20,362,125
    32 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU 
    33 CAPTION "Symbolleiste anpassen"
     47IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
     48STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
     49CAPTION "Toolbar einrichten"
    3450FONT 8, "MS Sans Serif"
    3551BEGIN
    36         DEFPUSHBUTTON "S&chließen",IDCANCEL,309,6,49,14
    37         PUSHBUTTON "Zurücksetzen",IDC_RESET_BTN,309,23,49,14
    38         PUSHBUTTON "&Hilfe",IDC_HELP_BTN,309,40,49,14
    39         PUSHBUTTON "Nach &oben",IDC_MOVEUP_BTN,309,74,49,14
    40         PUSHBUTTON "&Nach unten",IDC_MOVEDN_BTN,309,91,49,14
    41         LTEXT "&Verfügbare Schaltflächen:",-1,4,5,84,10
    42         LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
    43         PUSHBUTTON "Hinz&ufügen ->",IDOK,129,42,49,14
    44         PUSHBUTTON "<- &Entfernen",IDC_REMOVE_BTN,129,62,49,14
    45         LTEXT "&Schaltflächen auf Symbolleiste:",-1,183,5,101,10
    46         LISTBOX IDC_TOOLBARBTN_LBOX,183,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
     52  DEFPUSHBUTTON "&Schließen",               IDCANCEL,308,6,44,14
     53  PUSHBUTTON    "&Zurücksetzen",            IDC_RESET_BTN,308,23,44,14
     54  PUSHBUTTON    "&Hilfe",                   IDC_HELP_BTN,308,40,44,14
     55  PUSHBUTTON    "Nach &Oben verschieben",   IDC_MOVEUP_BTN,308,74,44,14
     56  PUSHBUTTON    "Nach &Unten verschieben",  IDC_MOVEDN_BTN,308,91,44,14
     57  LTEXT         "&Vorhandene Knöpfe:", -1,4,5,84,10
     58  LISTBOX       IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
     59  PUSHBUTTON    "H&inzufügen ->",           IDOK, 131, 42, 44, 14
     60  PUSHBUTTON    "<- &Löschen",              IDC_REMOVE_BTN,131,62,44,14
     61  LTEXT         "&Toolbarknöpfe:", -1,182,5,78,10
     62  LISTBOX       IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
    4763END
    4864
     
    6682}
    6783
    68 STRINGTABLE DISCARDABLE
    69 {
    70         IDS_CLOSE       "Schließen"
    71 }
    7284
  • trunk/src/comctl32/comboex.c

    r5416 r5630  
    1919
    2020/*
    21  * ComboBoxEx control v2 (mod4)
     21 * ComboBoxEx control v2 (mod5)
    2222 *
    2323 * Copyright 1998, 1999 Eric Kohl
     
    5959 *   5. The LBN_SELCHANGE is just for documentation purposes.
    6060 *
     61 *  mod 5
     62 *   1. Add support for CB_GETITEMDATA to a Comboex. Returns the LPARAM
     63 *      passed during insert of item.
     64 *   2. Remember selected item and don't issue CB_SETCURSEL unless needed.
     65 *   3. Add initial support for WM_NCCREATE to remove unwanted window styles
     66 *      (Currently just WS_VSCROLL and WS_HSCROLL, but probably should be
     67 *       more.)
     68 *   4. Improve some traces.
     69 *   5. Add support for CB_SETITEMDATA sets LPARAM value from item.
     70 *
    6171 * Test vehicals were the ControlSpy modules (rebar.exe and comboboxex.exe),
    62  *  and IE 4.0.
     72 *  WinRAR, and IE 4.0.
    6373 *
    6474 */
     
    6979#include "debugtools.h"
    7080#include "wine/unicode.h"
    71 
    7281#ifdef __WIN32OS2__
    7382#include "ccbase.h"
     
    109118    WNDPROC      prevComboWndProc;   /* previous Combo WNDPROC value */
    110119    DWORD        dwExtStyle;
     120    INT          selected;         /* index of selected item */
    111121    DWORD        flags;            /* WINE internal flags */
    112122    HFONT        font;
     
    882892
    883893static LRESULT
     894COMBOEX_GetItemData (HWND hwnd, WPARAM wParam, LPARAM lParam)
     895{
     896    INT index = wParam;
     897    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
     898    CBE_ITEMDATA *item1, *item2;
     899    LRESULT lret = 0;
     900
     901    item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA,
     902                                             wParam, lParam);
     903    if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) {
     904        item2 = COMBOEX_FindItem (infoPtr, index);
     905        if (item2 != item1) {
     906            ERR("data structures damaged!\n");
     907            return CB_ERR;
     908        }
     909        if (item1->mask & CBEIF_LPARAM)
     910            lret = (LRESULT) item1->lParam;
     911        TRACE("returning 0x%08lx\n", lret);
     912        return lret;
     913    }
     914    lret = (LRESULT)item1;
     915    TRACE("non-valid result from combo, returning 0x%08lx\n", lret);
     916    return lret;
     917}
     918
     919
     920static LRESULT
    884921COMBOEX_SetCursel (HWND hwnd, WPARAM wParam, LPARAM lParam)
    885922{
     
    896933    TRACE("selecting item %d text=%s\n", index, (item->pszText) ?
    897934          debugstr_w(item->pszText) : "<null>");
     935    infoPtr->selected = index;
    898936
    899937    lret = SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, wParam, lParam);
    900938    COMBOEX_SetEditText (infoPtr, item);
    901939    return lret;
     940}
     941
     942
     943static LRESULT
     944COMBOEX_SetItemData (HWND hwnd, WPARAM wParam, LPARAM lParam)
     945{
     946    INT index = wParam;
     947    COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
     948    CBE_ITEMDATA *item1, *item2;
     949
     950    item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA,
     951                                             wParam, lParam);
     952    if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) {
     953        item2 = COMBOEX_FindItem (infoPtr, index);
     954        if (item2 != item1) {
     955            ERR("data structures damaged!\n");
     956            return CB_ERR;
     957        }
     958        item1->mask |= CBEIF_LPARAM;
     959        item1->lParam = lParam;
     960        TRACE("setting lparam to 0x%08lx\n", lParam);
     961        return 0;
     962    }
     963    TRACE("non-valid result from combo 0x%08lx\n", (DWORD)item1);
     964    return (LRESULT)item1;
    902965}
    903966
     
    9681031    infoPtr->nb_items = 0;
    9691032    infoPtr->hwndSelf = hwnd;
     1033    infoPtr->selected = -1;
    9701034
    9711035    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
     
    9751039                        (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);
    9761040
    977     TRACE("combo style=%08lx, additional style=%08lx\n", dwComboStyle,
     1041    GetWindowRect(hwnd, &wnrc1);
     1042    GetClientRect(hwnd, &clrc1);
     1043    TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d)\n",
     1044          wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
     1045          clrc1.left, clrc1.top, clrc1.right, clrc1.bottom);
     1046    TRACE("combo style=%08lx, adding style=%08lx\n", dwComboStyle,
    9781047          WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL |
    9791048          CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST |
     
    10771146    GetClientRect(hwnd, &clrc1);
    10781147    GetWindowRect(infoPtr->hwndCombo, &cmbwrc);
    1079     TRACE("Ex wnd=(%d,%d)-(%d,%d) Ex clt=(%d,%d)-(%d,%d) Cb wnd=(%d,%d)-(%d,%d)\n",
     1148    TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) CB wnd=(%d,%d)-(%d,%d)\n",
    10801149          wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
    10811150          clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
     
    10861155
    10871156    GetWindowRect(infoPtr->hwndCombo, &cmbwrc);
    1088     TRACE("Ex wnd=(%d,%d)-(%d,%d)\n",
     1157    TRACE("CB window=(%d,%d)-(%d,%d)\n",
    10891158          cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
    10901159    SetWindowPos(hwnd, HWND_TOP,
     
    11181187    INT cursel, n, oldItem;
    11191188    NMCBEENDEDITA cbeend;
     1189    DWORD oldflags;
    11201190
    11211191    TRACE("for command %d\n", command);
     
    11711241            }
    11721242        }
    1173         if (infoPtr->flags & WCBE_ACTEDIT) {
     1243
     1244        /* Save flags for testing and reset them */
     1245        oldflags = infoPtr->flags;
     1246        infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
     1247
     1248        if (oldflags & WCBE_ACTEDIT) {
    11741249            WideCharToMultiByte (CP_ACP, 0, item->pszText, -1,
    11751250                                 cbeend.szText, sizeof(cbeend.szText),
    11761251                                 NULL, NULL);
    1177             cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
     1252            cbeend.fChanged = (oldflags & WCBE_EDITCHG);
    11781253            cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
    11791254                                                 CB_GETCURSEL, 0, 0);
    11801255            cbeend.iWhy = CBENF_DROPDOWN;
    11811256
    1182             infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
    11831257            if (COMBOEX_Notify (infoPtr, CBEN_ENDEDITA,
    11841258                                (NMHDR *)&cbeend, FALSE)) {
     
    11881262            }
    11891263        }
    1190         SendMessageW (hwnd, CB_SETCURSEL, cursel, 0);
    1191         SetFocus(infoPtr->hwndCombo);
     1264
     1265        /* if selection has changed the set the new current selection */
     1266        cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
     1267        if ((oldflags & WCBE_EDITCHG) || (cursel != infoPtr->selected)) {
     1268            infoPtr->selected = cursel;
     1269            SendMessageW (hwnd, CB_SETCURSEL, cursel, 0);
     1270            SetFocus(infoPtr->hwndCombo);
     1271        }
    11921272        return 0;
    11931273
     
    12101290            ERR("item %d not found. Problem!\n", oldItem);
    12111291            break;
    1212         } 
     1292        }
     1293        infoPtr->selected = oldItem;
    12131294        COMBOEX_SetEditText (infoPtr, item);
    12141295        return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam,
     
    16191700
    16201701static LRESULT
     1702COMBOEX_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
     1703{
     1704    /* WARNING: The COMBOEX_INFO structure is not yet created */
     1705    DWORD oldstyle, newstyle;
     1706
     1707    oldstyle = (DWORD)GetWindowLongA (hwnd, GWL_STYLE);
     1708    newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL);
     1709    if (newstyle != oldstyle) {
     1710        TRACE("req style %08lx, reseting style %08lx\n",
     1711              oldstyle, newstyle);
     1712        SetWindowLongA (hwnd, GWL_STYLE, newstyle);
     1713    }
     1714    return 1;
     1715}
     1716
     1717
     1718static LRESULT
    16211719COMBOEX_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
    16221720{
     
    16561754            - (cbx_crect.right-cbx_crect.left);
    16571755
     1756    TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n",
     1757          wp->x, wp->y, wp->cx, wp->cy, wp->flags);
    16581758    TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n",
    16591759          cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
     
    17711871                    break;
    17721872                }
    1773                  
     1873                infoPtr->selected = oldItem;             
    17741874                COMBOEX_SetEditText (infoPtr, item);
    17751875                RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |
     
    21102210{
    21112211    TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam);
    2112     if (!COMBOEX_GetInfoPtr (hwnd) && (uMsg != WM_CREATE))
     2212
     2213    if (!COMBOEX_GetInfoPtr (hwnd)) {
     2214        if (uMsg == WM_CREATE)
     2215            return COMBOEX_Create (hwnd, wParam, lParam);
     2216        if (uMsg == WM_NCCREATE)
     2217            COMBOEX_NCCreate (hwnd, wParam, lParam);
    21132218        return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     2219    }
    21142220
    21152221    switch (uMsg)
     
    21672273/*   Combo messages we are not sure if we need to process or just forward */
    21682274        case CB_GETDROPPEDCONTROLRECT:
    2169         case CB_GETITEMDATA:
    21702275        case CB_GETITEMHEIGHT:
    21712276        case CB_GETLBTEXT:
     
    21752280        case CB_RESETCONTENT:
    21762281        case CB_SELECTSTRING:
    2177         case CB_SETITEMDATA:
    21782282        case WM_SETTEXT:
    21792283        case WM_GETTEXT:
    2180             FIXME("(0x%x 0x%x 0x%lx): possible missing fucntion\n",
     2284            FIXME("(0x%x 0x%x 0x%lx): possibly missing function\n",
    21812285                  uMsg, wParam, lParam);
    21822286            return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
     
    21962300                                            wParam, lParam);
    21972301
     2302        case CB_GETITEMDATA:
     2303            return COMBOEX_GetItemData (hwnd, wParam, lParam);
     2304
    21982305        case CB_SETCURSEL:
    21992306            return COMBOEX_SetCursel (hwnd, wParam, lParam);
     2307
     2308        case CB_SETITEMDATA:
     2309            return COMBOEX_SetItemData (hwnd, wParam, lParam);
    22002310
    22012311        case CB_SETITEMHEIGHT:
     
    22132323
    22142324/*   Window messages we need to process */
    2215         case WM_CREATE:
    2216             return COMBOEX_Create (hwnd, wParam, lParam);
    2217 
    22182325        case WM_DELETEITEM:
    22192326            return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam);
     
    22412348            return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    22422349#else
    2243             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     2350            return DefWindowProcA (hwnd, uMsg, wParam, lParam);
    22442351#endif
    22452352    }
  • trunk/src/comctl32/comctl32.def

    r5416 r5630  
    1 ; $Id: comctl32.def,v 1.21 2001-03-31 13:25:26 sandervl Exp $
     1; $Id: comctl32.def,v 1.22 2001-04-29 10:30:56 sandervl Exp $
    22LIBRARY COMCTL32 INITINSTANCE
    33DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library'
     
    103103; ordinals????
    104104  FreeMRUListA        = _FreeMRUListA@4            @152
    105   AddMRUData          = _AddMRUData@12             @153
    106   FindMRUData         = _FindMRUData@16            @154
    107   CreateMRUListLazyA  = _CreateMRUListLazyA@16     @155
     105  AddMRUStringA       = _AddMRUStringA@8           @153
     106  EnumMRUListA        = _EnumMRUListA@16           @154
     107  FindMRUStringA      = _FindMRUStringA@12         @155
     108  DelMRUString        = _DelMRUString@8            @156
     109  CreateMRUListLazyA  = _CreateMRUListLazyA@16     @157
     110
     111  AddMRUData          = _AddMRUData@12             @167
     112  FindMRUData         = _FindMRUData@16            @169
    108113
    109114  Str_GetPtrA         = _Str_GetPtrA@12            @233
     
    164169  StrSpnW             = _COMCTL32_StrSpnW@8        @364
    165170
    166   comctl32_410        = _comctl32_410@16           @410
    167   comctl32_411        = _comctl32_411@12           @411
    168   comctl32_412        = _comctl32_412@12           @412
    169   comctl32_413        = _comctl32_413@16           @413
     171                        _comctl32_410@16           @410 NONAME
     172                        _comctl32_411@12           @411 NONAME
     173                        _comctl32_412@12           @412 NONAME
     174                        _comctl32_413@16           @413 NONAME
     175                        _COMCTL32_415@20           @415 NONAME
  • trunk/src/comctl32/comctl32.h

    r5416 r5630  
    1 /* $Id: comctl32.h,v 1.19 2001-03-31 13:25:26 sandervl Exp $ */
     1/* $Id: comctl32.h,v 1.20 2001-04-29 10:30:56 sandervl Exp $ */
    22/*
    33 * Win32 common controls implementation
     
    208208void UPDOWN_Unregister(void);
    209209
     210
     211INT  Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen);
     212BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc);
     213
    210214#ifdef __cplusplus
    211215}
  • trunk/src/comctl32/comctl32undoc.cpp

    r5416 r5630  
    1 /* $Id: comctl32undoc.cpp,v 1.8 2001-03-31 13:25:26 sandervl Exp $ */
     1/* $Id: comctl32undoc.cpp,v 1.9 2001-04-29 10:30:56 sandervl Exp $ */
    22/*
    33 * Undocumented functions from COMCTL32.DLL
     
    25452545}
    25462546
    2547 
     2547/**************************************************************************
     2548 * COMCTL32_415 [COMCTL32.415]
     2549 *
     2550 * FIXME: What's this supposed to do?
     2551 *        Parameter 1 is an HWND, you're on your own for the rest.
     2552 */
     2553
     2554BOOL WINAPI COMCTL32_415( HWND hwnd, DWORD b, DWORD c, DWORD d, DWORD e)
     2555{
     2556
     2557   FIXME("(%x, %lx, %lx, %lx, %lx): stub!\n", hwnd, b, c, d, e);
     2558
     2559   return TRUE;
     2560}
     2561
     2562/**************************************************************************
     2563 * Str_GetPtrWtoA [internal]
     2564 *
     2565 * Converts a unicode string into a multi byte string
     2566 *
     2567 * PARAMS
     2568 *     lpSrc   [I] Pointer to the unicode source string
     2569 *     lpDest  [O] Pointer to caller supplied storage for the multi byte string
     2570 *     nMaxLen [I] Size, in bytes, of the destination buffer
     2571 *
     2572 * RETURNS
     2573 *     Length, in bytes, of the converted string.
     2574 */
     2575
     2576INT
     2577Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen)
     2578{
     2579    INT len;
     2580
     2581    TRACE("(%s %p %d)\n", debugstr_w(lpSrc), lpDest, nMaxLen);
     2582
     2583    if (!lpDest && lpSrc)
     2584        return WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL);
     2585
     2586    if (nMaxLen == 0)
     2587        return 0;
     2588
     2589    if (lpSrc == NULL) {
     2590        lpDest[0] = '\0';
     2591        return 0;
     2592    }
     2593
     2594    len = WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL);
     2595    if (len >= nMaxLen)
     2596        len = nMaxLen - 1;
     2597
     2598    WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, lpDest, len, NULL, NULL);
     2599    lpDest[len] = '\0';
     2600
     2601    return len;
     2602}
     2603
     2604
     2605/**************************************************************************
     2606 * Str_SetPtrAtoW [internal]
     2607 *
     2608 * Converts a multi byte string to a unicode string.
     2609 * If the pointer to the destination buffer is NULL a buffer is allocated.
     2610 * If the destination buffer is too small to keep the converted multi byte
     2611 * string the destination buffer is reallocated. If the source pointer is
     2612 * NULL, the destination buffer is freed.
     2613 *
     2614 * PARAMS
     2615 *     lppDest [I/O] pointer to a pointer to the destination buffer
     2616 *     lpSrc   [I] pointer to a multi byte string
     2617 *
     2618 * RETURNS
     2619 *     TRUE: conversion successful
     2620 *     FALSE: error
     2621 */
     2622
     2623BOOL
     2624Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc)
     2625{
     2626    TRACE("(%p %s)\n", lppDest, lpSrc);
     2627
     2628    if (lpSrc) {
     2629        INT len = MultiByteToWideChar(CP_ACP,0,lpSrc,-1,NULL,0);
     2630        LPWSTR ptr = (LPWSTR)COMCTL32_ReAlloc (*lppDest, len*sizeof(WCHAR));
     2631
     2632        if (!ptr)
     2633            return FALSE;
     2634        MultiByteToWideChar(CP_ACP,0,lpSrc,-1,ptr,len);
     2635        *lppDest = ptr;
     2636    }
     2637    else {
     2638        if (*lppDest) {
     2639            COMCTL32_Free (*lppDest);
     2640            *lppDest = NULL;
     2641        }
     2642    }
     2643
     2644    return TRUE;
     2645}
  • trunk/src/comctl32/makefile

    r4717 r5630  
    1 # $Id: makefile,v 1.31 2000-12-02 23:37:13 bird Exp $
     1# $Id: makefile,v 1.32 2001-04-29 10:30:56 sandervl Exp $
    22
    33#
     
    5757$(ODIN32_LIB)/user32.lib \
    5858$(ODIN32_LIB)/msvfw32.lib \
     59$(ODIN32_LIB)/winmm.lib \
    5960$(ODIN32_LIB)/$(ODINCRT).lib \
    6061os2386.lib \
Note: See TracChangeset for help on using the changeset viewer.