Ignore:
Timestamp:
Nov 29, 2023, 5:59:34 PM (21 months ago)
Author:
gyoung
Message:

Merge Lar's 2.9 branch into the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mediafolder/c/m3ufolder/m3ufolderoverriddenwpmethods.cpp

    r2 r133  
    11/*
    22 * This file is (C) Chris Wohlgemuth 2002-2003
    3  * 
     3 *
    44 * It's part of the Media-Folder distribution
    55 */
     
    3333extern ULONG ulQWL_LEFTCTRLHWND;
    3434
    35 #if 0
    36 /* For calling the method in the MMAudio class. Linking to the DLL would require the
    37    new audio classes. By dynamically querying the method the media folder works without
    38    installing the audio classes. */ 
    39 typedef ULONG   SOMLINK somTP_MMCDTrack_cwmmQueryTrackInfo(MMCDTrack *somSelf,
    40                 char** chrString,
    41                 ULONG ulSize,
    42                 int iWhich);
    43 typedef somTP_MMCDTrack_cwmmQueryTrackInfo *somTD_MMCDTrack_cwmmQueryTrackInfo;
    44 extern somTD_MMCDTrack_cwmmQueryTrackInfo methodPtrCDTrack;
    45 #endif
    46 
    4735extern LOADEDBITMAP allBMPs[];
    4836extern PFNWP pfnwpGenericFrame;
     
    7058//void HlpWriteToTrapLog(const char* chrFormat, ...);
    7159
    72 #if 0
    73 void _Optlink rexxThreadFunc (void *arg)
    74 {
    75   HAB  hab;
    76   HMQ  hmq;
    77   QMSG qmsg;
    78   CWM3UFolder *thisPtr;
    79   HWND hwnd;
    80 #if 0
    81   char chrFileName[CCHMAXPATH];
    82   char chrFolderName[CCHMAXPATH];
    83   char chrRexxScript[CCHMAXPATH];
    84 #endif
    85   char *chrFileName;
    86   char *chrFolderName;
    87   char *chrRexxScript;
    88   ULONG ulSize;
    89 
    90   thisPtr=(CWM3UFolder*)arg;   
    91   if(!somIsObj(thisPtr))
    92     return;
    93 
    94   if(!somIsObj(thisPtr->wpObjM3UFile))
    95     return;
    96 
    97   chrFileName=thisPtr->wpAllocMem( CCHMAXPATH*3+10 , &ulSize);
    98   if(!chrFileName)
    99     return;
    100  
    101   chrFolderName=chrFileName+CCHMAXPATH+1;
    102   chrRexxScript=chrFolderName+CCHMAXPATH+1;
    103 
    104   ulSize=CCHMAXPATH;
    105   if(!((WPFileSystem*)thisPtr->wpObjM3UFile)->wpQueryRealName(chrFileName, &ulSize, TRUE))
    106     return;
    107  
    108   ulSize=CCHMAXPATH;
    109   if(!thisPtr->wpQueryRealName(chrFolderName, &ulSize, TRUE))
    110     return;
    111 
    112   hab=WinInitialize(0);
    113   if(hab) {
    114     hmq=WinCreateMsgQueue(hab,0);
    115     if(hmq) {     
    116       RXSTRING arg[2];                    /* argument string for REXX  */
    117       RXSTRING rexxretval;                /* return value from REXX    */
    118       APIRET   rc;                        /* return code from REXX     */
    119       SHORT    rexxrc = 0;                /* return code from function */
    120      
    121      
    122       sprintf(chrRexxScript,"%s%s",  chrInstallDir,RX_INSERT_PLAYLISTTRACKS);
    123       //HlpWriteToTrapLog("chrRexxScript: %s\n", chrRexxScript);
    124       /* By setting the strlength of the output RXSTRING to zero, we   */
    125       /* force the interpreter to allocate memory and return it to us. */
    126       /* We could provide a buffer for the interpreter to use instead. */
    127       rexxretval.strlength = 0L;          /* initialize return to empty*/
    128      
    129       MAKERXSTRING(arg[0], chrFileName, strlen(chrFileName));/* create input argument     */
    130       MAKERXSTRING(arg[1], chrFolderName, strlen(chrFolderName));/* create input argument     */             
    131      
    132       TRY_LOUD(RX_START) {
    133         /* Here we call the interpreter.  We don't really need to use    */
    134         /* all the casts in this call; they just help illustrate         */
    135         /* the data types used.                                          */
    136         rc=RexxStart((LONG)       2,             /* number of arguments   */
    137                      (PRXSTRING)  &arg,          /* array of arguments    */
    138                      (PSZ)        chrRexxScript,/* name of REXX file     */
    139                      //   (PSZ)        "H:\\cwmm\\mediafolder\\beep.cmd",/* name of REXX file     */
    140                      (PRXSTRING)  0,             /* No INSTORE used       */
    141                      (PSZ)        "CWRXX",         /* Command env. name     */
    142                      (LONG)       RXSUBROUTINE,  /* Code for how invoked  */
    143                      (PRXSYSEXIT) 0,             /* No EXITs on this call */
    144                      (PSHORT)     &rexxrc,       /* Rexx program output   */
    145                      (PRXSTRING)  &rexxretval ); /* Rexx program output   */
    146        
    147         if(rc) {
    148           sprintf(chrFileName,"Error in the Rexx skript %s\n\n Get more information with 'help REX%04d'.\n",
    149                   "", rc*-1);
    150           WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrFileName, "", 1234, MB_OK|MB_MOVEABLE|MB_ERROR);
    151         }
    152         DosFreeMem(rexxretval.strptr);          /* Release storage given to us by REXX.  */     
    153       }
    154       CATCH(RX_START)
    155         {}END_CATCH;
    156                
    157         WinDestroyMsgQueue(hmq);
    158     }
    159     WinTerminate(hab);
    160   }
    161   thisPtr->fContentsChanged=FALSE;
    162   thisPtr->wpFreeMem((PBYTE)chrFileName);
    163 }
    164 
    165 BOOL CWM3UFolder::wpSetup(PSZ pSetupString)
    166 {
    167   /**************************************************
    168    *                                                *
    169    *                                                *
    170    **************************************************/
    171   char buffer[25];
    172   ULONG bufferSize;
    173 
    174   /* Set object window HWND */
    175   bufferSize=sizeof(buffer);
    176   if(wpScanSetupString(pSetupString, "M3UOBJECTWINDOW", buffer,&bufferSize))
    177     {
    178       hwndObject=atol(buffer);
    179     }
    180 
    181   /* Set object pointer to M3U-File */
    182   bufferSize=sizeof(buffer);
    183   if(wpScanSetupString(pSetupString, "M3UOBJECTHANDLE", buffer,&bufferSize))
    184     {
    185       WPObject *wpObject;
    186 
    187       wpObjM3UFile=NULLHANDLE;
    188       wpObject=(WPObject*)atol(buffer);
    189       if(somIsObj(wpObject))
    190         wpObjM3UFile=wpObject;
    191     }
    192 
    193 
    194   /* FIXME: Use immediate parent here !!!! */
    195   return CWMediaFolder::wpSetup(pSetupString);
    196 }
    197 #endif
    198 
    19960/*****************************************************/
    20061/*                                                   */
     
    20364/*                                                   */
    20465/*****************************************************/
    205 MRESULT EXPENTRY m3uFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
     66MRESULT EXPENTRY m3uFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    20667{
    20768  CWMediaFolder* thisPtr;
     
    272133/*                                                                          */
    273134/****************************************************************************/
    274 MRESULT EXPENTRY m3uTopCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
    275 {
    276    
     135MRESULT EXPENTRY m3uTopCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     136{
     137
    277138  switch(msg)
    278139    {
     
    284145        ULONG ulStyle;
    285146        SWP swp;
    286        
     147
    287148        WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
    288149        WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp);
     
    299160      WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT));
    300161      return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),msg,mp1,mp2);
    301      
     162
    302163      /*****************************************************/
    303164      /* Paint the background.                             */
     
    321182          ptl.x=lTemp*rclSource.xRight;
    322183          lTemp=rcl.yBottom/rclSource.yTop;
    323           lTemp*=rclSource.yTop;   
     184          lTemp*=rclSource.yTop;
    324185          while(ptl.x<rcl.xRight) {
    325186            ptl.y=lTemp;
    326187            while(ptl.y<rcl.yTop) {/* y direction */
    327188              WinDrawBitmap(hps, allBMPs[CTRLIDX_BOTTOM].hbm,
    328                             &rclSource, 
     189                            &rclSource,
    329190                            (PPOINTL)&ptl,
    330191                            0, 0,
     
    332193              ptl.y+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cy;
    333194            };
    334             ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx; 
     195            ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx;
    335196          };
    336197          WinEndPaint(hps);
     
    351212        rclSource.xRight=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cx;
    352213        WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPLEFT].hbm,
    353                       &rclSource, 
     214                      &rclSource,
    354215                      (PPOINTL)&rclSave,
    355216                      0, 0,
     
    364225        rclSource.xRight=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx;
    365226        WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPRIGHT].hbm,
    366                       &rclSource, 
     227                      &rclSource,
    367228                      (PPOINTL)&rclSave,
    368229                      0, 0,
     
    386247 *                                                          *
    387248************************************************************/
    388 MRESULT EXPENTRY m3uFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
     249MRESULT EXPENTRY m3uFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    389250{
    390251  CWM3UFolder* thisPtr;
     
    419280#endif
    420281              case 0x2d1: /* View menu */
    421                 /* Remove change to Tree from menubar menu */ 
     282                /* Remove change to Tree from menubar menu */
    422283                WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(717,TRUE),0);
    423284                /* Icon view */
     
    462323          case ID_MENUITEMEXIT:
    463324            WinPostMsg(hwnd, WM_CLOSE, 0, 0);
    464             return MRFALSE; 
     325            return MRFALSE;
    465326          case ID_MENUITEMSAVE:
    466327            {
     
    472333                  }
    473334                }
    474               return MRFALSE; 
     335              return MRFALSE;
    475336            }
    476337          default:
    477             if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) { 
     338            if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) {
    478339              BOOL bHandled=FALSE;
    479              
     340
    480341              TRY_LOUD(AF_MENU) {
    481342#if 0
     
    484345                    thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
    485346                    if(somIsObj(thisPtr)) {
    486                      
     347
    487348                      CWMenuFolder * wpFolder; 
    488349                      HOBJECT hObject;
     
    490351                      somTD_CWMenuFolder_mfCheckSkriptMenuItems methodPtr;
    491352                      M_WPObject *m_wpObject;
    492                      
     353
    493354                      if(!bHandled)
    494355                        bHandled=thisPtr->cwCheckUserMenuItems(USERMENUFOLDER_MEDIAFOLDER , SHORT1FROMMP(mp1));
     
    557418
    558419  /* Reregister wpFolder window class on first opening */
    559   /* We need this private code to have some private 
     420  /* We need this private code to have some private
    560421     window words */
    561422  if(!g_fRegisteredWindowClass)
    562423    {
    563424      CLASSINFO ci;
    564      
     425
    565426      if(WinQueryClassInfo(WinQueryAnchorBlock(HWND_DESKTOP),
    566427                           (PSZ)"wpFolder window",
     
    589450  /* Skip media folder. Because of this skip we had to register the window words here (see above).
    590451     It's not asured a Mediafolder was already opended. Normaly the window words are added in
    591      wpOpen() of the Mediafolder. 
     452     wpOpen() of the Mediafolder.
    592453     FIXME: This only works if CWProgFolder->CWMediaFolder->CWM3UFolder is the class hierarchy */
    593454  hwnd=CWProgFolder::wpOpen(hwndCnr, ulView, ulParam);
    594455
    595456  /* Only subclass folder frames, not settings notebooks */
    596   if(ulView!=OPEN_SETTINGS){   
     457  if(ulView!=OPEN_SETTINGS){
    597458    if(!hResource) {
    598459      errorResource();
     
    604465      ULONG ulErr;
    605466
    606       /* Remove the title added by XWP */
    607       WinSetWindowText(hwnd, wpObjM3UFile->wpQueryTitle());
     467          if (somIsObj(wpObjM3UFile)) {
     468         /* Remove the title added by XWP */
     469         WinSetWindowText(hwnd, wpObjM3UFile->wpQueryTitle());
     470      }
    608471      if(!getMessage(text, IDSTR_PLAYLISTVIEWTITLE, sizeof(text), queryResModuleHandle(), HWND_DESKTOP))
    609472        sprintf(text, "Playlist Editor");
     
    624487        /* Menu bar found */
    625488
    626         /* Remove folder item from menubar menu */ 
     489        /* Remove folder item from menubar menu */
    627490        WinSendMsg( myFrameCtrlHWND, MM_REMOVEITEM, MPFROM2SHORT(0x2cf,TRUE),0);
    628491
     
    633496        mi.afStyle=MIS_TEXT|MIS_SUBMENU;
    634497        mi.id=ID_MENUFILE;
    635         mi.afAttribute=NULL;               
     498        mi.afAttribute=NULL;
    636499        mi.hwndSubMenu=hwndMenu;
    637500        mi.hItem=NULL;
     
    640503        getMessage(text, IDSTR_MENUFILE,sizeof(text), hResource, hwnd);
    641504        WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi),
    642                    (MPARAM)text); 
     505                   (MPARAM)text);
    643506
    644507        /* Insert skript and user menu item if necessary */
     
    675538            iItemCount=(int)WinSendMsg(myFrameCtrlHWND,MM_QUERYITEMCOUNT,(MPARAM)0,
    676539                                       (MPARAM)0);
    677            
     540
    678541            /* Fill the MENUITEM structure */
    679542            mi.iPosition=iItemCount-1;
    680543            mi.afStyle=MIS_TEXT|MIS_SUBMENU;
    681544            mi.id=ID_MBMENUSKRIPTS;
    682             mi.afAttribute=NULL;               
     545            mi.afAttribute=NULL;
    683546            mi.hwndSubMenu=hwndMenu;
    684547            mi.hItem=NULL;
     
    687550            getMessage(text, IDSTR_MENUSKRIPTS,sizeof(text), hResource, hwnd);
    688551            WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi),
    689                        (MPARAM)text); 
     552                       (MPARAM)text);
    690553          }/* end of if(hwndMenu) */
    691554        }
     
    700563         the procedure saves this pointer for later use. */
    701564      myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd, m3uTopCtrlDialogProc,hResource,IDDLG_TOPFRAME ,this);
    702       /* Save the HWND in the instance data */   
     565      /* Save the HWND in the instance data */
    703566      //      hwndTop=myFrameCtrlHWND;
    704       /* Save the HWND in the Window words */   
    705       WinSetWindowULong( hwnd, ulQWL_TOPCTRLHWND, myFrameCtrlHWND); 
    706    
     567      /* Save the HWND in the Window words */
     568      WinSetWindowULong( hwnd, ulQWL_TOPCTRLHWND, myFrameCtrlHWND);
     569
    707570      if(myFrameCtrlHWND){
    708571        /* Query the size of the dialog */
     
    712575        //        sizel.cy=rectl.yTop-rectl.yBottom;
    713576        sizel.cy=12;
    714         /* Call a method of CWProgFolder to add the dialog as a framecontrol. 
     577        /* Call a method of CWProgFolder to add the dialog as a framecontrol.
    715578           FCTL_TOP means put it at the top of the folder.
    716579           After calling cwUpdateFrame(hwnd) it will be visible */
     
    722585         the procedure saves this pointer for later use. */
    723586      myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,leftCtrlDialogProc,hResource,IDDLG_LEFTFRAME ,this);
    724       /* Save the HWND in the instance data */   
     587      /* Save the HWND in the instance data */
    725588      //    hwndLeft=myFrameCtrlHWND;
    726       /* Save the HWND in the Window words */   
     589      /* Save the HWND in the Window words */
    727590      WinSetWindowULong( hwnd, ulQWL_LEFTCTRLHWND, myFrameCtrlHWND);
    728        
    729    
     591
     592
    730593      if(myFrameCtrlHWND){
    731594        /* Query the size of the dialog */
     
    734597        sizel.cx=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx-1-7-2;//rectl.xRight-rectl.xLeft;
    735598        //  sizel.cx=rectl.xRight-rectl.xLeft;
    736         /* Call a method of CWProgFolder to add the dialog as a framecontrol. 
     599        /* Call a method of CWProgFolder to add the dialog as a framecontrol.
    737600           FCTL_RIGHT means put it at the RIGHT of the folder.
    738601           After calling cwUpdateFrame(hwnd) it will be visible */
     
    744607         the procedure saves this pointer for later use. */
    745608      myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,rightCtrlDialogProc,hResource,IDDLG_FRAMERIGHT ,this);
    746       /* Save the HWND in the instance data */   
     609      /* Save the HWND in the instance data */
    747610      //      hwndRight=myFrameCtrlHWND;
    748       /* Save the HWND in the Window words */   
     611      /* Save the HWND in the Window words */
    749612      WinSetWindowULong( hwnd, ulQWL_RIGHTCTRLHWND, myFrameCtrlHWND);
    750      
     613
    751614      if(myFrameCtrlHWND){
    752615        CNRINFO cnrInfo;
    753         HWND hwndContainer; 
     616        HWND hwndContainer;
    754617        PVIEWITEM pView;
    755618
     
    758621        /* It's the right dialog so we need the width but not the height. */
    759622        sizel.cx=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx-1-7-2;// rectl.xRight-rectl.xLeft;
    760         /* Call a method of CWProgFolder to add the dialog as a framecontrol. 
     623        /* Call a method of CWProgFolder to add the dialog as a framecontrol.
    761624           FCTL_RIGHT means put it at the RIGHT of the folder.
    762625           After calling cwUpdateFrame(hwnd) it will be visible */
    763626        cwAddFrameCtl(hwnd, myFrameCtrlHWND, sizel, FCTL_RIGHT, FCTL_POSABOVE|FCTL_POSBELOW);
    764        
     627
    765628        //        hwndContainer=WinWindowFromID(myFrameCtrlHWND, IDCNR_PLAYLIST);
    766629        //  WinSendMsg(hwndContainer,CM_QUERYCNRINFO, MPFROMP(&cnrInfo),
     
    772635         the procedure saves this pointer for later use. */
    773636      myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,bottomCtrlDialogProc,hResource,IDDLG_BOTTOMFRAME ,this);
    774       /* Save the HWND in the instance data */   
    775       hwndBottom=myFrameCtrlHWND;           
    776       /* Save the HWND in the Window words */   
     637      /* Save the HWND in the instance data */
     638      hwndBottom=myFrameCtrlHWND;
     639      /* Save the HWND in the Window words */
    777640      WinSetWindowULong( hwnd, ulQWL_BOTTOMCTRLHWND, myFrameCtrlHWND);
    778641
     
    783646        sizel.cy=rectl.yTop-rectl.yBottom-2;
    784647        //    sizel.cy=allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cy;
    785         /* Call a method of CWProgFolder to add the dialog as a framecontrol. 
     648        /* Call a method of CWProgFolder to add the dialog as a framecontrol.
    786649           FCTL_TOP means put it at the top of the folder.
    787650           After calling cwUpdateFrame(hwnd) it will be visible */
     
    810673        SysWriteToTrapLog("\nTrap occured in %s, file: %s above line %d.\n",
    811674                          __FUNCTION__, __FILE__, __LINE__);
    812        
    813       } END_CATCH;   
     675
     676      } END_CATCH;
    814677
    815678      /* Make sure on open the container is visible */
     
    825688  fContentsChanged=TRUE;
    826689  return CWMediaFolder::wpDeleteFromContent(Object);
    827 }
    828 
    829 MRESULT CWM3UFolder::wpDrop(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem)
    830 {
    831   return CWMediaFolder::wpDrop(hwndCnr, pDragInfo, pDragItem);
    832690}
    833691
     
    847705    return;
    848706
    849   thisPtr=(CWM3UFolder*)parms->thisPtr;   
     707  thisPtr=(CWM3UFolder*)parms->thisPtr;
    850708  if(!somIsObj(thisPtr))
    851709    return;
     
    862720    hmq=WinCreateMsgQueue(hab,0);
    863721    if(hmq) {
    864       FILE* fStream;     
     722      FILE* fStream;
    865723
    866724      if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), parms->hwndCnr))
     
    894752                    else
    895753                      break;/* Error */
    896                                        
     754
    897755                    /* Get the name of the audio file */
    898756                    ulSize=sizeof(chrFileName);
     
    906764                  break;
    907765                }/* for() */
    908             }/* fopen() */   
     766            }/* fopen() */
    909767          fclose(fStream);
    910768        }
     
    918776    /* Close and destroy the folder if requested */
    919777    WinPostMsg(parms->hwndFrame, WM_CLOSE, 0, 0);
    920     if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), thisPtr->hwndObject)) 
     778    if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), thisPtr->hwndObject))
    921779      WinPostMsg(thisPtr->hwndObject, WM_APPTERMINATENOTIFY, 0, 0);
    922780  }
     
    968826                           title, IDSTR_CLOSETITLE, sizeof(title),
    969827                           queryResModuleHandle(),
    970                            HWND_DESKTOP, 
     828                           HWND_DESKTOP,
    971829                           MB_YESNOCANCEL|MB_MOVEABLE|MB_ICONQUESTION))==MBID_CANCEL)
    972830      return FALSE;
Note: See TracChangeset for help on using the changeset viewer.