Mercurial > hg > svgui
comparison layer/FlexiNoteLayer.cpp @ 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 | 488add397d34 |
children | bb1f2a20f7db |
comparison
equal
deleted
inserted
replaced
791:b076cefaf708 | 792:0ba792bb235b |
---|---|
1279 long duration = 10000; | 1279 long duration = 10000; |
1280 | 1280 |
1281 long frame = v->getFrameForX(e->x()); | 1281 long frame = v->getFrameForX(e->x()); |
1282 float value = getValueForY(v, e->y()); | 1282 float value = getValueForY(v, e->y()); |
1283 | 1283 |
1284 FlexiNoteModel::PointList noteList = m_model->getPoints(); | |
1285 | |
1284 if (m_intelligentActions) { | 1286 if (m_intelligentActions) { |
1285 long smallestRightNeighbourFrame = 0; | 1287 long smallestRightNeighbourFrame = 0; |
1286 for (FlexiNoteModel::PointList::const_iterator i = m_model->getPoints().begin(); | 1288 for (FlexiNoteModel::PointList::const_iterator i = noteList.begin(); |
1287 i != m_model->getPoints().end(); ++i) { | 1289 i != noteList.end(); ++i) { |
1288 FlexiNote currentNote = *i; | 1290 FlexiNote currentNote = *i; |
1289 if (currentNote.frame > frame) { | 1291 if (currentNote.frame > frame) { |
1290 smallestRightNeighbourFrame = currentNote.frame; | 1292 smallestRightNeighbourFrame = currentNote.frame; |
1291 break; | 1293 break; |
1292 } | 1294 } |
1293 } | 1295 } |
1294 | 1296 if (smallestRightNeighbourFrame > 0) { |
1295 duration = std::min(smallestRightNeighbourFrame - frame + 1, duration); | 1297 duration = std::min(smallestRightNeighbourFrame - frame + 1, duration); |
1296 duration = (duration > 0) ? duration : 0; | 1298 duration = (duration > 0) ? duration : 0; |
1299 } | |
1297 } | 1300 } |
1298 | 1301 |
1299 if (!m_intelligentActions || | 1302 if (!m_intelligentActions || |
1300 (m_model->getPoints(frame).empty() && duration > 0)) { | 1303 (m_model->getPoints(frame).empty() && duration > 0)) { |
1301 FlexiNote newNote(frame, value, duration, 100, "new note"); | 1304 FlexiNote newNote(frame, value, duration, 100, "new note"); |