Changeset 104 for trunk/classes/mm-progs/videoplayer/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/videoplayer/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/ … … 55 55 #include "sys_funcs.h" 56 56 57 #ifndef OPEN_DEFAULT 57 #ifndef OPEN_DEFAULT 58 58 /* Open views for the wpOpen() method */ 59 59 … … 140 140 141 141 /* Every folder has one running play thread to handle play commands */ 142 void _OptlinkplayThreadFunc (void *arg);142 void playThreadFunc (void *arg); 143 143 void controlPlaying(HWND hwndDialog, ULONG ulAction, ULONG ulReserved); 144 144 BOOL stopAudioFile(HWND hwndFrame); … … 216 216 WinQueryPointerPos(HWND_DESKTOP, &ptl) ; 217 217 WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1); 218 WinPopupMenu(hwnd, hwnd, hwndPopup, 218 WinPopupMenu(hwnd, hwnd, hwndPopup, 219 219 ptl.x, ptl.y, 0, PU_HCONSTRAIN | PU_VCONSTRAIN | 220 PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 | PU_NONE ); 221 220 PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 | PU_NONE ); 221 222 222 } 223 223 … … 232 232 hResource=BMP_RESSOURCEHANDLE; //_queryResModuleHandle(); 233 233 hps=WinGetPS(HWND_DESKTOP); 234 234 235 235 /* The main BMP */ 236 236 allBMPs[MAIN_BMP_IDX].hbm=GpiLoadBitmap(hps, hResource, IDBMP_TOPMIDDLE, 0, 0); … … 332 332 WinSetWindowPos(WinWindowFromID(hwnd, ci.id),HWND_TOP, ci.rclSource.xLeft,ci.rclSource.yBottom, 333 333 ci.rclSource.xRight-ci.rclSource.xLeft, 334 ci.rclSource.yTop-ci.rclSource.yBottom, SWP_MOVE|SWP_SIZE); 334 ci.rclSource.yTop-ci.rclSource.yBottom, SWP_MOVE|SWP_SIZE); 335 335 oldPlayTimeProc=WinSubclassWindow(WinWindowFromID(hwnd, IDST_MMPLAYERPLAYTIME), playTimeTextProc); 336 336 337 337 /* Pos slider */ 338 338 ci=ciControls[CTRLIDX_POSSLIDER];//ciPosSlider; 339 WinCreateWindow(hwnd, SLIDER_CLASS, "", WS_VISIBLE | WS_TABSTOP, 0,0, 10, 10, 339 WinCreateWindow(hwnd, SLIDER_CLASS, "", WS_VISIBLE | WS_TABSTOP, 0,0, 10, 10, 340 340 hwnd, HWND_TOP, ci.id, NULLHANDLE, NULLHANDLE); 341 341 WinSetWindowPos(WinWindowFromID(hwnd, ci.id),HWND_TOP, ci.rclDest.xLeft, ci.rclDest.yBottom, 342 342 ci.rclSource.xRight-ci.rclSource.xLeft, 343 343 ci.rclSource.yTop-ci.rclSource.yBottom, SWP_MOVE | SWP_SIZE); 344 344 345 345 WinSendMsg(WinWindowFromID(hwnd, ci.id),SLM_SETSLIDERINFO, 346 346 MPFROM2SHORT(SMA_SLIDERARMDIMENSIONS,0), 347 MPFROM2SHORT( 9, 9)); 347 MPFROM2SHORT( 9, 9)); 348 348 349 349 /* Vol slider */ 350 350 ci=ciControls[CTRLIDX_VOLSLIDER];//ciVolSlider; 351 WinCreateWindow(hwnd, SLIDER_CLASS, "", WS_VISIBLE | WS_TABSTOP, 0,0, 10, 10, 351 WinCreateWindow(hwnd, SLIDER_CLASS, "", WS_VISIBLE | WS_TABSTOP, 0,0, 10, 10, 352 352 hwnd, HWND_TOP, ci.id, NULLHANDLE, NULLHANDLE); 353 353 WinSetWindowPos(WinWindowFromID(hwnd, ci.id),HWND_TOP, ci.rclDest.xLeft, ci.rclDest.yBottom, … … 356 356 WinSendMsg(WinWindowFromID(hwnd, ci.id),SLM_SETSLIDERINFO, 357 357 MPFROM2SHORT(SMA_SLIDERARMDIMENSIONS,0), 358 MPFROM2SHORT( 9, 9)); 358 MPFROM2SHORT( 9, 9)); 359 359 360 360 } … … 375 375 if((rc & 0x0000ffff)!=MCIERR_SUCCESS) { 376 376 /* Problem with MCI. Clean up. The Timer will be stopped in the method */ 377 stopAudioFile(hwndFrame); 377 stopAudioFile(hwndFrame); 378 378 } 379 379 else { 380 380 if(!stricmp(retMsg, "stopped")) { 381 381 /* Audio file played. */ 382 stopAudioFile(hwndFrame); 382 stopAudioFile(hwndFrame); 383 383 } 384 384 showPlayTimeDisplay(hwndFrame, TRUE);/* Ensure display is visible */ … … 396 396 return usItems; 397 397 } 398 398 399 399 return 0; 400 400 } … … 402 402 BOOL DrgVerifyTypeCW(PDRAGITEM pDragItem, char * chrType) 403 403 { 404 /* DrgVerifyType() seems not to work when several types are in the list?? 404 /* DrgVerifyType() seems not to work when several types are in the list?? 405 405 Dokumentation says, it works... */ 406 406 /* Only check for a single type for now */ … … 472 472 for(ulHash=0;*theString!='\0'; theString++) 473 473 ulHash=*theString+37*ulHash; 474 474 475 475 return ulHash%HASHSIZE; 476 476 } … … 543 543 MRESULT handleDrag0ver(PDRAGINFO pdi, HWND hwnd) 544 544 { 545 545 546 546 /* Only accept one file */ 547 547 if(DrgGetNumObjects(pdi)!=1) { … … 551 551 if(DrgCheckForKnownType(pdi, hwnd)) 552 552 return MRFROM2SHORT(DOR_DROP, DO_COPY); 553 554 return MRFROM2SHORT(DOR_NEVERDROP, DO_COPY); 553 554 return MRFROM2SHORT(DOR_NEVERDROP, DO_COPY); 555 555 } 556 556 … … 567 567 char chrFile[CCHMAXPATH]; 568 568 PDRAGITEM pDragItem; 569 569 570 570 pDragItem=DrgQueryDragitemPtr(pdi, 0); 571 DrgQueryStrName(pDragItem->hstrSourceName,sizeof(chrFile), chrFile); 572 DrgQueryStrName(pDragItem->hstrContainerName,sizeof(chrSourceName), chrSourceName); 571 DrgQueryStrName(pDragItem->hstrSourceName,sizeof(chrFile), chrFile); 572 DrgQueryStrName(pDragItem->hstrContainerName,sizeof(chrSourceName), chrSourceName); 573 573 strcat(chrSourceName, chrFile); 574 574 575 575 /* Start new file */ 576 576 controlPlaying(hwnd, PLAY_FIRST, 0); … … 613 613 MPFROM2SHORT(SC_SIZE, TRUE), 614 614 MPFROMP(NULL)); 615 615 616 616 WinSendMsg(hwndMenu, /* Delete Minimize from the system menu */ 617 617 MM_DELETEITEM, 618 618 MPFROM2SHORT(SC_MINIMIZE, TRUE), 619 619 MPFROMP(NULL)); 620 620 621 621 WinSendMsg(hwndMenu, /* Delete Maximize from the system menu */ 622 622 MM_DELETEITEM, … … 653 653 654 654 switch (msg) 655 { 655 { 656 656 case DM_DRAGOVER: 657 657 { … … 682 682 swctl.fbJump=SWL_JUMPABLE; 683 683 WinAddSwitchEntry(&swctl); 684 684 685 685 adjustDialogControlPos(hwnd); 686 686 687 687 /* Set volume slider*/ 688 688 WinSendMsg( WinWindowFromID(hwnd, IDSL_MMPLAYERVOLUME), … … 690 690 MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE), 691 691 MPFROMLONG( ulVolume)); 692 692 693 693 /* Subclass buttons for DnD */ 694 694 orgButtonProc=WinSubclassWindow(WinWindowFromID(hwnd, IDPB_MMPLAYERPLAY), buttonProc); 695 695 WinSubclassWindow(WinWindowFromID(hwnd, IDPB_MMPLAYERPAUSE), buttonProc); 696 696 WinSubclassWindow(WinWindowFromID(hwnd, IDPB_MMPLAYERSTOP), buttonProc); 697 697 698 698 FixSysMenu(hwnd); 699 699 … … 701 701 if(allBMPs[MAIN_BMP_IDX].hbm) { 702 702 SWP swp; 703 704 WinQueryWindowPos(WinWindowFromID(hwnd, FID_TITLEBAR), &swp); 705 WinSetWindowPos(WinWindowFromID(hwnd, ID_CLIENT), NULLHANDLE, 706 WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME), 707 WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME), 703 704 WinQueryWindowPos(WinWindowFromID(hwnd, FID_TITLEBAR), &swp); 705 WinSetWindowPos(WinWindowFromID(hwnd, ID_CLIENT), NULLHANDLE, 706 WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME), 707 WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME), 708 708 allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cx, 709 709 allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cy, 710 710 SWP_SIZE|SWP_MOVE); 711 711 orgBgProc=WinSubclassWindow(WinWindowFromID(hwnd, ID_CLIENT), bgProc); 712 712 713 713 WinSetWindowPos(hwnd, NULLHANDLE, 0, 0, 714 714 allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cx+WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME)*2, … … 741 741 /*****************************************************/ 742 742 case WM_APPTERMINATENOTIFY: 743 743 744 744 switch(SHORT1FROMMP(mp1)) 745 745 { … … 754 754 return MRFALSE; 755 755 case NOTIFY_CONTEXT: 756 /* Show context menu. */ 756 /* Show context menu. */ 757 757 HlpContextMenu(hwnd, iWhichDisplay+ID_MENUITEMELAPSED, TRUE); 758 758 return MRFALSE; … … 761 761 } 762 762 return MRFALSE; 763 763 764 764 /*****************************************************/ 765 765 /* The following two messages are for device sharing */ … … 769 769 char chrCommand[100]; 770 770 int iWavePriv; 771 771 772 772 iWavePriv=ulPid; 773 773 … … 800 800 /* SETPOSITIONADVICE does not work for some reason, */ 801 801 /* so a timer is used. Yes, it's quit cumbersome... */ 802 /*****************************************************/ 802 /*****************************************************/ 803 803 case WM_TIMER: 804 804 if(SHORT1FROMMP(mp1)==IDTIMER_PLAY) { … … 821 821 /* Set slider position */ 822 822 823 WinPostMsg( WinWindowFromID(hwnd, IDSL_MMPLAYERPOSBAR), 823 WinPostMsg( WinWindowFromID(hwnd, IDSL_MMPLAYERPOSBAR), 824 824 SLM_SETSLIDERINFO, 825 825 MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE), … … 908 908 default: 909 909 break; 910 } 910 } 911 911 break; 912 912 … … 919 919 char chrCommand[50]; 920 920 char retMsg[20]; 921 921 922 922 switch(SHORT2FROMMP(mp1)) 923 923 { … … 949 949 static long lLastPos=0; 950 950 long lPos=LONGFROMMP(mp2); 951 951 952 952 bPosDragging=TRUE; 953 953 lPos*=ulTotalLength/100; … … 973 973 { 974 974 ULONG ulValue; 975 975 976 976 ulValue=LONGFROMMP(mp2); 977 977 ulVolume=ulValue; … … 985 985 986 986 bPosDragging=FALSE; 987 lPos*=1000; 987 lPos*=1000; 988 988 lPos*=ulTotalLength/100; 989 989 lPos/=1000;// Use only full seconds … … 992 992 seekAudioFile(lPos); 993 993 /* restart timer */ 994 WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, IDTIMER_PLAY, PLAYTIMER_DELAY); 994 WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, IDTIMER_PLAY, PLAYTIMER_DELAY); 995 995 ulPos=lPos/1000; 996 996 break; … … 1009 1009 break; 1010 1010 }/* switch */ 1011 1011 1012 1012 return WinDefDlgProc( hwnd, msg, mp1, mp2); 1013 1013 } … … 1029 1029 ))==NULLHANDLE) 1030 1030 return FALSE; 1031 1031 1032 1032 ulSize=sizeof(chrFileName); 1033 1033 1034 1034 if ((rc = DosOpen(chrFileName, &handle, &act, 1035 1035 0L, 0, OPEN_ACTION_OPEN_IF_EXISTS, … … 1095 1095 BOOL writeVolumeToIni(char * iniFile, char* chrApp, char *chrKey, ULONG ulVolume) 1096 1096 { 1097 1097 1098 1098 return IniSaveInt(iniFile, chrApp, chrKey, ulVolume); 1099 1099 } … … 1145 1145 if(hab) { 1146 1146 hmq=WinCreateMsgQueue(hab,0); 1147 if(hmq) { 1148 /* Check if user started prog by hand */ 1147 if(hmq) { 1148 /* Check if user started prog by hand */ 1149 1149 if(argc!=NUMPARAMS) {/* Not the right num of params */ 1150 1150 pmUsage(); … … 1164 1164 strcpy(chrClassName, params[1]); 1165 1165 1166 /* Get our ressource dll */ 1166 /* Get our ressource dll */ 1167 1167 RESSOURCEHANDLE=queryResModuleHandle(argv[0]); 1168 1168 /* Get data from INI file */ … … 1176 1176 WinRegisterClass(WinQueryAnchorBlock(HWND_DESKTOP), SLIDER_CLASS, privateSliderProc,0, SLADDBYTES); 1177 1177 1178 _loadBmps(); 1178 _loadBmps(); 1179 1179 DosGetInfoBlocks(&ptib, &ppib); 1180 1180 ulPid=ppib->pib_ulpid; … … 1183 1183 //DosBeep(5000, 400); 1184 1184 1185 if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, decodeStatusDialogProc, 1185 if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, decodeStatusDialogProc, 1186 1186 RESSOURCEHANDLE, IDDLG_MMPLAYER, 0) == DID_ERROR ) 1187 1187 { 1188 1188 /* 1189 Text: 1190 Title: "Installation problem" 1191 */ 1189 Text: 1190 Title: "Installation problem" 1191 */ 1192 1192 messageBox( text, IDSTR_CONVERTDIALOGERROR , sizeof(text), 1193 1193 title, IDSTR_INSTALLERRORTITLE , sizeof(title),
Note:
See TracChangeset
for help on using the changeset viewer.