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.

251 lines
6.6 KiB

  1. //
  2. // Driver Verifier UI
  3. // Copyright (c) Microsoft Corporation, 1999
  4. //
  5. //
  6. //
  7. // module: CSetPage.cpp
  8. // author: DMihai
  9. // created: 11/1/00
  10. //
  11. // Description:
  12. //
  13. #include "stdafx.h"
  14. #include "verifier.h"
  15. #include "CSetPage.h"
  16. #include "VrfUtil.h"
  17. #include "VGlobal.h"
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. //
  24. // Change this if you add/remove/change order
  25. // of radio buttons on this page
  26. //
  27. #define FIRST_RADIO_BUTTON_ID IDC_CUSTSETT_PREDEF_RADIO
  28. //
  29. // Help IDs
  30. //
  31. static DWORD MyHelpIds[] =
  32. {
  33. IDC_CUSTSETT_PREDEF_RADIO, IDH_DV_EnablePredefined,
  34. IDC_CUSTSETT_FULLLIST_RADIO, IDH_DV_IndividualSettings,
  35. IDC_CUSTSETT_TYPICAL_CHECK, IDH_DV_Standard,
  36. IDC_CUSTSETT_EXCESS_CHECK, IDH_DV_Rigorous,
  37. IDC_CUSTSETT_LOWRES_CHECK, IDH_DV_LowResource,
  38. 0, 0
  39. };
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CCustSettPage property page
  42. IMPLEMENT_DYNCREATE(CCustSettPage, CVerifierPropertyPage)
  43. CCustSettPage::CCustSettPage()
  44. : CVerifierPropertyPage( CCustSettPage::IDD )
  45. {
  46. //{{AFX_DATA_INIT(CCustSettPage)
  47. m_bTypicalTests = FALSE;
  48. m_bExcessiveTests = FALSE;
  49. m_bLowResTests = FALSE;
  50. m_nCrtRadio = -1;
  51. //}}AFX_DATA_INIT
  52. }
  53. CCustSettPage::~CCustSettPage()
  54. {
  55. }
  56. void CCustSettPage::DoDataExchange(CDataExchange* pDX)
  57. {
  58. CVerifierPropertyPage::DoDataExchange(pDX);
  59. //{{AFX_DATA_MAP(CCustSettPage)
  60. DDX_Control(pDX, IDC_CUSTSETT_NEXT_DESCR_STATIC, m_NextDescription);
  61. DDX_Control(pDX, IDC_CUSTSETT_TYPICAL_CHECK, m_TypicalTestsCheck);
  62. DDX_Control(pDX, IDC_CUSTSETT_LOWRES_CHECK, m_LowresTestsCheck);
  63. DDX_Control(pDX, IDC_CUSTSETT_EXCESS_CHECK, m_ExcessTestsCheck);
  64. DDX_Check(pDX, IDC_CUSTSETT_TYPICAL_CHECK, m_bTypicalTests);
  65. DDX_Check(pDX, IDC_CUSTSETT_EXCESS_CHECK, m_bExcessiveTests);
  66. DDX_Check(pDX, IDC_CUSTSETT_LOWRES_CHECK, m_bLowResTests);
  67. DDX_Radio(pDX, IDC_CUSTSETT_PREDEF_RADIO, m_nCrtRadio);
  68. //}}AFX_DATA_MAP
  69. }
  70. BEGIN_MESSAGE_MAP(CCustSettPage, CVerifierPropertyPage)
  71. //{{AFX_MSG_MAP(CCustSettPage)
  72. ON_BN_CLICKED(IDC_CUSTSETT_FULLLIST_RADIO, OnFulllistRadio)
  73. ON_BN_CLICKED(IDC_CUSTSETT_PREDEF_RADIO, OnPredefRadio)
  74. ON_WM_CONTEXTMENU()
  75. ON_MESSAGE( WM_HELP, OnHelp )
  76. //}}AFX_MSG_MAP
  77. END_MESSAGE_MAP()
  78. /////////////////////////////////////////////////////////////////////////////
  79. VOID CCustSettPage::EnablePredefCheckboxes( BOOL bEnable )
  80. {
  81. m_TypicalTestsCheck.EnableWindow( bEnable );
  82. m_LowresTestsCheck.EnableWindow( bEnable );
  83. m_ExcessTestsCheck.EnableWindow( bEnable );
  84. }
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CCustSettPage message handlers
  87. /////////////////////////////////////////////////////////////////////////////
  88. LRESULT CCustSettPage::OnWizardNext()
  89. {
  90. LRESULT lNextPageId;
  91. //
  92. // Let's assume we cannot continue
  93. //
  94. lNextPageId = -1;
  95. if( UpdateData() == TRUE )
  96. {
  97. if( IDC_CUSTSETT_PREDEF_RADIO - FIRST_RADIO_BUTTON_ID == m_nCrtRadio )
  98. {
  99. //
  100. // Use predefined settings
  101. //
  102. if( FALSE == m_bTypicalTests &&
  103. FALSE == m_bExcessiveTests &&
  104. FALSE == m_bLowResTests )
  105. {
  106. //
  107. // No tests are currently selected - we cannot continue
  108. //
  109. VrfErrorResourceFormat( IDS_NO_TESTS_SELECTED );
  110. }
  111. else
  112. {
  113. //
  114. // Set our data according to the GUI
  115. //
  116. //
  117. // Use predefined settings
  118. //
  119. g_NewVerifierSettings.m_SettingsBits.EnableTypicalTests( m_bTypicalTests );
  120. g_NewVerifierSettings.m_SettingsBits.EnableExcessiveTests( m_bExcessiveTests );
  121. g_NewVerifierSettings.m_SettingsBits.EnableLowResTests( m_bLowResTests );
  122. //
  123. // Go to the next page
  124. //
  125. lNextPageId = IDD_DRVSET_PAGE;
  126. }
  127. }
  128. else
  129. {
  130. //
  131. // Select the tests to be performed from a full list
  132. //
  133. lNextPageId = IDD_FULL_LIST_SETT_PAGE;
  134. }
  135. }
  136. if( -1 != lNextPageId )
  137. {
  138. //
  139. // Have some valid custom settings and we are going to the next page
  140. //
  141. g_NewVerifierSettings.m_SettingsBits.m_SettingsType = CSettingsBits::SettingsTypeCustom;
  142. }
  143. GoingToNextPageNotify( lNextPageId );
  144. return lNextPageId;
  145. }
  146. /////////////////////////////////////////////////////////////////////////////
  147. BOOL CCustSettPage::OnInitDialog()
  148. {
  149. //
  150. // Don't try to reconstruct the current data from the registry
  151. // to the GUI because it's too hard. Always start with standard tests.
  152. //
  153. m_nCrtRadio = IDC_CUSTSETT_PREDEF_RADIO - FIRST_RADIO_BUTTON_ID;
  154. m_bTypicalTests = TRUE;
  155. m_bExcessiveTests = FALSE;
  156. m_bLowResTests = FALSE;
  157. CVerifierPropertyPage::OnInitDialog();
  158. VrfSetWindowText( m_NextDescription, IDS_TAS_PAGE_NEXT_DESCR_PREDEFINED );
  159. return TRUE; // return TRUE unless you set the focus to a control
  160. // EXCEPTION: OCX Property Pages should return FALSE
  161. }
  162. /////////////////////////////////////////////////////////////////////////////
  163. void CCustSettPage::OnFulllistRadio()
  164. {
  165. EnablePredefCheckboxes( FALSE );
  166. VrfSetWindowText( m_NextDescription, IDS_TAS_PAGE_NEXT_DESCR_LIST );
  167. }
  168. /////////////////////////////////////////////////////////////////////////////
  169. void CCustSettPage::OnPredefRadio()
  170. {
  171. EnablePredefCheckboxes( TRUE );
  172. VrfSetWindowText( m_NextDescription, IDS_TAS_PAGE_NEXT_DESCR_PREDEFINED );
  173. }
  174. /////////////////////////////////////////////////////////////
  175. BOOL CCustSettPage::OnSetActive()
  176. {
  177. m_pParentSheet->SetWizardButtons( PSWIZB_NEXT |
  178. PSWIZB_BACK );
  179. return CVerifierPropertyPage::OnSetActive();
  180. }
  181. /////////////////////////////////////////////////////////////
  182. LONG CCustSettPage::OnHelp( WPARAM wParam, LPARAM lParam )
  183. {
  184. LONG lResult = 0;
  185. LPHELPINFO lpHelpInfo = (LPHELPINFO)lParam;
  186. ::WinHelp(
  187. (HWND) lpHelpInfo->hItemHandle,
  188. g_szVerifierHelpFile,
  189. HELP_WM_HELP,
  190. (DWORD_PTR) MyHelpIds );
  191. return lResult;
  192. }
  193. /////////////////////////////////////////////////////////////////////////////
  194. void CCustSettPage::OnContextMenu(CWnd* pWnd, CPoint point)
  195. {
  196. ::WinHelp(
  197. pWnd->m_hWnd,
  198. g_szVerifierHelpFile,
  199. HELP_CONTEXTMENU,
  200. (DWORD_PTR) MyHelpIds );
  201. }