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.

172 lines
3.9 KiB

  1. #include "headers.hxx"
  2. #include "UpdatesRequiredPage.hpp"
  3. #include "resource.h"
  4. #include "common.hpp"
  5. #include "AnalisysResults.hpp"
  6. UpdatesRequiredPage::UpdatesRequiredPage
  7. (
  8. const String& reportName_,
  9. AnalisysResults &results_
  10. )
  11. :
  12. reportName(reportName_),
  13. results(results_),
  14. WizardPage
  15. (
  16. IDD_UPDATES_REQUIRED,
  17. IDS_UPDATES_REQUIRED_PAGE_TITLE,
  18. IDS_UPDATES_REQUIRED_PAGE_SUBTITLE,
  19. true
  20. )
  21. {
  22. LOG_CTOR(UpdatesRequiredPage);
  23. }
  24. UpdatesRequiredPage::~UpdatesRequiredPage()
  25. {
  26. LOG_DTOR(UpdatesRequiredPage);
  27. }
  28. // WizardPage overrides
  29. bool
  30. UpdatesRequiredPage::OnSetActive()
  31. {
  32. LOG_FUNCTION(UpdatesRequiredPage::OnSetActive);
  33. Win::PropSheet_SetWizButtons(Win::GetParent(hwnd),
  34. PSWIZB_NEXT | PSWIZB_BACK);
  35. return true;
  36. }
  37. bool
  38. UpdatesRequiredPage::OnCommand(
  39. HWND /*windowFrom*/,
  40. unsigned controlIdFrom,
  41. unsigned code
  42. )
  43. {
  44. LOG_FUNCTION(UpdatesRequiredPage::OnCommand);
  45. switch (controlIdFrom)
  46. {
  47. case IDC_VIEW_DETAILS:
  48. {
  49. if (code == BN_CLICKED)
  50. {
  51. ShowReport();
  52. }
  53. }
  54. }
  55. return true;
  56. }
  57. bool
  58. UpdatesRequiredPage::OnWizBack()
  59. {
  60. LOG_FUNCTION(UpdatesRequiredPage::OnWizBack);
  61. GetWizard().SetNextPageID(hwnd,IDD_ANALISYS);
  62. return true;
  63. }
  64. void
  65. UpdatesRequiredPage::OnInit()
  66. {
  67. LOG_FUNCTION(UpdatesRequiredPage::OnInit);
  68. long created = results.createW2KObjects.size() +
  69. results.createXPObjects.size();
  70. long updated = results.objectActions.size();
  71. long containers = results.createContainers.size();
  72. String sCreated,sUpdated;
  73. if( containers==0)
  74. {
  75. sCreated = String::format(
  76. String::load(IDS_NUMBER_FORMAT).c_str(),
  77. created,
  78. String::load(IDS_OBJECTS).c_str()
  79. );
  80. }
  81. else
  82. {
  83. sCreated = String::format(
  84. String::load(IDS_CREATED_FORMAT).c_str(),
  85. created,
  86. String::load(IDS_OBJECTS).c_str(),
  87. String::load(IDS_AND).c_str(),
  88. containers,
  89. String::load(IDS_CONTAINERS).c_str()
  90. );
  91. }
  92. sUpdated = String::format(
  93. String::load(IDS_NUMBER_FORMAT).c_str(),
  94. updated,
  95. String::load(IDS_VALUES).c_str()
  96. );
  97. Win::SetDlgItemText( hwnd,IDC_CREATE_OBJECTS, sCreated);
  98. Win::SetDlgItemText( hwnd,IDC_UPDATE_OBJECTS, sUpdated);
  99. HFONT
  100. bulletFont = CreateFont(
  101. 0,
  102. 0,
  103. 0,
  104. 0,
  105. FW_NORMAL,
  106. 0,
  107. 0,
  108. 0,
  109. SYMBOL_CHARSET,
  110. OUT_CHARACTER_PRECIS,
  111. CLIP_CHARACTER_PRECIS,
  112. PROOF_QUALITY,
  113. VARIABLE_PITCH|FF_DONTCARE,
  114. L"Marlett");
  115. if (bulletFont)
  116. {
  117. Win::SetDlgItemText(hwnd,IDC_BULLET1,L"h");
  118. Win::SetDlgItemText(hwnd,IDC_BULLET2,L"h");
  119. Win::SetWindowFont(Win::GetDlgItem(hwnd, IDC_BULLET1), bulletFont, true);
  120. Win::SetWindowFont(Win::GetDlgItem(hwnd, IDC_BULLET2), bulletFont, true);
  121. }
  122. };
  123. // This function is void because if we cannot show
  124. // the report, this is not a fatal error
  125. void
  126. UpdatesRequiredPage::ShowReport()
  127. {
  128. LOG_FUNCTION(UpdatesRequiredPage::ShowReport);
  129. HRESULT hr=S_OK;
  130. do
  131. {
  132. hr=Notepad(reportName);
  133. BREAK_ON_FAILED_HRESULT(hr);
  134. } while(0);
  135. if (FAILED(hr))
  136. {
  137. ShowError(hr,error);
  138. }
  139. LOG_HRESULT(hr);
  140. }