Changeset 3203 for trunk/src


Ignore:
Timestamp:
Mar 23, 2000, 6:14:45 PM (25 years ago)
Author:
cbratschi
Message:

dynamic WINMM linking

Location:
trunk/src/comctl32
Files:
3 edited

Legend:

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

    r2875 r3203  
    1 /* $Id: animate.cpp,v 1.1 2000-02-23 17:09:40 cbratschi Exp $ */
     1/* $Id: animate.cpp,v 1.2 2000-03-23 17:14:33 cbratschi Exp $ */
    22/*
    33 * Animation control
     
    2020#include "animate.h"
    2121
     22HINSTANCE hMSVFW32 = 0;
     23
     24HINSTANCE hWINMM = 0;
     25static LONG     (*WINAPI WINMM_mmioRead)(HMMIO,HPSTR,LONG) = 0;
     26static LONG     (*WINAPI WINMM_mmioSeek)(HMMIO,LONG,INT) = 0;
     27static MMRESULT (*WINAPI WINMM_mmioClose)(HMMIO,UINT) = 0;
     28static HMMIO    (*WINAPI WINMM_mmioOpenA)(LPSTR ,MMIOINFO*,DWORD) = 0;
     29static HMMIO    (*WINAPI WINMM_mmioOpenW)(LPWSTR,MMIOINFO*,DWORD) = 0;
     30static UINT     (*WINAPI WINMM_mmioDescend)(HMMIO,MMCKINFO*,const MMCKINFO*,UINT) = 0;
     31static UINT     (*WINAPI WINMM_mmioAscend)(HMMIO,MMCKINFO*,UINT) = 0;
     32
    2233#define ANIMATE_GetInfoPtr(hwnd) ((ANIMATE_INFO*)getInfoPtr(hwnd))
     34
     35static BOOL ANIMATE_LoadMSVFW32(VOID)
     36{
     37  if (hMSVFW32) return TRUE;
     38
     39  hMSVFW32 = LoadLibraryA("msvfw32.dll");
     40
     41  return hMSVFW32;
     42}
     43
     44static VOID ANIMATE_UnloadMSVFW32(VOID)
     45{
     46  if (hMSVFW32)
     47  {
     48    FreeLibrary(hMSVFW32);
     49    hMSVFW32 = 0;
     50  }
     51}
     52
     53static BOOL ANIMATE_LoadWINMM(VOID)
     54{
     55  if (hWINMM) return TRUE;
     56
     57  hWINMM = LoadLibraryA("WINMM");
     58  if (!hWINMM) return FALSE;
     59
     60  *(VOID**)&WINMM_mmioRead    = (VOID*)GetProcAddress(hWINMM,"mmioRead");
     61  *(VOID**)&WINMM_mmioSeek    = (VOID*)GetProcAddress(hWINMM,"mmioSeek");
     62  *(VOID**)&WINMM_mmioClose   = (VOID*)GetProcAddress(hWINMM,"mmioClose");
     63  *(VOID**)&WINMM_mmioOpenA   = (VOID*)GetProcAddress(hWINMM,"mmioOpenA");
     64  *(VOID**)&WINMM_mmioOpenW   = (VOID*)GetProcAddress(hWINMM,"mmioOpenW");
     65  *(VOID**)&WINMM_mmioDescend = (VOID*)GetProcAddress(hWINMM,"mmioDescend");
     66  *(VOID**)&WINMM_mmioAscend  = (VOID*)GetProcAddress(hWINMM,"mmioAscend");
     67
     68  return TRUE;
     69}
     70
     71static VOID ANIMATE_UnloadWINMM(VOID)
     72{
     73  if (hWINMM)
     74  {
     75    FreeLibrary(hWINMM);
     76    hWINMM = 0;
     77    *(VOID**)&WINMM_mmioRead    = NULL;
     78    *(VOID**)&WINMM_mmioSeek    = NULL;
     79    *(VOID**)&WINMM_mmioClose   = NULL;
     80    *(VOID**)&WINMM_mmioOpenA   = NULL;
     81    *(VOID**)&WINMM_mmioOpenW   = NULL;
     82    *(VOID**)&WINMM_mmioDescend = NULL;
     83    *(VOID**)&WINMM_mmioAscend  = NULL;
     84  }
     85}
    2386
    2487static BOOL ANIMATE_LoadRes(ANIMATE_INFO *infoPtr,HINSTANCE hInst,LPWSTR lpName,BOOL unicode)
     
    45108    mminfo.pchBuffer = (LPSTR)lpAvi;
    46109    mminfo.cchBuffer = SizeofResource(hInst, hrsrc);
    47     infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ);
     110    infoPtr->hMMio = WINMM_mmioOpenA(NULL, &mminfo, MMIO_READ);
    48111
    49112    if (!infoPtr->hMMio) {
     
    58121{
    59122    if (unicode)
    60       infoPtr->hMMio = mmioOpenW(lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
     123      infoPtr->hMMio = WINMM_mmioOpenW(lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    61124    else
    62       infoPtr->hMMio = mmioOpenA((LPSTR)lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
     125      infoPtr->hMMio = WINMM_mmioOpenA((LPSTR)lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    63126
    64127    if (!infoPtr->hMMio)
     
    95158    if (infoPtr->hMMio) {
    96159        ANIMATE_DoStop(infoPtr);
    97         mmioClose(infoPtr->hMMio, 0);
     160        WINMM_mmioClose(infoPtr->hMMio, 0);
    98161        if (infoPtr->hRes) {
    99162            FreeResource(infoPtr->hRes);
     
    154217    EnterCriticalSection(&infoPtr->cs);
    155218
    156     mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
    157     mmioRead(infoPtr->hMMio, (HPSTR)infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
     219    WINMM_mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
     220    WINMM_mmioRead(infoPtr->hMMio, (HPSTR)infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
    158221
    159222    if (infoPtr->hic &&
     
    257320    DWORD               insize;
    258321
    259     if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {
     322    if (WINMM_mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {
    260323        //WARN("Can't find 'RIFF' chunk\n");
    261324        return FALSE;
     
    269332
    270333    mmckHead.fccType = mmioFOURCC('h', 'd', 'r', 'l');
    271     if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {
     334    if (WINMM_mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {
    272335        //WARN("Can't find 'hdrl' list\n");
    273336        return FALSE;
     
    275338
    276339    mmckInfo.ckid = mmioFOURCC('a', 'v', 'i', 'h');
    277     if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) {
     340    if (WINMM_mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) {
    278341        //WARN("Can't find 'avih' chunk\n");
    279342        return FALSE;
    280343    }
    281344
    282     mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah));
     345    WINMM_mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah));
    283346    //TRACE("mah.dwMicroSecPerFrame=%ld\n",     infoPtr->mah.dwMicroSecPerFrame);
    284347    //TRACE("mah.dwMaxBytesPerSec=%ld\n",       infoPtr->mah.dwMaxBytesPerSec);
     
    291354    //TRACE("mah.dwWidth=%ld\n",                        infoPtr->mah.dwWidth);
    292355    //TRACE("mah.dwHeight=%ld\n",               infoPtr->mah.dwHeight);
    293     mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     356    WINMM_mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    294357
    295358    mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
    296     if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {
     359    if (WINMM_mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {
    297360        //WARN("Can't find 'strl' list\n");
    298361        return FALSE;
     
    300363
    301364    mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'h');
    302     if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
     365    if (WINMM_mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
    303366        //WARN("Can't find 'strh' chunk\n");
    304367        return FALSE;
    305368    }
    306369
    307     mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));
     370    WINMM_mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));
    308371    //TRACE("ash.fccType='%c%c%c%c'\n",                 LOBYTE(LOWORD(infoPtr->ash.fccType)),
    309372    //                                          HIBYTE(LOWORD(infoPtr->ash.fccType)),
     
    327390    //TRACE("ash.rcFrame=(%d,%d,%d,%d)\n",      infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left,
    328391    //    infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right);
    329     mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     392    WINMM_mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    330393
    331394    mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'f');
    332     if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
     395    if (WINMM_mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
    333396        //WARN("Can't find 'strh' chunk\n");
    334397        return FALSE;
     
    341404    }
    342405
    343     mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize);
     406    WINMM_mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize);
    344407    //TRACE("bih.biSize=%ld\n",                 infoPtr->inbih->biSize);
    345408    //TRACE("bih.biWidth=%ld\n",                infoPtr->inbih->biWidth);
     
    353416    //TRACE("bih.biClrUsed=%ld\n",      infoPtr->inbih->biClrUsed);
    354417    //TRACE("bih.biClrImportant=%ld\n",         infoPtr->inbih->biClrImportant);
    355     mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    356 
    357     mmioAscend(infoPtr->hMMio, &mmckList, 0);
     418    WINMM_mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     419
     420    WINMM_mmioAscend(infoPtr->hMMio, &mmckList, 0);
    358421
    359422#if 0
     
    362425     */
    363426    mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
    364     if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {
     427    if (WINMM_mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {
    365428        //WARN("There should be a single 'strl' list\n");
    366429        return FALSE;
     
    368431#endif
    369432
    370     mmioAscend(infoPtr->hMMio, &mmckHead, 0);
     433    WINMM_mmioAscend(infoPtr->hMMio, &mmckHead, 0);
    371434
    372435    /* no need to read optional JUNK chunk */
    373436
    374437    mmckList.fccType = mmioFOURCC('m', 'o', 'v', 'i');
    375     if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {
     438    if (WINMM_mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {
    376439        //WARN("Can't find 'movi' list\n");
    377440        return FALSE;
     
    388451
    389452    numFrame = insize = 0;
    390     while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
     453    while (WINMM_mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
    391454           numFrame < infoPtr->mah.dwTotalFrames) {
    392455        infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset;
     
    394457            insize = mmckInfo.cksize;
    395458        numFrame++;
    396         mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     459        WINMM_mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
    397460    }
    398461    if (numFrame != infoPtr->mah.dwTotalFrames) {
     
    547610{
    548611    ANIMATE_INFO*       infoPtr;
    549     HMODULE             hModule = LoadLibraryA("msvfw32.dll");
    550 
    551     if (!hModule)
    552         return FALSE;
     612
     613    if (!ANIMATE_LoadWINMM()) return FALSE;
     614    if (!ANIMATE_LoadMSVFW32()) return FALSE;
    553615
    554616    /* allocate memory for info structure */
     
    560622
    561623    /* Temporary hack until we get dllglue up and running */
    562     *(VOID**)&infoPtr->fnICOpen        = (VOID*)GetProcAddress(hModule, "ICOpen");
    563     *(VOID**)&infoPtr->fnICClose       = (VOID*)GetProcAddress(hModule, "ICClose");
    564     *(VOID**)&infoPtr->fnICSendMessage = (VOID*)GetProcAddress(hModule, "ICSendMessage");
    565     *(VOID**)&infoPtr->fnICDecompress  = (VOID*)GetProcAddress(hModule, "ICDecompress");
     624    *(VOID**)&infoPtr->fnICOpen        = (VOID*)GetProcAddress(hMSVFW32,"ICOpen");
     625    *(VOID**)&infoPtr->fnICClose       = (VOID*)GetProcAddress(hMSVFW32,"ICClose");
     626    *(VOID**)&infoPtr->fnICSendMessage = (VOID*)GetProcAddress(hMSVFW32,"ICSendMessage");
     627    *(VOID**)&infoPtr->fnICDecompress  = (VOID*)GetProcAddress(hMSVFW32,"ICDecompress");
    566628
    567629    //TRACE("Animate style=0x%08lx, parent=%08lx\n", GetWindowLongA(hWnd, GWL_STYLE), (DWORD)GetParent(hWnd));
  • trunk/src/comctl32/listview.cpp

    r3194 r3203  
    1 /*$Id: listview.cpp,v 1.5 2000-03-22 16:56:36 cbratschi Exp $*/
     1/*$Id: listview.cpp,v 1.6 2000-03-23 17:14:34 cbratschi Exp $*/
    22/*
    33 * Listview control
     
    1212 *
    1313 * TODO:
    14  *   1. No horizontal scrolling when header is larger than the client area.
    15  *   2. Drawing optimizations.
    16  *   3. Hot item handling.
     14 *   - Hot item handling.
    1715 *
    1816 * Notifications:
     
    3533 *   LISTVIEW_RedrawItems : empty stub
    3634 *   LISTVIEW_Update : not completed
    37  * WM_SETREDRAW not implemented
    3835 *
    3936 * the sort algorithm isn't stable (order of same items isn't fixed)!!!
     
    156153static LRESULT LISTVIEW_GetStringWidth(HWND hwnd,HDC hdc,LPWSTR lpszText,BOOL unicode);
    157154static BOOL    LISTVIEW_EnsureVisible(HWND hwnd,INT nItem,BOOL bPartial);
    158 static VOID    LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos);
     155static VOID    LISTVIEW_UpdateHeaderSize(HWND hwnd,INT nNewScrollPos,INT xScroll);
    159156
    160157static VOID LISTVIEW_Refresh(HWND hwnd)
     
    175172
    176173    GetClientRect(hwnd,&rect);
    177     GetClientRect(infoPtr->hwndHeader,&rect2);
    178     rect.top += rect2.bottom;
     174    GetWindowRect(infoPtr->hwndHeader,&rect2);
     175    rect.top += rect2.bottom-rect2.top;
    179176    InvalidateRect(hwnd,&rect,TRUE);
    180177  } else InvalidateRect(hwnd,NULL,TRUE);
     
    224221  if (infoPtr->refreshFlags & (RF_REFRESH | RF_NOREDRAW)) return;
    225222  LISTVIEW_GetItemRect(hwnd,nItem,&rect,LVIR_SELECTBOUNDS);
     223//CB: todo: clip header
    226224  InvalidateRect(hwnd,&rect,TRUE);
    227225}
     
    231229  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    232230  RECT rect,header;
    233   INT xOffset = infoPtr->lefttop.x*LISTVIEW_SCROLL_DIV_SIZE;
     231  INT xOffset = infoPtr->lefttop.x*infoPtr->scrollStep.x;
    234232
    235233  if (infoPtr->refreshFlags & (RF_REFRESH | RF_NOREDRAW)) return;
    236234  LISTVIEW_GetItemRect(hwnd,nItem,&rect,LVIR_SELECTBOUNDS);
    237 
     235//CB: todo: clip header
    238236  //get header rect
    239237  Header_GetItemRect(infoPtr->hwndHeader,nSubItem,&header);
     
    260258    //clip header
    261259    GetClientRect(hwnd,&rect);
    262     GetClientRect(infoPtr->hwndHeader,&header);
     260    GetWindowRect(infoPtr->hwndHeader,&header);
     261
    263262    if (yScroll < 0)
    264     {
    265       //up
    266       rect.top += header.bottom-yScroll;
    267       ScrollWindowEx(hwnd,xScroll,yScroll,&rect,NULL,0,NULL,0);
    268       rect.top = rect.bottom+yScroll;
    269       if (rect.top < header.bottom) rect.top = header.bottom;
    270       InvalidateRect(hwnd,&rect,TRUE);//CB: still wrong pixels
     263    { //up
     264      INT headerH = header.bottom-header.top;
     265
     266      rect.top += headerH-yScroll;
     267      if (rect.top < rect.bottom)
     268      {
     269        ScrollWindowEx(hwnd,xScroll,yScroll,&rect,NULL,0,NULL,0);
     270        rect.top = rect.bottom+yScroll;
     271        if (rect.top < headerH) rect.top = headerH;
     272        InvalidateRect(hwnd,&rect,TRUE);//CB: still wrong pixels
     273      } else
     274      {
     275        rect.top = headerH;
     276        InvalidateRect(hwnd,&rect,TRUE);
     277      }
    271278    } else if (yScroll > 0)
    272279    { //down
    273       rect.top += header.bottom;
     280      rect.top += header.bottom-header.top;
    274281      ScrollWindowEx(hwnd,xScroll,yScroll,&rect,NULL,0,NULL,SW_INVALIDATE);
    275282    }
    276283    if (yScroll == 0)
    277284    {
    278       rect.top += header.bottom;
     285      rect.top += header.bottom-header.top;
    279286      ScrollWindowEx(hwnd,xScroll,yScroll,&rect,NULL,0,NULL,SW_INVALIDATE);
    280287    }
    281     if (xScroll != 0) LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x);
     288
     289    if (xScroll != 0) LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x,xScroll);
    282290  } else ScrollWindowEx(hwnd,xScroll,yScroll,NULL,NULL,0,NULL,SW_INVALIDATE);
    283291}
     
    297305 * NOTES
    298306 */
    299 static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos)
     307static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos,INT xScroll)
    300308{
    301309    LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     
    310318
    311319    MapWindowPoints(HWND_DESKTOP, hwnd, point, 2);
    312     point[0].x = -(nNewScrollPos * LISTVIEW_SCROLL_DIV_SIZE);
    313     point[1].x += (nNewScrollPos * LISTVIEW_SCROLL_DIV_SIZE);
    314 
    315     SetWindowPos(infoPtr->hwndHeader,0,
    316         point[0].x,point[0].y,point[1].x,point[1].y,
    317         SWP_NOZORDER | SWP_NOACTIVATE);
     320    point[0].x = -nNewScrollPos*infoPtr->scrollStep.x;
     321    point[1].x += nNewScrollPos*infoPtr->scrollStep.x;
     322
     323    //CB: todo: smoother scrolling (BTW: SWP_NOREDRAW doesn't work!)
     324    SetWindowPos(infoPtr->hwndHeader,0,point[0].x,point[0].y,point[1].x,point[1].y,SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
    318325}
    319326
     
    340347  if (dwStyle & LVS_NOSCROLL)
    341348  {
     349    infoPtr->lefttop.x = 0;
     350    infoPtr->lefttop.y = 0;
     351    infoPtr->maxScroll = infoPtr->lefttop;
     352    infoPtr->scrollPage = infoPtr->lefttop;
     353    infoPtr->scrollStep = infoPtr->lefttop;
    342354    ShowScrollBar(hwnd,SB_BOTH,FALSE);
    343355    return;
     
    353365    INT nCountPerRow = LISTVIEW_GetCountPerRow(hwnd);
    354366    INT nNumOfItems = GETITEMCOUNT(infoPtr);
    355 //CB: todo: doesn't work!
    356     infoPtr->maxScroll.x = nNumOfItems / nCountPerColumn+1;
     367
     368    infoPtr->maxScroll.x = nNumOfItems / nCountPerColumn;
    357369    if ((nNumOfItems % nCountPerColumn) == 0)
    358370      infoPtr->maxScroll.x--;
     
    360372    infoPtr->lefttop.x = LISTVIEW_GetTopIndex(hwnd) / nCountPerColumn;
    361373    infoPtr->scrollPage.x = nCountPerRow;
     374    infoPtr->scrollStep.x = infoPtr->nItemWidth;
    362375
    363376    scrollInfo.nMin  = 0;
     
    373386    infoPtr->lefttop.y = LISTVIEW_GetTopIndex(hwnd);
    374387    infoPtr->scrollPage.y = LISTVIEW_GetCountPerColumn(hwnd);
     388    infoPtr->scrollStep.y = infoPtr->nItemHeight;
    375389
    376390    scrollInfo.nMin  = 0;
     
    388402    infoPtr->scrollPage.x = nListWidth / LISTVIEW_SCROLL_DIV_SIZE;
    389403    infoPtr->maxScroll.x = max(infoPtr->nItemWidth / LISTVIEW_SCROLL_DIV_SIZE, 0);
     404    infoPtr->scrollStep.x = LISTVIEW_SCROLL_DIV_SIZE;
    390405
    391406    scrollInfo.nMin  = 0;
     
    397412
    398413    /* Update the Header Control */
    399     LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x);
     414    LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x,0);
    400415  } else
    401416  {
     
    412427      infoPtr->maxScroll.x = max(nViewWidth / LISTVIEW_SCROLL_DIV_SIZE, 0);
    413428      infoPtr->scrollPage.x = nListWidth / LISTVIEW_SCROLL_DIV_SIZE;
     429      infoPtr->scrollStep.x = LISTVIEW_SCROLL_DIV_SIZE;
    414430
    415431      scrollInfo.nMin  = 0;
     
    426442      infoPtr->maxScroll.y = max(nViewHeight / LISTVIEW_SCROLL_DIV_SIZE,0);
    427443      infoPtr->scrollPage.y = nListHeight / LISTVIEW_SCROLL_DIV_SIZE;
     444      infoPtr->scrollStep.y = LISTVIEW_SCROLL_DIV_SIZE;
    428445
    429446      scrollInfo.nMin  = 0;
     
    615632//        lprcView->left, lprcView->top, lprcView->right, lprcView->bottom);
    616633
    617   if (lprcView != NULL)
     634  if (lprcView)
    618635  {
    619636    bResult = TRUE;
     
    645662  POINT ptOrigin;
    646663
    647 //  TRACE("(hwnd=%x, lprcView=%p)\n", hwnd, lprcView);
    648 
    649   if (lprcView != NULL)
     664  if (lprcView)
    650665  {
    651666    bResult = LISTVIEW_GetOrigin(hwnd, &ptOrigin);
    652     if (bResult != FALSE)
     667    if (bResult)
    653668    {
    654669      lprcView->left = infoPtr->rcView.left + ptOrigin.x;
     
    657672      lprcView->bottom = infoPtr->rcView.bottom + ptOrigin.y;
    658673    }
    659 
    660 //    TRACE("(left=%d, top=%d, right=%d, bottom=%d)\n",
    661 //          lprcView->left, lprcView->top, lprcView->right, lprcView->bottom);
    662674  }
    663675
     
    719731  INT i;
    720732
    721 //  TRACE("(hwnd=%x)\n", hwnd);
    722 
    723733  if (uView == LVS_ICON)
    724734  {
     
    731741    for (i = 0; i < nHeaderItemCount; i++)
    732742    {
    733       if (Header_GetItemRect(infoPtr->hwndHeader, i, &rcHeaderItem) != 0)
     743      if (Header_GetItemRect(infoPtr->hwndHeader, i, &rcHeaderItem))
    734744      {
    735745        nItemWidth += (rcHeaderItem.right - rcHeaderItem.left);
     
    20612071  INT nColumnCount = Header_GetItemCount(infoPtr->hwndHeader);
    20622072  RECT rcItem,rcClient,*rcHeader;
    2063   INT  j,nItem,nLast,xOffset = infoPtr->lefttop.x*LISTVIEW_SCROLL_DIV_SIZE;
     2073  INT  j,nItem,nLast,xOffset = infoPtr->lefttop.x*infoPtr->scrollStep.x;
    20642074
    20652075  nItem = LISTVIEW_GetTopIndex(hwnd);
     
    22482258
    22492259  GetClientRect(hwnd,&rcClient);
    2250 //CB: todo: hscroll!
     2260
    22512261  for (i = 0; i < nColumnCount; i++)
    22522262  {
     
    29772987
    29782988  rcItem.left = LVIR_BOUNDS;
    2979   if (LISTVIEW_GetItemRect(hwnd, nItem, &rcItem) != FALSE)
     2989  if (LISTVIEW_GetItemRect(hwnd, nItem, &rcItem))
    29802990  {
    29812991    if (rcItem.left < infoPtr->rcList.left)
     
    29862996        if (uView == LVS_LIST)
    29872997        {
    2988           nScrollPosWidth = infoPtr->nItemWidth;
     2998          nScrollPosWidth = infoPtr->scrollStep.x;
    29892999          rcItem.left += infoPtr->rcList.left;
    29903000        } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON))
    29913001        {
    2992           nScrollPosWidth = LISTVIEW_SCROLL_DIV_SIZE;
     3002          nScrollPosWidth = infoPtr->scrollStep.x;
    29933003          rcItem.left += infoPtr->rcList.left;
    29943004        }
     
    29963006        /* When in LVS_REPORT view, the scroll position should
    29973007           not be updated. */
    2998         if (nScrollPosWidth != 0)
     3008        if (nScrollPosWidth)
    29993009        {
    30003010          if (rcItem.left % nScrollPosWidth == 0)
     
    30183028        {
    30193029          rcItem.right -= infoPtr->rcList.right;
    3020           nScrollPosWidth = infoPtr->nItemWidth;
     3030          nScrollPosWidth = infoPtr->scrollStep.x;
    30213031        } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON))
    30223032        {
    30233033          rcItem.right -= infoPtr->rcList.right;
    3024           nScrollPosWidth = LISTVIEW_SCROLL_DIV_SIZE;
     3034          nScrollPosWidth = infoPtr->scrollStep.x;
    30253035        }
    30263036
    30273037        /* When in LVS_REPORT view, the scroll position should
    30283038           not be updated. */
    3029         if (nScrollPosWidth != 0)
     3039        if (nScrollPosWidth)
    30303040        {
    30313041          SCROLLINFO scrollInfo;
     
    30533063        {
    30543064          rcItem.top -= infoPtr->rcList.top;
    3055           nScrollPosHeight = infoPtr->nItemHeight;
     3065          nScrollPosHeight = infoPtr->scrollStep.y;
    30563066        }
    30573067        else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON))
    30583068        {
    3059           nScrollPosHeight = LISTVIEW_SCROLL_DIV_SIZE;
     3069          nScrollPosHeight = infoPtr->scrollStep.y;
    30603070          rcItem.top += infoPtr->rcList.top;
    30613071        }
     
    30723082        }
    30733083      }
    3074     }
    3075     else if (rcItem.bottom > infoPtr->rcList.bottom)
     3084    } else if (rcItem.bottom > infoPtr->rcList.bottom)
    30763085    {
    30773086      /* scroll down */
     
    30813090        {
    30823091          rcItem.bottom -= infoPtr->rcList.bottom;
    3083           nScrollPosHeight = infoPtr->nItemHeight;
    3084         }
    3085         else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON))
    3086         {
    3087           nScrollPosHeight = LISTVIEW_SCROLL_DIV_SIZE;
     3092          nScrollPosHeight = infoPtr->scrollStep.y;
     3093        } else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON))
     3094        {
     3095          nScrollPosHeight = infoPtr->scrollStep.x;
    30883096          rcItem.bottom -= infoPtr->rcList.bottom;
    30893097        }
     
    31033111
    31043112  if ((oldlefttop.x != infoPtr->lefttop.x) || (oldlefttop.y != infoPtr->lefttop.y))
    3105     LISTVIEW_ScrollWindow(hwnd,(oldlefttop.x-infoPtr->lefttop.x)*LISTVIEW_SCROLL_DIV_SIZE,(oldlefttop.y-infoPtr->lefttop.y)*infoPtr->nItemHeight,uView);
     3113    LISTVIEW_ScrollWindow(hwnd,(oldlefttop.x-infoPtr->lefttop.x)*infoPtr->scrollStep.x,(oldlefttop.y-infoPtr->lefttop.y)*infoPtr->scrollStep.y,uView);
    31063114
    31073115  return TRUE;
     
    48054813  {
    48064814    if (dwStyle & WS_HSCROLL)
    4807       lpptOrigin->x = -infoPtr->lefttop.x*LISTVIEW_SCROLL_DIV_SIZE;
     4815      lpptOrigin->x = -infoPtr->lefttop.x*infoPtr->scrollStep.x;
    48084816    else
    48094817      lpptOrigin->x = 0;
    48104818
    48114819    if (dwStyle & WS_VSCROLL)
    4812       lpptOrigin->y = -infoPtr->lefttop.y*LISTVIEW_SCROLL_DIV_SIZE;
     4820      lpptOrigin->y = -infoPtr->lefttop.y*infoPtr->scrollStep.y;
    48134821    else
    48144822      lpptOrigin->y = 0;
     
    64606468    DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    64616469    UINT uView =  dwStyle & LVS_TYPEMASK;
    6462     INT xScroll = (oldX-infoPtr->lefttop.x)* LISTVIEW_SCROLL_DIV_SIZE;//CB:tocheck
     6470    INT xScroll = (oldX-infoPtr->lefttop.x)*infoPtr->scrollStep.x;
    64636471
    64646472    ZeroMemory(&scrollInfo, sizeof(SCROLLINFO));
     
    71037111  {
    71047112    /* handle notification from header control */
    7105     if ((lpnmh->code == HDN_ENDTRACKA) || (lpnmh->code == HDN_ENDTRACKW))
    7106     {
    7107       infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
    7108       LISTVIEW_Refresh(hwnd);
    7109     }
    7110     else if((lpnmh->code ==  HDN_ITEMCLICKA) || (lpnmh->code ==  HDN_ITEMCLICKW))
    7111     {
    7112         /* Handle sorting by Header Column */
    7113         NMLISTVIEW nmlv;
    7114         LPNMHEADERA pnmHeader = (LPNMHEADERA) lpnmh;
    7115 
    7116         ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
    7117         nmlv.iItem = -1;
    7118         nmlv.iSubItem = pnmHeader->iItem;
    7119 
    7120         sendNotify(hwnd,LVN_COLUMNCLICK,&nmlv.hdr);
    7121 
    7122     }
    7123     else if(lpnmh->code == NM_RELEASEDCAPTURE)
    7124     {
    7125       /* Idealy this should be done in HDN_ENDTRACKA
    7126        * but since SetItemBounds in Header.c is called after
    7127        * the notification is sent, it is neccessary to handle the
    7128        * update of the scroll bar here (Header.c works fine as it is,
    7129        * no need to disturb it)
    7130        */
    7131       infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
    7132       LISTVIEW_UpdateScroll(hwnd);
    7133       LISTVIEW_Refresh(hwnd);
    7134     }
    7135 
     7113    if ((lpnmh->code == HDN_ITEMCHANGEDA) || (lpnmh->code == HDN_ITEMCHANGEDW))
     7114    {
     7115      INT width;
     7116
     7117      width = LISTVIEW_GetItemWidth(hwnd);
     7118      if (width != infoPtr->nItemWidth)
     7119      {
     7120        infoPtr->nItemWidth = width;
     7121        LISTVIEW_UpdateScroll(hwnd);
     7122        LISTVIEW_Refresh(hwnd);
     7123      }
     7124    } else if((lpnmh->code ==  HDN_ITEMCLICKA) || (lpnmh->code ==  HDN_ITEMCLICKW))
     7125    {
     7126      /* Handle sorting by Header Column */
     7127      NMLISTVIEW nmlv;
     7128      LPNMHEADERA pnmHeader = (LPNMHEADERA)lpnmh;
     7129
     7130      ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
     7131      nmlv.iItem = -1;
     7132      nmlv.iSubItem = pnmHeader->iItem;
     7133
     7134      sendNotify(hwnd,LVN_COLUMNCLICK,&nmlv.hdr);
     7135    }
    71367136  }
    71377137
     
    74097409{
    74107410  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    7411   LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    7412   UINT uView = lStyle & LVS_TYPEMASK;
     7411  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     7412  UINT uView = dwStyle & LVS_TYPEMASK;
    74137413
    74147414  LISTVIEW_UpdateSize(hwnd);
     7415  LISTVIEW_UpdateScroll(hwnd);
    74157416
    74167417  if ((uView == LVS_SMALLICON) || (uView == LVS_ICON))
    74177418  {
    7418     if (lStyle & LVS_ALIGNLEFT)
    7419     {
     7419    if (dwStyle & LVS_ALIGNLEFT)
    74207420      LISTVIEW_AlignLeft(hwnd);
    7421     }
    74227421    else
    7423     {
    74247422      LISTVIEW_AlignTop(hwnd);
    7425     }
    7426   }
    7427 
    7428   /* invalidate client area + erase background */
    7429   infoPtr->refreshFlags |= RF_UPDATESCROLL;
    7430   LISTVIEW_QueueRefresh(hwnd);
    7431 
     7423  }
    74327424  return 0;
    74337425}
     
    74467438{
    74477439  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    7448   LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    7449   UINT uView = lStyle & LVS_TYPEMASK;
     7440  LONG dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     7441  UINT uView = dwStyle & LVS_TYPEMASK;
    74507442  RECT rcList;
    74517443
     
    74587450  if (uView == LVS_LIST)
    74597451  {
    7460     if ((lStyle & WS_HSCROLL) == 0)
     7452    if (!(dwStyle & WS_HSCROLL))
    74617453    {
    74627454      INT nHScrollHeight = GetSystemMetrics(SM_CYHSCROLL);
     
    74667458      }
    74677459    }
    7468   }
    7469   else if (uView == LVS_REPORT)
    7470   {
    7471     HDLAYOUT hl;
    7472     WINDOWPOS wp;
    7473 
    7474     hl.prc = &rcList;
    7475     hl.pwpos = &wp;
    7476     Header_Layout(infoPtr->hwndHeader, &hl);
    7477     SetWindowPos(infoPtr->hwndHeader,hwnd,wp.x,wp.y,wp.cx,wp.cy,wp.flags);
    7478     if (!(LVS_NOCOLUMNHEADER & lStyle))
    7479     {
    7480       infoPtr->rcList.top = max(wp.cy, 0);
     7460  } else if (uView == LVS_REPORT)
     7461  {
     7462    if (!(dwStyle & LVS_NOCOLUMNHEADER))
     7463    {
     7464      HDLAYOUT hl;
     7465      WINDOWPOS wp;
     7466
     7467      hl.prc = &rcList;
     7468      hl.pwpos = &wp;
     7469      Header_Layout(infoPtr->hwndHeader, &hl);
     7470      SetWindowPos(infoPtr->hwndHeader,hwnd,wp.x,wp.y,wp.cx,wp.cy,wp.flags);
     7471      infoPtr->rcList.top = max(wp.cy,0);
    74817472    }
    74827473  }
     
    74987489                                 LPSTYLESTRUCT lpss)
    74997490{
    7500   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     7491  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    75017492  UINT uNewView = lpss->styleNew & LVS_TYPEMASK;
    75027493  UINT uOldView = lpss->styleOld & LVS_TYPEMASK;
    75037494  RECT rcList = infoPtr->rcList;
    7504 
    7505 //  TRACE("(hwnd=%x, styletype=%x, stylestruct=%p)\n",
    7506 //        hwnd, wStyleType, lpss);
    75077495
    75087496  if (wStyleType == GWL_STYLE)
     
    82108198
    82118199  ZeroMemory(&wndClass, sizeof(WNDCLASSA));
    8212   wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
     8200  wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
    82138201  wndClass.lpfnWndProc = (WNDPROC)LISTVIEW_WindowProc;
    82148202  wndClass.cbClsExtra = 0;
  • trunk/src/comctl32/makefile

    r3031 r3203  
    1 # $Id: makefile,v 1.24 2000-03-06 23:38:17 bird Exp $
     1# $Id: makefile,v 1.25 2000-03-23 17:14:45 cbratschi Exp $
    22
    33#
     
    8484$(PDWIN32_LIB)/user32.lib
    8585$(PDWIN32_LIB)/odincrt.lib
    86 $(PDWIN32_LIB)/winmm.lib
    8786OS2386.LIB
    8887$(RTLLIB_O)
Note: See TracChangeset for help on using the changeset viewer.