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.

225 lines
7.1 KiB

  1. // Copyright 1995-1997 Microsoft Corporation. All Rights Reserved.
  2. #include "header.h"
  3. #include "..\hhctrl\infowiz.h"
  4. BOOL CInfoTypePageContents::OnNotify(UINT code)
  5. {
  6. switch (code) {
  7. case PSN_SETACTIVE:
  8. MakeCheckedList(IDLB_INFO_TYPES);
  9. SetWizButtons(PSWIZB_NEXT | PSWIZB_BACK);
  10. FillInfoTypeListBox();
  11. break;
  12. case PSN_WIZBACK:
  13. SaveInfoTypes();
  14. if (m_InfoParam.idPreviousPage > 0) {
  15. SetResult(m_InfoParam.idPreviousPage);
  16. return TRUE;
  17. }
  18. break;
  19. case PSN_WIZNEXT:
  20. SaveInfoTypes();
  21. if (m_InfoParam.idNextPage > 0) {
  22. SetResult(m_InfoParam.idNextPage);
  23. return TRUE;
  24. }
  25. break;
  26. }
  27. return FALSE;
  28. }
  29. void CInfoTypePageContents::SaveInfoTypes(void)
  30. {
  31. int bitflag = 1;
  32. INFOTYPE* pInfoType = m_InfoParam.pInfoTypes;
  33. int type;
  34. if ( m_InfoParam.iCategory >= 0 )
  35. { // Exclusive IT in category
  36. if ( m_InfoParam.fExclusive )
  37. {
  38. CStr csz;
  39. csz.ReSize(MAX_PATH);
  40. m_pCheckBox->GetText(csz.psz);
  41. type = m_InfoParam.pInfoType->GetFirstCategoryType( m_InfoParam.iCategory );
  42. while ( type != -1 )
  43. {
  44. if ((m_InfoParam.pInfoType->GetInfoType(csz.psz) == type) &&
  45. !m_InfoParam.pInfoType->IsHidden(type))
  46. AddIT( type, pInfoType );
  47. else
  48. DeleteIT(type, pInfoType);
  49. type = m_InfoParam.pInfoType->GetNextITinCategory();
  50. }
  51. }
  52. else
  53. { // Inclusive Category
  54. int ordinal_IT=0;
  55. type = m_InfoParam.pInfoType->GetFirstCategoryType( m_InfoParam.iCategory );
  56. while ( type != -1 )
  57. {
  58. if ( m_pCheckBox->GetItemData(ordinal_IT) && !m_InfoParam.pInfoType->IsHidden(type))
  59. AddIT( type, pInfoType );
  60. else
  61. DeleteIT( type, pInfoType );
  62. if (!m_InfoParam.pInfoType->IsHidden(type))
  63. ordinal_IT++;
  64. type = m_InfoParam.pInfoType->GetNextITinCategory();
  65. }
  66. }
  67. }
  68. else
  69. { // no category
  70. if ( m_InfoParam.fExclusive )
  71. { // set of exclusive IT's
  72. CStr csz;
  73. csz.ReSize(MAX_PATH);
  74. m_pCheckBox->GetText(csz.psz);
  75. for (type=1; type <= m_InfoParam.pInfoType->HowManyInfoTypes(); type++ )
  76. {
  77. if ( (m_InfoParam.pInfoType->GetInfoType(csz.psz) == type) &&
  78. !m_InfoParam.pInfoType->IsHidden(type) )
  79. AddIT( type, pInfoType );
  80. else
  81. DeleteIT( type, pInfoType );
  82. }
  83. }
  84. else
  85. { // set of inclusive IT's
  86. for ( type=1; type <= m_InfoParam.pInfoType->HowManyInfoTypes(); type++ )
  87. {
  88. if ( m_pCheckBox->GetItemData(type-1) && !m_InfoParam.pInfoType->IsHidden(type) )
  89. AddIT( type, pInfoType );
  90. else
  91. DeleteIT( type, pInfoType );
  92. }
  93. }
  94. }
  95. }
  96. void CInfoTypePageContents::FillInfoTypeListBox(void)
  97. {
  98. int bitflag = 1;
  99. INFOTYPE* pInfoType = m_InfoParam.pInfoTypes;
  100. int type;
  101. int lbpos;
  102. m_pCheckBox->Reset();
  103. if ( m_InfoParam.iCategory >= 0 )
  104. {
  105. type = m_InfoParam.pInfoType->GetFirstCategoryType( m_InfoParam.iCategory );
  106. while ( (type != -1) && !m_InfoParam.pInfoType->IsHidden(type) )
  107. {
  108. lbpos = (int)m_pCheckBox->AddString(m_InfoParam.pInfoType->m_itTables.m_ptblInfoTypes->GetPointer(type));
  109. m_pCheckBox->SetItemData(lbpos, type);
  110. type = m_InfoParam.pInfoType->GetNextITinCategory();
  111. }
  112. SetWindowText(IDTXT_DESCRIPTION,
  113. m_InfoParam.pInfoType->GetCategoryDescription(m_InfoParam.iCategory+1) );
  114. }else
  115. {
  116. for (type = 1; type <= m_InfoParam.pInfoType->HowManyInfoTypes(); type++)
  117. {
  118. if ( m_InfoParam.pInfoType->IsHidden(type) )
  119. continue;
  120. lbpos = (int)m_pCheckBox->AddString(m_InfoParam.pInfoType->m_itTables.m_ptblInfoTypes->GetPointer(type));
  121. m_pCheckBox->SetItemData(lbpos, type);
  122. }
  123. }
  124. }
  125. void CInfoTypePageContents::OnSelChange(UINT id)
  126. {
  127. int posType;
  128. if (id == IDLB_INFO_TYPES) {
  129. m_pCheckBox->OnSelChange();
  130. int pos = (int)m_pCheckBox->GetCurSel();
  131. if (pos != LB_ERR)
  132. {
  133. ASSERT(m_InfoParam.pInfoType->m_itTables.m_ptblInfoTypeDescriptions);
  134. CStr cszItem;
  135. cszItem.ReSize(MAX_PATH);
  136. m_pCheckBox->GetText(cszItem, MAX_PATH, pos);
  137. posType = m_InfoParam.pInfoType->GetITIndex(cszItem.psz);
  138. SetWindowText(IDTXT_DESCRIPTION,
  139. m_InfoParam.pInfoType->GetInfoTypeDescription(posType));
  140. }
  141. }
  142. }
  143. BOOL CWizardIntro::OnNotify(UINT code)
  144. {
  145. switch (code) {
  146. case PSN_SETACTIVE:
  147. SetWizButtons(PSWIZB_NEXT);
  148. if (m_pInfoParam->fCustom)
  149. SetCheck(IDRADIO_CUSTOM);
  150. else if (m_pInfoParam->fAll)
  151. SetCheck(IDRADIO_ALL);
  152. else
  153. SetCheck(IDRADIO_ALL ); //IDRADIO_TYPICAL);
  154. break;
  155. case PSN_WIZNEXT:
  156. if (GetCheck(IDRADIO_TYPICAL)) {
  157. m_pInfoParam->fTypical = TRUE;
  158. m_pInfoParam->fAll = FALSE;
  159. m_pInfoParam->fCustom = FALSE;
  160. if (m_pInfoParam->pInfoType->m_pTypicalInfoTypes) {
  161. ASSERT(lcSize(m_pInfoParam->pInfoTypes) == lcSize(m_pInfoParam->pInfoType->m_pTypicalInfoTypes));
  162. memcpy(m_pInfoParam->pInfoTypes, m_pInfoParam->pInfoType->m_pTypicalInfoTypes, lcSize(m_pInfoParam->pInfoTypes));
  163. }
  164. SetResult(IDWIZ_INFOTYPE_FINISH);
  165. return TRUE;
  166. }
  167. if (GetCheck(IDRADIO_ALL)) {
  168. m_pInfoParam->fTypical = FALSE;
  169. m_pInfoParam->fAll = TRUE;
  170. m_pInfoParam->fCustom = FALSE;
  171. memset(m_pInfoParam->pInfoTypes, 0xFF, lcSize(m_pInfoParam->pInfoTypes));
  172. SetResult(IDWIZ_INFOTYPE_FINISH);
  173. return TRUE;
  174. }
  175. else {
  176. m_pInfoParam->fTypical = FALSE;
  177. m_pInfoParam->fAll = FALSE;
  178. m_pInfoParam->fCustom = TRUE;
  179. memset(m_pInfoParam->pInfoTypes, 0xFF, lcSize(m_pInfoParam->pInfoTypes));
  180. }
  181. return FALSE;
  182. }
  183. return FALSE;
  184. }
  185. void CWizardIntro::OnButton(UINT id)
  186. {
  187. if (GetCheck(id)) {
  188. SetCheck(IDRADIO_ALL, FALSE);
  189. SetCheck(IDRADIO_TYPICAL, FALSE);
  190. SetCheck(IDRADIO_CUSTOM, FALSE);
  191. SetCheck(id, TRUE);
  192. }
  193. }
  194. BOOL CInfoWizFinish::OnNotify(UINT code)
  195. {
  196. switch (code) {
  197. case PSN_SETACTIVE:
  198. SetWizButtons(PSWIZB_BACK | PSWIZB_FINISH);
  199. break;
  200. case PSN_WIZBACK:
  201. if (m_pInfoParam->fAll || m_pInfoParam->fTypical) {
  202. SetResult(CWizardIntro::IDD);
  203. return TRUE;
  204. }
  205. break;
  206. }
  207. return FALSE;
  208. }