From d8d292edc746ae41126456d6987d84e41dfb0396 Mon Sep 17 00:00:00 2001 From: Steve Daulton Date: Tue, 14 Apr 2015 13:50:51 +0100 Subject: [PATCH] Add time and date property list. --- src/effects/nyquist/Nyquist.cpp | 25 +++++++++++++++++++++++++ src/import/Import.cpp | 7 +++++++ 2 files changed, 32 insertions(+) diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 94be9e4ec..64f59b60e 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -49,6 +49,7 @@ effects from this one class. #include #include #include +#include #if defined EXPERIMENTAL_NYQUIST_TIME_PROPERTY #include @@ -540,6 +541,30 @@ bool EffectNyquist::Process() #endif + // Date and time: + wxDateTime now = wxDateTime::Now(); + int year = now.GetYear(); + int doy = now.GetDayOfYear(); + int dom = now.GetDay(); + // enumerated constants + wxDateTime::Month month = now.GetMonth(); + wxDateTime::WeekDay day = now.GetWeekDay(); + + // Date/time as a list: year, day of year, hour, minute, seconds + mProps += wxString::Format(wxT("(setf *SYSTEM-TIME* (list %d %d %d %d %d))\n"), + year, doy, now.GetHour(), now.GetMinute(), now.GetSecond()); + + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'DATE)\n"), now.FormatDate().c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'TIME)\n"), now.FormatTime().c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'ISO-DATE)\n"), now.FormatISODate().c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'ISO-TIME)\n"), now.FormatISOTime().c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* %d 'YEAR)\n"), year); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* %d 'DAY)\n"), dom); // day of month + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* %d 'MONTH)\n"), month); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'MONTH-NAME)\n"), now.GetMonthName(month).c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'DAY-NAME)\n"), now.GetWeekDayName(day).c_str()); + + TrackListIterator all(project->GetTracks()); Track *t; int numTracks = 0; diff --git a/src/import/Import.cpp b/src/import/Import.cpp index 60a767be5..9ab903b0e 100644 --- a/src/import/Import.cpp +++ b/src/import/Import.cpp @@ -701,6 +701,13 @@ int Importer::Import(wxString fName, return 0; } + // Audacity project + if (extension.IsSameAs(wxT("aup"), false)) { + errorMessage.Printf(_("\"%s\" is an Audacity Project file. \nUse the 'File > Open' command to open Audacity Projects."), fName.c_str()); + pProj->mbBusyImporting = false; + return 0; + } + // we were not able to recognize the file type errorMessage.Printf(_("Audacity did not recognize the type of the file '%s'.\nIf it is uncompressed, try importing it using \"Import Raw\"."),fName.c_str()); }