Audacity  3.0.3
TrackArtist.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  TrackArtist.h
6 
7  Dominic Mazzoni
8 
9  This singleton class handles the actual rendering of WaveTracks
10  (both waveforms and spectra), NoteTracks, and LabelTracks.
11 
12  It's actually a little harder than it looks, because for
13  waveforms at least it needs to cache the samples that are
14  currently on-screen.
15 
16 **********************************************************************/
17 
18 #ifndef __AUDACITY_TRACKARTIST__
19 #define __AUDACITY_TRACKARTIST__
20 
21 
22 
23 
24 #include <wx/brush.h> // member variable
25 #include <wx/pen.h> // member variables
26 
27 #include "Prefs.h"
28 
29 class wxRect;
30 
31 class TrackList;
32 class TrackPanel;
33 class SelectedRegion;
34 class Track;
35 class TrackPanel;
37 class ZoomInfo;
38 
39 namespace TrackArt {
40 
41  // Helper: draws the "sync-locked" watermark tiled to a rectangle
42  AUDACITY_DLL_API
43  void DrawSyncLockTiles(
44  TrackPanelDrawingContext &context, const wxRect &rect );
45 
46  // Helper: draws background with selection rect
47  AUDACITY_DLL_API
49  const wxRect &rect, const Track *track,
50  const wxBrush &selBrush, const wxBrush &unselBrush,
51  bool useSelection = true);
52 
53  AUDACITY_DLL_API
55  const wxRect & rect );
56 }
57 
58 class AUDACITY_DLL_API TrackArtist final : private PrefsListener {
59 
60 public:
61 
62  enum : unsigned {
71 
72  NPasses
73  };
74 
75  TrackArtist( TrackPanel *parent_ );
76  ~TrackArtist();
77  static TrackArtist *Get( TrackPanelDrawingContext & );
78 
79  void SetBackgroundBrushes(wxBrush unselectedBrushIn, wxBrush selectedBrushIn,
80  wxPen unselectedPenIn, wxPen selectedPenIn) {
81  this->unselectedBrush = unselectedBrushIn;
82  this->selectedBrush = selectedBrushIn;
83  this->unselectedPen = unselectedPenIn;
84  this->selectedPen = selectedPenIn;
85  }
86 
87  void SetColours(int iColorIndex);
88 
89  void UpdatePrefs() override;
90  void UpdateSelectedPrefs( int id ) override;
91 
93 
94  // Preference values
95  float mdBrange; // "/GUI/EnvdBRange"
96  bool mShowClipping; // "/GUI/ShowClipping"
98  bool mbShowTrackNameInTrack; // "/GUI/ShowTrackNameInWaveform"
99 
100  wxBrush blankBrush;
102  wxBrush selectedBrush;
103  wxBrush sampleBrush;
104  wxBrush selsampleBrush;
105  wxBrush dragsampleBrush;// for samples which are draggable.
108  wxPen blankPen;
110  wxPen selectedPen;
111  wxPen samplePen;
112  wxPen rmsPen;
113  wxPen muteRmsPen;
118  wxPen shadowPen;
119  wxPen clippedPen;
122 
123 #ifdef EXPERIMENTAL_FFT_Y_GRID
124  bool fftYGridOld;
125 #endif //EXPERIMENTAL_FFT_Y_GRID
126 
127 #ifdef EXPERIMENTAL_FIND_NOTES
128  bool fftFindNotesOld;
129  int findNotesMinAOld;
130  int findNotesNOld;
131  bool findNotesQuantizeOld;
132 #endif
133 
134  const SelectedRegion *pSelectedRegion{};
135  ZoomInfo *pZoomInfo{};
136 
137  bool drawEnvelope{ false };
138  bool bigPoints{ false };
139  bool drawSliders{ false };
140  bool hasSolo{ false };
141 };
142 
143 extern AUDACITY_DLL_API int GetWaveYPos(float value, float min, float max,
144  int height, bool dB, bool outer, float dBr,
145  bool clip);
146 extern float FromDB(float value, double dBRange);
147 extern AUDACITY_DLL_API float ValueOfPixel(int yy, int height, bool offset,
148  bool dB, double dBRange, float zoomMin, float zoomMax);
149 
150 #endif // define __AUDACITY_TRACKARTIST__
TrackArtist::clippedPen
wxPen clippedPen
Definition: TrackArtist.h:119
outer
static const wxPoint2DDouble outer[]
Definition: ASlider.cpp:395
TrackArtist::mdBrange
float mdBrange
Definition: TrackArtist.h:95
TrackArtist::muteClippedPen
wxPen muteClippedPen
Definition: TrackArtist.h:120
TrackArtist::odProgressNotYetPen
wxPen odProgressNotYetPen
Definition: TrackArtist.h:116
ZoomInfo
Definition: ZoomInfo.h:47
TrackArtist::PassBorders
@ PassBorders
Definition: TrackArtist.h:65
TrackPanelDrawingContext
Definition: TrackPanelDrawingContext.h:22
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1263
TrackArtist::PassSnapping
@ PassSnapping
Definition: TrackArtist.h:70
GetWaveYPos
AUDACITY_DLL_API int GetWaveYPos(float value, float min, float max, int height, bool dB, bool outer, float dBr, bool clip)
Definition: TrackArtist.cpp:132
TrackArtist::selectedPen
wxPen selectedPen
Definition: TrackArtist.h:110
ValueOfPixel
AUDACITY_DLL_API float ValueOfPixel(int yy, int height, bool offset, bool dB, double dBRange, float zoomMin, float zoomMax)
Definition: TrackArtist.cpp:188
TrackArtist
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...
Definition: TrackArtist.h:58
TrackPanel
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:64
TrackArtist::rmsPen
wxPen rmsPen
Definition: TrackArtist.h:112
TrackArtist::muteRmsPen
wxPen muteRmsPen
Definition: TrackArtist.h:113
PrefsListener
Definition: Prefs.h:388
TrackArt::DrawSyncLockTiles
AUDACITY_DLL_API void DrawSyncLockTiles(TrackPanelDrawingContext &context, const wxRect &rect)
Definition: TrackArtist.cpp:276
PrefsListener::UpdateSelectedPrefs
virtual void UpdateSelectedPrefs(int id)
Definition: Prefs.cpp:100
FromDB
float FromDB(float value, double dBRange)
Definition: TrackArtist.cpp:179
TrackArtist::unselectedBrush
wxBrush unselectedBrush
Definition: TrackArtist.h:101
TrackArtist::mShowClipping
bool mShowClipping
Definition: TrackArtist.h:96
TrackArt::DrawNegativeOffsetTrackArrows
AUDACITY_DLL_API void DrawNegativeOffsetTrackArrows(TrackPanelDrawingContext &context, const wxRect &rect)
Definition: TrackArtist.cpp:209
TrackArtist::dragsampleBrush
wxBrush dragsampleBrush
Definition: TrackArtist.h:105
TrackArtist::blankSelectedBrush
wxBrush blankSelectedBrush
Definition: TrackArtist.h:107
TrackArtist::shadowPen
wxPen shadowPen
Definition: TrackArtist.h:118
TrackArtist::sampleBrush
wxBrush sampleBrush
Definition: TrackArtist.h:103
TrackArtist::PassControls
@ PassControls
Definition: TrackArtist.h:66
TrackArt
Definition: TrackArtist.h:39
TrackArtist::blankBrush
wxBrush blankBrush
Definition: TrackArtist.h:100
TrackArtist::selsampleBrush
wxBrush selsampleBrush
Definition: TrackArtist.h:104
TrackArtist::muteSampleBrush
wxBrush muteSampleBrush
Definition: TrackArtist.h:106
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
TrackArtist::blankSelectedPen
wxPen blankSelectedPen
Definition: TrackArtist.h:121
TrackArtist::mbShowTrackNameInTrack
bool mbShowTrackNameInTrack
Definition: TrackArtist.h:98
TrackArt::DrawBackgroundWithSelection
AUDACITY_DLL_API void DrawBackgroundWithSelection(TrackPanelDrawingContext &context, const wxRect &rect, const Track *track, const wxBrush &selBrush, const wxBrush &unselBrush, bool useSelection=true)
Definition: TrackArtist.cpp:386
TrackArtist::parent
TrackPanel * parent
Definition: TrackArtist.h:92
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:238
TrackArtist::mSampleDisplay
int mSampleDisplay
Definition: TrackArtist.h:97
TrackArtist::SetBackgroundBrushes
void SetBackgroundBrushes(wxBrush unselectedBrushIn, wxBrush selectedBrushIn, wxPen unselectedPenIn, wxPen selectedPenIn)
Definition: TrackArtist.h:79
TrackArtist::PassZooming
@ PassZooming
Definition: TrackArtist.h:67
PrefsListener::UpdatePrefs
virtual void UpdatePrefs()=0
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
Prefs.h
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
TrackArtist::unselectedPen
wxPen unselectedPen
Definition: TrackArtist.h:109
TrackArtist::PassFocus
@ PassFocus
Definition: TrackArtist.h:69
TrackArtist::odProgressDonePen
wxPen odProgressDonePen
Definition: TrackArtist.h:117
SelectedRegion
Defines a selected portion of a project.
Definition: SelectedRegion.h:38