From 2beae4edb534955f8bf90f678f22de93753265cf Mon Sep 17 00:00:00 2001 From: "v.audacity" Date: Fri, 27 Aug 2010 22:56:01 +0000 Subject: [PATCH] Check for type of slider control, and instead of defaulting to int on a bad specification, put up a warning and do not create the slider. --- src/effects/nyquist/Nyquist.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index f2eb05161..37aa5c5ba 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -93,7 +93,7 @@ EffectNyquist::EffectNyquist(wxString fName) return; } - wxLogNull dontLog; + // wxLogNull dontLog; // Vaughan, 2010-08-27: Why turn off logging? Logging is good! mName = wxFileName(fName).GetName(); mFileName = wxFileName(fName); @@ -279,11 +279,24 @@ void EffectNyquist::Parse(wxString line) return; } - if (tokens[3] == wxT("real")) { + if ((tokens[3] == wxT("real")) || + (tokens[3] == wxT("float"))) // undocumented, but useful, alternative ctrl.type = NYQ_CTRL_REAL; - } - else { + else if (tokens[3] == wxT("int")) ctrl.type = NYQ_CTRL_INT; + else + { + wxString str; + str.Printf(_("Bad Nyquist 'control' type specification: '%s' in plugin file '%s'.\nControl not created."), + tokens[3], mFileName.GetFullPath()); + + // Too disturbing to show alert before Audacity frame is up. + // wxMessageBox(str, wxT("Nyquist Warning"), wxOK | wxICON_EXCLAMATION); + + // Note that the AudacityApp's mLogger has not yet been created, + // so this brings up an alert box, but after the Audacity frame is up. + wxLogWarning(str); + return; } ctrl.lowStr = tokens[6]; @@ -1316,15 +1329,3 @@ void NyquistOutputDialog::OnOk(wxCommandEvent & /* event */) EndModal(wxID_OK); } - -// Indentation settings for Vim and Emacs and unique identifier for Arch, a -// version control system. Please do not modify past this point. -// -// Local Variables: -// c-basic-offset: 3 -// indent-tabs-mode: nil -// End: -// -// vim: et sts=3 sw=3 -// arch-tag: a6e418bb-2609-42f2-a8ae-8e50373855f3 -