Audacity  2.3.1
Public Member Functions | List of all members
TracksViewModeSetting Class Reference
Inheritance diagram for TracksViewModeSetting:
EncodedEnumSetting EnumSetting

Public Member Functions

 TracksViewModeSetting (const wxString &key, const ComponentInterfaceSymbol symbols[], size_t nSymbols, size_t defaultSymbol, const int intValues[], const wxString &oldKey)
void Migrate (wxString &value) override
- Public Member Functions inherited from EncodedEnumSetting
 EncodedEnumSetting (const wxString &key, const ComponentInterfaceSymbol symbols[], size_t nSymbols, size_t defaultSymbol, const int intValues[]=nullptr, const wxString &oldKey=wxString(""))
virtual int ReadInt () const
bool WriteInt (int code)
- Public Member Functions inherited from EnumSetting
 EnumSetting (const wxString &key, const ComponentInterfaceSymbol symbols[], size_t nSymbols, size_t defaultSymbol)
const wxString & Key () const
const ComponentInterfaceSymbolDefault () const
const ComponentInterfaceSymbolbegin () const
const ComponentInterfaceSymbolend () const
wxString Read () const
bool Write (const wxString &value)

Additional Inherited Members

- Protected Member Functions inherited from EncodedEnumSetting
size_t FindInt (int code) const
void Migrate (wxString &) override
- Protected Member Functions inherited from EnumSetting
size_t Find (const wxString &value) const
- Protected Attributes inherited from EnumSetting
const wxString mKey
const ComponentInterfaceSymbolmSymbols
const size_t mnSymbols
bool mMigrated { false }
const size_t mDefaultSymbol

Detailed Description

Definition at line 74 of file TracksPrefs.cpp.

Constructor & Destructor Documentation

TracksViewModeSetting::TracksViewModeSetting ( const wxString &  key,
const ComponentInterfaceSymbol  symbols[],
size_t  nSymbols,
size_t  defaultSymbol,
const int  intValues[],
const wxString &  oldKey 

Definition at line 76 of file TracksPrefs.cpp.

85  key, symbols, nSymbols, defaultSymbol, intValues, oldKey }
86  {}

Member Function Documentation

void TracksViewModeSetting::Migrate ( wxString &  value)

Reimplemented from EnumSetting.

Definition at line 88 of file TracksPrefs.cpp.

References WaveTrack::ConvertLegacyDisplayValue(), EncodedEnumSetting::FindInt(), gPrefs, ComponentInterfaceSymbol::Internal(), EncodedEnumSetting::Migrate(), EnumSetting::mSymbols, WaveTrack::ValidateWaveTrackDisplay(), WaveTrack::Waveform, and EncodedEnumSetting::WriteInt().

89  {
90  // Special logic for this preference which was twice migrated!
92  // First test for the older but not oldest key:
94  if (!value.empty())
95  return;
97  // PRL: Bugs 1043, 1044
98  // 2.1.1 writes a NEW key for this preference, which got NEW values,
99  // to avoid confusing version 2.1.0 if it reads the preference file afterwards.
100  // Prefer the NEW preference key if it is present
102  int oldMode;
103  gPrefs->Read(wxT("/GUI/DefaultViewMode"), // The very old key
104  &oldMode,
105  (int)(WaveTrack::Waveform));
106  auto viewMode = WaveTrack::ConvertLegacyDisplayValue(oldMode);
108  // Now future-proof 2.1.1 against a recurrence of this sort of bug!
109  viewMode = WaveTrack::ValidateWaveTrackDisplay(viewMode);
111  const_cast<TracksViewModeSetting*>(this)->WriteInt( viewMode );
112  gPrefs->Flush();
114  value = mSymbols[ FindInt(viewMode) ].Internal();
115  }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
static WaveTrackDisplay ConvertLegacyDisplayValue(int oldValue)
Definition: WaveTrack.cpp:262
const ComponentInterfaceSymbol * mSymbols
Definition: Prefs.h:99
const wxString & Internal() const
static WaveTrackDisplay ValidateWaveTrackDisplay(WaveTrackDisplay display)
Definition: WaveTrack.cpp:296
bool WriteInt(int code)
Definition: Prefs.cpp:458
size_t FindInt(int code) const
Definition: Prefs.cpp:430
void Migrate(wxString &) override
Definition: Prefs.cpp:440

The documentation for this class was generated from the following file: