33 S.StartStatic(
XO(
"Exported Allegro (.gro) files save time as:"));
44 S.EndRadioButtonGroup();
79 const auto numNoteTracksSelected = range.
size();
81 if(numNoteTracksSelected > 1) {
83 XO(
"Please select only one Note Track at a time.") );
86 else if(numNoteTracksSelected < 1) {
88 XO(
"Please select a Note Track.") );
92 wxASSERT(numNoteTracksSelected);
93 if (!numNoteTracksSelected)
96 const auto nt = *range.begin();
102 fName =
SelectFile(FileNames::Operation::Export,
103 XO(
"Export MIDI As:"),
108 {
XO(
"MIDI file"), {
wxT(
"mid") },
true },
109 {
XO(
"Allegro file"), {
wxT(
"gro") },
true },
111 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
117 if(!fName.Contains(
wxT(
"."))) {
118 fName = fName +
wxT(
".mid");
124 if (wxFileExists(fName)) {
126 wxString safetyFileName = fName +
wxT(
"~");
128 wxString safetyFileName = fName +
wxT(
".bak");
131 if (wxFileExists(safetyFileName))
132 wxRemoveFile(safetyFileName);
134 wxRename(fName, safetyFileName);
137 if(fName.EndsWith(
wxT(
".mid")) || fName.EndsWith(
wxT(
".midi"))) {
138 nt->ExportMIDI(fName);
139 }
else if(fName.EndsWith(
wxT(
".gro"))) {
140 nt->ExportAllegro(fName);
143"You have selected a filename with an unrecognized file extension.\nDo you want to continue?");
144 auto title =
XO(
"Export MIDI");
148 }
else if (
id == wxYES) {
149 nt->ExportMIDI(fName);
159 {
wxT(
"File/Import-Export/ExportOther"),
160 { OrderingHint::After, {
"ExportLabels"} } }
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
const ReservedCommandFlag & AudioIONotBusyFlag()
XXO("&Cut/Copy/Paste Toolbar")
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
accessors for certain important windows associated with each project
FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
size_t size() const
How many attachment pointers are in the Site.
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
AudacityProject & project
A Track that is used for Midi notes. (Somewhat old code).
static EnumSetting< bool > AllegroStyleSetting
Generates classes whose instances register items at construction.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
auto Any() -> TrackIterRange< TrackType >
static TrackList & Get(AudacityProject &project)
ImportExportPrefs::RegisteredControls reg
void OnExportMIDI(const CommandContext &context)
const ReservedCommandFlag & NoteTracksExistFlag()
void AddControls(ShuttleGui &S)