22 #include "base/Pitch.h" 37 int x0 = r.x(), y0 = r.y(), x1 = r.x() + r.width(), y1 = r.y() + r.height();
39 paint.drawLine(x0, y0, x0, y1);
41 int py = y1, ppy = y1;
42 paint.setBrush(paint.pen().color());
44 for (
int i = 0; i < 128; ++i) {
46 double f = Pitch::getFrequencyForPitch(i);
49 if (y < y0 - 2)
break;
58 QColor col = Qt::gray;
61 col = col.lighter(150);
64 paint.fillRect(x0 + 1,
72 if (n == 1 || n == 3 || n == 6 || n == 8 || n == 10) {
74 paint.drawLine(x0 + 1, y, x1, y);
75 int rh = ((py - y) / 4) * 2;
77 paint.drawRect(x0 + 1, y - (py-y)/4, (x1 - x0) / 2, rh);
78 }
else if (n == 0 || n == 5) {
81 paint.drawLine(x0 + 1, (y + py) / 2, x1, (y + py) / 2);
96 int x0 = r.x(), y0 = r.y(), x1 = r.x() + r.width(), y1 = r.y() + r.height();
98 paint.drawLine(x0, y0, x1, y0);
100 int px = x0, ppx = x0;
101 paint.setBrush(paint.pen().color());
103 for (
int i = 0; i < 128; ++i) {
105 double f = Pitch::getFrequencyForPitch(i);
129 QColor col = Qt::gray;
132 col = col.lighter(150);
135 paint.fillRect((px + ppx) / 2 + 1,
137 x - (px + ppx) / 2 - 1,
143 if (n == 1 || n == 3 || n == 6 || n == 8 || n == 10) {
145 paint.drawLine(x, y0, x, y1);
146 int rw = int(lrint(
double(x - px) / 4) * 2);
148 paint.drawRect(x - rw/2, (y0 + y1) / 2, rw, (y1 - y0) / 2);
149 }
else if (n == 0 || n == 5) {
152 paint.drawLine((x + px) / 2, y0, (x + px) / 2, y1);
Interface for classes that provide geometry information (such as size, start frame, and a large number of other properties) about the disposition of a layer.
virtual double getYForFrequency(double frequency, double minFreq, double maxFreq, bool logarithmic) const =0
Return the (maybe fractional) pixel y-coordinate corresponding to a given frequency, if the frequency range is as specified.
void paintPianoVertical(LayerGeometryProvider *v, QPainter &paint, QRect rect, double minf, double maxf)
void paintPianoHorizontal(LayerGeometryProvider *v, const HorizontalScaleProvider *p, QPainter &paint, QRect rect)
virtual double getXForFrequency(const LayerGeometryProvider *, double freq) const =0
Interface to be implemented by objects, such as layers or objects they delegate to, in which the X axis corresponds to frequency.