Mercurial > hg > svgui
diff layer/TimeInstantLayer.cpp @ 23:ca57f70b0e48
* Add Zero Crossings output from zc plugin (as well as Zero Crossings Count)
* Use brief friendly names for layers instead of full transform descriptions
* Clearer command names for editing commands
* Some efficiencies in drawing dense points in TimeInstantLayer
author | Chris Cannam |
---|---|
date | Tue, 31 Jan 2006 17:19:45 +0000 |
parents | 179bf7b5ddea |
children | dcdb21b62dbb |
line wrap: on
line diff
--- a/layer/TimeInstantLayer.cpp Tue Jan 31 15:57:25 2006 +0000 +++ b/layer/TimeInstantLayer.cpp Tue Jan 31 17:19:45 2006 +0000 @@ -290,6 +290,8 @@ if (!localPoints.empty()) illuminateFrame = localPoints.begin()->frame; } + int prevX = -1; + for (SparseOneDimensionalModel::PointList::const_iterator i = points.begin(); i != points.end(); ++i) { @@ -298,6 +300,8 @@ ++j; int x = getXForFrame(p.frame); + if (x == prevX && p.frame != illuminateFrame) continue; + int iw = getXForFrame(p.frame + m_model->getResolution()) - x; if (iw < 2) { if (iw < 1) { @@ -316,7 +320,12 @@ } else { paint.setPen(brushColour); } - paint.drawRect(x, 0, iw - 1, m_view->height() - 1); + + if (iw > 1) { + paint.drawRect(x, 0, iw - 1, m_view->height() - 1); + } else { + paint.drawLine(x, 0, x, m_view->height() - 1); + } paint.setPen(m_colour); if (p.label != "") { @@ -337,6 +346,8 @@ p.label); } } + + prevX = x; } } @@ -381,6 +392,11 @@ { std::cerr << "TimeInstantLayer::drawEnd(" << e->x() << ")" << std::endl; if (!m_model || !m_editing) return; + QString newName = tr("Add Point at %1 s") + .arg(RealTime::frame2RealTime(m_editingPoint.frame, + m_model->getSampleRate()) + .toText(false).c_str()); + m_editingCommand->setName(newName); m_editingCommand->finish(); m_editingCommand = 0; m_editing = false; @@ -432,7 +448,14 @@ { std::cerr << "TimeInstantLayer::editEnd(" << e->x() << ")" << std::endl; if (!m_model || !m_editing) return; - if (m_editingCommand) m_editingCommand->finish(); + if (m_editingCommand) { + QString newName = tr("Move Point to %1 s") + .arg(RealTime::frame2RealTime(m_editingPoint.frame, + m_model->getSampleRate()) + .toText(false).c_str()); + m_editingCommand->setName(newName); + m_editingCommand->finish(); + } m_editingCommand = 0; m_editing = false; }