- Timestamp:
- Mar 23, 2000, 6:14:45 PM (25 years ago)
- 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:40cbratschi Exp $ */1 /* $Id: animate.cpp,v 1.2 2000-03-23 17:14:33 cbratschi Exp $ */ 2 2 /* 3 3 * Animation control … … 20 20 #include "animate.h" 21 21 22 HINSTANCE hMSVFW32 = 0; 23 24 HINSTANCE hWINMM = 0; 25 static LONG (*WINAPI WINMM_mmioRead)(HMMIO,HPSTR,LONG) = 0; 26 static LONG (*WINAPI WINMM_mmioSeek)(HMMIO,LONG,INT) = 0; 27 static MMRESULT (*WINAPI WINMM_mmioClose)(HMMIO,UINT) = 0; 28 static HMMIO (*WINAPI WINMM_mmioOpenA)(LPSTR ,MMIOINFO*,DWORD) = 0; 29 static HMMIO (*WINAPI WINMM_mmioOpenW)(LPWSTR,MMIOINFO*,DWORD) = 0; 30 static UINT (*WINAPI WINMM_mmioDescend)(HMMIO,MMCKINFO*,const MMCKINFO*,UINT) = 0; 31 static UINT (*WINAPI WINMM_mmioAscend)(HMMIO,MMCKINFO*,UINT) = 0; 32 22 33 #define ANIMATE_GetInfoPtr(hwnd) ((ANIMATE_INFO*)getInfoPtr(hwnd)) 34 35 static BOOL ANIMATE_LoadMSVFW32(VOID) 36 { 37 if (hMSVFW32) return TRUE; 38 39 hMSVFW32 = LoadLibraryA("msvfw32.dll"); 40 41 return hMSVFW32; 42 } 43 44 static VOID ANIMATE_UnloadMSVFW32(VOID) 45 { 46 if (hMSVFW32) 47 { 48 FreeLibrary(hMSVFW32); 49 hMSVFW32 = 0; 50 } 51 } 52 53 static 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 71 static 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 } 23 86 24 87 static BOOL ANIMATE_LoadRes(ANIMATE_INFO *infoPtr,HINSTANCE hInst,LPWSTR lpName,BOOL unicode) … … 45 108 mminfo.pchBuffer = (LPSTR)lpAvi; 46 109 mminfo.cchBuffer = SizeofResource(hInst, hrsrc); 47 infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ);110 infoPtr->hMMio = WINMM_mmioOpenA(NULL, &mminfo, MMIO_READ); 48 111 49 112 if (!infoPtr->hMMio) { … … 58 121 { 59 122 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); 61 124 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); 63 126 64 127 if (!infoPtr->hMMio) … … 95 158 if (infoPtr->hMMio) { 96 159 ANIMATE_DoStop(infoPtr); 97 mmioClose(infoPtr->hMMio, 0);160 WINMM_mmioClose(infoPtr->hMMio, 0); 98 161 if (infoPtr->hRes) { 99 162 FreeResource(infoPtr->hRes); … … 154 217 EnterCriticalSection(&infoPtr->cs); 155 218 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); 158 221 159 222 if (infoPtr->hic && … … 257 320 DWORD insize; 258 321 259 if ( mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {322 if (WINMM_mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) { 260 323 //WARN("Can't find 'RIFF' chunk\n"); 261 324 return FALSE; … … 269 332 270 333 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) { 272 335 //WARN("Can't find 'hdrl' list\n"); 273 336 return FALSE; … … 275 338 276 339 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) { 278 341 //WARN("Can't find 'avih' chunk\n"); 279 342 return FALSE; 280 343 } 281 344 282 mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah));345 WINMM_mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah)); 283 346 //TRACE("mah.dwMicroSecPerFrame=%ld\n", infoPtr->mah.dwMicroSecPerFrame); 284 347 //TRACE("mah.dwMaxBytesPerSec=%ld\n", infoPtr->mah.dwMaxBytesPerSec); … … 291 354 //TRACE("mah.dwWidth=%ld\n", infoPtr->mah.dwWidth); 292 355 //TRACE("mah.dwHeight=%ld\n", infoPtr->mah.dwHeight); 293 mmioAscend(infoPtr->hMMio, &mmckInfo, 0);356 WINMM_mmioAscend(infoPtr->hMMio, &mmckInfo, 0); 294 357 295 358 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) { 297 360 //WARN("Can't find 'strl' list\n"); 298 361 return FALSE; … … 300 363 301 364 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) { 303 366 //WARN("Can't find 'strh' chunk\n"); 304 367 return FALSE; 305 368 } 306 369 307 mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));370 WINMM_mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash)); 308 371 //TRACE("ash.fccType='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccType)), 309 372 // HIBYTE(LOWORD(infoPtr->ash.fccType)), … … 327 390 //TRACE("ash.rcFrame=(%d,%d,%d,%d)\n", infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left, 328 391 // infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right); 329 mmioAscend(infoPtr->hMMio, &mmckInfo, 0);392 WINMM_mmioAscend(infoPtr->hMMio, &mmckInfo, 0); 330 393 331 394 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) { 333 396 //WARN("Can't find 'strh' chunk\n"); 334 397 return FALSE; … … 341 404 } 342 405 343 mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize);406 WINMM_mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize); 344 407 //TRACE("bih.biSize=%ld\n", infoPtr->inbih->biSize); 345 408 //TRACE("bih.biWidth=%ld\n", infoPtr->inbih->biWidth); … … 353 416 //TRACE("bih.biClrUsed=%ld\n", infoPtr->inbih->biClrUsed); 354 417 //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); 358 421 359 422 #if 0 … … 362 425 */ 363 426 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) { 365 428 //WARN("There should be a single 'strl' list\n"); 366 429 return FALSE; … … 368 431 #endif 369 432 370 mmioAscend(infoPtr->hMMio, &mmckHead, 0);433 WINMM_mmioAscend(infoPtr->hMMio, &mmckHead, 0); 371 434 372 435 /* no need to read optional JUNK chunk */ 373 436 374 437 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) { 376 439 //WARN("Can't find 'movi' list\n"); 377 440 return FALSE; … … 388 451 389 452 numFrame = insize = 0; 390 while ( mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&453 while (WINMM_mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 && 391 454 numFrame < infoPtr->mah.dwTotalFrames) { 392 455 infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset; … … 394 457 insize = mmckInfo.cksize; 395 458 numFrame++; 396 mmioAscend(infoPtr->hMMio, &mmckInfo, 0);459 WINMM_mmioAscend(infoPtr->hMMio, &mmckInfo, 0); 397 460 } 398 461 if (numFrame != infoPtr->mah.dwTotalFrames) { … … 547 610 { 548 611 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; 553 615 554 616 /* allocate memory for info structure */ … … 560 622 561 623 /* Temporary hack until we get dllglue up and running */ 562 *(VOID**)&infoPtr->fnICOpen = (VOID*)GetProcAddress(hM odule,"ICOpen");563 *(VOID**)&infoPtr->fnICClose = (VOID*)GetProcAddress(hM odule,"ICClose");564 *(VOID**)&infoPtr->fnICSendMessage = (VOID*)GetProcAddress(hM odule,"ICSendMessage");565 *(VOID**)&infoPtr->fnICDecompress = (VOID*)GetProcAddress(hM odule,"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"); 566 628 567 629 //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:36cbratschi Exp $*/1 /*$Id: listview.cpp,v 1.6 2000-03-23 17:14:34 cbratschi Exp $*/ 2 2 /* 3 3 * Listview control … … 12 12 * 13 13 * 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. 17 15 * 18 16 * Notifications: … … 35 33 * LISTVIEW_RedrawItems : empty stub 36 34 * LISTVIEW_Update : not completed 37 * WM_SETREDRAW not implemented38 35 * 39 36 * the sort algorithm isn't stable (order of same items isn't fixed)!!! … … 156 153 static LRESULT LISTVIEW_GetStringWidth(HWND hwnd,HDC hdc,LPWSTR lpszText,BOOL unicode); 157 154 static BOOL LISTVIEW_EnsureVisible(HWND hwnd,INT nItem,BOOL bPartial); 158 static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos);155 static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd,INT nNewScrollPos,INT xScroll); 159 156 160 157 static VOID LISTVIEW_Refresh(HWND hwnd) … … 175 172 176 173 GetClientRect(hwnd,&rect); 177 Get ClientRect(infoPtr->hwndHeader,&rect2);178 rect.top += rect2.bottom ;174 GetWindowRect(infoPtr->hwndHeader,&rect2); 175 rect.top += rect2.bottom-rect2.top; 179 176 InvalidateRect(hwnd,&rect,TRUE); 180 177 } else InvalidateRect(hwnd,NULL,TRUE); … … 224 221 if (infoPtr->refreshFlags & (RF_REFRESH | RF_NOREDRAW)) return; 225 222 LISTVIEW_GetItemRect(hwnd,nItem,&rect,LVIR_SELECTBOUNDS); 223 //CB: todo: clip header 226 224 InvalidateRect(hwnd,&rect,TRUE); 227 225 } … … 231 229 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 232 230 RECT rect,header; 233 INT xOffset = infoPtr->lefttop.x* LISTVIEW_SCROLL_DIV_SIZE;231 INT xOffset = infoPtr->lefttop.x*infoPtr->scrollStep.x; 234 232 235 233 if (infoPtr->refreshFlags & (RF_REFRESH | RF_NOREDRAW)) return; 236 234 LISTVIEW_GetItemRect(hwnd,nItem,&rect,LVIR_SELECTBOUNDS); 237 235 //CB: todo: clip header 238 236 //get header rect 239 237 Header_GetItemRect(infoPtr->hwndHeader,nSubItem,&header); … … 260 258 //clip header 261 259 GetClientRect(hwnd,&rect); 262 GetClientRect(infoPtr->hwndHeader,&header); 260 GetWindowRect(infoPtr->hwndHeader,&header); 261 263 262 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 } 271 278 } else if (yScroll > 0) 272 279 { //down 273 rect.top += header.bottom ;280 rect.top += header.bottom-header.top; 274 281 ScrollWindowEx(hwnd,xScroll,yScroll,&rect,NULL,0,NULL,SW_INVALIDATE); 275 282 } 276 283 if (yScroll == 0) 277 284 { 278 rect.top += header.bottom ;285 rect.top += header.bottom-header.top; 279 286 ScrollWindowEx(hwnd,xScroll,yScroll,&rect,NULL,0,NULL,SW_INVALIDATE); 280 287 } 281 if (xScroll != 0) LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x); 288 289 if (xScroll != 0) LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x,xScroll); 282 290 } else ScrollWindowEx(hwnd,xScroll,yScroll,NULL,NULL,0,NULL,SW_INVALIDATE); 283 291 } … … 297 305 * NOTES 298 306 */ 299 static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos )307 static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos,INT xScroll) 300 308 { 301 309 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); … … 310 318 311 319 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); 318 325 } 319 326 … … 340 347 if (dwStyle & LVS_NOSCROLL) 341 348 { 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; 342 354 ShowScrollBar(hwnd,SB_BOTH,FALSE); 343 355 return; … … 353 365 INT nCountPerRow = LISTVIEW_GetCountPerRow(hwnd); 354 366 INT nNumOfItems = GETITEMCOUNT(infoPtr); 355 //CB: todo: doesn't work! 356 infoPtr->maxScroll.x = nNumOfItems / nCountPerColumn +1;367 368 infoPtr->maxScroll.x = nNumOfItems / nCountPerColumn; 357 369 if ((nNumOfItems % nCountPerColumn) == 0) 358 370 infoPtr->maxScroll.x--; … … 360 372 infoPtr->lefttop.x = LISTVIEW_GetTopIndex(hwnd) / nCountPerColumn; 361 373 infoPtr->scrollPage.x = nCountPerRow; 374 infoPtr->scrollStep.x = infoPtr->nItemWidth; 362 375 363 376 scrollInfo.nMin = 0; … … 373 386 infoPtr->lefttop.y = LISTVIEW_GetTopIndex(hwnd); 374 387 infoPtr->scrollPage.y = LISTVIEW_GetCountPerColumn(hwnd); 388 infoPtr->scrollStep.y = infoPtr->nItemHeight; 375 389 376 390 scrollInfo.nMin = 0; … … 388 402 infoPtr->scrollPage.x = nListWidth / LISTVIEW_SCROLL_DIV_SIZE; 389 403 infoPtr->maxScroll.x = max(infoPtr->nItemWidth / LISTVIEW_SCROLL_DIV_SIZE, 0); 404 infoPtr->scrollStep.x = LISTVIEW_SCROLL_DIV_SIZE; 390 405 391 406 scrollInfo.nMin = 0; … … 397 412 398 413 /* Update the Header Control */ 399 LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x );414 LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x,0); 400 415 } else 401 416 { … … 412 427 infoPtr->maxScroll.x = max(nViewWidth / LISTVIEW_SCROLL_DIV_SIZE, 0); 413 428 infoPtr->scrollPage.x = nListWidth / LISTVIEW_SCROLL_DIV_SIZE; 429 infoPtr->scrollStep.x = LISTVIEW_SCROLL_DIV_SIZE; 414 430 415 431 scrollInfo.nMin = 0; … … 426 442 infoPtr->maxScroll.y = max(nViewHeight / LISTVIEW_SCROLL_DIV_SIZE,0); 427 443 infoPtr->scrollPage.y = nListHeight / LISTVIEW_SCROLL_DIV_SIZE; 444 infoPtr->scrollStep.y = LISTVIEW_SCROLL_DIV_SIZE; 428 445 429 446 scrollInfo.nMin = 0; … … 615 632 // lprcView->left, lprcView->top, lprcView->right, lprcView->bottom); 616 633 617 if (lprcView != NULL)634 if (lprcView) 618 635 { 619 636 bResult = TRUE; … … 645 662 POINT ptOrigin; 646 663 647 // TRACE("(hwnd=%x, lprcView=%p)\n", hwnd, lprcView); 648 649 if (lprcView != NULL) 664 if (lprcView) 650 665 { 651 666 bResult = LISTVIEW_GetOrigin(hwnd, &ptOrigin); 652 if (bResult != FALSE)667 if (bResult) 653 668 { 654 669 lprcView->left = infoPtr->rcView.left + ptOrigin.x; … … 657 672 lprcView->bottom = infoPtr->rcView.bottom + ptOrigin.y; 658 673 } 659 660 // TRACE("(left=%d, top=%d, right=%d, bottom=%d)\n",661 // lprcView->left, lprcView->top, lprcView->right, lprcView->bottom);662 674 } 663 675 … … 719 731 INT i; 720 732 721 // TRACE("(hwnd=%x)\n", hwnd);722 723 733 if (uView == LVS_ICON) 724 734 { … … 731 741 for (i = 0; i < nHeaderItemCount; i++) 732 742 { 733 if (Header_GetItemRect(infoPtr->hwndHeader, i, &rcHeaderItem) != 0)743 if (Header_GetItemRect(infoPtr->hwndHeader, i, &rcHeaderItem)) 734 744 { 735 745 nItemWidth += (rcHeaderItem.right - rcHeaderItem.left); … … 2061 2071 INT nColumnCount = Header_GetItemCount(infoPtr->hwndHeader); 2062 2072 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; 2064 2074 2065 2075 nItem = LISTVIEW_GetTopIndex(hwnd); … … 2248 2258 2249 2259 GetClientRect(hwnd,&rcClient); 2250 //CB: todo: hscroll! 2260 2251 2261 for (i = 0; i < nColumnCount; i++) 2252 2262 { … … 2977 2987 2978 2988 rcItem.left = LVIR_BOUNDS; 2979 if (LISTVIEW_GetItemRect(hwnd, nItem, &rcItem) != FALSE)2989 if (LISTVIEW_GetItemRect(hwnd, nItem, &rcItem)) 2980 2990 { 2981 2991 if (rcItem.left < infoPtr->rcList.left) … … 2986 2996 if (uView == LVS_LIST) 2987 2997 { 2988 nScrollPosWidth = infoPtr-> nItemWidth;2998 nScrollPosWidth = infoPtr->scrollStep.x; 2989 2999 rcItem.left += infoPtr->rcList.left; 2990 3000 } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 2991 3001 { 2992 nScrollPosWidth = LISTVIEW_SCROLL_DIV_SIZE;3002 nScrollPosWidth = infoPtr->scrollStep.x; 2993 3003 rcItem.left += infoPtr->rcList.left; 2994 3004 } … … 2996 3006 /* When in LVS_REPORT view, the scroll position should 2997 3007 not be updated. */ 2998 if (nScrollPosWidth != 0)3008 if (nScrollPosWidth) 2999 3009 { 3000 3010 if (rcItem.left % nScrollPosWidth == 0) … … 3018 3028 { 3019 3029 rcItem.right -= infoPtr->rcList.right; 3020 nScrollPosWidth = infoPtr-> nItemWidth;3030 nScrollPosWidth = infoPtr->scrollStep.x; 3021 3031 } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 3022 3032 { 3023 3033 rcItem.right -= infoPtr->rcList.right; 3024 nScrollPosWidth = LISTVIEW_SCROLL_DIV_SIZE;3034 nScrollPosWidth = infoPtr->scrollStep.x; 3025 3035 } 3026 3036 3027 3037 /* When in LVS_REPORT view, the scroll position should 3028 3038 not be updated. */ 3029 if (nScrollPosWidth != 0)3039 if (nScrollPosWidth) 3030 3040 { 3031 3041 SCROLLINFO scrollInfo; … … 3053 3063 { 3054 3064 rcItem.top -= infoPtr->rcList.top; 3055 nScrollPosHeight = infoPtr-> nItemHeight;3065 nScrollPosHeight = infoPtr->scrollStep.y; 3056 3066 } 3057 3067 else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) 3058 3068 { 3059 nScrollPosHeight = LISTVIEW_SCROLL_DIV_SIZE;3069 nScrollPosHeight = infoPtr->scrollStep.y; 3060 3070 rcItem.top += infoPtr->rcList.top; 3061 3071 } … … 3072 3082 } 3073 3083 } 3074 } 3075 else if (rcItem.bottom > infoPtr->rcList.bottom) 3084 } else if (rcItem.bottom > infoPtr->rcList.bottom) 3076 3085 { 3077 3086 /* scroll down */ … … 3081 3090 { 3082 3091 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; 3088 3096 rcItem.bottom -= infoPtr->rcList.bottom; 3089 3097 } … … 3103 3111 3104 3112 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); 3106 3114 3107 3115 return TRUE; … … 4805 4813 { 4806 4814 if (dwStyle & WS_HSCROLL) 4807 lpptOrigin->x = -infoPtr->lefttop.x* LISTVIEW_SCROLL_DIV_SIZE;4815 lpptOrigin->x = -infoPtr->lefttop.x*infoPtr->scrollStep.x; 4808 4816 else 4809 4817 lpptOrigin->x = 0; 4810 4818 4811 4819 if (dwStyle & WS_VSCROLL) 4812 lpptOrigin->y = -infoPtr->lefttop.y* LISTVIEW_SCROLL_DIV_SIZE;4820 lpptOrigin->y = -infoPtr->lefttop.y*infoPtr->scrollStep.y; 4813 4821 else 4814 4822 lpptOrigin->y = 0; … … 6460 6468 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 6461 6469 UINT uView = dwStyle & LVS_TYPEMASK; 6462 INT xScroll = (oldX-infoPtr->lefttop.x)* LISTVIEW_SCROLL_DIV_SIZE;//CB:tocheck6470 INT xScroll = (oldX-infoPtr->lefttop.x)*infoPtr->scrollStep.x; 6463 6471 6464 6472 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); … … 7103 7111 { 7104 7112 /* 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 } 7136 7136 } 7137 7137 … … 7409 7409 { 7410 7410 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; 7413 7413 7414 7414 LISTVIEW_UpdateSize(hwnd); 7415 LISTVIEW_UpdateScroll(hwnd); 7415 7416 7416 7417 if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 7417 7418 { 7418 if (lStyle & LVS_ALIGNLEFT) 7419 { 7419 if (dwStyle & LVS_ALIGNLEFT) 7420 7420 LISTVIEW_AlignLeft(hwnd); 7421 }7422 7421 else 7423 {7424 7422 LISTVIEW_AlignTop(hwnd); 7425 } 7426 } 7427 7428 /* invalidate client area + erase background */ 7429 infoPtr->refreshFlags |= RF_UPDATESCROLL; 7430 LISTVIEW_QueueRefresh(hwnd); 7431 7423 } 7432 7424 return 0; 7433 7425 } … … 7446 7438 { 7447 7439 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; 7450 7442 RECT rcList; 7451 7443 … … 7458 7450 if (uView == LVS_LIST) 7459 7451 { 7460 if ( (lStyle & WS_HSCROLL) == 0)7452 if (!(dwStyle & WS_HSCROLL)) 7461 7453 { 7462 7454 INT nHScrollHeight = GetSystemMetrics(SM_CYHSCROLL); … … 7466 7458 } 7467 7459 } 7468 } 7469 else if (uView == LVS_REPORT) 7470 { 7471 HDLAYOUT hl; 7472 WINDOWPOS wp; 7473 7474 hl.prc = &rcList; 7475 hl.pwpos = ℘ 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 = ℘ 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); 7481 7472 } 7482 7473 } … … 7498 7489 LPSTYLESTRUCT lpss) 7499 7490 { 7500 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 7491 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 7501 7492 UINT uNewView = lpss->styleNew & LVS_TYPEMASK; 7502 7493 UINT uOldView = lpss->styleOld & LVS_TYPEMASK; 7503 7494 RECT rcList = infoPtr->rcList; 7504 7505 // TRACE("(hwnd=%x, styletype=%x, stylestruct=%p)\n",7506 // hwnd, wStyleType, lpss);7507 7495 7508 7496 if (wStyleType == GWL_STYLE) … … 8210 8198 8211 8199 ZeroMemory(&wndClass, sizeof(WNDCLASSA)); 8212 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS ;8200 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; 8213 8201 wndClass.lpfnWndProc = (WNDPROC)LISTVIEW_WindowProc; 8214 8202 wndClass.cbClsExtra = 0; -
trunk/src/comctl32/makefile
r3031 r3203 1 # $Id: makefile,v 1.2 4 2000-03-06 23:38:17 birdExp $1 # $Id: makefile,v 1.25 2000-03-23 17:14:45 cbratschi Exp $ 2 2 3 3 # … … 84 84 $(PDWIN32_LIB)/user32.lib 85 85 $(PDWIN32_LIB)/odincrt.lib 86 $(PDWIN32_LIB)/winmm.lib87 86 OS2386.LIB 88 87 $(RTLLIB_O)
Note:
See TracChangeset
for help on using the changeset viewer.