DataTreeView.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. #if !defined(AFX_DATATREEVIEW_H__2BB39E40_5D3A_11D2_9FC6_00104B791122__INCLUDED_)
  19. #define AFX_DATATREEVIEW_H__2BB39E40_5D3A_11D2_9FC6_00104B791122__INCLUDED_
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif // _MSC_VER >= 1000
  23. // DataTreeView.h : header file
  24. //
  25. #include "AfxCView.H"
  26. #include "AssetTypes.H"
  27. #include "Vector.H"
  28. // Forward declarations
  29. class RenderObjClass;
  30. class AssetInfoClass;
  31. /////////////////////////////////////////////////////////////////////////////
  32. //
  33. // CDataTreeView view
  34. //
  35. class CDataTreeView : public CTreeView
  36. {
  37. protected:
  38. CDataTreeView(); // protected constructor used by dynamic creation
  39. DECLARE_DYNCREATE(CDataTreeView)
  40. // Attributes
  41. public:
  42. // Operations
  43. public:
  44. // Overrides
  45. // ClassWizard generated virtual function overrides
  46. //{{AFX_VIRTUAL(CDataTreeView)
  47. public:
  48. virtual void OnInitialUpdate();
  49. protected:
  50. virtual void OnDraw(CDC* pDC); // overridden to draw this view
  51. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  52. //}}AFX_VIRTUAL
  53. // Implementation
  54. protected:
  55. virtual ~CDataTreeView();
  56. #ifdef _DEBUG
  57. virtual void AssertValid() const;
  58. virtual void Dump(CDumpContext& dc) const;
  59. #endif
  60. // Generated message map functions
  61. protected:
  62. //{{AFX_MSG(CDataTreeView)
  63. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  64. afx_msg void OnSelChanged(NMHDR* pNMHDR, LRESULT* pResult);
  65. afx_msg void OnDeleteItem(NMHDR* pNMHDR, LRESULT* pResult);
  66. afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
  67. //}}AFX_MSG
  68. DECLARE_MESSAGE_MAP()
  69. public:
  70. /////////////////////////////////////////////////////////////////////
  71. // Public methods
  72. /////////////////////////////////////////////////////////////////////
  73. //
  74. // Asset insertion methods
  75. //
  76. bool Add_Asset_To_Tree (LPCTSTR name, ASSET_TYPE type, bool bselect);
  77. void LoadAssetsIntoTree (void);
  78. void Refresh_Asset (LPCTSTR new_name, LPCTSTR old_name, ASSET_TYPE type);
  79. //
  80. // Animation insertion methods
  81. //
  82. void LoadAnimationsIntoTree (void);
  83. void LoadAnimationsIntoTree (HTREEITEM hItem);
  84. bool Are_Anims_Restricted (void) const { return m_RestrictAnims; }
  85. void Restrict_Anims (bool onoff);
  86. //
  87. // Texture insertion methods
  88. //
  89. void Load_Materials_Into_Tree (void);
  90. //
  91. // Display methods
  92. //
  93. void Display_Asset (HTREEITEM htree_item = NULL);
  94. void Select_Next (void);
  95. void Select_Prev (void);
  96. void Reload_Lightmap_Models (void);
  97. //
  98. // Information methods
  99. //
  100. RenderObjClass * Get_Current_Render_Obj (void) const;
  101. AssetInfoClass * Get_Current_Asset_Info (void) const;
  102. LPCTSTR GetCurrentSelectionName (void);
  103. ASSET_TYPE GetCurrentSelectionType (void);
  104. HTREEITEM FindChildItem (HTREEITEM hParentItem, LPCTSTR pszChildItemName);
  105. HTREEITEM FindChildItem (HTREEITEM hParentItem, RenderObjClass *prender_obj);
  106. HTREEITEM FindFirstChildItemBasedOnHierarchyName (HTREEITEM hParentItem, LPCTSTR pszHierarchyName);
  107. HTREEITEM FindSiblingItemBasedOnHierarchyName (HTREEITEM hCurrentItem, LPCTSTR pszHierarchyName);
  108. void Build_Render_Object_List (DynamicVectorClass <CString> &asset_list, HTREEITEM hparent = TVI_ROOT);
  109. //
  110. // Initialization methods
  111. //
  112. void CreateRootNodes (void);
  113. protected:
  114. ///////////////////////////////////////////////////////////////////////
  115. // Protected methods
  116. ///////////////////////////////////////////////////////////////////////
  117. ASSET_TYPE Determine_Tree_Location (RenderObjClass &render_obj, HTREEITEM &hroot, int &icon_index);
  118. void Determine_Tree_Location (ASSET_TYPE type, HTREEITEM &hroot, int &icon_index);
  119. RenderObjClass * Create_Render_Obj_To_Display (HTREEITEM htree_item);
  120. void Add_Emitters_To_Menu (HMENU hmenu, RenderObjClass &render_obj);
  121. void Free_Child_Models (HTREEITEM parent_item);
  122. private:
  123. ///////////////////////////////////////////////////////
  124. //
  125. // Private member data
  126. //
  127. HTREEITEM m_hMaterialsRoot;
  128. HTREEITEM m_hMeshRoot;
  129. HTREEITEM m_hAggregateRoot;
  130. HTREEITEM m_hLODRoot;
  131. HTREEITEM m_hMeshCollectionRoot;
  132. HTREEITEM m_hEmitterRoot;
  133. HTREEITEM m_hPrimitivesRoot;
  134. HTREEITEM m_hHierarchyRoot;
  135. HTREEITEM m_hSoundRoot;
  136. int m_iAnimationIcon;
  137. int m_iTCAnimationIcon;
  138. int m_iADAnimationIcon;
  139. int m_iMeshIcon;
  140. int m_iMaterialIcon;
  141. int m_iLODIcon;
  142. int m_iEmitterIcon;
  143. int m_iPrimitivesIcon;
  144. int m_iAggregateIcon;
  145. int m_iHierarchyIcon;
  146. int m_iSoundIcon;
  147. bool m_RestrictAnims;
  148. };
  149. /////////////////////////////////////////////////////////////////////////////
  150. //{{AFX_INSERT_LOCATION}}
  151. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  152. #endif // !defined(AFX_DATATREEVIEW_H__2BB39E40_5D3A_11D2_9FC6_00104B791122__INCLUDED_)