Audacity 3.2.0
TrackArtist.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 TrackArtist.cpp
6
7 Dominic Mazzoni
8
9
10*******************************************************************//*******************************************************************/
40
41
42#include "TrackArtist.h"
43
44#include "AllThemeResources.h"
45#include "prefs/GUIPrefs.h"
46#include "SyncLock.h"
47#include "Theme.h"
49
50#include "Decibels.h"
51#include "prefs/TracksPrefs.h"
52
53namespace
54{
55 void ChangeLightness(wxPen& pen, int ialpha)
56 {
57 pen.SetColour(pen.GetColour().ChangeLightness(ialpha));
58 }
59
60 void ChangeLightness(wxBrush& brush, int ialpha)
61 {
62 brush.SetColour(brush.GetColour().ChangeLightness(ialpha));
63 }
64}
65
67 : parent( parent_ )
68{
70 mShowClipping = false;
71 mSampleDisplay = 1;// Stem plots by default.
72
73 SetColours(0);
74
76}
77
79{
80}
81
83{
84 return static_cast< TrackArtist* >( context.pUserData );
85}
86
87void TrackArtist::SetColours( int iColorIndex)
88{
95 theTheme.SetBrushColour( blankSelectedBrush, clrBlankSelected);
96 theTheme.SetBrushColour( envelopeBackgroundBrush, clrEnvelopeBackground);
99
100 theTheme.SetPenColour( blankPen, clrBlank);
101 theTheme.SetPenColour( unselectedPen, clrUnselected);
102 theTheme.SetPenColour( selectedPen, clrSelected);
103 theTheme.SetPenColour( muteSamplePen, clrMuteSample);
104 theTheme.SetPenColour( odProgressDonePen, clrProgressDone);
105 theTheme.SetPenColour( odProgressNotYetPen, clrProgressNotYet);
106 theTheme.SetPenColour( clippedPen, clrClipped);
107 theTheme.SetPenColour( muteClippedPen, clrMuteClipped);
108 theTheme.SetPenColour( blankSelectedPen,clrBlankSelected);
109
110 theTheme.SetPenColour( selsamplePen, clrSelSample);
111 theTheme.SetPenColour( muteRmsPen, clrMuteRms);
112
113 theTheme.SetPenColour( beatSepearatorPen[0], clrBeatSeparatorPen );
114 theTheme.SetPenColour( beatSepearatorPen[1], clrBeatSeparatorPen );
115 theTheme.SetPenColour( barSepearatorPen[0], clrBarSeparatorPen );
116 theTheme.SetPenColour( barSepearatorPen[1], clrBarSeparatorPen );
117 theTheme.SetBrushColour( beatStrongBrush[0], clrBeatFillStrongBrush );
118 theTheme.SetBrushColour( beatStrongBrush[1], clrBeatFillStrongBrush );
119 theTheme.SetBrushColour( beatWeakBrush[0], clrBeatFillWeakBrush );
120 theTheme.SetBrushColour( beatWeakBrush[1], clrBeatFillWeakBrush );
121 theTheme.SetBrushColour( beatStrongSelBrush[0], clrBeatFillStrongSelBrush );
122 theTheme.SetBrushColour( beatStrongSelBrush[1], clrBeatFillStrongSelBrush );
123 theTheme.SetBrushColour( beatWeakSelBrush[0], clrBeatFillWeakSelBrush );
124 theTheme.SetBrushColour( beatWeakSelBrush[1], clrBeatFillWeakSelBrush );
125
134
135 switch( iColorIndex %4 )
136 {
137 default:
138 case 0:
139 theTheme.SetPenColour( samplePen, clrSample);
140 theTheme.SetPenColour( rmsPen, clrRms);
141 break;
142 case 1: // RED
143 theTheme.SetPenColour( samplePen, clrSample2);
144 theTheme.SetPenColour( rmsPen, clrRms2);
145 break;
146 case 2: // GREEN
147 theTheme.SetPenColour( samplePen, clrSample3);
148 theTheme.SetPenColour( rmsPen, clrRms3);
149 break;
150 case 3: //BLACK
151 theTheme.SetPenColour( samplePen, clrSample4);
152 theTheme.SetPenColour( rmsPen, clrRms4);
153 break;
154
155 }
156}
157
159{
160 if( id == ShowClippingPrefsID())
161 mShowClipping = gPrefs->Read(wxT("/GUI/ShowClipping"), mShowClipping);
162}
163
165{
168
170
171 SetColours(0);
172}
wxT("CloseDown"))
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
int ShowClippingPrefsID()
Definition: GUIPrefs.cpp:225
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
THEME_API Theme theTheme
Definition: Theme.cpp:82
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:207
const T & GetDefault() const
Definition: Prefs.h:199
void SetBrushColour(wxBrush &Brush, int iIndex)
void SetPenColour(wxPen &Pen, int iIndex)
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...
Definition: TrackArtist.h:40
wxBrush blankBrush
Definition: TrackArtist.h:73
wxBrush envelopeBackgroundBrush
Definition: TrackArtist.h:81
wxBrush beatWeakSelBrush[2]
Definition: TrackArtist.h:103
wxPen odProgressDonePen
Definition: TrackArtist.h:93
wxPen rmsPen
Definition: TrackArtist.h:88
wxPen unselectedPen
Definition: TrackArtist.h:85
float mdBrange
Definition: TrackArtist.h:69
wxPen beatSepearatorPen[2]
Definition: TrackArtist.h:98
wxPen muteSamplePen
Definition: TrackArtist.h:91
wxBrush sampleBrush
Definition: TrackArtist.h:76
wxPen barSepearatorPen[2]
Definition: TrackArtist.h:99
wxPen muteClippedPen
Definition: TrackArtist.h:95
wxBrush selectedBrush
Definition: TrackArtist.h:75
wxBrush beatStrongBrush[2]
Definition: TrackArtist.h:100
wxPen selectedPen
Definition: TrackArtist.h:86
wxPen samplePen
Definition: TrackArtist.h:87
wxPen odProgressNotYetPen
Definition: TrackArtist.h:92
wxBrush beatWeakBrush[2]
Definition: TrackArtist.h:101
wxPen clippedPen
Definition: TrackArtist.h:94
wxBrush selsampleBrush
Definition: TrackArtist.h:77
TrackArtist(TrackPanel *parent_)
Definition: TrackArtist.cpp:66
wxPen blankPen
Definition: TrackArtist.h:84
wxPen muteRmsPen
Definition: TrackArtist.h:89
bool mShowClipping
Definition: TrackArtist.h:70
void SetColours(int iColorIndex)
Definition: TrackArtist.cpp:87
wxBrush beatStrongSelBrush[2]
Definition: TrackArtist.h:102
int mSampleDisplay
Definition: TrackArtist.h:71
wxBrush clipAffordanceBackgroundSelBrush
Definition: TrackArtist.h:83
wxBrush dragsampleBrush
Definition: TrackArtist.h:78
wxPen selsamplePen
Definition: TrackArtist.h:90
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:82
wxBrush clipAffordanceBackgroundBrush
Definition: TrackArtist.h:82
wxBrush unselectedBrush
Definition: TrackArtist.h:74
wxBrush blankSelectedBrush
Definition: TrackArtist.h:80
void UpdateSelectedPrefs(int id) override
void UpdatePrefs() override
wxPen blankSelectedPen
Definition: TrackArtist.h:96
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:63
static WaveChannelViewConstants::SampleDisplay SampleViewChoice()
virtual bool Read(const wxString &key, bool *value) const =0
void ChangeLightness(wxBrush &brush, int ialpha)
Definition: TrackArtist.cpp:60