22#include <wx/checkbox.h>
23#include <wx/textctrl.h>
29#include "../TrackPanel.h"
31#include "../tracks/playabletrack/wavetrack/ui/WaveTrackView.h"
39:
PrefsPanel(parent, winid, wt ?
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"),
252 XO(
"1024 - default"),
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") );
400 for (
auto channel : channels) {
419 const bool isOpenPage = this->IsShown();
420 if (
mWt && isOpenPage) {
422 for (
auto channel : channels)
440 const bool isOpenPage = this->IsShown();
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)
XXO("&Cut/Copy/Paste Toolbar")
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.
void GetBounds(const WaveTrack &wt, float &min, float &max) const
void SetBounds(float min, float max)
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 void Reset(WaveTrack &track)
Make track lose indpendent settings and use defaults.
static const EnumValueSymbols & GetScaleNames()
static SpectrogramSettings & Get(const WaveTrack &track)
Mutative access to attachment even if the track argument is const.
void ConvertToActualWindowSizes()
static const EnumValueSymbols & GetColorSchemeNames()
static SpectrogramSettings & Own(WaveTrack &track)
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.
void RestorePlacements(const WaveTrackSubViewPlacements &placements)
const WaveTrackSubViewPlacements & SavePlacements() const
static WaveTrackView & Get(WaveTrack &track)
PrefsPanel::Registration sAttachment