# HG changeset patch # User Chris Cannam # Date 1570618279 -3600 # Node ID 37df1530519defcc2e52deb9f4e5d210fe17de81 # Parent 14a162f6870fa33228fff4b033cc9aa65a6d53d9 Fix failure to apply new frame when pasting events diff -r 14a162f6870f -r 37df1530519d layer/BoxLayer.cpp --- 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(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() + diff -r 14a162f6870f -r 37df1530519d layer/FlexiNoteLayer.cpp --- 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(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() + diff -r 14a162f6870f -r 37df1530519d layer/ImageLayer.cpp --- 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(m_model); if (!model) return false; @@ -842,7 +843,8 @@ } } - Event p = *i; + Event p = i->withFrame(frame); + Event newPoint = p; //!!! inadequate diff -r 14a162f6870f -r 37df1530519d layer/NoteLayer.cpp --- 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() + diff -r 14a162f6870f -r 37df1530519d layer/RegionLayer.cpp --- 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(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() + diff -r 14a162f6870f -r 37df1530519d layer/TextLayer.cpp --- 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(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) / diff -r 14a162f6870f -r 37df1530519d layer/TimeInstantLayer.cpp --- 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(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())); } diff -r 14a162f6870f -r 37df1530519d layer/TimeValueLayer.cpp --- 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(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())); }