mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 16:19:43 +02:00
Fix spectral preferences extra caching issue.
This commit is contained in:
parent
6a5a61d39a
commit
4724c6a131
@ -4895,9 +4895,15 @@ void AudacityProject::OnPreferences(const CommandContext &WXUNUSED(context) )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "./prefs/SpectrogramSettings.h"
|
||||
#include "./prefs/WaveformSettings.h"
|
||||
void AudacityProject::OnReloadPreferences(const CommandContext &WXUNUSED(context) )
|
||||
{
|
||||
{
|
||||
SpectrogramSettings::defaults().LoadPrefs();
|
||||
WaveformSettings::defaults().LoadPrefs();
|
||||
|
||||
GlobalPrefsDialog dialog(this /* parent */ );
|
||||
wxCommandEvent Evt;
|
||||
//dialog.Show();
|
||||
|
@ -739,6 +739,23 @@ void WaveTrack::SetSpectrogramSettings(std::unique_ptr<SpectrogramSettings> &&pS
|
||||
}
|
||||
}
|
||||
|
||||
void WaveTrack::UseSpectralPrefs( bool bUse )
|
||||
{
|
||||
if( bUse ){
|
||||
if( !mpSpectrumSettings )
|
||||
return;
|
||||
// reset it, and next we will be getting the defaults.
|
||||
mpSpectrumSettings.reset();
|
||||
}
|
||||
else {
|
||||
if( mpSpectrumSettings )
|
||||
return;
|
||||
GetIndependentSpectrogramSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const WaveformSettings &WaveTrack::GetWaveformSettings() const
|
||||
{
|
||||
if (mpWaveformSettings)
|
||||
|
@ -155,7 +155,7 @@ private:
|
||||
WaveformSettings &GetWaveformSettings();
|
||||
WaveformSettings &GetIndependentWaveformSettings();
|
||||
void SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings);
|
||||
|
||||
void UseSpectralPrefs( bool bUse=true );
|
||||
//
|
||||
// High-level editing
|
||||
//
|
||||
|
@ -91,6 +91,8 @@ bool SetTrackCommand::DefineParams( ShuttleParams & S ){
|
||||
S.OptionalN( bHasDisplayType ).DefineEnum( mDisplayType, wxT("Display"), kWaveform, displays );
|
||||
S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, scales );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours );
|
||||
S.OptionalN( bHasUseSpecPrefs ).Define( bUseSpecPrefs, wxT("SpecPrefs"), false );
|
||||
|
||||
S.OptionalN( bHasSpectralSelect ).Define( bSpectralSelect, wxT("SpectralSel"),true );
|
||||
S.OptionalN( bHasGrayScale ).Define( bGrayScale, wxT("GrayScale"), false );
|
||||
// There is also a select command. This is an alternative.
|
||||
@ -124,12 +126,13 @@ void SetTrackCommand::PopulateOrExchange(ShuttleGui & S)
|
||||
S.EndMultiColumn();
|
||||
S.StartMultiColumn(2, wxALIGN_CENTER);
|
||||
{
|
||||
S.Optional( bHasSpectralSelect ).TieCheckBox( _("Spectral Select:"), bSpectralSelect );
|
||||
S.Optional( bHasGrayScale ).TieCheckBox( _("Gray Scale:"), bGrayScale );
|
||||
S.Optional( bHasSelected ).TieCheckBox( _("Selected:"), bSelected );
|
||||
S.Optional( bHasFocused ).TieCheckBox( _("Focused:"), bFocused);
|
||||
S.Optional( bHasSolo ).TieCheckBox( _("Solo:"), bSolo);
|
||||
S.Optional( bHasMute ).TieCheckBox( _("Mute:"), bMute);
|
||||
S.Optional( bHasUseSpecPrefs ).TieCheckBox( _("Use Spectral Prefs:"), bUseSpecPrefs );
|
||||
S.Optional( bHasSpectralSelect ).TieCheckBox( _("Spectral Select:"), bSpectralSelect);
|
||||
S.Optional( bHasGrayScale ).TieCheckBox( _("Gray Scale:"), bGrayScale );
|
||||
S.Optional( bHasSelected ).TieCheckBox( _("Selected:"), bSelected );
|
||||
S.Optional( bHasFocused ).TieCheckBox( _("Focused:"), bFocused);
|
||||
S.Optional( bHasSolo ).TieCheckBox( _("Solo:"), bSolo);
|
||||
S.Optional( bHasMute ).TieCheckBox( _("Mute:"), bMute);
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
}
|
||||
@ -177,11 +180,14 @@ bool SetTrackCommand::Apply(const CommandContext & context)
|
||||
(mScaleType==kLinear) ?
|
||||
WaveformSettings::stLinear
|
||||
: WaveformSettings::stLogarithmic;
|
||||
|
||||
if( wt && bHasUseSpecPrefs ){
|
||||
wt->UseSpectralPrefs( bUseSpecPrefs );
|
||||
}
|
||||
if( wt && bHasSpectralSelect )
|
||||
wt->GetSpectrogramSettings().spectralSelection = bSpectralSelect;
|
||||
if( wt && bHasGrayScale )
|
||||
wt->GetSpectrogramSettings().isGrayscale = bGrayScale;
|
||||
|
||||
// These ones don't make sense on the second channel of a stereo track.
|
||||
if( !bIsSecondChannel ){
|
||||
if( bHasSelected )
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
int mHeight;
|
||||
int mDisplayType;
|
||||
int mScaleType;
|
||||
bool bUseSpecPrefs;
|
||||
bool bSpectralSelect;
|
||||
bool bGrayScale;
|
||||
bool bSelected;
|
||||
@ -64,6 +65,7 @@ public:
|
||||
bool bHasHeight;
|
||||
bool bHasDisplayType;
|
||||
bool bHasScaleType;
|
||||
bool bHasUseSpecPrefs;
|
||||
bool bHasSpectralSelect;
|
||||
bool bHasGrayScale;
|
||||
bool bHasSelected;
|
||||
|
@ -517,6 +517,7 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
||||
}
|
||||
|
||||
WaveformSettings::defaults().LoadPrefs();
|
||||
SpectrogramSettings::defaults().LoadPrefs();
|
||||
|
||||
if( IsModal() )
|
||||
EndModal(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user