Changeset 141 for trunk/classes/c/c_image/cwimage.c
- Timestamp:
- Jan 21, 2024, 10:15:49 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/classes/c/c_image/cwimage.c
r108 r141 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 … … 160 160 if(!pCreateBMP) 161 161 return (MRESULT) FALSE; 162 162 163 #ifdef DEBUG 163 164 SysWriteToTrapLog("In %s, line %d\n", __FUNCTION__, __LINE__); … … 167 168 return (MRESULT) FALSE; 168 169 169 /* 170 V0.2.8, CW 2004/11/01 171 170 /* 171 V0.2.8, CW 2004/11/01 172 172 173 It's possible that a lot of requests are issued to this thread while opening a folder. 173 174 These are qeued and in the meanwhile the user may have closed the folder. … … 181 182 pmrcToRefresh=pCreateBMP->pmrcToRefresh; 182 183 for(;;) { 183 RECTL rectl , rectl2;184 RECTL rectl2; 184 185 if(WinSendMsg(pCreateBMP->hwndCnr, CM_QUERYVIEWPORTRECT, MPFROMP(&rectl2), MPFROM2SHORT(CMA_WORKSPACE, FALSE))) { 185 186 … … 197 198 198 199 _wpLockObject(pCreateBMP->wpObject); 199 200 200 201 /* Check if in the meantime the bitmap was created */ 201 202 if(!_hBitmapSmall) { 202 /* 203 /* 203 204 FIXME: 204 205 205 206 Not threadsafe!!! 206 207 207 208 Use a private work alike for wpQueryBitmapHandle instead??? 208 209 … … 214 215 bLoaded=TRUE; 215 216 216 if(_wpQueryBitmapHandle(pCreateBMP->wpObject, 217 &hbm, 217 if(_wpQueryBitmapHandle(pCreateBMP->wpObject, 218 &hbm, 218 219 NULLHANDLE, 219 pCreateBMP->ulWidth, 220 pCreateBMP->ulHeight, 221 0, /* ulFlags*/ 222 0, 220 pCreateBMP->ulWidth, 221 pCreateBMP->ulHeight, 222 0, /* ulFlags*/ 223 0, 223 224 NULLHANDLE)) { 224 225 _hBitmapSmall=hbm; 225 226 _ulSizeSmallBitmap=pCreateBMP->ulHeight; 226 227 if(!bLoaded) { 227 /* The bitmap wasn't loaded so discard itnow, we don't need it any more as we have228 229 230 228 /* Discard the large bitmap now, we don't need it any more as we have 229 the small one. */ 230 GpiDeleteBitmap(_hBitmap); 231 _hBitmap=NULLHANDLE; 231 232 } 232 233 }/* _wpQueryBitmapHandle() */ … … 235 236 // WinPostMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION)); 236 237 WinSendMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION)); 237 238 _wpUnlockObject(pCreateBMP->wpObject);239 238 break; 240 239 }/* for */ 241 240 }/* Try */ 242 CATCH(BITMAP_OBJECT) 243 { 241 CATCH(BITMAP_OBJECT) { 244 242 SysWriteToTrapLog("\nTrap occured in %s, file %s, around line %d.\n", 245 243 __FUNCTION__, __FILE__, __LINE__); 246 _wpUnlockObject(pCreateBMP->wpObject); /* If we trapped in wpUnlockObject(), we will have a problem here... */247 } END_CATCH;248 249 250 251 252 244 } END_CATCH; 245 _wpUnlockObject(pCreateBMP->wpObject); 246 // WinSendMsg(pCreateBMP->hwndCnr, CM_INVALIDATERECORD,MPFROMP(&pmrcToRefresh),MPFROM2SHORT(1,CMA_NOREPOSITION)); 247 // _wp_FreeMem(wpObject, (PBYTE)pCreateBMP); 248 free((PBYTE)pCreateBMP); 249 250 return (MRESULT) FALSE; 253 251 }/* case ACKEY_CREATE_SMALLBITMAP */ 254 252 case ACKEY_QUERY_BITMAPINFO: … … 262 260 return (MRESULT) FALSE; 263 261 264 TRY_LOUD(BITMAPIH_OBJECT) { 262 TRY_LOUD(BITMAPIH_OBJECT) { 265 263 somThis = MMImageGetData(pCreateBMP->wpObject); 266 264 267 265 /* Check if in the meantime the bitmap was created */ 268 266 if(!_pBmpInfoHeader2) { … … 303 301 HMQ hmq; 304 302 QMSG qmsg; 305 303 306 304 hab=WinInitialize(0); 307 305 if(hab) { … … 348 346 } 349 347 return FALSE; 350 348 351 349 } 352 350 default: … … 430 428 //ulPostCount++; 431 429 //SysWriteToTrapLog(" Have msg %d\n", ulPostCount); 432 430 433 431 /* 434 432 Check for system msgs and dispatch them. … … 476 474 /* 477 475 queue is almost full. The semaphore was posted by the function so 478 dispatch messages faster. 476 dispatch messages faster. 479 477 */ 480 478 int a=0; 481 479 // SysWriteToTrapLog(" --Semaphore posted\n"); 482 while((bQuit=!WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))==FALSE 480 while((bQuit=!WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))==FALSE 483 481 && a < BMP_DEL_UPPER-BMP_DEL_LOWER) { 484 482 // SysWriteToTrapLog(" -- Got message, dispatching it...\n"); … … 560 558 561 559 if(pbmpih2->cbFix==sizeof(BITMAPINFOHEADER2)) { 562 if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 560 if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 563 561 queryResModuleHandle(), hwnd)) 564 562 strcpy(chrTemplate, "%d Pixel"); 565 563 sprintf(fName, chrTemplate, pbmpih2->cx); 566 564 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEWIDTH),fName); 567 565 568 566 sprintf(fName, chrTemplate, pbmpih2->cy); 569 567 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEHEIGHT),fName); 570 568 571 if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 569 if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 572 570 queryResModuleHandle(), hwnd)) 573 strcpy(chrTemplate, "%d Bit"); 571 strcpy(chrTemplate, "%d Bit"); 574 572 sprintf(fName, chrTemplate, pbmpih2->cBitCount); 575 573 WinSetWindowText(WinWindowFromID(hwnd, IDST_COLORDEPTH),fName); … … 578 576 /* We shouldn't get a BITMAPINFOHEADER here but who knows...*/ 579 577 PBITMAPINFOHEADER pbmpih=(PBITMAPINFOHEADER)pbmpih2; 580 if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 578 if(!getMessage(chrTemplate, IDSTR_SPRINTFPIXEL, sizeof(chrTemplate), 581 579 queryResModuleHandle(), hwnd)) 582 580 strcpy(chrTemplate, "%d Pixel"); 583 581 sprintf(fName, chrTemplate,pbmpih->cx); 584 582 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEWIDTH),fName); 585 583 586 584 sprintf(fName, chrTemplate, pbmpih->cy); 587 585 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEHEIGHT),fName); 588 586 589 if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 590 queryResModuleHandle(), hwnd)) 587 if(!getMessage(chrTemplate, IDSTR_SPRINTFBIT, sizeof(chrTemplate), 588 queryResModuleHandle(), hwnd)) 591 589 strcpy(chrTemplate, "%d Bit"); 592 590 sprintf(fName, chrTemplate, pbmpih->cBitCount); 593 591 WinSetWindowText(WinWindowFromID(hwnd, IDST_COLORDEPTH),fName); 594 592 } 595 593 596 594 WinSetWindowText(WinWindowFromID(hwnd, IDST_IMAGEFORMAT),_chrIOProcName); 597 595 } … … 607 605 mp2=MPFROMLONG(LONGFROMMP(mp2)|0x80000);/*AWP_ACTIVATE 0x00080000L*/ 608 606 mr=WinDefDlgProc(hwnd, msg, mp1, mp2); 609 return mr; 607 return mr; 610 608 } 611 609 break; … … 618 616 619 617 mr=WinDefDlgProc(hwnd, msg, mp1, mp2); 620 WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), 618 WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), 621 619 WM_SETFOCUS, MPFROMHWND(hwnd), (MPARAM)TRUE); 622 620 return mr; … … 688 686 /* */ 689 687 /*!!******************************************************/ 690 SOM_Scope ULONG SOMLINK cwimg_cwmmAddImageInformationPage(MMImage *somSelf, 688 SOM_Scope ULONG SOMLINK cwimg_cwmmAddImageInformationPage(MMImage *somSelf, 691 689 HWND hwndNotebook) 692 690 { … … 797 795 /* */ 798 796 /*!!******************************************************/ 799 SOM_Scope HBITMAP SOMLINK cwimg_cwmmQuerySmallBitmapHandle(MMImage *somSelf, 800 ULONG ulSize, 801 PMINIRECORDCORE pmrcToRefresh, 797 SOM_Scope HBITMAP SOMLINK cwimg_cwmmQuerySmallBitmapHandle(MMImage *somSelf, 798 ULONG ulSize, 799 PMINIRECORDCORE pmrcToRefresh, 802 800 HWND hwndCnr) 803 801 { … … 818 816 819 817 if(_bNoIOProcAvailable) 820 return NULLHANDLE; /* No IO-proc for this image format. Don't try again in the future. 818 return NULLHANDLE; /* No IO-proc for this image format. Don't try again in the future. 821 819 This var is set if we trapped during reading. */ 822 820 … … 842 840 } 843 841 844 /* 845 FIXME: use WinIsWindow() here?? 842 /* 843 FIXME: use WinIsWindow() here?? 846 844 */ 847 845 if(!_hBitmapSmall && hwndCreateBMP) { … … 866 864 867 865 WinPostMsg(hwndCreateBMP, WM_APPTERMINATENOTIFY,MPFROMP(pCreateBMP), MPFROM2SHORT(0, ACKEY_CREATE_SMALLBITMAP)); 868 free(pCreateBMP);869 866 return NULLHANDLE; 870 867 } … … 924 921 925 922 /* 926 * SOM_Scope ULONG SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 927 * char** chrString, 928 * ULONG ulSize, 923 * SOM_Scope ULONG SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 924 * char** chrString, 925 * ULONG ulSize, 929 926 * int iWhich) 930 927 */ … … 933 930 * The prototype for cwimg_cwmmQueryImageInfo was replaced by the following prototype: 934 931 */ 935 SOM_Scope ULONG SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 936 char** chrString, 937 ULONG ulSize, 932 SOM_Scope ULONG SOMLINK cwimg_cwmmQueryImageInfo(MMImage *somSelf, 933 char** chrString, 934 ULONG ulSize, 938 935 long iWhich) 939 936 { 940 PBITMAPINFOHEADER2 pBmpInfoHdr2=NULLHANDLE; 937 PBITMAPINFOHEADER2 pBmpInfoHdr2=NULLHANDLE; 941 938 ULONG ulWidth, ulHeight, ulDepth; 942 939 MMImageData *somThis = MMImageGetData(somSelf); … … 987 984 } 988 985 989 SOM_Scope void SOMLINK cwimg_cwmmRequestBmpDeletion(MMImage *somSelf, 986 SOM_Scope void SOMLINK cwimg_cwmmRequestBmpDeletion(MMImage *somSelf, 990 987 ULONG ulFlags) 991 988 { … … 1013 1010 RECTL rectl2; 1014 1011 PRECORDITEM pri=(PRECORDITEM)(++pui); 1015 1012 1016 1013 /* 1017 1014 V0.2.9 CW 2004/11/12 1018 1015 1019 1016 Check if small bitmaps for icons are currently visible in any container. This is useful if the 1020 1017 user scrolls a folder with a lot of pictures. … … 1026 1023 pui--; 1027 1024 if(WinSendMsg(pri->hwndCnr, CM_QUERYVIEWPORTRECT, MPFROMP(&rectl2), MPFROM2SHORT(CMA_WORKSPACE, FALSE))) { 1028 1025 1029 1026 if(pri->pRecord->ptlIcon.y >= rectl2.yBottom && pri->pRecord->ptlIcon.y <= rectl2.yTop && 1030 1027 pri->pRecord->ptlIcon.x >= rectl2.xLeft && pri->pRecord->ptlIcon.x < rectl2.xRight) 1031 1028 bDeleteBmp=FALSE; 1032 1033 }/* WinSendMsg() */ 1029 1030 }/* WinSendMsg() */ 1034 1031 } 1035 1032 }/* else */ … … 1061 1058 * The prototype for cwimg_wpQueryBitmapHandle was replaced by the following prototype: 1062 1059 */ 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, 1060 SOM_Scope BOOL SOMLINK cwimg_wpQueryBitmapHandle(MMImage *somSelf, 1061 HBITMAP* phBitmap, 1062 HPAL* phPalette, 1063 ULONG ulWidth, 1064 ULONG ulHeight, 1065 ULONG ulFlags, 1066 long lBackgroundColor, 1070 1067 BOOL* pbQuitEarly) 1071 1068 { … … 1073 1070 char chrName[CCHMAXPATH]; 1074 1071 1075 MMImageData *somThis = MMImageGetData(somSelf); 1072 MMImageData *somThis = MMImageGetData(somSelf); 1076 1073 MMImageMethodDebug("MMImage","cwimg_wpQueryBitmapHandle"); 1077 1074 … … 1091 1088 return FALSE; 1092 1089 1093 1090 1094 1091 TRY_LOUD(QRY_HBM) { 1095 1092 /* Create a new (maybe smaller) bitmap from the normal size bitmap */ 1096 *phBitmap=createNewBitmap ( _hBitmap, (PBITMAPINFOHEADER2) _pBmpInfoHeader2, 1093 *phBitmap=createNewBitmap ( _hBitmap, (PBITMAPINFOHEADER2) _pBmpInfoHeader2, 1097 1094 ulWidth, ulHeight , pbQuitEarly); 1098 1095 } … … 1106 1103 chrName); 1107 1104 } END_CATCH; 1108 1105 1109 1106 if(!*phBitmap) 1110 1107 return FALSE; … … 1124 1121 BOOL bSem; 1125 1122 1126 MMImageData *somThis = MMImageGetData(somSelf); 1123 MMImageData *somThis = MMImageGetData(somSelf); 1127 1124 MMImageMethodDebug("MMImage","cwimg_wpQueryBitmapInfoHeader"); 1128 1125 … … 1193 1190 break; 1194 1191 1195 bGotHeader=getBmpInfoHeader( (PBITMAPINFOHEADER2) pByte, chrName, _chrIOProcName, 1192 bGotHeader=getBmpInfoHeader( (PBITMAPINFOHEADER2) pByte, chrName, _chrIOProcName, 1196 1193 sizeof(_chrIOProcName), &_bNoIOProcAvailable); 1197 1194 break; … … 1253 1250 * The prototype for cwimg_wpQueryBitmapData was replaced by the following prototype: 1254 1251 */ 1255 SOM_Scope PBYTE SOMLINK cwimg_wpQueryBitmapData(MMImage *somSelf, 1252 SOM_Scope PBYTE SOMLINK cwimg_wpQueryBitmapData(MMImage *somSelf, 1256 1253 ULONG* pulSize) 1257 1254 { … … 1261 1258 NOT_IMPLEMENTED 1262 1259 1263 return (MMImage_parent_WPImageFile_wpQueryBitmapData(somSelf, 1260 return (MMImage_parent_WPImageFile_wpQueryBitmapData(somSelf, 1264 1261 pulSize)); 1265 1262 } … … 1268 1265 * The prototype for cwimg_wpSetBitmapData was replaced by the following prototype: 1269 1266 */ 1270 SOM_Scope BOOL SOMLINK cwimg_wpSetBitmapData(MMImage *somSelf, 1271 PBYTE pBitmapData, 1267 SOM_Scope BOOL SOMLINK cwimg_wpSetBitmapData(MMImage *somSelf, 1268 PBYTE pBitmapData, 1272 1269 ULONG ulSize) 1273 1270 { … … 1284 1281 #endif 1285 1282 1286 return (MMImage_parent_WPImageFile_wpSetBitmapData(somSelf, 1287 pBitmapData, 1283 return (MMImage_parent_WPImageFile_wpSetBitmapData(somSelf, 1284 pBitmapData, 1288 1285 ulSize)); 1289 1286 } … … 1298 1295 BOOL bGotHeader=FALSE; 1299 1296 1300 MMImageData *somThis = MMImageGetData(somSelf); 1297 MMImageData *somThis = MMImageGetData(somSelf); 1301 1298 MMImageMethodDebug("MMImage","cwimg_wpReadImageFile"); 1302 1299 … … 1327 1324 chrName); 1328 1325 }END_CATCH; 1329 1326 1330 1327 if(!bGotHeader) 1331 1328 return FALSE; … … 1347 1344 _bNoIOProcAvailable=TRUE; 1348 1345 } END_CATCH; 1349 1346 1350 1347 if(!_hBitmap) { 1351 1348 return FALSE; 1352 1349 } 1353 1350 1354 1351 return TRUE; 1355 1352 } … … 1413 1410 HWND hwndSubMenu; 1414 1411 MENUITEM mi; 1415 1412 1416 1413 if(g_pmmFormatInfoArray) 1417 1414 free(g_pmmFormatInfoArray); … … 1421 1418 '\0', 1422 1419 sizeof(MMFORMATINFO) ); 1423 1420 1424 1421 mmFormatInfo.ulMediaType |= MMIO_MEDIATYPE_IMAGE; 1425 mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED; 1422 mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED; 1426 1423 ulReturnCode = mmioQueryFormatCount ( &mmFormatInfo, 1427 1424 &lNumIOProcs, 1428 1425 0, 1429 1426 0 ); 1430 1427 1431 1428 if( ulReturnCode != MMIO_SUCCESS ) 1432 1429 { … … 1444 1441 return FALSE; 1445 1442 } 1446 1443 1447 1444 /* 1448 1445 * call mmioGetFormats to get info on the formats supported. … … 1463 1460 return FALSE; 1464 1461 } 1465 1462 1466 1463 if( lFormatsRead != lNumIOProcs ) 1467 1464 { … … 1479 1476 hwndSubMenu=WinCreateWindow(hwndMenu,WC_MENU,"",0, 1480 1477 0,0,0,0, 1481 hwndMenu,//Owner. If set, this window 1478 hwndMenu,//Owner. If set, this window 1482 1479 //is destroyed if owner is destroyed 1483 1480 HWND_TOP, … … 1488 1485 mi.afStyle=MIS_TEXT;//|MIS_SUBMENU; 1489 1486 mi.id=ID_MENU_CONVERT; 1490 mi.afAttribute=NULLHANDLE; 1487 mi.afAttribute=NULLHANDLE; 1491 1488 mi.hwndSubMenu=NULLHANDLE;//hwndSubMenu; 1492 1489 mi.hItem=NULLHANDLE; … … 1502 1499 { 1503 1500 mmioGetFormatName(pmmFormatInfoArray, szBuffer, &lBytesRead, 0L, 0L); 1504 1501 1505 1502 /* Insert NULL string terminator */ 1506 1503 *( szBuffer + lBytesRead ) = (CHAR)NULL; … … 1520 1517 mi.afStyle=MIS_TEXT|MIS_SUBMENU; 1521 1518 mi.id=ID_ITEM_FIRSTCONVERT+index;/* Create menu id */ 1522 mi.afAttribute=NULLHANDLE; 1519 mi.afAttribute=NULLHANDLE; 1523 1520 mi.hwndSubMenu=NULLHANDLE;//hwndSubMenu; 1524 1521 mi.hItem=NULLHANDLE; … … 1528 1525 /* 1529 1526 * advance to next entry in mmFormatInfo array 1530 */ 1527 */ 1531 1528 pmmFormatInfoArray++; 1532 1529 } … … 1564 1561 * The prototype for cwimg_wpModifyPopupMenu was replaced by the following prototype: 1565 1562 */ 1566 SOM_Scope BOOL SOMLINK cwimg_wpModifyPopupMenu(MMImage *somSelf, 1567 HWND hwndMenu, 1568 HWND hwndCnr, 1563 SOM_Scope BOOL SOMLINK cwimg_wpModifyPopupMenu(MMImage *somSelf, 1564 HWND hwndMenu, 1565 HWND hwndCnr, 1569 1566 ULONG iPosition) 1570 1567 { … … 1583 1580 if(!getMessage(text, IDSTR_MENU_IMAGEINFO, sizeof(text), queryResModuleHandle(), hwndMenu)) 1584 1581 strcpy(text, "Image information: %d x %d x %d"); 1585 1582 1586 1583 sprintf(menuText, text, _ulWidth, _ulHeight, _ulDepth);//create menuitem 1587 1584 1588 1585 //insert size menuitem in popupmenu 1589 1586 … … 1599 1596 insertIOProcMenuItems( hwndMenu ); 1600 1597 menuInsertMenuSeparator(hwndMenu, NULLHANDLE, MIT_END ); 1601 1598 1602 1599 }/* TRY_LOUD */ 1603 1600 CATCH(IMAGE_INSERTPOPUPMENU) … … 1607 1604 } END_CATCH; 1608 1605 1609 return (MMImage_parent_WPImageFile_wpModifyPopupMenu(somSelf, 1610 hwndMenu, 1611 hwndCnr, 1606 return (MMImage_parent_WPImageFile_wpModifyPopupMenu(somSelf, 1607 hwndMenu, 1608 hwndCnr, 1612 1609 iPosition)); 1613 1610 } … … 1617 1614 * The prototype for cwimg_wpMenuItemSelected was replaced by the following prototype: 1618 1615 */ 1619 SOM_Scope BOOL SOMLINK cwimg_wpMenuItemSelected(MMImage *somSelf, 1620 HWND hwndFrame, 1616 SOM_Scope BOOL SOMLINK cwimg_wpMenuItemSelected(MMImage *somSelf, 1617 HWND hwndFrame, 1621 1618 ULONG ulMenuId) 1622 1619 { … … 1631 1628 ULONG ulSize; 1632 1629 ULONG ulRc; 1633 1630 1634 1631 PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "imageconverter", "", chrEditor, 1635 1632 sizeof(chrEditor)); … … 1659 1656 } 1660 1657 1661 return (MMImage_parent_WPImageFile_wpMenuItemSelected(somSelf, 1662 hwndFrame, 1658 return (MMImage_parent_WPImageFile_wpMenuItemSelected(somSelf, 1659 hwndFrame, 1663 1660 ulMenuId)); 1664 1661 } … … 1667 1664 * The prototype for cwimg_wpOpen was replaced by the following prototype: 1668 1665 */ 1669 SOM_Scope HWND SOMLINK cwimg_wpOpen(MMImage *somSelf, HWND hwndCnr, 1666 SOM_Scope HWND SOMLINK cwimg_wpOpen(MMImage *somSelf, HWND hwndCnr, 1670 1667 ULONG ulView, ULONG param) 1671 1668 { … … 1711 1708 } 1712 1709 1713 return (MMImage_parent_WPImageFile_wpOpen(somSelf, hwndCnr, 1710 return (MMImage_parent_WPImageFile_wpOpen(somSelf, hwndCnr, 1714 1711 ulView, param)); 1715 1712 } … … 1719 1716 * The prototype for cwimg_wpAddSettingsPages was replaced by the following prototype: 1720 1717 */ 1721 SOM_Scope BOOL SOMLINK cwimg_wpAddSettingsPages(MMImage *somSelf, 1718 SOM_Scope BOOL SOMLINK cwimg_wpAddSettingsPages(MMImage *somSelf, 1722 1719 HWND hwndNotebook) 1723 1720 { … … 1726 1723 MMImageMethodDebug("MMImage","cwimg_wpAddSettingsPages"); 1727 1724 1728 rc=(MMImage_parent_WPImageFile_wpAddSettingsPages(somSelf, 1725 rc=(MMImage_parent_WPImageFile_wpAddSettingsPages(somSelf, 1729 1726 hwndNotebook)); 1730 1727 return rc | (_cwmmAddImageInformationPage(somSelf, hwndNotebook)); … … 1735 1732 * The prototype for cwimg_wpQueryDetailsData was replaced by the following prototype: 1736 1733 */ 1737 SOM_Scope ULONG SOMLINK cwimg_wpQueryDetailsData(MMImage *somSelf, 1738 PVOID* ppDetailsData, 1734 SOM_Scope ULONG SOMLINK cwimg_wpQueryDetailsData(MMImage *somSelf, 1735 PVOID* ppDetailsData, 1739 1736 PULONG pcp) 1740 1737 { … … 1746 1743 1747 1744 /* Fill parent info */ 1748 rcParent=(MMImage_parent_WPImageFile_wpQueryDetailsData(somSelf, 1749 ppDetailsData, 1745 rcParent=(MMImage_parent_WPImageFile_wpQueryDetailsData(somSelf, 1746 ppDetailsData, 1750 1747 pcp)); 1751 1748 … … 1754 1751 { 1755 1752 ULONG ulWidth, ulHeight, ulDepth; 1756 1757 PBITMAPINFOHEADER2 pBmpInfoHeader2=NULLHANDLE; 1753 1754 PBITMAPINFOHEADER2 pBmpInfoHeader2=NULLHANDLE; 1758 1755 1759 1756 #if 0 … … 1761 1758 is on CD is done in wpRestore() */ 1762 1759 pBmpInfoHeader2=(PBITMAPINFOHEADER2) _wpQueryBitmapInfoHeader(somSelf); 1763 #endif 1760 #endif 1764 1761 1765 1762 pBmpInfoHeader2=(PBITMAPINFOHEADER2)_pBmpInfoHeader2; … … 1785 1782 ulDepth=_ulDepth; 1786 1783 } 1787 /* Fill the structure with the info to be displayed */ 1788 pImageDetails=(PIMAGEDETAILS)*ppDetailsData; 1784 /* Fill the structure with the info to be displayed */ 1785 pImageDetails=(PIMAGEDETAILS)*ppDetailsData; 1789 1786 pImageDetails->ulWidth=ulWidth; 1790 1787 pImageDetails->ulHeight=ulHeight; 1791 1788 pImageDetails->ulDepth=ulDepth; 1792 1789 pImageDetails->pszFormat=_chrIOProcName; 1793 1794 *ppDetailsData=((PBYTE) (*ppDetailsData))+sizeof(*pImageDetails); 1790 1791 *ppDetailsData=((PBYTE) (*ppDetailsData))+sizeof(*pImageDetails); 1795 1792 } 1796 1793 else … … 1806 1803 * The prototype for cwimg_wpRestoreState was replaced by the following prototype: 1807 1804 */ 1808 SOM_Scope BOOL SOMLINK cwimg_wpRestoreState(MMImage *somSelf, 1805 SOM_Scope BOOL SOMLINK cwimg_wpRestoreState(MMImage *somSelf, 1809 1806 ULONG ulReserved) 1810 1807 { … … 1813 1810 MMImageData *somThis = MMImageGetData(somSelf); 1814 1811 MMImageMethodDebug("MMImage","cwimg_wpRestoreState"); 1815 1812 1816 1813 _bUseNewClsFeatures=TRUE; 1817 1814 1818 1815 if(cwObjectIsOnCD(somSelf)) { 1819 1816 /* The object is on CD. Check if we should use the new class features */ … … 1827 1824 the filename is unknown). Querying the image data in wpObjectReady() is to late because that method is called after 1828 1825 wpQueryDetailsData(). In wpObjectReady the image header will be read in. */ 1829 1826 1830 1827 /* Query the image info */ 1831 1828 if(!_wpRestoreLong(somSelf, "CWImage", KEY_FILESIZE, &_ulFileSize)) … … 1843 1840 // _wpQueryBitmapInfoHeader(somSelf); 1844 1841 1845 return (MMImage_parent_WPImageFile_wpRestoreState(somSelf, 1842 return (MMImage_parent_WPImageFile_wpRestoreState(somSelf, 1846 1843 ulReserved)); 1847 1844 } … … 1870 1867 1871 1868 /* Refresh */ 1872 bufferSize=sizeof(buffer); 1869 bufferSize=sizeof(buffer); 1873 1870 if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMREFRESH, buffer,&bufferSize)) 1874 1871 { 1875 1872 _cwmmFreeBitmaps(somSelf); 1876 1873 #if 0 1877 _cwmmQuerySmallBitmapHandle(somSelf, 1878 0, 1879 NULLHANDLE, 1874 _cwmmQuerySmallBitmapHandle(somSelf, 1875 0, 1876 NULLHANDLE, 1880 1877 0); 1881 1878 #endif … … 1883 1880 // _wpCnrRefreshDetails(somSelf); 1884 1881 } 1885 1882 1886 1883 return (MMImage_parent_WPImageFile_wpSetup(somSelf, pszSetupString)); 1887 1884 } 1888 1885 1889 1886 1890 SOM_Scope void SOMLINK cwimg_wpObjectReady(MMImage *somSelf, 1887 SOM_Scope void SOMLINK cwimg_wpObjectReady(MMImage *somSelf, 1891 1888 ULONG ulCode, WPObject* refObject) 1892 { 1889 { 1893 1890 PCREATEBMPINFO pCreateBMP; 1894 1891 ULONG ulError; 1895 1892 MMImageData *somThis = MMImageGetData(somSelf); 1896 1893 MMImageMethodDebug("MMImage","cwimg_wpObjectReady"); 1897 1898 MMImage_parent_WPImageFile_wpObjectReady(somSelf, ulCode, 1894 1895 MMImage_parent_WPImageFile_wpObjectReady(somSelf, ulCode, 1899 1896 refObject); 1900 1897 /* Get image info asynchronous to replace cached image size read in from EA which … … 1906 1903 /* Only the object pointer is used */ 1907 1904 pCreateBMP->wpObject=somSelf; 1908 1909 // WinPostMsg(hwndCreateBMP, WM_APPTERMINATENOTIFY,MPFROMP(pCreateBMP), MPFROM2SHORT(0, ACKEY_QUERY_BITMAPINFO)); 1905 1906 // WinPostMsg(hwndCreateBMP, WM_APPTERMINATENOTIFY,MPFROMP(pCreateBMP), MPFROM2SHORT(0, ACKEY_QUERY_BITMAPINFO)); 1910 1907 } 1911 1908 #endif … … 1927 1924 '\0', 1928 1925 sizeof(MMFORMATINFO) ); 1929 1926 1930 1927 mmFormatInfo.ulMediaType |= MMIO_MEDIATYPE_IMAGE; 1931 mmFormatInfo.ulFlags|=MMIO_CANREADTRANSLATED;/* Read !!!*/ 1928 mmFormatInfo.ulFlags|=MMIO_CANREADTRANSLATED;/* Read !!!*/ 1932 1929 ulReturnCode = mmioQueryFormatCount ( &mmFormatInfo, 1933 1930 &lNumIOProcs, 1934 1931 0, 1935 1932 0 ); 1936 1933 1937 1934 if( ulReturnCode != MMIO_SUCCESS ) 1938 1935 { … … 1955 1952 return FALSE; 1956 1953 } 1957 1954 1958 1955 /* 1959 1956 * call mmioGetFormats to get info on the formats supported. … … 1973 1970 return FALSE; 1974 1971 } 1975 1972 1976 1973 if( lFormatsRead != lNumIOProcs ) 1977 1974 { … … 2005 2002 // HlpWriteToTrapLog("Known Extension: %s\n", chrMMImageKnownExt); 2006 2003 // HlpWriteToTrapLog("Extension: %s\n", chrMMImageExt); 2007 } 2004 } 2008 2005 /* 2009 2006 * advance to next entry in mmFormatInfo array 2010 */ 2007 */ 2011 2008 pmmFormatInfoArray++; 2012 2009 } … … 2036 2033 if(_pBmpInfoHeader2) { 2037 2034 if(((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cbFix==sizeof(BITMAPINFOHEADER2)) { 2038 _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cx); 2035 _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cx); 2039 2036 _wpSaveLong(somSelf, "CWImage", KEY_HEIGHT, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cy); 2040 2037 _wpSaveLong(somSelf, "CWImage", KEY_DEPTH, ((PBITMAPINFOHEADER2)_pBmpInfoHeader2)->cBitCount); … … 2043 2040 PBITMAPINFOHEADER pBmpInfoHeader=(PBITMAPINFOHEADER)_pBmpInfoHeader2; 2044 2041 2045 _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, pBmpInfoHeader->cx); 2042 _wpSaveLong(somSelf, "CWImage", KEY_WIDTH, pBmpInfoHeader->cx); 2046 2043 _wpSaveLong(somSelf, "CWImage", KEY_HEIGHT, pBmpInfoHeader->cy); 2047 2044 _wpSaveLong(somSelf, "CWImage", KEY_DEPTH, pBmpInfoHeader->cBitCount); … … 2052 2049 2053 2050 #if 0 2054 SOM_Scope BOOL SOMLINK cwimg_wpFormatDragItem(MMImage *somSelf, 2051 SOM_Scope BOOL SOMLINK cwimg_wpFormatDragItem(MMImage *somSelf, 2055 2052 PDRAGITEM pdrgItem) 2056 2053 { … … 2060 2057 MMImageMethodDebug("MMImage","cwimg_wpFormatDragItem"); 2061 2058 2062 rc= (MMImage_parent_WPImageFile_wpFormatDragItem(somSelf, 2059 rc= (MMImage_parent_WPImageFile_wpFormatDragItem(somSelf, 2063 2060 pdrgItem)); 2064 2061 DosBeep(500,10); … … 2080 2077 If the folder is closed it's likely the bitmaps may be obsolete. A check for USAGE_RECORD items 2081 2078 will be done on another thread. 2082 2079 2083 2080 wpDeleteFromObjUseList() seems to be the more natural place to do this but the method is not called 2084 2081 when an object is removed from a container. Also wpCnrRemoveObject() doesn't work because the WPS seems … … 2089 2086 2090 2087 */ 2091 if(_hBitmap || _hBitmapSmall) 2088 if(_hBitmap || _hBitmapSmall) 2092 2089 sendDeleteBMPMsg(somSelf); 2093 2090 … … 2126 2123 /* Now check installed IO procs for other exts and add them to the filter list */ 2127 2124 _getMissingExtFromImageIOProc(); 2128 bGotImgExt=TRUE; 2125 bGotImgExt=TRUE; 2129 2126 } 2130 2127 … … 2134 2131 globalHab=WinQueryAnchorBlock(HWND_DESKTOP); 2135 2132 2136 if(!getMessage(chrHelpLibrary, IDSTR_HELPLIBRARY, sizeof(chrHelpLibrary), 2133 if(!getMessage(chrHelpLibrary, IDSTR_HELPLIBRARY, sizeof(chrHelpLibrary), 2137 2134 queryModuleHandle(), HWND_DESKTOP)) 2138 2135 strcpy(chrHelpLibrary,"MMPARTS.HLP"); … … 2152 2149 { 2153 2150 memset((PCH)pCfi,0,sizeof(CLASSFIELDINFO)); 2154 2151 2155 2152 pCfi->cb=sizeof(CLASSFIELDINFO); 2156 2153 pCfi->flData=CFA_LEFT|CFA_SEPARATOR|CFA_FIREADONLY; … … 2159 2156 pCfi->pTitleData=(PVOID)pszImageColTitles[i]; 2160 2157 pCfi->flCompare=COMPARE_SUPPORTED|SORTBY_SUPPORTED; 2161 2158 2162 2159 switch(i) 2163 2160 { … … 2191 2188 }/* switch(i) */ 2192 2189 }/* for() */ 2193 cfiImageFieldInfo[NUM_IMAGE_DETAILS_FIELDS].pNextFieldInfo=NULL; 2190 cfiImageFieldInfo[NUM_IMAGE_DETAILS_FIELDS].pNextFieldInfo=NULL; 2194 2191 if(!hwndCreateBMP) 2195 2192 _beginthread(createBMPThreadFunc,NULL,8192*20, NULLHANDLE); //Fehlerbehandlung fehlt … … 2223 2220 { 2224 2221 ULONG ulHowMatched=1; 2225 2222 2226 2223 DosBeep(5000, 1000); 2227 2224 /* Template found. Now query associated program */ … … 2230 2227 DosBeep(500, 1000); 2231 2228 } 2232 #endif 2229 #endif 2233 2230 /* Create default templates. We do it here because we need an object to query the associated 2234 2231 program (if any) when the system asks for the default view. */ … … 2252 2249 '\0', 2253 2250 sizeof(MMFORMATINFO) ); 2254 2251 2255 2252 mmFormatInfo.ulMediaType |= MMIO_MEDIATYPE_IMAGE; 2256 mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED; 2253 mmFormatInfo.ulFlags|=MMIO_CANWRITETRANSLATED; 2257 2254 ulReturnCode = mmioQueryFormatCount ( &mmFormatInfo, 2258 2255 &lNumIOProcs, 2259 2256 0, 2260 2257 0 ); 2261 2258 2262 2259 if( ulReturnCode != MMIO_SUCCESS ) 2263 2260 { … … 2280 2277 return FALSE; 2281 2278 } 2282 2279 2283 2280 /* 2284 2281 * call mmioGetFormats to get info on the formats supported. … … 2298 2295 return FALSE; 2299 2296 } 2300 2297 2301 2298 if( lFormatsRead != lNumIOProcs ) 2302 2299 { … … 2314 2311 { 2315 2312 mmioGetFormatName(pmmFormatInfoArray, szBuffer, &lBytesRead, 0L, 0L); 2316 2313 2317 2314 /* Insert NULL string terminator */ 2318 2315 *( szBuffer + lBytesRead ) = (CHAR)NULL; … … 2320 2317 /* Compressed TIF is not supported because the Warp 4 IO-Procs are 2321 2318 broken. */ 2322 //HlpWriteToTrapLog("--------- Ext: %s, IO-Proc: %s, Name: %s\n", 2319 //HlpWriteToTrapLog("--------- Ext: %s, IO-Proc: %s, Name: %s\n", 2323 2320 //chrExt, pmmFormatInfoArray->szDefaultFormatExt, 2324 2321 // szBuffer); … … 2336 2333 /* 2337 2334 * advance to next entry in mmFormatInfo array 2338 */ 2335 */ 2339 2336 pmmFormatInfoArray++; 2340 2337 } … … 2344 2341 } 2345 2342 2346 SOM_Scope BOOL SOMLINK cwimgM_wpclsCreateDefaultTemplates(M_MMImage *somSelf, 2343 SOM_Scope BOOL SOMLINK cwimgM_wpclsCreateDefaultTemplates(M_MMImage *somSelf, 2347 2344 WPObject* Folder) 2348 2345 { … … 2354 2351 /* The FOURCC of the JPEG-IO proc is JPEG so we have to create that template 2355 2352 in the JPG class. */ 2356 2353 2357 2354 if(checkImageIOProc( _wpclsQueryInstanceFilter(somSelf))) { 2358 2355 // WPFolder* wpFolder; … … 2400 2397 */ 2401 2398 2402 SOM_Scope ULONG SOMLINK cwimgM_wpclsQueryIconData(M_MMImage *somSelf, 2399 SOM_Scope ULONG SOMLINK cwimgM_wpclsQueryIconData(M_MMImage *somSelf, 2403 2400 PICONINFO pIconInfo) 2404 2401 { … … 2424 2421 * The prototype for cwimgM_wpclsQueryDetailsInfo was replaced by the following prototype: 2425 2422 */ 2426 SOM_Scope ULONG SOMLINK cwimgM_wpclsQueryDetailsInfo(M_MMImage *somSelf, 2427 PCLASSFIELDINFO* ppClassFieldInfo, 2423 SOM_Scope ULONG SOMLINK cwimgM_wpclsQueryDetailsInfo(M_MMImage *somSelf, 2424 PCLASSFIELDINFO* ppClassFieldInfo, 2428 2425 PULONG pSize) 2429 2426 { … … 2435 2432 M_MMImageMethodDebug("M_MMImage","cwimgM_wpclsQueryDetailsInfo"); 2436 2433 2437 cParentColumns= (M_MMImage_parent_M_WPImageFile_wpclsQueryDetailsInfo(somSelf, 2438 ppClassFieldInfo, 2434 cParentColumns= (M_MMImage_parent_M_WPImageFile_wpclsQueryDetailsInfo(somSelf, 2435 ppClassFieldInfo, 2439 2436 pSize)); 2440 2437 if(pSize)
Note:
See TracChangeset
for help on using the changeset viewer.