diff layer/NoteLayer.cpp @ 1423:62e908518c71 single-point

Update to Event api in place of Clipboard points
author Chris Cannam
date Fri, 08 Mar 2019 13:37:30 +0000
parents 6f51297a0250
children 2ee77c9974d7
line wrap: on
line diff
--- a/layer/NoteLayer.cpp	Tue Mar 05 10:02:48 2019 +0000
+++ b/layer/NoteLayer.cpp	Fri Mar 08 13:37:30 2019 +0000
@@ -1218,9 +1218,8 @@
     for (NoteModel::PointList::iterator i = points.begin();
          i != points.end(); ++i) {
         if (s.contains(i->frame)) {
-            Clipboard::Point point(i->frame, i->value, i->duration, i->level, i->label);
-            point.setReferenceFrame(alignToReference(v, i->frame));
-            to.addPoint(point);
+            Event point(i->frame, i->value, i->duration, i->level, i->label);
+            to.addPoint(point.withReferenceFrame(alignToReference(v, i->frame)));
         }
     }
 }
@@ -1230,7 +1229,7 @@
 {
     if (!m_model) return false;
 
-    const Clipboard::PointList &points = from.getPoints();
+    const EventVector &points = from.getPoints();
 
     bool realign = false;
 
@@ -1254,10 +1253,9 @@
     NoteModel::EditCommand *command =
         new NoteModel::EditCommand(m_model, tr("Paste"));
 
-    for (Clipboard::PointList::const_iterator i = points.begin();
+    for (EventVector::const_iterator i = points.begin();
          i != points.end(); ++i) {
         
-        if (!i->haveFrame()) continue;
         sv_frame_t frame = 0;
 
         if (!realign) {
@@ -1266,7 +1264,7 @@
 
         } else {
 
-            if (i->haveReferenceFrame()) {
+            if (i->hasReferenceFrame()) {
                 frame = i->getReferenceFrame();
                 frame = alignFromReference(v, frame);
             } else {
@@ -1276,17 +1274,16 @@
 
         NoteModel::Point newPoint(frame);
   
-        if (i->haveLabel()) newPoint.label = i->getLabel();
-        if (i->haveValue()) newPoint.value = i->getValue();
+        if (i->hasLabel()) newPoint.label = i->getLabel();
+        if (i->hasValue()) newPoint.value = i->getValue();
         else newPoint.value = (m_model->getValueMinimum() +
                                m_model->getValueMaximum()) / 2;
-        if (i->haveLevel()) newPoint.level = i->getLevel();
-        if (i->haveDuration()) newPoint.duration = i->getDuration();
+        if (i->hasLevel()) newPoint.level = i->getLevel();
+        if (i->hasDuration()) newPoint.duration = i->getDuration();
         else {
             sv_frame_t nextFrame = frame;
-            Clipboard::PointList::const_iterator j = i;
+            EventVector::const_iterator j = i;
             for (; j != points.end(); ++j) {
-                if (!j->haveFrame()) continue;
                 if (j != i) break;
             }
             if (j != points.end()) {