Mercurial > hg > svgui
comparison layer/TimeValueLayer.cpp @ 335:2f83b6e3b8ca
* Add Erase tool and mode
* Add icons for Normalize buttons in property boxes, and for Show Peaks
* Add support for velocity in notes -- not yet reflected in display or
editable in the note edit dialog, but they are imported from MIDI,
played, and exported
* Begin work on making pastes align pasted times (subtler than I thought)
author | Chris Cannam |
---|---|
date | Fri, 23 Nov 2007 16:48:23 +0000 |
parents | 4f4f38a11cd2 |
children | ffa448b0e1bc 0895517bb2d1 |
comparison
equal
deleted
inserted
replaced
334:0a74248af622 | 335:2f83b6e3b8ca |
---|---|
938 m_editingCommand = 0; | 938 m_editingCommand = 0; |
939 m_editing = false; | 939 m_editing = false; |
940 } | 940 } |
941 | 941 |
942 void | 942 void |
943 TimeValueLayer::eraseStart(View *v, QMouseEvent *e) | |
944 { | |
945 if (!m_model) return; | |
946 | |
947 SparseTimeValueModel::PointList points = getLocalPoints(v, e->x()); | |
948 if (points.empty()) return; | |
949 | |
950 m_editingPoint = *points.begin(); | |
951 | |
952 if (m_editingCommand) { | |
953 m_editingCommand->finish(); | |
954 m_editingCommand = 0; | |
955 } | |
956 | |
957 m_editing = true; | |
958 } | |
959 | |
960 void | |
961 TimeValueLayer::eraseDrag(View *v, QMouseEvent *e) | |
962 { | |
963 } | |
964 | |
965 void | |
966 TimeValueLayer::eraseEnd(View *v, QMouseEvent *e) | |
967 { | |
968 if (!m_model || !m_editing) return; | |
969 | |
970 m_editing = false; | |
971 | |
972 SparseTimeValueModel::PointList points = getLocalPoints(v, e->x()); | |
973 if (points.empty()) return; | |
974 if (points.begin()->frame != m_editingPoint.frame || | |
975 points.begin()->value != m_editingPoint.value) return; | |
976 | |
977 m_editingCommand = new SparseTimeValueModel::EditCommand | |
978 (m_model, tr("Erase Point")); | |
979 | |
980 m_editingCommand->deletePoint(m_editingPoint); | |
981 | |
982 m_editingCommand->finish(); | |
983 m_editingCommand = 0; | |
984 m_editing = false; | |
985 } | |
986 | |
987 void | |
943 TimeValueLayer::editStart(View *v, QMouseEvent *e) | 988 TimeValueLayer::editStart(View *v, QMouseEvent *e) |
944 { | 989 { |
945 // std::cerr << "TimeValueLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl; | 990 // std::cerr << "TimeValueLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl; |
946 | 991 |
947 if (!m_model) return; | 992 if (!m_model) return; |
1145 | 1190 |
1146 for (SparseTimeValueModel::PointList::iterator i = points.begin(); | 1191 for (SparseTimeValueModel::PointList::iterator i = points.begin(); |
1147 i != points.end(); ++i) { | 1192 i != points.end(); ++i) { |
1148 if (s.contains(i->frame)) { | 1193 if (s.contains(i->frame)) { |
1149 Clipboard::Point point(i->frame, i->value, i->label); | 1194 Clipboard::Point point(i->frame, i->value, i->label); |
1195 point.setReferenceFrame(m_model->alignToReference(i->frame)); | |
1150 to.addPoint(point); | 1196 to.addPoint(point); |
1151 } | 1197 } |
1152 } | 1198 } |
1153 } | 1199 } |
1154 | 1200 |