Ticket #22: mmfolder.diff
File mmfolder.diff, 29.3 KB (added by , 8 months ago) |
---|
-
D:\cwmmclasses\trunk\classes\c\c_mm\mmfolder.c
16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; see the file COPYING. If not, write to 18 18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 19 */ 20 20 /* 21 21 * If you need another license for your project/product (commercial, 22 22 * noncommercial, whatever) contact me at 23 * 23 * 24 24 * http://www.os2world.com/cdwriting 25 25 * http://www.geocities.com/SiliconValley/Sector/5785/ 26 26 * 27 27 */ 28 28 /* 29 29 * This file was generated by the SOM Compiler and Emitter Framework. 30 * Generated using: 30 * Generated using: 31 31 * SOM Emitter emitctm: 2.42 32 32 */ 33 33 … … 58 58 #include "som_wps_funcs.h" 59 59 #include "sys_funcs.h" 60 60 61 //#if 062 #ifndef _cwmmQuerySmallBitmapHandle63 #define _cwmmQuerySmallBitmapHandle MMImage_cwmmQuerySmallBitmapHandle64 #define _cwmmQuerySmallBitmapHandleCWBitmap MMBitmap_cwmmQuerySmallBitmapHandle65 #endif66 //#endif67 61 #define STOREWINDOWID 112233 68 62 69 63 //#define DEBUG … … 82 76 { 83 77 somId mySomId; 84 78 static SOMClass * mWPFolderClass=NULLHANDLE; 85 79 86 80 if(!mWPFolderClass) { 87 81 if((mySomId=somIdFromString("WPFolder"))!=NULLHANDLE) { 88 82 mWPFolderClass=(SOMClass*)_somClassFromId(SOMClassMgrObject, mySomId); … … 112 106 { 113 107 somId mySomId; 114 108 static SOMClass *mWPImgClass=NULL; 115 109 116 110 if(!mWPImgClass) { 117 111 if((mySomId=somIdFromString("MMBitmap"))!=NULLHANDLE) { 118 112 mWPImgClass=(SOMClass*)_somClassFromId(SOMClassMgrObject, mySomId); … … 122 116 return mWPImgClass; 123 117 } 124 118 125 MRESULT EXPENTRY mmFolderContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 119 MRESULT EXPENTRY mmFolderContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 126 120 { 127 121 HWND hwndStore; 128 122 MMFolder *somSelf; … … 141 135 PCNRINFO pCnrInfo=(PCNRINFO)PVOIDFROMMP(mp1); 142 136 143 137 if(pCnrInfo) { 144 // writeLog("flWindowAttr: 0x%x, Mask: 0x%x, cxTreeIndent: %d, cyLineSpacing: %d\n", 138 // writeLog("flWindowAttr: 0x%x, Mask: 0x%x, cxTreeIndent: %d, cyLineSpacing: %d\n", 145 139 // pCnrInfo->flWindowAttr, LONGFROMMP(mp2), pCnrInfo->cxTreeIndent, pCnrInfo->cyLineSpacing); 146 140 147 141 if(!(pCnrInfo->flWindowAttr & (CV_DETAIL|CV_TREE/*|CV_ICON|CV_NAME*/)) && … … 152 146 { 153 147 somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER); 154 148 if(somIsObj(somSelf)) { 155 MMFolderData *somThis = MMFolderGetData(somSelf); 156 149 MMFolderData *somThis = MMFolderGetData(somSelf); 150 157 151 pCnrInfo->flWindowAttr&=~CA_DRAWICON; 158 152 pCnrInfo->flWindowAttr|=CA_DRAWBITMAP|CA_OWNERDRAW; 159 153 pCnrInfo->slBitmapOrIcon.cx=_ulCurrentSize; 160 154 pCnrInfo->slBitmapOrIcon.cy=_ulCurrentSize; 161 155 162 156 mp2=MPFROMLONG(LONGFROMMP(mp2)|CMA_SLBITMAPORICON|CMA_FLWINDOWATTR); 163 157 } 164 158 } … … 188 182 { 189 183 somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER); 190 184 if(somIsObj(somSelf)) { 191 MMFolderData *somThis = MMFolderGetData(somSelf); 185 MMFolderData *somThis = MMFolderGetData(somSelf); 192 186 if(_oldContainerProc) 193 187 return _oldContainerProc(hwnd, msg, mp1, mp2); 194 188 } 195 189 } 196 } 190 } 197 191 return WinDefWindowProc(hwnd, msg, mp1, mp2); 198 192 } 199 193 … … 244 238 { 245 239 HPOINTER hptrTemplate; 246 240 HMODULE hmodTemplate; 247 241 248 242 if(!DosQueryModuleHandle("PMWP",&hmodTemplate)) 249 243 { 250 244 ULONG ulIconSize; 251 245 252 246 hptrTemplate=WinLoadPointer(HWND_DESKTOP, hmodTemplate, 20); 253 247 WinDrawPointer(hps, rcl->xLeft, rcl->yBottom, hptrTemplate, (flCnr & CV_MINI ? DP_MINI:DP_NORMAL)); 254 248 WinDestroyPointer(hptrTemplate); … … 260 254 } 261 255 return DP_MINI; 262 256 } 263 257 264 258 return DP_NORMAL; 265 259 } 266 260 267 261 268 MRESULT EXPENTRY mmFolderFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 262 MRESULT EXPENTRY mmFolderFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 269 263 { 270 264 HWND hwndStore; 271 265 MMFolder *somSelf; … … 278 272 case WM_DRAWITEM: 279 273 { 280 274 POWNERITEM pOwnerItem=(POWNERITEM)PVOIDFROMMP(mp2); 281 275 282 276 283 277 /* We only draw icons not text */ 284 278 if(pOwnerItem->idItem==CMA_ICON /*&& !bNot*/) { … … 304 298 && (pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_SELECTED)) { 305 299 POINTL pointl; 306 300 307 WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE); 301 WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE); 308 302 GpiSetPattern(pOwnerItem->hps,PATSYM_DIAG2); 309 303 pointl.x = rclTemp.xLeft; 310 304 pointl.y = rclTemp.yBottom; … … 312 306 pointl.x = rclTemp.xRight - 1; 313 307 pointl.y = rclTemp.yTop - 1; 314 308 GpiSetColor(pOwnerItem->hps, CLR_BLACK); 315 GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1); 316 309 GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1); 310 317 311 } 318 312 /* Check if record is in use */ 319 313 else if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE) { 320 314 POINTL pointl; 321 315 322 WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE); 316 WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE); 323 317 GpiSetPattern(pOwnerItem->hps,PATSYM_DIAG1); 324 318 pointl.x = rclTemp.xLeft; 325 319 pointl.y = rclTemp.yBottom; … … 327 321 pointl.x = rclTemp.xRight - 1; 328 322 pointl.y = rclTemp.yTop - 1; 329 323 GpiSetColor(pOwnerItem->hps, CLR_BLACK); 330 GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1); 324 GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1); 331 325 } 332 326 /* or is it only selected? */ 333 327 else if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_SELECTED) … … 335 329 /* Default is paint white background */ 336 330 else 337 331 WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE); 338 /* Emphasis drawn */ 332 /* Emphasis drawn */ 339 333 340 334 /********************************************/ 341 335 /* */ … … 345 339 if(mrc){ 346 340 WPObject *wpObject; 347 341 ULONG ulIconSize=150;/* Default if query fails */ 348 342 349 343 wpObject=(WPObject*)OBJECT_FROM_PREC(mrc); // Get object 350 344 wpObject=somGetFileSystemObject(wpObject); // Get Filesystem object 351 345 … … 361 355 #ifdef DEBUG 362 356 SysWriteToTrapLog("Object is an image. (%s line: %d)\n", __FUNCTION__, __LINE__); 363 357 #endif 364 /* Get object pointer of lighttable folder */ 358 /* Get object pointer of lighttable folder */ 365 359 if((hwndStore=WinWindowFromID(hwnd, STOREWINDOWID))!=NULLHANDLE) 366 360 { 367 361 somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER); 368 362 if(somIsObj(somSelf)) { 369 MMFolderData *somThis = MMFolderGetData(somSelf); 363 MMFolderData *somThis = MMFolderGetData(somSelf); 370 364 ulIconSize=_ulCurrentSize; 371 365 } 372 366 } … … 388 382 389 383 Wondering what hidden problems/bugs will show upt in the future... 390 384 */ 391 if((hbm= _cwmmQuerySmallBitmapHandle( (MMImage*) wpObject, ulIconSize, mrc, hwndCnr))!=NULLHANDLE)385 if((hbm=cwimg_cwmmQuerySmallBitmapHandle( (MMImage*) wpObject, ulIconSize, mrc, hwndCnr))!=NULLHANDLE) 392 386 pBmpInfoHeader2=(PBITMAPINFOHEADER2)_wpQueryBitmapInfoHeader((MMImage*)wpObject); 393 387 #ifdef DEBUG 394 388 SysWriteToTrapLog("Queried HBITMAP: %x (line: %d)\n", hbm, __LINE__); … … 398 392 else if(_somIsA(wpObject, cwBitmapClass)) { 399 393 /* The default WPS bitmap class (WPBitmap) returns an PBITMAPHEADER. The CWBitmap class 400 394 does return a PBITMAPHEADER2<-. */ 401 if((hbm= _cwmmQuerySmallBitmapHandleCWBitmap( (MMBitmap*) wpObject, ulIconSize))!=NULLHANDLE)395 if((hbm=cwbmp_cwmmQuerySmallBitmapHandle( (MMBitmap*) wpObject, ulIconSize))!=NULLHANDLE) 402 396 pBmpInfoHeader2=(PBITMAPINFOHEADER2)_cwmmQueryBitmapInfoHeader((MMBitmap*)wpObject); 403 397 } 404 398 … … 428 422 cwAdjustIconRECTL(&rcl, ulIconWidth, ulWidth, ulHeight); 429 423 /* And now draw the bitmap */ 430 424 #if 0 431 if(pBmpInfoHeader2->cclrUsed==2) { 425 if(pBmpInfoHeader2->cclrUsed==2) { 432 426 WinDrawBitmap(pOwnerItem->hps, hbm, NULL, (PPOINTL)&rcl,//pOwnerItem->rclItem, 433 427 CLR_WHITE, CLR_BLACK, DBM_STRETCH /*| DBM_IMAGEATTRS*/); 434 428 } … … 441 435 /* Draw a small border around the image */ 442 436 cwDraw2ColorBorder(pOwnerItem->hps, &rclTemp, CLR_BLACK, CLR_DARKGRAY); 443 437 /* Done */ 444 free(hbm); 438 if(_somIsA(wpObject, cwImageClass)) { 439 cwimg_cwmmFreeSmallBitmap((MMImage *)wpObject); 440 } 441 else { 442 cwbmp_cwmmFreeSmallBitmap((MMBitmap*)wpObject); 443 } 445 444 return (MRESULT) TRUE; 446 445 }/* hbm */ 447 446 }/* cwImageClass/cwBitmapClass */ … … 474 473 if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE) 475 474 { 476 475 SOMClass* wpFolderClass=queryWpFolderClass(); 477 476 478 477 if(somIsObj(wpFolderClass)) { 479 if(_somIsA(wpObject, wpFolderClass)) { 478 if(_somIsA(wpObject, wpFolderClass)) { 480 479 /* It's a folder */ 481 480 HPOINTER hptr; 482 481 483 482 pOwnerItem->rclItem.xLeft=rcl.xLeft; 484 483 pOwnerItem->rclItem.yBottom=rcl.yBottom; 485 484 486 485 /* The following is only for Warp 4 but Warp 3 isn't supported anyway...*/ 487 486 hptr=_wpQueryIconN(wpObject,1); 488 487 if(WinDrawPointer(pOwnerItem->hps, rcl.xLeft, rcl.yBottom, hptr, ulMiniOrNormal)) { 489 488 cwDraw2ColorBorder(pOwnerItem->hps, &rclTemp, CLR_BLACK, CLR_DARKGRAY); 490 489 return (MRESULT) TRUE; 491 490 } 492 491 493 492 } 494 493 }/* if(somIsObj(wpFolderClass)) */ 495 494 }/* if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE) */ 496 495 497 496 if(WinDrawPointer(pOwnerItem->hps, rcl.xLeft, rcl.yBottom, mrc->hptrIcon, ulMiniOrNormal)) { 498 497 cwDraw2ColorBorder(pOwnerItem->hps, &rclTemp, CLR_BLACK, CLR_DARKGRAY); 499 498 return (MRESULT) TRUE; … … 508 507 /* It's the details view */ 509 508 /*************************/ 510 509 PCNRDRAWITEMINFO pCnrDrawItemInfo=(PCNRDRAWITEMINFO)pOwnerItem->hItem; 511 510 512 511 if(pCnrDrawItemInfo && pCnrDrawItemInfo->pFieldInfo->flData & CFA_BITMAPORICON) { 513 512 PMINIRECORDCORE mrc=(PMINIRECORDCORE)((PCNRDRAWITEMINFO)pOwnerItem->hItem)->pRecord; 514 513 if(mrc){ … … 517 516 ULONG ulIconSize=150;/* Default if query fails */ 518 517 HWND hwndCnr=WinWindowFromID(hwnd, FID_CLIENT); 519 518 RECTL rclTemp=pOwnerItem->rclItem; 520 519 521 520 wpObjToRefresh=(WPObject*)OBJECT_FROM_PREC(mrc);//Get object 522 521 wpObject=somGetFileSystemObject(wpObjToRefresh); 523 522 524 523 /* Draw Background */ 525 524 rclTemp.xLeft+=2; 526 525 rclTemp.xRight-=2; 527 526 rclTemp.yBottom+=2; 528 527 rclTemp.yTop-=2; 529 528 530 529 /* Check if record is selected and in use... */ 531 530 if((pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE) 532 531 && (pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_SELECTED)) { 533 532 POINTL pointl; 534 533 535 534 GpiSetPattern(pOwnerItem->hps,PATSYM_DIAG2); 536 535 pointl.x = rclTemp.xLeft; 537 536 pointl.y = rclTemp.yBottom; … … 539 538 pointl.x = rclTemp.xRight - 1; 540 539 pointl.y = rclTemp.yTop - 1; 541 540 GpiSetColor(pOwnerItem->hps, CLR_BLACK); 542 GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1); 543 541 GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1); 542 544 543 } 545 544 /* or only in use... */ 546 545 else if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE) { 547 546 POINTL pointl; 548 547 549 548 GpiSetPattern(pOwnerItem->hps,PATSYM_DIAG1); 550 549 pointl.x = rclTemp.xLeft; 551 550 pointl.y = rclTemp.yBottom; … … 553 552 pointl.x = rclTemp.xRight - 1; 554 553 pointl.y = rclTemp.yTop - 1; 555 554 GpiSetColor(pOwnerItem->hps, CLR_BLACK); 556 GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1); 555 GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1); 557 556 } 558 557 /* or only selected. */ 559 558 else if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_SELECTED) … … 564 563 if(somIsObj(wpObject) && _wpIsObjectInitialized(wpObject)) { 565 564 SOMClass* cwBitmapClass=queryCWBitmapFileClass(); 566 565 SOMClass* cwImageClass=queryCWImageFileClass(); 567 566 568 567 if(somIsObj(cwImageClass)||somIsObj(cwBitmapClass)) { 569 568 HBITMAP hbm=NULLHANDLE; 570 569 PBITMAPINFOHEADER2 pBmpInfoHeader2; 571 570 572 571 /* Query object pointer */ 573 572 if((hwndStore=WinWindowFromID(hwnd, STOREWINDOWID))!=NULLHANDLE) 574 573 { 575 574 somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER); 576 575 if(somIsObj(somSelf)) { 577 MMFolderData *somThis = MMFolderGetData(somSelf); 576 MMFolderData *somThis = MMFolderGetData(somSelf); 578 577 ulIconSize=_ulCurrentSize; 579 578 } 580 579 } 581 /* Get the small bitmap from the object */ 580 /* Get the small bitmap from the object */ 582 581 if(_somIsA(wpObject, cwImageClass)) { 583 hbm= _cwmmQuerySmallBitmapHandle( (MMImage*) wpObject, ulIconSize, mrc, hwndCnr);582 hbm=cwimg_cwmmQuerySmallBitmapHandle( (MMImage*) wpObject, ulIconSize, mrc, hwndCnr); 584 583 pBmpInfoHeader2=(PBITMAPINFOHEADER2)_wpQueryBitmapInfoHeader((MMImage*)wpObject); 585 584 } 586 585 else if(_somIsA(wpObject, cwBitmapClass)) { 587 hbm= _cwmmQuerySmallBitmapHandleCWBitmap( (MMImage*) wpObject, ulIconSize);586 hbm=cwbmp_cwmmQuerySmallBitmapHandle( (MMBitmap*) wpObject, ulIconSize); 588 587 pBmpInfoHeader2=(PBITMAPINFOHEADER2)_wpQueryBitmapInfoHeader((MMBitmap*)wpObject); 589 588 } 590 589 if(hbm) … … 635 634 WinDrawBitmap(pOwnerItem->hps, hbm, NULL, (PPOINTL)&rcl,//pOwnerItem->rclItem, 636 635 CLR_WHITE, CLR_BLACK, DBM_STRETCH /*|DBM_IMAGEATTRS*/); 637 636 } 637 if(_somIsA(wpObject, cwImageClass)) { 638 cwimg_cwmmFreeSmallBitmap((MMImage *)wpObject); 639 } 640 else { 641 cwbmp_cwmmFreeSmallBitmap((MMBitmap*)wpObject); 642 } 638 643 return (MRESULT) TRUE; 639 644 }/* hbm */ 640 645 }/* cwImageClass */ … … 678 683 { 679 684 somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER); 680 685 if(somIsObj(somSelf)) { 681 MMFolderData *somThis = MMFolderGetData(somSelf); 686 MMFolderData *somThis = MMFolderGetData(somSelf); 682 687 switch(_usLastSelMenuItem) 683 688 { 684 689 case 0x2d1:/* view menu */ … … 695 700 if((cnrInfo.flWindowAttr & CV_ICON) && !(cnrInfo.flWindowAttr & CV_TREE)) { 696 701 /* insert separator */ 697 702 menuInsertMenuSeparator( HWNDFROMMP(mp2), NULLHANDLE, MIT_END); 698 703 699 704 /* Load the menu from the resource */ 700 705 hwndMenu=WinLoadMenu(hwnd,queryResModuleHandle(), ID_MENUICONSIZE); 701 706 702 707 /* Fill the MENUITEM structure */ 703 708 mi.iPosition=MIT_END; 704 709 mi.afStyle=MIS_TEXT|MIS_SUBMENU; 705 710 mi.id=ID_MENUICONSIZE; 706 mi.afAttribute=NULLHANDLE; 711 mi.afAttribute=NULLHANDLE; 707 712 mi.hwndSubMenu=hwndMenu; 708 713 mi.hItem=NULLHANDLE; 709 714 if(!getMessage(text, IDSTR_ICONSIZEMENU, sizeof(text), queryResModuleHandle(), hwnd)) 710 715 strcpy(text, "Icon ~size");; 711 716 menuInsertMenuItem(HWNDFROMMP(mp2), hwndMenu, MIT_END, ID_MENUICONSIZE, text); 712 717 713 718 /* check current menuitem */ 714 719 switch(_ulCurrentSize) 715 720 { … … 732 737 WinCheckMenuItem(hwndMenu, ID_250X250ITEM, TRUE); 733 738 break; 734 739 default: 735 break; 740 break; 736 741 } 737 742 } 738 743 }/* if() */ … … 749 754 { 750 755 somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER); 751 756 if(somIsObj(somSelf)) { 752 MMFolderData *somThis = MMFolderGetData(somSelf); 757 MMFolderData *somThis = MMFolderGetData(somSelf); 753 758 _usLastSelMenuItem=SHORT1FROMMP(mp1); 754 759 } 755 760 } … … 762 767 { 763 768 somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER); 764 769 if(somIsObj(somSelf)) { 765 MMFolderData *somThis = MMFolderGetData(somSelf); 770 MMFolderData *somThis = MMFolderGetData(somSelf); 766 771 if(_oldFrameProc) 767 772 return _oldFrameProc(hwnd, msg, mp1, mp2); 768 773 } 769 774 } 770 775 771 776 return WinDefWindowProc(hwnd, msg, mp1, mp2); 772 777 } 773 778 … … 775 780 * wpSetupOnce :override; 776 781 */ 777 782 778 SOM_Scope HWND SOMLINK mmfldr_wpOpen(MMFolder *somSelf, HWND hwndCnr, 783 SOM_Scope HWND SOMLINK mmfldr_wpOpen(MMFolder *somSelf, HWND hwndCnr, 779 784 ULONG ulView, ULONG param) 780 785 { 781 786 HWND hwnd; 782 787 783 MMFolderData *somThis = MMFolderGetData(somSelf); 788 MMFolderData *somThis = MMFolderGetData(somSelf); 784 789 MMFolderMethodDebug("MMFolder","mmfldr_wpOpen"); 785 790 786 hwnd=(MMFolder_parent_WPFolder_wpOpen(somSelf, hwndCnr, 791 hwnd=(MMFolder_parent_WPFolder_wpOpen(somSelf, hwndCnr, 787 792 ulView, param)); 788 793 789 794 /* Only subclass folder frames, not settings notebooks */ 790 if(ulView!=OPEN_SETTINGS){ 795 if(ulView!=OPEN_SETTINGS){ 791 796 HWND hwndStore; 792 797 793 798 if((hwndStore=WinCreateWindow(hwnd, WC_STATIC, "objectStore", 0, 0,0,0,0, 794 799 hwnd, HWND_BOTTOM, STOREWINDOWID, NULLHANDLE, NULLHANDLE))!=NULLHANDLE) 795 800 { 796 HWND hwndContainer; 801 HWND hwndContainer; 797 802 798 803 WinSetWindowULong(hwndStore, QWL_USER, (ULONG)somSelf); 799 804 _oldFrameProc=WinSubclassWindow(hwnd, mmFolderFrameProc); 800 805 801 806 if(hwnd) 802 807 { 803 808 CNRINFO cnrInfo; 804 809 HWND hwndContainer=WinWindowFromID(hwnd,FID_CLIENT); 805 810 806 811 /* Change the containerflags */ 807 812 if(WinSendMsg(hwndContainer,CM_QUERYCNRINFO, MPFROMP(&cnrInfo), 808 813 MPFROMSHORT(sizeof(cnrInfo)))) 809 814 { 810 if(cnrInfo.flWindowAttr & CV_ICON) { 815 if(cnrInfo.flWindowAttr & CV_ICON) { 811 816 cnrInfo.slBitmapOrIcon.cx=_ulCurrentSize; 812 817 cnrInfo.slBitmapOrIcon.cy=_ulCurrentSize; 813 818 cnrInfo.flWindowAttr&=~CA_DRAWICON; … … 828 833 } 829 834 830 835 #if 0 831 SOM_Scope BOOL SOMLINK mmfldr_wpSetupOnce(MMFolder *somSelf, 836 SOM_Scope BOOL SOMLINK mmfldr_wpSetupOnce(MMFolder *somSelf, 832 837 PSZ pszSetupString) 833 838 { 834 839 BOOL rc; … … 853 858 } 854 859 #endif 855 860 856 SOM_Scope BOOL SOMLINK mmfldr_wpRestoreState(MMFolder *somSelf, 861 SOM_Scope BOOL SOMLINK mmfldr_wpRestoreState(MMFolder *somSelf, 857 862 ULONG ulReserved) 858 863 { 859 864 MMFolderData *somThis = MMFolderGetData(somSelf); … … 864 869 _ulCurrentSize=MMFLDR_DEFAULT_ICONSIZE; 865 870 } 866 871 867 return (MMFolder_parent_WPFolder_wpRestoreState(somSelf, 872 return (MMFolder_parent_WPFolder_wpRestoreState(somSelf, 868 873 ulReserved)); 869 874 } 870 875 871 SOM_Scope BOOL SOMLINK mmfldr_wpRestoreData(MMFolder *somSelf, 872 PSZ pszClass, ULONG ulKey, 876 SOM_Scope BOOL SOMLINK mmfldr_wpRestoreData(MMFolder *somSelf, 877 PSZ pszClass, ULONG ulKey, 873 878 PBYTE pValue, PULONG pcbValue) 874 879 { 875 880 BOOL rc; 876 881 MMFolderData *somThis = MMFolderGetData(somSelf); 877 882 MMFolderMethodDebug("MMFolder","mmfldr_wpRestoreData"); 878 883 879 rc= (MMFolder_parent_WPFolder_wpRestoreData(somSelf, pszClass, 880 ulKey, pValue, 884 rc= (MMFolder_parent_WPFolder_wpRestoreData(somSelf, pszClass, 885 ulKey, pValue, 881 886 pcbValue)); 882 887 switch(ulKey) 883 888 { … … 913 918 { 914 919 MMFolderData *somThis = MMFolderGetData(somSelf); 915 920 MMFolderMethodDebug("MMFolder","mmfldr_wpSaveState"); 916 921 917 922 _wpSaveLong( somSelf, "MMFolder", KEY_ICONSIZE, _ulCurrentSize); 918 923 919 924 return (MMFolder_parent_WPFolder_wpSaveState(somSelf)); 920 925 } 921 926 922 927 923 SOM_Scope BOOL SOMLINK mmfldr_wpSaveData(MMFolder *somSelf, 924 PSZ pszClass, ULONG ulKey, 928 SOM_Scope BOOL SOMLINK mmfldr_wpSaveData(MMFolder *somSelf, 929 PSZ pszClass, ULONG ulKey, 925 930 PBYTE pValue, ULONG cbValue) 926 931 { 927 932 PSZ psz; … … 931 936 /* When the template is created wpRestoreData() isn't called so we don't have 932 937 the address of the instance data containing grid spacing and view. So 933 938 we force the object to save the instance data and in wpSaveData we 934 finally get the right addresses to change the object view to gridded. 939 finally get the right addresses to change the object view to gridded. 935 940 This change is done in wpObjectReady() where we called wpSaveImmediate(). */ 936 941 937 942 /* If no ID result is NULL */ … … 940 945 941 946 Check ID for NULL to prevent crash in stricmp(). 942 947 */ 943 psz=_wpQueryObjectID(somSelf); 948 psz=_wpQueryObjectID(somSelf); 944 949 // if(!stricmp(_wpQueryObjectID(somSelf), "<MMPM2_MMFOLDERTEMPLATE>")) 945 950 if(psz && !stricmp(psz, "<MMPM2_MMFOLDERTEMPLATE>")) 946 951 { … … 976 981 } 977 982 } 978 983 979 return (MMFolder_parent_WPFolder_wpSaveData(somSelf, pszClass, 980 ulKey, pValue, 984 return (MMFolder_parent_WPFolder_wpSaveData(somSelf, pszClass, 985 ulKey, pValue, 981 986 cbValue)); 982 987 } 983 988 984 SOM_Scope BOOL SOMLINK mmfldr_wpMenuItemSelected(MMFolder *somSelf, 985 HWND hwndFrame, 989 SOM_Scope BOOL SOMLINK mmfldr_wpMenuItemSelected(MMFolder *somSelf, 990 HWND hwndFrame, 986 991 ULONG ulMenuId) 987 992 { 988 993 CNRINFO cnrInfo; … … 998 1003 { 999 1004 char text[200]; 1000 1005 CNRINFO cnrInfo2=cnrInfo; 1001 1006 1002 1007 switch(ulMenuId) 1003 1008 { 1004 1009 case ID_50X50ITEM: … … 1048 1053 *(_pulGridSpacing--)=_ulCurrentSize+MMFLDR_SPACINGDELTA_Y; 1049 1054 } 1050 1055 1051 _wpSetup(somSelf, "MENUITEMSELECTED=716");/* Change to icon view */ 1056 _wpSetup(somSelf, "MENUITEMSELECTED=716");/* Change to icon view */ 1052 1057 _wpSetup(somSelf, "MENUITEMSELECTED=309");/* Arrange */ 1053 1058 1054 1059 WinEnableWindowUpdate(hwndContainer, TRUE); … … 1056 1061 return TRUE; 1057 1062 } 1058 1063 }/* if() */ 1059 return (MMFolder_parent_WPFolder_wpMenuItemSelected(somSelf, 1060 hwndFrame, 1064 return (MMFolder_parent_WPFolder_wpMenuItemSelected(somSelf, 1065 hwndFrame, 1061 1066 ulMenuId)); 1062 1067 } 1063 1068 … … 1065 1070 /* 1066 1071 *wpSetup:override; 1067 1072 */ 1068 SOM_Scope void SOMLINK mmfldr_wpObjectReady(MMFolder *somSelf, 1073 SOM_Scope void SOMLINK mmfldr_wpObjectReady(MMFolder *somSelf, 1069 1074 ULONG ulCode, WPObject* refObject) 1070 1075 { 1071 1076 MMFolderData *somThis = MMFolderGetData(somSelf); … … 1094 1099 _ulCurrentSize=MMFLDR_DEFAULT_ICONSIZE; 1095 1100 1096 1101 /* If no ID result is NULL */ 1097 psz=_wpQueryObjectID(somSelf); 1102 psz=_wpQueryObjectID(somSelf); 1098 1103 if(psz && !stricmp(psz, "<MMPM2_MMFOLDERTEMPLATE>")) { 1099 1104 /* When the template is created wpRestoreData() isn't called so we don't have 1100 1105 the address of the instance data containing grid spacing and view. So 1101 1106 we force the object to save the instance data and in wpSaveData we 1102 1107 finally get the right addresses to change the object view to gridded. */ 1103 1108 1104 1109 _wpSaveImmediate(somSelf); 1105 1110 /* Set default view to gridded */ 1106 1111 1107 1112 if(_pFldrLongArray!=NULLHANDLE) { 1108 1113 *_pFldrLongArray=0x80; 1109 1114 //DosBeep(100, 200); … … 1114 1119 /* FIXME: Use fontsize */ 1115 1120 *(_pulGridSpacing--)=_ulCurrentSize+MMFLDR_SPACINGDELTA_Y; 1116 1121 } 1117 1122 1118 1123 } 1119 1124 break; 1120 1125 } … … 1131 1136 MMFolderData *somThis = MMFolderGetData(somSelf); 1132 1137 MMFolderMethodDebug("MMFolder","mmfldr_wpSetup"); 1133 1138 1134 bufferSize=sizeof(buffer); 1139 bufferSize=sizeof(buffer); 1135 1140 if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMTHUMBSIZE, buffer, &bufferSize)) 1136 1141 { 1137 1142 PVIEWITEM pViewItem; … … 1174 1179 pViewItem; 1175 1180 pViewItem=_wpFindViewItem(somSelf,VIEW_CONTENTS|VIEW_TREE|VIEW_DETAILS, pViewItem)) 1176 1181 { 1177 _wpMenuItemSelected(somSelf, 1178 pViewItem->handle, 1182 _wpMenuItemSelected(somSelf, 1183 pViewItem->handle, 1179 1184 ulMenuId); 1180 1185 } 1181 1186 } … … 1183 1188 } 1184 1189 1185 1190 1186 SOM_Scope BOOL SOMLINK mmfldrM_wpclsCreateDefaultTemplates(M_MMFolder *somSelf, 1191 SOM_Scope BOOL SOMLINK mmfldrM_wpclsCreateDefaultTemplates(M_MMFolder *somSelf, 1187 1192 WPObject* Folder) 1188 1193 { 1189 1194 char chrSetup[sizeof(MMFLDR_TEMPLATE_SETUP)+1]; … … 1199 1204 sprintf(chrSetup, MMFLDR_TEMPLATE_SETUP); 1200 1205 wpFolder=_wpclsQueryFolder(somSelf, MMTEMPLATE_FOLDER_ID, FALSE); 1201 1206 _wpclsNew(somSelf, _wpclsQueryTitle(somSelf), chrSetup, wpFolder,FALSE); 1202 1207 1203 1208 return TRUE; 1204 1209 } 1205 1210 … … 1218 1223 } 1219 1224 1220 1225 1221 SOM_Scope ULONG SOMLINK mmfldrM_wpclsQueryIconData(M_MMFolder *somSelf, 1226 SOM_Scope ULONG SOMLINK mmfldrM_wpclsQueryIconData(M_MMFolder *somSelf, 1222 1227 PICONINFO pIconInfo) 1223 1228 { 1224 1229 HMODULE hmod; … … 1240 1245 } 1241 1246 1242 1247 1243 SOM_Scope ULONG SOMLINK mmfldrM_wpclsQueryIconDataN(M_MMFolder *somSelf, 1244 ICONINFO* pIconInfo, 1248 SOM_Scope ULONG SOMLINK mmfldrM_wpclsQueryIconDataN(M_MMFolder *somSelf, 1249 ICONINFO* pIconInfo, 1245 1250 ULONG ulIconIndex) 1246 1251 { 1247 1252 HMODULE hmod;