Annotation of mstools/samples/sdktools/perfmon/rptoptns.c, revision 1.1.1.1

1.1       root        1: 
                      2: #include "perfmon.h"
                      3: 
                      4: #include "report.h"     // for ReportData
                      5: #include "utils.h"
                      6: #include "playback.h"   // for PlayingBackLog
                      7: #include "pmhelpid.h"   // Help IDs
                      8: 
                      9: static BOOL LocalManualRefresh ;
                     10: static DWORD iIntervalMSecs ;
                     11: 
                     12: 
                     13: void static OnInitDialog (HWND hDlg, PREPORT pReport)
                     14:    {
                     15:    int            i ;
                     16: 
                     17:    for (i = 0 ;
                     18:         i < NumIntervals ;
                     19:         i++)
                     20:       CBAddInt (DialogControl (hDlg, IDD_REPORTOPTIONSINTERVAL), 
                     21:                 aiIntervals [i]) ;
                     22: 
                     23:    DialogSetInterval (hDlg, IDD_REPORTOPTIONSINTERVAL,
                     24:       pReport->iIntervalMSecs) ;
                     25: 
                     26:    LocalManualRefresh = pReport->bManualRefresh ;
                     27: 
                     28:    if (LocalManualRefresh && !PlayingBackLog())
                     29:       {
                     30:       DialogEnable (hDlg, IDD_REPORTOPTIONSINTERVAL, FALSE) ;
                     31:       DialogEnable (hDlg, IDD_REPORTOPTIONSINTERVALTEXT, FALSE) ;
                     32:       }
                     33: 
                     34:    CheckRadioButton(hDlg,
                     35:       IDD_REPORTOPTIONSMANUALREFRESH,
                     36:       IDD_REPORTOPTIONSPERIODIC,
                     37:       LocalManualRefresh ? IDD_REPORTOPTIONSMANUALREFRESH :
                     38:       IDD_REPORTOPTIONSPERIODIC) ;
                     39: 
                     40:    WindowCenter (hDlg) ;
                     41: 
                     42:    }
                     43: 
                     44: 
                     45: int FAR WINAPI ReportOptionsDlgProc (HWND hDlg, 
                     46:                                      unsigned iMessage, 
                     47:                                      WPARAM wParam, 
                     48:                                      LONG lParam)
                     49:    {
                     50:    BOOL           bHandled ;
                     51: 
                     52:    bHandled = TRUE ;
                     53:    switch (iMessage)
                     54:       {
                     55:       case WM_INITDIALOG:
                     56:          dwCurrentDlgID = HC_PM_idDlgOptionReport ;
                     57:          OnInitDialog (hDlg, (PREPORT) lParam) ;
                     58:          return  (TRUE) ;
                     59: 
                     60:       case WM_CLOSE:
                     61:          dwCurrentDlgID = 0 ;
                     62:          EndDialog (hDlg, 0) ;
                     63:          break ;
                     64: 
                     65:       case WM_COMMAND:
                     66:          switch(wParam)
                     67:             {
                     68:             case IDD_OK:
                     69:                {
                     70:                FLOAT    eIntervalMSec ;
                     71: 
                     72:                eIntervalMSec = DialogFloat (hDlg, IDD_REPORTOPTIONSINTERVAL, NULL) ;
                     73: 
                     74:                if (eIntervalMSec > MAX_INTERVALSEC ||
                     75:                    eIntervalMSec < MIN_INTERVALSEC)
                     76:                   {
                     77:                   DlgErrorBox (hDlg, ERR_BADTIMEINTERVAL) ;
                     78:                   SetFocus (DialogControl (hDlg, IDD_REPORTOPTIONSINTERVAL)) ;
                     79:                   EditSetTextEndPos (hDlg, IDD_REPORTOPTIONSINTERVAL) ;
                     80:                   return (FALSE) ;
                     81:                   break ;
                     82:                   }
                     83:                eIntervalMSec = eIntervalMSec * (FLOAT) 1000.0 +
                     84:                   (FLOAT) 0.5 ;
                     85: 
                     86:                iIntervalMSecs = (DWORD) (eIntervalMSec);
                     87:                dwCurrentDlgID = 0 ;
                     88:                EndDialog (hDlg, 1) ;
                     89:                }
                     90:                break ;
                     91: 
                     92:             case IDD_CANCEL:
                     93:                dwCurrentDlgID = 0 ;
                     94:                EndDialog (hDlg, 0) ;
                     95:                break ;
                     96: 
                     97:             case IDD_REPORTOPTIONSPERIODIC :
                     98:             case IDD_REPORTOPTIONSMANUALREFRESH :
                     99:                
                    100:                // check if the Manual refresh is currently checked.
                    101:                // Then toggle the ManualRefresh button
                    102:                LocalManualRefresh =
                    103:                   IsDlgButtonChecked (hDlg, IDD_REPORTOPTIONSMANUALREFRESH) ;
                    104: 
                    105:                CheckRadioButton(hDlg,
                    106:                   IDD_REPORTOPTIONSMANUALREFRESH,
                    107:                   IDD_REPORTOPTIONSPERIODIC,
                    108:                   LocalManualRefresh ? IDD_REPORTOPTIONSPERIODIC :
                    109:                   IDD_REPORTOPTIONSMANUALREFRESH) ;
                    110: 
                    111:                DialogEnable (hDlg, IDD_REPORTOPTIONSINTERVAL, LocalManualRefresh) ;
                    112:                DialogEnable (hDlg, IDD_REPORTOPTIONSINTERVALTEXT, LocalManualRefresh) ;
                    113:                LocalManualRefresh = !LocalManualRefresh ;
                    114:                break ;
                    115: 
                    116:             case IDD_DISPLAYHELP:
                    117:                CallWinHelp (dwCurrentDlgID) ;
                    118:                break ;
                    119: 
                    120:             default:
                    121:                bHandled = FALSE ;
                    122:                break;
                    123:             }
                    124:          break;
                    125: 
                    126: 
                    127:       default:
                    128:             bHandled = FALSE ;
                    129:          break ;            
                    130:       }  // switch
                    131: 
                    132:    return (bHandled) ;
                    133:    }  // ReportOptionsDlgProc
                    134: 
                    135: 
                    136: 
                    137: 
                    138: BOOL DisplayReportOptions (HWND hWndParent,
                    139:                            HWND hWndReport)
                    140:    {  // DisplayReportOptions
                    141:    PREPORT        pReport ;
                    142: 
                    143:    pReport = ReportData (hWndParent) ;
                    144: 
                    145:    if (DialogBoxParam (hInstance, idDlgReportOptions, 
                    146:                        hWndParent, (DLGPROC) ReportOptionsDlgProc, 
                    147:                        (LPARAM) pReport))
                    148:       {  // if
                    149:       pReport->iIntervalMSecs = iIntervalMSecs ;
                    150:       if (LocalManualRefresh != pReport->bManualRefresh)
                    151:          {
                    152:          ToggleReportRefresh (hWndReport) ;
                    153:          }
                    154:       else
                    155:          {
                    156:          SetReportTimer (pReport) ;
                    157:          }
                    158:       }  // if
                    159: 
                    160:    return (TRUE) ;
                    161:    }  // DisplayReportOptions
                    162: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.