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.

144 lines
3.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef FLEXPANEL_H
  7. #define FLEXPANEL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #ifndef INCLUDED_MXWINDOW
  12. #include <mxtk/mxWindow.h>
  13. #endif
  14. #define IDC_FLEX 7001
  15. #define IDC_FLEXSCROLL 7101
  16. #define IDC_EXPRESSIONRESET 7102
  17. // NOTE THIS THIS TAKES UP 4 * 96 entries (384)
  18. // #define NEXT_AVAIL 7457 ...etc.
  19. #define IDC_FLEXSCALE 7200
  20. #define IDC_FLEXSCALE_LAST 7584
  21. #define IDC_FP_UNCHECK_ALL 7800
  22. #define IDC_FP_CHECK_ALL 7801
  23. #define IDC_FP_INVERT 7802
  24. #define IDC_FP_MENU 7803
  25. #include "studio.h"
  26. class mxTab;
  27. class mxChoice;
  28. class mxCheckBox;
  29. class mxSlider;
  30. class mxScrollbar;
  31. class mxLineEdit;
  32. class mxLabel;
  33. class mxButton;
  34. class MatSysWindow;
  35. class TextureWindow;
  36. class mxExpressionSlider;
  37. #include "expressions.h"
  38. #include "faceposertoolwindow.h"
  39. /*
  40. int nameindex;
  41. int numkeys;
  42. int keyindex;
  43. { char key, char weight }
  44. */
  45. class ControlPanel;
  46. class FlexPanel : public mxWindow, public IFacePoserToolWindow
  47. {
  48. typedef mxWindow BaseClass;
  49. mxExpressionSlider *slFlexScale[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ];
  50. mxScrollbar *slScrollbar;
  51. mxButton *btnResetSliders;
  52. mxButton *btnCopyToSliders;
  53. mxButton *btnCopyFromSliders;
  54. mxButton *btnMenu;
  55. public:
  56. // CREATORS
  57. FlexPanel (mxWindow *parent);
  58. virtual ~FlexPanel ();
  59. virtual void redraw();
  60. virtual bool PaintBackground( void );
  61. void SetEvent( CChoreoEvent *event );
  62. virtual void OnModelChanged();
  63. // MANIPULATORS
  64. int handleEvent (mxEvent *event);
  65. void initFlexes ();
  66. bool IsValidSlider( int iFlexController ) const;
  67. float GetSlider( int iFlexController );
  68. float GetSliderRawValue( int iFlexController );
  69. void GetSliderRange( int iFlexController, float& minvalue, float& maxvalue );
  70. void SetSlider( int iFlexController, float value );
  71. float GetInfluence( int iFlexController );
  72. void SetInfluence( int iFlexController, float value );
  73. void SetEdited( int iFlexController, bool isEdited );
  74. bool IsEdited( int iFlexController );
  75. int LookupFlex( int iSlider, int barnum );
  76. int LookupPairedFlex( int iFlexController );
  77. // maps global flex_controller index to UI slider
  78. int nFlexSliderIndex[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ];
  79. int nFlexSliderBarnum[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ];
  80. void PositionSliders( int sboffset );
  81. void PositionControls( int width, int height );
  82. void EditExpression( void );
  83. void NewExpression( void );
  84. void setExpression( int index );
  85. void DeleteExpression( int index );
  86. void SaveExpression( int index );
  87. void RevertExpression( int index );
  88. void CopyControllerSettings( void );
  89. void PasteControllerSettings( void );
  90. void ResetSliders( bool preserveundo, bool bDirtyClass );
  91. void CopyControllerSettingsToStructure( CExpression *exp );
  92. private:
  93. enum
  94. {
  95. FP_STATE_UNCHECK = 0,
  96. FP_STATE_CHECK,
  97. FP_STATE_INVERT
  98. };
  99. void OnSetAll( int state );
  100. void OnMenu();
  101. bool m_bNewExpressionMode;
  102. // Since we combine left/right into one, this will be less than hdr->numflexcontrollers
  103. int m_nViewableFlexControllerCount;
  104. };
  105. extern FlexPanel *g_pFlexPanel;
  106. #endif // FLEXPANEL_H