Index: D:\cwmmclasses\trunk\classes\c\c_mm\mmfolder.c
===================================================================
--- D:\cwmmclasses\trunk\classes\c\c_mm\mmfolder.c	(revision 67)
+++ D:\cwmmclasses\trunk\classes\c\c_mm\mmfolder.c	(working copy)
@@ -16,18 +16,18 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; see the file COPYING.  If not, write to
  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */          
+ */
 /*
  * If you need another license for your project/product (commercial,
  * noncommercial, whatever) contact me at
- * 
+ *
  * http://www.os2world.com/cdwriting
  * http://www.geocities.com/SiliconValley/Sector/5785/
  *
  */
 /*
  *  This file was generated by the SOM Compiler and Emitter Framework.
- *  Generated using: 
+ *  Generated using:
  *      SOM Emitter emitctm: 2.42
  */
 
@@ -58,12 +58,6 @@
 #include "som_wps_funcs.h"
 #include "sys_funcs.h"
 
-//#if 0
-#ifndef  _cwmmQuerySmallBitmapHandle
-#define _cwmmQuerySmallBitmapHandle MMImage_cwmmQuerySmallBitmapHandle
-#define _cwmmQuerySmallBitmapHandleCWBitmap MMBitmap_cwmmQuerySmallBitmapHandle
-#endif
-//#endif
 #define STOREWINDOWID 112233
 
 //#define DEBUG
@@ -82,7 +76,7 @@
 {
   somId mySomId;
   static SOMClass * mWPFolderClass=NULLHANDLE;
-  
+
   if(!mWPFolderClass) {
     if((mySomId=somIdFromString("WPFolder"))!=NULLHANDLE) {
       mWPFolderClass=(SOMClass*)_somClassFromId(SOMClassMgrObject, mySomId);
@@ -112,7 +106,7 @@
 {
   somId mySomId;
   static SOMClass *mWPImgClass=NULL;
-  
+
   if(!mWPImgClass) {
     if((mySomId=somIdFromString("MMBitmap"))!=NULLHANDLE) {
       mWPImgClass=(SOMClass*)_somClassFromId(SOMClassMgrObject, mySomId);
@@ -122,7 +116,7 @@
   return mWPImgClass;
 }
 
-MRESULT EXPENTRY mmFolderContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
+MRESULT EXPENTRY mmFolderContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
   HWND hwndStore;
   MMFolder *somSelf;
@@ -141,7 +135,7 @@
         PCNRINFO pCnrInfo=(PCNRINFO)PVOIDFROMMP(mp1);
 
         if(pCnrInfo) {
-          //      writeLog("flWindowAttr: 0x%x, Mask: 0x%x, cxTreeIndent: %d, cyLineSpacing: %d\n", 
+          //      writeLog("flWindowAttr: 0x%x, Mask: 0x%x, cxTreeIndent: %d, cyLineSpacing: %d\n",
           //       pCnrInfo->flWindowAttr, LONGFROMMP(mp2), pCnrInfo->cxTreeIndent, pCnrInfo->cyLineSpacing);
 
           if(!(pCnrInfo->flWindowAttr & (CV_DETAIL|CV_TREE/*|CV_ICON|CV_NAME*/)) &&
@@ -152,13 +146,13 @@
               {
                 somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER);
                 if(somIsObj(somSelf)) {
-                  MMFolderData *somThis = MMFolderGetData(somSelf); 
-                  
+                  MMFolderData *somThis = MMFolderGetData(somSelf);
+
                   pCnrInfo->flWindowAttr&=~CA_DRAWICON;
                   pCnrInfo->flWindowAttr|=CA_DRAWBITMAP|CA_OWNERDRAW;
                   pCnrInfo->slBitmapOrIcon.cx=_ulCurrentSize;
                   pCnrInfo->slBitmapOrIcon.cy=_ulCurrentSize;
-                  
+
                   mp2=MPFROMLONG(LONGFROMMP(mp2)|CMA_SLBITMAPORICON|CMA_FLWINDOWATTR);
                 }
               }
@@ -188,12 +182,12 @@
         {
           somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER);
           if(somIsObj(somSelf)) {
-            MMFolderData *somThis = MMFolderGetData(somSelf); 
+            MMFolderData *somThis = MMFolderGetData(somSelf);
             if(_oldContainerProc)
               return _oldContainerProc(hwnd, msg, mp1, mp2);
           }
         }
-    }    
+    }
   return WinDefWindowProc(hwnd, msg, mp1, mp2);
 }
 
@@ -244,11 +238,11 @@
 {
   HPOINTER hptrTemplate;
   HMODULE hmodTemplate;
-  
+
   if(!DosQueryModuleHandle("PMWP",&hmodTemplate))
     {
       ULONG ulIconSize;
-      
+
       hptrTemplate=WinLoadPointer(HWND_DESKTOP, hmodTemplate, 20);
       WinDrawPointer(hps, rcl->xLeft, rcl->yBottom, hptrTemplate, (flCnr &  CV_MINI ? DP_MINI:DP_NORMAL));
       WinDestroyPointer(hptrTemplate);
@@ -260,12 +254,12 @@
         }
       return DP_MINI;
     }
-  
+
   return DP_NORMAL;
 }
 
 
-MRESULT EXPENTRY mmFolderFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
+MRESULT EXPENTRY mmFolderFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
   HWND hwndStore;
   MMFolder *somSelf;
@@ -278,7 +272,7 @@
     case WM_DRAWITEM:
       {
         POWNERITEM pOwnerItem=(POWNERITEM)PVOIDFROMMP(mp2);
- 
+
 
         /* We only draw icons not text */
         if(pOwnerItem->idItem==CMA_ICON /*&& !bNot*/) {
@@ -304,7 +298,7 @@
              && (pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_SELECTED)) {
             POINTL pointl;
 
-            WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE);            
+            WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE);
             GpiSetPattern(pOwnerItem->hps,PATSYM_DIAG2);
             pointl.x = rclTemp.xLeft;
             pointl.y = rclTemp.yBottom;
@@ -312,14 +306,14 @@
             pointl.x = rclTemp.xRight - 1;
             pointl.y = rclTemp.yTop - 1;
             GpiSetColor(pOwnerItem->hps, CLR_BLACK);
-            GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1);         
-            
+            GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1);
+
           }
           /* Check if record is in use */
           else if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE) {
             POINTL pointl;
 
-            WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE);            
+            WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE);
             GpiSetPattern(pOwnerItem->hps,PATSYM_DIAG1);
             pointl.x = rclTemp.xLeft;
             pointl.y = rclTemp.yBottom;
@@ -327,7 +321,7 @@
             pointl.x = rclTemp.xRight - 1;
             pointl.y = rclTemp.yTop - 1;
             GpiSetColor(pOwnerItem->hps, CLR_BLACK);
-            GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1);                    
+            GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1);
           }
           /* or is it only selected? */
           else if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_SELECTED)
@@ -335,7 +329,7 @@
           /* Default is paint white background */
           else
             WinFillRect(pOwnerItem->hps, &rclTemp, CLR_WHITE);
-          /* Emphasis drawn */          
+          /* Emphasis drawn */
 
           /********************************************/
           /*                                          */
@@ -345,7 +339,7 @@
           if(mrc){
             WPObject *wpObject;
             ULONG ulIconSize=150;/* Default if query fails */
-            
+
             wpObject=(WPObject*)OBJECT_FROM_PREC(mrc); // Get object
             wpObject=somGetFileSystemObject(wpObject);  // Get Filesystem object
 
@@ -361,12 +355,12 @@
 #ifdef DEBUG
                 SysWriteToTrapLog("Object is an image. (%s line: %d)\n", __FUNCTION__, __LINE__);
 #endif
-                /* Get object pointer of lighttable folder */                
+                /* Get object pointer of lighttable folder */
                 if((hwndStore=WinWindowFromID(hwnd, STOREWINDOWID))!=NULLHANDLE)
                   {
                     somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER);
                     if(somIsObj(somSelf)) {
-                      MMFolderData *somThis = MMFolderGetData(somSelf); 
+                      MMFolderData *somThis = MMFolderGetData(somSelf);
                       ulIconSize=_ulCurrentSize;
                     }
                   }
@@ -388,7 +382,7 @@
 
                     Wondering what hidden problems/bugs will show upt in the future...
                     */
-                  if((hbm=_cwmmQuerySmallBitmapHandle( (MMImage*) wpObject, ulIconSize, mrc, hwndCnr))!=NULLHANDLE)          
+                  if((hbm=cwimg_cwmmQuerySmallBitmapHandle( (MMImage*) wpObject, ulIconSize, mrc, hwndCnr))!=NULLHANDLE)
                     pBmpInfoHeader2=(PBITMAPINFOHEADER2)_wpQueryBitmapInfoHeader((MMImage*)wpObject);
 #ifdef DEBUG
                   SysWriteToTrapLog("Queried HBITMAP: %x (line: %d)\n", hbm, __LINE__);
@@ -398,7 +392,7 @@
                 else if(_somIsA(wpObject, cwBitmapClass)) {
                   /* The default WPS bitmap class (WPBitmap) returns an PBITMAPHEADER. The CWBitmap class
                      does return a PBITMAPHEADER2<-. */
-                  if((hbm=_cwmmQuerySmallBitmapHandleCWBitmap( (MMBitmap*) wpObject, ulIconSize))!=NULLHANDLE)
+                  if((hbm=cwbmp_cwmmQuerySmallBitmapHandle( (MMBitmap*) wpObject, ulIconSize))!=NULLHANDLE)
                     pBmpInfoHeader2=(PBITMAPINFOHEADER2)_cwmmQueryBitmapInfoHeader((MMBitmap*)wpObject);
                 }
 
@@ -428,7 +422,7 @@
                       cwAdjustIconRECTL(&rcl, ulIconWidth, ulWidth, ulHeight);
                       /* And now draw the bitmap */
 #if 0
-                      if(pBmpInfoHeader2->cclrUsed==2) {                        
+                      if(pBmpInfoHeader2->cclrUsed==2) {
                         WinDrawBitmap(pOwnerItem->hps, hbm, NULL, (PPOINTL)&rcl,//pOwnerItem->rclItem,
                                       CLR_WHITE, CLR_BLACK, DBM_STRETCH /*| DBM_IMAGEATTRS*/);
                       }
@@ -441,7 +435,12 @@
                     /* Draw a small border around the image */
                     cwDraw2ColorBorder(pOwnerItem->hps, &rclTemp, CLR_BLACK, CLR_DARKGRAY);
                     /* Done */
-                    free(hbm);
+                    if(_somIsA(wpObject, cwImageClass)) {
+                       cwimg_cwmmFreeSmallBitmap((MMImage *)wpObject);
+                    }
+                    else {
+                       cwbmp_cwmmFreeSmallBitmap((MMBitmap*)wpObject);
+                    }
                     return (MRESULT) TRUE;
                   }/* hbm */
               }/* cwImageClass/cwBitmapClass */
@@ -474,26 +473,26 @@
                 if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE)
                   {
                     SOMClass* wpFolderClass=queryWpFolderClass();
-                    
+
                     if(somIsObj(wpFolderClass)) {
-                      if(_somIsA(wpObject, wpFolderClass)) {   
+                      if(_somIsA(wpObject, wpFolderClass)) {
                         /* It's a folder */
                         HPOINTER hptr;
-                        
+
                         pOwnerItem->rclItem.xLeft=rcl.xLeft;
                         pOwnerItem->rclItem.yBottom=rcl.yBottom;
-                        
+
                         /* The following is only for Warp 4 but Warp 3 isn't supported anyway...*/
                         hptr=_wpQueryIconN(wpObject,1);
                         if(WinDrawPointer(pOwnerItem->hps, rcl.xLeft, rcl.yBottom, hptr, ulMiniOrNormal)) {
                           cwDraw2ColorBorder(pOwnerItem->hps, &rclTemp, CLR_BLACK, CLR_DARKGRAY);
                           return (MRESULT) TRUE;
                         }
-                        
+
                       }
                     }/* if(somIsObj(wpFolderClass)) */
                   }/* if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE) */
-                
+
                 if(WinDrawPointer(pOwnerItem->hps, rcl.xLeft, rcl.yBottom, mrc->hptrIcon, ulMiniOrNormal)) {
                   cwDraw2ColorBorder(pOwnerItem->hps, &rclTemp, CLR_BLACK, CLR_DARKGRAY);
                   return (MRESULT) TRUE;
@@ -508,7 +507,7 @@
           /* It's the details view */
           /*************************/
           PCNRDRAWITEMINFO pCnrDrawItemInfo=(PCNRDRAWITEMINFO)pOwnerItem->hItem;
-          
+
           if(pCnrDrawItemInfo && pCnrDrawItemInfo->pFieldInfo->flData & CFA_BITMAPORICON) {
             PMINIRECORDCORE mrc=(PMINIRECORDCORE)((PCNRDRAWITEMINFO)pOwnerItem->hItem)->pRecord;
             if(mrc){
@@ -517,21 +516,21 @@
               ULONG ulIconSize=150;/* Default if query fails */
               HWND hwndCnr=WinWindowFromID(hwnd, FID_CLIENT);
               RECTL rclTemp=pOwnerItem->rclItem;
-              
+
               wpObjToRefresh=(WPObject*)OBJECT_FROM_PREC(mrc);//Get object
               wpObject=somGetFileSystemObject(wpObjToRefresh);
-              
+
               /* Draw Background */
               rclTemp.xLeft+=2;
               rclTemp.xRight-=2;
               rclTemp.yBottom+=2;
               rclTemp.yTop-=2;
-              
+
               /* Check if record is selected and in use... */
               if((pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE)
                  && (pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_SELECTED)) {
                 POINTL pointl;
-                
+
                 GpiSetPattern(pOwnerItem->hps,PATSYM_DIAG2);
                 pointl.x = rclTemp.xLeft;
                 pointl.y = rclTemp.yBottom;
@@ -539,13 +538,13 @@
                 pointl.x = rclTemp.xRight - 1;
                 pointl.y = rclTemp.yTop - 1;
                 GpiSetColor(pOwnerItem->hps, CLR_BLACK);
-                GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1);         
-                
+                GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1);
+
               }
               /* or only in use... */
               else if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_INUSE) {
                 POINTL pointl;
-                
+
                 GpiSetPattern(pOwnerItem->hps,PATSYM_DIAG1);
                 pointl.x = rclTemp.xLeft;
                 pointl.y = rclTemp.yBottom;
@@ -553,7 +552,7 @@
                 pointl.x = rclTemp.xRight - 1;
                 pointl.y = rclTemp.yTop - 1;
                 GpiSetColor(pOwnerItem->hps, CLR_BLACK);
-                GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1);         
+                GpiBox(pOwnerItem->hps,DRO_FILL,&pointl,1,1);
               }
               /* or only selected. */
               else if(pCnrDrawItemInfo->pRecord->flRecordAttr & CRA_SELECTED)
@@ -564,27 +563,27 @@
               if(somIsObj(wpObject) && _wpIsObjectInitialized(wpObject)) {
                 SOMClass* cwBitmapClass=queryCWBitmapFileClass();
                 SOMClass* cwImageClass=queryCWImageFileClass();
-                
+
                 if(somIsObj(cwImageClass)||somIsObj(cwBitmapClass)) {
                   HBITMAP hbm=NULLHANDLE;
                   PBITMAPINFOHEADER2 pBmpInfoHeader2;
-                  
+
                   /* Query object pointer */
                   if((hwndStore=WinWindowFromID(hwnd, STOREWINDOWID))!=NULLHANDLE)
                     {
                       somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER);
                       if(somIsObj(somSelf)) {
-                        MMFolderData *somThis = MMFolderGetData(somSelf); 
+                        MMFolderData *somThis = MMFolderGetData(somSelf);
                         ulIconSize=_ulCurrentSize;
                       }
                     }
-                  /* Get the small bitmap from the object */ 
+                  /* Get the small bitmap from the object */
                   if(_somIsA(wpObject, cwImageClass)) {
-                    hbm=_cwmmQuerySmallBitmapHandle( (MMImage*) wpObject, ulIconSize, mrc, hwndCnr);
+                    hbm=cwimg_cwmmQuerySmallBitmapHandle( (MMImage*) wpObject, ulIconSize, mrc, hwndCnr);
                     pBmpInfoHeader2=(PBITMAPINFOHEADER2)_wpQueryBitmapInfoHeader((MMImage*)wpObject);
                   }
                   else if(_somIsA(wpObject, cwBitmapClass)) {
-                    hbm=_cwmmQuerySmallBitmapHandleCWBitmap( (MMImage*) wpObject, ulIconSize);
+                    hbm=cwbmp_cwmmQuerySmallBitmapHandle( (MMBitmap*) wpObject, ulIconSize);
                     pBmpInfoHeader2=(PBITMAPINFOHEADER2)_wpQueryBitmapInfoHeader((MMBitmap*)wpObject);
                   }
                   if(hbm)
@@ -635,6 +634,12 @@
                         WinDrawBitmap(pOwnerItem->hps, hbm, NULL, (PPOINTL)&rcl,//pOwnerItem->rclItem,
                                       CLR_WHITE, CLR_BLACK, DBM_STRETCH /*|DBM_IMAGEATTRS*/);
                       }
+                      if(_somIsA(wpObject, cwImageClass)) {
+                         cwimg_cwmmFreeSmallBitmap((MMImage *)wpObject);
+                      }
+                      else {
+                         cwbmp_cwmmFreeSmallBitmap((MMBitmap*)wpObject);
+                      }
                       return (MRESULT) TRUE;
                     }/* hbm */
                 }/* cwImageClass */
@@ -678,7 +683,7 @@
         {
           somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER);
           if(somIsObj(somSelf)) {
-            MMFolderData *somThis = MMFolderGetData(somSelf); 
+            MMFolderData *somThis = MMFolderGetData(somSelf);
             switch(_usLastSelMenuItem)
               {
               case 0x2d1:/* view menu */
@@ -695,21 +700,21 @@
                     if((cnrInfo.flWindowAttr & CV_ICON) && !(cnrInfo.flWindowAttr & CV_TREE)) {
                       /* insert separator */
                       menuInsertMenuSeparator( HWNDFROMMP(mp2), NULLHANDLE, MIT_END);
-                      
+
                       /* Load the menu from the resource */
                       hwndMenu=WinLoadMenu(hwnd,queryResModuleHandle(), ID_MENUICONSIZE);
-                      
+
                       /* Fill the MENUITEM structure */
                       mi.iPosition=MIT_END;
                       mi.afStyle=MIS_TEXT|MIS_SUBMENU;
                       mi.id=ID_MENUICONSIZE;
-                      mi.afAttribute=NULLHANDLE;                
+                      mi.afAttribute=NULLHANDLE;
                       mi.hwndSubMenu=hwndMenu;
                       mi.hItem=NULLHANDLE;
                       if(!getMessage(text, IDSTR_ICONSIZEMENU, sizeof(text), queryResModuleHandle(), hwnd))
                         strcpy(text, "Icon ~size");;
                       menuInsertMenuItem(HWNDFROMMP(mp2), hwndMenu, MIT_END, ID_MENUICONSIZE, text);
-                      
+
                       /* check current menuitem */
                       switch(_ulCurrentSize)
                         {
@@ -732,7 +737,7 @@
                           WinCheckMenuItem(hwndMenu, ID_250X250ITEM, TRUE);
                           break;
                         default:
-                          break; 
+                          break;
                         }
                     }
                   }/* if() */
@@ -749,7 +754,7 @@
         {
           somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER);
           if(somIsObj(somSelf)) {
-            MMFolderData *somThis = MMFolderGetData(somSelf); 
+            MMFolderData *somThis = MMFolderGetData(somSelf);
             _usLastSelMenuItem=SHORT1FROMMP(mp1);
           }
         }
@@ -762,12 +767,12 @@
     {
       somSelf=(MMFolder*) WinQueryWindowULong(hwndStore,QWL_USER);
       if(somIsObj(somSelf)) {
-        MMFolderData *somThis = MMFolderGetData(somSelf); 
+        MMFolderData *somThis = MMFolderGetData(somSelf);
         if(_oldFrameProc)
           return _oldFrameProc(hwnd, msg, mp1, mp2);
       }
     }
-  
+
   return WinDefWindowProc(hwnd, msg, mp1, mp2);
 }
 
@@ -775,39 +780,39 @@
  *	wpSetupOnce :override;
  */
 
-SOM_Scope HWND  SOMLINK mmfldr_wpOpen(MMFolder *somSelf, HWND hwndCnr, 
+SOM_Scope HWND  SOMLINK mmfldr_wpOpen(MMFolder *somSelf, HWND hwndCnr,
                                       ULONG ulView, ULONG param)
 {
   HWND hwnd;
 
-  MMFolderData *somThis = MMFolderGetData(somSelf); 
+  MMFolderData *somThis = MMFolderGetData(somSelf);
     MMFolderMethodDebug("MMFolder","mmfldr_wpOpen");
 
-    hwnd=(MMFolder_parent_WPFolder_wpOpen(somSelf, hwndCnr, 
+    hwnd=(MMFolder_parent_WPFolder_wpOpen(somSelf, hwndCnr,
                                             ulView, param));
 
     /* Only subclass folder frames, not settings notebooks */
-    if(ulView!=OPEN_SETTINGS){    
+    if(ulView!=OPEN_SETTINGS){
       HWND hwndStore;
 
       if((hwndStore=WinCreateWindow(hwnd, WC_STATIC, "objectStore", 0, 0,0,0,0,
                          hwnd, HWND_BOTTOM, STOREWINDOWID, NULLHANDLE, NULLHANDLE))!=NULLHANDLE)
         {
-          HWND hwndContainer;     
+          HWND hwndContainer;
 
           WinSetWindowULong(hwndStore, QWL_USER, (ULONG)somSelf);
           _oldFrameProc=WinSubclassWindow(hwnd, mmFolderFrameProc);
-          
+
           if(hwnd)
             {
               CNRINFO cnrInfo;
               HWND hwndContainer=WinWindowFromID(hwnd,FID_CLIENT);
-  
+
               /* Change the containerflags */
               if(WinSendMsg(hwndContainer,CM_QUERYCNRINFO, MPFROMP(&cnrInfo),
                             MPFROMSHORT(sizeof(cnrInfo))))
                 {
-                  if(cnrInfo.flWindowAttr & CV_ICON) {              
+                  if(cnrInfo.flWindowAttr & CV_ICON) {
                     cnrInfo.slBitmapOrIcon.cx=_ulCurrentSize;
                     cnrInfo.slBitmapOrIcon.cy=_ulCurrentSize;
                     cnrInfo.flWindowAttr&=~CA_DRAWICON;
@@ -828,7 +833,7 @@
 }
 
 #if 0
-SOM_Scope BOOL  SOMLINK mmfldr_wpSetupOnce(MMFolder *somSelf, 
+SOM_Scope BOOL  SOMLINK mmfldr_wpSetupOnce(MMFolder *somSelf,
                                            PSZ pszSetupString)
 {
   BOOL rc;
@@ -853,7 +858,7 @@
 }
 #endif
 
-SOM_Scope BOOL  SOMLINK mmfldr_wpRestoreState(MMFolder *somSelf, 
+SOM_Scope BOOL  SOMLINK mmfldr_wpRestoreState(MMFolder *somSelf,
                                               ULONG ulReserved)
 {
     MMFolderData *somThis = MMFolderGetData(somSelf);
@@ -864,20 +869,20 @@
       _ulCurrentSize=MMFLDR_DEFAULT_ICONSIZE;
     }
 
-    return (MMFolder_parent_WPFolder_wpRestoreState(somSelf, 
+    return (MMFolder_parent_WPFolder_wpRestoreState(somSelf,
                                                     ulReserved));
 }
 
-SOM_Scope BOOL  SOMLINK mmfldr_wpRestoreData(MMFolder *somSelf, 
-                                             PSZ pszClass, ULONG ulKey, 
+SOM_Scope BOOL  SOMLINK mmfldr_wpRestoreData(MMFolder *somSelf,
+                                             PSZ pszClass, ULONG ulKey,
                                              PBYTE pValue, PULONG pcbValue)
 {
   BOOL rc;
     MMFolderData *somThis = MMFolderGetData(somSelf);
     MMFolderMethodDebug("MMFolder","mmfldr_wpRestoreData");
 
-    rc= (MMFolder_parent_WPFolder_wpRestoreData(somSelf, pszClass, 
-                                                   ulKey, pValue, 
+    rc= (MMFolder_parent_WPFolder_wpRestoreData(somSelf, pszClass,
+                                                   ulKey, pValue,
                                                    pcbValue));
     switch(ulKey)
       {
@@ -913,15 +918,15 @@
 {
     MMFolderData *somThis = MMFolderGetData(somSelf);
     MMFolderMethodDebug("MMFolder","mmfldr_wpSaveState");
-    
+
     _wpSaveLong( somSelf, "MMFolder", KEY_ICONSIZE, _ulCurrentSize);
 
     return (MMFolder_parent_WPFolder_wpSaveState(somSelf));
 }
 
 
-SOM_Scope BOOL  SOMLINK mmfldr_wpSaveData(MMFolder *somSelf, 
-                                          PSZ pszClass, ULONG ulKey, 
+SOM_Scope BOOL  SOMLINK mmfldr_wpSaveData(MMFolder *somSelf,
+                                          PSZ pszClass, ULONG ulKey,
                                           PBYTE pValue, ULONG cbValue)
 {
   PSZ psz;
@@ -931,7 +936,7 @@
     /* When the template is created wpRestoreData() isn't called so we don't have
        the address of the instance data containing grid spacing and view. So
        we force the object to save the instance data and in wpSaveData we
-       finally get the right addresses to change the object view to gridded. 
+       finally get the right addresses to change the object view to gridded.
        This change is done in wpObjectReady() where we called wpSaveImmediate(). */
 
     /* If no ID result is NULL */
@@ -940,7 +945,7 @@
 
       Check ID for NULL to prevent crash in stricmp().
      */
-    psz=_wpQueryObjectID(somSelf);          
+    psz=_wpQueryObjectID(somSelf);
     //  if(!stricmp(_wpQueryObjectID(somSelf), "<MMPM2_MMFOLDERTEMPLATE>"))
     if(psz && !stricmp(psz, "<MMPM2_MMFOLDERTEMPLATE>"))
       {
@@ -976,13 +981,13 @@
           }
       }
 
-    return (MMFolder_parent_WPFolder_wpSaveData(somSelf, pszClass, 
-                                                ulKey, pValue, 
+    return (MMFolder_parent_WPFolder_wpSaveData(somSelf, pszClass,
+                                                ulKey, pValue,
                                                 cbValue));
 }
 
-SOM_Scope BOOL  SOMLINK mmfldr_wpMenuItemSelected(MMFolder *somSelf, 
-                                                  HWND hwndFrame, 
+SOM_Scope BOOL  SOMLINK mmfldr_wpMenuItemSelected(MMFolder *somSelf,
+                                                  HWND hwndFrame,
                                                   ULONG ulMenuId)
 {
   CNRINFO cnrInfo;
@@ -998,7 +1003,7 @@
         {
           char text[200];
           CNRINFO cnrInfo2=cnrInfo;
-    
+
           switch(ulMenuId)
             {
             case ID_50X50ITEM:
@@ -1048,7 +1053,7 @@
             *(_pulGridSpacing--)=_ulCurrentSize+MMFLDR_SPACINGDELTA_Y;
           }
 
-          _wpSetup(somSelf, "MENUITEMSELECTED=716");/* Change to icon view */          
+          _wpSetup(somSelf, "MENUITEMSELECTED=716");/* Change to icon view */
           _wpSetup(somSelf, "MENUITEMSELECTED=309");/* Arrange */
 
           WinEnableWindowUpdate(hwndContainer, TRUE);
@@ -1056,8 +1061,8 @@
           return TRUE;
         }
     }/* if() */
-    return (MMFolder_parent_WPFolder_wpMenuItemSelected(somSelf, 
-                                                        hwndFrame, 
+    return (MMFolder_parent_WPFolder_wpMenuItemSelected(somSelf,
+                                                        hwndFrame,
                                                         ulMenuId));
 }
 
@@ -1065,7 +1070,7 @@
 /*
  *wpSetup:override;
  */
-SOM_Scope void  SOMLINK mmfldr_wpObjectReady(MMFolder *somSelf, 
+SOM_Scope void  SOMLINK mmfldr_wpObjectReady(MMFolder *somSelf,
                                              ULONG ulCode, WPObject* refObject)
 {
     MMFolderData *somThis = MMFolderGetData(somSelf);
@@ -1094,16 +1099,16 @@
             _ulCurrentSize=MMFLDR_DEFAULT_ICONSIZE;
 
           /* If no ID result is NULL */
-          psz=_wpQueryObjectID(somSelf);          
+          psz=_wpQueryObjectID(somSelf);
           if(psz && !stricmp(psz, "<MMPM2_MMFOLDERTEMPLATE>")) {
             /* When the template is created wpRestoreData() isn't called so we don't have
                the address of the instance data containing grid spacing and view. So
                we force the object to save the instance data and in wpSaveData we
                finally get the right addresses to change the object view to gridded. */
-            
+
             _wpSaveImmediate(somSelf);
             /* Set default view to gridded */
-            
+
             if(_pFldrLongArray!=NULLHANDLE) {
               *_pFldrLongArray=0x80;
               //DosBeep(100, 200);
@@ -1114,7 +1119,7 @@
               /* FIXME: Use fontsize */
               *(_pulGridSpacing--)=_ulCurrentSize+MMFLDR_SPACINGDELTA_Y;
             }
-            
+
           }
           break;
         }
@@ -1131,7 +1136,7 @@
     MMFolderData *somThis = MMFolderGetData(somSelf);
     MMFolderMethodDebug("MMFolder","mmfldr_wpSetup");
 
-    bufferSize=sizeof(buffer); 
+    bufferSize=sizeof(buffer);
     if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMTHUMBSIZE, buffer, &bufferSize))
       {
         PVIEWITEM pViewItem;
@@ -1174,8 +1179,8 @@
             pViewItem;
             pViewItem=_wpFindViewItem(somSelf,VIEW_CONTENTS|VIEW_TREE|VIEW_DETAILS, pViewItem))
           {
-            _wpMenuItemSelected(somSelf, 
-                                pViewItem->handle, 
+            _wpMenuItemSelected(somSelf,
+                                pViewItem->handle,
                                 ulMenuId);
           }
       }
@@ -1183,7 +1188,7 @@
 }
 
 
-SOM_Scope BOOL  SOMLINK mmfldrM_wpclsCreateDefaultTemplates(M_MMFolder *somSelf, 
+SOM_Scope BOOL  SOMLINK mmfldrM_wpclsCreateDefaultTemplates(M_MMFolder *somSelf,
                                                             WPObject* Folder)
 {
   char chrSetup[sizeof(MMFLDR_TEMPLATE_SETUP)+1];
@@ -1199,7 +1204,7 @@
   sprintf(chrSetup, MMFLDR_TEMPLATE_SETUP);
   wpFolder=_wpclsQueryFolder(somSelf, MMTEMPLATE_FOLDER_ID, FALSE);
   _wpclsNew(somSelf, _wpclsQueryTitle(somSelf), chrSetup, wpFolder,FALSE);
-  
+
   return TRUE;
 }
 
@@ -1218,7 +1223,7 @@
 }
 
 
-SOM_Scope ULONG  SOMLINK mmfldrM_wpclsQueryIconData(M_MMFolder *somSelf, 
+SOM_Scope ULONG  SOMLINK mmfldrM_wpclsQueryIconData(M_MMFolder *somSelf,
                                                     PICONINFO pIconInfo)
 {
   HMODULE hmod;
@@ -1240,8 +1245,8 @@
 }
 
 
-SOM_Scope ULONG  SOMLINK mmfldrM_wpclsQueryIconDataN(M_MMFolder *somSelf, 
-                                                     ICONINFO* pIconInfo, 
+SOM_Scope ULONG  SOMLINK mmfldrM_wpclsQueryIconDataN(M_MMFolder *somSelf,
+                                                     ICONINFO* pIconInfo,
                                                      ULONG ulIconIndex)
 {
   HMODULE hmod;
