Index: /branches/v2.9_Lars/mediafolder/c/m3ufolder/m3ufolderoverriddenwpmethods.cpp
===================================================================
--- /branches/v2.9_Lars/mediafolder/c/m3ufolder/m3ufolderoverriddenwpmethods.cpp	(revision 119)
+++ /branches/v2.9_Lars/mediafolder/c/m3ufolder/m3ufolderoverriddenwpmethods.cpp	(revision 120)
@@ -1,5 +1,5 @@
 /*
  * This file is (C) Chris Wohlgemuth 2002-2003
- * 
+ *
  * It's part of the Media-Folder distribution
  */
@@ -32,16 +32,4 @@
 extern ULONG ulQWL_RIGHTCTRLHWND;
 extern ULONG ulQWL_LEFTCTRLHWND;
-
-#if 0 
-/* For calling the method in the MMAudio class. Linking to the DLL would require the
-   new audio classes. By dynamically querying the method the media folder works without
-   installing the audio classes. */  
-typedef ULONG   SOMLINK somTP_MMCDTrack_cwmmQueryTrackInfo(MMCDTrack *somSelf,
-		char** chrString,
-		ULONG ulSize,
-		int iWhich);
-typedef somTP_MMCDTrack_cwmmQueryTrackInfo *somTD_MMCDTrack_cwmmQueryTrackInfo;
-extern somTD_MMCDTrack_cwmmQueryTrackInfo methodPtrCDTrack;
-#endif
 
 extern LOADEDBITMAP allBMPs[];
@@ -88,5 +76,5 @@
   ULONG ulSize;
 
-  thisPtr=(CWM3UFolder*)arg;   
+  thisPtr=(CWM3UFolder*)arg;
   if(!somIsObj(thisPtr))
     return;
@@ -98,5 +86,5 @@
   if(!chrFileName)
     return;
-  
+
   chrFolderName=chrFileName+CCHMAXPATH+1;
   chrRexxScript=chrFolderName+CCHMAXPATH+1;
@@ -105,5 +93,5 @@
   if(!((WPFileSystem*)thisPtr->wpObjM3UFile)->wpQueryRealName(chrFileName, &ulSize, TRUE))
     return;
-  
+
   ulSize=CCHMAXPATH;
   if(!thisPtr->wpQueryRealName(chrFolderName, &ulSize, TRUE))
@@ -113,11 +101,11 @@
   if(hab) {
     hmq=WinCreateMsgQueue(hab,0);
-    if(hmq) {      
+    if(hmq) {
       RXSTRING arg[2];                    /* argument string for REXX  */
       RXSTRING rexxretval;                /* return value from REXX    */
       APIRET   rc;                        /* return code from REXX     */
       SHORT    rexxrc = 0;                /* return code from function */
-      
-      
+
+
       sprintf(chrRexxScript,"%s%s",  chrInstallDir,RX_INSERT_PLAYLISTTRACKS);
       //HlpWriteToTrapLog("chrRexxScript: %s\n", chrRexxScript);
@@ -126,8 +114,8 @@
       /* We could provide a buffer for the interpreter to use instead. */
       rexxretval.strlength = 0L;          /* initialize return to empty*/
-      
+
       MAKERXSTRING(arg[0], chrFileName, strlen(chrFileName));/* create input argument     */
-      MAKERXSTRING(arg[1], chrFolderName, strlen(chrFolderName));/* create input argument     */              
-      
+      MAKERXSTRING(arg[1], chrFolderName, strlen(chrFolderName));/* create input argument     */
+
       TRY_LOUD(RX_START) {
         /* Here we call the interpreter.  We don't really need to use    */
@@ -144,15 +132,15 @@
                      (PSHORT)     &rexxrc,       /* Rexx program output   */
                      (PRXSTRING)  &rexxretval ); /* Rexx program output   */
-        
+
         if(rc) {
-          sprintf(chrFileName,"Error in the Rexx skript %s\n\n Get more information with 'help REX%04d'.\n", 
+          sprintf(chrFileName,"Error in the Rexx skript %s\n\n Get more information with 'help REX%04d'.\n",
                   "", rc*-1);
           WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrFileName, "", 1234, MB_OK|MB_MOVEABLE|MB_ERROR);
         }
-        DosFreeMem(rexxretval.strptr);          /* Release storage given to us by REXX.  */      
+        DosFreeMem(rexxretval.strptr);          /* Release storage given to us by REXX.  */
       }
       CATCH(RX_START)
         {}END_CATCH;
-               
+
         WinDestroyMsgQueue(hmq);
     }
@@ -160,5 +148,5 @@
   }
   thisPtr->fContentsChanged=FALSE;
-  thisPtr->wpFreeMem((PBYTE)chrFileName); 
+  thisPtr->wpFreeMem((PBYTE)chrFileName);
 }
 
@@ -203,5 +191,5 @@
 /*                                                   */
 /*****************************************************/
-MRESULT EXPENTRY m3uFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
+MRESULT EXPENTRY m3uFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
   CWMediaFolder* thisPtr;
@@ -272,7 +260,7 @@
 /*                                                                          */
 /****************************************************************************/
-MRESULT EXPENTRY m3uTopCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
-{
-    
+MRESULT EXPENTRY m3uTopCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
+{
+
   switch(msg)
     {
@@ -284,5 +272,5 @@
         ULONG ulStyle;
         SWP swp;
-        
+
         WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
         WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp);
@@ -299,5 +287,5 @@
       WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT));
       return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),msg,mp1,mp2);
-      
+
       /*****************************************************/
       /* Paint the background.                             */
@@ -321,10 +309,10 @@
           ptl.x=lTemp*rclSource.xRight;
           lTemp=rcl.yBottom/rclSource.yTop;
-          lTemp*=rclSource.yTop;   
+          lTemp*=rclSource.yTop;
           while(ptl.x<rcl.xRight) {
             ptl.y=lTemp;
             while(ptl.y<rcl.yTop) {/* y direction */
               WinDrawBitmap(hps, allBMPs[CTRLIDX_BOTTOM].hbm,
-                            &rclSource, 
+                            &rclSource,
                             (PPOINTL)&ptl,
                             0, 0,
@@ -332,5 +320,5 @@
               ptl.y+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cy;
             };
-            ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx; 
+            ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx;
           };
           WinEndPaint(hps);
@@ -351,5 +339,5 @@
         rclSource.xRight=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cx;
         WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPLEFT].hbm,
-                      &rclSource, 
+                      &rclSource,
                       (PPOINTL)&rclSave,
                       0, 0,
@@ -364,5 +352,5 @@
         rclSource.xRight=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx;
         WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPRIGHT].hbm,
-                      &rclSource, 
+                      &rclSource,
                       (PPOINTL)&rclSave,
                       0, 0,
@@ -386,5 +374,5 @@
  *                                                          *
 ************************************************************/
-MRESULT EXPENTRY m3uFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
+MRESULT EXPENTRY m3uFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
   CWM3UFolder* thisPtr;
@@ -419,5 +407,5 @@
 #endif
               case 0x2d1: /* View menu */
-                /* Remove change to Tree from menubar menu */ 
+                /* Remove change to Tree from menubar menu */
                 WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(717,TRUE),0);
                 /* Icon view */
@@ -462,5 +450,5 @@
           case ID_MENUITEMEXIT:
             WinPostMsg(hwnd, WM_CLOSE, 0, 0);
-            return MRFALSE; 
+            return MRFALSE;
           case ID_MENUITEMSAVE:
             {
@@ -472,10 +460,10 @@
                   }
                 }
-              return MRFALSE; 
+              return MRFALSE;
             }
           default:
-            if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) { 
+            if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) {
               BOOL bHandled=FALSE;
-              
+
               TRY_LOUD(AF_MENU) {
 #if 0
@@ -484,5 +472,5 @@
                     thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
                     if(somIsObj(thisPtr)) {
-                      
+
                       CWMenuFolder * wpFolder;	
                       HOBJECT hObject;
@@ -490,5 +478,5 @@
                       somTD_CWMenuFolder_mfCheckSkriptMenuItems methodPtr;
                       M_WPObject *m_wpObject;
-                      
+
                       if(!bHandled)
                         bHandled=thisPtr->cwCheckUserMenuItems(USERMENUFOLDER_MEDIAFOLDER , SHORT1FROMMP(mp1));
@@ -557,10 +545,10 @@
 
   /* Reregister wpFolder window class on first opening */
-  /* We need this private code to have some private 
+  /* We need this private code to have some private
      window words */
   if(!g_fRegisteredWindowClass)
     {
       CLASSINFO ci;
-      
+
       if(WinQueryClassInfo(WinQueryAnchorBlock(HWND_DESKTOP),
                            (PSZ)"wpFolder window",
@@ -589,10 +577,10 @@
   /* Skip media folder. Because of this skip we had to register the window words here (see above).
      It's not asured a Mediafolder was already opended. Normaly the window words are added in
-     wpOpen() of the Mediafolder. 
+     wpOpen() of the Mediafolder.
      FIXME: This only works if CWProgFolder->CWMediaFolder->CWM3UFolder is the class hierarchy */
   hwnd=CWProgFolder::wpOpen(hwndCnr, ulView, ulParam);
 
   /* Only subclass folder frames, not settings notebooks */
-  if(ulView!=OPEN_SETTINGS){    
+  if(ulView!=OPEN_SETTINGS){
     if(!hResource) {
       errorResource();
@@ -624,5 +612,5 @@
         /* Menu bar found */
 
-        /* Remove folder item from menubar menu */ 
+        /* Remove folder item from menubar menu */
         WinSendMsg( myFrameCtrlHWND, MM_REMOVEITEM, MPFROM2SHORT(0x2cf,TRUE),0);
 
@@ -633,5 +621,5 @@
         mi.afStyle=MIS_TEXT|MIS_SUBMENU;
         mi.id=ID_MENUFILE;
-        mi.afAttribute=NULL;                
+        mi.afAttribute=NULL;
         mi.hwndSubMenu=hwndMenu;
         mi.hItem=NULL;
@@ -640,5 +628,5 @@
         getMessage(text, IDSTR_MENUFILE,sizeof(text), hResource, hwnd);
         WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi),
-                   (MPARAM)text); 
+                   (MPARAM)text);
 
         /* Insert skript and user menu item if necessary */
@@ -675,10 +663,10 @@
             iItemCount=(int)WinSendMsg(myFrameCtrlHWND,MM_QUERYITEMCOUNT,(MPARAM)0,
                                        (MPARAM)0);
-            
+
             /* Fill the MENUITEM structure */
             mi.iPosition=iItemCount-1;
             mi.afStyle=MIS_TEXT|MIS_SUBMENU;
             mi.id=ID_MBMENUSKRIPTS;
-            mi.afAttribute=NULL;                
+            mi.afAttribute=NULL;
             mi.hwndSubMenu=hwndMenu;
             mi.hItem=NULL;
@@ -687,5 +675,5 @@
             getMessage(text, IDSTR_MENUSKRIPTS,sizeof(text), hResource, hwnd);
             WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi),
-                       (MPARAM)text); 
+                       (MPARAM)text);
           }/* end of if(hwndMenu) */
         }
@@ -700,9 +688,9 @@
          the procedure saves this pointer for later use. */
       myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd, m3uTopCtrlDialogProc,hResource,IDDLG_TOPFRAME ,this);
-      /* Save the HWND in the instance data */    
+      /* Save the HWND in the instance data */
       //      hwndTop=myFrameCtrlHWND;
-      /* Save the HWND in the Window words */    
-      WinSetWindowULong( hwnd, ulQWL_TOPCTRLHWND, myFrameCtrlHWND);  
-    
+      /* Save the HWND in the Window words */
+      WinSetWindowULong( hwnd, ulQWL_TOPCTRLHWND, myFrameCtrlHWND);
+
       if(myFrameCtrlHWND){
         /* Query the size of the dialog */
@@ -712,5 +700,5 @@
         //        sizel.cy=rectl.yTop-rectl.yBottom;
         sizel.cy=12;
-        /* Call a method of CWProgFolder to add the dialog as a framecontrol. 
+        /* Call a method of CWProgFolder to add the dialog as a framecontrol.
            FCTL_TOP means put it at the top of the folder.
            After calling cwUpdateFrame(hwnd) it will be visible */
@@ -722,10 +710,10 @@
          the procedure saves this pointer for later use. */
       myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,leftCtrlDialogProc,hResource,IDDLG_LEFTFRAME ,this);
-      /* Save the HWND in the instance data */    
+      /* Save the HWND in the instance data */
       //    hwndLeft=myFrameCtrlHWND;
-      /* Save the HWND in the Window words */    
+      /* Save the HWND in the Window words */
       WinSetWindowULong( hwnd, ulQWL_LEFTCTRLHWND, myFrameCtrlHWND);
-        
-    
+
+
       if(myFrameCtrlHWND){
         /* Query the size of the dialog */
@@ -734,5 +722,5 @@
         sizel.cx=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx-1-7-2;//rectl.xRight-rectl.xLeft;
         //  sizel.cx=rectl.xRight-rectl.xLeft;
-        /* Call a method of CWProgFolder to add the dialog as a framecontrol. 
+        /* Call a method of CWProgFolder to add the dialog as a framecontrol.
            FCTL_RIGHT means put it at the RIGHT of the folder.
            After calling cwUpdateFrame(hwnd) it will be visible */
@@ -744,12 +732,12 @@
          the procedure saves this pointer for later use. */
       myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,rightCtrlDialogProc,hResource,IDDLG_FRAMERIGHT ,this);
-      /* Save the HWND in the instance data */    
+      /* Save the HWND in the instance data */
       //      hwndRight=myFrameCtrlHWND;
-      /* Save the HWND in the Window words */    
+      /* Save the HWND in the Window words */
       WinSetWindowULong( hwnd, ulQWL_RIGHTCTRLHWND, myFrameCtrlHWND);
-     
+
       if(myFrameCtrlHWND){
         CNRINFO cnrInfo;
-        HWND hwndContainer; 
+        HWND hwndContainer;
         PVIEWITEM pView;
 
@@ -758,9 +746,9 @@
         /* It's the right dialog so we need the width but not the height. */
         sizel.cx=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx-1-7-2;// rectl.xRight-rectl.xLeft;
-        /* Call a method of CWProgFolder to add the dialog as a framecontrol. 
+        /* Call a method of CWProgFolder to add the dialog as a framecontrol.
            FCTL_RIGHT means put it at the RIGHT of the folder.
            After calling cwUpdateFrame(hwnd) it will be visible */
         cwAddFrameCtl(hwnd, myFrameCtrlHWND, sizel, FCTL_RIGHT, FCTL_POSABOVE|FCTL_POSBELOW);
-        
+
         //        hwndContainer=WinWindowFromID(myFrameCtrlHWND, IDCNR_PLAYLIST);
         //  WinSendMsg(hwndContainer,CM_QUERYCNRINFO, MPFROMP(&cnrInfo),
@@ -772,7 +760,7 @@
          the procedure saves this pointer for later use. */
       myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,bottomCtrlDialogProc,hResource,IDDLG_BOTTOMFRAME ,this);
-      /* Save the HWND in the instance data */    
-      hwndBottom=myFrameCtrlHWND;            
-      /* Save the HWND in the Window words */    
+      /* Save the HWND in the instance data */
+      hwndBottom=myFrameCtrlHWND;
+      /* Save the HWND in the Window words */
       WinSetWindowULong( hwnd, ulQWL_BOTTOMCTRLHWND, myFrameCtrlHWND);
 
@@ -783,5 +771,5 @@
         sizel.cy=rectl.yTop-rectl.yBottom-2;
         //    sizel.cy=allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cy;
-        /* Call a method of CWProgFolder to add the dialog as a framecontrol. 
+        /* Call a method of CWProgFolder to add the dialog as a framecontrol.
            FCTL_TOP means put it at the top of the folder.
            After calling cwUpdateFrame(hwnd) it will be visible */
@@ -810,6 +798,6 @@
         SysWriteToTrapLog("\nTrap occured in %s, file: %s above line %d.\n",
                           __FUNCTION__, __FILE__, __LINE__);
-        
-      } END_CATCH;    
+
+      } END_CATCH;
 
       /* Make sure on open the container is visible */
@@ -827,7 +815,61 @@
 }
 
-MRESULT CWM3UFolder::wpDrop(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem)
-{
-  return CWMediaFolder::wpDrop(hwndCnr, pDragInfo, pDragItem);
+MRESULT CWM3UFolder::wpDragOver(HWND hwndCnr,PDRAGINFO pDragInfo)
+{
+  ULONG ulNumberOfObjects;
+  WPObject *wpObject = NULL;  
+  USHORT usIndicator=DOR_NEVERDROP,usOp=0;
+
+  /* Get access to the dragInfo */
+  if (DrgAccessDraginfo(pDragInfo)) {
+      PDRAGITEM pDragItem = NULL;
+      M_CWMediaFolder *mediaFolderClass = NULL;
+
+     	/* Get number of items */
+     	ulNumberOfObjects = DrgQueryDragitemCount( pDragInfo);
+
+     	if(ulNumberOfObjects>1) {
+         usIndicator = DOR_NODROP;
+         usOp = 0;
+         goto quit;
+     	}
+
+      /* check if a WPS object was dropped, we do not accept anything else */
+      pDragItem = DrgQueryDragitemPtr(pDragInfo,0);
+      if (!DrgVerifyRMF(pDragItem,"DRM_OBJECT","DRF_OBJECT")) {
+         usIndicator = DOR_NEVERDROP;
+         usOp = 0;
+         goto quit;
+      } /* endif */
+
+      /*
+         refuse drop if WPS object pointer is not valid or if the object is
+         a descendant of MMCDTrack class (see Netlabs ticket #19)
+      */
+      wpObject = (WPObject *)OBJECT_FROM_PREC(pDragItem->ulItemID);
+      mediaFolderClass = (M_CWMediaFolder *)CWMediaFolder::__ClassObject;
+      if (!somIsObj(wpObject) || wpObject->somIsA(mediaFolderClass->MMCDTrackClass)) {
+         usIndicator = DOR_NEVERDROP;
+         usOp = 0;
+         goto quit;
+      } /* endif */
+
+     	switch(pDragInfo->usOperation)
+       {
+       case DO_DEFAULT:
+       case DO_LINK:
+         usIndicator = DOR_DROP;
+         usOp = DO_LINK;
+         break;
+      default:
+         usIndicator = DOR_NODROPOP;
+         usOp = DO_LINK;
+         break;
+       }
+quit:
+     /* Free the draginfo */
+     DrgFreeDraginfo(pDragInfo);
+  }
+  return MRFROM2SHORT(usIndicator,usOp);
 }
 
@@ -847,5 +889,5 @@
     return;
 
-  thisPtr=(CWM3UFolder*)parms->thisPtr;   
+  thisPtr=(CWM3UFolder*)parms->thisPtr;
   if(!somIsObj(thisPtr))
     return;
@@ -862,5 +904,5 @@
     hmq=WinCreateMsgQueue(hab,0);
     if(hmq) {
-      FILE* fStream;      
+      FILE* fStream;
 
       if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), parms->hwndCnr))
@@ -894,5 +936,5 @@
                     else
                       break;/* Error */
-                                        
+
                     /* Get the name of the audio file */
                     ulSize=sizeof(chrFileName);
@@ -906,5 +948,5 @@
                   break;
                 }/* for() */
-            }/* fopen() */   
+            }/* fopen() */
           fclose(fStream);
         }
@@ -918,5 +960,5 @@
     /* Close and destroy the folder if requested */
     WinPostMsg(parms->hwndFrame, WM_CLOSE, 0, 0);
-    if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), thisPtr->hwndObject)) 
+    if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), thisPtr->hwndObject))
       WinPostMsg(thisPtr->hwndObject, WM_APPTERMINATENOTIFY, 0, 0);
   }
@@ -968,5 +1010,5 @@
                            title, IDSTR_CLOSETITLE, sizeof(title),
                            queryResModuleHandle(),
-                           HWND_DESKTOP, 
+                           HWND_DESKTOP,
                            MB_YESNOCANCEL|MB_MOVEABLE|MB_ICONQUESTION))==MBID_CANCEL)
       return FALSE;
Index: /branches/v2.9_Lars/mediafolder/include/m3ufolder.hh
===================================================================
--- /branches/v2.9_Lars/mediafolder/include/m3ufolder.hh	(revision 119)
+++ /branches/v2.9_Lars/mediafolder/include/m3ufolder.hh	(revision 120)
@@ -28,5 +28,5 @@
   HWND hwndFrame;
   BOOL fSaveOnly;
-}M3UTHREADPARMS; 
+}M3UTHREADPARMS;
 
 #pragma SOMAsDefault(on)
@@ -48,5 +48,5 @@
   virtual BOOL wpclsQueryDefaultHelp(PULONG HelpPanelId,PSZ HelpLibrary);
   virtual BOOL wpclsCreateDefaultTemplates(WPObject * wpObject);
-  /*  
+  /*
   virtual void wpclsUnInitData();
 
@@ -76,5 +76,5 @@
   virtual ULONG wpFilterPopupMenu(ULONG ulFlags, HWND hwndCnr, BOOL fMultiSelect);
   virtual BOOL wpModifyPopupMenu(HWND hwndMenu, HWND hwndCnr, ULONG ulPosition);
-  virtual MRESULT wpDrop(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem);  
+  virtual MRESULT wpDragOver(HWND hwndCnr,PDRAGINFO pDragInfo);
 #if 0
   virtual BOOL wpRestoreState(ULONG ulReserved);
