mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 08:29:27 +02:00
Bug2480 fix follow-ups
This commit is contained in:
commit
57b39ed099
@ -704,22 +704,13 @@ void WaveTrack::UseSpectralPrefs( bool bUse )
|
||||
|
||||
const WaveformSettings &WaveTrack::GetWaveformSettings() const
|
||||
{
|
||||
if (mpWaveformSettings)
|
||||
return *mpWaveformSettings;
|
||||
else
|
||||
return WaveformSettings::defaults();
|
||||
// Create on demand
|
||||
return const_cast<WaveTrack*>(this)->GetWaveformSettings();
|
||||
}
|
||||
|
||||
WaveformSettings &WaveTrack::GetWaveformSettings()
|
||||
{
|
||||
if (mpWaveformSettings)
|
||||
return *mpWaveformSettings;
|
||||
else
|
||||
return WaveformSettings::defaults();
|
||||
}
|
||||
|
||||
WaveformSettings &WaveTrack::GetIndependentWaveformSettings()
|
||||
{
|
||||
// Create on demand
|
||||
if (!mpWaveformSettings)
|
||||
mpWaveformSettings = std::make_unique<WaveformSettings>(WaveformSettings::defaults());
|
||||
return *mpWaveformSettings;
|
||||
|
@ -156,7 +156,6 @@ private:
|
||||
|
||||
const WaveformSettings &GetWaveformSettings() const;
|
||||
WaveformSettings &GetWaveformSettings();
|
||||
WaveformSettings &GetIndependentWaveformSettings();
|
||||
void SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings);
|
||||
void UseSpectralPrefs( bool bUse=true );
|
||||
//
|
||||
|
@ -387,7 +387,7 @@ bool SetTrackVisualsCommand::ApplyInner(const CommandContext & context, Track *
|
||||
}
|
||||
}
|
||||
if( wt && bHasScaleType )
|
||||
wt->GetIndependentWaveformSettings().scaleType =
|
||||
wt->GetWaveformSettings().scaleType =
|
||||
(mScaleType==kLinear) ?
|
||||
WaveformSettings::stLinear
|
||||
: WaveformSettings::stLogarithmic;
|
||||
|
@ -171,7 +171,7 @@ bool WaveformPrefs::Commit()
|
||||
channel->SetWaveformSettings({});
|
||||
else {
|
||||
WaveformSettings &settings =
|
||||
channel->GetIndependentWaveformSettings();
|
||||
channel->GetWaveformSettings();
|
||||
settings = mTempSettings;
|
||||
}
|
||||
}
|
||||
|
@ -86,15 +86,9 @@ bool WaveformSettings::Validate(bool /* quiet */)
|
||||
|
||||
void WaveformSettings::LoadPrefs()
|
||||
{
|
||||
bool newPrefFound;
|
||||
scaleType = TracksPrefs::WaveformScaleChoice();
|
||||
|
||||
newPrefFound = gPrefs->Read(wxT("/Waveform/ScaleType"), &scaleType);
|
||||
if (!newPrefFound)
|
||||
scaleType = TracksPrefs::WaveformScaleChoice();
|
||||
|
||||
newPrefFound = gPrefs->Read(wxT("/Waveform/dBRange"), &dBRange);
|
||||
if (!newPrefFound)
|
||||
dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
|
||||
dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
|
||||
|
||||
// Enforce legal values
|
||||
Validate(true);
|
||||
@ -104,8 +98,6 @@ void WaveformSettings::LoadPrefs()
|
||||
|
||||
void WaveformSettings::SavePrefs()
|
||||
{
|
||||
gPrefs->Write(wxT("/Waveform/ScaleType"), long(scaleType));
|
||||
gPrefs->Write(wxT("/Waveform/dBRange"), long(dBRange));
|
||||
}
|
||||
|
||||
void WaveformSettings::Update()
|
||||
|
@ -766,7 +766,6 @@ void WaveTrackMenuTable::OnSetDisplay(wxCommandEvent & event)
|
||||
!(displays.size() == 1 && displays[0].id == id);
|
||||
if (wrongType) {
|
||||
for (auto channel : TrackList::Channels(pTrack)) {
|
||||
channel->SetLastScaleType();
|
||||
WaveTrackView::Get( *channel )
|
||||
.SetDisplay( WaveTrackView::Display{ id } );
|
||||
}
|
||||
|
@ -1280,14 +1280,6 @@ void WaveTrackView::BuildSubViews() const
|
||||
pThis->SetMultiView( true );
|
||||
display = WaveTrackSubViewType::Default();
|
||||
}
|
||||
|
||||
// Force creation always:
|
||||
WaveformSettings &settings = static_cast< WaveTrack* >( pTrack.get() )
|
||||
->GetIndependentWaveformSettings();
|
||||
|
||||
// Set the default scale type to linear or log, even if we are showing
|
||||
// spectrogram
|
||||
settings.scaleType = TracksPrefs::WaveformScaleChoice();
|
||||
|
||||
pThis->DoSetDisplay( display, !multi );
|
||||
}
|
||||
|
@ -84,11 +84,11 @@ unsigned WaveformVRulerControls::DoHandleWheelRotation(
|
||||
return RefreshNone;
|
||||
|
||||
WaveformSettings &settings =
|
||||
wt->GetIndependentWaveformSettings();
|
||||
wt->GetWaveformSettings();
|
||||
float olddBRange = settings.dBRange;
|
||||
for (auto channel : TrackList::Channels(wt)) {
|
||||
WaveformSettings &channelSettings =
|
||||
channel->GetIndependentWaveformSettings();
|
||||
channel->GetWaveformSettings();
|
||||
if (steps < 0)
|
||||
// Zoom out
|
||||
channelSettings.NextLowerDBRange();
|
||||
|
@ -329,7 +329,7 @@ void WaveformVRulerMenuTable::OnWaveformScaleType(wxCommandEvent &evt)
|
||||
|
||||
if (wt->GetWaveformSettings().scaleType != newScaleType) {
|
||||
for (auto channel : TrackList::Channels(wt)) {
|
||||
channel->GetIndependentWaveformSettings().scaleType = newScaleType;
|
||||
channel->GetWaveformSettings().scaleType = newScaleType;
|
||||
}
|
||||
|
||||
AudacityProject *const project = &mpData->project;
|
||||
|
Loading…
x
Reference in New Issue
Block a user