35#define PIANO_EVENT_TIMER 73566
36#define DEFERRED_KEY_CLICK_DOWN 1
37#define DEFERRED_KEY_CLICK_UP 2
38#define INFOWIN_TIMEOUT 3
41WX_DECLARE_OBJARRAY(wxRect, RectArray);
49class Piano :
public wxEvtHandler {
54 void Paint(
int y, wxDC &dc, wxDC *shapeDC = NULL);
55 void Paint(
int y,
ocpnDC &dc, wxDC *shapeDC = NULL);
57 void FormatKeys(
void);
58 bool MouseEvent(wxMouseEvent &event);
59 void SetColorScheme(ColorScheme cs);
60 void SetKeyArray(std::vector<int> piano_chart_index_array);
61 void SetActiveKey(
int iactive) { m_iactive = iactive; }
62 void SetActiveKeyArray(std::vector<int> array);
63 void SetNoshowIndexArray(std::vector<int> array);
64 void AddNoshowIndexArray(std::vector<int> array);
65 void SetEclipsedIndexArray(std::vector<int> array);
66 void SetSkewIndexArray(std::vector<int> array);
67 void SetTmercIndexArray(std::vector<int> array);
68 void SetPolyIndexArray(std::vector<int> array);
70 std::vector<int> GetActiveKeyArray() {
return m_active_index_array; }
72 void SetVizIcon(wxBitmap *picon_bmp) {
73 if (m_pVizIconBmp)
delete m_pVizIconBmp;
74 m_pVizIconBmp = picon_bmp;
76 void SetInVizIcon(wxBitmap *picon_bmp) {
77 if (m_pInVizIconBmp)
delete m_pInVizIconBmp;
78 m_pInVizIconBmp = picon_bmp;
80 void SetSkewIcon(wxBitmap *picon_bmp) {
81 if (m_pSkewIconBmp)
delete m_pSkewIconBmp;
82 m_pSkewIconBmp = picon_bmp;
84 void SetTMercIcon(wxBitmap *picon_bmp) {
85 if (m_pTmercIconBmp)
delete m_pTmercIconBmp;
86 m_pTmercIconBmp = picon_bmp;
88 void SetPolyIcon(wxBitmap *picon_bmp) {
89 if (m_pPolyIconBmp)
delete m_pPolyIconBmp;
90 m_pPolyIconBmp = picon_bmp;
92 void ShowBusy(
bool busy);
93 void onTimerEvent(wxTimerEvent &event);
95 wxPoint GetKeyOrigin(
int key_index);
96 void ResetRollover(
void);
97 void SetRoundedRectangles(
bool val) {
105 wxString &GenerateAndStoreNewHash();
106 wxString &GetStoredHash();
108 int GetnKeys() {
return m_nRegions; }
111 void BuildGLTexture();
112 bool InArray(std::vector<int> &array,
int key);
114 wxString GetStateHash();
121 int m_hover_icon_last;
126 wxBrush m_srBrush, m_rBrush;
127 wxBrush m_svBrush, m_vBrush;
128 wxBrush m_unavailableBrush;
129 wxBrush m_utileBrush, m_tileBrush;
134 std::vector<int> m_key_array;
135 std::vector<int> m_noshow_index_array;
136 std::vector<int> m_active_index_array;
137 std::vector<int> m_eclipsed_index_array;
138 std::vector<int> m_skew_index_array;
139 std::vector<int> m_tmerc_index_array;
140 std::vector<int> m_poly_index_array;
142 wxTimer m_eventTimer;
143 int m_click_sel_index;
144 int m_click_sel_dbindex;
148 std::vector<wxRect> KeyRect;
150 wxBitmap *m_pVizIconBmp;
151 wxBitmap *m_pInVizIconBmp;
152 wxBitmap *m_pTmercIconBmp;
153 wxBitmap *m_pSkewIconBmp;
154 wxBitmap *m_pPolyIconBmp;
160 GLuint m_tex, m_texw, m_texh, m_tex_piano_height;
161 int m_ref, m_pad, m_radius, m_texPitch;
165 DECLARE_EVENT_TABLE()
175 void OnSize(wxSizeEvent &event);
176 void OnPaint(wxPaintEvent &event);
177 void MouseEvent(wxMouseEvent &event);
182 DECLARE_EVENT_TABLE()