33 S.StartStatic(
XO(
"Exported Allegro (.gro) files save time as:"));
46 S.EndRadioButtonGroup();
83 const auto numNoteTracksSelected = range.
size();
85 if(numNoteTracksSelected > 1) {
87 XO(
"Please select only one Note Track at a time.") );
90 else if(numNoteTracksSelected < 1) {
92 XO(
"Please select a Note Track.") );
96 wxASSERT(numNoteTracksSelected);
97 if (!numNoteTracksSelected)
100 const auto nt = *range.begin();
106 fName =
SelectFile(FileNames::Operation::Export,
107 XO(
"Export MIDI As:"),
112 {
XO(
"MIDI file"), {
wxT(
"mid") },
true },
113 {
XO(
"Allegro file"), {
wxT(
"gro") },
true },
115 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
121 if(!fName.Contains(
wxT(
"."))) {
122 fName = fName +
wxT(
".mid");
128 if (wxFileExists(fName)) {
130 wxString safetyFileName = fName +
wxT(
"~");
132 wxString safetyFileName = fName +
wxT(
".bak");
135 if (wxFileExists(safetyFileName))
136 wxRemoveFile(safetyFileName);
138 wxRename(fName, safetyFileName);
141 if(fName.EndsWith(
wxT(
".mid")) || fName.EndsWith(
wxT(
".midi"))) {
142 nt->ExportMIDI(fName);
143 }
else if(fName.EndsWith(
wxT(
".gro"))) {
144 nt->ExportAllegro(fName);
147"You have selected a filename with an unrecognized file extension.\nDo you want to continue?");
148 auto title =
XO(
"Export MIDI");
152 }
else if (
id == wxYES) {
153 nt->ExportMIDI(fName);
163 {
wxT(
"File/Import-Export/ExportOther"),
164 { 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)