changeset 792:0ba792bb235b tonioni

adding a note after the last existing one is now possible (#974)
author matthiasm
date Thu, 12 Jun 2014 14:31:48 +0100
parents b076cefaf708
children bb1f2a20f7db
files layer/FlexiNoteLayer.cpp view/Overview.cpp
diffstat 2 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/layer/FlexiNoteLayer.cpp	Thu Jun 12 13:42:10 2014 +0100
+++ b/layer/FlexiNoteLayer.cpp	Thu Jun 12 14:31:48 2014 +0100
@@ -1281,19 +1281,22 @@
     long frame = v->getFrameForX(e->x());
     float value = getValueForY(v, e->y());
     
+    FlexiNoteModel::PointList noteList = m_model->getPoints();
+
     if (m_intelligentActions) {
         long smallestRightNeighbourFrame = 0;
-        for (FlexiNoteModel::PointList::const_iterator i = m_model->getPoints().begin();
-             i != m_model->getPoints().end(); ++i) {
+        for (FlexiNoteModel::PointList::const_iterator i = noteList.begin();
+             i != noteList.end(); ++i) {
             FlexiNote currentNote = *i;
             if (currentNote.frame > frame) {
                 smallestRightNeighbourFrame = currentNote.frame;
                 break;
             }
         }
-        
-        duration = std::min(smallestRightNeighbourFrame - frame + 1, duration);
-        duration = (duration > 0) ? duration : 0;
+        if (smallestRightNeighbourFrame > 0) {
+            duration = std::min(smallestRightNeighbourFrame - frame + 1, duration);
+            duration = (duration > 0) ? duration : 0;
+        }
     }
 
     if (!m_intelligentActions || 
--- a/view/Overview.cpp	Thu Jun 12 13:42:10 2014 +0100
+++ b/view/Overview.cpp	Thu Jun 12 14:31:48 2014 +0100
@@ -280,7 +280,7 @@
 #ifdef DEBUG_OVERVIEW
         cerr << "Overview::mouseMoveEvent: x " << e->x() << " and click x " << m_clickPos.x() << " -> frame " << newCentreFrame << " -> rf " << rf << endl;
 #endif
-	emit centreFrameChanged(rf, true, PlaybackIgnore);
+	emit centreFrameChanged(rf, true, PlaybackScrollContinuous);
     }
 }