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.

128 lines
5.8 KiB

  1. //====== Copyright � 1996-2009, Valve Corporation, All rights reserved. =======
  2. //
  3. // Declaration of CDmeGraphEditorState, a data model element which stores
  4. // the active state data for the graph editor.
  5. //
  6. //=============================================================================
  7. #ifndef DMEGRAPHEDITORSTATE_H
  8. #define DMEGRAPHEDITORSTATE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "sfmobjects/dmegrapheditorcurve.h"
  13. #include "movieobjects/dmechannel.h"
  14. #include "movieobjects/dmebookmark.h"
  15. #include "datamodel/dmelement.h"
  16. // Function declaration for bookmark update callbacks.
  17. typedef void (*FnUpdateBookmarks)( const CDmaElementArray< CDmeBookmark > &bookmarkSet, void *pData );
  18. typedef void (*FnOnBookmarkTimeChange )( DmeTime_t oldTime, DmeTime_t newTime, void *pData );
  19. //-----------------------------------------------------------------------------
  20. // The CDmeGraphEditorState class is a data model element which represents the
  21. // active state of the CGraphEditor class. It contains the visible curve set,
  22. // selection, and curve handle data. It provides access to selection and
  23. // handles, but does not perform any data manipulation.
  24. //-----------------------------------------------------------------------------
  25. class CDmeGraphEditorState : public CDmElement
  26. {
  27. DEFINE_ELEMENT( CDmeGraphEditorState, CDmElement );
  28. public:
  29. // Remove all curves from the list of active curves
  30. void RemoveAllCurves();
  31. // Add or update the specified channel for editing.
  32. CDmeGraphEditorCurve *AddCurve( CDmeChannel *pChannel, DmeFramerate_t framerate, bool bFrameSnap, const DmeClipStack_t &clipstack );
  33. // Find the graph editor curve for the specified channel
  34. CDmeGraphEditorCurve *FindCurve( const CDmeChannel *pChannel ) const;
  35. // Find the graph editor curve for the specified channel within the active set.
  36. CDmeGraphEditorCurve *FindActiveCurve( const CDmeChannel *pChannel ) const;
  37. // Find the graph editor curve with in the active set that is associated with a channel of the specified name.
  38. CDmeGraphEditorCurve *FindActiveCurveByChannelName( const char *name ) const;
  39. // Remove all curves from the list of active curves
  40. void DeactiveateAllCurves();
  41. // Remove and curves which do not remove to a valid channel
  42. void RemoveInvalidCurves();
  43. // Add the specified curve to the list of active curves
  44. void MakeCurveActive( CDmeGraphEditorCurve *pCurve, LogComponents_t nComponents );
  45. // Clear the current key selection
  46. void ClearSelection();
  47. // Select the specified keys according to the specified selection mode
  48. void SelectKeys( const CUtlVector< CDmeCurveKey * > &keyList, SelectionMode_t selectionMode );
  49. // Find the index of the the key in the selection set
  50. int FindSelectedKey( const CDmeCurveKey *pKey ) const;
  51. // Set the tangent selection for the specified keys
  52. void SelectKeyTangents( const CUtlVector< CDmeCurveKey * > &keyList, const CUtlVector< bool > &inList,
  53. const CUtlVector< bool > &outList, SelectionMode_t selectionMode );
  54. // Select the specified component of the specified curve and all the keys on the component
  55. void SelectCurveComponents( const CUtlVector< CDmeGraphEditorCurve * > &curveList, const CUtlVector < LogComponents_t > &nComponentFlagsList, SelectionMode_t selectionMode );
  56. // Add a bookmark to the set at the specified time
  57. CDmeBookmark *AddBookmark( DmeTime_t time, bool bAddToSet = true );
  58. // Find a bookmark with the specified time
  59. CDmeBookmark *FindBookmark( DmeTime_t time ) const;
  60. // Remove all of the current bookmarks from the bookmark set
  61. void ClearBookmarkSet();
  62. // Rebuild the bookmark set from the specified list of times
  63. void SetAllBookmarks( const CUtlVector< DmeTime_t > &times );
  64. // Accessors
  65. bool ShouldDisplayGrid() const { return m_bDisplayGrid; }
  66. CDmaElementArray< CDmeBookmark > &GetBookmarkSet() { return m_BookmarkSet; }
  67. const CDmaElementArray< CDmeBookmark > &GetBookmarkSet() const { return m_BookmarkSet; }
  68. const CDmaElementArray< CDmeGraphEditorCurve > &GetFullCurveList() const { return m_CurveList; }
  69. const CDmaElementArray< CDmeGraphEditorCurve > &GetActiveCurveList() const { return m_ActiveCurveList; }
  70. const CDmaElementArray< CDmeCurveKey > &GetSelectedKeys() const { return m_SelectedKeys; }
  71. private:
  72. // Select the specified key according to the specified selection mode
  73. void SelectKey( CDmeCurveKey *pKey, bool bInTangent, bool bOutTangent, SelectionMode_t selectionMode );
  74. // Add the specified key to the selection
  75. void AddKeyToSelection( CDmeCurveKey *pKey, bool bInSelection, bool bOutSelection );
  76. // Remove the specified key from the selection
  77. void RemoveKeyFromSelection( CDmeCurveKey *pKey, bool bInSelection, bool bOutSelection );
  78. // Toggle the selection of the specified key
  79. void ToggleKeySelection( CDmeCurveKey *pKey, bool bInSelection, bool bOutSelection );
  80. // Remove the invalid curves from the specified array
  81. static void RemoveInvalidCurves( CDmaElementArray< CDmeGraphEditorCurve > &curveList );
  82. CDmaElementArray< CDmeGraphEditorCurve > m_CurveList; // "curveList" : Array of all curves currently available to the graph editor
  83. CDmaElementArray< CDmeGraphEditorCurve > m_ActiveCurveList; // "activeCurveList" : Array of curves visible in the graph editor which will be modified by operations
  84. CDmaElementArray< CDmeCurveKey > m_SelectedKeys; // "selectedKeys" : Array of curve keys that are currently selected
  85. CDmaElementArray< CDmeBookmark > m_BookmarkSet; // "bookmarkSet" : Array of bookmark elements generated from the active log bookmarks
  86. CDmaVar< bool > m_bDisplayGrid; // "displayGrid" : Flag indicating if the graph grid should be displayed
  87. friend class CUndoGraphEditorSelectKeys;
  88. };
  89. #endif // DMEGRAPHEDITORSTATE_H