Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
5.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef FACEEDITSHEET_H
  8. #define FACEEDITSHEET_H
  9. #pragma once
  10. #include <afxtempl.h>
  11. #include "FaceEdit_MaterialPage.h"
  12. #include "FaceEdit_DispPage.h"
  13. class CMapFace;
  14. class CMapSolid;
  15. //=============================================================================
  16. //
  17. // Face Edit Sheet
  18. //
  19. class CFaceEditSheet : public CPropertySheet
  20. {
  21. DECLARE_DYNAMIC( CFaceEditSheet )
  22. public:
  23. // solid/face selection structure
  24. typedef struct
  25. {
  26. CMapDoc *pMapDoc; // From whence it came, so if we close the CMapDoc we can unselect it.
  27. CMapFace *pMapFace;
  28. CMapSolid *pMapSolid;
  29. } StoredFace_t;
  30. //=========================================================================
  31. //
  32. // Creation/Destruction
  33. //
  34. CFaceEditSheet( LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0 );
  35. virtual ~CFaceEditSheet();
  36. BOOL Create( CWnd *pParentWnd );
  37. void Setup( void );
  38. //=========================================================================
  39. //
  40. // Update
  41. //
  42. void SetVisibility( bool bVisible );
  43. inline void NotifyGraphicsChanged( void );
  44. void CloseAllPageDialogs( void );
  45. void UpdateControls( void );
  46. // Called when the CMapDoc goes away. Don't hang onto old face pointers that come from this doc.
  47. void ClearFaceListByMapDoc( CMapDoc *pDoc );
  48. //=========================================================================
  49. //
  50. // Selection
  51. //
  52. enum { FACE_LIST_SIZE = 32 };
  53. enum
  54. {
  55. id_SwitchModeStart = 0x100,
  56. ModeLiftSelect,
  57. ModeLift,
  58. ModeSelect,
  59. ModeApply,
  60. ModeApplyAll,
  61. ModeApplyLightmapScale,
  62. ModeAlignToView,
  63. id_SwitchModeEnd
  64. };
  65. enum
  66. {
  67. cfToggle = 0x01, // toggle - if selected, then unselect
  68. cfSelect = 0x02, // select
  69. cfUnselect = 0x04, // unselect
  70. cfClear = 0x08, // clear face list
  71. cfEdgeAlign = 0x10 // align face texture coordinates to 3d view alignment - should be here???
  72. };
  73. void ClickFace( CMapSolid *pSolid, int faceIndex, int cmd, int clickMode = -1 );
  74. inline void SetClickMode( int mode );
  75. inline int GetClickMode( void );
  76. void EnableUpdate( bool bEnable );
  77. inline bool HasUpdateEnabled( void );
  78. inline int GetFaceListCount( void );
  79. inline CMapFace *GetFaceListDataFace( int index );
  80. inline CMapSolid *GetFaceListDataSolid( int index );
  81. // Called when a new material is detected.
  82. void NotifyNewMaterial( IEditorTexture *pTex );
  83. //=========================================================================
  84. //
  85. // Virtual Overrides
  86. //
  87. //{{AFX_VIRTUAL( CFaceEditSheet )
  88. virtual BOOL PreTranslateMessage( MSG *pMsg );
  89. //}}AFX_VIRTUAL
  90. CFaceEditMaterialPage m_MaterialPage; // material "page"
  91. CFaceEditDispPage m_DispPage; // displacement "page"
  92. protected:
  93. CUtlVector<StoredFace_t> m_Faces; // face list
  94. // CFaceEditMaterialPage m_MaterialPage; // material "page"
  95. // CFaceEditDispPage m_DispPage; // displacement "page"
  96. int m_ClickMode; // lame this is here!!!! -- see CMapDoc (SelectFace)
  97. bool m_bEnableUpdate; // update the dialog (true/false)
  98. //=========================================================================
  99. //
  100. // Creation/Destruction
  101. //
  102. void SetupPages( void );
  103. void SetupButtons( void );
  104. //=========================================================================
  105. //
  106. // Selection
  107. //
  108. void ClearFaceList( void );
  109. int FindFaceInList( CMapFace *pFace );
  110. //=========================================================================
  111. //
  112. // Message Map
  113. //
  114. //{{AFX_MSG( CFaceEditSheet )
  115. afx_msg void OnClose( void );
  116. //}}AFX_MSG
  117. DECLARE_MESSAGE_MAP()
  118. };
  119. //-----------------------------------------------------------------------------
  120. //-----------------------------------------------------------------------------
  121. inline void CFaceEditSheet::NotifyGraphicsChanged( void )
  122. {
  123. m_MaterialPage.NotifyGraphicsChanged();
  124. }
  125. //-----------------------------------------------------------------------------
  126. //-----------------------------------------------------------------------------
  127. inline void CFaceEditSheet::SetClickMode( int mode )
  128. {
  129. m_ClickMode = mode;
  130. }
  131. //-----------------------------------------------------------------------------
  132. //-----------------------------------------------------------------------------
  133. inline int CFaceEditSheet::GetClickMode( void )
  134. {
  135. return m_ClickMode;
  136. }
  137. //-----------------------------------------------------------------------------
  138. //-----------------------------------------------------------------------------
  139. inline int CFaceEditSheet::GetFaceListCount( void )
  140. {
  141. return m_Faces.Count();
  142. }
  143. //-----------------------------------------------------------------------------
  144. //-----------------------------------------------------------------------------
  145. inline CMapFace *CFaceEditSheet::GetFaceListDataFace( int index )
  146. {
  147. return m_Faces[index].pMapFace;
  148. }
  149. //-----------------------------------------------------------------------------
  150. //-----------------------------------------------------------------------------
  151. inline CMapSolid *CFaceEditSheet::GetFaceListDataSolid( int index )
  152. {
  153. return m_Faces[index].pMapSolid;
  154. }
  155. //-----------------------------------------------------------------------------
  156. //-----------------------------------------------------------------------------
  157. inline bool CFaceEditSheet::HasUpdateEnabled( void )
  158. {
  159. return m_bEnableUpdate;
  160. }
  161. #endif // FACEEDITSHEET_H