EmitterUserPropPage.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. // EmitterUserPropPage.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "w3dview.h"
  22. #include "EmitterUserPropPage.h"
  23. #include "W3D_File.H"
  24. #include "Part_Emt.H"
  25. #include "EmitterInstanceList.H"
  26. #ifdef _DEBUG
  27. #define new DEBUG_NEW
  28. #undef THIS_FILE
  29. static char THIS_FILE[] = __FILE__;
  30. #endif
  31. /////////////////////////////////////////////////////////////////////////////
  32. // EmitterUserPropPageClass property page
  33. IMPLEMENT_DYNCREATE(EmitterUserPropPageClass, CPropertyPage)
  34. /////////////////////////////////////////////////////////////
  35. //
  36. // EmitterUserPropPageClass
  37. //
  38. EmitterUserPropPageClass::EmitterUserPropPageClass (EmitterInstanceListClass *pemitter)
  39. : m_pEmitterList (NULL),
  40. m_bValid (true),
  41. m_iType (EMITTER_TYPEID_DEFAULT),
  42. CPropertyPage(EmitterUserPropPageClass::IDD)
  43. {
  44. //{{AFX_DATA_INIT(EmitterUserPropPageClass)
  45. // NOTE: the ClassWizard will add member initialization here
  46. //}}AFX_DATA_INIT
  47. Initialize ();
  48. return ;
  49. }
  50. /////////////////////////////////////////////////////////////
  51. //
  52. // ~EmitterUserPropPageClass
  53. //
  54. EmitterUserPropPageClass::~EmitterUserPropPageClass (void)
  55. {
  56. return;
  57. }
  58. /////////////////////////////////////////////////////////////
  59. //
  60. // DoDataExchange
  61. //
  62. void
  63. EmitterUserPropPageClass::DoDataExchange (CDataExchange* pDX)
  64. {
  65. // Allow the base class to process this message
  66. CPropertyPage::DoDataExchange(pDX);
  67. //{{AFX_DATA_MAP(EmitterUserPropPageClass)
  68. DDX_Control(pDX, IDC_TYPE_COMBO, m_TypeCombo);
  69. //}}AFX_DATA_MAP
  70. return ;
  71. }
  72. BEGIN_MESSAGE_MAP(EmitterUserPropPageClass, CPropertyPage)
  73. //{{AFX_MSG_MAP(EmitterUserPropPageClass)
  74. ON_EN_CHANGE(IDC_PROGRAMMER_SETTINGS_EDIT, OnChangeProgrammerSettingsEdit)
  75. ON_CBN_SELCHANGE(IDC_TYPE_COMBO, OnSelchangeTypeCombo)
  76. //}}AFX_MSG_MAP
  77. END_MESSAGE_MAP()
  78. /////////////////////////////////////////////////////////////
  79. //
  80. // Initialize
  81. //
  82. void
  83. EmitterUserPropPageClass::Initialize (void)
  84. {
  85. if (m_pEmitterList != NULL) {
  86. // Record the user information from the emitter (if it exists)
  87. m_iType = m_pEmitterList->Get_User_Type ();
  88. m_UserString = m_pEmitterList->Get_User_String ();
  89. }
  90. return ;
  91. }
  92. /////////////////////////////////////////////////////////////
  93. //
  94. // OnInitDialog
  95. //
  96. BOOL
  97. EmitterUserPropPageClass::OnInitDialog (void)
  98. {
  99. // Allow the base class to process this message
  100. CPropertyPage::OnInitDialog ();
  101. // Add the list of user-types to the combobox
  102. for (int index = 0; index < EMITTER_TYPEID_COUNT; index ++) {
  103. m_TypeCombo.AddString (EMITTER_TYPE_NAMES[index]);
  104. }
  105. // Select the correct entry in the combobox
  106. m_TypeCombo.SetCurSel (m_iType);
  107. // Fill in the user-box
  108. SetDlgItemText (IDC_PROGRAMMER_SETTINGS_EDIT, m_UserString);
  109. return TRUE;
  110. }
  111. /////////////////////////////////////////////////////////////
  112. //
  113. // OnApply
  114. //
  115. BOOL
  116. EmitterUserPropPageClass::OnApply (void)
  117. {
  118. // Get the settings from the controls
  119. m_iType = m_TypeCombo.GetCurSel ();
  120. GetDlgItemText (IDC_PROGRAMMER_SETTINGS_EDIT, m_UserString);
  121. //
  122. // Pass the new settings onto the emitter
  123. //
  124. m_pEmitterList->Set_User_Type (m_iType);
  125. m_pEmitterList->Set_User_String (m_UserString);
  126. // Allow the base class to process this message
  127. return CPropertyPage::OnApply ();
  128. }
  129. /////////////////////////////////////////////////////////////
  130. //
  131. // OnChangeProgrammerSettingsEdit
  132. //
  133. void
  134. EmitterUserPropPageClass::OnChangeProgrammerSettingsEdit (void)
  135. {
  136. SetModified ();
  137. return ;
  138. }
  139. /////////////////////////////////////////////////////////////
  140. //
  141. // OnSelchangeTypeCombo
  142. //
  143. void
  144. EmitterUserPropPageClass::OnSelchangeTypeCombo (void)
  145. {
  146. SetModified ();
  147. return ;
  148. }