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