Audacity  3.0.3
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:
Collaboration diagram for TrackArtist:

Public Types

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

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

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
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 ()
- 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 76 of file TrackArtist.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned

Definition at line 80 of file TrackArtist.h.

80  : unsigned {
81  PassTracks,
87  PassFocus,
90  NPasses
91  };

Constructor & Destructor Documentation

◆ TrackArtist()

TrackArtist::TrackArtist ( TrackPanel parent_)

Definition at line 63 of file TrackArtist.cpp.

64  : parent( parent_ )
65 {
67  mShowClipping = false;
68  mSampleDisplay = 1;// Stem plots by default.
70  SetColours(0);
72  UpdatePrefs();
73 }

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 75 of file TrackArtist.cpp.

76 {
77 }

Member Function Documentation

◆ Get()

TrackArtist * TrackArtist::Get ( TrackPanelDrawingContext context)

Definition at line 79 of file TrackArtist.cpp.

80 {
81  return static_cast< TrackArtist* >( context.pUserData );
82 }

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(), SpectrumView::Draw(), WaveformView::Draw(), WaveTrackAffordanceControls::Draw(), TrackArt::DrawBackgroundWithSelection(), WaveTrackSubView::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 

Definition at line 97 of file TrackArtist.h.

98  {
99  this->unselectedBrush = unselectedBrushIn;
100  this->selectedBrush = selectedBrushIn;
101  this->unselectedPen = unselectedPenIn;
102  this->selectedPen = selectedPenIn;
103  }

Referenced by AudacityPrintout::OnPrintPage().

Here is the caller graph for this function:

◆ SetColours()

void TrackArtist::SetColours ( int  iColorIndex)

Definition at line 84 of file TrackArtist.cpp.

85 {
86  theTheme.SetBrushColour( blankBrush, clrBlank );
87  theTheme.SetBrushColour( unselectedBrush, clrUnselected);
88  theTheme.SetBrushColour( selectedBrush, clrSelected);
89  theTheme.SetBrushColour( sampleBrush, clrSample);
90  theTheme.SetBrushColour( selsampleBrush, clrSelSample);
91  theTheme.SetBrushColour( dragsampleBrush, clrDragSample);
92  theTheme.SetBrushColour( blankSelectedBrush, clrBlankSelected);
94  theTheme.SetPenColour( blankPen, clrBlank);
95  theTheme.SetPenColour( unselectedPen, clrUnselected);
96  theTheme.SetPenColour( selectedPen, clrSelected);
97  theTheme.SetPenColour( muteSamplePen, clrMuteSample);
98  theTheme.SetPenColour( odProgressDonePen, clrProgressDone);
99  theTheme.SetPenColour( odProgressNotYetPen, clrProgressNotYet);
100  theTheme.SetPenColour( shadowPen, clrShadow);
101  theTheme.SetPenColour( clippedPen, clrClipped);
102  theTheme.SetPenColour( muteClippedPen, clrMuteClipped);
103  theTheme.SetPenColour( blankSelectedPen,clrBlankSelected);
105  theTheme.SetPenColour( selsamplePen, clrSelSample);
106  theTheme.SetPenColour( muteRmsPen, clrMuteRms);
108  switch( iColorIndex %4 )
109  {
110  default:
111  case 0:
112  theTheme.SetPenColour( samplePen, clrSample);
113  theTheme.SetPenColour( rmsPen, clrRms);
114  break;
115  case 1: // RED
116  samplePen.SetColour( wxColor( 160,10,10 ) );
117  rmsPen.SetColour( wxColor( 230,80,80 ) );
118  break;
119  case 2: // GREEN
120  samplePen.SetColour( wxColor( 35,110,35 ) );
121  rmsPen.SetColour( wxColor( 75,200,75 ) );
122  break;
123  case 3: //BLACK
124  samplePen.SetColour( wxColor( 0,0,0 ) );
125  rmsPen.SetColour( wxColor( 100,100,100 ) );
126  break;
128  }
129 }

References 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 ( )

Implements PrefsListener.

Definition at line 291 of file TrackArtist.cpp.

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)

Reimplemented from PrefsListener.

Definition at line 283 of file TrackArtist.cpp.

284 {
285  if( id == ShowClippingPrefsID())
286  mShowClipping = gPrefs->Read(wxT("/GUI/ShowClipping"), mShowClipping);
287  if( id == ShowTrackNameInWaveformPrefsID())
288  mbShowTrackNameInTrack = gPrefs->ReadBool(wxT("/GUI/ShowTrackNameInWaveform"), false);
289 }

References gPrefs, mbShowTrackNameInTrack, mShowClipping, ShowClippingPrefsID(), and ShowTrackNameInWaveformPrefsID().

Referenced by UpdatePrefs().

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

Member Data Documentation

◆ bigPoints

bool TrackArtist::bigPoints { false }

Definition at line 156 of file TrackArtist.h.

◆ blankBrush

wxBrush TrackArtist::blankBrush

Definition at line 118 of file TrackArtist.h.

Referenced by SetColours().

◆ blankPen

wxPen TrackArtist::blankPen

Definition at line 126 of file TrackArtist.h.

Referenced by SetColours().

◆ blankSelectedBrush

wxBrush TrackArtist::blankSelectedBrush

Definition at line 125 of file TrackArtist.h.

Referenced by SetColours().

◆ blankSelectedPen

wxPen TrackArtist::blankSelectedPen

Definition at line 139 of file TrackArtist.h.

Referenced by SetColours().

◆ clippedPen

wxPen TrackArtist::clippedPen

Definition at line 137 of file TrackArtist.h.

Referenced by SetColours().

◆ dragsampleBrush

wxBrush TrackArtist::dragsampleBrush

Definition at line 123 of file TrackArtist.h.

Referenced by SetColours().

◆ drawEnvelope

bool TrackArtist::drawEnvelope { false }

Definition at line 155 of file TrackArtist.h.

◆ drawSliders

bool TrackArtist::drawSliders { false }

Definition at line 157 of file TrackArtist.h.

◆ hasSolo

bool TrackArtist::hasSolo { false }

Definition at line 159 of file TrackArtist.h.

◆ mbShowTrackNameInTrack

bool TrackArtist::mbShowTrackNameInTrack

Definition at line 116 of file TrackArtist.h.

Referenced by UpdateSelectedPrefs().

◆ mdBrange

float TrackArtist::mdBrange

Definition at line 113 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdatePrefs().

◆ mSampleDisplay

int TrackArtist::mSampleDisplay

Definition at line 115 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdatePrefs().

◆ mShowClipping

bool TrackArtist::mShowClipping

Definition at line 114 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdateSelectedPrefs().

◆ muteClippedPen

wxPen TrackArtist::muteClippedPen

Definition at line 138 of file TrackArtist.h.

Referenced by SetColours().

◆ muteRmsPen

wxPen TrackArtist::muteRmsPen

Definition at line 131 of file TrackArtist.h.

Referenced by SetColours().

◆ muteSampleBrush

wxBrush TrackArtist::muteSampleBrush

Definition at line 124 of file TrackArtist.h.

◆ muteSamplePen

wxPen TrackArtist::muteSamplePen

Definition at line 133 of file TrackArtist.h.

Referenced by SetColours().

◆ odProgressDonePen

wxPen TrackArtist::odProgressDonePen

Definition at line 135 of file TrackArtist.h.

Referenced by SetColours().

◆ odProgressNotYetPen

wxPen TrackArtist::odProgressNotYetPen

Definition at line 134 of file TrackArtist.h.

Referenced by SetColours().

◆ onBrushTool

bool TrackArtist::onBrushTool { false }

Definition at line 158 of file TrackArtist.h.

◆ parent

TrackPanel* TrackArtist::parent

Definition at line 110 of file TrackArtist.h.

◆ pSelectedRegion

const SelectedRegion* TrackArtist::pSelectedRegion {}

Definition at line 152 of file TrackArtist.h.

Referenced by AudacityPrintout::OnPrintPage().

◆ pZoomInfo

ZoomInfo* TrackArtist::pZoomInfo {}

Definition at line 153 of file TrackArtist.h.

Referenced by EqualizationPanel::OnPaint(), and AudacityPrintout::OnPrintPage().

◆ rmsPen

wxPen TrackArtist::rmsPen

Definition at line 130 of file TrackArtist.h.

Referenced by SetColours().

◆ sampleBrush

wxBrush TrackArtist::sampleBrush

Definition at line 121 of file TrackArtist.h.

Referenced by SetColours().

◆ samplePen

wxPen TrackArtist::samplePen

Definition at line 129 of file TrackArtist.h.

Referenced by SetColours().

◆ selectedBrush

wxBrush TrackArtist::selectedBrush

Definition at line 120 of file TrackArtist.h.

Referenced by SetColours().

◆ selectedPen

wxPen TrackArtist::selectedPen

Definition at line 128 of file TrackArtist.h.

Referenced by SetColours().

◆ selsampleBrush

wxBrush TrackArtist::selsampleBrush

Definition at line 122 of file TrackArtist.h.

Referenced by SetColours().

◆ selsamplePen

wxPen TrackArtist::selsamplePen

Definition at line 132 of file TrackArtist.h.

Referenced by SetColours().

◆ shadowPen

wxPen TrackArtist::shadowPen

Definition at line 136 of file TrackArtist.h.

Referenced by SetColours().

◆ unselectedBrush

wxBrush TrackArtist::unselectedBrush

Definition at line 119 of file TrackArtist.h.

Referenced by SetColours().

◆ unselectedPen

wxPen TrackArtist::unselectedPen

Definition at line 127 of file TrackArtist.h.

Referenced by SetColours().

The documentation for this class was generated from the following files:
int ShowClippingPrefsID()
Definition: GUIPrefs.cpp:277
void UpdateSelectedPrefs(int id) override
Definition: TrackArtist.cpp:283
wxPen clippedPen
Definition: TrackArtist.h:137
float mdBrange
Definition: TrackArtist.h:113
@ NPasses
Definition: TrackArtist.h:90
wxPen muteClippedPen
Definition: TrackArtist.h:138
FileConfig * gPrefs
Definition: Prefs.cpp:70
wxPen odProgressNotYetPen
Definition: TrackArtist.h:134
@ PassBorders
Definition: TrackArtist.h:83
@ PassSnapping
Definition: TrackArtist.h:88
void UpdatePrefs() override
Definition: TrackArtist.cpp:291
wxPen selectedPen
Definition: TrackArtist.h:128
int ShowTrackNameInWaveformPrefsID()
Definition: GUIPrefs.cpp:283
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...
Definition: TrackArtist.h:76
wxPen rmsPen
Definition: TrackArtist.h:130
wxPen muteRmsPen
Definition: TrackArtist.h:131
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:128
wxBrush unselectedBrush
Definition: TrackArtist.h:119
bool mShowClipping
Definition: TrackArtist.h:114
wxBrush dragsampleBrush
Definition: TrackArtist.h:123
wxBrush blankSelectedBrush
Definition: TrackArtist.h:125
wxPen shadowPen
Definition: TrackArtist.h:136
void SetBrushColour(wxBrush &Brush, int iIndex)
Definition: Theme.cpp:1204
const T & GetDefault() const
Definition: Prefs.h:120
wxBrush sampleBrush
Definition: TrackArtist.h:121
@ PassControls
Definition: TrackArtist.h:84
wxBrush blankBrush
Definition: TrackArtist.h:118
wxBrush selsampleBrush
Definition: TrackArtist.h:122
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
wxPen blankSelectedPen
Definition: TrackArtist.h:139
bool mbShowTrackNameInTrack
Definition: TrackArtist.h:116
void * pUserData
Definition: TrackPanelDrawingContext.h:27
TrackPanel * parent
Definition: TrackArtist.h:110
int mSampleDisplay
Definition: TrackArtist.h:115
void SetColours(int iColorIndex)
Definition: TrackArtist.cpp:84
static WaveTrackViewConstants::SampleDisplay SampleViewChoice()
Definition: TracksPrefs.cpp:196
@ PassZooming
Definition: TrackArtist.h:85
wxBrush selectedBrush
Definition: TrackArtist.h:120
@ PassTracks
Definition: TrackArtist.h:81
wxPen blankPen
Definition: TrackArtist.h:126
wxPen muteSamplePen
Definition: TrackArtist.h:133
Definition: Theme.cpp:203
wxPen selsamplePen
Definition: TrackArtist.h:132
wxPen samplePen
Definition: TrackArtist.h:129
@ PassMargins
Definition: TrackArtist.h:82
@ PassBackground
Definition: TrackArtist.h:86
void SetPenColour(wxPen &Pen, int iIndex)
Definition: Theme.cpp:1210
wxPen unselectedPen
Definition: TrackArtist.h:127
@ PassFocus
Definition: TrackArtist.h:87
wxPen odProgressDonePen
Definition: TrackArtist.h:135