File: TrackPanel.h

package info (click to toggle)
audacity 0.98-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,896 kB
  • ctags: 4,089
  • sloc: cpp: 26,099; ansic: 4,961; sh: 2,465; makefile: 156; perl: 23
file content (209 lines) | stat: -rw-r--r-- 4,639 bytes parent folder | download
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/**********************************************************************

  Audacity: A Digital Audio Editor

  TrackPanel.h

  Dominic Mazzoni

**********************************************************************/

#ifndef __AUDACITY_TRACK_PANEL__
#define __AUDACITY_TRACK_PANEL__

#include <wx/timer.h>
#include <wx/window.h>

#include "ViewInfo.h"

class wxMenu;
class wxRect;
class wxStatusBar;

class TrackList;
class VTrack;
class TrackPanel;
class TrackArtist;

class AudacityTimer:public wxTimer {
 public:
   virtual void Notify();
   TrackPanel *parent;
};

class TrackPanelListener {
 public:
   virtual void TP_DisplayStatusMessage(const char *msg, int fieldNum) = 0;
   virtual int TP_GetCurrentTool() = 0;
   virtual void TP_OnPlayKey() = 0;
   virtual void TP_PushState() = 0;
   virtual void TP_RedrawScrollbars() = 0;
   virtual void TP_ScrollLeft() = 0;
   virtual void TP_ScrollRight() = 0;
   virtual void TP_HasMouse() = 0;
};

class TrackPanel:public wxWindow {
 public:

   TrackPanel(wxWindow * parent,
              wxWindowID id,
              const wxPoint & pos,
              const wxSize & size,
              TrackList * tracks,
              ViewInfo * viewInfo, TrackPanelListener * listener);

   virtual ~ TrackPanel();

   void OnPaint(wxPaintEvent & event);
   void OnMouseEvent(wxMouseEvent & event);
   void OnKeyEvent(wxKeyEvent & event);

   void OnTimer();

   int GetRulerHeight();
   int GetLeftOffset();

   void GetTracksUsableArea(int *width, int *height);

   void SelectNone();

 private:

   void HandleCursor(wxMouseEvent & event);
   void HandleResize(wxMouseEvent & event);
   void HandleSelect(wxMouseEvent & event);
   void HandleEnvelope(wxMouseEvent & event);
   void HandleSlide(wxMouseEvent & event);
   void HandleZoom(wxMouseEvent & event);
   void HandleLabelClick(wxMouseEvent & event);
   void HandleClosing(wxMouseEvent & event);
   void HandleMuting(wxMouseEvent & event);
   void HandleSoloing(wxMouseEvent & event);

   void MakeParentRedrawScrollbars();
   void MakeParentPushState();

   void OnSetName();

   void OnMoveUp();
   void OnMoveDown();

   void OnUpOctave();
   void OnDownOctave();

   void OnChannelLeft();
   void OnChannelRight();
   void OnChannelMono();

   void OnWaveform();
   void OnWaveformDB();
   void OnSpectrum();
   void OnPitch();

   void OnRate8();
   void OnRate11();
   void OnRate16();
   void OnRate22();
   void OnRate44();
   void OnRate48();
   void OnRateOther();

   void OnSplitStereo();
   void OnMergeStereo();

   void RemoveTrack(VTrack * toRemove);

   // Find track info by coordinate
   VTrack *FindTrack(int mouseX, int mouseY, bool label,
                     wxRect * trackRect = NULL, int *trackNum = NULL);

   int GetTitleWidth();
   int GetTitleOffset();
   int GetVRulerWidth();
   int GetVRulerOffset();
   int GetLabelWidth();

   void SetLabelFont(wxDC * dc);

   void DrawRuler(wxDC * dc, bool text = true);
   void DrawTracks(wxDC * dc);

   void GetTrackControlsRect(wxRect & trackRect, wxRect & r);
   void GetCloseBoxRect(wxRect & trackRect, wxRect & r);
   void GetTitleBarRect(wxRect & trackRect, wxRect & r);
   void GetMuteRect(wxRect & trackRect, wxRect & r);
   void GetSoloRect(wxRect & trackRect, wxRect & r);

   void DrawCloseBox(wxDC * dc, wxRect & r, bool down);
   void DrawTitleBar(wxDC * dc, wxRect & r, VTrack * t, bool down);
   void DrawMute(wxDC * dc, wxRect & r, VTrack * t, bool down);
   void DrawSolo(wxDC * dc, wxRect & r, VTrack * t, bool down);

   void DrawVRuler(wxDC * dc, wxRect & r, VTrack * t);

   TrackPanelListener *mListener;

   TrackList *mTracks;
   ViewInfo *mViewInfo;
   wxStatusBar *mStatusBar;

   TrackArtist *mTrackArtist;

   AudacityTimer mTimer;
   int mTimeCount;

   wxBitmap *mBitmap;
   int mPrevWidth;
   int mPrevHeight;

   double mSelStart;

   VTrack *mCapturedTrack;
   wxRect mCapturedRect;
   int mCapturedNum;

   bool mIndicatorShowing;

   int mMouseClickX;
   int mMouseClickY;

   int mMouseMostRecentX;
   int mMouseMostRecentY;

   int mZoomStart;
   int mZoomEnd;

   int mInitialTrackHeight;

   bool mAutoScrolling;

   bool mIsClosing;
   bool mIsSelecting;
   bool mIsResizing;
   bool mIsSliding;
   bool mIsEnveloping;
   bool mIsZooming;
   bool mIsMuting;
   bool mIsSoloing;

   wxCursor *mArrowCursor;
   wxCursor *mSelectCursor;
   wxCursor *mResizeCursor;
   wxCursor *mSlideCursor;
   wxCursor *mZoomInCursor;
   wxCursor *mZoomOutCursor;

   wxMenu *mWaveTrackMenu;
   wxMenu *mNoteTrackMenu;
   wxMenu *mLabelTrackMenu;
   wxMenu *mRateMenu;

   VTrack *mPopupMenuTarget;

 public:

   DECLARE_EVENT_TABLE()
};

#endif