comparison layer/NoteLayer.cpp @ 1428:c9fa16e41664 single-point

Update RegionLayer to updated RegionModel
author Chris Cannam
date Fri, 15 Mar 2019 14:24:22 +0000
parents f792a5001d80
children 5b9692768beb
comparison
equal deleted inserted replaced
1427:f792a5001d80 1428:c9fa16e41664
543 if (points.empty()) return false; 543 if (points.empty()) return false;
544 frame = points.begin()->getFrame(); 544 frame = points.begin()->getFrame();
545 return true; 545 return true;
546 } 546 }
547 547
548 //!!! I think this is not quite right - we want to be able to snap
549 //!!! to events that are nearby but not covering the given frame,
550 //!!! and I think that worked with the old code. Compare and
551 //!!! revise.
552
548 points = m_model->getEventsCovering(frame); 553 points = m_model->getEventsCovering(frame);
549 sv_frame_t snapped = frame; 554 sv_frame_t snapped = frame;
550 bool found = false; 555 bool found = false;
551 556
552 for (EventVector::const_iterator i = points.begin(); 557 for (EventVector::const_iterator i = points.begin();
1210 new ChangeEventsCommand(m_model, tr("Paste")); 1215 new ChangeEventsCommand(m_model, tr("Paste"));
1211 1216
1212 for (EventVector::const_iterator i = points.begin(); 1217 for (EventVector::const_iterator i = points.begin();
1213 i != points.end(); ++i) { 1218 i != points.end(); ++i) {
1214 1219
1215 Event p = *i;
1216
1217 sv_frame_t frame = 0; 1220 sv_frame_t frame = 0;
1218 1221
1219 if (!realign) { 1222 if (!realign) {
1220 1223
1221 frame = i->getFrame(); 1224 frame = i->getFrame();
1228 } else { 1231 } else {
1229 frame = i->getFrame(); 1232 frame = i->getFrame();
1230 } 1233 }
1231 } 1234 }
1232 1235
1236 Event p = *i;
1233 Event newPoint = p; 1237 Event newPoint = p;
1234 if (!p.hasValue()) { 1238 if (!p.hasValue()) {
1235 newPoint = newPoint.withValue((m_model->getValueMinimum() + 1239 newPoint = newPoint.withValue((m_model->getValueMinimum() +
1236 m_model->getValueMaximum()) / 2); 1240 m_model->getValueMaximum()) / 2);
1237 } 1241 }