File: Project.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 (195 lines) | stat: -rw-r--r-- 4,193 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
/**********************************************************************

  Audacity: A Digital Audio Editor

  Project.h

  Dominic Mazzoni

  In Audacity, the main window you work in is called a project.
  Projects can contain an arbitrary number of tracks of many
  different types, but if a project contains just one or two
  tracks then it can be saved in standard formats like WAV or AIFF.
  This window is the one that contains the menu bar (except on
  the Mac).

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

#ifndef __AUDACITY_PROJECT__
#define __AUDACITY_PROJECT__

#include <wx/frame.h>
#include <wx/window.h>
#include <wx/scrolbar.h>

#include "AStatus.h"
#include "DirManager.h"
#include "TrackPanel.h"
#include "UndoManager.h"

class wxBoxSizer;
class wxDragImage;

class TrackList;
class APalette;
class Tags;

class AudacityProject;

AudacityProject *CreateNewAudacityProject(wxWindow * parentFrame);
AudacityProject *GetActiveProject();
void RedrawAllProjects();

WX_DEFINE_ARRAY(AudacityProject *, AProjectArray);

extern AProjectArray gAudacityProjects;

class AudacityProject:public wxFrame,
    public TrackPanelListener, public AStatusListener {
 public:

   // Constructor and Destructor

   AudacityProject(wxWindow * parent, wxWindowID id,
                   const wxPoint & pos, const wxSize & size);

    virtual ~ AudacityProject();

   // Accessors

   double GetRate();
   TrackList *GetTracks();
   double GetSel0();
   double GetSel1();
   APalette *GetAPalette();
   wxString GetName();
   DirManager *GetDirManager();
   Tags *GetTags();

   // File I/O

   void OpenFile(wxString fileName);
   void Import(wxString fileName);
   void Save(bool overwrite = true, bool fromSaveAs = false);
   void SaveAs();
   void Clear();

   // Methods associated with menu items are in Menus.h

#define AUDACITY_MENUS_METHODS
#include "Menus.h"
#undef AUDACITY_MENUS_METHODS

   // Message Handlers

   virtual bool ProcessEvent(wxEvent & event);

   void OnActivate(wxActivateEvent & event);
   void OnPaint(wxPaintEvent & event);
   void OnMouseEvent(wxMouseEvent & event);
   void OnSize(wxSizeEvent & event);
   void OnScroll(wxScrollEvent & event);
   void OnCloseWindow(wxCloseEvent & event);
   void OnDropFiles(wxDropFilesEvent & event);

   void HandleResize();

   // Other commands

   void RedrawProject();
   void SelectNone();

   // Scrollbars

   void OnScrollLeft();
   void OnScrollRight();
   void FinishAutoScroll();
   void FixScrollbars();

   // TrackPanel callback methods

   virtual void TP_DisplayStatusMessage(const char *msg, int fieldNum);
   virtual int TP_GetCurrentTool();
   virtual void TP_OnPlayKey();
   virtual void TP_PushState();
   virtual void TP_RedrawScrollbars();
   virtual void TP_ScrollLeft();
   virtual void TP_ScrollRight();
   virtual void TP_HasMouse();

   // APalette

   void ShowPalette();
   void HidePalette();

   // AStatus callback methods

   virtual void AS_SetRate(double rate);

 private:

   // Private Methods

   void ClearClipboard();
   void InitialState();
   void PushState(bool makeDirty = true);
   void PopState(TrackList * l);

   // The project's name and file info

   wxString mName;
   wxString mFileName;
   DirManager mDirManager;
   double mRate;
   
   // Tags (artist name, song properties, MP3 ID3 info, etc.)
   
   Tags *mTags;

   // List of tracks and display info

   TrackList *mTracks;
   ViewInfo mViewInfo;

   TrackList *mLastSavedTracks;

   // Clipboard (static because it is shared by all projects)

   static TrackList *msClipboard;
   static AudacityProject *msClipProject;
   static double msClipLen;

   // History/Undo manager

   UndoManager mUndoManager;
   bool mDirty;

   // Menus

   wxMenuBar *mMenuBar;
   wxMenu *mFileMenu;
   wxMenu *mEditMenu;
   wxMenu *mViewMenu;
   wxMenu *mProjectMenu;
   wxMenu *mTrackMenu;
   wxMenu *mEffectMenu;
   wxMenu *mHelpMenu;

   // Window elements

   APalette *mAPalette;
   AStatus *mStatus;
   wxPoint mPaletteHotspot;
   wxDragImage *mDrag;
   TrackPanel *mTrackPanel;
   wxScrollBar *mHsbar;
   wxScrollBar *mVsbar;

   bool mAutoScrolling;

 public:

    DECLARE_EVENT_TABLE()
};

#endif