- Timestamp:
- Nov 29, 2023, 5:59:34 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mediafolder/c/m3ufolder/m3ufolderoverriddenwpmethods.cpp
r2 r133 1 1 /* 2 2 * This file is (C) Chris Wohlgemuth 2002-2003 3 * 3 * 4 4 * It's part of the Media-Folder distribution 5 5 */ … … 33 33 extern ULONG ulQWL_LEFTCTRLHWND; 34 34 35 #if 036 /* For calling the method in the MMAudio class. Linking to the DLL would require the37 new audio classes. By dynamically querying the method the media folder works without38 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 #endif46 47 35 extern LOADEDBITMAP allBMPs[]; 48 36 extern PFNWP pfnwpGenericFrame; … … 70 58 //void HlpWriteToTrapLog(const char* chrFormat, ...); 71 59 72 #if 073 void _Optlink rexxThreadFunc (void *arg)74 {75 HAB hab;76 HMQ hmq;77 QMSG qmsg;78 CWM3UFolder *thisPtr;79 HWND hwnd;80 #if 081 char chrFileName[CCHMAXPATH];82 char chrFolderName[CCHMAXPATH];83 char chrRexxScript[CCHMAXPATH];84 #endif85 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 #endif198 199 60 /*****************************************************/ 200 61 /* */ … … 203 64 /* */ 204 65 /*****************************************************/ 205 MRESULT EXPENTRY m3uFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 66 MRESULT EXPENTRY m3uFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 206 67 { 207 68 CWMediaFolder* thisPtr; … … 272 133 /* */ 273 134 /****************************************************************************/ 274 MRESULT EXPENTRY m3uTopCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 275 { 276 135 MRESULT EXPENTRY m3uTopCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 136 { 137 277 138 switch(msg) 278 139 { … … 284 145 ULONG ulStyle; 285 146 SWP swp; 286 147 287 148 WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr. 288 149 WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp); … … 299 160 WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT)); 300 161 return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),msg,mp1,mp2); 301 162 302 163 /*****************************************************/ 303 164 /* Paint the background. */ … … 321 182 ptl.x=lTemp*rclSource.xRight; 322 183 lTemp=rcl.yBottom/rclSource.yTop; 323 lTemp*=rclSource.yTop; 184 lTemp*=rclSource.yTop; 324 185 while(ptl.x<rcl.xRight) { 325 186 ptl.y=lTemp; 326 187 while(ptl.y<rcl.yTop) {/* y direction */ 327 188 WinDrawBitmap(hps, allBMPs[CTRLIDX_BOTTOM].hbm, 328 &rclSource, 189 &rclSource, 329 190 (PPOINTL)&ptl, 330 191 0, 0, … … 332 193 ptl.y+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cy; 333 194 }; 334 ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx; 195 ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx; 335 196 }; 336 197 WinEndPaint(hps); … … 351 212 rclSource.xRight=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cx; 352 213 WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPLEFT].hbm, 353 &rclSource, 214 &rclSource, 354 215 (PPOINTL)&rclSave, 355 216 0, 0, … … 364 225 rclSource.xRight=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx; 365 226 WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPRIGHT].hbm, 366 &rclSource, 227 &rclSource, 367 228 (PPOINTL)&rclSave, 368 229 0, 0, … … 386 247 * * 387 248 ************************************************************/ 388 MRESULT EXPENTRY m3uFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 249 MRESULT EXPENTRY m3uFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 389 250 { 390 251 CWM3UFolder* thisPtr; … … 419 280 #endif 420 281 case 0x2d1: /* View menu */ 421 /* Remove change to Tree from menubar menu */ 282 /* Remove change to Tree from menubar menu */ 422 283 WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(717,TRUE),0); 423 284 /* Icon view */ … … 462 323 case ID_MENUITEMEXIT: 463 324 WinPostMsg(hwnd, WM_CLOSE, 0, 0); 464 return MRFALSE; 325 return MRFALSE; 465 326 case ID_MENUITEMSAVE: 466 327 { … … 472 333 } 473 334 } 474 return MRFALSE; 335 return MRFALSE; 475 336 } 476 337 default: 477 if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) { 338 if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) { 478 339 BOOL bHandled=FALSE; 479 340 480 341 TRY_LOUD(AF_MENU) { 481 342 #if 0 … … 484 345 thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER); 485 346 if(somIsObj(thisPtr)) { 486 347 487 348 CWMenuFolder * wpFolder; 488 349 HOBJECT hObject; … … 490 351 somTD_CWMenuFolder_mfCheckSkriptMenuItems methodPtr; 491 352 M_WPObject *m_wpObject; 492 353 493 354 if(!bHandled) 494 355 bHandled=thisPtr->cwCheckUserMenuItems(USERMENUFOLDER_MEDIAFOLDER , SHORT1FROMMP(mp1)); … … 557 418 558 419 /* 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 560 421 window words */ 561 422 if(!g_fRegisteredWindowClass) 562 423 { 563 424 CLASSINFO ci; 564 425 565 426 if(WinQueryClassInfo(WinQueryAnchorBlock(HWND_DESKTOP), 566 427 (PSZ)"wpFolder window", … … 589 450 /* Skip media folder. Because of this skip we had to register the window words here (see above). 590 451 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. 592 453 FIXME: This only works if CWProgFolder->CWMediaFolder->CWM3UFolder is the class hierarchy */ 593 454 hwnd=CWProgFolder::wpOpen(hwndCnr, ulView, ulParam); 594 455 595 456 /* Only subclass folder frames, not settings notebooks */ 596 if(ulView!=OPEN_SETTINGS){ 457 if(ulView!=OPEN_SETTINGS){ 597 458 if(!hResource) { 598 459 errorResource(); … … 604 465 ULONG ulErr; 605 466 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 } 608 471 if(!getMessage(text, IDSTR_PLAYLISTVIEWTITLE, sizeof(text), queryResModuleHandle(), HWND_DESKTOP)) 609 472 sprintf(text, "Playlist Editor"); … … 624 487 /* Menu bar found */ 625 488 626 /* Remove folder item from menubar menu */ 489 /* Remove folder item from menubar menu */ 627 490 WinSendMsg( myFrameCtrlHWND, MM_REMOVEITEM, MPFROM2SHORT(0x2cf,TRUE),0); 628 491 … … 633 496 mi.afStyle=MIS_TEXT|MIS_SUBMENU; 634 497 mi.id=ID_MENUFILE; 635 mi.afAttribute=NULL; 498 mi.afAttribute=NULL; 636 499 mi.hwndSubMenu=hwndMenu; 637 500 mi.hItem=NULL; … … 640 503 getMessage(text, IDSTR_MENUFILE,sizeof(text), hResource, hwnd); 641 504 WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi), 642 (MPARAM)text); 505 (MPARAM)text); 643 506 644 507 /* Insert skript and user menu item if necessary */ … … 675 538 iItemCount=(int)WinSendMsg(myFrameCtrlHWND,MM_QUERYITEMCOUNT,(MPARAM)0, 676 539 (MPARAM)0); 677 540 678 541 /* Fill the MENUITEM structure */ 679 542 mi.iPosition=iItemCount-1; 680 543 mi.afStyle=MIS_TEXT|MIS_SUBMENU; 681 544 mi.id=ID_MBMENUSKRIPTS; 682 mi.afAttribute=NULL; 545 mi.afAttribute=NULL; 683 546 mi.hwndSubMenu=hwndMenu; 684 547 mi.hItem=NULL; … … 687 550 getMessage(text, IDSTR_MENUSKRIPTS,sizeof(text), hResource, hwnd); 688 551 WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi), 689 (MPARAM)text); 552 (MPARAM)text); 690 553 }/* end of if(hwndMenu) */ 691 554 } … … 700 563 the procedure saves this pointer for later use. */ 701 564 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 */ 703 566 // 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 707 570 if(myFrameCtrlHWND){ 708 571 /* Query the size of the dialog */ … … 712 575 // sizel.cy=rectl.yTop-rectl.yBottom; 713 576 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. 715 578 FCTL_TOP means put it at the top of the folder. 716 579 After calling cwUpdateFrame(hwnd) it will be visible */ … … 722 585 the procedure saves this pointer for later use. */ 723 586 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 */ 725 588 // hwndLeft=myFrameCtrlHWND; 726 /* Save the HWND in the Window words */ 589 /* Save the HWND in the Window words */ 727 590 WinSetWindowULong( hwnd, ulQWL_LEFTCTRLHWND, myFrameCtrlHWND); 728 729 591 592 730 593 if(myFrameCtrlHWND){ 731 594 /* Query the size of the dialog */ … … 734 597 sizel.cx=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx-1-7-2;//rectl.xRight-rectl.xLeft; 735 598 // 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. 737 600 FCTL_RIGHT means put it at the RIGHT of the folder. 738 601 After calling cwUpdateFrame(hwnd) it will be visible */ … … 744 607 the procedure saves this pointer for later use. */ 745 608 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 */ 747 610 // hwndRight=myFrameCtrlHWND; 748 /* Save the HWND in the Window words */ 611 /* Save the HWND in the Window words */ 749 612 WinSetWindowULong( hwnd, ulQWL_RIGHTCTRLHWND, myFrameCtrlHWND); 750 613 751 614 if(myFrameCtrlHWND){ 752 615 CNRINFO cnrInfo; 753 HWND hwndContainer; 616 HWND hwndContainer; 754 617 PVIEWITEM pView; 755 618 … … 758 621 /* It's the right dialog so we need the width but not the height. */ 759 622 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. 761 624 FCTL_RIGHT means put it at the RIGHT of the folder. 762 625 After calling cwUpdateFrame(hwnd) it will be visible */ 763 626 cwAddFrameCtl(hwnd, myFrameCtrlHWND, sizel, FCTL_RIGHT, FCTL_POSABOVE|FCTL_POSBELOW); 764 627 765 628 // hwndContainer=WinWindowFromID(myFrameCtrlHWND, IDCNR_PLAYLIST); 766 629 // WinSendMsg(hwndContainer,CM_QUERYCNRINFO, MPFROMP(&cnrInfo), … … 772 635 the procedure saves this pointer for later use. */ 773 636 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 */ 777 640 WinSetWindowULong( hwnd, ulQWL_BOTTOMCTRLHWND, myFrameCtrlHWND); 778 641 … … 783 646 sizel.cy=rectl.yTop-rectl.yBottom-2; 784 647 // 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. 786 649 FCTL_TOP means put it at the top of the folder. 787 650 After calling cwUpdateFrame(hwnd) it will be visible */ … … 810 673 SysWriteToTrapLog("\nTrap occured in %s, file: %s above line %d.\n", 811 674 __FUNCTION__, __FILE__, __LINE__); 812 813 } END_CATCH; 675 676 } END_CATCH; 814 677 815 678 /* Make sure on open the container is visible */ … … 825 688 fContentsChanged=TRUE; 826 689 return CWMediaFolder::wpDeleteFromContent(Object); 827 }828 829 MRESULT CWM3UFolder::wpDrop(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem)830 {831 return CWMediaFolder::wpDrop(hwndCnr, pDragInfo, pDragItem);832 690 } 833 691 … … 847 705 return; 848 706 849 thisPtr=(CWM3UFolder*)parms->thisPtr; 707 thisPtr=(CWM3UFolder*)parms->thisPtr; 850 708 if(!somIsObj(thisPtr)) 851 709 return; … … 862 720 hmq=WinCreateMsgQueue(hab,0); 863 721 if(hmq) { 864 FILE* fStream; 722 FILE* fStream; 865 723 866 724 if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), parms->hwndCnr)) … … 894 752 else 895 753 break;/* Error */ 896 754 897 755 /* Get the name of the audio file */ 898 756 ulSize=sizeof(chrFileName); … … 906 764 break; 907 765 }/* for() */ 908 }/* fopen() */ 766 }/* fopen() */ 909 767 fclose(fStream); 910 768 } … … 918 776 /* Close and destroy the folder if requested */ 919 777 WinPostMsg(parms->hwndFrame, WM_CLOSE, 0, 0); 920 if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), thisPtr->hwndObject)) 778 if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), thisPtr->hwndObject)) 921 779 WinPostMsg(thisPtr->hwndObject, WM_APPTERMINATENOTIFY, 0, 0); 922 780 } … … 968 826 title, IDSTR_CLOSETITLE, sizeof(title), 969 827 queryResModuleHandle(), 970 HWND_DESKTOP, 828 HWND_DESKTOP, 971 829 MB_YESNOCANCEL|MB_MOVEABLE|MB_ICONQUESTION))==MBID_CANCEL) 972 830 return FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.