genlodextensiondialog.cpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*
  2. ** Command & Conquer Generals(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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Max2W3D *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/max2w3d/genlodextensiondialog.cpp $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 10/10/00 11:14a $*
  31. * *
  32. * $Revision:: 1 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * GenLodExtensionDialogClass::GenLodExtensionDialogClass -- Constructor *
  37. * GenLodExtensionDialogClass::~GenLodExtensionDialogClass -- Destructor *
  38. * GenLodExtensionDialogClass::Get_Options -- Presents the dialog, gets user input *
  39. * GenLodExtensionDialogClass::Dialog_Proc -- Windows message handling *
  40. * _gen_lod_ext_dialog_proc -- windows dialog proc *
  41. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  42. #include "genlodextensiondialog.h"
  43. #include "dllmain.h"
  44. #include "resource.h"
  45. #include <Max.h>
  46. /**********************************************************************************************
  47. **
  48. ** GenLodExtensionDialogClass Implementation
  49. **
  50. **********************************************************************************************/
  51. /***********************************************************************************************
  52. * GenLodExtensionDialogClass::GenLodExtensionDialogClass -- Constructor *
  53. * *
  54. * INPUT: *
  55. * *
  56. * OUTPUT: *
  57. * *
  58. * WARNINGS: *
  59. * *
  60. * HISTORY: *
  61. *=============================================================================================*/
  62. GenLodExtensionDialogClass::GenLodExtensionDialogClass(Interface * maxinterface) :
  63. Hwnd(NULL),
  64. Options(NULL),
  65. MaxInterface(maxinterface),
  66. LodIndexSpin(NULL)
  67. {
  68. }
  69. /***********************************************************************************************
  70. * GenLodExtensionDialogClass::~GenLodExtensionDialogClass -- Destructor *
  71. * *
  72. * INPUT: *
  73. * *
  74. * OUTPUT: *
  75. * *
  76. * WARNINGS: *
  77. * *
  78. * HISTORY: *
  79. * 10/10/2000 gth : Created. *
  80. *=============================================================================================*/
  81. GenLodExtensionDialogClass::~GenLodExtensionDialogClass(void)
  82. {
  83. ReleaseISpinner(LodIndexSpin);
  84. }
  85. /***********************************************************************************************
  86. * GenLodExtensionDialogClass::Get_Options -- Presents the dialog, gets user input *
  87. * *
  88. * INPUT: *
  89. * *
  90. * OUTPUT: *
  91. * *
  92. * WARNINGS: *
  93. * *
  94. * HISTORY: *
  95. * 10/10/2000 gth : Created. *
  96. *=============================================================================================*/
  97. bool GenLodExtensionDialogClass::Get_Options(OptionsStruct * options)
  98. {
  99. Options = options;
  100. // Put up the options dialog box.
  101. BOOL result = DialogBoxParam
  102. (
  103. AppInstance,
  104. MAKEINTRESOURCE (IDD_GENERATE_LOD_EXTENSION_DIALOG),
  105. MaxInterface->GetMAXHWnd(),
  106. (DLGPROC) _gen_lod_ext_dialog_proc,
  107. (LPARAM) this
  108. );
  109. if (result == TRUE) {
  110. return true;
  111. } else {
  112. return false;
  113. }
  114. }
  115. /***********************************************************************************************
  116. * GenLodExtensionDialogClass::Dialog_Proc -- Windows message handling *
  117. * *
  118. * INPUT: *
  119. * *
  120. * OUTPUT: *
  121. * *
  122. * WARNINGS: *
  123. * *
  124. * HISTORY: *
  125. * 10/10/2000 gth : Created. *
  126. *=============================================================================================*/
  127. bool GenLodExtensionDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM)
  128. {
  129. switch (message ) {
  130. case WM_INITDIALOG:
  131. // Setup the LOD spinner control.
  132. LodIndexSpin = SetupIntSpinner
  133. (
  134. Hwnd,
  135. IDC_LOD_INDEX_SPIN,
  136. IDC_LOD_INDEX_EDIT,
  137. MIN_LOD_INDEX,MAX_LOD_INDEX,INITIAL_LOD_INDEX
  138. );
  139. return 1;
  140. case WM_COMMAND:
  141. switch (LOWORD(wParam))
  142. {
  143. case IDOK:
  144. Options->LodIndex = LodIndexSpin->GetIVal();
  145. EndDialog(Hwnd, 1);
  146. break;
  147. case IDCANCEL:
  148. EndDialog(Hwnd, 0);
  149. break;
  150. }
  151. return 1;
  152. }
  153. return 0;
  154. }
  155. /***********************************************************************************************
  156. * _gen_lod_ext_dialog_proc -- windows dialog proc *
  157. * *
  158. * INPUT: *
  159. * *
  160. * OUTPUT: *
  161. * *
  162. * WARNINGS: *
  163. * *
  164. * HISTORY: *
  165. * 10/10/2000 gth : Created. *
  166. *=============================================================================================*/
  167. static BOOL CALLBACK _gen_lod_ext_dialog_proc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
  168. {
  169. static GenLodExtensionDialogClass * dialog = NULL;
  170. if (message == WM_INITDIALOG) {
  171. dialog = (GenLodExtensionDialogClass *)lparam;
  172. dialog->Hwnd = hwnd;
  173. }
  174. if (dialog) {
  175. return dialog->Dialog_Proc(hwnd, message, wparam, lparam);
  176. } else {
  177. return FALSE;
  178. }
  179. }