TextureMgrDialog.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. *** 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 : LevelEdit *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/W3DView/TextureMgrDialog.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 3/01/01 3:16p $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if !defined(AFX_TEXTUREMGRDIALOG_H__3F61844D_CDEA_11D2_9FFC_00104B791122__INCLUDED_)
  36. #define AFX_TEXTUREMGRDIALOG_H__3F61844D_CDEA_11D2_9FFC_00104B791122__INCLUDED_
  37. #if _MSC_VER > 1000
  38. #pragma once
  39. #endif // _MSC_VER > 1000
  40. #include "Vector.H"
  41. #include "RendObj.H"
  42. #include "Utils.H"
  43. #include "Resource.H"
  44. #include "DialogToolbar.H"
  45. #include "texture.h"
  46. // Forward declarations
  47. class MeshClass;
  48. #ifdef WW3D_DX8
  49. /////////////////////////////////////////////////////////////////////////////
  50. //
  51. // Constants
  52. //
  53. const int ICON_MESH = 0;
  54. const int ICON_DEF_TEXTURE = 1;
  55. #define TEXTURE_NODE_LIST DynamicVectorClass <class TextureListNodeClass *>
  56. /////////////////////////////////////////////////////////////////////////////
  57. //
  58. // TextureListNodeClass
  59. //
  60. class TextureListNodeClass
  61. {
  62. public:
  63. typedef enum
  64. {
  65. TYPE_MESH = 0,
  66. TYPE_TEXTURE,
  67. TYPE_COUNT
  68. } NODE_TYPE;
  69. ////////////////////////////////////////////////////////////
  70. //
  71. // Public constructors/destructors
  72. //
  73. TextureListNodeClass (LPCTSTR name = NULL)
  74. : m_pTexture (NULL),
  75. m_Type (TYPE_MESH),
  76. m_pParent (NULL),
  77. m_Name (name),
  78. m_TextureIndex (0),
  79. m_IconIndex (ICON_MESH) {}
  80. TextureListNodeClass (TextureClass *ptexture, LPCTSTR name = NULL)
  81. : m_pTexture (NULL),
  82. m_Type (TYPE_TEXTURE),
  83. m_pParent (NULL),
  84. m_Name (name),
  85. m_TextureIndex (0),
  86. m_IconIndex (ICON_DEF_TEXTURE) { MEMBER_ADD (m_pTexture, ptexture); }
  87. ~TextureListNodeClass (void) { MEMBER_RELEASE (m_pTexture); Free_Subobj_List (); }
  88. ////////////////////////////////////////////////////////////
  89. //
  90. // Public methods
  91. //
  92. void Set_Name (LPCTSTR name) { m_Name = name; }
  93. LPCTSTR Get_Name (void) const { return m_Name; }
  94. NODE_TYPE Get_Type (void) const { return m_Type; }
  95. void Set_Type (NODE_TYPE type) { m_Type = type; }
  96. TextureClass * Peek_Texture (void) const { return m_pTexture; }
  97. void Set_Texture (TextureClass *ptex) { MEMBER_ADD (m_pTexture, ptex); }
  98. TEXTURE_NODE_LIST & Get_Subobj_List (void) { return m_SubObjectList; }
  99. void Set_Parent (TextureListNodeClass *pparent) { m_pParent = pparent; }
  100. TextureListNodeClass * Get_Parent (void) const { return m_pParent; }
  101. void Add_Subobj (TextureListNodeClass *pchild) { m_SubObjectList.Add (pchild); }
  102. int Get_Icon_Index (void) const { return m_IconIndex; }
  103. void Set_Icon_Index (int index) { m_IconIndex = index; }
  104. int Get_Texture_Index (void) const { return m_TextureIndex; }
  105. void Set_Texture_Index (int index) { m_TextureIndex = index; }
  106. protected:
  107. ////////////////////////////////////////////////////////////
  108. //
  109. // Protected methods
  110. //
  111. void Free_Subobj_List (void);
  112. private:
  113. ////////////////////////////////////////////////////////////
  114. //
  115. // Private member data
  116. //
  117. NODE_TYPE m_Type;
  118. CString m_Name;
  119. TEXTURE_NODE_LIST m_SubObjectList;
  120. TextureClass * m_pTexture;
  121. TextureListNodeClass * m_pParent;
  122. int m_IconIndex;
  123. int m_TextureIndex;
  124. };
  125. /////////////////////////////////////////////////////////////////////////////
  126. //
  127. // Free_Subobj_List
  128. //
  129. __inline void
  130. TextureListNodeClass::Free_Subobj_List (void)
  131. {
  132. // Loop through all the subobject entries and free thier pointers
  133. for (int index = 0; index < m_SubObjectList.Count (); index ++) {
  134. SAFE_DELETE (m_SubObjectList[index]);
  135. }
  136. m_SubObjectList.Delete_All ();
  137. return ;
  138. }
  139. /////////////////////////////////////////////////////////////////////////////
  140. //
  141. // TextureMgrDialogClass dialog
  142. //
  143. class TextureMgrDialogClass : public CDialog
  144. {
  145. // Construction
  146. public:
  147. TextureMgrDialogClass (RenderObjClass *pbase_model, CWnd *pParent = NULL);
  148. // Dialog Data
  149. //{{AFX_DATA(TextureMgrDialogClass)
  150. enum { IDD = IDD_TEXTURE_MANAGMENT };
  151. CListCtrl m_ListCtrl;
  152. //}}AFX_DATA
  153. // Overrides
  154. // ClassWizard generated virtual function overrides
  155. //{{AFX_VIRTUAL(TextureMgrDialogClass)
  156. protected:
  157. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  158. //}}AFX_VIRTUAL
  159. // Implementation
  160. protected:
  161. // Generated message map functions
  162. //{{AFX_MSG(TextureMgrDialogClass)
  163. virtual BOOL OnInitDialog();
  164. virtual void OnOK();
  165. virtual void OnCancel();
  166. afx_msg void OnDblclkMeshTextureListCtrl(NMHDR* pNMHDR, LRESULT* pResult);
  167. afx_msg void OnKeydownMeshTextureListCtrl(NMHDR* pNMHDR, LRESULT* pResult);
  168. afx_msg void OnDestroy();
  169. afx_msg void OnBack();
  170. afx_msg void OnDetails();
  171. afx_msg void OnLarge();
  172. afx_msg void OnList();
  173. afx_msg void OnSmall();
  174. afx_msg void OnPropagate();
  175. //}}AFX_MSG
  176. DECLARE_MESSAGE_MAP()
  177. public:
  178. protected:
  179. ////////////////////////////////////////////////////////////////
  180. //
  181. // Protected methosd
  182. //
  183. void Add_Subobjs_To_List (RenderObjClass *prender_obj);
  184. void Add_Textures_To_Node (MeshClass *pmesh, TextureListNodeClass *pmesh_node);
  185. void Fill_List_Ctrl_With_Meshes (void);
  186. void Fill_List_Ctrl_With_Textures (TextureListNodeClass &pparent);
  187. int Find_Texture_Thumbnail (LPCTSTR name);
  188. int Get_Thumbnail (TextureClass *ptexture);
  189. void Insert_Texture_Details (TextureListNodeClass *pnode, int index);
  190. private:
  191. ////////////////////////////////////////////////////////////////
  192. //
  193. // Private member data
  194. //
  195. RenderObjClass * m_pBaseModel;
  196. TEXTURE_NODE_LIST m_NodeList;
  197. bool m_bContainsMeshes;
  198. CImageList * m_pImageList;
  199. CImageList * m_pImageListSmall;
  200. CImageList * m_pTextureImageList;
  201. CImageList * m_pTextureImageListSmall;
  202. DynamicVectorClass <CString> m_TextureNames;
  203. DialogToolbarClass m_Toolbar;
  204. };
  205. #endif //WW3D_DX8
  206. //{{AFX_INSERT_LOCATION}}
  207. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  208. #endif // !defined(AFX_TEXTUREMGRDIALOG_H__3F61844D_CDEA_11D2_9FFC_00104B791122__INCLUDED_)