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.

224 lines
4.8 KiB

  1. // ToolDefs.cpp : implementation file
  2. //
  3. #include "precomp.hxx"
  4. #ifdef _DEBUG
  5. #define new DEBUG_NEW
  6. #undef THIS_FILE
  7. static char THIS_FILE[] = __FILE__;
  8. #endif
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CToolDefs dialog
  11. CToolDefs::CToolDefs(CWnd* pParent /*=NULL*/)
  12. : CPropertyPage(CToolDefs::IDD)
  13. {
  14. //{{AFX_DATA_INIT(CToolDefs)
  15. m_szStartPath = _T("");
  16. m_fAutoInstall = FALSE;
  17. m_iDeployment = -1;
  18. m_iUI = -1;
  19. //}}AFX_DATA_INIT
  20. }
  21. CToolDefs::~CToolDefs()
  22. {
  23. *m_ppThis = NULL;
  24. }
  25. void CToolDefs::DoDataExchange(CDataExchange* pDX)
  26. {
  27. CDialog::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(CToolDefs)
  29. DDX_Text(pDX, IDC_EDIT1, m_szStartPath);
  30. DDX_Check(pDX, IDC_CHECK1, m_fAutoInstall);
  31. DDX_Radio(pDX, IDC_RADIO1, m_iDeployment);
  32. DDX_Radio(pDX, IDC_RADIO7, m_iUI);
  33. //}}AFX_DATA_MAP
  34. }
  35. BEGIN_MESSAGE_MAP(CToolDefs, CDialog)
  36. //{{AFX_MSG_MAP(CToolDefs)
  37. ON_BN_CLICKED(IDC_BUTTON1, OnBrowse)
  38. ON_BN_CLICKED(IDC_RADIO1, OnUseWizard)
  39. ON_BN_CLICKED(IDC_RADIO2, OnUsePropPage)
  40. ON_BN_CLICKED(IDC_RADIO4, OnDeployDisabled)
  41. ON_BN_CLICKED(IDC_RADIO5, OnDeployPublished)
  42. ON_BN_CLICKED(IDC_RADIO6, OnDeployAssigned)
  43. ON_BN_CLICKED(IDC_RADIO8, OnBasicUI)
  44. ON_BN_CLICKED(IDC_RADIO7, OnMaxUI)
  45. ON_BN_CLICKED(IDC_RADIO9, OnDefaultUI)
  46. ON_EN_CHANGE(IDC_EDIT1, OnChangePath)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CToolDefs message handlers
  51. BOOL CToolDefs::OnInitDialog()
  52. {
  53. m_fAutoInstall = m_pToolDefaults->fAutoInstall;
  54. m_szStartPath = m_pToolDefaults->szStartPath;
  55. switch (m_pToolDefaults->NPBehavior)
  56. {
  57. case NP_DISABLED:
  58. m_iDeployment = 1;
  59. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  60. break;
  61. case NP_PUBLISHED:
  62. m_iDeployment = 2;
  63. GetDlgItem(IDC_CHECK1)->EnableWindow(TRUE);
  64. break;
  65. case NP_ASSIGNED:
  66. m_iDeployment = 3;
  67. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  68. break;
  69. case NP_PROPPAGE:
  70. m_iDeployment = 4;
  71. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  72. break;
  73. case NP_WIZARD:
  74. default:
  75. m_iDeployment = 0;
  76. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  77. break;
  78. }
  79. switch (m_pToolDefaults->UILevel)
  80. {
  81. case INSTALLUILEVEL_FULL:
  82. m_iUI = 0;
  83. break;
  84. case INSTALLUILEVEL_BASIC:
  85. m_iUI = 1;
  86. break;
  87. case INSTALLUILEVEL_DEFAULT:
  88. default:
  89. m_iUI = 2;
  90. break;
  91. }
  92. CPropertyPage::OnInitDialog();
  93. return TRUE; // return TRUE unless you set the focus to a control
  94. // EXCEPTION: OCX Property Pages should return FALSE
  95. }
  96. void CToolDefs::OnBrowse()
  97. {
  98. // TODO: Add your control notification handler code here
  99. }
  100. void CToolDefs::OnUseWizard()
  101. {
  102. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  103. SetModified();
  104. }
  105. void CToolDefs::OnUsePropPage()
  106. {
  107. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  108. SetModified();
  109. }
  110. void CToolDefs::OnDeployDisabled()
  111. {
  112. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  113. m_fAutoInstall = FALSE;
  114. SetModified();
  115. }
  116. void CToolDefs::OnDeployPublished()
  117. {
  118. GetDlgItem(IDC_CHECK1)->EnableWindow(TRUE);
  119. SetModified();
  120. }
  121. void CToolDefs::OnDeployAssigned()
  122. {
  123. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  124. m_fAutoInstall = TRUE;
  125. SetModified();
  126. }
  127. void CToolDefs::OnBasicUI()
  128. {
  129. SetModified();
  130. }
  131. void CToolDefs::OnMaxUI()
  132. {
  133. SetModified();
  134. }
  135. void CToolDefs::OnDefaultUI()
  136. {
  137. SetModified();
  138. }
  139. BOOL CToolDefs::OnApply()
  140. {
  141. m_pToolDefaults->fAutoInstall = m_fAutoInstall;
  142. m_pToolDefaults->szStartPath = m_szStartPath;
  143. switch (m_iDeployment)
  144. {
  145. case 1:
  146. m_pToolDefaults->NPBehavior = NP_DISABLED;
  147. break;
  148. case 2:
  149. m_pToolDefaults->NPBehavior = NP_PUBLISHED;
  150. break;
  151. case 3:
  152. m_pToolDefaults->NPBehavior = NP_ASSIGNED;
  153. break;
  154. case 4:
  155. m_pToolDefaults->NPBehavior = NP_PROPPAGE;
  156. break;
  157. case 0:
  158. default:
  159. m_pToolDefaults->NPBehavior = NP_WIZARD;
  160. break;
  161. }
  162. switch (m_iUI)
  163. {
  164. case 0:
  165. m_pToolDefaults->UILevel = INSTALLUILEVEL_FULL;
  166. break;
  167. case 1:
  168. m_pToolDefaults->UILevel = INSTALLUILEVEL_BASIC;
  169. break;
  170. case 2:
  171. default:
  172. m_pToolDefaults->UILevel = INSTALLUILEVEL_DEFAULT;
  173. }
  174. MMCPropertyChangeNotify(m_hConsoleHandle, (long) m_cookie);
  175. return CPropertyPage::OnApply();
  176. }
  177. void CToolDefs::OnChangePath()
  178. {
  179. SetModified();
  180. }
  181. LRESULT CToolDefs::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
  182. {
  183. switch (message)
  184. {
  185. case WM_USER_REFRESH:
  186. // UNDONE
  187. return 0;
  188. case WM_USER_CLOSE:
  189. return GetOwner()->SendMessage(WM_CLOSE);
  190. default:
  191. return CPropertyPage::WindowProc(message, wParam, lParam);
  192. }
  193. }