Audacity  2.2.2
ExportMultiple.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ExportMultiple.h
6 
7  Dominic Mazzoni
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_EXPORT_MULTIPLE__
12 #define __AUDACITY_EXPORT_MULTIPLE__
13 
14 #include <wx/dialog.h>
15 #include <wx/string.h>
16 #include <wx/listctrl.h>
17 #include <wx/simplebook.h>
18 
19 #include "Export.h"
20 #include "../Tags.h" // we need to know about the Tags class for metadata
21 #include "../wxFileNameWrapper.h"
22 
23 class wxButton;
24 class wxCheckBox;
25 class wxChoice;
26 class wxRadioButton;
27 class wxTextCtrl;
28 
29 class AudacityProject;
30 class LabelTrack;
31 class SelectionState;
32 class ShuttleGui;
33 class Track;
34 
35 class ExportMultiple final : public wxDialogWrapper
36 {
37 public:
38 
40  virtual ~ExportMultiple();
41 
42  int ShowModal();
43 
44 private:
45 
46  // Export
47  void CanExport();
48  void CountTracksAndLabels();
49  bool DirOk();
58  ProgressResult ExportMultipleByLabel(bool byName, const wxString &prefix, bool addNumber);
59 
66  ProgressResult ExportMultipleByTrack(bool byName, const wxString &prefix, bool addNumber);
67 
78  ProgressResult DoExport(std::unique_ptr<ProgressDialog> &pDialog,
79  unsigned channels,
80  const wxFileName &name,
81  bool selectedOnly,
82  double t0,
83  double t1,
84  const Tags &tags);
88  wxString MakeFileName(const wxString &input);
89  // Dialog
91  void EnableControls();
92 
93  void OnFormat(wxCommandEvent& event);
94  void OnOptions(wxCommandEvent& event);
95  void OnCreate(wxCommandEvent& event);
96  void OnChoose(wxCommandEvent& event);
97  void OnLabel(wxCommandEvent& event);
98  void OnFirst(wxCommandEvent& event);
99  void OnFirstFileName(wxCommandEvent& event);
100  void OnTrack(wxCommandEvent& event);
101  void OnByName(wxCommandEvent& event);
102  void OnByNumber(wxCommandEvent& event);
103  void OnPrefix(wxCommandEvent& event);
104  void OnCancel(wxCommandEvent& event);
105  void OnExport(wxCommandEvent& event);
106 
107 private:
109  std::vector<ExportPlugin*> mPlugins;
117 
127 
128  // List of file actually exported
129  wxArrayString mExported;
130 
131  wxChoice *mFormat;
133  wxButton *mOptions;
134 
135  wxTextCtrl *mDir;
137  wxButton *mCreate;
138  wxButton *mChoose;
139 
140  wxRadioButton *mLabel;
141  wxStaticText *mLabelLabel;
143  wxCheckBox *mFirst;
144  wxStaticText *mFirstFileLabel;
145  wxTextCtrl *mFirstFileName;
148  wxRadioButton *mTrack;
149  wxStaticText *mTrackLabel;
150 
151  wxRadioButton *mByNumberAndName;
152  wxRadioButton *mByName;
153  wxRadioButton *mByNumber;
155  wxStaticText *mPrefixLabel;
156  wxTextCtrl *mPrefix;
157 
158  wxCheckBox *mOverwrite;
159 
160  wxButton *mCancel;
161  wxButton *mExport;
162 
163  wxSimplebook *mBook;
164 
166 
167  DECLARE_EVENT_TABLE()
168 
169 };
170 
171 class SuccessDialog final : public wxDialogWrapper
172 {
173 public:
174  SuccessDialog(wxWindow *parent, wxWindowID id, const wxString &title) :
175  wxDialogWrapper(parent, id, title, wxDefaultPosition,
176  wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {};
177  void OnKeyDown(wxListEvent& event); // dismisses dialog when <enter> is pressed with list control having focus
178  void OnItemActivated(wxListEvent& event); // dismisses dialog when <enter> is pressed with list item having focus
179 private:
180  DECLARE_EVENT_TABLE()
181 };
182 
183 class MouseEvtHandler final : public wxEvtHandler
184 {
185 public:
186  void OnMouse(wxMouseEvent& event);
187 private:
188  DECLARE_EVENT_TABLE()
189 };
190 
191 
197  class ExportKit
198  {
199  public:
202  double t0;
203  double t1;
204  unsigned channels;
205  }; // end of ExportKit declaration
206  /* we are going to want an set of these kits, and don't know how many until
207  * runtime. I would dearly like to use a std::vector, but it seems that
208  * this isn't done anywhere else in Audacity, presumably for a reason?, so
209  * I'm stuck with wxArrays, which are much harder, as well as non-standard.
210  */
211 
212 
213 #endif
void OnByNumber(wxCommandEvent &event)
wxRadioButton * mByNumberAndName
TrackList * mTracks
LabelTrack * mLabels
A list of TrackListNode items.
Definition: Track.h:619
ProgressResult
wxRadioButton * mTrack
SelectionState & mSelectionState
void OnFormat(wxCommandEvent &event)
SuccessDialog(wxWindow *parent, wxWindowID id, const wxString &title)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
wxRadioButton * mLabel
wxTextCtrl * mPrefix
void OnKeyDown(wxListEvent &event)
void OnOptions(wxCommandEvent &event)
wxButton * mChoose
wxTextCtrl * mDir
AudacityProject * mProject
wxString MakeFileName(const wxString &input)
Takes an arbitrary text string and converts it to a form that can be used as a file name...
wxSimplebook * mBook
Exporter mExporter
void OnByName(wxCommandEvent &event)
wxButton * mOptions
wxButton * mExport
void OnMouse(wxMouseEvent &event)
void OnCreate(wxCommandEvent &event)
void OnPrefix(wxCommandEvent &event)
void CountTracksAndLabels()
wxButton * mCreate
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
wxRadioButton * mByName
wxButton * mCancel
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
wxStaticText * mPrefixLabel
wxTextCtrl * mFirstFileName
void OnLabel(wxCommandEvent &event)
ProgressResult ExportMultipleByTrack(bool byName, const wxString &prefix, bool addNumber)
Export each track in the project to a separate file.
virtual ~ExportMultiple()
wxRadioButton * mByNumber
void OnCancel(wxCommandEvent &event)
wxArrayString mExported
wxStaticText * mTrackLabel
wxCheckBox * mFirst
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:102
void PopulateOrExchange(ShuttleGui &S)
void OnItemActivated(wxListEvent &event)
wxFileNameWrapper destfile
wxChoice * mFormat
void OnChoose(wxCommandEvent &event)
ID3 Tags (for MP3)
Definition: Tags.h:70
std::vector< ExportPlugin * > mPlugins
A private class used to store the information needed to do an export.
void OnFirst(wxCommandEvent &event)
const wxChar * name
Definition: Distortion.cpp:94
Presents a dialog box allowing the user to export multiple files either by exporting each track as a ...
wxStaticText * mFirstFileLabel
void OnExport(wxCommandEvent &event)
ProgressResult DoExport(std::unique_ptr< ProgressDialog > &pDialog, unsigned channels, const wxFileName &name, bool selectedOnly, double t0, double t1, const Tags &tags)
ExportMultiple(AudacityProject *parent)
unsigned channels
void OnTrack(wxCommandEvent &event)
void OnFirstFileName(wxCommandEvent &event)
wxStaticText * mLabelLabel
wxCheckBox * mOverwrite
ProgressResult ExportMultipleByLabel(bool byName, const wxString &prefix, bool addNumber)
Export multiple labeled regions of the project to separate files.