comparison layer/SpectrumLayer.cpp @ 1231:ff97318e993c

Scale piano keyboard height according to text size
author Chris Cannam
date Thu, 26 Jan 2017 21:18:28 +0000
parents 1badacff7ab2
children 4d0ca1ab4cd0
comparison
equal deleted inserted replaced
1230:366ffdf719cd 1231:ff97318e993c
666 double thresh = (pow(10, -6) / m_gain) * (m_windowSize / 2.0); // -60dB adj 666 double thresh = (pow(10, -6) / m_gain) * (m_windowSize / 2.0); // -60dB adj
667 667
668 int xorigin = getVerticalScaleWidth(v, false, paint) + 1; 668 int xorigin = getVerticalScaleWidth(v, false, paint) + 1;
669 int w = v->getPaintWidth() - xorigin - 1; 669 int w = v->getPaintWidth() - xorigin - 1;
670 670
671 int pkh = 0; 671 int pkh = int(paint.fontMetrics().height() * 0.7 + 0.5);
672 //!!! if (m_binScale == LogBins) { 672 if (pkh < 10) pkh = 10;
673 pkh = 10;
674 //!!! }
675 673
676 paint.save(); 674 paint.save();
677 675
678 if (fft && m_showPeaks) { 676 if (fft && m_showPeaks) {
679 677
747 745
748 // int pkh = 10; 746 // int pkh = 10;
749 int h = v->getPaintHeight(); 747 int h = v->getPaintHeight();
750 748
751 // piano keyboard 749 // piano keyboard
752 //!!! should be in a new paintHorizontalScale()? 750
753 // nice to have a piano keyboard class, of course 751 //!!! todo: move to PianoScale::paintPianoHorizontal
754 752
755 paint.drawLine(xorigin, h - pkh - 1, w + xorigin, h - pkh - 1); 753 paint.drawLine(xorigin, h - pkh - 1, w + xorigin, h - pkh - 1);
756 754
757 int px = xorigin, ppx = xorigin; 755 int px = xorigin, ppx = xorigin;
758 paint.setBrush(paint.pen().color()); 756 paint.setBrush(paint.pen().color());
759 757