mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 06:40:08 +02:00
ChoiceSetting contains vectors; simplify constructions of it
This commit is contained in:
parent
e485afa156
commit
9b67e7538f
@ -397,39 +397,35 @@ inline float Dither::ShapedDither(float sample)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const EnumValueSymbol choicesDither[] = {
|
static const std::initializer_list<EnumValueSymbol> choicesDither{
|
||||||
{ XO("None") },
|
{ XO("None") },
|
||||||
{ XO("Rectangle") },
|
{ XO("Rectangle") },
|
||||||
{ XO("Triangle") },
|
{ XO("Triangle") },
|
||||||
{ XO("Shaped") },
|
{ XO("Shaped") },
|
||||||
};
|
};
|
||||||
static const size_t nChoicesDither = WXSIZEOF( choicesDither );
|
static const std::initializer_list<int> intChoicesDither{
|
||||||
static const int intChoicesDither[] = {
|
DitherType::none,
|
||||||
(int) DitherType::none,
|
DitherType::rectangle,
|
||||||
(int) DitherType::rectangle,
|
DitherType::triangle,
|
||||||
(int) DitherType::triangle,
|
DitherType::shaped,
|
||||||
(int) DitherType::shaped,
|
|
||||||
};
|
};
|
||||||
static_assert(
|
|
||||||
nChoicesDither == WXSIZEOF( intChoicesDither ),
|
|
||||||
"size mismatch"
|
|
||||||
);
|
|
||||||
|
|
||||||
static const size_t defaultFastDither = 0; // none
|
|
||||||
|
|
||||||
EnumSetting Dither::FastSetting{
|
EnumSetting Dither::FastSetting{
|
||||||
wxT("Quality/DitherAlgorithmChoice"),
|
wxT("Quality/DitherAlgorithmChoice"),
|
||||||
choicesDither, nChoicesDither, defaultFastDither,
|
choicesDither,
|
||||||
|
0, // none
|
||||||
|
|
||||||
|
// for migrating old preferences:
|
||||||
intChoicesDither,
|
intChoicesDither,
|
||||||
wxT("Quality/DitherAlgorithm")
|
wxT("Quality/DitherAlgorithm")
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t defaultBestDither = 3; // shaped
|
|
||||||
|
|
||||||
EnumSetting Dither::BestSetting{
|
EnumSetting Dither::BestSetting{
|
||||||
wxT("Quality/HQDitherAlgorithmChoice"),
|
wxT("Quality/HQDitherAlgorithmChoice"),
|
||||||
choicesDither, nChoicesDither, defaultBestDither,
|
choicesDither,
|
||||||
|
3, // shaped
|
||||||
|
|
||||||
|
// for migrating old preferences:
|
||||||
intChoicesDither,
|
intChoicesDither,
|
||||||
wxT("Quality/HQDitherAlgorithm")
|
wxT("Quality/HQDitherAlgorithm")
|
||||||
};
|
};
|
||||||
|
@ -253,16 +253,17 @@ wxString ChoiceSetting::Read() const
|
|||||||
// Remap to default if the string is not known -- this avoids surprises
|
// Remap to default if the string is not known -- this avoids surprises
|
||||||
// in case we try to interpret config files from future versions
|
// in case we try to interpret config files from future versions
|
||||||
auto index = Find( value );
|
auto index = Find( value );
|
||||||
if ( index >= mnSymbols )
|
if ( index >= mSymbols.size() )
|
||||||
value = defaultValue;
|
value = defaultValue;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ChoiceSetting::Find( const wxString &value ) const
|
size_t ChoiceSetting::Find( const wxString &value ) const
|
||||||
{
|
{
|
||||||
|
auto start = begin();
|
||||||
return size_t(
|
return size_t(
|
||||||
std::find( begin(), end(), EnumValueSymbol{ value, {} } )
|
std::find( start, end(), EnumValueSymbol{ value, {} } )
|
||||||
- mSymbols );
|
- start );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChoiceSetting::Migrate( wxString &value )
|
void ChoiceSetting::Migrate( wxString &value )
|
||||||
@ -273,7 +274,7 @@ void ChoiceSetting::Migrate( wxString &value )
|
|||||||
bool ChoiceSetting::Write( const wxString &value )
|
bool ChoiceSetting::Write( const wxString &value )
|
||||||
{
|
{
|
||||||
auto index = Find( value );
|
auto index = Find( value );
|
||||||
if (index >= mnSymbols)
|
if (index >= mSymbols.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto result = gPrefs->Write( mKey, value );
|
auto result = gPrefs->Write( mKey, value );
|
||||||
@ -281,24 +282,38 @@ bool ChoiceSetting::Write( const wxString &value )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnumSetting::EnumSetting(
|
||||||
|
const wxString &key,
|
||||||
|
EnumValueSymbols symbols,
|
||||||
|
size_t defaultSymbol,
|
||||||
|
|
||||||
|
std::vector<int> intValues, // must have same size as symbols
|
||||||
|
const wxString &oldKey
|
||||||
|
)
|
||||||
|
: ChoiceSetting{ key, std::move( symbols ), defaultSymbol }
|
||||||
|
, mIntValues{ std::move( intValues ) }
|
||||||
|
, mOldKey{ oldKey }
|
||||||
|
{
|
||||||
|
auto size = mSymbols.size();
|
||||||
|
if( mIntValues.size() != size ) {
|
||||||
|
wxASSERT( false );
|
||||||
|
mIntValues.resize( size );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int EnumSetting::ReadInt() const
|
int EnumSetting::ReadInt() const
|
||||||
{
|
{
|
||||||
if (!mIntValues)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
auto index = Find( Read() );
|
auto index = Find( Read() );
|
||||||
wxASSERT( index < mnSymbols );
|
wxASSERT( index < mIntValues.size() );
|
||||||
return mIntValues[ index ];
|
return mIntValues[ index ];
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t EnumSetting::FindInt( int code ) const
|
size_t EnumSetting::FindInt( int code ) const
|
||||||
{
|
{
|
||||||
if (!mIntValues)
|
const auto start = mIntValues.begin();
|
||||||
return mnSymbols;
|
|
||||||
|
|
||||||
return size_t(
|
return size_t(
|
||||||
std::find( mIntValues, mIntValues + mnSymbols, code )
|
std::find( start, mIntValues.end(), code )
|
||||||
- mIntValues );
|
- start );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnumSetting::Migrate( wxString &value )
|
void EnumSetting::Migrate( wxString &value )
|
||||||
@ -311,7 +326,7 @@ void EnumSetting::Migrate( wxString &value )
|
|||||||
// Audacity. But further changes will be stored only to the NEW key
|
// Audacity. But further changes will be stored only to the NEW key
|
||||||
// and won't be seen then.
|
// and won't be seen then.
|
||||||
auto index = FindInt( intValue );
|
auto index = FindInt( intValue );
|
||||||
if ( index >= mnSymbols )
|
if ( index >= mSymbols.size() )
|
||||||
index = mDefaultSymbol;
|
index = mDefaultSymbol;
|
||||||
value = mSymbols[index].Internal();
|
value = mSymbols[index].Internal();
|
||||||
Write(value);
|
Write(value);
|
||||||
@ -322,7 +337,7 @@ void EnumSetting::Migrate( wxString &value )
|
|||||||
bool EnumSetting::WriteInt( int code ) // you flush gPrefs afterward
|
bool EnumSetting::WriteInt( int code ) // you flush gPrefs afterward
|
||||||
{
|
{
|
||||||
auto index = FindInt( code );
|
auto index = FindInt( code );
|
||||||
if ( index >= mnSymbols )
|
if ( index >= mSymbols.size() )
|
||||||
return false;
|
return false;
|
||||||
return Write( mSymbols[index].Internal() );
|
return Write( mSymbols[index].Internal() );
|
||||||
}
|
}
|
||||||
|
32
src/Prefs.h
32
src/Prefs.h
@ -86,6 +86,8 @@ public:
|
|||||||
int mVersionMicroKeyInit{};
|
int mVersionMicroKeyInit{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using EnumValueSymbols = std::vector< EnumValueSymbol >;
|
||||||
|
|
||||||
/// Packages a table of user-visible choices each with an internal code string,
|
/// Packages a table of user-visible choices each with an internal code string,
|
||||||
/// a preference key path, and a default choice
|
/// a preference key path, and a default choice
|
||||||
class ChoiceSetting
|
class ChoiceSetting
|
||||||
@ -93,24 +95,23 @@ class ChoiceSetting
|
|||||||
public:
|
public:
|
||||||
ChoiceSetting(
|
ChoiceSetting(
|
||||||
const wxString &key,
|
const wxString &key,
|
||||||
const EnumValueSymbol symbols[], size_t nSymbols,
|
EnumValueSymbols symbols,
|
||||||
size_t defaultSymbol
|
size_t defaultSymbol
|
||||||
)
|
)
|
||||||
: mKey{ key }
|
: mKey{ key }
|
||||||
|
|
||||||
, mSymbols{ symbols }
|
, mSymbols{ std::move( symbols ) }
|
||||||
, mnSymbols{ nSymbols }
|
|
||||||
|
|
||||||
, mDefaultSymbol{ defaultSymbol }
|
, mDefaultSymbol{ defaultSymbol }
|
||||||
{
|
{
|
||||||
wxASSERT( defaultSymbol < nSymbols );
|
wxASSERT( defaultSymbol < mSymbols.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString &Key() const { return mKey; }
|
const wxString &Key() const { return mKey; }
|
||||||
const EnumValueSymbol &Default() const
|
const EnumValueSymbol &Default() const
|
||||||
{ return mSymbols[mDefaultSymbol]; }
|
{ return mSymbols[mDefaultSymbol]; }
|
||||||
const EnumValueSymbol *begin() const { return mSymbols; }
|
EnumValueSymbols::const_iterator begin() const { return mSymbols.begin(); }
|
||||||
const EnumValueSymbol *end() const { return mSymbols + mnSymbols; }
|
EnumValueSymbols::const_iterator end() const { return mSymbols.end(); }
|
||||||
|
|
||||||
wxString Read() const;
|
wxString Read() const;
|
||||||
bool Write( const wxString &value ); // you flush gPrefs afterward
|
bool Write( const wxString &value ); // you flush gPrefs afterward
|
||||||
@ -121,8 +122,7 @@ protected:
|
|||||||
|
|
||||||
const wxString mKey;
|
const wxString mKey;
|
||||||
|
|
||||||
const EnumValueSymbol *mSymbols;
|
const EnumValueSymbols mSymbols;
|
||||||
const size_t mnSymbols;
|
|
||||||
|
|
||||||
// stores an internal value
|
// stores an internal value
|
||||||
mutable bool mMigrated { false };
|
mutable bool mMigrated { false };
|
||||||
@ -139,18 +139,12 @@ class EnumSetting : public ChoiceSetting
|
|||||||
public:
|
public:
|
||||||
EnumSetting(
|
EnumSetting(
|
||||||
const wxString &key,
|
const wxString &key,
|
||||||
const EnumValueSymbol symbols[], size_t nSymbols,
|
EnumValueSymbols symbols,
|
||||||
size_t defaultSymbol,
|
size_t defaultSymbol,
|
||||||
|
|
||||||
const int intValues[] = nullptr, // must have same size as symbols
|
std::vector<int> intValues, // must have same size as symbols
|
||||||
const wxString &oldKey = wxString("")
|
const wxString &oldKey
|
||||||
)
|
);
|
||||||
: ChoiceSetting{ key, symbols, nSymbols, defaultSymbol }
|
|
||||||
, mIntValues{ intValues }
|
|
||||||
, mOldKey{ oldKey }
|
|
||||||
{
|
|
||||||
wxASSERT( mIntValues );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read and write the encoded values
|
// Read and write the encoded values
|
||||||
virtual int ReadInt() const;
|
virtual int ReadInt() const;
|
||||||
@ -161,7 +155,7 @@ protected:
|
|||||||
void Migrate( wxString& ) override;
|
void Migrate( wxString& ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int *mIntValues;
|
std::vector<int> mIntValues;
|
||||||
const wxString mOldKey;
|
const wxString mOldKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,53 +52,36 @@ Resample::~Resample()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
static const EnumValueSymbol methodNames[] = {
|
static const std::initializer_list<EnumValueSymbol> methodNames{
|
||||||
{ wxT("LowQuality"), XO("Low Quality (Fastest)") },
|
{ wxT("LowQuality"), XO("Low Quality (Fastest)") },
|
||||||
{ wxT("MediumQuality"), XO("Medium Quality") },
|
{ wxT("MediumQuality"), XO("Medium Quality") },
|
||||||
{ wxT("HighQuality"), XO("High Quality") },
|
{ wxT("HighQuality"), XO("High Quality") },
|
||||||
{ wxT("BestQuality"), XO("Best Quality (Slowest)") }
|
{ wxT("BestQuality"), XO("Best Quality (Slowest)") }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t numMethods = WXSIZEOF(methodNames);
|
static auto intChoicesMethod = {
|
||||||
|
|
||||||
static const wxString fastMethodKey =
|
|
||||||
wxT("/Quality/LibsoxrSampleRateConverterChoice");
|
|
||||||
|
|
||||||
static const wxString bestMethodKey =
|
|
||||||
wxT("/Quality/LibsoxrHQSampleRateConverterChoice");
|
|
||||||
|
|
||||||
static const wxString oldFastMethodKey =
|
|
||||||
wxT("/Quality/LibsoxrSampleRateConverter");
|
|
||||||
|
|
||||||
static const wxString oldBestMethodKey =
|
|
||||||
wxT("/Quality/LibsoxrHQSampleRateConverter");
|
|
||||||
|
|
||||||
static const size_t fastMethodDefault = 1; // Medium Quality
|
|
||||||
static const size_t bestMethodDefault = 3; // Best Quality
|
|
||||||
|
|
||||||
static const int intChoicesMethod[] = {
|
|
||||||
0, 1, 2, 3
|
0, 1, 2, 3
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert( WXSIZEOF(intChoicesMethod) == numMethods, "size mismatch" );
|
|
||||||
|
|
||||||
EnumSetting Resample::FastMethodSetting{
|
EnumSetting Resample::FastMethodSetting{
|
||||||
fastMethodKey,
|
wxT("/Quality/LibsoxrSampleRateConverterChoice"),
|
||||||
methodNames, numMethods,
|
methodNames,
|
||||||
fastMethodDefault,
|
1, // Medium Quality
|
||||||
|
|
||||||
|
// for migrating old preferences:
|
||||||
intChoicesMethod,
|
intChoicesMethod,
|
||||||
oldFastMethodKey
|
wxT("/Quality/LibsoxrSampleRateConverter")
|
||||||
};
|
};
|
||||||
|
|
||||||
EnumSetting Resample::BestMethodSetting
|
EnumSetting Resample::BestMethodSetting
|
||||||
{
|
{
|
||||||
bestMethodKey,
|
wxT("/Quality/LibsoxrHQSampleRateConverterChoice"),
|
||||||
methodNames, numMethods,
|
methodNames,
|
||||||
bestMethodDefault,
|
3, // Best Quality,
|
||||||
|
|
||||||
|
// for migrating old preferences:
|
||||||
intChoicesMethod,
|
intChoicesMethod,
|
||||||
oldBestMethodKey
|
wxT("/Quality/LibsoxrHQSampleRateConverter")
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
|
@ -32,26 +32,21 @@
|
|||||||
|
|
||||||
//////////
|
//////////
|
||||||
|
|
||||||
static const EnumValueSymbol choicesFormat[] = {
|
|
||||||
{ wxT("Format16Bit"), XO("16-bit") },
|
|
||||||
{ wxT("Format24Bit"), XO("24-bit") },
|
|
||||||
{ wxT("Format32BitFloat"), XO("32-bit float") }
|
|
||||||
};
|
|
||||||
static const size_t nChoicesFormat = WXSIZEOF( choicesFormat );
|
|
||||||
static const int intChoicesFormat[] = {
|
|
||||||
int16Sample,
|
|
||||||
int24Sample,
|
|
||||||
floatSample
|
|
||||||
};
|
|
||||||
static_assert( nChoicesFormat == WXSIZEOF(intChoicesFormat), "size mismatch" );
|
|
||||||
|
|
||||||
static const size_t defaultChoiceFormat = 2; // floatSample
|
|
||||||
|
|
||||||
static EnumSetting formatSetting{
|
static EnumSetting formatSetting{
|
||||||
wxT("/SamplingRate/DefaultProjectSampleFormatChoice"),
|
wxT("/SamplingRate/DefaultProjectSampleFormatChoice"),
|
||||||
choicesFormat, nChoicesFormat, defaultChoiceFormat,
|
{
|
||||||
|
{ wxT("Format16Bit"), XO("16-bit") },
|
||||||
intChoicesFormat,
|
{ wxT("Format24Bit"), XO("24-bit") },
|
||||||
|
{ wxT("Format32BitFloat"), XO("32-bit float") }
|
||||||
|
},
|
||||||
|
2, // floatSample
|
||||||
|
|
||||||
|
// for migrating old preferences:
|
||||||
|
{
|
||||||
|
int16Sample,
|
||||||
|
int24Sample,
|
||||||
|
floatSample
|
||||||
|
},
|
||||||
wxT("/SamplingRate/DefaultProjectSampleFormat"),
|
wxT("/SamplingRate/DefaultProjectSampleFormat"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,33 +54,20 @@ namespace {
|
|||||||
|
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
static const EnumValueSymbol choicesView[] = {
|
class TracksViewModeEnumSetting : public EnumSetting {
|
||||||
{ XO("Waveform") },
|
|
||||||
{ wxT("WaveformDB"), XO("Waveform (dB)") },
|
|
||||||
{ XO("Spectrogram") }
|
|
||||||
};
|
|
||||||
static const int intChoicesView[] = {
|
|
||||||
(int)(WaveTrackViewConstants::Waveform),
|
|
||||||
(int)(WaveTrackViewConstants::obsoleteWaveformDBDisplay),
|
|
||||||
(int)(WaveTrackViewConstants::Spectrum)
|
|
||||||
};
|
|
||||||
static const size_t nChoicesView = WXSIZEOF(choicesView);
|
|
||||||
static_assert( nChoicesView == WXSIZEOF(intChoicesView), "size mismatch" );
|
|
||||||
|
|
||||||
static const size_t defaultChoiceView = 0;
|
|
||||||
|
|
||||||
class TracksViewModeSetting : public EnumSetting {
|
|
||||||
public:
|
public:
|
||||||
TracksViewModeSetting(
|
TracksViewModeEnumSetting(
|
||||||
const wxString &key,
|
const wxString &key,
|
||||||
const EnumValueSymbol symbols[], size_t nSymbols,
|
EnumValueSymbols symbols,
|
||||||
size_t defaultSymbol,
|
size_t defaultSymbol,
|
||||||
|
|
||||||
const int intValues[],
|
std::vector<int> intValues,
|
||||||
const wxString &oldKey
|
const wxString &oldKey
|
||||||
)
|
)
|
||||||
: EnumSetting{
|
: EnumSetting{
|
||||||
key, symbols, nSymbols, defaultSymbol, intValues, oldKey }
|
key, std::move( symbols ), defaultSymbol,
|
||||||
|
std::move( intValues ), oldKey
|
||||||
|
}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Migrate( wxString &value ) override
|
void Migrate( wxString &value ) override
|
||||||
@ -106,18 +93,28 @@ public:
|
|||||||
// Now future-proof 2.1.1 against a recurrence of this sort of bug!
|
// Now future-proof 2.1.1 against a recurrence of this sort of bug!
|
||||||
viewMode = WaveTrackViewConstants::ValidateWaveTrackDisplay(viewMode);
|
viewMode = WaveTrackViewConstants::ValidateWaveTrackDisplay(viewMode);
|
||||||
|
|
||||||
const_cast<TracksViewModeSetting*>(this)->WriteInt( viewMode );
|
const_cast<TracksViewModeEnumSetting*>(this)->WriteInt( viewMode );
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
|
|
||||||
value = mSymbols[ FindInt(viewMode) ].Internal();
|
value = mSymbols[ FindInt(viewMode) ].Internal();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static TracksViewModeSetting viewModeSetting{
|
static TracksViewModeEnumSetting viewModeSetting{
|
||||||
wxT("/GUI/DefaultViewModeChoice"),
|
wxT("/GUI/DefaultViewModeChoice"),
|
||||||
choicesView, nChoicesView, defaultChoiceView,
|
{
|
||||||
|
{ XO("Waveform") },
|
||||||
|
{ wxT("WaveformDB"), XO("Waveform (dB)") },
|
||||||
|
{ XO("Spectrogram") }
|
||||||
|
},
|
||||||
|
0, // Waveform
|
||||||
|
|
||||||
intChoicesView,
|
// for migrating old preferences:
|
||||||
|
{
|
||||||
|
WaveTrackViewConstants::Waveform,
|
||||||
|
WaveTrackViewConstants::obsoleteWaveformDBDisplay,
|
||||||
|
WaveTrackViewConstants::Spectrum
|
||||||
|
},
|
||||||
wxT("/GUI/DefaultViewModeNew")
|
wxT("/GUI/DefaultViewModeNew")
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -127,25 +124,19 @@ WaveTrackViewConstants::Display TracksPrefs::ViewModeChoice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
static const EnumValueSymbol choicesSampleDisplay[] = {
|
|
||||||
{ wxT("ConnectDots"), XO("Connect dots") },
|
|
||||||
{ wxT("StemPlot"), XO("Stem plot") }
|
|
||||||
};
|
|
||||||
static const size_t nChoicesSampleDisplay = WXSIZEOF( choicesSampleDisplay );
|
|
||||||
static const int intChoicesSampleDisplay[] = {
|
|
||||||
(int) WaveTrackViewConstants::LinearInterpolate,
|
|
||||||
(int) WaveTrackViewConstants::StemPlot
|
|
||||||
};
|
|
||||||
static_assert(
|
|
||||||
nChoicesSampleDisplay == WXSIZEOF(intChoicesSampleDisplay), "size mismatch" );
|
|
||||||
|
|
||||||
static const size_t defaultChoiceSampleDisplay = 1;
|
|
||||||
|
|
||||||
static EnumSetting sampleDisplaySetting{
|
static EnumSetting sampleDisplaySetting{
|
||||||
wxT("/GUI/SampleViewChoice"),
|
wxT("/GUI/SampleViewChoice"),
|
||||||
choicesSampleDisplay, nChoicesSampleDisplay, defaultChoiceSampleDisplay,
|
{
|
||||||
|
{ wxT("ConnectDots"), XO("Connect dots") },
|
||||||
|
{ wxT("StemPlot"), XO("Stem plot") }
|
||||||
|
},
|
||||||
|
1, // StemPlot
|
||||||
|
|
||||||
intChoicesSampleDisplay,
|
// for migrating old preferences:
|
||||||
|
{
|
||||||
|
WaveTrackViewConstants::LinearInterpolate,
|
||||||
|
WaveTrackViewConstants::StemPlot
|
||||||
|
},
|
||||||
wxT("/GUI/SampleView")
|
wxT("/GUI/SampleView")
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -155,7 +146,7 @@ WaveTrackViewConstants::SampleDisplay TracksPrefs::SampleViewChoice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
static const EnumValueSymbol choicesZoom[] = {
|
static const std::initializer_list<EnumValueSymbol> choicesZoom{
|
||||||
{ wxT("FitToWidth"), XO("Fit to Width") },
|
{ wxT("FitToWidth"), XO("Fit to Width") },
|
||||||
{ wxT("ZoomToSelection"), XO("Zoom to Selection") },
|
{ wxT("ZoomToSelection"), XO("Zoom to Selection") },
|
||||||
{ wxT("ZoomDefault"), XO("Zoom Default") },
|
{ wxT("ZoomDefault"), XO("Zoom Default") },
|
||||||
@ -172,8 +163,7 @@ static const EnumValueSymbol choicesZoom[] = {
|
|||||||
{ wxT("FourPixelsPerSample"), XO("4 Pixels per Sample") },
|
{ wxT("FourPixelsPerSample"), XO("4 Pixels per Sample") },
|
||||||
{ wxT("MaxZoom"), XO("Max Zoom") },
|
{ wxT("MaxZoom"), XO("Max Zoom") },
|
||||||
};
|
};
|
||||||
static const size_t nChoicesZoom = WXSIZEOF( choicesZoom );
|
static const std::initializer_list<int> intChoicesZoom{
|
||||||
static const int intChoicesZoom[] = {
|
|
||||||
WaveTrackViewConstants::kZoomToFit,
|
WaveTrackViewConstants::kZoomToFit,
|
||||||
WaveTrackViewConstants::kZoomToSelection,
|
WaveTrackViewConstants::kZoomToSelection,
|
||||||
WaveTrackViewConstants::kZoomDefault,
|
WaveTrackViewConstants::kZoomDefault,
|
||||||
@ -190,24 +180,23 @@ static const int intChoicesZoom[] = {
|
|||||||
WaveTrackViewConstants::kZoom4To1,
|
WaveTrackViewConstants::kZoom4To1,
|
||||||
WaveTrackViewConstants::kMaxZoom,
|
WaveTrackViewConstants::kMaxZoom,
|
||||||
};
|
};
|
||||||
static_assert( nChoicesZoom == WXSIZEOF(intChoicesZoom), "size mismatch" );
|
|
||||||
|
|
||||||
static const size_t defaultChoiceZoom1 = 2; // kZoomDefault
|
|
||||||
|
|
||||||
static EnumSetting zoom1Setting{
|
static EnumSetting zoom1Setting{
|
||||||
wxT("/GUI/ZoomPreset1Choice"),
|
wxT("/GUI/ZoomPreset1Choice"),
|
||||||
choicesZoom, nChoicesZoom, defaultChoiceZoom1,
|
choicesZoom,
|
||||||
|
2, // kZoomDefault
|
||||||
|
|
||||||
|
// for migrating old preferences:
|
||||||
intChoicesZoom,
|
intChoicesZoom,
|
||||||
wxT("/GUI/ZoomPreset1")
|
wxT("/GUI/ZoomPreset1")
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t defaultChoiceZoom2 = 13; // kZoom4To1
|
|
||||||
|
|
||||||
static EnumSetting zoom2Setting{
|
static EnumSetting zoom2Setting{
|
||||||
wxT("/GUI/ZoomPreset2Choice"),
|
wxT("/GUI/ZoomPreset2Choice"),
|
||||||
choicesZoom, nChoicesZoom, defaultChoiceZoom2,
|
choicesZoom,
|
||||||
|
13, // kZoom4To1
|
||||||
|
|
||||||
|
// for migrating old preferences:
|
||||||
intChoicesZoom,
|
intChoicesZoom,
|
||||||
wxT("/GUI/ZoomPreset2")
|
wxT("/GUI/ZoomPreset2")
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user