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.

299 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. tapi.cpp
  5. Abstract:
  6. This file implements the welcome and finish pages.
  7. Environment:
  8. WIN32 User Mode
  9. Author:
  10. Andrew Ritz (andrewr) 24-July-1998
  11. --*/
  12. #include "ntoc.h"
  13. #pragma hdrstop
  14. HFONT hBigFont = NULL;
  15. HFONT
  16. GetBigFont(
  17. void
  18. )
  19. {
  20. LOGFONT LargeFont;
  21. NONCLIENTMETRICS ncm = {0};
  22. WCHAR FontName[100];
  23. WCHAR FontSize[30];
  24. int iFontSize;
  25. HDC hdc;
  26. HFONT hFont = NULL;
  27. //
  28. // get the large fonts for wizard97
  29. //
  30. ncm.cbSize = sizeof(ncm);
  31. SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
  32. CopyMemory((LPVOID* )&LargeFont,(LPVOID *) &ncm.lfMessageFont,sizeof(LargeFont) );
  33. LoadStringW(hInstance,IDS_LARGEFONT_NAME,FontName,sizeof(FontName)/sizeof(WCHAR) );
  34. LoadStringW(hInstance,IDS_LARGEFONT_SIZE,FontSize,sizeof(FontSize)/sizeof(WCHAR) );
  35. iFontSize = wcstoul( FontSize, NULL, 10 );
  36. // make sure we at least have some basic font
  37. if (*FontName == 0 || iFontSize == 0) {
  38. lstrcpy(FontName,TEXT("MS Shell Dlg") );
  39. iFontSize = 18;
  40. }
  41. lstrcpy(LargeFont.lfFaceName, FontName);
  42. LargeFont.lfWeight = FW_BOLD;
  43. if ((hdc = GetDC(NULL))) {
  44. LargeFont.lfHeight = 0 - (GetDeviceCaps(hdc,LOGPIXELSY) * iFontSize / 72);
  45. hFont = CreateFontIndirect(&LargeFont);
  46. ReleaseDC( NULL, hdc);
  47. }
  48. return hFont;
  49. }
  50. void
  51. WelcomeInit(
  52. void
  53. )
  54. {
  55. if (!hBigFont) {
  56. hBigFont = GetBigFont();
  57. }
  58. return;
  59. }
  60. void
  61. WelcomeCommit(
  62. void
  63. )
  64. {
  65. return;
  66. }
  67. #if 0
  68. void
  69. ReinstallInit(
  70. void
  71. )
  72. {
  73. if (!hBigFont) {
  74. hBigFont = GetBigFont();
  75. }
  76. return;
  77. }
  78. void
  79. ReinstallCommit(
  80. void
  81. )
  82. {
  83. return;
  84. }
  85. #endif
  86. void
  87. FinishInit(
  88. void
  89. )
  90. {
  91. if (!hBigFont) {
  92. hBigFont = GetBigFont();
  93. }
  94. return;
  95. }
  96. void
  97. FinishCommit(
  98. void
  99. )
  100. {
  101. return;
  102. }
  103. LRESULT
  104. WelcomeDlgProc(
  105. HWND hwnd,
  106. UINT message,
  107. WPARAM wParam,
  108. LPARAM lParam
  109. )
  110. {
  111. static BOOL FirstTime = TRUE;
  112. CommonWizardProc( hwnd, message, wParam, lParam, WizPageWelcome );
  113. switch( message ) {
  114. case WM_INITDIALOG:
  115. if (hBigFont) {
  116. SetWindowFont(GetDlgItem(hwnd,IDT_TITLE), hBigFont, TRUE);
  117. }
  118. break;
  119. case WM_NOTIFY:
  120. switch (((NMHDR *) lParam)->code) {
  121. case PSN_SETACTIVE:
  122. #if 0
  123. if (SetupInitComponent.SetupData.OperationFlags & SETUPOP_BATCH) {
  124. PropSheet_PressButton( GetParent(hwnd), PSBTN_NEXT );
  125. return TRUE;
  126. }
  127. #else
  128. if (SetupInitComponent.SetupData.OperationFlags & SETUPOP_BATCH) {
  129. PropSheet_PressButton( GetParent(hwnd), PSBTN_NEXT );
  130. return TRUE;
  131. }
  132. if (FirstTime) {
  133. SetWindowLongPtr( hwnd, DWLP_MSGRESULT, -1 );
  134. FirstTime = FALSE;
  135. return TRUE;
  136. }
  137. #endif
  138. break;
  139. }
  140. break;
  141. }
  142. return FALSE;
  143. }
  144. LRESULT
  145. FinishDlgProc(
  146. HWND hwnd,
  147. UINT message,
  148. WPARAM wParam,
  149. LPARAM lParam
  150. )
  151. {
  152. CommonWizardProc( hwnd, message, wParam, lParam, WizPageFinal );
  153. switch( message ) {
  154. case WM_INITDIALOG:
  155. //PropSheet_SetWizButtons( GetParent(hwnd), PSWIZB_FINISH );
  156. //
  157. // don't allow cancel on the finish page...it's too late
  158. //
  159. ShowWindow(GetDlgItem(GetParent(hwnd),IDCANCEL),SW_HIDE);
  160. if (hBigFont) {
  161. SetWindowFont(GetDlgItem(hwnd,IDT_TITLE), hBigFont, TRUE);
  162. }
  163. break;
  164. case WM_NOTIFY:
  165. switch (((NMHDR *) lParam)->code) {
  166. case PSN_SETACTIVE:
  167. if (SetupInitComponent.SetupData.OperationFlags & SETUPOP_BATCH) {
  168. PropSheet_PressButton( GetParent(hwnd), PSBTN_FINISH );
  169. return TRUE;
  170. }
  171. }
  172. break;
  173. }
  174. return FALSE;
  175. }
  176. #if 0
  177. LRESULT
  178. ReinstallDlgProc(
  179. HWND hwnd,
  180. UINT message,
  181. WPARAM wParam,
  182. LPARAM lParam
  183. )
  184. {
  185. CommonWizardProc( hwnd, message, wParam, lParam, WizPageReinstall );
  186. switch( message ) {
  187. case WM_INITDIALOG:
  188. //PropSheet_SetWizButtons( GetParent(hwnd), PSWIZB_BACK | PSWIZB_NEXT );
  189. break;
  190. case WM_NOTIFY:
  191. switch (((NMHDR *) lParam)->code) {
  192. case PSN_SETACTIVE:
  193. //if (!NoChanges) {
  194. // SetWindowLong( hDlg, DWL_MSGRESULT, -1 );
  195. //}
  196. break;
  197. case PSN_WIZNEXT:
  198. if (IsDlgButtonChecked(hwnd,IDYES)) {
  199. SetupInitComponent.HelperRoutines.SetSetupMode(
  200. SetupInitComponent.HelperRoutines.OcManagerContext ,
  201. SETUPMODE_REINSTALL | SetupInitComponent.HelperRoutines.GetSetupMode( SetupInitComponent.HelperRoutines.OcManagerContext )
  202. );
  203. }
  204. break;
  205. default:
  206. ;
  207. };
  208. default:
  209. ;
  210. };
  211. return FALSE;
  212. }
  213. #endif