22#include <wx/checkbox.h>
23#include <wx/textctrl.h>
29#include "../TrackPanel.h"
31#include "../tracks/playabletrack/wavetrack/ui/WaveChannelView.h"
39:
PrefsPanel(parent, winid, wc ?
XO(
"Spectrogram Settings") :
XO(
"Spectrograms"))
76 return XO(
"Preferences for Spectrum");
87 ?
"Spectrogram_Settings"
88 :
"Spectrograms_Preferences";
133 wxChoice *
const pPaddingSizeControl =
134 static_cast<wxChoice*
>(wxWindow::FindWindowById(
ID_PADDING_SIZE,
this));
136 if (pPaddingSizeControl) {
138 pPaddingSizeControl->Clear();
141 unsigned padding = 1;
144 while (windowSize <= maxWindowSize) {
145 const auto numeral = wxString::Format(
wxT(
"%d"), padding);
147 if (pPaddingSizeControl)
148 pPaddingSizeControl->Append(numeral);
156 if (pPaddingSizeControl)
176 S.StartMultiColumn(2,wxEXPAND);
178 S.SetStretchyCol( 0 );
179 S.SetStretchyCol( 1 );
180 S.StartStatic(
XO(
"Scale"),1);
182 S.StartMultiColumn(2,wxEXPAND);
184 S.SetStretchyCol( 0 );
185 S.SetStretchyCol( 1 );
202 S.StartStatic(
XO(
"Colors"),1);
204 S.StartMultiColumn(2,wxEXPAND);
206 S.SetStretchyCol( 0 );
207 S.SetStretchyCol( 1 );
209 S.Id(
ID_GAIN).TieNumericTextBox(
XXO(
"&Gain (dB):"),
233 S.StartStatic(
XO(
"Algorithm"));
235 S.StartMultiColumn(2);
245 XO(
"8 - most wideband"),
257 XO(
"32768 - most narrowband"),
274#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
279#ifdef EXPERIMENTAL_FFT_Y_GRID
280 S.TieCheckBox(
XO(
"Show a grid along the &Y-axis"),
284#ifdef EXPERIMENTAL_FIND_NOTES
286 S.StartStatic(
XO(
"FFT Find Notes"));
291 S.TieNumericTextBox(
XXO(
"Minimum Amplitude (dB):"),
296 S.TieNumericTextBox(
XXO(
"Max. Number of Notes (1..128):"),
302 S.TieCheckBox(
XXO(
"&Find Notes"),
305 S.TieCheckBox(
XXO(
"&Quantize Notes"),
312#ifdef SPECTRAL_SELECTION_GLOBAL_SWITCH
313 S.StartStatic(
XO(
"Global settings"));
315 S.TieCheckBox(
XXO(
"Ena&ble spectral selection"),
337 if (!
mMaxFreq->GetValue().ToLong(&maxFreq)) {
343 if (!
mMinFreq->GetValue().ToLong(&minFreq)) {
349 if (!
mGain->GetValue().ToLong(&gain)) {
355 if (!
mRange->GetValue().ToLong(&range)) {
366#ifdef EXPERIMENTAL_FIND_NOTES
368 if (!mFindNotesMinA->GetValue().ToLong(&findNotesMinA)) {
374 if (!mFindNotesN->GetValue().ToLong(&findNotesN)) {
378 if (findNotesN < 1 || findNotesN > 128) {
380"The maximum number of notes must be in the range 1..128") );
414 const bool isOpenPage = this->IsShown();
415 if (
mWc && isOpenPage) {
433 const bool isOpenPage = this->IsShown();
519 wxChoice *
const pWindowSizeControl =
520 static_cast<wxChoice*
>(wxWindow::FindWindowById(
ID_WINDOW_SIZE,
this));
521 size_t windowSize = 1 <<
578 return [=](wxWindow *parent, wxWindowID winid,
AudacityProject *pProject)
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
const TranslatableString WindowFuncName(int whichFunction)
XXO("&Cut/Copy/Paste Toolbar")
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
PrefsPanel::Factory SpectrumPrefsFactory(WaveChannel *wc)
#define SPECTRUM_PREFS_PLUGIN_SYMBOL
static Settings & settings()
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
void SetBounds(float min, float max)
void GetBounds(const WaveChannel &wc, float &min, float &max) const
static SpectrogramBounds & Get(WaveTrack &track)
Get either the global default settings, or the track's own if previously created.
Spectrogram settings, either for one track or as defaults.
static SpectrogramSettings & defaults()
static const TranslatableStrings & GetAlgorithmNames()
bool Validate(bool quiet)
static const EnumValueSymbols & GetScaleNames()
static SpectrogramSettings & Get(const WaveTrack &track)
void ConvertToActualWindowSizes()
static const EnumValueSymbols & GetColorSchemeNames()
static SpectrogramSettings & Own(WaveChannel &wc)
static void Reset(WaveChannel &channel)
Make channel lose indpendent settings and use defaults.
void ConvertToEnumeratedWindowSizes()
size_t WindowSize() const
A PrefsPanel for spectrum settings.
ComponentInterfaceSymbol GetSymbol() const override
AudacityProject * mProject
TranslatableStrings mZeroPaddingChoices
void Populate(size_t windowSize)
void OnWindowSize(wxCommandEvent &event)
void OnDefaults(wxCommandEvent &)
void OnAlgorithm(wxCommandEvent &)
wxCheckBox * mDefaultsCheckbox
void PopulatePaddingChoices(size_t windowSize)
std::vector< WaveChannelSubViewPlacement > mOrigPlacements
void EnableDisableSTFTOnlyControls()
void PopulateOrExchange(ShuttleGui &S) override
void OnControl(wxCommandEvent &event)
TranslatableStrings mTypeChoices
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
wxTextCtrl * mFrequencyGain
SpectrogramSettings mOrigSettings
SpectrogramSettings mTempSettings
wxChoice * mZeroPaddingChoiceCtrl
SpectrumPrefs(wxWindow *parent, wxWindowID winid, AudacityProject *pProject, WaveChannel *wc)
bool ShowsPreviewButton() override
TranslatableString GetDescription() const override
wxChoice * mAlgorithmChoice
static TrackPanel & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
const WaveChannelSubViewPlacements & SavePlacements() const
static WaveChannelView & Get(WaveChannel &channel)
void RestorePlacements(const WaveChannelSubViewPlacements &placements)
PrefsPanel::Registration sAttachment