Changeset 104 for trunk/classes/mm-progs/MMPlayer/mmplayer.c
- Timestamp:
- Oct 2, 2023, 11:34:35 PM (23 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to
/branches/v2.9 merged eligible /branches/v2.9_Lars merged eligible
-
Property svn:mergeinfo
set to
-
trunk/classes/mm-progs/MMPlayer/mmplayer.c
r46 r104 21 21 * If you need another license for your project/product (commercial, 22 22 * noncommercial, whatever) contact me at 23 * 23 * 24 24 * http://www.os2world.com/cdwriting 25 25 * http://www.geocities.com/SiliconValley/Sector/5785/ … … 52 52 #include "sys_funcs.h" 53 53 54 #ifndef OPEN_DEFAULT 54 #ifndef OPEN_DEFAULT 55 55 /* Open views for the wpOpen() method */ 56 56 … … 135 135 136 136 /* Every folder has one running play thread to handle play commands */ 137 void _OptlinkplayThreadFunc (void *arg);137 void playThreadFunc (void *arg); 138 138 void controlPlaying(HWND hwndDialog, ULONG ulAction, ULONG ulReserved); 139 139 BOOL stopAudioFile(HWND hwndFrame); … … 211 211 WinQueryPointerPos(HWND_DESKTOP, &ptl) ; 212 212 WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1); 213 WinPopupMenu(hwnd, hwnd, hwndPopup, 213 WinPopupMenu(hwnd, hwnd, hwndPopup, 214 214 ptl.x, ptl.y, 0, PU_HCONSTRAIN | PU_VCONSTRAIN | 215 PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 | PU_NONE ); 216 215 PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 | PU_NONE ); 216 217 217 } 218 218 … … 227 227 hResource=BMP_RESSOURCEHANDLE; //_queryResModuleHandle(); 228 228 hps=WinGetPS(HWND_DESKTOP); 229 229 230 230 /* The main BMP */ 231 231 allBMPs[MAIN_BMP_IDX].hbm=GpiLoadBitmap(hps, hResource, IDBMP_TOPMIDDLE, 0, 0); … … 327 327 WinSetWindowPos(WinWindowFromID(hwnd, ci.id),HWND_TOP, ci.rclSource.xLeft,ci.rclSource.yBottom, 328 328 ci.rclSource.xRight-ci.rclSource.xLeft, 329 ci.rclSource.yTop-ci.rclSource.yBottom, SWP_MOVE|SWP_SIZE); 329 ci.rclSource.yTop-ci.rclSource.yBottom, SWP_MOVE|SWP_SIZE); 330 330 oldPlayTimeProc=WinSubclassWindow(WinWindowFromID(hwnd, IDST_MMPLAYERPLAYTIME), playTimeTextProc); 331 331 332 332 /* Pos slider */ 333 333 ci=ciControls[CTRLIDX_POSSLIDER];//ciPosSlider; 334 WinCreateWindow(hwnd, SLIDER_CLASS, "", WS_VISIBLE | WS_TABSTOP, 0,0, 10, 10, 334 WinCreateWindow(hwnd, SLIDER_CLASS, "", WS_VISIBLE | WS_TABSTOP, 0,0, 10, 10, 335 335 hwnd, HWND_TOP, ci.id, NULLHANDLE, NULLHANDLE); 336 336 WinSetWindowPos(WinWindowFromID(hwnd, ci.id),HWND_TOP, ci.rclDest.xLeft, ci.rclDest.yBottom, 337 337 ci.rclSource.xRight-ci.rclSource.xLeft, 338 338 ci.rclSource.yTop-ci.rclSource.yBottom, SWP_MOVE | SWP_SIZE); 339 339 340 340 WinSendMsg(WinWindowFromID(hwnd, ci.id),SLM_SETSLIDERINFO, 341 341 MPFROM2SHORT(SMA_SLIDERARMDIMENSIONS,0), 342 MPFROM2SHORT( 9, 9)); 342 MPFROM2SHORT( 9, 9)); 343 343 344 344 /* Vol slider */ 345 345 ci=ciControls[CTRLIDX_VOLSLIDER];//ciVolSlider; 346 WinCreateWindow(hwnd, SLIDER_CLASS, "", WS_VISIBLE | WS_TABSTOP, 0,0, 10, 10, 346 WinCreateWindow(hwnd, SLIDER_CLASS, "", WS_VISIBLE | WS_TABSTOP, 0,0, 10, 10, 347 347 hwnd, HWND_TOP, ci.id, NULLHANDLE, NULLHANDLE); 348 348 WinSetWindowPos(WinWindowFromID(hwnd, ci.id),HWND_TOP, ci.rclDest.xLeft, ci.rclDest.yBottom, … … 351 351 WinSendMsg(WinWindowFromID(hwnd, ci.id),SLM_SETSLIDERINFO, 352 352 MPFROM2SHORT(SMA_SLIDERARMDIMENSIONS,0), 353 MPFROM2SHORT( 9, 9)); 353 MPFROM2SHORT( 9, 9)); 354 354 355 355 } … … 370 370 if((rc & 0x0000ffff)!=MCIERR_SUCCESS) { 371 371 /* Problem with MCI. Clean up. The Timer will be stopped in the method */ 372 stopAudioFile(hwndFrame); 372 stopAudioFile(hwndFrame); 373 373 } 374 374 else { 375 375 if(!stricmp(retMsg, "stopped")) { 376 376 /* Audio file played. */ 377 stopAudioFile(hwndFrame); 377 stopAudioFile(hwndFrame); 378 378 } 379 379 showPlayTimeDisplay(hwndFrame, TRUE);/* Ensure display is visible */ … … 391 391 return usItems; 392 392 } 393 393 394 394 return 0; 395 395 } … … 397 397 BOOL DrgVerifyTypeCW(PDRAGITEM pDragItem, char * chrType) 398 398 { 399 /* DrgVerifyType() seems not to work when several types are in the list?? 399 /* DrgVerifyType() seems not to work when several types are in the list?? 400 400 Dokumentation says, it works... */ 401 401 /* Only check for a single type for now */ … … 467 467 for(ulHash=0;*theString!='\0'; theString++) 468 468 ulHash=*theString+37*ulHash; 469 469 470 470 return ulHash%HASHSIZE; 471 471 } … … 538 538 MRESULT handleDrag0ver(PDRAGINFO pdi, HWND hwnd) 539 539 { 540 540 541 541 /* Only accept one file */ 542 542 if(DrgGetNumObjects(pdi)!=1) { … … 546 546 if(DrgCheckForKnownType(pdi, hwnd)) 547 547 return MRFROM2SHORT(DOR_DROP, DO_COPY); 548 549 return MRFROM2SHORT(DOR_NEVERDROP, DO_COPY); 548 549 return MRFROM2SHORT(DOR_NEVERDROP, DO_COPY); 550 550 } 551 551 … … 562 562 char chrFile[CCHMAXPATH]; 563 563 PDRAGITEM pDragItem; 564 564 565 565 pDragItem=DrgQueryDragitemPtr(pdi, 0); 566 DrgQueryStrName(pDragItem->hstrSourceName,sizeof(chrFile), chrFile); 567 DrgQueryStrName(pDragItem->hstrContainerName,sizeof(chrSourceName), chrSourceName); 566 DrgQueryStrName(pDragItem->hstrSourceName,sizeof(chrFile), chrFile); 567 DrgQueryStrName(pDragItem->hstrContainerName,sizeof(chrSourceName), chrSourceName); 568 568 strcat(chrSourceName, chrFile); 569 569 570 570 /* Start new file */ 571 571 controlPlaying(hwnd, PLAY_FIRST, 0); … … 608 608 MPFROM2SHORT(SC_SIZE, TRUE), 609 609 MPFROMP(NULL)); 610 610 611 611 WinSendMsg(hwndMenu, /* Delete Minimize from the system menu */ 612 612 MM_DELETEITEM, 613 613 MPFROM2SHORT(SC_MINIMIZE, TRUE), 614 614 MPFROMP(NULL)); 615 615 616 616 WinSendMsg(hwndMenu, /* Delete Maximize from the system menu */ 617 617 MM_DELETEITEM, … … 648 648 649 649 switch (msg) 650 { 650 { 651 651 case DM_DRAGOVER: 652 652 { … … 676 676 swctl.fbJump=SWL_JUMPABLE; 677 677 WinAddSwitchEntry(&swctl); 678 678 679 679 adjustDialogControlPos(hwnd); 680 680 681 681 /* Set volume slider*/ 682 682 WinSendMsg( WinWindowFromID(hwnd, IDSL_MMPLAYERVOLUME), … … 684 684 MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE), 685 685 MPFROMLONG( ulVolume)); 686 686 687 687 /* Subclass buttons for DnD */ 688 688 orgButtonProc=WinSubclassWindow(WinWindowFromID(hwnd, IDPB_MMPLAYERPLAY), buttonProc); 689 689 WinSubclassWindow(WinWindowFromID(hwnd, IDPB_MMPLAYERPAUSE), buttonProc); 690 690 WinSubclassWindow(WinWindowFromID(hwnd, IDPB_MMPLAYERSTOP), buttonProc); 691 691 692 692 FixSysMenu(hwnd); 693 693 … … 695 695 if(allBMPs[MAIN_BMP_IDX].hbm) { 696 696 SWP swp; 697 698 WinQueryWindowPos(WinWindowFromID(hwnd, FID_TITLEBAR), &swp); 699 WinSetWindowPos(WinWindowFromID(hwnd, ID_CLIENT), NULLHANDLE, 700 WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME), 701 WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME), 697 698 WinQueryWindowPos(WinWindowFromID(hwnd, FID_TITLEBAR), &swp); 699 WinSetWindowPos(WinWindowFromID(hwnd, ID_CLIENT), NULLHANDLE, 700 WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME), 701 WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME), 702 702 allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cx, 703 703 allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cy, 704 704 SWP_SIZE|SWP_MOVE); 705 705 orgBgProc=WinSubclassWindow(WinWindowFromID(hwnd, ID_CLIENT), bgProc); 706 706 707 707 WinSetWindowPos(hwnd, NULLHANDLE, 0, 0, 708 708 allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cx+WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME)*2, … … 732 732 /*****************************************************/ 733 733 case WM_APPTERMINATENOTIFY: 734 734 735 735 switch(SHORT1FROMMP(mp1)) 736 736 { … … 745 745 return MRFALSE; 746 746 case NOTIFY_CONTEXT: 747 /* Show context menu. */ 747 /* Show context menu. */ 748 748 HlpContextMenu(hwnd, iWhichDisplay+ID_MENUITEMELAPSED, TRUE); 749 749 return MRFALSE; … … 752 752 } 753 753 return MRFALSE; 754 754 755 755 /*****************************************************/ 756 756 /* The following two messages are for device sharing */ … … 760 760 char chrCommand[100]; 761 761 int iWavePriv; 762 762 763 763 iWavePriv=ulPid; 764 764 … … 791 791 /* SETPOSITIONADVICE does not work for some reason, */ 792 792 /* so a timer is used. Yes, it's quit cumbersome... */ 793 /*****************************************************/ 793 /*****************************************************/ 794 794 case WM_TIMER: 795 795 if(SHORT1FROMMP(mp1)==IDTIMER_PLAY) { … … 812 812 /* Set slider position */ 813 813 814 WinPostMsg( WinWindowFromID(hwnd, IDSL_MMPLAYERPOSBAR), 814 WinPostMsg( WinWindowFromID(hwnd, IDSL_MMPLAYERPOSBAR), 815 815 SLM_SETSLIDERINFO, 816 816 MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE), … … 898 898 default: 899 899 break; 900 } 900 } 901 901 break; 902 902 … … 909 909 char chrCommand[50]; 910 910 char retMsg[20]; 911 911 912 912 switch(SHORT2FROMMP(mp1)) 913 913 { … … 939 939 static long lLastPos=0; 940 940 long lPos=LONGFROMMP(mp2); 941 941 942 942 bPosDragging=TRUE; 943 943 lPos*=ulTotalLength/100; 944 944 if(lPos/1000!=lLastPos) { 945 945 /* Prevent flickering */ 946 sprintf(chrCommand, "% d:%02d", lPos/1000/60, (lPos/1000)%60);946 sprintf(chrCommand, "%lu:%02lu", lPos/1000/60, (lPos/1000)%60); 947 947 WinSetWindowText(WinWindowFromID(hwnd, IDST_MMPLAYERPLAYTIME), chrCommand); 948 948 lLastPos=lPos/1000; … … 963 963 { 964 964 ULONG ulValue; 965 965 966 966 ulValue=LONGFROMMP(mp2); 967 967 ulVolume=ulValue; … … 975 975 976 976 bPosDragging=FALSE; 977 lPos*=1000; 977 lPos*=1000; 978 978 lPos*=ulTotalLength/100; 979 979 lPos/=1000;// Use only full seconds … … 982 982 seekAudioFile(lPos); 983 983 /* restart timer */ 984 WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, IDTIMER_PLAY, PLAYTIMER_DELAY); 984 WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, IDTIMER_PLAY, PLAYTIMER_DELAY); 985 985 ulPos=lPos/1000; 986 986 break; … … 999 999 break; 1000 1000 }/* switch */ 1001 1001 1002 1002 return WinDefDlgProc( hwnd, msg, mp1, mp2); 1003 1003 } … … 1019 1019 ))==NULLHANDLE) 1020 1020 return FALSE; 1021 1021 1022 1022 ulSize=sizeof(chrFileName); 1023 1023 1024 1024 if ((rc = DosOpen(chrFileName, &handle, &act, 1025 1025 0L, 0, OPEN_ACTION_OPEN_IF_EXISTS, … … 1085 1085 BOOL writeVolumeToIni(char * iniFile, char* chrApp, char *chrKey, ULONG ulVolume) 1086 1086 { 1087 1087 1088 1088 return IniSaveInt(iniFile, chrApp, chrKey, ulVolume); 1089 1089 } … … 1108 1108 if(MMIO_SUCCESS!=mmioIdentifyFile(chrFile, &mmioInfo, &mmFormatInfo, &fourCC, 0,0)) 1109 1109 { 1110 return 0; 1110 return 0; 1111 1111 } 1112 1112 1113 1113 if(mmFormatInfo.ulMediaType==MMIO_MEDIATYPE_MIDI) 1114 1114 return 1; /* Midi */ 1115 1115 1116 1116 /* Any other audio file */ 1117 1117 return 2; … … 1143 1143 if(hab) { 1144 1144 hmq=WinCreateMsgQueue(hab,0); 1145 if(hmq) { 1146 /* Check if user started prog by hand */ 1145 if(hmq) { 1146 /* Check if user started prog by hand */ 1147 1147 if(argc!=NUMPARAMS) {/* Not the right num of params */ 1148 1148 pmUsage(); … … 1161 1161 { 1162 1162 /* FIXME: Identify error !!!*/ 1163 1163 1164 1164 }; 1165 1165 1166 1166 if(rc==1) 1167 1167 { … … 1176 1176 strcpy(chrClassName, params[1]); 1177 1177 1178 /* Get our ressource dll */ 1178 /* Get our ressource dll */ 1179 1179 // RESSOURCEHANDLE=0; 1180 1180 RESSOURCEHANDLE=queryResModuleHandle(argv[0]); … … 1189 1189 WinRegisterClass(WinQueryAnchorBlock(HWND_DESKTOP), SLIDER_CLASS, privateSliderProc,0, SLADDBYTES); 1190 1190 1191 _loadBmps(); 1191 _loadBmps(); 1192 1192 DosGetInfoBlocks(&ptib, &ppib); 1193 1193 ulPid=ppib->pib_ulpid; 1194 1194 _beginthread(playThreadFunc,NULL,8192*16, NULLHANDLE); //Fehlerbehandlung fehlt 1195 1195 1196 if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, decodeStatusDialogProc, 1196 if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, decodeStatusDialogProc, 1197 1197 RESSOURCEHANDLE, IDDLG_MMPLAYER, 0) == DID_ERROR ) 1198 1198 { 1199 1199 /* 1200 Text: 1201 Title: "Installation problem" 1202 */ 1200 Text: 1201 Title: "Installation problem" 1202 */ 1203 1203 messageBox( text, IDSTR_CONVERTDIALOGERROR , sizeof(text), 1204 1204 title, IDSTR_INSTALLERRORTITLE , sizeof(title),
Note:
See TracChangeset
for help on using the changeset viewer.