FinalDialog.cpp 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Installer *
  23. * *
  24. * $Archive:: /Commando/Code/Installer/FinalDialog.cpp $*
  25. * *
  26. * $Author:: Ian_l $*
  27. * *
  28. * $Modtime:: 11/09/01 10:42p $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. // Includes.
  36. #include "FinalDialog.h"
  37. #include "ButtonCtrl.h"
  38. #include "CheckBoxCtrl.h"
  39. #include "Installer.h"
  40. #include "Translator.h"
  41. /***********************************************************************************************
  42. * FinalDialogClass::On_Init_Dialog -- *
  43. * *
  44. * INPUT: *
  45. * *
  46. * OUTPUT: *
  47. * *
  48. * WARNINGS: *
  49. * *
  50. * HISTORY: *
  51. * 08/22/01 IML : Created. *
  52. *=============================================================================================*/
  53. void FinalDialogClass::On_Init_Dialog (void)
  54. {
  55. switch ((_Installer.Install_Game() ? 1 : 0) + (_Installer.Install_WOL() ? 2 : 0)) {
  56. case 0:
  57. // Should never occur. At least one component should have been installed.
  58. WWASSERT (false);
  59. break;
  60. case 1:
  61. Set_Dlg_Item_Text (IDC_FINAL_STATIC1, TxWideStringClass (IDS_GAME_INSTALLED));
  62. break;
  63. case 2:
  64. Set_Dlg_Item_Text (IDC_FINAL_STATIC1, TxWideStringClass (IDS_WOL_INSTALLED));
  65. break;
  66. case 3:
  67. Set_Dlg_Item_Text (IDC_FINAL_STATIC1, TxWideStringClass (IDS_GAME_AND_WOL_INSTALLED));
  68. break;
  69. }
  70. // Show the back button? If false this suggests that there is not a dialog to go back to.
  71. if (!ShowBackButton) {
  72. ButtonCtrlClass *backbutton;
  73. backbutton = Get_Dlg_Item (IDC_BUTTON_BACK)->As_ButtonCtrlClass();
  74. backbutton->Show (false);
  75. backbutton->Enable (false);
  76. }
  77. if (_Installer.Install_Game()) {
  78. Check_Dlg_Button (IDC_FINAL_CHECK1, true);
  79. } else {
  80. Check_Dlg_Button (IDC_FINAL_CHECK3, true);
  81. Enable_Dlg_Item (IDC_FINAL_CHECK1, false);
  82. Enable_Dlg_Item (IDC_FINAL_CHECK2, false);
  83. }
  84. Set_Dlg_Item_Text (IDC_FINAL_STATIC3, TxWideStringClass (IDS_FINAL_NOTES));
  85. InstallMenuDialogClass::On_Init_Dialog();
  86. }
  87. /***********************************************************************************************
  88. * FinalDialogClass::On_Command -- *
  89. * *
  90. * INPUT: *
  91. * *
  92. * OUTPUT: *
  93. * *
  94. * WARNINGS: *
  95. * *
  96. * HISTORY: *
  97. * 08/22/01 IML : Created. *
  98. *=============================================================================================*/
  99. void FinalDialogClass::On_Command (int ctrl_id, int message_id, DWORD param)
  100. {
  101. static bool _disabled = false;
  102. // Implement radio controls with the three check boxes by making them mutually exclusive.
  103. // NOTE: Unlike Windows GUI, a control can always get focus regardless of its checked status.
  104. if (!_disabled) {
  105. CheckBoxCtrlClass *check1, *check2, *check3;
  106. bool setcheckcontrols;
  107. setcheckcontrols = false;
  108. switch (ctrl_id) {
  109. case IDC_FINAL_CHECK1:
  110. check1 = Get_Dlg_Item (IDC_FINAL_CHECK1)->As_CheckBoxCtrlClass();
  111. check2 = Get_Dlg_Item (IDC_FINAL_CHECK2)->As_CheckBoxCtrlClass();
  112. check3 = Get_Dlg_Item (IDC_FINAL_CHECK3)->As_CheckBoxCtrlClass();
  113. setcheckcontrols = true;
  114. break;
  115. case IDC_FINAL_CHECK2:
  116. check1 = Get_Dlg_Item (IDC_FINAL_CHECK2)->As_CheckBoxCtrlClass();
  117. check2 = Get_Dlg_Item (IDC_FINAL_CHECK1)->As_CheckBoxCtrlClass();
  118. check3 = Get_Dlg_Item (IDC_FINAL_CHECK3)->As_CheckBoxCtrlClass();
  119. setcheckcontrols = true;
  120. break;
  121. case IDC_FINAL_CHECK3:
  122. check1 = Get_Dlg_Item (IDC_FINAL_CHECK3)->As_CheckBoxCtrlClass();
  123. check2 = Get_Dlg_Item (IDC_FINAL_CHECK1)->As_CheckBoxCtrlClass();
  124. check3 = Get_Dlg_Item (IDC_FINAL_CHECK2)->As_CheckBoxCtrlClass();
  125. setcheckcontrols = true;
  126. break;
  127. case IDCANCEL:
  128. MenuDialogClass::On_Command (ctrl_id, message_id, param);
  129. return;
  130. default:
  131. break;
  132. }
  133. if (setcheckcontrols) {
  134. // Prevent recursion on this function by 'disabling' it.
  135. _disabled = true;
  136. if (check1->Get_Check()) {
  137. check2->Set_Check (false);
  138. check3->Set_Check (false);
  139. } else {
  140. // If it has just been unchecked then check it again - user must
  141. // not be able to uncheck a control by clicking on it.
  142. check1->Set_Check (true);
  143. }
  144. _disabled = false;
  145. }
  146. }
  147. InstallMenuDialogClass::On_Command (ctrl_id, message_id, param);
  148. }