Changeset 120
- Timestamp:
- Oct 7, 2023, 11:26:26 PM (22 months ago)
- Location:
- branches/v2.9_Lars/mediafolder
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v2.9_Lars/mediafolder/c/m3ufolder/m3ufolderoverriddenwpmethods.cpp
r2 r120 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 */ … … 32 32 extern ULONG ulQWL_RIGHTCTRLHWND; 33 33 extern ULONG ulQWL_LEFTCTRLHWND; 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 34 47 35 extern LOADEDBITMAP allBMPs[]; … … 88 76 ULONG ulSize; 89 77 90 thisPtr=(CWM3UFolder*)arg; 78 thisPtr=(CWM3UFolder*)arg; 91 79 if(!somIsObj(thisPtr)) 92 80 return; … … 98 86 if(!chrFileName) 99 87 return; 100 88 101 89 chrFolderName=chrFileName+CCHMAXPATH+1; 102 90 chrRexxScript=chrFolderName+CCHMAXPATH+1; … … 105 93 if(!((WPFileSystem*)thisPtr->wpObjM3UFile)->wpQueryRealName(chrFileName, &ulSize, TRUE)) 106 94 return; 107 95 108 96 ulSize=CCHMAXPATH; 109 97 if(!thisPtr->wpQueryRealName(chrFolderName, &ulSize, TRUE)) … … 113 101 if(hab) { 114 102 hmq=WinCreateMsgQueue(hab,0); 115 if(hmq) { 103 if(hmq) { 116 104 RXSTRING arg[2]; /* argument string for REXX */ 117 105 RXSTRING rexxretval; /* return value from REXX */ 118 106 APIRET rc; /* return code from REXX */ 119 107 SHORT rexxrc = 0; /* return code from function */ 120 121 108 109 122 110 sprintf(chrRexxScript,"%s%s", chrInstallDir,RX_INSERT_PLAYLISTTRACKS); 123 111 //HlpWriteToTrapLog("chrRexxScript: %s\n", chrRexxScript); … … 126 114 /* We could provide a buffer for the interpreter to use instead. */ 127 115 rexxretval.strlength = 0L; /* initialize return to empty*/ 128 116 129 117 MAKERXSTRING(arg[0], chrFileName, strlen(chrFileName));/* create input argument */ 130 MAKERXSTRING(arg[1], chrFolderName, strlen(chrFolderName));/* create input argument */ 131 118 MAKERXSTRING(arg[1], chrFolderName, strlen(chrFolderName));/* create input argument */ 119 132 120 TRY_LOUD(RX_START) { 133 121 /* Here we call the interpreter. We don't really need to use */ … … 144 132 (PSHORT) &rexxrc, /* Rexx program output */ 145 133 (PRXSTRING) &rexxretval ); /* Rexx program output */ 146 134 147 135 if(rc) { 148 sprintf(chrFileName,"Error in the Rexx skript %s\n\n Get more information with 'help REX%04d'.\n", 136 sprintf(chrFileName,"Error in the Rexx skript %s\n\n Get more information with 'help REX%04d'.\n", 149 137 "", rc*-1); 150 138 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrFileName, "", 1234, MB_OK|MB_MOVEABLE|MB_ERROR); 151 139 } 152 DosFreeMem(rexxretval.strptr); /* Release storage given to us by REXX. */ 140 DosFreeMem(rexxretval.strptr); /* Release storage given to us by REXX. */ 153 141 } 154 142 CATCH(RX_START) 155 143 {}END_CATCH; 156 144 157 145 WinDestroyMsgQueue(hmq); 158 146 } … … 160 148 } 161 149 thisPtr->fContentsChanged=FALSE; 162 thisPtr->wpFreeMem((PBYTE)chrFileName); 150 thisPtr->wpFreeMem((PBYTE)chrFileName); 163 151 } 164 152 … … 203 191 /* */ 204 192 /*****************************************************/ 205 MRESULT EXPENTRY m3uFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 193 MRESULT EXPENTRY m3uFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 206 194 { 207 195 CWMediaFolder* thisPtr; … … 272 260 /* */ 273 261 /****************************************************************************/ 274 MRESULT EXPENTRY m3uTopCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 275 { 276 262 MRESULT EXPENTRY m3uTopCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 263 { 264 277 265 switch(msg) 278 266 { … … 284 272 ULONG ulStyle; 285 273 SWP swp; 286 274 287 275 WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr. 288 276 WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp); … … 299 287 WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT)); 300 288 return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),msg,mp1,mp2); 301 289 302 290 /*****************************************************/ 303 291 /* Paint the background. */ … … 321 309 ptl.x=lTemp*rclSource.xRight; 322 310 lTemp=rcl.yBottom/rclSource.yTop; 323 lTemp*=rclSource.yTop; 311 lTemp*=rclSource.yTop; 324 312 while(ptl.x<rcl.xRight) { 325 313 ptl.y=lTemp; 326 314 while(ptl.y<rcl.yTop) {/* y direction */ 327 315 WinDrawBitmap(hps, allBMPs[CTRLIDX_BOTTOM].hbm, 328 &rclSource, 316 &rclSource, 329 317 (PPOINTL)&ptl, 330 318 0, 0, … … 332 320 ptl.y+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cy; 333 321 }; 334 ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx; 322 ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx; 335 323 }; 336 324 WinEndPaint(hps); … … 351 339 rclSource.xRight=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cx; 352 340 WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPLEFT].hbm, 353 &rclSource, 341 &rclSource, 354 342 (PPOINTL)&rclSave, 355 343 0, 0, … … 364 352 rclSource.xRight=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx; 365 353 WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPRIGHT].hbm, 366 &rclSource, 354 &rclSource, 367 355 (PPOINTL)&rclSave, 368 356 0, 0, … … 386 374 * * 387 375 ************************************************************/ 388 MRESULT EXPENTRY m3uFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 376 MRESULT EXPENTRY m3uFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 389 377 { 390 378 CWM3UFolder* thisPtr; … … 419 407 #endif 420 408 case 0x2d1: /* View menu */ 421 /* Remove change to Tree from menubar menu */ 409 /* Remove change to Tree from menubar menu */ 422 410 WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(717,TRUE),0); 423 411 /* Icon view */ … … 462 450 case ID_MENUITEMEXIT: 463 451 WinPostMsg(hwnd, WM_CLOSE, 0, 0); 464 return MRFALSE; 452 return MRFALSE; 465 453 case ID_MENUITEMSAVE: 466 454 { … … 472 460 } 473 461 } 474 return MRFALSE; 462 return MRFALSE; 475 463 } 476 464 default: 477 if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) { 465 if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) { 478 466 BOOL bHandled=FALSE; 479 467 480 468 TRY_LOUD(AF_MENU) { 481 469 #if 0 … … 484 472 thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER); 485 473 if(somIsObj(thisPtr)) { 486 474 487 475 CWMenuFolder * wpFolder; 488 476 HOBJECT hObject; … … 490 478 somTD_CWMenuFolder_mfCheckSkriptMenuItems methodPtr; 491 479 M_WPObject *m_wpObject; 492 480 493 481 if(!bHandled) 494 482 bHandled=thisPtr->cwCheckUserMenuItems(USERMENUFOLDER_MEDIAFOLDER , SHORT1FROMMP(mp1)); … … 557 545 558 546 /* Reregister wpFolder window class on first opening */ 559 /* We need this private code to have some private 547 /* We need this private code to have some private 560 548 window words */ 561 549 if(!g_fRegisteredWindowClass) 562 550 { 563 551 CLASSINFO ci; 564 552 565 553 if(WinQueryClassInfo(WinQueryAnchorBlock(HWND_DESKTOP), 566 554 (PSZ)"wpFolder window", … … 589 577 /* Skip media folder. Because of this skip we had to register the window words here (see above). 590 578 It's not asured a Mediafolder was already opended. Normaly the window words are added in 591 wpOpen() of the Mediafolder. 579 wpOpen() of the Mediafolder. 592 580 FIXME: This only works if CWProgFolder->CWMediaFolder->CWM3UFolder is the class hierarchy */ 593 581 hwnd=CWProgFolder::wpOpen(hwndCnr, ulView, ulParam); 594 582 595 583 /* Only subclass folder frames, not settings notebooks */ 596 if(ulView!=OPEN_SETTINGS){ 584 if(ulView!=OPEN_SETTINGS){ 597 585 if(!hResource) { 598 586 errorResource(); … … 624 612 /* Menu bar found */ 625 613 626 /* Remove folder item from menubar menu */ 614 /* Remove folder item from menubar menu */ 627 615 WinSendMsg( myFrameCtrlHWND, MM_REMOVEITEM, MPFROM2SHORT(0x2cf,TRUE),0); 628 616 … … 633 621 mi.afStyle=MIS_TEXT|MIS_SUBMENU; 634 622 mi.id=ID_MENUFILE; 635 mi.afAttribute=NULL; 623 mi.afAttribute=NULL; 636 624 mi.hwndSubMenu=hwndMenu; 637 625 mi.hItem=NULL; … … 640 628 getMessage(text, IDSTR_MENUFILE,sizeof(text), hResource, hwnd); 641 629 WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi), 642 (MPARAM)text); 630 (MPARAM)text); 643 631 644 632 /* Insert skript and user menu item if necessary */ … … 675 663 iItemCount=(int)WinSendMsg(myFrameCtrlHWND,MM_QUERYITEMCOUNT,(MPARAM)0, 676 664 (MPARAM)0); 677 665 678 666 /* Fill the MENUITEM structure */ 679 667 mi.iPosition=iItemCount-1; 680 668 mi.afStyle=MIS_TEXT|MIS_SUBMENU; 681 669 mi.id=ID_MBMENUSKRIPTS; 682 mi.afAttribute=NULL; 670 mi.afAttribute=NULL; 683 671 mi.hwndSubMenu=hwndMenu; 684 672 mi.hItem=NULL; … … 687 675 getMessage(text, IDSTR_MENUSKRIPTS,sizeof(text), hResource, hwnd); 688 676 WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi), 689 (MPARAM)text); 677 (MPARAM)text); 690 678 }/* end of if(hwndMenu) */ 691 679 } … … 700 688 the procedure saves this pointer for later use. */ 701 689 myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd, m3uTopCtrlDialogProc,hResource,IDDLG_TOPFRAME ,this); 702 /* Save the HWND in the instance data */ 690 /* Save the HWND in the instance data */ 703 691 // hwndTop=myFrameCtrlHWND; 704 /* Save the HWND in the Window words */ 705 WinSetWindowULong( hwnd, ulQWL_TOPCTRLHWND, myFrameCtrlHWND); 706 692 /* Save the HWND in the Window words */ 693 WinSetWindowULong( hwnd, ulQWL_TOPCTRLHWND, myFrameCtrlHWND); 694 707 695 if(myFrameCtrlHWND){ 708 696 /* Query the size of the dialog */ … … 712 700 // sizel.cy=rectl.yTop-rectl.yBottom; 713 701 sizel.cy=12; 714 /* Call a method of CWProgFolder to add the dialog as a framecontrol. 702 /* Call a method of CWProgFolder to add the dialog as a framecontrol. 715 703 FCTL_TOP means put it at the top of the folder. 716 704 After calling cwUpdateFrame(hwnd) it will be visible */ … … 722 710 the procedure saves this pointer for later use. */ 723 711 myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,leftCtrlDialogProc,hResource,IDDLG_LEFTFRAME ,this); 724 /* Save the HWND in the instance data */ 712 /* Save the HWND in the instance data */ 725 713 // hwndLeft=myFrameCtrlHWND; 726 /* Save the HWND in the Window words */ 714 /* Save the HWND in the Window words */ 727 715 WinSetWindowULong( hwnd, ulQWL_LEFTCTRLHWND, myFrameCtrlHWND); 728 729 716 717 730 718 if(myFrameCtrlHWND){ 731 719 /* Query the size of the dialog */ … … 734 722 sizel.cx=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx-1-7-2;//rectl.xRight-rectl.xLeft; 735 723 // sizel.cx=rectl.xRight-rectl.xLeft; 736 /* Call a method of CWProgFolder to add the dialog as a framecontrol. 724 /* Call a method of CWProgFolder to add the dialog as a framecontrol. 737 725 FCTL_RIGHT means put it at the RIGHT of the folder. 738 726 After calling cwUpdateFrame(hwnd) it will be visible */ … … 744 732 the procedure saves this pointer for later use. */ 745 733 myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,rightCtrlDialogProc,hResource,IDDLG_FRAMERIGHT ,this); 746 /* Save the HWND in the instance data */ 734 /* Save the HWND in the instance data */ 747 735 // hwndRight=myFrameCtrlHWND; 748 /* Save the HWND in the Window words */ 736 /* Save the HWND in the Window words */ 749 737 WinSetWindowULong( hwnd, ulQWL_RIGHTCTRLHWND, myFrameCtrlHWND); 750 738 751 739 if(myFrameCtrlHWND){ 752 740 CNRINFO cnrInfo; 753 HWND hwndContainer; 741 HWND hwndContainer; 754 742 PVIEWITEM pView; 755 743 … … 758 746 /* It's the right dialog so we need the width but not the height. */ 759 747 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. 748 /* Call a method of CWProgFolder to add the dialog as a framecontrol. 761 749 FCTL_RIGHT means put it at the RIGHT of the folder. 762 750 After calling cwUpdateFrame(hwnd) it will be visible */ 763 751 cwAddFrameCtl(hwnd, myFrameCtrlHWND, sizel, FCTL_RIGHT, FCTL_POSABOVE|FCTL_POSBELOW); 764 752 765 753 // hwndContainer=WinWindowFromID(myFrameCtrlHWND, IDCNR_PLAYLIST); 766 754 // WinSendMsg(hwndContainer,CM_QUERYCNRINFO, MPFROMP(&cnrInfo), … … 772 760 the procedure saves this pointer for later use. */ 773 761 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 */ 762 /* Save the HWND in the instance data */ 763 hwndBottom=myFrameCtrlHWND; 764 /* Save the HWND in the Window words */ 777 765 WinSetWindowULong( hwnd, ulQWL_BOTTOMCTRLHWND, myFrameCtrlHWND); 778 766 … … 783 771 sizel.cy=rectl.yTop-rectl.yBottom-2; 784 772 // sizel.cy=allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cy; 785 /* Call a method of CWProgFolder to add the dialog as a framecontrol. 773 /* Call a method of CWProgFolder to add the dialog as a framecontrol. 786 774 FCTL_TOP means put it at the top of the folder. 787 775 After calling cwUpdateFrame(hwnd) it will be visible */ … … 810 798 SysWriteToTrapLog("\nTrap occured in %s, file: %s above line %d.\n", 811 799 __FUNCTION__, __FILE__, __LINE__); 812 813 } END_CATCH; 800 801 } END_CATCH; 814 802 815 803 /* Make sure on open the container is visible */ … … 827 815 } 828 816 829 MRESULT CWM3UFolder::wpDrop(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem) 830 { 831 return CWMediaFolder::wpDrop(hwndCnr, pDragInfo, pDragItem); 817 MRESULT CWM3UFolder::wpDragOver(HWND hwndCnr,PDRAGINFO pDragInfo) 818 { 819 ULONG ulNumberOfObjects; 820 WPObject *wpObject = NULL; 821 USHORT usIndicator=DOR_NEVERDROP,usOp=0; 822 823 /* Get access to the dragInfo */ 824 if (DrgAccessDraginfo(pDragInfo)) { 825 PDRAGITEM pDragItem = NULL; 826 M_CWMediaFolder *mediaFolderClass = NULL; 827 828 /* Get number of items */ 829 ulNumberOfObjects = DrgQueryDragitemCount( pDragInfo); 830 831 if(ulNumberOfObjects>1) { 832 usIndicator = DOR_NODROP; 833 usOp = 0; 834 goto quit; 835 } 836 837 /* check if a WPS object was dropped, we do not accept anything else */ 838 pDragItem = DrgQueryDragitemPtr(pDragInfo,0); 839 if (!DrgVerifyRMF(pDragItem,"DRM_OBJECT","DRF_OBJECT")) { 840 usIndicator = DOR_NEVERDROP; 841 usOp = 0; 842 goto quit; 843 } /* endif */ 844 845 /* 846 refuse drop if WPS object pointer is not valid or if the object is 847 a descendant of MMCDTrack class (see Netlabs ticket #19) 848 */ 849 wpObject = (WPObject *)OBJECT_FROM_PREC(pDragItem->ulItemID); 850 mediaFolderClass = (M_CWMediaFolder *)CWMediaFolder::__ClassObject; 851 if (!somIsObj(wpObject) || wpObject->somIsA(mediaFolderClass->MMCDTrackClass)) { 852 usIndicator = DOR_NEVERDROP; 853 usOp = 0; 854 goto quit; 855 } /* endif */ 856 857 switch(pDragInfo->usOperation) 858 { 859 case DO_DEFAULT: 860 case DO_LINK: 861 usIndicator = DOR_DROP; 862 usOp = DO_LINK; 863 break; 864 default: 865 usIndicator = DOR_NODROPOP; 866 usOp = DO_LINK; 867 break; 868 } 869 quit: 870 /* Free the draginfo */ 871 DrgFreeDraginfo(pDragInfo); 872 } 873 return MRFROM2SHORT(usIndicator,usOp); 832 874 } 833 875 … … 847 889 return; 848 890 849 thisPtr=(CWM3UFolder*)parms->thisPtr; 891 thisPtr=(CWM3UFolder*)parms->thisPtr; 850 892 if(!somIsObj(thisPtr)) 851 893 return; … … 862 904 hmq=WinCreateMsgQueue(hab,0); 863 905 if(hmq) { 864 FILE* fStream; 906 FILE* fStream; 865 907 866 908 if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), parms->hwndCnr)) … … 894 936 else 895 937 break;/* Error */ 896 938 897 939 /* Get the name of the audio file */ 898 940 ulSize=sizeof(chrFileName); … … 906 948 break; 907 949 }/* for() */ 908 }/* fopen() */ 950 }/* fopen() */ 909 951 fclose(fStream); 910 952 } … … 918 960 /* Close and destroy the folder if requested */ 919 961 WinPostMsg(parms->hwndFrame, WM_CLOSE, 0, 0); 920 if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), thisPtr->hwndObject)) 962 if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), thisPtr->hwndObject)) 921 963 WinPostMsg(thisPtr->hwndObject, WM_APPTERMINATENOTIFY, 0, 0); 922 964 } … … 968 1010 title, IDSTR_CLOSETITLE, sizeof(title), 969 1011 queryResModuleHandle(), 970 HWND_DESKTOP, 1012 HWND_DESKTOP, 971 1013 MB_YESNOCANCEL|MB_MOVEABLE|MB_ICONQUESTION))==MBID_CANCEL) 972 1014 return FALSE; -
branches/v2.9_Lars/mediafolder/include/m3ufolder.hh
r51 r120 28 28 HWND hwndFrame; 29 29 BOOL fSaveOnly; 30 }M3UTHREADPARMS; 30 }M3UTHREADPARMS; 31 31 32 32 #pragma SOMAsDefault(on) … … 48 48 virtual BOOL wpclsQueryDefaultHelp(PULONG HelpPanelId,PSZ HelpLibrary); 49 49 virtual BOOL wpclsCreateDefaultTemplates(WPObject * wpObject); 50 /* 50 /* 51 51 virtual void wpclsUnInitData(); 52 52 … … 76 76 virtual ULONG wpFilterPopupMenu(ULONG ulFlags, HWND hwndCnr, BOOL fMultiSelect); 77 77 virtual BOOL wpModifyPopupMenu(HWND hwndMenu, HWND hwndCnr, ULONG ulPosition); 78 virtual MRESULT wpDr op(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem);78 virtual MRESULT wpDragOver(HWND hwndCnr,PDRAGINFO pDragInfo); 79 79 #if 0 80 80 virtual BOOL wpRestoreState(ULONG ulReserved);
Note:
See TracChangeset
for help on using the changeset viewer.