comparison layer/FlexiNoteLayer.cpp @ 648:f61a54364d1d tonioni

slightly tidied george's splitEnd method
author matthiasm
date Sat, 15 Jun 2013 19:52:06 +0100
parents 87fe9e05e076
children 2ad082c5a090 12d570c27d85
comparison
equal deleted inserted replaced
647:87fe9e05e076 648:f61a54364d1d
1054 if (xdist != 0 || ydist != 0) { 1054 if (xdist != 0 || ydist != 0) {
1055 std::cerr << "mouse moved" << std::endl; 1055 std::cerr << "mouse moved" << std::endl;
1056 return; 1056 return;
1057 } 1057 }
1058 1058
1059 FlexiNoteModel::Point note(0); 1059 // MM simpler declaration
1060 FlexiNote note(0);
1060 if (!getPointToDrag(v, e->x(), e->y(), note)) return; 1061 if (!getPointToDrag(v, e->x(), e->y(), note)) return;
1061 1062
1062 long frame = v->getFrameForX(e->x()); 1063 long frame = v->getFrameForX(e->x());
1063 1064
1064 FlexiNoteModel::Point newNote1 = note; 1065 int gap = 0; // MM: I prefer a gap of 0, but we can decide later
1065 newNote1.frame = note.frame; 1066
1066 newNote1.value = note.value; 1067 // MM: changed this a bit, to make it slightly clearer
1067 // newNote1.duration = note.duration+10000; 1068 FlexiNote newNote1(note.frame, note.value,
1068 newNote1.duration = frame - note.frame - 100; 1069 frame - note.frame - gap,
1069 newNote1.label = note.label; 1070 note.level, note.label);
1070 1071
1071 FlexiNoteModel::Point newNote2 = note; 1072 FlexiNote newNote2(frame, note.value,
1072 newNote2.frame = frame + 100; 1073 note.duration - newNote1.duration,
1073 newNote2.value = note.value; 1074 note.level, note.label);
1074 newNote2.duration = note.duration - (frame - note.frame - 100);
1075 newNote2.label = note.label;
1076
1077 1075
1078 FlexiNoteModel::EditCommand *command = new FlexiNoteModel::EditCommand 1076 FlexiNoteModel::EditCommand *command = new FlexiNoteModel::EditCommand
1079 (m_model, tr("Edit Point")); 1077 (m_model, tr("Edit Point"));
1080 command->deletePoint(note); 1078 command->deletePoint(note);
1081 command->addPoint(newNote1); 1079 command->addPoint(newNote1);