/********************************************************************** Audacity: A Digital Audio Editor SpectrumPrefs.cpp Dominic Mazzoni James Crook *******************************************************************//** \class SpectrumPrefs \brief A PrefsPanel for spectrum settings. *//*******************************************************************/ #include "../Audacity.h" #include #include #include #include "../Prefs.h" #include "../ShuttleGui.h" #include "SpectrumPrefs.h" #include "../FFT.h" enum { ID_MINFREQUENCY = 8000, ID_MAXFREQUENCY }; SpectrumPrefs::SpectrumPrefs(wxWindow * parent): PrefsPanel(parent) { SetLabel(_("Spectrograms")); // Provide visual label SetName(_("Spectrograms")); // Provide audible label Populate( ); } void SpectrumPrefs::Populate( ) { int minFreq; int maxFreq; // First any pre-processing for constructing the GUI. // Unusual handling of maxFreqStr because it is a validated input. gPrefs->Read(wxT("/Spectrum/MaxFreq"), &maxFreq, 8000L); gPrefs->Read(wxT("/Spectrum/MinFreq"), &minFreq, 0L); gPrefs->Read(wxT("/Spectrum/WindowType"), &windowType, 3L); minFreqStr.Printf(wxT("%d"), minFreq); maxFreqStr.Printf(wxT("%d"), maxFreq); //------------------------- Main section -------------------- // Now construct the GUI itself. // Use 'eIsCreatingFromPrefs' so that the GUI is // initialised with values from gPrefs. ShuttleGui S(this, eIsCreatingFromPrefs); PopulateOrExchange(S); // ----------------------- End of main section -------------- } void SpectrumPrefs::PopulateOrExchange( ShuttleGui & S ) { wxArrayString windowTypeList; for(int i=0; i 100000) { wxMessageBox(_("Maximum frequency must be in the range 100 Hz - 100,000 Hz")); return false; } //---- End of validation of maxFreqStr. //---- Validation of minFreqStr long minFreq; if (!minFreqStr.ToLong(&minFreq)) { wxMessageBox(_("The minimum frequency must be an integer")); return false; } if (minFreq < 0) { wxMessageBox(_("Minimum frequency must be at least 0 Hz")); return false; } //---- End of validation of maxFreqStr. gPrefs->Write(wxT("/Spectrum/MinFreq"), minFreq); gPrefs->Write(wxT("/Spectrum/MaxFreq"), maxFreq); gPrefs->Write(wxT("/Spectrum/WindowType"), windowType); // TODO: Force all projects to repaint themselves return true; } SpectrumPrefs::~SpectrumPrefs() { } // 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: 54d8e954-f415-40e9-afa4-9d53ab37770d