Team Fortress 2 Source Code as on 22/4/2020
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.

92 lines
2.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef COMMEDITDOC_H
  9. #define COMMEDITDOC_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "dme_controls/inotifyui.h"
  14. #include "datamodel/dmehandle.h"
  15. #include "datamodel/dmelement.h"
  16. //-----------------------------------------------------------------------------
  17. // Forward declarations
  18. //-----------------------------------------------------------------------------
  19. class ICommEditDocCallback;
  20. class CCommEditDoc;
  21. class CDmeCommentaryNodeEntity;
  22. typedef CDmrElementArray<CDmeCommentaryNodeEntity> CDmrCommentaryNodeEntityList;
  23. //-----------------------------------------------------------------------------
  24. // Contains all editable state
  25. //-----------------------------------------------------------------------------
  26. class CCommEditDoc : public IDmNotify
  27. {
  28. public:
  29. CCommEditDoc( ICommEditDocCallback *pCallback );
  30. ~CCommEditDoc();
  31. // Inherited from INotifyUI
  32. virtual void NotifyDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
  33. // Sets/Gets the file name
  34. const char *GetTXTFileName();
  35. void SetTXTFileName( const char *pFileName );
  36. // Dirty bits (has it changed since the last time it was saved?)
  37. void SetDirty( bool bDirty );
  38. bool IsDirty() const;
  39. // Saves/loads from file
  40. bool LoadFromFile( const char *pFileName );
  41. void SaveToFile( );
  42. // Returns the root object
  43. CDmElement *GetRootObject();
  44. // Called when data changes (see INotifyUI for flags)
  45. void OnDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
  46. // Returns the entity list
  47. CDmAttribute *GetEntityList();
  48. // Adds a new info_target
  49. void AddNewInfoTarget( void );
  50. void AddNewInfoTarget( const Vector &vecOrigin, const QAngle &angAngles );
  51. // Adds a new commentary node
  52. void AddNewCommentaryNode( void );
  53. void AddNewCommentaryNode( const Vector &vecOrigin, const QAngle &angAngles );
  54. // Deletes a commentary node
  55. void DeleteCommentaryNode( CDmElement *pNode );
  56. // Returns the commentary node at the specified location
  57. CDmeCommentaryNodeEntity *GetCommentaryNodeForLocation( Vector &vecOrigin, QAngle &angAbsAngles );
  58. // For element choice lists. Return false if it's an unknown choice list type
  59. virtual bool GetStringChoiceList( const char *pChoiceListType, CDmElement *pElement,
  60. const char *pAttributeName, bool bArrayElement, StringChoiceList_t &list );
  61. virtual bool GetElementChoiceList( const char *pChoiceListType, CDmElement *pElement,
  62. const char *pAttributeName, bool bArrayElement, ElementChoiceList_t &list );
  63. private:
  64. ICommEditDocCallback *m_pCallback;
  65. CDmeHandle< CDmElement > m_hRoot;
  66. char m_pTXTFileName[512];
  67. bool m_bDirty;
  68. };
  69. #endif // COMMEDITDOC_H