- Timestamp:
- Dec 30, 2023, 1:21:06 PM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v2.9_Lars/classes/c/c_image/cwimage.c
r130 r138 25 25 * along with this program; see the file COPYING. If not, write to 26 26 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 */ 27 */ 28 28 /* 29 29 * If you need another license for your project/product (commercial, 30 30 * noncommercial, whatever) contact me at 31 * 31 * 32 32 * http://www.os2world.com/cdwriting 33 33 * http://www.geocities.com/SiliconValley/Sector/5785/ … … 36 36 /* 37 37 * This file was generated by the SOM Compiler and Emitter Framework. 38 * Generated using: 38 * Generated using: 39 39 * SOM Emitter emitctm: 2.42 40 40 */ … … 120 120 HBITMAP createNewBitmap ( HBITMAP hbm, 121 121 PBITMAPINFOHEADER2 pBmpInfoHeader2, 122 ULONG ulWidth, 123 ULONG ulHeight, 122 ULONG ulWidth, 123 ULONG ulHeight, 124 124 BOOL* pbQuitEarly); 125 125 … … 129 129 BOOL getStringFromRexxScript(PSZ rexxFile, char* chrResult, ULONG ulSize); 130 130 131 BOOL mmclsCreateTheDefaultTemplate(M_WPObject *somSelf, 131 BOOL mmclsCreateTheDefaultTemplate(M_WPObject *somSelf, 132 132 WPObject* Folder); 133 133 134 134 MRESULT menuInsertMenuSeparator(HWND hwndMenu, HWND hwndSubMenu, SHORT sPosition ); 135 135 136 /* 136 /* 137 137 This Proc creates the small bitmaps for display on a separate thread. 138 138 It's used indirectly used by the lighttable folder when an attempt to … … 151 151 case ACKEY_CREATE_SMALLBITMAP: 152 152 { 153 BOOL bLoaded=FALSE;154 153 HBITMAP hbm; 155 154 PCREATEBMPINFO pCreateBMP=PVOIDFROMMP(mp1); … … 167 166 return (MRESULT) FALSE; 168 167 169 /* 170 V0.2.8, CW 2004/11/01 171 168 /* 169 V0.2.8, CW 2004/11/01 170 172 171 It's possible that a lot of requests are issued to this thread while opening a folder. 173 172 These are qeued and in the meanwhile the user may have closed the folder. … … 181 180 pmrcToRefresh=pCreateBMP->pmrcToRefresh; 182 181 for(;;) { 183 RECTL rectl , rectl2;182 RECTL rectl2; 184 183 if(WinSendMsg(pCreateBMP->hwndCnr, CM_QUERYVIEWPORTRECT, MPFROMP(&rectl2), MPFROM2SHORT(CMA_WORKSPACE, FALSE))) { 185 184 … … 197 196 198 197 _wpLockObject(pCreateBMP->wpObject); 199 198 200 199 /* Check if in the meantime the bitmap was created */ 201 if(!_hBitmapSmall ) {202 /* 200 if(!_hBitmapSmall && _hBitmap) { 201 /* 203 202 FIXME: 204 203 205 204 Not threadsafe!!! 206 205 207 206 Use a private work alike for wpQueryBitmapHandle instead??? 208 209 Check if bitmap data already loaded. Keep the info so we don't discard the bitmap later on. Another 210 function may have requested the bitmap before. During wpQueryBitmapHandle() a normal size bitmap 211 is always created. We don't want to have memory wasted by the big one so it's discarded afterwards. 212 Not perfect, but works at the moment. Will be revamped later with automatic bitmap deletion. */ 213 if(_hBitmap) 214 bLoaded=TRUE; 215 216 if(_wpQueryBitmapHandle(pCreateBMP->wpObject, 217 &hbm, 207 */ 208 209 if(_wpQueryBitmapHandle(pCreateBMP->wpObject, 210 &hbm, 218 211 NULLHANDLE, 219 pCreateBMP->ulWidth, 220 pCreateBMP->ulHeight, 221 0, /* ulFlags*/ 222 0, 212 pCreateBMP->ulWidth, 213 pCreateBMP->ulHeight, 214 0, /* ulFlags*/ 215 0, 223 216 NULLHANDLE)) { 224 217 _hBitmapSmall=hbm; 225 218 _ulSizeSmallBitmap=pCreateBMP->ulHeight; 226 if(!bLoaded) { 227 /* The bitmap wasn't loaded so discard it now, we don't need it any more as we have 228 the small one. */ 229 GpiDeleteBitmap(_hBitmap); 230 _hBitmap=NULLHANDLE; 231 } 219 /* Discard the large bitmap now, we don't need it any more as we have 220 the small one. */ 221 GpiDeleteBitmap(_hBitmap); 222 _hBitmap=NULLHANDLE; 232 223 }/* _wpQueryBitmapHandle() */ 233 224 } … … 235 226 // WinPostMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION)); 236 227 WinSendMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION)); 237 238 _wpUnlockObject(pCreateBMP->wpObject);239 228 break; 240 229 }/* for */ … … 244 233 SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d.\n", 245 234 __FUNCTION__, __FILE__, __LINE__); 246 _wpUnlockObject(pCreateBMP->wpObject); /* If we trapped in wpUnlockObject(), we will have a problem here... */247 235 } END_CATCH; 236 _wpUnlockObject(pCreateBMP->wpObject); 248 237 // WinSendMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION)); 249 238 // _wp_FreeMem(wpObject, (PBYTE)pCreateBMP); … … 262 251 return (MRESULT) FALSE; 263 252 264 TRY_LOUD(BITMAPIH_OBJECT) { 253 TRY_LOUD(BITMAPIH_OBJECT) { 265 254 somThis = MMImageGetData(pCreateBMP->wpObject); 266 255 267 256 /* Check if in the meantime the bitmap was created */ 268 257 if(!_pBmpInfoHeader2) { … … 303 292 HMQ hmq; 304 293 QMSG qmsg; 305 294 306 295 hab=WinInitialize(0); 307 296 if(hab) { … … 348 337 } 349 338 return FALSE; 350 339 351 340 } 352 341 default: … … 430 419 //ulPostCount++; 431 420 //SysWriteToTrapLog(" Have msg %d\n", ulPostCount); 432 421 433 422 /* 434 423 Check for system msgs and dispatch them. … … 476 465 /* 477 466 queue is almost full. The semaphore was posted by the function so 478 dispatch messages faster. 467 dispatch messages faster. 479 468 */ 480 469 int a=0; 481 470 // SysWriteToTrapLog(" --Semaphore posted\n"); 482 while((bQuit=!WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))==FALSE 471 while((bQuit=!WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))==FALSE 483 472 && a < BMP_DEL_UPPER-BMP_DEL_LOWER) { 484 473 // SysWriteToTrapLog(" -- Got message, dispatching it...\n"); … … 560 549 561 550 if(pbmpih2->cbFix==sizeof(BITMAPINFOHEADER2)) { 562 if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 551 if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 563 552 queryResModuleHandle(), hwnd)) 564 553 strcpy(chrTemplate, "%d Pixel"); 565 554 sprintf(fName, chrTemplate, pbmpih2->cx); 566 555 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEWIDTH),fName); 567 556 568 557 sprintf(fName, chrTemplate, pbmpih2->cy); 569 558 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEHEIGHT),fName); 570 559 571 if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 560 if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 572 561 queryResModuleHandle(), hwnd)) 573 strcpy(chrTemplate, "%d Bit"); 562 strcpy(chrTemplate, "%d Bit"); 574 563 sprintf(fName, chrTemplate, pbmpih2->cBitCount); 575 564 WinSetWindowText(WinWindowFromID(hwnd, IDST_COLORDEPTH),fName); … … 578 567 /* We shouldn't get a BITMAPINFOHEADER here but who knows...*/ 579 568 PBITMAPINFOHEADER pbmpih=(PBITMAPINFOHEADER)pbmpih2; 580 if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 569 if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 581 570 queryResModuleHandle(), hwnd)) 582 571 strcpy(chrTemplate, "%d Pixel"); 583 572 sprintf(fName, chrTemplate,pbmpih->cx); 584 573 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEWIDTH),fName); 585 574 586 575 sprintf(fName, chrTemplate, pbmpih->cy); 587 576 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEHEIGHT),fName); 588 577 589 if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 590 queryResModuleHandle(), hwnd)) 578 if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 579 queryResModuleHandle(), hwnd)) 591 580 strcpy(chrTemplate, "%d Bit"); 592 581 sprintf(fName, chrTemplate, pbmpih->cBitCount); 593 582 WinSetWindowText(WinWindowFromID(hwnd, IDST_COLORDEPTH),fName); 594 583 } 595 584 596 585 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEFORMAT),_chrIOProcName); 597 586 } … … 607 596 mp2=MPFROMLONG(LONGFROMMP(mp2)|0x80000);/*AWP_ACTIVATE 0x00080000L*/ 608 597 mr=WinDefDlgProc(hwnd, msg, mp1, mp2); 609 return mr; 598 return mr; 610 599 } 611 600 break; … … 618 607 619 608 mr=WinDefDlgProc(hwnd, msg, mp1, mp2); 620 WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), 609 WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), 621 610 WM_SETFOCUS, MPFROMHWND(hwnd), (MPARAM)TRUE); 622 611 return mr; … … 688 677 /* */ 689 678 /*!!******************************************************/ 690 SOM_Scope ULONG SOMLINK cwimg_cwmmAddImageInformationPage(MMImage *somSelf, 679 SOM_Scope ULONG SOMLINK cwimg_cwmmAddImageInformationPage(MMImage *somSelf, 691 680 HWND hwndNotebook) 692 681 { … … 797 786 /* */ 798 787 /*!!******************************************************/ 799 SOM_Scope HBITMAP SOMLINK cwimg_cwmmQuerySmallBitmapHandle(MMImage *somSelf, 800 ULONG ulSize, 801 PMINIRECORDCORE pmrcToRefresh, 788 SOM_Scope HBITMAP SOMLINK cwimg_cwmmQuerySmallBitmapHandle(MMImage *somSelf, 789 ULONG ulSize, 790 PMINIRECORDCORE pmrcToRefresh, 802 791 HWND hwndCnr) 803 792 { … … 818 807 819 808 if(_bNoIOProcAvailable) 820 return NULLHANDLE; /* No IO-proc for this image format. Don't try again in the future. 809 return NULLHANDLE; /* No IO-proc for this image format. Don't try again in the future. 821 810 This var is set if we trapped during reading. */ 822 811 … … 842 831 } 843 832 844 /* 845 FIXME: use WinIsWindow() here?? 833 /* 834 FIXME: use WinIsWindow() here?? 846 835 */ 847 836 if(!_hBitmapSmall && hwndCreateBMP) { … … 924 913 925 914 /* 926 * SOM_Scope ULONG SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 927 * char** chrString, 928 * ULONG ulSize, 915 * SOM_Scope ULONG SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 916 * char** chrString, 917 * ULONG ulSize, 929 918 * int iWhich) 930 919 */ … … 933 922 * The prototype for cwimg_cwmmQueryImageInfo was replaced by the following prototype: 934 923 */ 935 SOM_Scope ULONG SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 936 char** chrString, 937 ULONG ulSize, 924 SOM_Scope ULONG SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 925 char** chrString, 926 ULONG ulSize, 938 927 long iWhich) 939 928 { 940 PBITMAPINFOHEADER2 pBmpInfoHdr2=NULLHANDLE; 929 PBITMAPINFOHEADER2 pBmpInfoHdr2=NULLHANDLE; 941 930 ULONG ulWidth, ulHeight, ulDepth; 942 931 MMImageData *somThis = MMImageGetData(somSelf); … … 987 976 } 988 977 989 SOM_Scope void SOMLINK cwimg_cwmmRequestBmpDeletion(MMImage *somSelf, 978 SOM_Scope void SOMLINK cwimg_cwmmRequestBmpDeletion(MMImage *somSelf, 990 979 ULONG ulFlags) 991 980 { … … 1013 1002 RECTL rectl2; 1014 1003 PRECORDITEM pri=(PRECORDITEM)(++pui); 1015 1004 1016 1005 /* 1017 1006 V0.2.9 CW 2004/11/12 1018 1007 1019 1008 Check if small bitmaps for icons are currently visible in any container. This is useful if the 1020 1009 user scrolls a folder with a lot of pictures. … … 1026 1015 pui--; 1027 1016 if(WinSendMsg(pri->hwndCnr, CM_QUERYVIEWPORTRECT, MPFROMP(&rectl2), MPFROM2SHORT(CMA_WORKSPACE, FALSE))) { 1028 1017 1029 1018 if(pri->pRecord->ptlIcon.y >= rectl2.yBottom && pri->pRecord->ptlIcon.y <= rectl2.yTop && 1030 1019 pri->pRecord->ptlIcon.x >= rectl2.xLeft && pri->pRecord->ptlIcon.x < rectl2.xRight) 1031 1020 bDeleteBmp=FALSE; 1032 1033 }/* WinSendMsg() */ 1021 1022 }/* WinSendMsg() */ 1034 1023 } 1035 1024 }/* else */ … … 1061 1050 * The prototype for cwimg_wpQueryBitmapHandle was replaced by the following prototype: 1062 1051 */ 1063 SOM_Scope BOOL SOMLINK cwimg_wpQueryBitmapHandle(MMImage *somSelf, 1064 HBITMAP* phBitmap, 1065 HPAL* phPalette, 1066 ULONG ulWidth, 1067 ULONG ulHeight, 1068 ULONG ulFlags, 1069 long lBackgroundColor, 1052 SOM_Scope BOOL SOMLINK cwimg_wpQueryBitmapHandle(MMImage *somSelf, 1053 HBITMAP* phBitmap, 1054 HPAL* phPalette, 1055 ULONG ulWidth, 1056 ULONG ulHeight, 1057 ULONG ulFlags, 1058 long lBackgroundColor, 1070 1059 BOOL* pbQuitEarly) 1071 1060 { … … 1073 1062 char chrName[CCHMAXPATH]; 1074 1063 1075 MMImageData *somThis = MMImageGetData(somSelf); 1064 MMImageData *somThis = MMImageGetData(somSelf); 1076 1065 MMImageMethodDebug("MMImage","cwimg_wpQueryBitmapHandle"); 1077 1066 … … 1091 1080 return FALSE; 1092 1081 1093 1082 1094 1083 TRY_LOUD(QRY_HBM) { 1095 1084 /* Create a new (maybe smaller) bitmap from the normal size bitmap */ 1096 *phBitmap=createNewBitmap ( _hBitmap, (PBITMAPINFOHEADER2) _pBmpInfoHeader2, 1085 *phBitmap=createNewBitmap ( _hBitmap, (PBITMAPINFOHEADER2) _pBmpInfoHeader2, 1097 1086 ulWidth, ulHeight , pbQuitEarly); 1098 1087 } … … 1106 1095 chrName); 1107 1096 } END_CATCH; 1108 1097 1109 1098 if(!*phBitmap) 1110 1099 return FALSE; … … 1124 1113 BOOL bSem; 1125 1114 1126 MMImageData *somThis = MMImageGetData(somSelf); 1115 MMImageData *somThis = MMImageGetData(somSelf); 1127 1116 MMImageMethodDebug("MMImage","cwimg_wpQueryBitmapInfoHeader"); 1128 1117 … … 1193 1182 break; 1194 1183 1195 bGotHeader=getBmpInfoHeader( (PBITMAPINFOHEADER2) pByte, chrName, _chrIOProcName, 1184 bGotHeader=getBmpInfoHeader( (PBITMAPINFOHEADER2) pByte, chrName, _chrIOProcName, 1196 1185 sizeof(_chrIOProcName), &_bNoIOProcAvailable); 1197 1186 break; … … 1253 1242 * The prototype for cwimg_wpQueryBitmapData was replaced by the following prototype: 1254 1243 */ 1255 SOM_Scope PBYTE SOMLINK cwimg_wpQueryBitmapData(MMImage *somSelf, 1244 SOM_Scope PBYTE SOMLINK cwimg_wpQueryBitmapData(MMImage *somSelf, 1256 1245 ULONG* pulSize) 1257 1246 { … … 1261 1250 NOT_IMPLEMENTED 1262 1251 1263 return (MMImage_parent_WPImageFile_wpQueryBitmapData(somSelf, 1252 return (MMImage_parent_WPImageFile_wpQueryBitmapData(somSelf, 1264 1253 pulSize)); 1265 1254 } … … 1268 1257 * The prototype for cwimg_wpSetBitmapData was replaced by the following prototype: 1269 1258 */ 1270 SOM_Scope BOOL SOMLINK cwimg_wpSetBitmapData(MMImage *somSelf, 1271 PBYTE pBitmapData, 1259 SOM_Scope BOOL SOMLINK cwimg_wpSetBitmapData(MMImage *somSelf, 1260 PBYTE pBitmapData, 1272 1261 ULONG ulSize) 1273 1262 { … … 1284 1273 #endif 1285 1274 1286 return (MMImage_parent_WPImageFile_wpSetBitmapData(somSelf, 1287 pBitmapData, 1275 return (MMImage_parent_WPImageFile_wpSetBitmapData(somSelf, 1276 pBitmapData, 1288 1277 ulSize)); 1289 1278 } … … 1298 1287 BOOL bGotHeader=FALSE; 1299 1288 1300 MMImageData *somThis = MMImageGetData(somSelf); 1289 MMImageData *somThis = MMImageGetData(somSelf); 1301 1290 MMImageMethodDebug("MMImage","cwimg_wpReadImageFile"); 1302 1291 … … 1327 1316 chrName); 1328 1317 }END_CATCH; 1329 1318 1330 1319 if(!bGotHeader) 1331 1320 return FALSE; … … 1347 1336 _bNoIOProcAvailable=TRUE; 1348 1337 } END_CATCH; 1349 1338 1350 1339 if(!_hBitmap) { 1351 1340 return FALSE; 1352 1341 } 1353 1342 1354 1343 return TRUE; 1355 1344 } … … 1413 1402 HWND hwndSubMenu; 1414 1403 MENUITEM mi; 1415 1404 1416 1405 if(g_pmmFormatInfoArray) 1417 1406 free(g_pmmFormatInfoArray); … … 1421 1410 '\0', 1422 1411 sizeof(MMFORMATINFO) ); 1423 1412 1424 1413 mmFormatInfo.ulMediaType |= MMIO_MEDIATYPE_IMAGE; 1425 mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED; 1414 mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED; 1426 1415 ulReturnCode = mmioQueryFormatCount ( &mmFormatInfo, 1427 1416 &lNumIOProcs, 1428 1417 0, 1429 1418 0 ); 1430 1419 1431 1420 if( ulReturnCode != MMIO_SUCCESS ) 1432 1421 { … … 1444 1433 return FALSE; 1445 1434 } 1446 1435 1447 1436 /* 1448 1437 * call mmioGetFormats to get info on the formats supported. … … 1463 1452 return FALSE; 1464 1453 } 1465 1454 1466 1455 if( lFormatsRead != lNumIOProcs ) 1467 1456 { … … 1479 1468 hwndSubMenu=WinCreateWindow(hwndMenu,WC_MENU,"",0, 1480 1469 0,0,0,0, 1481 hwndMenu,//Owner. If set, this window 1470 hwndMenu,//Owner. If set, this window 1482 1471 //is destroyed if owner is destroyed 1483 1472 HWND_TOP, … … 1488 1477 mi.afStyle=MIS_TEXT;//|MIS_SUBMENU; 1489 1478 mi.id=ID_MENU_CONVERT; 1490 mi.afAttribute=NULLHANDLE; 1479 mi.afAttribute=NULLHANDLE; 1491 1480 mi.hwndSubMenu=NULLHANDLE;//hwndSubMenu; 1492 1481 mi.hItem=NULLHANDLE; … … 1502 1491 { 1503 1492 mmioGetFormatName(pmmFormatInfoArray, szBuffer, &lBytesRead, 0L, 0L); 1504 1493 1505 1494 /* Insert NULL string terminator */ 1506 1495 *( szBuffer + lBytesRead ) = (CHAR)NULL; … … 1520 1509 mi.afStyle=MIS_TEXT|MIS_SUBMENU; 1521 1510 mi.id=ID_ITEM_FIRSTCONVERT+index;/* Create menu id */ 1522 mi.afAttribute=NULLHANDLE; 1511 mi.afAttribute=NULLHANDLE; 1523 1512 mi.hwndSubMenu=NULLHANDLE;//hwndSubMenu; 1524 1513 mi.hItem=NULLHANDLE; … … 1528 1517 /* 1529 1518 * advance to next entry in mmFormatInfo array 1530 */ 1519 */ 1531 1520 pmmFormatInfoArray++; 1532 1521 } … … 1564 1553 * The prototype for cwimg_wpModifyPopupMenu was replaced by the following prototype: 1565 1554 */ 1566 SOM_Scope BOOL SOMLINK cwimg_wpModifyPopupMenu(MMImage *somSelf, 1567 HWND hwndMenu, 1568 HWND hwndCnr, 1555 SOM_Scope BOOL SOMLINK cwimg_wpModifyPopupMenu(MMImage *somSelf, 1556 HWND hwndMenu, 1557 HWND hwndCnr, 1569 1558 ULONG iPosition) 1570 1559 { … … 1583 1572 if(!getMessage(text, IDSTR_MENU_IMAGEINFO, sizeof(text), queryResModuleHandle(), hwndMenu)) 1584 1573 strcpy(text, "Image information: %d x %d x %d"); 1585 1574 1586 1575 sprintf(menuText, text, _ulWidth, _ulHeight, _ulDepth);//create menuitem 1587 1576 1588 1577 //insert size menuitem in popupmenu 1589 1578 … … 1599 1588 insertIOProcMenuItems( hwndMenu ); 1600 1589 menuInsertMenuSeparator(hwndMenu, NULLHANDLE, MIT_END ); 1601 1590 1602 1591 }/* TRY_LOUD */ 1603 1592 CATCH(IMAGE_INSERTPOPUPMENU) … … 1607 1596 } END_CATCH; 1608 1597 1609 return (MMImage_parent_WPImageFile_wpModifyPopupMenu(somSelf, 1610 hwndMenu, 1611 hwndCnr, 1598 return (MMImage_parent_WPImageFile_wpModifyPopupMenu(somSelf, 1599 hwndMenu, 1600 hwndCnr, 1612 1601 iPosition)); 1613 1602 } … … 1617 1606 * The prototype for cwimg_wpMenuItemSelected was replaced by the following prototype: 1618 1607 */ 1619 SOM_Scope BOOL SOMLINK cwimg_wpMenuItemSelected(MMImage *somSelf, 1620 HWND hwndFrame, 1608 SOM_Scope BOOL SOMLINK cwimg_wpMenuItemSelected(MMImage *somSelf, 1609 HWND hwndFrame, 1621 1610 ULONG ulMenuId) 1622 1611 { … … 1631 1620 ULONG ulSize; 1632 1621 ULONG ulRc; 1633 1622 1634 1623 PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "imageconverter", "", chrEditor, 1635 1624 sizeof(chrEditor)); … … 1659 1648 } 1660 1649 1661 return (MMImage_parent_WPImageFile_wpMenuItemSelected(somSelf, 1662 hwndFrame, 1650 return (MMImage_parent_WPImageFile_wpMenuItemSelected(somSelf, 1651 hwndFrame, 1663 1652 ulMenuId)); 1664 1653 } … … 1667 1656 * The prototype for cwimg_wpOpen was replaced by the following prototype: 1668 1657 */ 1669 SOM_Scope HWND SOMLINK cwimg_wpOpen(MMImage *somSelf, HWND hwndCnr, 1658 SOM_Scope HWND SOMLINK cwimg_wpOpen(MMImage *somSelf, HWND hwndCnr, 1670 1659 ULONG ulView, ULONG param) 1671 1660 { … … 1711 1700 } 1712 1701 1713 return (MMImage_parent_WPImageFile_wpOpen(somSelf, hwndCnr, 1702 return (MMImage_parent_WPImageFile_wpOpen(somSelf, hwndCnr, 1714 1703 ulView, param)); 1715 1704 } … … 1719 1708 * The prototype for cwimg_wpAddSettingsPages was replaced by the following prototype: 1720 1709 */ 1721 SOM_Scope BOOL SOMLINK cwimg_wpAddSettingsPages(MMImage *somSelf, 1710 SOM_Scope BOOL SOMLINK cwimg_wpAddSettingsPages(MMImage *somSelf, 1722 1711 HWND hwndNotebook) 1723 1712 { … … 1726 1715 MMImageMethodDebug("MMImage","cwimg_wpAddSettingsPages"); 1727 1716 1728 rc=(MMImage_parent_WPImageFile_wpAddSettingsPages(somSelf, 1717 rc=(MMImage_parent_WPImageFile_wpAddSettingsPages(somSelf, 1729 1718 hwndNotebook)); 1730 1719 return rc | (_cwmmAddImageInformationPage(somSelf, hwndNotebook)); … … 1735 1724 * The prototype for cwimg_wpQueryDetailsData was replaced by the following prototype: 1736 1725 */ 1737 SOM_Scope ULONG SOMLINK cwimg_wpQueryDetailsData(MMImage *somSelf, 1738 PVOID* ppDetailsData, 1726 SOM_Scope ULONG SOMLINK cwimg_wpQueryDetailsData(MMImage *somSelf, 1727 PVOID* ppDetailsData, 1739 1728 PULONG pcp) 1740 1729 { … … 1746 1735 1747 1736 /* Fill parent info */ 1748 rcParent=(MMImage_parent_WPImageFile_wpQueryDetailsData(somSelf, 1749 ppDetailsData, 1737 rcParent=(MMImage_parent_WPImageFile_wpQueryDetailsData(somSelf, 1738 ppDetailsData, 1750 1739 pcp)); 1751 1740 … … 1754 1743 { 1755 1744 ULONG ulWidth, ulHeight, ulDepth; 1756 1757 PBITMAPINFOHEADER2 pBmpInfoHeader2=NULLHANDLE; 1745 1746 PBITMAPINFOHEADER2 pBmpInfoHeader2=NULLHANDLE; 1758 1747 1759 1748 #if 0 … … 1761 1750 is on CD is done in wpRestore() */ 1762 1751 pBmpInfoHeader2=(PBITMAPINFOHEADER2) _wpQueryBitmapInfoHeader(somSelf); 1763 #endif 1752 #endif 1764 1753 1765 1754 pBmpInfoHeader2=(PBITMAPINFOHEADER2)_pBmpInfoHeader2; … … 1785 1774 ulDepth=_ulDepth; 1786 1775 } 1787 /* Fill the structure with the info to be displayed */ 1788 pImageDetails=(PIMAGEDETAILS)*ppDetailsData; 1776 /* Fill the structure with the info to be displayed */ 1777 pImageDetails=(PIMAGEDETAILS)*ppDetailsData; 1789 1778 pImageDetails->ulWidth=ulWidth; 1790 1779 pImageDetails->ulHeight=ulHeight; 1791 1780 pImageDetails->ulDepth=ulDepth; 1792 1781 pImageDetails->pszFormat=_chrIOProcName; 1793 1794 *ppDetailsData=((PBYTE) (*ppDetailsData))+sizeof(*pImageDetails); 1782 1783 *ppDetailsData=((PBYTE) (*ppDetailsData))+sizeof(*pImageDetails); 1795 1784 } 1796 1785 else … … 1806 1795 * The prototype for cwimg_wpRestoreState was replaced by the following prototype: 1807 1796 */ 1808 SOM_Scope BOOL SOMLINK cwimg_wpRestoreState(MMImage *somSelf, 1797 SOM_Scope BOOL SOMLINK cwimg_wpRestoreState(MMImage *somSelf, 1809 1798 ULONG ulReserved) 1810 1799 { … … 1813 1802 MMImageData *somThis = MMImageGetData(somSelf); 1814 1803 MMImageMethodDebug("MMImage","cwimg_wpRestoreState"); 1815 1804 1816 1805 _bUseNewClsFeatures=TRUE; 1817 1806 1818 1807 if(cwObjectIsOnCD(somSelf)) { 1819 1808 /* The object is on CD. Check if we should use the new class features */ … … 1827 1816 the filename is unknown). Querying the image data in wpObjectReady() is to late because that method is called after 1828 1817 wpQueryDetailsData(). In wpObjectReady the image header will be read in. */ 1829 1818 1830 1819 /* Query the image info */ 1831 1820 if(!_wpRestoreLong(somSelf, "CWImage", KEY_FILESIZE, &_ulFileSize)) … … 1843 1832 // _wpQueryBitmapInfoHeader(somSelf); 1844 1833 1845 return (MMImage_parent_WPImageFile_wpRestoreState(somSelf, 1834 return (MMImage_parent_WPImageFile_wpRestoreState(somSelf, 1846 1835 ulReserved)); 1847 1836 } … … 1870 1859 1871 1860 /* Refresh */ 1872 bufferSize=sizeof(buffer); 1861 bufferSize=sizeof(buffer); 1873 1862 if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMREFRESH, buffer,&bufferSize)) 1874 1863 { 1875 1864 _cwmmFreeBitmaps(somSelf); 1876 1865 #if 0 1877 _cwmmQuerySmallBitmapHandle(somSelf, 1878 0, 1879 NULLHANDLE, 1866 _cwmmQuerySmallBitmapHandle(somSelf, 1867 0, 1868 NULLHANDLE, 1880 1869 0); 1881 1870 #endif … … 1883 1872 // _wpCnrRefreshDetails(somSelf); 1884 1873 } 1885 1874 1886 1875 return (MMImage_parent_WPImageFile_wpSetup(somSelf, pszSetupString)); 1887 1876 } 1888 1877 1889 1878 1890 SOM_Scope void SOMLINK cwimg_wpObjectReady(MMImage *somSelf, 1879 SOM_Scope void SOMLINK cwimg_wpObjectReady(MMImage *somSelf, 1891 1880 ULONG ulCode, WPObject* refObject) 1892 { 1881 { 1893 1882 PCREATEBMPINFO pCreateBMP; 1894 1883 ULONG ulError; 1895 1884 MMImageData *somThis = MMImageGetData(somSelf); 1896 1885 MMImageMethodDebug("MMImage","cwimg_wpObjectReady"); 1897 1898 MMImage_parent_WPImageFile_wpObjectReady(somSelf, ulCode, 1886 1887 MMImage_parent_WPImageFile_wpObjectReady(somSelf, ulCode, 1899 1888 refObject); 1900 1889 /* Get image info asynchronous to replace cached image size read in from EA which … … 1906 1895 /* Only the object pointer is used */ 1907 1896 pCreateBMP->wpObject=somSelf; 1908 1909 // WinPostMsg(hwndCreateBMP, WM_APPTERMINATENOTIFY,MPFROMP(pCreateBMP), MPFROM2SHORT(0, ACKEY_QUERY_BITMAPINFO)); 1897 1898 // WinPostMsg(hwndCreateBMP, WM_APPTERMINATENOTIFY,MPFROMP(pCreateBMP), MPFROM2SHORT(0, ACKEY_QUERY_BITMAPINFO)); 1910 1899 } 1911 1900 #endif … … 1927 1916 '\0', 1928 1917 sizeof(MMFORMATINFO) ); 1929 1918 1930 1919 mmFormatInfo.ulMediaType |= MMIO_MEDIATYPE_IMAGE; 1931 mmFormatInfo.ulFlags|=MMIO_CANREADTRANSLATED;/* Read !!!*/ 1920 mmFormatInfo.ulFlags|=MMIO_CANREADTRANSLATED;/* Read !!!*/ 1932 1921 ulReturnCode = mmioQueryFormatCount ( &mmFormatInfo, 1933 1922 &lNumIOProcs, 1934 1923 0, 1935 1924 0 ); 1936 1925 1937 1926 if( ulReturnCode != MMIO_SUCCESS ) 1938 1927 { … … 1955 1944 return FALSE; 1956 1945 } 1957 1946 1958 1947 /* 1959 1948 * call mmioGetFormats to get info on the formats supported. … … 1973 1962 return FALSE; 1974 1963 } 1975 1964 1976 1965 if( lFormatsRead != lNumIOProcs ) 1977 1966 { … … 2005 1994 // HlpWriteToTrapLog("Known Extension: %s\n", chrMMImageKnownExt); 2006 1995 // HlpWriteToTrapLog("Extension: %s\n", chrMMImageExt); 2007 } 1996 } 2008 1997 /* 2009 1998 * advance to next entry in mmFormatInfo array 2010 */ 1999 */ 2011 2000 pmmFormatInfoArray++; 2012 2001 } … … 2036 2025 if(_pBmpInfoHeader2) { 2037 2026 if(((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cbFix==sizeof(BITMAPINFOHEADER2)) { 2038 _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cx); 2027 _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cx); 2039 2028 _wpSaveLong(somSelf, "CWImage", KEY_HEIGHT, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cy); 2040 2029 _wpSaveLong(somSelf, "CWImage", KEY_DEPTH, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cBitCount); … … 2043 2032 PBITMAPINFOHEADER pBmpInfoHeader=(PBITMAPINFOHEADER)_pBmpInfoHeader2; 2044 2033 2045 _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, pBmpInfoHeader->cx); 2034 _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, pBmpInfoHeader->cx); 2046 2035 _wpSaveLong(somSelf, "CWImage", KEY_HEIGHT, pBmpInfoHeader->cy); 2047 2036 _wpSaveLong(somSelf, "CWImage", KEY_DEPTH, pBmpInfoHeader->cBitCount); … … 2052 2041 2053 2042 #if 0 2054 SOM_Scope BOOL SOMLINK cwimg_wpFormatDragItem(MMImage *somSelf, 2043 SOM_Scope BOOL SOMLINK cwimg_wpFormatDragItem(MMImage *somSelf, 2055 2044 PDRAGITEM pdrgItem) 2056 2045 { … … 2060 2049 MMImageMethodDebug("MMImage","cwimg_wpFormatDragItem"); 2061 2050 2062 rc= (MMImage_parent_WPImageFile_wpFormatDragItem(somSelf, 2051 rc= (MMImage_parent_WPImageFile_wpFormatDragItem(somSelf, 2063 2052 pdrgItem)); 2064 2053 DosBeep(500,10); … … 2080 2069 If the folder is closed it's likely the bitmaps may be obsolete. A check for USAGE_RECORD items 2081 2070 will be done on another thread. 2082 2071 2083 2072 wpDeleteFromObjUseList() seems to be the more natural place to do this but the method is not called 2084 2073 when an object is removed from a container. Also wpCnrRemoveObject() doesn't work because the WPS seems … … 2089 2078 2090 2079 */ 2091 if(_hBitmap || _hBitmapSmall) 2080 if(_hBitmap || _hBitmapSmall) 2092 2081 sendDeleteBMPMsg(somSelf); 2093 2082 … … 2126 2115 /* Now check installed IO procs for other exts and add them to the filter list */ 2127 2116 _getMissingExtFromImageIOProc(); 2128 bGotImgExt=TRUE; 2117 bGotImgExt=TRUE; 2129 2118 } 2130 2119 … … 2134 2123 globalHab=WinQueryAnchorBlock(HWND_DESKTOP); 2135 2124 2136 if(!getMessage(chrHelpLibrary, IDSTR_HELPLIBRARY, sizeof(chrHelpLibrary), 2125 if(!getMessage(chrHelpLibrary, IDSTR_HELPLIBRARY, sizeof(chrHelpLibrary), 2137 2126 queryModuleHandle(), HWND_DESKTOP)) 2138 2127 strcpy(chrHelpLibrary,"MMPARTS.HLP"); … … 2152 2141 { 2153 2142 memset((PCH)pCfi,0,sizeof(CLASSFIELDINFO)); 2154 2143 2155 2144 pCfi->cb=sizeof(CLASSFIELDINFO); 2156 2145 pCfi->flData=CFA_LEFT|CFA_SEPARATOR|CFA_FIREADONLY; … … 2159 2148 pCfi->pTitleData=(PVOID)pszImageColTitles[i]; 2160 2149 pCfi->flCompare=COMPARE_SUPPORTED|SORTBY_SUPPORTED; 2161 2150 2162 2151 switch(i) 2163 2152 { … … 2191 2180 }/* switch(i) */ 2192 2181 }/* for() */ 2193 cfiImageFieldInfo[NUM_IMAGE_DETAILS_FIELDS].pNextFieldInfo=NULL; 2182 cfiImageFieldInfo[NUM_IMAGE_DETAILS_FIELDS].pNextFieldInfo=NULL; 2194 2183 if(!hwndCreateBMP) 2195 2184 _beginthread(createBMPThreadFunc,NULL,8192*20, NULLHANDLE); //Fehlerbehandlung fehlt … … 2223 2212 { 2224 2213 ULONG ulHowMatched=1; 2225 2214 2226 2215 DosBeep(5000, 1000); 2227 2216 /* Template found. Now query associated program */ … … 2230 2219 DosBeep(500, 1000); 2231 2220 } 2232 #endif 2221 #endif 2233 2222 /* Create default templates. We do it here because we need an object to query the associated 2234 2223 program (if any) when the system asks for the default view. */ … … 2252 2241 '\0', 2253 2242 sizeof(MMFORMATINFO) ); 2254 2243 2255 2244 mmFormatInfo.ulMediaType |= MMIO_MEDIATYPE_IMAGE; 2256 mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED; 2245 mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED; 2257 2246 ulReturnCode = mmioQueryFormatCount ( &mmFormatInfo, 2258 2247 &lNumIOProcs, 2259 2248 0, 2260 2249 0 ); 2261 2250 2262 2251 if( ulReturnCode != MMIO_SUCCESS ) 2263 2252 { … … 2280 2269 return FALSE; 2281 2270 } 2282 2271 2283 2272 /* 2284 2273 * call mmioGetFormats to get info on the formats supported. … … 2298 2287 return FALSE; 2299 2288 } 2300 2289 2301 2290 if( lFormatsRead != lNumIOProcs ) 2302 2291 { … … 2314 2303 { 2315 2304 mmioGetFormatName(pmmFormatInfoArray, szBuffer, &lBytesRead, 0L, 0L); 2316 2305 2317 2306 /* Insert NULL string terminator */ 2318 2307 *( szBuffer + lBytesRead ) = (CHAR)NULL; … … 2320 2309 /* Compressed TIF is not supported because the Warp 4 IO-Procs are 2321 2310 broken. */ 2322 //HlpWriteToTrapLog("--------- Ext: %s, IO-Proc: %s, Name: %s\n", 2311 //HlpWriteToTrapLog("--------- Ext: %s, IO-Proc: %s, Name: %s\n", 2323 2312 //chrExt, pmmFormatInfoArray->szDefaultFormatExt, 2324 2313 // szBuffer); … … 2336 2325 /* 2337 2326 * advance to next entry in mmFormatInfo array 2338 */ 2327 */ 2339 2328 pmmFormatInfoArray++; 2340 2329 } … … 2344 2333 } 2345 2334 2346 SOM_Scope BOOL SOMLINK cwimgM_wpclsCreateDefaultTemplates(M_MMImage *somSelf, 2335 SOM_Scope BOOL SOMLINK cwimgM_wpclsCreateDefaultTemplates(M_MMImage *somSelf, 2347 2336 WPObject* Folder) 2348 2337 { … … 2354 2343 /* The FOURCC of the JPEG-IO proc is JPEG so we have to create that template 2355 2344 in the JPG class. */ 2356 2345 2357 2346 if(checkImageIOProc( _wpclsQueryInstanceFilter(somSelf))) { 2358 2347 // WPFolder* wpFolder; … … 2400 2389 */ 2401 2390 2402 SOM_Scope ULONG SOMLINK cwimgM_wpclsQueryIconData(M_MMImage *somSelf, 2391 SOM_Scope ULONG SOMLINK cwimgM_wpclsQueryIconData(M_MMImage *somSelf, 2403 2392 PICONINFO pIconInfo) 2404 2393 { … … 2424 2413 * The prototype for cwimgM_wpclsQueryDetailsInfo was replaced by the following prototype: 2425 2414 */ 2426 SOM_Scope ULONG SOMLINK cwimgM_wpclsQueryDetailsInfo(M_MMImage *somSelf, 2427 PCLASSFIELDINFO* ppClassFieldInfo, 2415 SOM_Scope ULONG SOMLINK cwimgM_wpclsQueryDetailsInfo(M_MMImage *somSelf, 2416 PCLASSFIELDINFO* ppClassFieldInfo, 2428 2417 PULONG pSize) 2429 2418 { … … 2435 2424 M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsQueryDetailsInfo"); 2436 2425 2437 cParentColumns= (M_MMImage_parent_M_WPImageFile_wpclsQueryDetailsInfo(somSelf, 2438 ppClassFieldInfo, 2426 cParentColumns= (M_MMImage_parent_M_WPImageFile_wpclsQueryDetailsInfo(somSelf, 2427 ppClassFieldInfo, 2439 2428 pSize)); 2440 2429 if(pSize)
Note:
See TracChangeset
for help on using the changeset viewer.