# HG changeset patch # User Chris Cannam # Date 1386093337 0 # Node ID 4dcf10bd28639af038f9ad30fbf71bd0d7fa827f # Parent 5674950ed82ab54fb0cbe7f3387c824f4d384d01 Add piano scale to note layer as well (need to handle the auto-align case properly) diff -r 5674950ed82a -r 4dcf10bd2863 layer/NoteLayer.cpp --- a/layer/NoteLayer.cpp Tue Dec 03 17:48:46 2013 +0000 +++ b/layer/NoteLayer.cpp Tue Dec 03 17:55:37 2013 +0000 @@ -23,6 +23,7 @@ #include "base/RangeMapper.h" #include "ColourDatabase.h" #include "view/View.h" +#include "PianoScale.h" #include "data/model/NoteModel.h" @@ -813,6 +814,22 @@ paint.restore(); } +int +NoteLayer::getVerticalScaleWidth(View *, bool, QPainter &paint) const +{ + return 10; +} + +void +NoteLayer::paintVerticalScale(View *v, bool, QPainter &paint, QRect) const +{ + float fmin, fmax; + getDisplayExtents(fmin, fmax); + PianoScale().paintPianoVertical + (v, paint, QRect(0, 0, 10, v->height()), fmin, fmax); + paint.drawLine(10, 0, 10, v->height()); +} + void NoteLayer::drawStart(View *v, QMouseEvent *e) { diff -r 5674950ed82a -r 4dcf10bd2863 layer/NoteLayer.h --- a/layer/NoteLayer.h Tue Dec 03 17:48:46 2013 +0000 +++ b/layer/NoteLayer.h Tue Dec 03 17:55:37 2013 +0000 @@ -34,6 +34,9 @@ virtual void paint(View *v, QPainter &paint, QRect rect) const; + virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const; + virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; + virtual QString getFeatureDescription(View *v, QPoint &) const; virtual bool snapToFeatureFrame(View *v, int &frame, @@ -102,8 +105,6 @@ virtual void setVerticalZoomStep(int); virtual RangeMapper *getNewVerticalZoomRangeMapper() const; - virtual int getVerticalScaleWidth(View *, bool, QPainter &) const { return 0; } - /** * Add a note-on. Used when recording MIDI "live". The note will * not be finally added to the layer until the corresponding