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.

235 lines
6.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef OP_OUTPUT_H
  7. #define OP_OUTPUT_H
  8. #pragma once
  9. #include "ObjectPage.h"
  10. #include "Resource.h"
  11. #include "TargetNameCombo.h"
  12. #include "MapEntity.h"
  13. #include "ToolPickEntity.h"
  14. #include "AutoSelCombo.h"
  15. #include "AnchorMgr.h"
  16. #define OUTPUT_LIST_NUM_COLUMNS 6
  17. class COP_Output;
  18. enum SortDirection_t;
  19. //-----------------------------------------------------------------------------
  20. // Purpose: A little glue object that connects the entity picker tool to our dialog.
  21. //-----------------------------------------------------------------------------
  22. class COP_OutputPickEntityTarget : public IPickEntityTarget
  23. {
  24. public:
  25. void AttachEntityDlg(COP_Output *pDlg) { m_pDlg = pDlg; }
  26. void OnNotifyPickEntity(CToolPickEntity *pTool);
  27. void AttachDlgItem( int nItem ) { m_nDlgItem = nItem; }
  28. private:
  29. int m_nDlgItem;
  30. COP_Output *m_pDlg;
  31. };
  32. //-----------------------------------------------------------------------------
  33. // Purpose: A list of connections and entites that send them.
  34. //-----------------------------------------------------------------------------
  35. class COutputConnection
  36. {
  37. public:
  38. CEntityConnectionList* m_pConnList;
  39. CMapEntityList* m_pEntityList;
  40. bool m_bIsValid;
  41. bool m_bOwnedByAll; // Connection used by all selected entities
  42. };
  43. class COP_Output : public CObjectPage, public CFilteredComboBox::ICallbacks
  44. {
  45. public:
  46. static CImageList *m_pImageList;
  47. static CEntityConnectionList* m_pConnectionBuffer; // Stores connections for copy/pasting
  48. static void EmptyCopyBuffer(void);
  49. public:
  50. DECLARE_DYNCREATE(COP_Output)
  51. // Construction
  52. COP_Output(void);
  53. ~COP_Output(void);
  54. virtual void UpdateData( int Mode, PVOID pData, bool bCanEdit );
  55. void SetSelectedConnection(CEntityConnection *pConnection);
  56. bool ShouldShowHiddenTargets();
  57. protected:
  58. virtual void OnTextChanged( const char *pText );
  59. void AddEntityConnections(CMapEntity *pEntity, bool bFirst);
  60. void AddConnection(CEntityConnection *pConnection);
  61. void RemoveAllEntityConnections(void);
  62. void UpdateConnectionList(void);
  63. void ResizeColumns(void);
  64. void SetSelectedItem(int nItem);
  65. void SetSelectedConnections(CEntityConnectionList &List);
  66. // Validation functions
  67. bool ValidateConnections(COutputConnection *pOutputConn, bool bVisibilityCheck);
  68. bool ValidateExternalConnections(COutputConnection *pOutputConn, bool bVisibilityCheck);
  69. void UpdateValidityButton(void);
  70. // Edit controls
  71. void UpdateEditControls(void);
  72. void EnableEditControls(bool bValue = true);
  73. void UpdateItemValidity(int nItem);
  74. void EnableTarget(bool bEnable);
  75. void EnableParam(bool bEnable);
  76. bool bSkipEditControlRefresh;
  77. // Functions for updating edited connections
  78. void UpdateEditedInputs(void);
  79. void UpdateEditedOutputs(void);
  80. void UpdateEditedTargets(void);
  81. void UpdateEditedDelays(void);
  82. void UpdateEditedFireOnce(void);
  83. void UpdateEditedParams(void);
  84. // Fuctions for reacting to combo box changes
  85. void OutputChanged(void);
  86. void InputChanged(void);
  87. void SortListByColumn(int nColumn, SortDirection_t eDirection);
  88. void SetSortColumn(int nColumn, SortDirection_t eDirection);
  89. void UpdateColumnHeaderText(int nColumn, bool bIsSortColumn, SortDirection_t eDirection);
  90. CMapEntityList m_EntityList; // Filtered m_pObjectList that only includes map entities
  91. const CMapEntityList* m_pMapEntityList; // List of all entities in the map.
  92. CEntityConnectionList m_EditList; // List of selected connections being edited
  93. void UpdateEntityList(); // Generates m_EntityList from m_pObjectList
  94. protected:
  95. CAnchorMgr m_AnchorMgr;
  96. CEditGameClass *m_pEditGameClass;
  97. CMapEntity *m_pEntity;
  98. bool m_bNoParamEdit;
  99. //
  100. // Cached data for sorting the list view.
  101. //
  102. int m_nSortColumn; // Current column used for sorting.
  103. SortDirection_t m_eSortDirection[OUTPUT_LIST_NUM_COLUMNS]; // Last sort direction per column.
  104. bool m_bPickingEntities;
  105. // ########################################
  106. // Message editing
  107. // ########################################
  108. void SetConnection(CEntityConnectionList *pConnectionList);
  109. void SetMapEntityList(const CMapEntityList *pMapEntityList);
  110. void AddEntityOutputs(CMapEntity *pEntity);
  111. void FillInputList(void);
  112. void FillOutputList(void);
  113. void FillTargetList(void);
  114. CMapEntity *GetTargetInstanceIOProxy();
  115. void FilterInputList(void);
  116. void FilterOutputList(void);
  117. void FilterTargetList(void);
  118. void FilterEntityOutputs(CMapEntity *pEntity);
  119. void StopPicking(void);
  120. CClassInput* GetInput(char *szInput, int nSize);
  121. CClassOutput* GetOutput(char *szOutput, int nSize);
  122. CMapEntityList* GetTarget(char *szTarget, int nSize);
  123. void UpdateCombosForSelectedInput(CClassInput *pInput);
  124. void UpdateCombosForSelectedOutput(CClassOutput *pOutput);
  125. // #########################################
  126. //{{AFX_DATA(COP_Output)
  127. enum { IDD = IDD_OBJPAGE_OUTPUT };
  128. CListCtrl m_ListCtrl;
  129. CAutoSelComboBox m_ComboOutput;
  130. CTargetNameComboBox m_ComboTarget;
  131. CAutoSelComboBox m_ComboInput;
  132. CButton m_CheckBoxFireOnce;
  133. CButton m_ctlShowHiddenTargetsAsBroken;
  134. CButton m_AddControl;
  135. CButton m_PasteControl;
  136. CButton m_DeleteControl;
  137. CString m_strOutput;
  138. CString m_strTarget;
  139. CString m_strInput;
  140. CString m_strParam;
  141. float m_fDelay;
  142. BOOL m_bFireOnce;
  143. //}}AFX_DATA
  144. // ClassWizard generate virtual function overrides
  145. //{{AFX_VIRTUAL(COP_Output)
  146. virtual void DoDataExchange(CDataExchange* pDX);
  147. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult);
  148. virtual BOOL OnInitDialog(void);
  149. virtual void OnDestroy(void);
  150. //}}AFX_VIRTUAL
  151. // Generated message map functions
  152. //{{AFX_MSG(COP_Output)
  153. afx_msg void OnAdd(void);
  154. afx_msg void OnCopy(void);
  155. afx_msg void OnPaste(void);
  156. afx_msg void OnSize( UINT nType, int cx, int cy );
  157. afx_msg void OnDelete(void);
  158. afx_msg void OnMark(void);
  159. afx_msg void OnPickEntity(void);
  160. afx_msg void OnPickEntityParam(void);
  161. afx_msg void OnSelChangeInput(void);
  162. afx_msg void OnEditUpdateInput(void);
  163. afx_msg void OnSelChangeOutput(void);
  164. afx_msg void OnEditUpdateOutput(void);
  165. afx_msg void OnSelChangeParam(void);
  166. afx_msg void OnEditUpdateParam(void);
  167. afx_msg void OnEditDelay(void);
  168. afx_msg void OnFireOnce(void);
  169. afx_msg void OnShowHiddenTargetsAsBroken();
  170. //}}AFX_MSG
  171. DECLARE_MESSAGE_MAP()
  172. private:
  173. bool m_bEntityParamTarget;
  174. COP_OutputPickEntityTarget m_PickEntityTarget;
  175. CString m_strLastParam;
  176. bool m_bIgnoreTextChanged;
  177. bool m_bIsInstanceIOProxy;
  178. friend class COP_OutputPickEntityTarget;
  179. public:
  180. };
  181. #endif // OP_OUTPUT_H