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:
[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
 
const SelectedRegionpSelectedRegion {}
 
ZoomInfopZoomInfo {}
 
bool drawEnvelope { false }
 
bool bigPoints { false }
 
bool drawSliders { false }
 
bool hasSolo { false }
 

Additional Inherited Members

- Private Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 

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 58 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 62 of file TrackArtist.h.

62  : unsigned {
63  PassTracks,
69  PassFocus,
71 
72  NPasses
73  };

Constructor & Destructor Documentation

◆ TrackArtist()

TrackArtist::TrackArtist ( TrackPanel parent_)

Definition at line 59 of file TrackArtist.cpp.

60  : parent( parent_ )
61 {
63  mShowClipping = false;
64  mSampleDisplay = 1;// Stem plots by default.
65 
66  SetColours(0);
67 
68  UpdatePrefs();
69 }

References ENV_DB_RANGE, mdBrange, mSampleDisplay, mShowClipping, SetColours(), and UpdatePrefs().

Here is the call graph for this function:

◆ ~TrackArtist()

TrackArtist::~TrackArtist ( )

Definition at line 71 of file TrackArtist.cpp.

72 {
73 }

Member Function Documentation

◆ Get()

TrackArtist * TrackArtist::Get ( TrackPanelDrawingContext context)
static

◆ SetBackgroundBrushes()

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

Definition at line 79 of file TrackArtist.h.

80  {
81  this->unselectedBrush = unselectedBrushIn;
82  this->selectedBrush = selectedBrushIn;
83  this->unselectedPen = unselectedPenIn;
84  this->selectedPen = selectedPenIn;
85  }

Referenced by AudacityPrintout::OnPrintPage().

Here is the caller graph for this function:

◆ SetColours()

void TrackArtist::SetColours ( int  iColorIndex)

Definition at line 80 of file TrackArtist.cpp.

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

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

Implements PrefsListener.

Definition at line 252 of file TrackArtist.cpp.

References ENV_DB_KEY, gPrefs, mdBrange, mSampleDisplay, 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 244 of file TrackArtist.cpp.

245 {
246  if( id == ShowClippingPrefsID())
247  mShowClipping = gPrefs->Read(wxT("/GUI/ShowClipping"), mShowClipping);
248  if( id == ShowTrackNameInWaveformPrefsID())
249  mbShowTrackNameInTrack = gPrefs->ReadBool(wxT("/GUI/ShowTrackNameInWaveform"), false);
250 }

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 138 of file TrackArtist.h.

◆ blankBrush

wxBrush TrackArtist::blankBrush

Definition at line 100 of file TrackArtist.h.

Referenced by SetColours().

◆ blankPen

wxPen TrackArtist::blankPen

Definition at line 108 of file TrackArtist.h.

Referenced by SetColours().

◆ blankSelectedBrush

wxBrush TrackArtist::blankSelectedBrush

Definition at line 107 of file TrackArtist.h.

Referenced by SetColours().

◆ blankSelectedPen

wxPen TrackArtist::blankSelectedPen

Definition at line 121 of file TrackArtist.h.

Referenced by SetColours().

◆ clippedPen

wxPen TrackArtist::clippedPen

Definition at line 119 of file TrackArtist.h.

Referenced by SetColours().

◆ dragsampleBrush

wxBrush TrackArtist::dragsampleBrush

Definition at line 105 of file TrackArtist.h.

Referenced by SetColours().

◆ drawEnvelope

bool TrackArtist::drawEnvelope { false }

Definition at line 137 of file TrackArtist.h.

◆ drawSliders

bool TrackArtist::drawSliders { false }

Definition at line 139 of file TrackArtist.h.

◆ hasSolo

bool TrackArtist::hasSolo { false }

Definition at line 140 of file TrackArtist.h.

◆ mbShowTrackNameInTrack

bool TrackArtist::mbShowTrackNameInTrack

Definition at line 98 of file TrackArtist.h.

Referenced by UpdateSelectedPrefs().

◆ mdBrange

float TrackArtist::mdBrange

Definition at line 95 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdatePrefs().

◆ mSampleDisplay

int TrackArtist::mSampleDisplay

Definition at line 97 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdatePrefs().

◆ mShowClipping

bool TrackArtist::mShowClipping

Definition at line 96 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdateSelectedPrefs().

◆ muteClippedPen

wxPen TrackArtist::muteClippedPen

Definition at line 120 of file TrackArtist.h.

Referenced by SetColours().

◆ muteRmsPen

wxPen TrackArtist::muteRmsPen

Definition at line 113 of file TrackArtist.h.

Referenced by SetColours().

◆ muteSampleBrush

wxBrush TrackArtist::muteSampleBrush

Definition at line 106 of file TrackArtist.h.

◆ muteSamplePen

wxPen TrackArtist::muteSamplePen

Definition at line 115 of file TrackArtist.h.

Referenced by SetColours().

◆ odProgressDonePen

wxPen TrackArtist::odProgressDonePen

Definition at line 117 of file TrackArtist.h.

Referenced by SetColours().

◆ odProgressNotYetPen

wxPen TrackArtist::odProgressNotYetPen

Definition at line 116 of file TrackArtist.h.

Referenced by SetColours().

◆ parent

TrackPanel* TrackArtist::parent

Definition at line 92 of file TrackArtist.h.

◆ pSelectedRegion

const SelectedRegion* TrackArtist::pSelectedRegion {}

Definition at line 134 of file TrackArtist.h.

Referenced by AudacityPrintout::OnPrintPage().

◆ pZoomInfo

ZoomInfo* TrackArtist::pZoomInfo {}

Definition at line 135 of file TrackArtist.h.

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

◆ rmsPen

wxPen TrackArtist::rmsPen

Definition at line 112 of file TrackArtist.h.

Referenced by SetColours().

◆ sampleBrush

wxBrush TrackArtist::sampleBrush

Definition at line 103 of file TrackArtist.h.

Referenced by SetColours().

◆ samplePen

wxPen TrackArtist::samplePen

Definition at line 111 of file TrackArtist.h.

Referenced by SetColours().

◆ selectedBrush

wxBrush TrackArtist::selectedBrush

Definition at line 102 of file TrackArtist.h.

Referenced by SetColours().

◆ selectedPen

wxPen TrackArtist::selectedPen

Definition at line 110 of file TrackArtist.h.

Referenced by SetColours().

◆ selsampleBrush

wxBrush TrackArtist::selsampleBrush

Definition at line 104 of file TrackArtist.h.

Referenced by SetColours().

◆ selsamplePen

wxPen TrackArtist::selsamplePen

Definition at line 114 of file TrackArtist.h.

Referenced by SetColours().

◆ shadowPen

wxPen TrackArtist::shadowPen

Definition at line 118 of file TrackArtist.h.

Referenced by SetColours().

◆ unselectedBrush

wxBrush TrackArtist::unselectedBrush

Definition at line 101 of file TrackArtist.h.

Referenced by SetColours().

◆ unselectedPen

wxPen TrackArtist::unselectedPen

Definition at line 109 of file TrackArtist.h.

Referenced by SetColours().


The documentation for this class was generated from the following files:
ShowClippingPrefsID
int ShowClippingPrefsID()
Definition: GUIPrefs.cpp:277
TrackArtist::UpdateSelectedPrefs
void UpdateSelectedPrefs(int id) override
Definition: TrackArtist.cpp:244
TrackArtist::clippedPen
wxPen clippedPen
Definition: TrackArtist.h:119
TrackArtist::mdBrange
float mdBrange
Definition: TrackArtist.h:95
TrackArtist::NPasses
@ NPasses
Definition: TrackArtist.h:72
TrackArtist::muteClippedPen
wxPen muteClippedPen
Definition: TrackArtist.h:120
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:68
ENV_DB_RANGE
#define ENV_DB_RANGE
Definition: GUISettings.h:16
TrackArtist::odProgressNotYetPen
wxPen odProgressNotYetPen
Definition: TrackArtist.h:116
TrackArtist::PassBorders
@ PassBorders
Definition: TrackArtist.h:65
TrackArtist::PassSnapping
@ PassSnapping
Definition: TrackArtist.h:70
TrackArtist::UpdatePrefs
void UpdatePrefs() override
Definition: TrackArtist.cpp:252
TrackArtist::selectedPen
wxPen selectedPen
Definition: TrackArtist.h:110
ShowTrackNameInWaveformPrefsID
int ShowTrackNameInWaveformPrefsID()
Definition: GUIPrefs.cpp:283
TrackArtist
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...
Definition: TrackArtist.h:58
TrackArtist::rmsPen
wxPen rmsPen
Definition: TrackArtist.h:112
TrackArtist::muteRmsPen
wxPen muteRmsPen
Definition: TrackArtist.h:113
TrackArtist::unselectedBrush
wxBrush unselectedBrush
Definition: TrackArtist.h:101
TrackArtist::mShowClipping
bool mShowClipping
Definition: TrackArtist.h:96
TrackArtist::dragsampleBrush
wxBrush dragsampleBrush
Definition: TrackArtist.h:105
TrackArtist::blankSelectedBrush
wxBrush blankSelectedBrush
Definition: TrackArtist.h:107
TrackArtist::shadowPen
wxPen shadowPen
Definition: TrackArtist.h:118
ThemeBase::SetBrushColour
void SetBrushColour(wxBrush &Brush, int iIndex)
Definition: Theme.cpp:1200
TrackArtist::sampleBrush
wxBrush sampleBrush
Definition: TrackArtist.h:103
TrackArtist::PassControls
@ PassControls
Definition: TrackArtist.h:66
ENV_DB_KEY
#define ENV_DB_KEY
Definition: GUISettings.h:15
TrackArtist::blankBrush
wxBrush blankBrush
Definition: TrackArtist.h:100
TrackArtist::selsampleBrush
wxBrush selsampleBrush
Definition: TrackArtist.h:104
TrackArtist::blankSelectedPen
wxPen blankSelectedPen
Definition: TrackArtist.h:121
TrackArtist::mbShowTrackNameInTrack
bool mbShowTrackNameInTrack
Definition: TrackArtist.h:98
TrackPanelDrawingContext::pUserData
void * pUserData
Definition: TrackPanelDrawingContext.h:27
TrackArtist::parent
TrackPanel * parent
Definition: TrackArtist.h:92
TrackArtist::mSampleDisplay
int mSampleDisplay
Definition: TrackArtist.h:97
TrackArtist::SetColours
void SetColours(int iColorIndex)
Definition: TrackArtist.cpp:80
TracksPrefs::SampleViewChoice
static WaveTrackViewConstants::SampleDisplay SampleViewChoice()
Definition: TracksPrefs.cpp:196
TrackArtist::PassZooming
@ PassZooming
Definition: TrackArtist.h:67
TrackArtist::selectedBrush
wxBrush selectedBrush
Definition: TrackArtist.h:102
TrackArtist::PassTracks
@ PassTracks
Definition: TrackArtist.h:63
TrackArtist::blankPen
wxPen blankPen
Definition: TrackArtist.h:108
TrackArtist::muteSamplePen
wxPen muteSamplePen
Definition: TrackArtist.h:115
theTheme
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:202
TrackArtist::selsamplePen
wxPen selsamplePen
Definition: TrackArtist.h:114
TrackArtist::samplePen
wxPen samplePen
Definition: TrackArtist.h:111
TrackArtist::PassMargins
@ PassMargins
Definition: TrackArtist.h:64
TrackArtist::PassBackground
@ PassBackground
Definition: TrackArtist.h:68
ThemeBase::SetPenColour
void SetPenColour(wxPen &Pen, int iIndex)
Definition: Theme.cpp:1206
TrackArtist::unselectedPen
wxPen unselectedPen
Definition: TrackArtist.h:109
TrackArtist::PassFocus
@ PassFocus
Definition: TrackArtist.h:69
TrackArtist::odProgressDonePen
wxPen odProgressDonePen
Definition: TrackArtist.h:117