Mercurial > hg > svgui
comparison layer/TimeInstantLayer.cpp @ 944:78c152e4db95
Merge from branch tonioni
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:12:17 +0100 |
parents | 251dd0abc7b7 |
children | 94e4952a6774 3871dffc31bd |
comparison
equal
deleted
inserted
replaced
896:78e041e45ff0 | 944:78c152e4db95 |
---|---|
199 | 199 |
200 return usePoints; | 200 return usePoints; |
201 } | 201 } |
202 | 202 |
203 QString | 203 QString |
204 TimeInstantLayer::getLabelPreceding(int frame) const | 204 TimeInstantLayer::getLabelPreceding(sv_frame_t frame) const |
205 { | 205 { |
206 if (!m_model) return ""; | 206 if (!m_model) return ""; |
207 SparseOneDimensionalModel::PointList points = m_model->getPreviousPoints(frame); | 207 SparseOneDimensionalModel::PointList points = m_model->getPreviousPoints(frame); |
208 for (SparseOneDimensionalModel::PointList::const_iterator i = points.begin(); | 208 for (SparseOneDimensionalModel::PointList::const_iterator i = points.begin(); |
209 i != points.end(); ++i) { | 209 i != points.end(); ++i) { |
247 pos = QPoint(v->getXForFrame(useFrame), pos.y()); | 247 pos = QPoint(v->getXForFrame(useFrame), pos.y()); |
248 return text; | 248 return text; |
249 } | 249 } |
250 | 250 |
251 bool | 251 bool |
252 TimeInstantLayer::snapToFeatureFrame(View *v, int &frame, | 252 TimeInstantLayer::snapToFeatureFrame(View *v, sv_frame_t &frame, |
253 int &resolution, | 253 int &resolution, |
254 SnapType snap) const | 254 SnapType snap) const |
255 { | 255 { |
256 if (!m_model) { | 256 if (!m_model) { |
257 return Layer::snapToFeatureFrame(v, frame, resolution, snap); | 257 return Layer::snapToFeatureFrame(v, frame, resolution, snap); |
267 frame = points.begin()->frame; | 267 frame = points.begin()->frame; |
268 return true; | 268 return true; |
269 } | 269 } |
270 | 270 |
271 points = m_model->getPoints(frame, frame); | 271 points = m_model->getPoints(frame, frame); |
272 int snapped = frame; | 272 sv_frame_t snapped = frame; |
273 bool found = false; | 273 bool found = false; |
274 | 274 |
275 for (SparseOneDimensionalModel::PointList::const_iterator i = points.begin(); | 275 for (SparseOneDimensionalModel::PointList::const_iterator i = points.begin(); |
276 i != points.end(); ++i) { | 276 i != points.end(); ++i) { |
277 | 277 |
664 delete dialog; | 664 delete dialog; |
665 return true; | 665 return true; |
666 } | 666 } |
667 | 667 |
668 void | 668 void |
669 TimeInstantLayer::moveSelection(Selection s, int newStartFrame) | 669 TimeInstantLayer::moveSelection(Selection s, sv_frame_t newStartFrame) |
670 { | 670 { |
671 if (!m_model) return; | 671 if (!m_model) return; |
672 | 672 |
673 SparseOneDimensionalModel::EditCommand *command = | 673 SparseOneDimensionalModel::EditCommand *command = |
674 new SparseOneDimensionalModel::EditCommand(m_model, | 674 new SparseOneDimensionalModel::EditCommand(m_model, |
710 for (SparseOneDimensionalModel::PointList::iterator i = points.begin(); | 710 for (SparseOneDimensionalModel::PointList::iterator i = points.begin(); |
711 i != points.end(); ++i) { | 711 i != points.end(); ++i) { |
712 | 712 |
713 if (s.contains(i->frame)) { | 713 if (s.contains(i->frame)) { |
714 | 714 |
715 double target = i->frame; | 715 double target = double(i->frame); |
716 target = newSize.getStartFrame() + | 716 target = double(newSize.getStartFrame()) + |
717 double(target - s.getStartFrame()) * ratio; | 717 target - double(s.getStartFrame()) * ratio; |
718 | 718 |
719 SparseOneDimensionalModel::Point newPoint(*i); | 719 SparseOneDimensionalModel::Point newPoint(*i); |
720 newPoint.frame = lrint(target); | 720 newPoint.frame = lrint(target); |
721 command->deletePoint(*i); | 721 command->deletePoint(*i); |
722 command->addPoint(newPoint); | 722 command->addPoint(newPoint); |
763 } | 763 } |
764 } | 764 } |
765 } | 765 } |
766 | 766 |
767 bool | 767 bool |
768 TimeInstantLayer::paste(View *v, const Clipboard &from, int frameOffset, bool) | 768 TimeInstantLayer::paste(View *v, const Clipboard &from, sv_frame_t frameOffset, bool) |
769 { | 769 { |
770 if (!m_model) return false; | 770 if (!m_model) return false; |
771 | 771 |
772 const Clipboard::PointList &points = from.getPoints(); | 772 const Clipboard::PointList &points = from.getPoints(); |
773 | 773 |
796 for (Clipboard::PointList::const_iterator i = points.begin(); | 796 for (Clipboard::PointList::const_iterator i = points.begin(); |
797 i != points.end(); ++i) { | 797 i != points.end(); ++i) { |
798 | 798 |
799 if (!i->haveFrame()) continue; | 799 if (!i->haveFrame()) continue; |
800 | 800 |
801 int frame = 0; | 801 sv_frame_t frame = 0; |
802 | 802 |
803 if (!realign) { | 803 if (!realign) { |
804 | 804 |
805 frame = i->getFrame(); | 805 frame = i->getFrame(); |
806 | 806 |