Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
4.6 KiB

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