Mercurial > hg > svgui
diff 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 |
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp Thu Nov 22 14:27:41 2007 +0000 +++ b/layer/TimeValueLayer.cpp Fri Nov 23 16:48:23 2007 +0000 @@ -940,6 +940,51 @@ } void +TimeValueLayer::eraseStart(View *v, QMouseEvent *e) +{ + if (!m_model) return; + + SparseTimeValueModel::PointList points = getLocalPoints(v, e->x()); + if (points.empty()) return; + + m_editingPoint = *points.begin(); + + if (m_editingCommand) { + m_editingCommand->finish(); + m_editingCommand = 0; + } + + m_editing = true; +} + +void +TimeValueLayer::eraseDrag(View *v, QMouseEvent *e) +{ +} + +void +TimeValueLayer::eraseEnd(View *v, QMouseEvent *e) +{ + if (!m_model || !m_editing) return; + + m_editing = false; + + SparseTimeValueModel::PointList points = getLocalPoints(v, e->x()); + if (points.empty()) return; + if (points.begin()->frame != m_editingPoint.frame || + points.begin()->value != m_editingPoint.value) return; + + m_editingCommand = new SparseTimeValueModel::EditCommand + (m_model, tr("Erase Point")); + + m_editingCommand->deletePoint(m_editingPoint); + + m_editingCommand->finish(); + m_editingCommand = 0; + m_editing = false; +} + +void TimeValueLayer::editStart(View *v, QMouseEvent *e) { // std::cerr << "TimeValueLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl; @@ -1147,6 +1192,7 @@ i != points.end(); ++i) { if (s.contains(i->frame)) { Clipboard::Point point(i->frame, i->value, i->label); + point.setReferenceFrame(m_model->alignToReference(i->frame)); to.addPoint(point); } }