Changeset 88
- Timestamp:
- Oct 1, 2023, 3:30:38 AM (23 months ago)
- Location:
- branches/v2.9_Lars/classes/mm-progs
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v2.9_Lars/classes/mm-progs/MMPlayer/customprocs.c
r2 r88 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/ … … 43 43 #include <stdio.h> 44 44 #include <stdlib.h> 45 #include <string.h> 45 46 46 47 … … 70 71 { 71 72 PDRAGINFO pdi=PVOIDFROMMP(mp1); 72 73 73 74 return handleDrag0ver( pdi, WinQueryWindow(hwnd, QW_PARENT)); 74 75 } … … 76 77 { 77 78 PDRAGINFO pdi=PVOIDFROMMP(mp1); 78 79 79 80 return handleDrop( pdi, WinQueryWindow(hwnd, QW_PARENT)); 80 81 } … … 104 105 if(swp.fl & SWP_MINIMIZE) 105 106 break; 106 107 107 108 hps=WinBeginPaint(hwnd, NULLHANDLE, NULLHANDLE); 108 109 WinQueryWindowRect(hwnd, &rcl); 109 110 WinDrawBitmap(hps, allBMPs[MAIN_BMP_IDX].hbm, 110 NULLHANDLE, 111 NULLHANDLE, 111 112 (PPOINTL)&rcl, 112 113 0, 0, 113 DBM_IMAGEATTRS); 114 DBM_IMAGEATTRS); 114 115 WinEndPaint(hps); 115 116 return MRFALSE; … … 183 184 184 185 WinDrawBitmap(ubPtr->hps, ci.hbmSource, 185 &ci.rclSource, 186 &ci.rclSource, 186 187 (PPOINTL)&rcl, 187 188 0, 0, … … 211 212 if(ulShowFeedback==2) 212 213 return 1; 213 214 214 215 switch(usControl) 215 216 { … … 237 238 hps=WinGetPS(hwnd); 238 239 WinDrawBitmap(hps, ci.hbmSource, 239 &ci.rclSource, 240 &ci.rclSource, 240 241 (PPOINTL)&rcl, 241 242 0, 0, … … 255 256 256 257 switch (msg) 257 { 258 { 258 259 #if 0 259 260 /* Drag and drop of audio files */ … … 330 331 USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWIDTH); 331 332 332 if(x<=lPos+usWidth+SLOFFSET && x>=lPos+SLOFFSET && 333 if(x<=lPos+usWidth+SLOFFSET && x>=lPos+SLOFFSET && 333 334 y<=WinQueryWindowUShort(hwnd, SLIDERY)+WinQueryWindowUShort(hwnd, SLIDERCY) 334 335 && y>=WinQueryWindowUShort(hwnd, SLIDERY)) { … … 346 347 if(SHORT1FROMMP(mp2)) { 347 348 hps=WinGetPS(hwnd); 348 WinQueryWindowRect(hwnd, &rcl); 349 WinQueryWindowRect(hwnd, &rcl); 349 350 GpiSetLineType(hps, LINETYPE_DOT); 350 351 ptl.x=rcl.xLeft; … … 369 370 if(WinQueryFocus(HWND_DESKTOP)==hwnd) { 370 371 if(SHORT2FROMMP(mp2)==VK_TAB && (SHORT1FROMMP(mp1) & KC_VIRTUALKEY)) 371 if(SHORT1FROMMP(mp1) & (KC_KEYUP|KC_PREVDOWN)) 372 if(SHORT1FROMMP(mp1) & (KC_KEYUP|KC_PREVDOWN)) 372 373 return (MRESULT)TRUE; 373 374 … … 486 487 USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWIDTH); 487 488 488 if(x<=lPos+usWidth+SLOFFSET && x>=lPos+SLOFFSET && 489 if(x<=lPos+usWidth+SLOFFSET && x>=lPos+SLOFFSET && 489 490 y<=WinQueryWindowUShort(hwnd, SLIDERY)+WinQueryWindowUShort(hwnd, SLIDERCY) 490 491 && y>=WinQueryWindowUShort(hwnd, SLIDERY)){ … … 522 523 USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWIDTH); 523 524 524 525 525 526 lTemp=lPos; 526 527 527 528 rcl.xLeft=WinQueryWindowULong(hwnd, SLIDERX); 528 529 rcl.yBottom=WinQueryWindowULong(hwnd, SLIDERY); … … 624 625 LONG lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS); 625 626 USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWIDTH); 626 if(x<=lPos+usWidth+SLOFFSET && x>=lPos+SLOFFSET && 627 if(x<=lPos+usWidth+SLOFFSET && x>=lPos+SLOFFSET && 627 628 y<=WinQueryWindowUShort(hwnd, SLIDERY)+WinQueryWindowUShort(hwnd, SLIDERCY) 628 629 && y>=WinQueryWindowUShort(hwnd, SLIDERY)) { … … 689 690 hps=WinBeginPaint(hwnd, NULLHANDLE, NULLHANDLE); 690 691 rcl3=rcl=rcl2; 691 /* Arm pos */ 692 /* Arm pos */ 692 693 rcl2.xLeft+=lPos; 693 /* Arm size */ 694 /* Arm size */ 694 695 rcl2.xRight=rcl2.xLeft+usWidth; 695 696 696 697 /* Shaft */ 697 698 /* Left part */ … … 742 743 if(!rc) 743 744 { 744 WinFillRect(hps,&rcl2, CLR_PALEGRAY); 745 WinFillRect(hps,&rcl2, CLR_PALEGRAY); 745 746 WinDrawBorder(hps, &rcl2, 2, 2, 0, 0 ,0x0400); 746 747 } … … 779 780 return (MRESULT)FALSE; 780 781 } 781 782 782 783 switch(poi->idItem) 783 784 { … … 786 787 //DosBeep(5000, 50); 787 788 WinDrawBitmap(poi->hps, ciArm.hbmSource, 788 &ciArm.rclSource, 789 &ciArm.rclSource, 789 790 (PPOINTL)&poi->rclItem, 790 791 0, 0, … … 796 797 WinDrawBitmap(poi->hps, 797 798 ci.hbmSource, 798 &ci.rclSource, 799 &ci.rclSource, 799 800 (PPOINTL)&poi->rclItem, 800 801 0, 0, … … 815 816 if(!WinDrawBitmap(poi->hps, ci.hbmSource, 816 817 &rcl, 817 //&ci.rclSource, 818 //&ci.rclSource, 818 819 (PPOINTL)&poi->rclItem, 819 820 0, 0, … … 863 864 char text[100]; 864 865 CONTROLINFO ci; 865 866 866 867 ci=ciControls[CTRLIDX_PLAYTIME];//ciVolSliderArm; 867 868 868 869 hps=WinBeginPaint(hwnd, NULLHANDLE, NULL); 869 870 if(WinQueryWindowText(hwnd, sizeof(text), text)) … … 871 872 POINTL ptl= {0}; 872 873 WinDrawBitmap(hps, ci.hbmSource, 873 &ci.rclSource, 874 &ci.rclSource, 874 875 &ptl, 875 876 0, 0, -
branches/v2.9_Lars/classes/mm-progs/MMPlayer/display.c
r2 r88 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/ … … 42 42 #include <stdio.h> 43 43 #include <stdlib.h> 44 #include <string.h> 44 45 45 46 /* 0: time, 1: remaining, 2: filename */ … … 88 89 89 90 90 /* This fun ktion sets the playtime display according to the user settings.91 /* This function sets the playtime display according to the user settings. 91 92 Supported are remaining time, elapsed time and ID3-tag display */ 92 void setPlayTimeText( hwndFrame)93 void setPlayTimeText(HWND hwndFrame) 93 94 { 94 95 char text[CCHMAXPATH]; … … 112 113 /* Show filename */ 113 114 text[0]=0; 114 115 115 116 if(ulTemp>=3) 116 117 text[0]=0; 117 118 else if(ulTemp>=0) 118 119 strcpy(text, chrPtrName); 119 120 120 121 #if 0 121 122 else 122 123 ulTemp=15; /* Show playtime for midi files */ 123 124 #endif 124 125 125 126 if(ulTemp>=3||!strlen(text)) { 126 127 /* Play time */ … … 135 136 ulDisplayTimer=ulTemp; 136 137 break; 137 138 138 139 #if 0 139 140 /* Show ID3 tag */ … … 149 150 if(ulTemp>=15) 150 151 text[0]=0; 151 else if(ulTemp>=12) 152 else if(ulTemp>=12) 152 153 methodPtr(cwAudio, &chrPtr, sizeof(text), IDINFO_GENRE); 153 154 else if(ulTemp>=9) … … 162 163 else 163 164 ulTemp=15; /* Show playtime for midi files */ 164 165 165 166 if(ulTemp>=15||!strlen(text)) { 166 167 /* Play time */ -
branches/v2.9_Lars/classes/mm-progs/MMPlayer/mmplayer.c
r46 r88 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), -
branches/v2.9_Lars/classes/mm-progs/MMPlayer/playaudio.c
r57 r88 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/ … … 73 73 char chrCommand[50]; 74 74 char retMsg[100]; 75 ULONG rc;76 75 77 76 iWavePriv=ulPid; … … 79 78 if(bPaused) { 80 79 sprintf(chrCommand,"RESUME wave%d wait", iWavePriv); 81 rc =mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);80 mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0); 82 81 bPaused=FALSE; 83 82 showPlayTimeDisplay( hwndFrame, TRUE); … … 85 84 else { 86 85 sprintf(chrCommand,"PAUSE wave%d wait", iWavePriv); 87 rc =mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);86 mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0); 88 87 bPaused=TRUE; 89 88 } … … 96 95 char chrCommand[50]; 97 96 char retMsg[100]; 98 ULONG rc;99 97 100 98 iWavePriv=ulPid; 101 99 102 100 if(bIsPlaying) { 103 101 sprintf(chrCommand,"stop wave%d wait", iWavePriv); 104 rc =mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);105 102 mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0); 103 106 104 sprintf(chrCommand,"close wave%d wait", iWavePriv); 107 rc =mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);108 105 mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0); 106 109 107 _resetDisplay(hwndFrame); 110 108 showPlayTimeDisplay( hwndFrame, TRUE); 111 109 WinStopTimer(WinQueryAnchorBlock(hwndFrame), hwndFrame, IDTIMER_PLAY); 112 110 bIsPlaying=FALSE; 113 bPaused=FALSE; 111 bPaused=FALSE; 114 112 } 115 113 return TRUE; … … 155 153 hwndNotify=hwndFrame;//WinWindowFromID(hwndTop, IDDLG_TOPMIDDLE); 156 154 157 /* Start audio file */ 155 /* Start audio file */ 158 156 sprintf(chrCommand,"open \"%s\" type %s alias wave%d SHAREABLE wait", chrSourceName, chrDevice, iWavePriv); 159 157 rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), hwndNotify, 0); 160 158 if((rc & 0x0000ffff)!=MCIERR_SUCCESS) 161 159 return 0; 162 160 163 161 /* Set time format */ 164 162 sprintf(chrCommand,"SET wave%d TIME FORMAT MILLISECONDS wait", iWavePriv); … … 168 166 rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0); 169 167 return 0; 170 } 168 } 171 169 172 170 #if 0 … … 219 217 char chrCommand[50]; 220 218 char retMsg[20]; 221 APIRET rc;222 219 223 220 sprintf(chrCommand,"PLAY wave%ld from %ld", ulPid, lPosSec); 224 rc=mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);221 mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0); 225 222 // ulStartPosition=lPosSec; 226 223 bPaused=FALSE; … … 269 266 270 267 /* Every folder has one running play thread to handle play commands */ 271 void _OptlinkplayThreadFunc (void *arg)268 void playThreadFunc (void *arg) 272 269 { 273 270 HAB hab; -
branches/v2.9_Lars/classes/mm-progs/audioconverter/audconv.c
r74 r88 380 380 if((hmmioTarget=mmioOpen(chrTargetName, &mmioinfo, MMIO_WRITE|MMIO_CREATE))==NULLHANDLE) 381 381 { 382 UCHAR chrError[ CCHMAXPATH];382 UCHAR chrError[64]; 383 383 UCHAR text[CCHMAXPATH*2]; 384 384 rc=mmioGetLastError(hmmioTarget); 385 mciGetErrorString(mmioinfo.ulErrorRet ,chrError, sizeof(chrError) );385 mciGetErrorString(mmioinfo.ulErrorRet ,chrError, sizeof(chrError)-1); 386 386 snprintf((PCHAR)text, sizeof(text)-1,"mmioOpen error with file %s:\n%s\n%lu", chrTargetName, chrError,mmioinfo.ulErrorRet); 387 387 mmioClose(hmmio,0); -
branches/v2.9_Lars/classes/mm-progs/imageconverter/imgconv.c
r74 r88 143 143 SIZEL ImageSize; 144 144 ULONG dwHeight, dwWidth; 145 SHORT wBitCount;146 145 FOURCC fccStorageSystem; 147 146 ULONG dwPadBytes; … … 244 243 dwHeight = mmImgHdr.mmXDIBHeader.BMPInfoHeader2.cy; 245 244 dwWidth = mmImgHdr.mmXDIBHeader.BMPInfoHeader2.cx; 246 wBitCount = mmImgHdr.mmXDIBHeader.BMPInfoHeader2.cBitCount;247 245 dwRowBits = dwWidth * mmImgHdr.mmXDIBHeader.BMPInfoHeader2.cBitCount; 248 246 dwNumRowBytes = dwRowBits >> 3; … … 876 874 877 875 if (ulBytesRead) { 878 LONG lWritten; 879 lWritten=mmioWrite (hmmioTarget, pRowBuffer, (ULONG)ulBytesRead); 876 mmioWrite (hmmioTarget, pRowBuffer, (ULONG)ulBytesRead); 880 877 #ifdef DEBUG 881 878 HlpWriteToTrapLog("ulBytesRead: %d, lWritten: %d.\n", ulBytesRead, lWritten); -
branches/v2.9_Lars/classes/mm-progs/videoplayer/mmplayer.c
r46 r88 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.