Audacity 3.2.0
WaveformSettings.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5WaveformSettings.h
6
7Paul Licameli
8
9**********************************************************************/
10
11#pragma once
12
13#include "ClientData.h" // to inherit
14#include "Prefs.h"
15
16class wxRect;
17
19class WaveChannel;
20class WaveTrack;
21
22class WAVE_TRACK_SETTINGS_API WaveformSettings
23 : public PrefsListener
24 , public ClientData::Cloneable<>
25{
26public:
29 static WaveformSettings &Get(const WaveTrack &track);
30
34 static WaveformSettings &Get(const WaveChannel &channel);
35
37 static void Set(
38 WaveChannel &channel, std::unique_ptr<WaveformSettings> pSettings );
39
40 // Singleton for settings that are not per-track
41 class WAVE_TRACK_SETTINGS_API Globals
42 {
43 public:
44 static Globals &Get();
45 void SavePrefs();
46
47 private:
48 Globals();
49 void LoadPrefs();
50 };
51
52 static WaveformSettings &defaults();
53
57 ~WaveformSettings() override;
58
59 PointerType Clone() const override;
60
61 bool IsDefault() const
62 {
63 return this == &defaults();
64 }
65
66 bool Validate(bool quiet);
67 void LoadPrefs();
68 void SavePrefs();
69 void Update();
70
71 void UpdatePrefs() override;
72
73 void ConvertToEnumeratedDBRange();
74 void ConvertToActualDBRange();
75 void NextLowerDBRange();
76 void NextHigherDBRange();
77
78 typedef int ScaleType;
79 enum ScaleTypeValues : int {
83
85 };
86
87 static const EnumValueSymbols &GetScaleNames();
88 static void GetRangeChoices(
89 TranslatableStrings* pChoices, wxArrayStringEx* pCodes,
90 int* pDefaultRangeIndex = nullptr);
91
92 static const wxString waveformScaleKey;
93 static const wxString dbLogValueString;
94 static const wxString dbLinValueString;
96
99
100 // Convenience
101 bool isLinear() const { return scaleType == stLinearAmp || scaleType == stLinearDb; }
102};
Utility ClientData::Site to register hooks into a host class that attach client data.
std::vector< TranslatableString > TranslatableStrings
A listener notified of changes in preferences.
Definition: Prefs.h:652
virtual void UpdatePrefs()=0
Definition: Prefs.cpp:154
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
Waveform settings, either for one track or as defaults.
bool isLinear() const
static const wxString dbLogValueString
bool IsDefault() const
static EnumSetting< ScaleTypeValues > waveformScaleSetting
static const wxString waveformScaleKey
static const wxString dbLinValueString
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202
A convenient base class defining abstract virtual Clone() for a given kind of pointer.
Definition: ClientData.h:50
virtual PointerType Clone() const =0
Owner< Base > PointerType
Definition: ClientData.h:54
Cloneable & operator=(const Cloneable &)=default