WhatToInstallDialog.cpp 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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/WhatToInstallDialog. $*
  25. * *
  26. * $Author:: Ian_l $*
  27. * *
  28. * $Modtime:: 10/25/01 3:38p $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. // Includes.
  36. #include "WhatToInstallDialog.h"
  37. #include "CheckBoxCtrl.h"
  38. #include "Resource.h"
  39. #include "Installer.h"
  40. #include "Translator.h"
  41. /***********************************************************************************************
  42. * WhatToInstallDialogClass::On_Init_Dialog -- *
  43. * *
  44. * INPUT: *
  45. * *
  46. * OUTPUT: *
  47. * *
  48. * WARNINGS: *
  49. * *
  50. * HISTORY: *
  51. * 08/22/01 IML : Created. *
  52. *=============================================================================================*/
  53. void WhatToInstallDialogClass::On_Init_Dialog (void)
  54. {
  55. CheckBoxCtrlClass *check;
  56. bool useigrsettings;
  57. Set_Dlg_Item_Text (IDC_WHAT_TO_INSTALL_CHECK1, TxWideStringClass (IDS_INSTALL_GAME));
  58. Set_Dlg_Item_Text (IDC_WHAT_TO_INSTALL_CHECK2, TxWideStringClass (IDS_INSTALL_WOL));
  59. Set_Dlg_Item_Text (IDC_WHAT_TO_INSTALL_CHECK3, TxWideStringClass (IDS_PLACE_SHORTCUT));
  60. Set_Dlg_Item_Text (IDC_WHAT_TO_INSTALL_CHECK4, TxWideStringClass (IDS_USE_GAME_ROOM_SETTINGS));
  61. Check_Dlg_Button (IDC_WHAT_TO_INSTALL_CHECK1, true);
  62. Check_Dlg_Button (IDC_WHAT_TO_INSTALL_CHECK2, _Installer.Is_Target_WOL_Older_Than_Source());
  63. Check_Dlg_Button (IDC_WHAT_TO_INSTALL_CHECK3, true);
  64. check = Get_Dlg_Item (IDC_WHAT_TO_INSTALL_CHECK4)->As_CheckBoxCtrlClass();
  65. if (_Installer.Can_Use_IGR_Settings()) {
  66. // If there is already a setting in the registry then use it - otherwise set it by default.
  67. if (_RegistryManager.Use_IGR_Settings (useigrsettings)) {
  68. check->Set_Check (useigrsettings);
  69. } else {
  70. check->Set_Check (true);
  71. }
  72. } else {
  73. // Don't even show this option to the user, and disable it unconditionally.
  74. check->Show (false);
  75. check->Set_Check (false);
  76. }
  77. check->Enable (Is_Dlg_Button_Checked (IDC_WHAT_TO_INSTALL_CHECK2));
  78. InstallMenuDialogClass::On_Init_Dialog();
  79. }
  80. /***********************************************************************************************
  81. * WhatToInstallDialogClass::On_Command -- *
  82. * *
  83. * INPUT: *
  84. * *
  85. * OUTPUT: *
  86. * *
  87. * WARNINGS: *
  88. * *
  89. * HISTORY: *
  90. * 08/22/01 IML : Created. *
  91. *=============================================================================================*/
  92. void WhatToInstallDialogClass::On_Command (int ctrl_id, int message_id, DWORD param)
  93. {
  94. switch (ctrl_id) {
  95. case IDOK:
  96. {
  97. // If neither of the first two options have been selected then ask the user if he wishes to cancel.
  98. if (!(Is_Dlg_Button_Checked (IDC_WHAT_TO_INSTALL_CHECK1) || Is_Dlg_Button_Checked (IDC_WHAT_TO_INSTALL_CHECK2))) {
  99. InstallMenuDialogClass::On_Command (IDCANCEL, 0, 0);
  100. return;
  101. }
  102. break;
  103. }
  104. case IDC_WHAT_TO_INSTALL_CHECK1:
  105. // Disable option 3 (create game icon) if option 1 (install game) is not checked.
  106. Enable_Dlg_Item (IDC_WHAT_TO_INSTALL_CHECK3, Is_Dlg_Button_Checked (IDC_WHAT_TO_INSTALL_CHECK1));
  107. break;
  108. case IDC_WHAT_TO_INSTALL_CHECK2:
  109. // Disable option 4 (use game room settings) if the user is not installing WOL.
  110. Enable_Dlg_Item (IDC_WHAT_TO_INSTALL_CHECK4, Is_Dlg_Button_Checked (IDC_WHAT_TO_INSTALL_CHECK2));
  111. // If the user wishes to install WOL but the source version is not newer than the current version
  112. // then issue a warning.
  113. if (Is_Dlg_Button_Checked (IDC_WHAT_TO_INSTALL_CHECK2) && (!_Installer.Is_Target_WOL_Older_Than_Source())) {
  114. MessageBoxClass::Do_Dialog (TxWideStringClass (IDS_WARNING), TxWideStringClass (IDS_SOURCE_WOL_OLDER), MessageBoxClass::MESSAGE_BOX_TYPE_OK, this);
  115. return;
  116. }
  117. default:
  118. break;
  119. }
  120. InstallMenuDialogClass::On_Command (ctrl_id, message_id, param);
  121. }