mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-18 01:27:41 +02:00
TracksPrefs does not use hardcoded list of all view types...
... It does have some duplication of string values, but only for purposes of upgrading old config files.
This commit is contained in:
parent
d2ccde77e7
commit
a69fba9990
@ -467,6 +467,8 @@ public:
|
||||
TranslatableString Stripped( unsigned options = MenuCodes ) const
|
||||
{ return TranslatableString{ *this }.Strip( options ); }
|
||||
|
||||
wxString StrippedTranslation() const { return Stripped().Translation(); }
|
||||
|
||||
private:
|
||||
static const Formatter NullContextFormatter;
|
||||
|
||||
|
@ -214,7 +214,7 @@ public:
|
||||
EnumValueSymbols symbols,
|
||||
long defaultSymbol,
|
||||
|
||||
std::initializer_list< Enum > values, // must have same size as symbols
|
||||
std::vector< Enum > values, // must have same size as symbols
|
||||
const wxString &oldKey = {}
|
||||
)
|
||||
: EnumSettingBase{
|
||||
|
@ -402,7 +402,7 @@ wxChoice * ShuttleGuiBase::AddChoice( const TranslatableString &Prompt,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
transform_container<wxArrayString>(
|
||||
choices, std::mem_fn( &TranslatableString::Translation ) ),
|
||||
choices, std::mem_fn( &TranslatableString::StrippedTranslation ) ),
|
||||
GetStyle( 0 ) );
|
||||
|
||||
pChoice->SetMinSize( { 180, -1 } );// Use -1 for 'default size' - Platform specific.
|
||||
@ -2421,7 +2421,7 @@ void ShuttleGui::SetMinSize( wxWindow *window, const TranslatableStrings & items
|
||||
{
|
||||
SetMinSize( window,
|
||||
transform_container<wxArrayStringEx>(
|
||||
items, std::mem_fn( &TranslatableString::Translation ) ) );
|
||||
items, std::mem_fn( &TranslatableString::StrippedTranslation ) ) );
|
||||
}
|
||||
|
||||
void ShuttleGui::SetMinSize( wxWindow *window, const wxArrayStringEx & items )
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "../Prefs.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../tracks/playabletrack/wavetrack/ui/WaveTrackView.h"
|
||||
|
||||
int TracksPrefs::iPreferencePinned = -1;
|
||||
|
||||
@ -81,8 +82,6 @@ namespace {
|
||||
const auto key2 = wxT("/GUI/DefaultViewModeChoice");
|
||||
const auto key3 = wxT("/GUI/DefaultViewModeChoiceNew");
|
||||
|
||||
const EnumValueSymbol waveformSymbol{ XO("Waveform") };
|
||||
const EnumValueSymbol spectrumSymbol{ XO("Spectrogram") };
|
||||
const wxString obsoleteValue{ wxT("WaveformDB") };
|
||||
};
|
||||
|
||||
@ -100,6 +99,9 @@ public:
|
||||
// to avoid confusing version 2.1.0 if it reads the preference file afterwards.
|
||||
// Prefer the NEW preference key if it is present
|
||||
|
||||
static const EnumValueSymbol waveformSymbol{ XO("Waveform") };
|
||||
static const EnumValueSymbol spectrumSymbol{ XO("Spectrogram") };
|
||||
|
||||
WaveTrackViewConstants::Display viewMode;
|
||||
int oldMode;
|
||||
wxString newValue;
|
||||
@ -143,23 +145,26 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static TracksViewModeEnumSetting viewModeSetting{
|
||||
key3,
|
||||
{
|
||||
{ waveformSymbol },
|
||||
{ spectrumSymbol }
|
||||
},
|
||||
0, // Waveform
|
||||
|
||||
{
|
||||
WaveTrackViewConstants::Waveform,
|
||||
WaveTrackViewConstants::Spectrum
|
||||
}
|
||||
};
|
||||
static TracksViewModeEnumSetting viewModeSetting()
|
||||
{
|
||||
// Do a delayed computation, so that registration of sub-view types completes
|
||||
// first
|
||||
const auto &types = WaveTrackSubView::AllTypes();
|
||||
auto symbols = transform_container< EnumValueSymbols >(
|
||||
types, std::mem_fn( &WaveTrackSubView::Type::name ) );
|
||||
auto ids = transform_container< std::vector< WaveTrackSubView::Display > >(
|
||||
types, std::mem_fn( &WaveTrackSubView::Type::id ) );
|
||||
return {
|
||||
key3,
|
||||
symbols,
|
||||
0, // Waveform
|
||||
ids
|
||||
};
|
||||
}
|
||||
|
||||
WaveTrackViewConstants::Display TracksPrefs::ViewModeChoice()
|
||||
{
|
||||
return viewModeSetting.ReadEnum();
|
||||
return viewModeSetting().ReadEnum();
|
||||
}
|
||||
|
||||
WaveformSettings::ScaleTypeValues TracksPrefs::WaveformScaleChoice()
|
||||
@ -344,7 +349,7 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
#endif
|
||||
|
||||
S.TieChoice(XO("Default &view mode:"),
|
||||
viewModeSetting );
|
||||
viewModeSetting() );
|
||||
|
||||
S.TieChoice(XO("Default Waveform scale:"),
|
||||
waveformScaleSetting );
|
||||
|
Loading…
x
Reference in New Issue
Block a user