changeset 1553:76e4302a3fc2

Fix note numbering - ensure stable across whole track (as it used to be, but without scanning all notes in paint in order to do that)
author Chris Cannam
date Fri, 22 Nov 2019 14:12:50 +0000
parents 045063dcd2bc
children a0b2f3b4dd2f 1f80a514ce29
files layer/FlexiNoteLayer.cpp
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/layer/FlexiNoteLayer.cpp	Thu Nov 21 14:03:19 2019 +0000
+++ b/layer/FlexiNoteLayer.cpp	Fri Nov 22 14:12:50 2019 +0000
@@ -824,15 +824,20 @@
 
     paint.save();
     paint.setRenderHint(QPainter::Antialiasing, false);
-    
-    int noteNumber = 0;
+
+    int noteNumber = -1;
 
     for (EventVector::const_iterator i = points.begin();
          i != points.end(); ++i) {
 
-        ++noteNumber;
         const Event &p(*i);
 
+        if (noteNumber < 0) {
+            noteNumber = model->getIndexForEvent(p);
+        } else {
+            noteNumber ++;
+        }
+
         int x = v->getXForFrame(p.getFrame());
         int y = getYForValue(v, p.getValue());
         int w = v->getXForFrame(p.getFrame() + p.getDuration()) - x;