Ignore:
Timestamp:
Oct 2, 2023, 11:34:35 PM (23 months ago)
Author:
gyoung
Message:

Remaining changes from merge with Lars 2.9 branch

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/classes/mm-progs/master_volume/volume.c

    r2 r104  
    1717 * along with this program; see the file COPYING.  If not, write to
    1818 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    19  */         
     19 */
    2020/*
    2121 * If you need another license for your project/product (commercial,
    2222 * noncommercial, whatever) contact me at
    23  * 
     23 *
    2424 * http://www.os2world.com/cdwriting
    2525 * http://www.geocities.com/SiliconValley/Sector/5785/
     
    3535#define INCL_MMIOOS2
    3636#define INCL_MCIOS2
    37 #define INCL_SECONDARYWINDOW   
    38 #define INCL_GRAPHICBUTTON 
     37#define INCL_SECONDARYWINDOW
     38#define INCL_GRAPHICBUTTON
    3939#include <os2.h>
    4040#include <sw.h>
     
    7373BOOL bHaveWindowPos=FALSE;
    7474
    75 BOOL bMute=FALSE; 
     75BOOL bMute=FALSE;
    7676HMODULE RESSOURCEHANDLE=0;
    7777int bTBVisible=0;
     
    134134
    135135/* Masteraudio does not support NOTIFY so use a thread to prevent PM freeze */
    136 MRESULT EXPENTRY volumeObjectProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
     136MRESULT EXPENTRY volumeObjectProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    137137{
    138138  switch(msg)
     
    153153              ULONG mastervolume;              /* Set to master volumepercentage
    154154                                                  percentage by this example      */
    155              
     155
    156156              USHORT usDeviceID=0;
    157157              MCI_MASTERAUDIO_PARMS masteraudioparms;
     
    161161              memset(&openParms,0, sizeof(openParms));
    162162              openParms.pszDeviceType="Masteraudio";
    163  
     163
    164164              rc=mciSendCommand(0,       /* Device                          */
    165165                             MCI_OPEN,                /* Master audio message            */
     
    171171              mciGetErrorString(rc,chrCommand, sizeof(chrCommand));
    172172              //sprintf(chrCommand, "%x", rc);
    173               WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrCommand, "", 1234, MB_MOVEABLE);             
     173              WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrCommand, "", 1234, MB_MOVEABLE);
    174174              DosBeep(5000, 10);
    175175              usDeviceID=openParms.usDeviceID;
     
    178178              /* Get current system master
    179179                 volume setting                  */
    180              
     180
    181181              mciSendCommand(usDeviceID,       /* Device                          */
    182182                             MCI_MASTERAUDIO,                /* Master audio message            */
     
    188188              /* Get current system master
    189189                 volume setting                  */
    190              
     190
    191191              mciSendCommand(usDeviceID,       /* Device                          */
    192192                             MCI_MASTERAUDIO,                /* Master audio message            */
     
    195195                             (PVOID) &masteraudioparms,      /* Data structure                  */
    196196                             0);                             /* User parm                       */
    197              
     197
    198198              mastervolume = masteraudioparms.ulReturn;
    199199                          DosBeep(500, 10);
     
    228228}
    229229
    230 void _Optlink volumeThreadFunc (void *arg)
     230void volumeThreadFunc (void *arg)
    231231{
    232232  HAB  hab;
     
    238238    hmq=WinCreateMsgQueue(hab,0);
    239239    if(hmq) {
    240      
     240
    241241      if((hwndThread=WinCreateWindow(HWND_OBJECT, WC_STATIC, "", 0,0,0,0,0, NULLHANDLE,
    242242                                     HWND_BOTTOM, 1, NULLHANDLE, NULLHANDLE))==NULLHANDLE) {
     
    245245      }
    246246      WinSubclassWindow(hwndThread,&volumeObjectProc);
    247       /* Window created. */             
     247      /* Window created. */
    248248
    249249      while(WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))
    250250        WinDispatchMsg(hab,&qmsg);
    251251      WinDestroyWindow(hwndThread);
    252      
     252
    253253      WinDestroyMsgQueue(hmq);
    254254    }
     
    267267  if((hwndTitleBar=WinWindowFromID(hwnd, FID_TITLEBAR))==NULLHANDLE)
    268268    return;
    269      
     269
    270270  hwndPopup = WinLoadMenu(hwnd, RESSOURCEHANDLE, IDM_POPUP);
    271271  if (hwndPopup == NULLHANDLE)
    272272    return;
    273  
     273
    274274  bVisible=WinIsWindowVisible(hwndTitleBar);
    275275
    276276  if(!bVisible)
    277     WinSendMsg(hwndPopup,MM_SETITEMATTR,MPFROM2SHORT(IDM_ITEMTITLEBAR,FALSE), 
     277    WinSendMsg(hwndPopup,MM_SETITEMATTR,MPFROM2SHORT(IDM_ITEMTITLEBAR,FALSE),
    278278               MPFROM2SHORT(MIA_CHECKED,MIA_CHECKED));
    279279
    280280  WinQueryPointerPos(HWND_DESKTOP, &ptl) ;
    281281  WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
    282   WinPopupMenu(hwnd, hwnd, hwndPopup, 
     282  WinPopupMenu(hwnd, hwnd, hwndPopup,
    283283               ptl.x, ptl.y, IDM_ITEMEXIT, PU_HCONSTRAIN | PU_VCONSTRAIN |
    284284               PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 | PU_NONE  );
     
    296296      if(!WinQueryWindowPos(hwndTitleBar,&swp))
    297297        return FALSE;
    298      
     298
    299299      if(!WinQueryWindowPos(hwnd,&swpFrame))
    300300        return FALSE;
    301      
     301
    302302      /* Shrink or expand the frame */
    303303      if(!bTBVisible) {
    304         WinSetWindowPos(hwnd, NULLHANDLE, swpFrame.x, swpFrame.y,//-swp.cy, 
     304        WinSetWindowPos(hwnd, NULLHANDLE, swpFrame.x, swpFrame.y,//-swp.cy,
    305305                        swpFrame.cx, swpFrame.cy+swp.cy, SWP_SIZE|SWP_MOVE);
    306306        bTBVisible=TRUE;
     
    308308      else
    309309        {
    310           WinSetWindowPos(hwnd, NULLHANDLE, swpFrame.x, swpFrame.y,//+swp.cy, 
     310          WinSetWindowPos(hwnd, NULLHANDLE, swpFrame.x, swpFrame.y,//+swp.cy,
    311311                          swpFrame.cx, swpFrame.cy-swp.cy, SWP_SIZE|SWP_MOVE);
    312312          bTBVisible=FALSE;
    313313        }
    314314    }
    315   WinSendMsg(hwnd,WM_UPDATEFRAME,0,0);     
     315  WinSendMsg(hwnd,WM_UPDATEFRAME,0,0);
    316316  return TRUE;
    317317}
     
    326326
    327327  switch (msg)
    328     {     
     328    {
    329329    case WM_INITDLG:
    330330      {
     
    345345                    (MPARAM) 0L,
    346346                    (MPARAM) 100L);
    347        
     347
    348348        WinSendMsg( WinWindowFromID(hwnd, IDCS_VOLUME),
    349349                    CSM_SETINCREMENT,
    350350                    (MPARAM) 10L,
    351351                    (MPARAM) 1L);
    352        
    353        
     352
     353
    354354        WinSendMsg( WinWindowFromID(hwnd, IDCS_VOLUME),
    355355                    CSM_SETVALUE,
    356356                    (MPARAM) queryMasterVolume(),
    357357                    (MPARAM) NULL);
    358        
    359        
     358
     359
    360360        // getMessage(title, IDSTR_CONVERTCHANNELS, sizeof(title), RESSOURCEHANDLE, hwnd);
    361361        /* Set dialog font to WarpSans for Warp 4 and above */
     
    365365                          DEFAULT_DIALOG_FONT );
    366366        }
    367        
     367
    368368        hpProgramIcon =
    369369          WinLoadPointer(
     
    371371                         (HMODULE) NULL,              /* Resource is kept in .Exe file. */
    372372                         ID_ICONVOLUME );                   /* Which icon to use.             */
    373        
     373
    374374        WinSendMsg(
    375375                   hwnd,                    /* Dialog window handle.                 */
     
    399399                            PP_BACKGROUNDCOLOR,(ULONG)sizeof(rgb), &rgb);
    400400          }
    401         ulSize=sizeof(RGB);       
     401        ulSize=sizeof(RGB);
    402402        if(IniRestoreData(chrIniFile, INI_VOLUME_APP, INI_BTNFGCLR_KEY, &rgb, &ulSize))
    403403          {
     
    428428        /* Remove top frame controls if titlebar is hidden */
    429429        SHORT countSwp;
    430                
     430
    431431        countSwp = (int) WinDefDlgProc(hwnd, msg, mp1, mp2);
    432432        if(countSwp) {
    433           if(bTBVisible==0) { 
    434             /* Hide frame controls */       
     433          if(bTBVisible==0) {
     434            /* Hide frame controls */
    435435            /* countSWP:  number of standard framecontrols
    436436               pswp:      Array of SWP describing the framecontrols.
     
    439439            PSWP pswpTB=NULLHANDLE;
    440440            PSWP pswp=(PSWP)mp1;
    441             int y, cy;
     441            int y;
    442442
    443443            for (a = 0; a < countSwp; a++)
     
    448448                    pswpTB=&pswp[a];
    449449                    y=pswp[a].y;
    450                     cy=pswp[a].cy;
    451450                    //    DosBeep(500,600);
    452451                    break;
     
    485484    case WM_BUTTON1MOTIONSTART:
    486485      /* Drag the window without titlebar */
    487       WinSendMsg(hwnd, WM_TRACKFRAME, 
     486      WinSendMsg(hwnd, WM_TRACKFRAME,
    488487                 MPFROMSHORT(TF_MOVE   /*| TF_SETPOINTERPOS */), NULL) ;
    489488      return (MRESULT) 0 ;
     
    504503           {
    505504             if (SHORT2FROMMP(mp1)==GBN_BUTTONDOWN) {
    506                bMute=TRUE; 
     505               bMute=TRUE;
    507506               setMasterVolume(hwnd, 0);
    508507             }
    509508             else if (SHORT2FROMMP(mp1)==GBN_BUTTONUP) {
    510509               SHORT sValue;
    511                
     510
    512511               bMute=FALSE;
    513512               WinSendMsg(WinWindowFromID(hwnd, IDCS_VOLUME),CSM_QUERYVALUE ,MPFROMP(&sValue) ,0);
     
    524523        memset(&masteraudioparms,0, sizeof(masteraudioparms));
    525524        /* Save master audio level */
    526         mciSendCommand( 0,       
     525        mciSendCommand( 0,
    527526                       MCI_MASTERAUDIO,                /* Master audio message            */
    528527                       MCI_WAIT |  MCI_MASTERVOL | MCI_SAVESETTING,
     
    594593      bTBVisible=IniRestoreInt(chrIniFile, INI_VOLUME_APP, INI_TBVISIBLE_KEY, 1);
    595594
    596       if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, 
     595      if( WinDlgBox( HWND_DESKTOP, NULLHANDLE,
    597596                     volumeDialogProc, RESSOURCEHANDLE, IDDLG_VOLUME, 0) == DID_ERROR )
    598597        {
    599598          /*
    600             Text:   
    601             Title:  "Installation problem"                       
     599            Text:
     600            Title:  "Installation problem"
    602601            */
    603602#if 0
     
    605604                      title, IDSTR_INSTALLERRORTITLE , sizeof(title),
    606605                      RESSOURCEHANDLE, HWND_DESKTOP, MB_OK | MB_ICONEXCLAMATION | MB_MOVEABLE);
    607 #endif       
     606#endif
    608607          WinDestroyMsgQueue( hmq );
    609608          WinTerminate( hab );
     
    637636                  (MPARAM) NULL);
    638637      while ( WinGetMsg( hab, (PQMSG) &qmsg, (HWND) NULL, 0, 0) )
    639         WinDispatchMsg( hab, (PQMSG) &qmsg ); 
     638        WinDispatchMsg( hab, (PQMSG) &qmsg );
    640639#endif
    641640      freeResHandle();
Note: See TracChangeset for help on using the changeset viewer.