1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#if !defined( MXEXPRESSIONTRAY_H )
#define MXEXPRESSIONTRAY_H
#ifdef _WIN32
#pragma once
#endif
#define IDC_TRAYSCROLL 1001
#define IDC_CONTEXT_NEWEXP 1002
#define IDC_CONTEXT_EDITEXP 1003
#define IDC_CONTEXT_SAVEEXP 1004
#define IDC_CONTEXT_DELETEXP 1005
#define IDC_CONTEXT_REVERT 1012
#define IDC_AB 1014
#define IDC_THUMBNAIL_INCREASE 1015
#define IDC_THUMBNAIL_DECREASE 1016
#define IDC_CONTEXT_CREATEBITMAP 1017
#define COLOR_TRAYBACKGROUND RGB( 240, 240, 220 )
class ControlPanel;
class FlexPanel;
class mxScrollbar;
class mxCheckBox;
class CChoreoView;
class CExpression;
class CExpClass;
class mxButton;
class CChoreoWidgetDrawHelper;
#include "faceposertoolwindow.h"
#include "mxbitmaptools.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class mxExpressionTray : public mxWindow, public IFacePoserToolWindow
{
public:
mxExpressionTray( mxWindow *parent, int id = 0 );
virtual ~mxExpressionTray ( void );
virtual void redraw ();
virtual bool PaintBackground( void );
virtual int handleEvent (mxEvent *event);
void ThumbnailIncrease( void );
void ThumbnailDecrease( void );
void RestoreThumbnailSize( void );
void AB( void );
void Select( int exp, bool deselect = true );
void Deselect( void );
int CountSelected( void );
void SetCellSize( int cellsize );
void ReloadBitmaps( void );
virtual void OnModelChanged();
private: // Data structures
typedef void (mxExpressionTray::*ETMEMBERFUNC)( int cell );
class mxETButton
{
public:
mxETButton *next;
char m_szName[ 32 ];
bool m_bActive;
RECT m_rc;
char m_szToolTip[ 128 ];
mxbitmapdata_t *m_pImage;
ETMEMBERFUNC m_fnCallback;
};
private: // Methods
void ChangeWeightOfExpressionInGroup( CExpClass *active, CExpression *exp, CExpression *group );
int GetCellUnderPosition( int x, int y );
bool ComputeRect( int cell, int& rcx, int& rcy, int& rcw, int& rch );
int ComputePixelsNeeded( void );
void RepositionSlider();
void SetClickedCell( int cell );
void ShowRightClickMenu( int mx, int my );
void DrawThumbNail( CExpClass *active, CExpression *current, CChoreoWidgetDrawHelper& helper,
int rcx, int rcy, int rcw, int rch, int c, int selected, bool updateselection );
void DrawDirtyFlag( CChoreoWidgetDrawHelper& helper, CExpression *current, int rcx, int rcy, int rcw, int rch );
void DrawExpressionFocusRect( CChoreoWidgetDrawHelper& helper, int x, int y, int w, int h, COLORREF clr );
void DrawExpressionDescription( CChoreoWidgetDrawHelper& helper, int x, int y, int w, int h, const char *expressionname, const char *description );
void CreateButtons( void );
void DeleteAllButtons( void );
void AddButton( const char *name, const char *tooltip, const char *bitmap,
ETMEMBERFUNC pfnCallback, bool active, int x, int y, int w, int h );
mxETButton *GetItemUnderCursor( int x, int y );
void DrawButton( CChoreoWidgetDrawHelper& helper, int cell, mxETButton *btn );
void ActivateButton( const char *name, bool active );
mxETButton *FindButton( const char *name );
void ET_Undo( int cell );
void ET_Redo( int cell );
void DrawFocusRect( void );
private: // Data
mxETButton *m_pButtons;
mxScrollbar *slScrollbar;
int m_nTopOffset;
int m_nLastNumExpressions;
int m_nGranularity;
// For A/B
int m_nPrevCell;
int m_nCurCell;
// For context menu
int m_nClickedCell;
// Formatting
int m_nButtonSquare;
int m_nGap;
int m_nDescriptionHeight;
int m_nSnapshotWidth;
int m_nSnapshotHeight;
// For detecting that the slider thumbs need to be recomputed
int m_nPreviousExpressionCount;
bool m_bDragging;
RECT m_rcFocus;
RECT m_rcOrig;
int m_nDragCell;
int m_nXStart;
int m_nYStart;
mxButton *m_pABButton;
mxButton *m_pThumbnailIncreaseButton;
mxButton *m_pThumbnailDecreaseButton;
};
extern mxExpressionTray *g_pExpressionTrayTool;
#endif // MXEXPRESSIONTRAY_H
|