comparison layer/NoteLayer.cpp @ 1315:1d7921b1852f

Ensure scale appears for layer when drawn in AutoAlign mode without any other layer present to align to
author Chris Cannam
date Wed, 04 Jul 2018 15:34:16 +0100
parents a34a2a25907c
children c39f2d439d59
comparison
equal deleted inserted replaced
1314:769d7890203b 1315:1d7921b1852f
59 m_editingCommand(0), 59 m_editingCommand(0),
60 m_verticalScale(AutoAlignScale), 60 m_verticalScale(AutoAlignScale),
61 m_scaleMinimum(0), 61 m_scaleMinimum(0),
62 m_scaleMaximum(0) 62 m_scaleMaximum(0)
63 { 63 {
64 SVDEBUG << "constructed NoteLayer" << endl; 64 SVDEBUG << "constructed NoteLayer" << endl;
65 } 65 }
66 66
67 void 67 void
68 NoteLayer::setModel(NoteModel *model) 68 NoteLayer::setModel(NoteModel *model)
69 { 69 {
831 } 831 }
832 832
833 int 833 int
834 NoteLayer::getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &paint) const 834 NoteLayer::getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &paint) const
835 { 835 {
836 if (!m_model || shouldAutoAlign()) { 836 if (!m_model) {
837 return 0; 837 return 0;
838 } else { 838 }
839 if (m_verticalScale == LogScale || m_verticalScale == MIDIRangeScale) { 839
840 return LogNumericalScale().getWidth(v, paint) + 10; // for piano 840 if (shouldAutoAlign() && !valueExtentsMatchMine(v)) {
841 } else { 841 return 0;
842 return LinearNumericalScale().getWidth(v, paint); 842 }
843 } 843
844 if (m_verticalScale == LogScale || m_verticalScale == MIDIRangeScale) {
845 return LogNumericalScale().getWidth(v, paint) + 10; // for piano
846 } else {
847 return LinearNumericalScale().getWidth(v, paint);
844 } 848 }
845 } 849 }
846 850
847 void 851 void
848 NoteLayer::paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect) const 852 NoteLayer::paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect) const