23#include <wx/checkbox.h>
24#include <wx/textctrl.h>
28#include "../ShuttleGui.h"
30#include "../TrackPanel.h"
31#include "../WaveTrack.h"
32#include "../tracks/playabletrack/wavetrack/ui/WaveTrackView.h"
36#include "../widgets/AudacityMessageBox.h"
40:
PrefsPanel(parent, winid, wt ?
XO(
"Spectrogram Settings") :
XO(
"Spectrograms"))
77 return XO(
"Preferences for Spectrum");
88 ?
"Spectrogram_Settings"
89 :
"Spectrograms_Preferences";
134 wxChoice *
const pPaddingSizeControl =
135 static_cast<wxChoice*
>(wxWindow::FindWindowById(
ID_PADDING_SIZE,
this));
137 if (pPaddingSizeControl) {
139 pPaddingSizeControl->Clear();
142 unsigned padding = 1;
145 while (windowSize <= maxWindowSize) {
146 const auto numeral = wxString::Format(wxT(
"%d"), padding);
148 if (pPaddingSizeControl)
149 pPaddingSizeControl->Append(numeral);
157 if (pPaddingSizeControl)
177 S.StartMultiColumn(2,wxEXPAND);
179 S.SetStretchyCol( 0 );
180 S.SetStretchyCol( 1 );
181 S.StartStatic(
XO(
"Scale"),1);
183 S.StartMultiColumn(2,wxEXPAND);
185 S.SetStretchyCol( 0 );
186 S.SetStretchyCol( 1 );
203 S.StartStatic(
XO(
"Colors"),1);
205 S.StartMultiColumn(2,wxEXPAND);
207 S.SetStretchyCol( 0 );
208 S.SetStretchyCol( 1 );
210 S.Id(
ID_GAIN).TieNumericTextBox(
XXO(
"&Gain (dB):"),
234 S.StartStatic(
XO(
"Algorithm"));
236 S.StartMultiColumn(2);
246 XO(
"8 - most wideband"),
253 XO(
"1024 - default"),
258 XO(
"32768 - most narrowband"),
275#ifndef SPECTRAL_SELECTION_GLOBAL_SWITCH
280#ifdef EXPERIMENTAL_FFT_Y_GRID
281 S.TieCheckBox(
XO(
"Show a grid along the &Y-axis"),
285#ifdef EXPERIMENTAL_FIND_NOTES
287 S.StartStatic(
XO(
"FFT Find Notes"));
292 S.TieNumericTextBox(
XXO(
"Minimum Amplitude (dB):"),
297 S.TieNumericTextBox(
XXO(
"Max. Number of Notes (1..128):"),
303 S.TieCheckBox(
XXO(
"&Find Notes"),
306 S.TieCheckBox(
XXO(
"&Quantize Notes"),
313#ifdef SPECTRAL_SELECTION_GLOBAL_SWITCH
314 S.StartStatic(
XO(
"Global settings"));
316 S.TieCheckBox(
XXO(
"Ena&ble spectral selection"),
338 if (!
mMaxFreq->GetValue().ToLong(&maxFreq)) {
344 if (!
mMinFreq->GetValue().ToLong(&minFreq)) {
350 if (!
mGain->GetValue().ToLong(&gain)) {
356 if (!
mRange->GetValue().ToLong(&range)) {
367#ifdef EXPERIMENTAL_FIND_NOTES
369 if (!mFindNotesMinA->GetValue().ToLong(&findNotesMinA)) {
375 if (!mFindNotesN->GetValue().ToLong(&findNotesN)) {
379 if (findNotesN < 1 || findNotesN > 128) {
381"The maximum number of notes must be in the range 1..128") );
401 for (
auto channel : channels) {
403 channel->SetSpectrogramSettings({});
404 channel->SetSpectrumBounds(-1, -1);
408 channel->GetIndependentSpectrogramSettings();
420 const bool isOpenPage = this->IsShown();
421 if (
mWt && isOpenPage) {
423 for (
auto channel : channels)
441 const bool isOpenPage = this->IsShown();
452 channel->SetSpectrogramSettings({});
454 channel->SetSpectrumBounds(-1, -1);
458 channel->GetIndependentSpectrogramSettings();
529 wxChoice *
const pWindowSizeControl =
530 static_cast<wxChoice*
>(wxWindow::FindWindowById(
ID_WINDOW_SIZE,
this));
531 size_t windowSize = 1 <<
589 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)
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
PrefsPanel::Factory SpectrumPrefsFactory(WaveTrack *wt)
#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.
Spectrogram settings, either for one track or as defaults.
static SpectrogramSettings & defaults()
static const TranslatableStrings & GetAlgorithmNames()
bool Validate(bool quiet)
static const EnumValueSymbols & GetScaleNames()
void ConvertToActualWindowSizes()
static const EnumValueSymbols & GetColorSchemeNames()
void ConvertToEnumeratedWindowSizes()
size_t WindowSize() const
A PrefsPanel for spectrum settings.
std::vector< WaveTrackSubViewPlacement > mOrigPlacements
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)
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
SpectrumPrefs(wxWindow *parent, wxWindowID winid, AudacityProject *pProject, WaveTrack *wt)
SpectrogramSettings mOrigSettings
SpectrogramSettings mTempSettings
wxChoice * mZeroPaddingChoiceCtrl
bool ShowsPreviewButton() override
TranslatableString GetDescription() const override
wxChoice * mAlgorithmChoice
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
static TrackPanel & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
A Track that contains audio waveform data.
const SpectrogramSettings & GetSpectrogramSettings() const
void GetSpectrumBounds(float *min, float *max) const
void RestorePlacements(const WaveTrackSubViewPlacements &placements)
const WaveTrackSubViewPlacements & SavePlacements() const
static WaveTrackView & Get(WaveTrack &track)
PrefsPanel::Registration sAttachment