mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-28 06:08:40 +02:00
Fix spectral preferences extra caching issue.
This commit is contained in:
parent
de17e6bbc5
commit
a9d6be00a6
@ -4910,9 +4910,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
|
||||
//
|
||||
|
@ -109,6 +109,8 @@ bool SetTrackCommand::DefineParams( ShuttleParams & S ){
|
||||
S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, scales );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours );
|
||||
S.OptionalN( bHasVZoom ).DefineEnum( mVZoom, wxT("VZoom"), kReset, vzooms );
|
||||
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.
|
||||
@ -144,12 +146,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();
|
||||
}
|
||||
@ -197,6 +200,10 @@ 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 )
|
||||
@ -209,7 +216,6 @@ bool SetTrackCommand::Apply(const CommandContext & context)
|
||||
case kHalfWave: wt->SetDisplayBounds(0,1); break;
|
||||
}
|
||||
}
|
||||
|
||||
// These ones don't make sense on the second channel of a stereo track.
|
||||
if( !bIsSecondChannel ){
|
||||
if( bHasSelected )
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
int mDisplayType;
|
||||
int mScaleType;
|
||||
int mVZoom;
|
||||
bool bUseSpecPrefs;
|
||||
bool bSpectralSelect;
|
||||
bool bGrayScale;
|
||||
bool bSelected;
|
||||
@ -66,6 +67,7 @@ public:
|
||||
bool bHasDisplayType;
|
||||
bool bHasScaleType;
|
||||
bool bHasVZoom;
|
||||
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