| 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 |
|
| 13 |
WavePaintParameters& WavePaintParameters::SetDisplayParameters( |
| 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 |
|
| 25 |
WavePaintParameters& |
| 26 |
WavePaintParameters::SetDBParameters(double dbRange, bool dbScale) noexcept |
| 27 |
{ |
| 28 |
DBRange = dbRange; |
| 29 |
DBScale = dbScale; |
| 30 |
|
| 31 |
return *this; |
| 32 |
} |
| 33 |
|
| 34 |
WavePaintParameters& |
| 35 |
WavePaintParameters::SetBlankColor(graphics::Color color) noexcept |
| 36 |
{ |
| 37 |
BlankColor = color; |
| 38 |
|
| 39 |
return *this; |
| 40 |
} |
| 41 |
|
| 42 |
WavePaintParameters& WavePaintParameters::SetZeroLineColor(graphics::Color color) noexcept |
| 43 |
{ |
| 44 |
ZeroLineColor = color; |
| 45 |
return *this; |
| 46 |
} |
| 47 |
|
| 48 |
WavePaintParameters& WavePaintParameters::SetBackgroundColors( |
| 49 |
graphics::Color normal, graphics::Color selected) noexcept |
| 50 |
{ |
| 51 |
BackgroundColors = { normal, selected }; |
| 52 |
return *this; |
| 53 |
} |
| 54 |
|
| 55 |
WavePaintParameters& WavePaintParameters::SetSampleColors( |
| 56 |
graphics::Color normal, graphics::Color selected) noexcept |
| 57 |
{ |
| 58 |
SampleColors = { normal, selected }; |
| 59 |
return *this; |
| 60 |
} |
| 61 |
|
| 62 |
WavePaintParameters& WavePaintParameters::SetRMSColors( |
| 63 |
graphics::Color normal, graphics::Color selected) noexcept |
| 64 |
{ |
| 65 |
RMSColors = { normal, selected }; |
| 66 |
return *this; |
| 67 |
} |
| 68 |
|
| 69 |
WavePaintParameters& WavePaintParameters::SetClippingColors( |
| 70 |
graphics::Color normal, graphics::Color selected) noexcept |
| 71 |
{ |
| 72 |
ClippingColors = { normal, selected }; |
| 73 |
return *this; |
| 74 |
} |
| 75 |
|
| 76 |
WavePaintParameters& WavePaintParameters::SetEnvelopeColors( |
| 77 |
graphics::Color normal, graphics::Color selected) noexcept |
| 78 |
{ |
| 79 |
EnvelopeColors = { normal, selected }; |
| 80 |
return *this; |
| 81 |
} |
| 82 |
|
| 83 |
WavePaintParameters& |
| 84 |
WavePaintParameters::SetEnvelope(const Envelope& envelope) noexcept |
| 85 |
{ |
| 86 |
AttachedEnvelope = &envelope; |
| 87 |
return *this; |
| 88 |
} |
| 89 |
|
| 90 |
WavePaintParameters& WavePaintParameters::ResetEnvelope() noexcept |
| 91 |
{ |
| 92 |
AttachedEnvelope = nullptr; |
| 93 |
return *this; |
| 94 |
} |
| 95 |
|
| 96 |
WavePaintParameters& WavePaintParameters::SetShowRMS(bool showRMS) noexcept |
| 97 |
{ |
| 98 |
ShowRMS = showRMS; |
| 99 |
return *this; |
| 100 |
} |
| 101 |
|
| 102 |
WavePaintParameters& WavePaintParameters::SetDrawEnvelope(bool drawEnvelope) noexcept |
| 103 |
{ |
| 104 |
DrawEnvelope = drawEnvelope; |
| 105 |
return *this; |
| 106 |
} |
| 107 |
|
| 108 |
bool operator==(const ColorPair& lhs, const ColorPair& rhs) noexcept |
| 109 |
{ |
| 110 |
return lhs.Normal == rhs.Normal && lhs.Selected == rhs.Selected; |
| 111 |
} |
| 112 |
|
| 113 |
bool operator!=(const ColorPair& lhs, const ColorPair& rhs) noexcept |
| 114 |
{ |
| 115 |
return !(lhs == rhs); |
| 116 |
} |
| 117 |
|
| 118 |
bool operator==( |
| 119 |
const WavePaintParameters& lhs, |
| 120 |
const WavePaintParameters& rhs) noexcept |
| 121 |
{ |
| 122 |
return lhs.AttachedEnvelope == rhs.AttachedEnvelope && |
| 123 |
lhs.Height == rhs.Height && lhs.Min == rhs.Min && |
| 124 |
lhs.Max == rhs.Max && lhs.DBRange == rhs.DBRange && |
| 125 |
lhs.DBScale == rhs.DBScale && lhs.ShowClipping == rhs.ShowClipping && |
| 126 |
lhs.ShowRMS == rhs.ShowRMS && |
| 127 |
lhs.DrawEnvelope == rhs.DrawEnvelope && |
| 128 |
lhs.BlankColor == rhs.BlankColor && |
| 129 |
lhs.BackgroundColors == rhs.BackgroundColors && |
| 130 |
lhs.SampleColors == rhs.SampleColors && |
| 131 |
lhs.RMSColors == rhs.RMSColors && |
| 132 |
lhs.ClippingColors == rhs.ClippingColors && |
| 133 |
lhs.EnvelopeColors == rhs.EnvelopeColors; |
| 134 |
} |
| 135 |
|
| 136 |
bool operator!=( |
| 137 |
const WavePaintParameters& lhs, |
| 138 |
const WavePaintParameters& rhs) noexcept |
| 139 |
{ |
| 140 |
return !(lhs == rhs); |
| 141 |
} |