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.

135 lines
4.3 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef BASEANIMSETATTRIBUTESLIDERPANEL_H
  7. #define BASEANIMSETATTRIBUTESLIDERPANEL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "datamodel/dmehandle.h"
  12. #include "dme_controls/BaseAnimationSetEditorController.h"
  13. #include "vgui_controls/EditablePanel.h"
  14. using namespace vgui;
  15. //-----------------------------------------------------------------------------
  16. // Forward declarations
  17. //-----------------------------------------------------------------------------
  18. class CBaseAnimationSetEditor;
  19. class CBaseAnimationSetControl;
  20. class CAttributeSlider;
  21. class CDmElement;
  22. class CDmeChannel;
  23. class CDmeFilmClip;
  24. class CDmeTimeSelection;
  25. enum RecordingMode_t;
  26. class DmeLog_TimeSelection_t;
  27. class CPresetSideFilterSlider;
  28. struct FaderPreview_t;
  29. struct AttributeValue_t;
  30. enum AnimationControlType_t;
  31. enum
  32. {
  33. FADER_DRAG_CHANGED = ( 1<<0 ),
  34. FADER_PREVIEW_KEY_CHANGED = ( 1<<1 ),
  35. FADER_AMOUNT_CHANGED = ( 1<<2 ),
  36. FADER_PRESET_CHANGED = ( 1<<3 ),
  37. };
  38. //-----------------------------------------------------------------------------
  39. // CBaseAnimSetAttributeSliderPanel
  40. //-----------------------------------------------------------------------------
  41. class CBaseAnimSetAttributeSliderPanel : public vgui::EditablePanel, public IAnimationSetControlSelectionChangedListener
  42. {
  43. DECLARE_CLASS_SIMPLE( CBaseAnimSetAttributeSliderPanel, vgui::EditablePanel );
  44. public:
  45. CBaseAnimSetAttributeSliderPanel( vgui::Panel *parent, const char *className, CBaseAnimationSetEditor *editor );
  46. public:
  47. virtual void ChangeAnimationSetClip( CDmeFilmClip *pFilmClip );
  48. virtual void OnControlsAddedOrRemoved();
  49. CBaseAnimationSetEditor* GetEditor();
  50. virtual CBaseAnimationSetControl* GetController() { return m_pController; }
  51. virtual void ApplySchemeSettings( vgui::IScheme *scheme );
  52. // These funcs only meaningful in derived/outer classes (SFM)
  53. virtual void StampValueIntoLogs( CDmElement *control, AnimationControlType_t type, const float &flValue ) {}
  54. virtual void StampValueIntoLogs( CDmElement *control, AnimationControlType_t type, const Vector &vecValue ) {}
  55. virtual void StampValueIntoLogs( CDmElement *control, AnimationControlType_t type, const Quaternion &qValue ) {}
  56. virtual void GetTypeInValueForControl( CDmElement *pControl, bool bOrientation, AttributeValue_t &controlValue, const AttributeValue_t &sliderValue );
  57. virtual void UpdatePreview( char const *pchFormat, ... );
  58. virtual void DispatchCurve( int nCurveType );
  59. CAttributeSlider *FindSliderForControl( const CDmElement *control );
  60. // Returns true if slider is visible
  61. bool GetSliderValues( AttributeValue_t *pValue, int nIndex );
  62. virtual void SetupForPreset( FaderPreview_t &fader );
  63. float GetBalanceSliderValue();
  64. // inherited from IAnimationSetControlSelectionChangedListener
  65. virtual void OnControlSelectionChanged();
  66. protected:
  67. virtual void OnThink();
  68. virtual void OnTick();
  69. virtual void OnCommand( const char *pCommand );
  70. virtual bool ApplySliderValues( bool force );
  71. virtual void UpdateControlSetMode( bool changingvalues, bool previewing, CAttributeSlider *dragSlider ) {}
  72. virtual void PerformLayout();
  73. protected:
  74. int FindSliderIndexForControl( const CDmElement *control );
  75. void UpdateSliderDependencyFlags() const;
  76. void RebuildSliderLists();
  77. // these are just temporary accessors for the CBaseAnimationSetControl until more code is moved over
  78. friend CBaseAnimationSetControl;
  79. int GetSliderCount() const { return m_SliderList.Count(); }
  80. CAttributeSlider *GetSlider( int i ) { return m_SliderList[ i ]; }
  81. CAttributeSlider *AllocateSlider();
  82. void FreeSlider( CAttributeSlider *slider );
  83. void InitFreeSliderList( int nCount );
  84. vgui::DHANDLE< CBaseAnimationSetEditor > m_hEditor;
  85. // Visible slider list
  86. vgui::DHANDLE< vgui::PanelListPanel > m_Sliders;
  87. // All sliders
  88. CUtlVector< CAttributeSlider * > m_SliderList;
  89. vgui::Button *m_pLeftRightBoth[ 2 ];
  90. CPresetSideFilterSlider *m_pPresetSideFilter;
  91. CBaseAnimationSetControl *m_pController;
  92. CUtlVector< CAttributeSlider * > m_FreeSliderList;
  93. };
  94. inline CBaseAnimationSetEditor* CBaseAnimSetAttributeSliderPanel::GetEditor()
  95. {
  96. return m_hEditor;
  97. }
  98. #endif // BASEANIMSETATTRIBUTESLIDERPANEL_H