Audacity 3.2.0
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TrackArtist Class Referencefinal

This class handles the actual rendering of WaveTracks (both waveforms and spectra), NoteTracks, LabelTracks and TimeTracks. More...

#include <TrackArtist.h>

Inheritance diagram for TrackArtist:
[legend]
Collaboration diagram for TrackArtist:
[legend]

Public Types

enum  : unsigned {
  PassTracks , PassMargins , PassBorders , PassControls ,
  PassZooming , PassBackground , PassFocus , PassSnapping ,
  NPasses
}
 

Public Member Functions

 TrackArtist (TrackPanel *parent_)
 
 ~TrackArtist ()
 
void SetBackgroundBrushes (wxBrush unselectedBrushIn, wxBrush selectedBrushIn, wxPen unselectedPenIn, wxPen selectedPenIn)
 
void SetColours (int iColorIndex)
 
void UpdatePrefs () override
 
void UpdateSelectedPrefs (int id) override
 

Static Public Member Functions

static TrackArtistGet (TrackPanelDrawingContext &)
 

Public Attributes

TrackPanelparent
 
float mdBrange
 
bool mShowClipping
 
int mSampleDisplay
 
bool mbShowTrackNameInTrack
 
wxBrush blankBrush
 
wxBrush unselectedBrush
 
wxBrush selectedBrush
 
wxBrush sampleBrush
 
wxBrush selsampleBrush
 
wxBrush dragsampleBrush
 
wxBrush muteSampleBrush
 
wxBrush blankSelectedBrush
 
wxPen blankPen
 
wxPen unselectedPen
 
wxPen selectedPen
 
wxPen samplePen
 
wxPen rmsPen
 
wxPen muteRmsPen
 
wxPen selsamplePen
 
wxPen muteSamplePen
 
wxPen odProgressNotYetPen
 
wxPen odProgressDonePen
 
wxPen shadowPen
 
wxPen clippedPen
 
wxPen muteClippedPen
 
wxPen blankSelectedPen
 
wxPen beatSepearatorPen
 
wxPen barSepearatorPen
 
wxBrush beatStrongBrush
 
wxBrush beatWeakBrush
 
wxBrush beatStrongSelBrush
 
wxBrush beatWeakSelBrush
 
const SelectedRegionpSelectedRegion {}
 
ZoomInfopZoomInfo {}
 
bool drawEnvelope { false }
 
bool bigPoints { false }
 
bool drawSliders { false }
 
bool onBrushTool { false }
 
bool hasSolo { false }
 

Additional Inherited Members

- Private Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
virtual void UpdateSelectedPrefs (int id)
 
- Static Private Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Detailed Description

This class handles the actual rendering of WaveTracks (both waveforms and spectra), NoteTracks, LabelTracks and TimeTracks.

It's actually a little harder than it looks, because for waveforms at least it needs to cache the samples that are currently on-screen.

How Audacity Redisplay Works
Roger Dannenberg

Oct 2010
In my opinion, the bitmap should contain only the waveform, note, and label images along with gray selection highlights. The track info (sliders, buttons, title, etc.), track selection highlight, cursor, and indicator should be drawn in the normal way, and clipping regions should be used to avoid excessive copying of bitmaps (say, when sliders move), or excessive redrawing of track info widgets (say, when scrolling occurs). This is a fairly tricky code change since it requires careful specification of what and where redraw should take place when any state changes. One surprising finding is that NoteTrack display is slow compared to WaveTrack display. Each note takes some time to gather attributes and select colors, and while audio draws two amplitudes per horizontal pixels, large MIDI scores can have more notes than horizontal pixels. This can make slider changes very sluggish, but this can also be a problem with many audio tracks.

Definition at line 39 of file TrackArtist.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned
Enumerator
PassTracks 
PassMargins 
PassBorders 
PassControls 
PassZooming 
PassBackground 
PassFocus 
PassSnapping 
NPasses 

Definition at line 43 of file TrackArtist.h.

Constructor & Destructor Documentation

◆ TrackArtist()

TrackArtist::TrackArtist ( TrackPanel parent_)

Definition at line 53 of file TrackArtist.cpp.

54 : parent( parent_ )
55{
57 mShowClipping = false;
58 mSampleDisplay = 1;// Stem plots by default.
59
60 SetColours(0);
61
63}
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
const T & GetDefault() const
Definition: Prefs.h:199
float mdBrange
Definition: TrackArtist.h:76
TrackPanel * parent
Definition: TrackArtist.h:73
bool mShowClipping
Definition: TrackArtist.h:77
void SetColours(int iColorIndex)
Definition: TrackArtist.cpp:74
int mSampleDisplay
Definition: TrackArtist.h:78
void UpdatePrefs() override

References DecibelScaleCutoff, Setting< T >::GetDefault(), mdBrange, mSampleDisplay, mShowClipping, SetColours(), and UpdatePrefs().

Here is the call graph for this function:

◆ ~TrackArtist()

TrackArtist::~TrackArtist ( )

Definition at line 65 of file TrackArtist.cpp.

66{
67}

Member Function Documentation

◆ Get()

TrackArtist * TrackArtist::Get ( TrackPanelDrawingContext context)
static

Definition at line 69 of file TrackArtist.cpp.

70{
71 return static_cast< TrackArtist* >( context.pUserData );
72}
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...
Definition: TrackArtist.h:39

References TrackPanelDrawingContext::pUserData.

Referenced by SpectrumView::DoDraw(), WaveformView::DoDraw(), LabelTrackView::Draw(), anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::Draw(), TrackPanelResizerCell::Draw(), NoteTrackAffordanceControls::Draw(), NoteTrackView::Draw(), NoteTrackVRulerControls::Draw(), HighlitClipButtonHandle::Draw(), SpectrumView::Draw(), WaveformView::Draw(), WaveTrackAffordanceControls::Draw(), TrackArt::DrawBackgroundWithSelection(), WaveChannelSubView::DrawBoldBoundaries(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), TrackArt::DrawCursor(), anonymous_namespace{TimeTrackView.cpp}::DrawHorzRulerAndCurve(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), anonymous_namespace{WaveformView.cpp}::DrawMinMaxRMS(), anonymous_namespace{NoteTrackView.cpp}::DrawNoteBackground(), anonymous_namespace{NoteTrackView.cpp}::DrawNoteTrack(), EnvelopeEditor::DrawPoints(), anonymous_namespace{TimeTrackView.cpp}::DrawTimeTrack(), anonymous_namespace{TrackPanel.cpp}::DrawTrackName(), anonymous_namespace{WaveformView.cpp}::DrawWaveformBackground(), anonymous_namespace{WaveTrackControls.cpp}::GainSliderDrawFunction(), and anonymous_namespace{WaveTrackControls.cpp}::PanSliderDrawFunction().

Here is the caller graph for this function:

◆ SetBackgroundBrushes()

void TrackArtist::SetBackgroundBrushes ( wxBrush  unselectedBrushIn,
wxBrush  selectedBrushIn,
wxPen  unselectedPenIn,
wxPen  selectedPenIn 
)
inline

Definition at line 60 of file TrackArtist.h.

61 {
62 this->unselectedBrush = unselectedBrushIn;
63 this->selectedBrush = selectedBrushIn;
64 this->unselectedPen = unselectedPenIn;
65 this->selectedPen = selectedPenIn;
66 }
wxPen unselectedPen
Definition: TrackArtist.h:90
wxBrush selectedBrush
Definition: TrackArtist.h:83
wxPen selectedPen
Definition: TrackArtist.h:91
wxBrush unselectedBrush
Definition: TrackArtist.h:82

◆ SetColours()

void TrackArtist::SetColours ( int  iColorIndex)

Definition at line 74 of file TrackArtist.cpp.

75{
82 theTheme.SetBrushColour( blankSelectedBrush, clrBlankSelected);
83
84 theTheme.SetPenColour( blankPen, clrBlank);
85 theTheme.SetPenColour( unselectedPen, clrUnselected);
86 theTheme.SetPenColour( selectedPen, clrSelected);
87 theTheme.SetPenColour( muteSamplePen, clrMuteSample);
88 theTheme.SetPenColour( odProgressDonePen, clrProgressDone);
89 theTheme.SetPenColour( odProgressNotYetPen, clrProgressNotYet);
90 theTheme.SetPenColour( shadowPen, clrShadow);
91 theTheme.SetPenColour( clippedPen, clrClipped);
92 theTheme.SetPenColour( muteClippedPen, clrMuteClipped);
93 theTheme.SetPenColour( blankSelectedPen,clrBlankSelected);
94
95 theTheme.SetPenColour( selsamplePen, clrSelSample);
96 theTheme.SetPenColour( muteRmsPen, clrMuteRms);
97
98 theTheme.SetPenColour( beatSepearatorPen, clrBeatSeparatorPen );
99 theTheme.SetPenColour( barSepearatorPen, clrBarSeparatorPen );
100 theTheme.SetBrushColour( beatStrongBrush, clrBeatFillStrongBrush );
101 theTheme.SetBrushColour( beatWeakBrush, clrBeatFillWeakBrush );
102 theTheme.SetBrushColour( beatStrongSelBrush, clrBeatFillStrongSelBrush );
103 theTheme.SetBrushColour( beatWeakSelBrush, clrBeatFillWeakSelBrush );
104
105 switch( iColorIndex %4 )
106 {
107 default:
108 case 0:
109 theTheme.SetPenColour( samplePen, clrSample);
110 theTheme.SetPenColour( rmsPen, clrRms);
111 break;
112 case 1: // RED
113 samplePen.SetColour( wxColor( 160,10,10 ) );
114 rmsPen.SetColour( wxColor( 230,80,80 ) );
115 break;
116 case 2: // GREEN
117 samplePen.SetColour( wxColor( 35,110,35 ) );
118 rmsPen.SetColour( wxColor( 75,200,75 ) );
119 break;
120 case 3: //BLACK
121 samplePen.SetColour( wxColor( 0,0,0 ) );
122 rmsPen.SetColour( wxColor( 100,100,100 ) );
123 break;
124
125 }
126}
THEME_API Theme theTheme
Definition: Theme.cpp:82
void SetBrushColour(wxBrush &Brush, int iIndex)
void SetPenColour(wxPen &Pen, int iIndex)
wxBrush beatWeakSelBrush
Definition: TrackArtist.h:109
wxBrush blankBrush
Definition: TrackArtist.h:81
wxPen odProgressDonePen
Definition: TrackArtist.h:98
wxPen rmsPen
Definition: TrackArtist.h:93
wxPen muteSamplePen
Definition: TrackArtist.h:96
wxBrush sampleBrush
Definition: TrackArtist.h:84
wxBrush beatWeakBrush
Definition: TrackArtist.h:107
wxPen muteClippedPen
Definition: TrackArtist.h:101
wxBrush beatStrongSelBrush
Definition: TrackArtist.h:108
wxBrush beatStrongBrush
Definition: TrackArtist.h:106
wxPen samplePen
Definition: TrackArtist.h:92
wxPen barSepearatorPen
Definition: TrackArtist.h:105
wxPen odProgressNotYetPen
Definition: TrackArtist.h:97
wxPen clippedPen
Definition: TrackArtist.h:100
wxBrush selsampleBrush
Definition: TrackArtist.h:85
wxPen shadowPen
Definition: TrackArtist.h:99
wxPen blankPen
Definition: TrackArtist.h:89
wxPen muteRmsPen
Definition: TrackArtist.h:94
wxBrush dragsampleBrush
Definition: TrackArtist.h:86
wxPen selsamplePen
Definition: TrackArtist.h:95
wxBrush blankSelectedBrush
Definition: TrackArtist.h:88
wxPen beatSepearatorPen
Definition: TrackArtist.h:104
wxPen blankSelectedPen
Definition: TrackArtist.h:102

References barSepearatorPen, beatSepearatorPen, beatStrongBrush, beatStrongSelBrush, beatWeakBrush, beatWeakSelBrush, blankBrush, blankPen, blankSelectedBrush, blankSelectedPen, clippedPen, dragsampleBrush, muteClippedPen, muteRmsPen, muteSamplePen, odProgressDonePen, odProgressNotYetPen, rmsPen, sampleBrush, samplePen, selectedBrush, selectedPen, selsampleBrush, selsamplePen, ThemeBase::SetBrushColour(), ThemeBase::SetPenColour(), shadowPen, theTheme, unselectedBrush, and unselectedPen.

Referenced by TrackArtist(), and UpdatePrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdatePrefs()

void TrackArtist::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Definition at line 136 of file TrackArtist.cpp.

137{
140
143
144 SetColours(0);
145}
int ShowTrackNameInWaveformPrefsID()
Definition: GUIPrefs.cpp:234
int ShowClippingPrefsID()
Definition: GUIPrefs.cpp:228
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:207
void UpdateSelectedPrefs(int id) override
static WaveChannelViewConstants::SampleDisplay SampleViewChoice()

References DecibelScaleCutoff, mdBrange, mSampleDisplay, Setting< T >::Read(), TracksPrefs::SampleViewChoice(), SetColours(), ShowClippingPrefsID(), ShowTrackNameInWaveformPrefsID(), and UpdateSelectedPrefs().

Referenced by TrackArtist().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateSelectedPrefs()

void TrackArtist::UpdateSelectedPrefs ( int  id)
overridevirtual

Reimplemented from PrefsListener.

Definition at line 128 of file TrackArtist.cpp.

129{
130 if( id == ShowClippingPrefsID())
131 mShowClipping = gPrefs->Read(wxT("/GUI/ShowClipping"), mShowClipping);
133 mbShowTrackNameInTrack = gPrefs->ReadBool(wxT("/GUI/ShowTrackNameInWaveform"), false);
134}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
bool mbShowTrackNameInTrack
Definition: TrackArtist.h:79
bool ReadBool(const wxString &key, bool defaultValue) const
virtual bool Read(const wxString &key, bool *value) const =0

References gPrefs, mbShowTrackNameInTrack, mShowClipping, audacity::BasicSettings::Read(), audacity::BasicSettings::ReadBool(), ShowClippingPrefsID(), ShowTrackNameInWaveformPrefsID(), and wxT().

Referenced by UpdatePrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ barSepearatorPen

wxPen TrackArtist::barSepearatorPen

Definition at line 105 of file TrackArtist.h.

Referenced by SetColours().

◆ beatSepearatorPen

wxPen TrackArtist::beatSepearatorPen

Definition at line 104 of file TrackArtist.h.

Referenced by SetColours().

◆ beatStrongBrush

wxBrush TrackArtist::beatStrongBrush

Definition at line 106 of file TrackArtist.h.

Referenced by SetColours().

◆ beatStrongSelBrush

wxBrush TrackArtist::beatStrongSelBrush

Definition at line 108 of file TrackArtist.h.

Referenced by SetColours().

◆ beatWeakBrush

wxBrush TrackArtist::beatWeakBrush

Definition at line 107 of file TrackArtist.h.

Referenced by SetColours().

◆ beatWeakSelBrush

wxBrush TrackArtist::beatWeakSelBrush

Definition at line 109 of file TrackArtist.h.

Referenced by SetColours().

◆ bigPoints

bool TrackArtist::bigPoints { false }

Definition at line 126 of file TrackArtist.h.

◆ blankBrush

wxBrush TrackArtist::blankBrush

Definition at line 81 of file TrackArtist.h.

Referenced by SetColours().

◆ blankPen

wxPen TrackArtist::blankPen

Definition at line 89 of file TrackArtist.h.

Referenced by SetColours().

◆ blankSelectedBrush

wxBrush TrackArtist::blankSelectedBrush

Definition at line 88 of file TrackArtist.h.

Referenced by SetColours().

◆ blankSelectedPen

wxPen TrackArtist::blankSelectedPen

Definition at line 102 of file TrackArtist.h.

Referenced by SetColours().

◆ clippedPen

wxPen TrackArtist::clippedPen

Definition at line 100 of file TrackArtist.h.

Referenced by SetColours().

◆ dragsampleBrush

wxBrush TrackArtist::dragsampleBrush

Definition at line 86 of file TrackArtist.h.

Referenced by SetColours().

◆ drawEnvelope

bool TrackArtist::drawEnvelope { false }

Definition at line 125 of file TrackArtist.h.

◆ drawSliders

bool TrackArtist::drawSliders { false }

Definition at line 127 of file TrackArtist.h.

◆ hasSolo

bool TrackArtist::hasSolo { false }

Definition at line 129 of file TrackArtist.h.

◆ mbShowTrackNameInTrack

bool TrackArtist::mbShowTrackNameInTrack

Definition at line 79 of file TrackArtist.h.

Referenced by UpdateSelectedPrefs().

◆ mdBrange

float TrackArtist::mdBrange

Definition at line 76 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdatePrefs().

◆ mSampleDisplay

int TrackArtist::mSampleDisplay

Definition at line 78 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdatePrefs().

◆ mShowClipping

bool TrackArtist::mShowClipping

Definition at line 77 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdateSelectedPrefs().

◆ muteClippedPen

wxPen TrackArtist::muteClippedPen

Definition at line 101 of file TrackArtist.h.

Referenced by SetColours().

◆ muteRmsPen

wxPen TrackArtist::muteRmsPen

Definition at line 94 of file TrackArtist.h.

Referenced by SetColours().

◆ muteSampleBrush

wxBrush TrackArtist::muteSampleBrush

Definition at line 87 of file TrackArtist.h.

◆ muteSamplePen

wxPen TrackArtist::muteSamplePen

Definition at line 96 of file TrackArtist.h.

Referenced by SetColours().

◆ odProgressDonePen

wxPen TrackArtist::odProgressDonePen

Definition at line 98 of file TrackArtist.h.

Referenced by SetColours().

◆ odProgressNotYetPen

wxPen TrackArtist::odProgressNotYetPen

Definition at line 97 of file TrackArtist.h.

Referenced by SetColours().

◆ onBrushTool

bool TrackArtist::onBrushTool { false }

Definition at line 128 of file TrackArtist.h.

◆ parent

TrackPanel* TrackArtist::parent

Definition at line 73 of file TrackArtist.h.

◆ pSelectedRegion

const SelectedRegion* TrackArtist::pSelectedRegion {}

Definition at line 122 of file TrackArtist.h.

◆ pZoomInfo

ZoomInfo* TrackArtist::pZoomInfo {}

Definition at line 123 of file TrackArtist.h.

Referenced by EqualizationPanel::OnPaint().

◆ rmsPen

wxPen TrackArtist::rmsPen

Definition at line 93 of file TrackArtist.h.

Referenced by SetColours().

◆ sampleBrush

wxBrush TrackArtist::sampleBrush

Definition at line 84 of file TrackArtist.h.

Referenced by SetColours().

◆ samplePen

wxPen TrackArtist::samplePen

Definition at line 92 of file TrackArtist.h.

Referenced by SetColours().

◆ selectedBrush

wxBrush TrackArtist::selectedBrush

Definition at line 83 of file TrackArtist.h.

Referenced by SetColours().

◆ selectedPen

wxPen TrackArtist::selectedPen

Definition at line 91 of file TrackArtist.h.

Referenced by SetColours().

◆ selsampleBrush

wxBrush TrackArtist::selsampleBrush

Definition at line 85 of file TrackArtist.h.

Referenced by SetColours().

◆ selsamplePen

wxPen TrackArtist::selsamplePen

Definition at line 95 of file TrackArtist.h.

Referenced by SetColours().

◆ shadowPen

wxPen TrackArtist::shadowPen

Definition at line 99 of file TrackArtist.h.

Referenced by SetColours().

◆ unselectedBrush

wxBrush TrackArtist::unselectedBrush

Definition at line 82 of file TrackArtist.h.

Referenced by SetColours().

◆ unselectedPen

wxPen TrackArtist::unselectedPen

Definition at line 90 of file TrackArtist.h.

Referenced by SetColours().


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