pgwizopt.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 6k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. #include "pch.hxx" // pch
  2. #pragma hdrstop
  3. #include "resource.h"
  4. #include "pgWizOpt.h"
  5. CWizardOptionsPg::CWizardOptionsPg( 
  6.     LPPROPSHEETPAGE ppsp
  7. ) : WizardPage(ppsp, 0, 0)
  8. {
  9. m_dwPageId = IDD_WIZOPTIONS;
  10. ppsp->pszTemplate = MAKEINTRESOURCE(m_dwPageId);
  11. }
  12. CWizardOptionsPg::~CWizardOptionsPg(
  13.     VOID
  14.     )
  15. {
  16. }
  17. DWORD g_rgdwWizNoOptionsSelected[] = {IDD_WIZNOOPTIONSSELECTED};
  18. DWORD g_rgdwWizDoFonts[] = {
  19. 0, // min text size
  20. /* IDD_PREV_MINTEXT1,
  21. IDD_PREV_MINTEXT2,
  22. IDD_PREV_MINTEXT3,
  23. IDD_FNTWIZMINTEXT,
  24. */
  25. IDD_FNTWIZMINTEXT2,
  26. 0, // scroll bar
  27. /*
  28. IDD_PREV_SCROLL1,
  29. IDD_PREV_SCROLL2,
  30. IDD_FNTWIZSCROLLBAR,
  31. */
  32. 0, // border
  33. /*
  34. IDD_PREV_BORDER1,
  35. IDD_PREV_BORDER2,
  36. */
  37. IDD_PREV_ICON1
  38. };
  39. DWORD g_rgdwWizDoColors[] = {
  40. IDD_PREV_COLOR,
  41. // IDD_CLRWIZHIGHCONTRAST
  42. };
  43. DWORD g_rgdwWizDoSounds[] = {
  44. IDD_SNDWIZSENTRYSHOWSOUNDS,
  45. };
  46. DWORD g_rgdwWizDoKeyboard[] = {
  47. IDD_KBDWIZSTICKYKEYS,
  48. IDD_KBDWIZFILTERKEYS,
  49. IDD_KBDWIZTOGGLEKEYS,
  50. IDD_KBDWIZSHOWEXTRAKEYBOARDHELP,
  51. // IDD_KBDWIZSERIALKEYS
  52. };
  53. DWORD g_rgdwWizDoMouse[] = {
  54. IDD_MSEWIZMOUSEKEYS,
  55. IDD_MSEWIZMOUSECURSOR,
  56. IDD_MSEWIZBUTTONCONFIG
  57. };
  58. DWORD g_rgdwWizFinalPages[] = {
  59. IDD_WIZHOTKEYANDNOTIFICATION,
  60. 0,
  61. /* // For usability tests
  62. IDD_WIZACCESSTIMEOUT1,
  63. IDD_WIZACCESSTIMEOUT2,
  64. */
  65. IDD_WIZWORKSTATIONDEFAULT,
  66. IDD_WIZSAVETOFILE,
  67. IDD_WIZFINISH
  68. };
  69. BOOL CWizardOptionsPg::AdjustWizPageOrder()
  70. {
  71. // HACK TO DYNAMICALLY CHANGE WHICH PAGES ARE USED BY THE WIZARD
  72. switch(g_Options.m_nTypeMinText)
  73. {
  74. case 0: g_rgdwWizDoFonts[0] =  IDD_PREV_MINTEXT1;break;
  75. case 1: g_rgdwWizDoFonts[0] =  IDD_PREV_MINTEXT2;break;
  76. case 2: g_rgdwWizDoFonts[0] =  IDD_PREV_MINTEXT3;break;
  77. case 3: g_rgdwWizDoFonts[0] =  IDD_FNTWIZMINTEXT;break;
  78. }
  79. switch(g_Options.m_nTypeScrollBar)
  80. {
  81. case 0: g_rgdwWizDoFonts[2] =  IDD_PREV_SCROLL1;break;
  82. case 1: g_rgdwWizDoFonts[2] =  IDD_PREV_SCROLL2;break;
  83. case 2: g_rgdwWizDoFonts[2] =  IDD_FNTWIZSCROLLBAR;break;
  84. }
  85. switch(g_Options.m_nTypeBorder)
  86. {
  87. case 0: g_rgdwWizDoFonts[3] =  IDD_PREV_BORDER1;break;
  88. case 1: g_rgdwWizDoFonts[3] =  IDD_PREV_BORDER2;break;
  89. }
  90. switch(g_Options.m_nTypeAccTimeOut)
  91. {
  92. case 0: g_rgdwWizFinalPages[1] =  IDD_WIZACCESSTIMEOUT1;break;
  93. case 1: g_rgdwWizFinalPages[1] =  IDD_WIZACCESSTIMEOUT2;break;
  94. }
  95. BOOL bDoFonts = Button_GetCheck(GetDlgItem(m_hwnd, IDC_DOFONTS));
  96. BOOL bDoColors = Button_GetCheck(GetDlgItem(m_hwnd, IDC_DOCOLORS));
  97. BOOL bDoSounds = Button_GetCheck(GetDlgItem(m_hwnd, IDC_DOSOUND));
  98. BOOL bDoKeyboard = Button_GetCheck(GetDlgItem(m_hwnd, IDC_DOKEYBOARD));
  99. BOOL bDoMouse = Button_GetCheck(GetDlgItem(m_hwnd, IDC_DOMOUSE));
  100. BOOL bDoNoOptions = (!bDoColors && !bDoFonts && !bDoSounds && !bDoKeyboard && !bDoMouse);
  101. // First remove all possible pages since we want to insert them in the correct order
  102. // Return value does not matter since the pages may not be in the array
  103. sm_WizPageOrder.RemovePages(g_rgdwWizNoOptionsSelected, ARRAYSIZE(g_rgdwWizNoOptionsSelected));
  104. sm_WizPageOrder.RemovePages(g_rgdwWizDoFonts, ARRAYSIZE(g_rgdwWizDoFonts));
  105. sm_WizPageOrder.RemovePages(g_rgdwWizDoColors, ARRAYSIZE(g_rgdwWizDoColors));
  106. sm_WizPageOrder.RemovePages(g_rgdwWizDoSounds, ARRAYSIZE(g_rgdwWizDoSounds));
  107. sm_WizPageOrder.RemovePages(g_rgdwWizDoKeyboard, ARRAYSIZE(g_rgdwWizDoKeyboard));
  108. sm_WizPageOrder.RemovePages(g_rgdwWizDoMouse, ARRAYSIZE(g_rgdwWizDoMouse));
  109. sm_WizPageOrder.RemovePages(g_rgdwWizFinalPages, ARRAYSIZE(g_rgdwWizFinalPages));
  110. // Then Add in pages in groups in the reverse order that we want them to appear.
  111. // We do them this way since they are inserted after this page, so the first group inserted
  112. // will be the last group at the end of this.
  113. // NOTE: We do not care about the return value from AddPages() in the sense
  114. // that we they do not allocate or free memory so it does not hurt to keep calling them.  We
  115. // Will propogate a return value of FALSE if any of them fail.
  116. BOOL bSuccess = TRUE;
  117. // Add Final Pages
  118. bSuccess = bSuccess && sm_WizPageOrder.AddPages(m_dwPageId, g_rgdwWizFinalPages, ARRAYSIZE(g_rgdwWizFinalPages));
  119. if(bDoNoOptions)
  120. bSuccess = bSuccess && sm_WizPageOrder.AddPages(m_dwPageId, g_rgdwWizNoOptionsSelected, ARRAYSIZE(g_rgdwWizNoOptionsSelected));
  121. if(bDoMouse)
  122. bSuccess = bSuccess && sm_WizPageOrder.AddPages(m_dwPageId, g_rgdwWizDoMouse, ARRAYSIZE(g_rgdwWizDoMouse));
  123. if(bDoKeyboard)
  124. bSuccess = bSuccess && sm_WizPageOrder.AddPages(m_dwPageId, g_rgdwWizDoKeyboard, ARRAYSIZE(g_rgdwWizDoKeyboard));
  125. // If keyboard was selected, but mouse was not selected, add the mousekeys page at the end of the keyboard page
  126. if(bDoKeyboard && !bDoMouse)
  127. {
  128. DWORD dw = IDD_MSEWIZMOUSEKEYS;
  129. bSuccess = bSuccess && sm_WizPageOrder.AddPages(g_rgdwWizDoKeyboard[ARRAYSIZE(g_rgdwWizDoKeyboard) - 1], &dw, 1);
  130. }
  131. if(bDoSounds)
  132. bSuccess = bSuccess && sm_WizPageOrder.AddPages(m_dwPageId, g_rgdwWizDoSounds, ARRAYSIZE(g_rgdwWizDoSounds));
  133. if(bDoColors & !bDoFonts) // Don't add colors here if we have fonts to add
  134. bSuccess = bSuccess && sm_WizPageOrder.AddPages(m_dwPageId, g_rgdwWizDoColors, ARRAYSIZE(g_rgdwWizDoColors));
  135. if(bDoFonts)
  136. bSuccess = bSuccess && sm_WizPageOrder.AddPages(m_dwPageId, g_rgdwWizDoFonts, ARRAYSIZE(g_rgdwWizDoFonts));
  137. if(bDoFonts && bDoColors) // Add the colors here if we also have fonts
  138. bSuccess = bSuccess && sm_WizPageOrder.AddPages(IDD_FNTWIZMINTEXT2, g_rgdwWizDoColors, ARRAYSIZE(g_rgdwWizDoColors));
  139. return bSuccess;
  140. }
  141. LRESULT
  142. CWizardOptionsPg::OnCommand(
  143. HWND hwnd,
  144. WPARAM wParam,
  145. LPARAM lParam
  146. )
  147. {
  148. LRESULT lResult = 1;
  149. WORD wNotifyCode = HIWORD(wParam);
  150. WORD wCtlID      = LOWORD(wParam);
  151. HWND hwndCtl     = (HWND)lParam;
  152. switch(wCtlID)
  153. {
  154. case IDC_BTNRESTORETODEFAULT:
  155. MessageBox(m_hwnd, __TEXT("Not Yet Implemented"), __TEXT("Error"), MB_OK);
  156. // g_Options.ApplyWindowsDefault();
  157. break;
  158. default:
  159. break;
  160. }
  161. return lResult;
  162. }