Audacity 3.2.0
WavePaintParameters.cpp
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 WavePaintParameters.cpp
7
8 Dmitry Vedenko
9
10**********************************************************************/
11#include "WavePaintParameters.h"
12
14 int height, double zoomMin, double zoomMax, bool showClipping) noexcept
15{
16 Height = height;
17 Min = zoomMin;
18 Max = zoomMax;
19
20 ShowClipping = showClipping;
21
22 return *this;
23}
24
26WavePaintParameters::SetDBParameters(double dbRange, bool dbScale) noexcept
27{
28 DBRange = dbRange;
29 DBScale = dbScale;
30
31 return *this;
32}
33
36{
37 BlankColor = color;
38
39 return *this;
40}
41
43{
44 ZeroLineColor = color;
45 return *this;
46}
47
49 graphics::Color normal, graphics::Color selected) noexcept
50{
51 BackgroundColors = { normal, selected };
52 return *this;
53}
54
56 graphics::Color normal, graphics::Color selected) noexcept
57{
58 SampleColors = { normal, selected };
59 return *this;
60}
61
63 graphics::Color normal, graphics::Color selected) noexcept
64{
65 RMSColors = { normal, selected };
66 return *this;
67}
68
70 graphics::Color normal, graphics::Color selected) noexcept
71{
72 ClippingColors = { normal, selected };
73 return *this;
74}
75
78{
79 AttachedEnvelope = &envelope;
80 return *this;
81}
82
84{
85 AttachedEnvelope = nullptr;
86 return *this;
87}
88
90{
91 ShowRMS = showRMS;
92 return *this;
93}
94
95bool operator==(const ColorPair& lhs, const ColorPair& rhs) noexcept
96{
97 return lhs.Normal == rhs.Normal && lhs.Selected == rhs.Selected;
98}
99
100bool operator!=(const ColorPair& lhs, const ColorPair& rhs) noexcept
101{
102 return !(lhs == rhs);
103}
104
106 const WavePaintParameters& lhs,
107 const WavePaintParameters& rhs) noexcept
108{
109 return lhs.AttachedEnvelope == rhs.AttachedEnvelope &&
110 lhs.Height == rhs.Height && lhs.Min == rhs.Min &&
111 lhs.Max == rhs.Max && lhs.DBRange == rhs.DBRange &&
112 lhs.DBScale == rhs.DBScale && lhs.ShowClipping == rhs.ShowClipping &&
113 lhs.ShowRMS == rhs.ShowRMS &&
114 lhs.BlankColor == rhs.BlankColor &&
115 lhs.BackgroundColors == rhs.BackgroundColors &&
116 lhs.SampleColors == rhs.SampleColors &&
117 lhs.RMSColors == rhs.RMSColors &&
118 lhs.ClippingColors == rhs.ClippingColors;
119}
120
122 const WavePaintParameters& lhs,
123 const WavePaintParameters& rhs) noexcept
124{
125 return !(lhs == rhs);
126}
bool operator!=(const ColorPair &lhs, const ColorPair &rhs) noexcept
bool operator==(const ColorPair &lhs, const ColorPair &rhs) noexcept
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:72
Pair of colors for waveform painting.
Parameters for the waveform painting.
const Envelope * AttachedEnvelope
Attached volume envelope, if any.
WavePaintParameters & SetBlankColor(graphics::Color color) noexcept
Sets the blank color.
WavePaintParameters & SetShowRMS(bool showRMS) noexcept
Sets the ShowRMS flag.
WavePaintParameters & ResetEnvelope() noexcept
Resets the envelope.
WavePaintParameters & SetBackgroundColors(graphics::Color normal, graphics::Color selected) noexcept
Sets the background colors.
WavePaintParameters & SetZeroLineColor(graphics::Color color) noexcept
Sets the horizontal zero line color.
WavePaintParameters & SetDBParameters(double dbRange, bool dbScale) noexcept
Sets the dB scale parameters.
WavePaintParameters & SetClippingColors(graphics::Color normal, graphics::Color selected) noexcept
Sets the clipping colors.
WavePaintParameters & SetSampleColors(graphics::Color normal, graphics::Color selected) noexcept
Sets the sample colors.
WavePaintParameters & SetDisplayParameters(int height, double zoomMin, double zoomMax, bool showClipping) noexcept
Sets the basic painting parameters.
WavePaintParameters & SetEnvelope(const Envelope &envelope) noexcept
Sets volume envelope.
WavePaintParameters & SetRMSColors(graphics::Color normal, graphics::Color selected) noexcept
Sets the RMS colors.
Class for storing color in 32-bit format.
Definition: Color.h:29