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/mediafldr/mediafolder.cpp

    r57 r133  
    11/*
    22 * This file is (C) Chris Wohlgemuth 2002
    3  * 
     3 *
    44 * It's part of the Media-Folder distribution
    55 */
     
    6969  switch(ulAction)
    7070    {
    71     case PLAY_FIRST: 
     71    case PLAY_FIRST:
    7272      /* Send a message to the object window created by the folder play thread */
    7373      WinPostMsg(thisPtr->mfData->hwndPlayObject,WM_APPTERMINATENOTIFY, 0,MPFROMLONG(PLAY_FIRST));
     
    146146              thisPtr->cwSeekAudioFile(LONGFROMMP(mp1));
    147147              /* restart timer */
    148               //    WinStartTimer(WinQueryAnchorBlock(hwnd), WinWindowFromID(hwndFrame), IDTIMER_PLAY, PLAYTIMER_DELAY); 
     148              //    WinStartTimer(WinQueryAnchorBlock(hwnd), WinWindowFromID(hwndFrame), IDTIMER_PLAY, PLAYTIMER_DELAY);
    149149              thisPtr->ulPos=LONGFROMMP(mp1)/1000;
    150150            }
     
    192192      if(hwnd) {
    193193        thisPtr->mfData->hwndPlayObject=hwnd;
     194        WinSetWindowULong(hwnd, QWL_USER,(ULONG)tPt);
    194195        WinSubclassWindow(hwnd,&playObjectProc);
    195         WinSetWindowULong(hwnd, QWL_USER,(ULONG)tPt);
    196196        /* Window created. */
    197197        while(WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))
     
    225225    return;
    226226
    227   thisPtr=(CWMediaFolder*)threadParms->thisPtr;   
     227  thisPtr=(CWMediaFolder*)threadParms->thisPtr;
    228228
    229229  if(!somIsObj(thisPtr))
     
    247247  if(!((WPFileSystem*)thisPtr->wpObjM3UFile)->wpQueryRealName(chrFileName, &ulSize, TRUE))
    248248    return;
    249  
     249
    250250  /* Get name of folder */
    251251  ulSize=CCHMAXPATH;
     
    256256  if(hab) {
    257257    hmq=WinCreateMsgQueue(hab,0);
    258     if(hmq) {     
     258    if(hmq) {
    259259      RXSTRING arg[2];                    /* argument string for REXX  */
    260260      RXSTRING rexxretval;                /* return value from REXX    */
     
    266266      /* We could provide a buffer for the interpreter to use instead. */
    267267      rexxretval.strlength = 0L;          /* initialize return to empty*/
    268      
     268
    269269      MAKERXSTRING(arg[0], chrFileName, strlen(chrFileName));/* create input argument     */
    270       MAKERXSTRING(arg[1], chrFolderName, strlen(chrFolderName));/* create input argument     */             
    271      
     270      MAKERXSTRING(arg[1], chrFolderName, strlen(chrFolderName));/* create input argument     */
     271
    272272      TRY_LOUD(RX_START) {
    273273        /* Here we call the interpreter.  We don't really need to use    */
     
    285285                     (PSHORT)     &rexxrc,       /* Rexx program output   */
    286286                     (PRXSTRING)  &rexxretval ); /* Rexx program output   */
    287        
     287
    288288        if(rc) {
    289           sprintf(chrFileName,"Error in the Rexx skript %s\n\n Get more information with 'help REX%04d'.\n", 
     289          sprintf(chrFileName,"Error in the Rexx skript %s\n\n Get more information with 'help REX%04d'.\n",
    290290                  "", rc*-1);
    291291          WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrFileName, "", 1234, MB_OK|MB_MOVEABLE|MB_ERROR);
    292292        }
    293         DosFreeMem(rexxretval.strptr);          /* Release storage given to us by REXX.  */     
     293        DosFreeMem(rexxretval.strptr);          /* Release storage given to us by REXX.  */
    294294      }
    295295      CATCH(RX_START)
    296296        {}END_CATCH;
    297                
     297
    298298        WinDestroyMsgQueue(hmq);
    299299    }
     
    301301  }
    302302  //  thisPtr->fContentsChanged=FALSE;
    303   thisPtr->wpFreeMem((PBYTE)chrFileName); 
     303  thisPtr->wpFreeMem((PBYTE)chrFileName);
    304304  thisPtr->wpFreeMem((PBYTE)threadParms);
    305305}
     
    372372
    373373        WinSetWindowPos(hwndFrame, NULLHANDLE, swp2.x, swp2.y, swp2.cx,swp2.cy,SWP_SIZE|SWP_MOVE);
    374         /* 
     374        /*
    375375           By changing the to contents view we trick the WPS to show the 'Details view' menu item in
    376376           the view menu of the folders system menu. In that sub menu the WPS always inserts all known
     
    379379           The system knows nothing about the 'compact view' and all the handling is done by us.
    380380           As a side effect the folder position information for the details
    381            view isn't changed when the folder is closed in 'Compact view'. 
     381           view isn't changed when the folder is closed in 'Compact view'.
    382382           */
    383383        wpMenuItemSelected(hwndFrame, 0x2cc);
     
    419419                            ",", chrBuf, sizeof(chrBuf));
    420420      chrBuf[sizeof(chrBuf)-1]=0;
    421      
     421
    422422      if(mfData->ulTotalTime<=3600) {
    423423        getMessage( text, IDSTR_STATUSTIME1, sizeof(text), queryResModuleHandle(), HWND_DESKTOP);
     
    432432        sprintf(time, text, mfData->ulTotalTime/(3600*24),
    433433                (mfData->ulTotalTime%(3600*24))/3600,  (mfData->ulTotalTime%3600)/60, mfData->ulTotalTime%60);
    434       }     
     434      }
    435435      if(mfData->ulSize<=0xffffffff) {
    436436        getMessage( text2, IDSTR_STATUSTIME4, sizeof(text2), queryResModuleHandle(),HWND_DESKTOP);
    437         sprintf(text, text2, 
     437        sprintf(text, text2,
    438438                mfData->ulNumTracks, mfData->ulSize/1000000 ,chrBuf, (mfData->ulSize%1000000)/1000,
    439439                chrBuf,  mfData->ulSize%1000,
     
    488488  getMessage(pageName, IDSTRSETTING_TOOLBAR, sizeof(pageName), queryResModuleHandle(), hwndNotebook);
    489489  pageinfo.pszName = pageName;
    490  
     490
    491491  //Insert the page into the settings notebook
    492492  return wpInsertSettingsPage(hwndNotebook,&pageinfo);
     
    497497  PMINIRECORDCORE mrc;
    498498  WPObject * contentObject;
    499  
     499
    500500  /* See if we have an audio file played with doubleclick */
    501501  mrc=(PMINIRECORDCORE)WinSendMsg(hwndContainer,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST),
     
    551551  /* Get new ID for wave device */
    552552  if(cwRequestMutex(hmtxFileName, 100000)==ERROR_TIMEOUT)
    553     return FALSE; 
     553    return FALSE;
    554554
    555555  iWaveDev++;
     
    565565      WPObject *wpObject;
    566566      PMINIRECORDCORE pmrc;
    567      
     567
    568568#if 0
    569569      /* There's already a file playing using doubleclick */
    570       if(mmGetOtherPlayingAudioFile( this, hwndContainer, &wpObject, &pmrc)) 
     570      if(mmGetOtherPlayingAudioFile( this, hwndContainer, &wpObject, &pmrc))
    571571        return 0;
    572572#endif
     
    605605        else
    606606          return 0;/* Error */
    607        
    608         if( contentObject->somIsA(cwAudioClass) || 
     607
     608        if( contentObject->somIsA(cwAudioClass) ||
    609609           /*contentObject->somIsA(mmAudioClass) ||*/
    610610           contentObject->somIsA(mmMIDIClass)) {
     
    643643                                    MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
    644644
    645     if((int)mrc==-1) { 
     645    if((int)mrc==-1) {
    646646      /* Wrong parameter -> user deleted the shadow. */
    647647      /* Stop wave, remove in use emphasis. */
     
    650650    }
    651651    //  HlpWriteToTrapLog("Next mrc is %x\n", mrc);
    652  
     652
    653653    notFound=TRUE;
    654     while(notFound && mrc && (int)mrc!=-1){ 
     654    while(notFound && mrc && (int)mrc!=-1){
    655655      contentObject=(WPObject*)OBJECT_FROM_PREC(mrc);//Get object
    656656      if(somIsObj(contentObject)) {
     
    664664      else
    665665        return 0;/* Error */
    666      
     666
    667667      if(contentObject->somIsA(cwAudioClass) ||
    668668         /* contentObject->somIsA(mmAudioClass) || */
     
    701701        /* Select the object */
    702702        WinSendMsg(hwndContainer,CM_SETRECORDEMPHASIS, MPFROMP(pmrc),
    703                    MPFROM2SHORT(TRUE, CRA_SELECTED)); 
     703                   MPFROM2SHORT(TRUE, CRA_SELECTED));
    704704
    705705        return cwPlayAudioFile(hwndFrame, PLAY_FIRST);/* Not yet playing, so start the first one. */
     
    709709        return cwPlayAudioFile(hwndFrame, PLAY_FIRST);/* Not yet playing, so start the first one. */
    710710    }
    711  
     711
    712712    /* Check the current time. If we are at the very beginning of the track skip to the previous track
    713713       otherwise skip to the beginning of the current track. */
     
    727727    /* Find an audio file */
    728728    notFound=TRUE;
    729     while(notFound && mrc && (int)mrc!=-1){ 
     729    while(notFound && mrc && (int)mrc!=-1){
    730730      contentObject=(WPObject*)OBJECT_FROM_PREC(mrc);//Get object
    731731      if(somIsObj(contentObject)) {
     
    741741
    742742      /* Check if it's an audio file thus playable */
    743       if(contentObject->somIsA(cwAudioClass) || 
     743      if(contentObject->somIsA(cwAudioClass) ||
    744744         /*   contentObject->somIsA(mmAudioClass) || */
    745745         contentObject->somIsA(mmMIDIClass)) {
     
    755755    if(!mrc)
    756756      return 0;
    757    
     757
    758758    break;
    759759  default:
     
    771771  else /*if(contentObject->somIsA(cwAudioClass) || contentObject->somIsA(mmAudioClass))*/
    772772    strncpy(chrDevice,"WAVEAUDIO", sizeof(chrDevice));
    773  
     773
    774774  chrDevice[sizeof(chrDevice)-1]=0;
    775775
    776776  hwndNotify=playControlDialogFromFrameHWND(hwndFrame);//WinWindowFromID(hwndTop, IDDLG_TOPMIDDLE);
    777777
    778   /* Start audio file */ 
     778  /* Start audio file */
    779779  sprintf(chrCommand,"open \"%s\"  type %s alias wave%d SHAREABLE wait",name, chrDevice, iWavePriv);
    780780  rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), hwndNotify, 0);
     
    789789    rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    790790    return 0;
    791   }     
     791  }
    792792
    793793  sprintf(chrCommand,"SETPOSITIONADVISE wave%d ON EVERY 1000 notify", iWavePriv);
     
    829829  }
    830830
    831   /* Start pos timer. SET MCIPOSITIONADVICE fails when seeking in the wave. 
     831  /* Start pos timer. SET MCIPOSITIONADVICE fails when seeking in the wave.
    832832     Don't know why. */
    833833
    834   //WinStartTimer(WinQueryAnchorBlock(hwndFrame), WinWindowFromID(hwndTop, IDDLG_TOPMIDDLE), IDTIMER_PLAY, PLAYTIMER_DELAY); 
     834  //WinStartTimer(WinQueryAnchorBlock(hwndFrame), WinWindowFromID(hwndTop, IDDLG_TOPMIDDLE), IDTIMER_PLAY, PLAYTIMER_DELAY);
    835835  WinStartTimer(WinQueryAnchorBlock(hwndFrame), playControlDialogFromFrameHWND(hwndFrame), IDTIMER_PLAY, PLAYTIMER_DELAY);
    836836
     
    849849  /* Select the object */
    850850  WinSendMsg(hwndContainer,CM_SETRECORDEMPHASIS, MPFROMP(mrc),
    851              MPFROM2SHORT(TRUE, CRA_SELECTED)); 
     851             MPFROM2SHORT(TRUE, CRA_SELECTED));
    852852
    853853  iWave=iWavePriv;
     
    872872  BOOL bFound=FALSE;
    873873
    874   /** Get a random number in the appropriate range                    */ 
     874  /** Get a random number in the appropriate range                    */
    875875  DosGetDateTime((PDATETIME)&DT);      /* Get the time               */
    876876  seed = DT.hours*60 + DT.minutes;     /* convert to hundreths       */
     
    885885
    886886#ifdef RANDOM_DEBUG
    887     HlpWriteToTrapLog("\n     Zufall: %d       %d\n", zufall, mfData->pRandomArray[zufall]); 
     887    HlpWriteToTrapLog("\n     Zufall: %d       %d\n", zufall, mfData->pRandomArray[zufall]);
    888888#endif
    889889    /* Get a random number in the appropriate range */
     
    891891      mfData->pRandomArray[zufall]=1;
    892892#ifdef RANDOM_DEBUG
    893       HlpWriteToTrapLog("2     Zufall: %d       %d\n", zufall, mfData->pRandomArray[zufall]); 
     893      HlpWriteToTrapLog("2     Zufall: %d       %d\n", zufall, mfData->pRandomArray[zufall]);
    894894#endif
    895895      return zufall;
     
    900900    if (zufall == start && !bFound) {
    901901#ifdef RANDOM_DEBUG
    902       HlpWriteToTrapLog("Error     Zufall: %d       %d\n", zufall, mfData->pRandomArray[zufall]); 
     902      HlpWriteToTrapLog("Error     Zufall: %d       %d\n", zufall, mfData->pRandomArray[zufall]);
    903903#endif
    904904      return -1;
     
    944944  /* Check if we currently play the last track. */
    945945  if((mfData->iNumPlayed>=mfData->iNumToPlay) && mfData->pRandomArray) {
    946     cwStopAudioFile(hwndFrame);/* Reset playing vars and remove in use emphasis */       
     946    cwStopAudioFile(hwndFrame);/* Reset playing vars and remove in use emphasis */
    947947    if(!(ulFlags&FLAG_REPEAT))
    948948      return 0;
     
    959959  /* Get new ID for wave device */
    960960  if(cwRequestMutex(hmtxFileName, 100000)==ERROR_TIMEOUT)
    961     return FALSE; 
     961    return FALSE;
    962962  iWaveDev++;
    963963  if(iWaveDev==1000)
     
    10091009  /* Find an audio file */
    10101010  notFound=TRUE;
    1011   while(notFound){ 
     1011  while(notFound){
    10121012    /* Find track to play */
    10131013    if((iTrack=_getRandomTrack(mfData))==-1) {
     
    10221022  HlpWriteToTrapLog("%s: _getRandomTrack returned: %d.\n", __FUNCTION__, iTrack);
    10231023#endif
    1024    
     1024
    10251025    for(a=0,mrc=(PMINIRECORDCORE)WinSendMsg(hwndContainer,CM_QUERYRECORD,NULL,
    10261026                                            MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
     
    10391039#endif
    10401040
    1041     if(!mrc) 
     1041    if(!mrc)
    10421042      {
    10431043#ifdef RANDOM_DEBUG
     
    10531053
    10541054    /* Check if it's an audio file thus playable */
    1055     if(contentObject->somIsA(cwAudioClass) || 
     1055    if(contentObject->somIsA(cwAudioClass) ||
    10561056       /*       contentObject->somIsA(mmAudioClass) ||*/
    10571057       contentObject->somIsA(mmMIDIClass)) {
     
    10831083  else /*if(contentObject->somIsA(cwAudioClass) || contentObject->somIsA(mmAudioClass))*/
    10841084    strncpy(chrDevice,"WAVEAUDIO", sizeof(chrDevice));
    1085  
     1085
    10861086  chrDevice[sizeof(chrDevice)-1]=0;
    10871087
    10881088  hwndNotify=playControlDialogFromFrameHWND(hwndFrame);//WinWindowFromID(hwndTop, IDDLG_TOPMIDDLE);
    10891089
    1090   /* Start audio file */ 
     1090  /* Start audio file */
    10911091  sprintf(chrCommand,"open \"%s\"  type %s alias wave%d SHAREABLE wait",name, chrDevice, iWavePriv);
    10921092  rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), hwndNotify, 0);
     
    11001100    rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    11011101    return 0;
    1102   }     
     1102  }
    11031103
    11041104  sprintf(chrCommand,"SETPOSITIONADVISE wave%d ON EVERY 1000 notify", iWavePriv);
     
    11401140    return 0;
    11411141  }
    1142   /* Start pos timer. SET MCIPOSITIONADVICE fails when seeking in the wave. 
     1142  /* Start pos timer. SET MCIPOSITIONADVICE fails when seeking in the wave.
    11431143     Don't know why. */
    1144   //  WinStartTimer(WinQueryAnchorBlock(hwndFrame), WinWindowFromID(hwndTop, IDDLG_TOPMIDDLE), IDTIMER_PLAY, PLAYTIMER_DELAY); 
    1145   WinStartTimer(WinQueryAnchorBlock(hwndFrame), playControlDialogFromFrameHWND(hwndFrame), IDTIMER_PLAY, PLAYTIMER_DELAY); 
     1144  //  WinStartTimer(WinQueryAnchorBlock(hwndFrame), WinWindowFromID(hwndTop, IDDLG_TOPMIDDLE), IDTIMER_PLAY, PLAYTIMER_DELAY);
     1145  WinStartTimer(WinQueryAnchorBlock(hwndFrame), playControlDialogFromFrameHWND(hwndFrame), IDTIMER_PLAY, PLAYTIMER_DELAY);
    11461146
    11471147  /* Set emphasis by adding the object to the inuse list */
     
    11581158  /* Select the object */
    11591159  WinSendMsg(hwndContainer,CM_SETRECORDEMPHASIS, MPFROMP(mrc),
    1160              MPFROM2SHORT(TRUE, CRA_SELECTED)); 
     1160             MPFROM2SHORT(TRUE, CRA_SELECTED));
    11611161
    11621162  iWave=iWavePriv;
     
    11871187        mfData->iNumPlayed=0;
    11881188      }
    1189      
     1189
    11901190      sprintf(chrCommand,"stop wave%d wait", iWave);
    11911191      rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    1192      
     1192
    11931193      sprintf(chrCommand,"close wave%d wait", iWave);
    11941194      rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    1195      
     1195
    11961196      _resetDisplay(this);
    11971197        //_resetDisplay(topControlFromFrameHWND(hwndFrame));
     
    12071207              myViewItem.bIsInUseList=FALSE;
    12081208        };
    1209      
     1209
    12101210      //HlpWriteToTrapLog("\n1 line %d.\n");
    1211      
     1211
    12121212      /* Deselect the object */
    12131213      if(WinIsWindow(WinQueryAnchorBlock(hwndFrame), hwndContainer))
    12141214        WinSendMsg(hwndContainer,CM_SETRECORDEMPHASIS, MPFROMP(mrcPlaying),
    1215                    MPFROM2SHORT(FALSE, CRA_SELECTED)); 
    1216      
     1215                   MPFROM2SHORT(FALSE, CRA_SELECTED));
     1216
    12171217      iWave=0;
    12181218      currentObject=NULLHANDLE;
     
    12341234#endif
    12351235          WinSendMsg(hwndContainer,CM_SETRECORDEMPHASIS, MPFROMP(mrc),
    1236                      MPFROM2SHORT(FALSE, CRA_SELECTED));       
     1236                     MPFROM2SHORT(FALSE, CRA_SELECTED));
    12371237        }
    12381238#if 0
     
    12581258                  ulPos=0;
    12591259                  WinSendMsg(hwndContainer,CM_SETRECORDEMPHASIS, MPFROMP(mrc),
    1260                              MPFROM2SHORT(FALSE, CRA_SELECTED)); 
     1260                             MPFROM2SHORT(FALSE, CRA_SELECTED));
    12611261
    12621262                };
     
    12731273                        __FUNCTION__, __FILE__, __LINE__);
    12741274    } END_CATCH;
    1275    
     1275
    12761276    return TRUE;
    12771277}
     
    13231323  if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
    13241324    /* Problem with MCI. Clean up. The Timer will be stopped in the method */
    1325     cwStopAudioFile(hwndFrame); 
     1325    cwStopAudioFile(hwndFrame);
    13261326  }
    13271327  else {
    13281328    if(!stricmp(retMsg, "stopped")) {
    13291329      /* Audio file played. Start next */
    1330       cwPlayAudioFile(hwndFrame, PLAY_NEXT); 
     1330      cwPlayAudioFile(hwndFrame, PLAY_NEXT);
    13311331    }
    13321332    showPlayTimeDisplay(this, TRUE);/* Ensure display is visible */
Note: See TracChangeset for help on using the changeset viewer.