changeset 1533:37df1530519d

Fix failure to apply new frame when pasting events
author Chris Cannam
date Wed, 09 Oct 2019 11:51:19 +0100
parents 14a162f6870f
children bfd8b22fd67c
files layer/BoxLayer.cpp layer/FlexiNoteLayer.cpp layer/ImageLayer.cpp layer/NoteLayer.cpp layer/RegionLayer.cpp layer/TextLayer.cpp layer/TimeInstantLayer.cpp layer/TimeValueLayer.cpp
diffstat 8 files changed, 30 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/layer/BoxLayer.cpp	Wed Oct 09 11:33:33 2019 +0100
+++ b/layer/BoxLayer.cpp	Wed Oct 09 11:51:19 2019 +0100
@@ -1106,7 +1106,8 @@
 }
 
 bool
-BoxLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /* frameOffset */, bool /* interactive */)
+BoxLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
+                sv_frame_t /* frameOffset */, bool /* interactive */)
 {
     auto model = ModelById::getAs<BoxModel>(m_model);
     if (!model) return false;
@@ -1154,7 +1155,8 @@
             }
         }
 
-        Event p = *i;
+        Event p = i->withFrame(frame);
+        
         Event newPoint = p;
         if (!p.hasValue()) {
             newPoint = newPoint.withValue((model->getValueMinimum() +
--- a/layer/FlexiNoteLayer.cpp	Wed Oct 09 11:33:33 2019 +0100
+++ b/layer/FlexiNoteLayer.cpp	Wed Oct 09 11:51:19 2019 +0100
@@ -1740,7 +1740,8 @@
 }
 
 bool
-FlexiNoteLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /*frameOffset */, bool /* interactive */)
+FlexiNoteLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
+                      sv_frame_t /*frameOffset */, bool /* interactive */)
 {
     auto model = ModelById::getAs<NoteModel>(m_model);
     if (!model) return false;
@@ -1787,7 +1788,8 @@
             }
         }
 
-        Event p = *i;
+        Event p = i->withFrame(frame);
+
         Event newPoint = p;
         if (!p.hasValue()) {
             newPoint = newPoint.withValue((model->getValueMinimum() +
--- a/layer/ImageLayer.cpp	Wed Oct 09 11:33:33 2019 +0100
+++ b/layer/ImageLayer.cpp	Wed Oct 09 11:51:19 2019 +0100
@@ -795,7 +795,8 @@
 }
 
 bool
-ImageLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /* frameOffset */, bool /* interactive */)
+ImageLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
+                  sv_frame_t /* frameOffset */, bool /* interactive */)
 {
     auto model = ModelById::getAs<ImageModel>(m_model);
     if (!model) return false;
@@ -842,7 +843,8 @@
             }
         }
 
-        Event p = *i;
+        Event p = i->withFrame(frame);
+
         Event newPoint = p;
 
         //!!! inadequate
--- a/layer/NoteLayer.cpp	Wed Oct 09 11:33:33 2019 +0100
+++ b/layer/NoteLayer.cpp	Wed Oct 09 11:51:19 2019 +0100
@@ -1237,7 +1237,8 @@
             }
         }
 
-        Event p = *i;
+        Event p = i->withFrame(frame);
+        
         Event newPoint = p;
         if (!p.hasValue()) {
             newPoint = newPoint.withValue((model->getValueMinimum() +
--- a/layer/RegionLayer.cpp	Wed Oct 09 11:33:33 2019 +0100
+++ b/layer/RegionLayer.cpp	Wed Oct 09 11:51:19 2019 +0100
@@ -1456,7 +1456,8 @@
 }
 
 bool
-RegionLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /* frameOffset */, bool /* interactive */)
+RegionLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
+                   sv_frame_t /* frameOffset */, bool /* interactive */)
 {
     auto model = ModelById::getAs<RegionModel>(m_model);
     if (!model) return false;
@@ -1504,7 +1505,8 @@
             }
         }
 
-        Event p = *i;
+        Event p = i->withFrame(frame);
+
         Event newPoint = p;
         if (!p.hasValue()) {
             newPoint = newPoint.withValue((model->getValueMinimum() +
--- a/layer/TextLayer.cpp	Wed Oct 09 11:33:33 2019 +0100
+++ b/layer/TextLayer.cpp	Wed Oct 09 11:51:19 2019 +0100
@@ -697,7 +697,8 @@
 }
 
 bool
-TextLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /* frameOffset */, bool /* interactive */)
+TextLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
+                 sv_frame_t /* frameOffset */, bool /* interactive */)
 {
     auto model = ModelById::getAs<TextModel>(m_model);
     if (!model) return false;
@@ -755,7 +756,8 @@
             }
         }
 
-        Event p = *i;
+        Event p = i->withFrame(frame);
+
         Event newPoint = p;
         if (p.hasValue()) {
             newPoint = newPoint.withValue(float((i->getValue() - valueMin) /
--- a/layer/TimeInstantLayer.cpp	Wed Oct 09 11:33:33 2019 +0100
+++ b/layer/TimeInstantLayer.cpp	Wed Oct 09 11:51:19 2019 +0100
@@ -763,7 +763,8 @@
 }
 
 bool
-TimeInstantLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t frameOffset, bool)
+TimeInstantLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
+                        sv_frame_t frameOffset, bool)
 {
     auto model = ModelById::getAs<SparseOneDimensionalModel>(m_model);
     if (!model) return false;
@@ -817,7 +818,8 @@
             else frame = 0;
         }
 
-        Event newPoint = *i;
+        Event newPoint = i->withFrame(frame);
+        
         if (!i->hasLabel() && i->hasValue()) {
             newPoint = newPoint.withLabel(QString("%1").arg(i->getValue()));
         }
--- a/layer/TimeValueLayer.cpp	Wed Oct 09 11:33:33 2019 +0100
+++ b/layer/TimeValueLayer.cpp	Wed Oct 09 11:51:19 2019 +0100
@@ -1686,8 +1686,8 @@
 }
 
 bool
-TimeValueLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /* frameOffset */,
-                      bool interactive)
+TimeValueLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
+                      sv_frame_t /* frameOffset */, bool interactive)
 {
     auto model = ModelById::getAs<SparseTimeValueModel>(m_model);
     if (!model) return false;
@@ -1842,7 +1842,8 @@
             }
         }
 
-        Event newPoint = *i;
+        Event newPoint = i->withFrame(frame);
+        
         if (!i->hasLabel() && i->hasValue()) {
             newPoint = newPoint.withLabel(QString("%1").arg(i->getValue()));
         }