diff layer/RegionLayer.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 2487521e857b
children c9fa16e41664
line wrap: on
line diff
--- a/layer/RegionLayer.cpp	Tue Mar 05 10:02:48 2019 +0000
+++ b/layer/RegionLayer.cpp	Fri Mar 08 13:37:30 2019 +0000
@@ -1478,9 +1478,8 @@
     for (RegionModel::PointList::iterator i = points.begin();
          i != points.end(); ++i) {
         if (s.contains(i->frame)) {
-            Clipboard::Point point(i->frame, i->value, i->duration, i->label);
-            point.setReferenceFrame(alignToReference(v, i->frame));
-            to.addPoint(point);
+            Event point(i->frame, i->value, i->duration, i->label);
+            to.addPoint(point.withReferenceFrame(alignToReference(v, i->frame)));
         }
     }
 }
@@ -1490,7 +1489,7 @@
 {
     if (!m_model) return false;
 
-    const Clipboard::PointList &points = from.getPoints();
+    const EventVector &points = from.getPoints();
 
     bool realign = false;
 
@@ -1514,10 +1513,9 @@
     RegionModel::EditCommand *command =
         new RegionModel::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) {
@@ -1526,7 +1524,7 @@
 
         } else {
 
-            if (i->haveReferenceFrame()) {
+            if (i->hasReferenceFrame()) {
                 frame = i->getReferenceFrame();
                 frame = alignFromReference(v, frame);
             } else {
@@ -1536,16 +1534,15 @@
 
         RegionModel::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->haveDuration()) newPoint.duration = i->getDuration();
+        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()) {