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 graphics::Color normal, graphics::Color selected) noexcept
44{
45 BackgroundColors = { normal, selected };
46 return *this;
47}
48
50 graphics::Color normal, graphics::Color selected) noexcept
51{
52 SampleColors = { normal, selected };
53 return *this;
54}
55
57 graphics::Color normal, graphics::Color selected) noexcept
58{
59 RMSColors = { normal, selected };
60 return *this;
61}
62
64 graphics::Color normal, graphics::Color selected) noexcept
65{
66 ClippingColors = { normal, selected };
67 return *this;
68}
69
72{
73 AttachedEnvelope = &envelope;
74 return *this;
75}
76
78{
79 AttachedEnvelope = nullptr;
80 return *this;
81}
82
84{
85 ShowRMS = showRMS;
86 return *this;
87}
88
89bool operator==(const ColorPair& lhs, const ColorPair& rhs) noexcept
90{
91 return lhs.Normal == rhs.Normal && lhs.Selected == rhs.Selected;
92}
93
94bool operator!=(const ColorPair& lhs, const ColorPair& rhs) noexcept
95{
96 return !(lhs == rhs);
97}
98
100 const WavePaintParameters& lhs,
101 const WavePaintParameters& rhs) noexcept
102{
103 return lhs.AttachedEnvelope == rhs.AttachedEnvelope &&
104 lhs.Height == rhs.Height && lhs.Min == rhs.Min &&
105 lhs.Max == rhs.Max && lhs.DBRange == rhs.DBRange &&
106 lhs.DBScale == rhs.DBScale && lhs.ShowClipping == rhs.ShowClipping &&
107 lhs.BlankColor == rhs.BlankColor &&
108 lhs.BackgroundColors == rhs.BackgroundColors &&
109 lhs.SampleColors == rhs.SampleColors &&
110 lhs.RMSColors == rhs.RMSColors &&
111 lhs.ClippingColors == rhs.ClippingColors;
112}
113
115 const WavePaintParameters& lhs,
116 const WavePaintParameters& rhs) noexcept
117{
118 return !(lhs == rhs);
119}
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 & 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