Mercurial > hg > svgui
comparison layer/TimeValueLayer.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 |
comparison
equal
deleted
inserted
replaced
22:179bf7b5ddea | 23:ca57f70b0e48 |
---|---|
25 | 25 |
26 TimeValueLayer::TimeValueLayer(View *w) : | 26 TimeValueLayer::TimeValueLayer(View *w) : |
27 Layer(w), | 27 Layer(w), |
28 m_model(0), | 28 m_model(0), |
29 m_editing(false), | 29 m_editing(false), |
30 m_originalPoint(0, 0.0, tr("New Point")), | |
30 m_editingPoint(0, 0.0, tr("New Point")), | 31 m_editingPoint(0, 0.0, tr("New Point")), |
31 m_editingCommand(0), | 32 m_editingCommand(0), |
32 m_colour(Qt::black), | 33 m_colour(Qt::black), |
33 m_plotStyle(PlotConnectedPoints) | 34 m_plotStyle(PlotConnectedPoints) |
34 { | 35 { |
495 frame = frame / m_model->getResolution() * m_model->getResolution(); | 496 frame = frame / m_model->getResolution() * m_model->getResolution(); |
496 | 497 |
497 float value = getValueForY(e->y()); | 498 float value = getValueForY(e->y()); |
498 | 499 |
499 m_editingPoint = SparseTimeValueModel::Point(frame, value, tr("New Point")); | 500 m_editingPoint = SparseTimeValueModel::Point(frame, value, tr("New Point")); |
501 m_originalPoint = m_editingPoint; | |
500 | 502 |
501 if (m_editingCommand) m_editingCommand->finish(); | 503 if (m_editingCommand) m_editingCommand->finish(); |
502 m_editingCommand = new SparseTimeValueModel::EditCommand(m_model, | 504 m_editingCommand = new SparseTimeValueModel::EditCommand(m_model, |
503 tr("Draw Point")); | 505 tr("Draw Point")); |
504 m_editingCommand->addPoint(m_editingPoint); | 506 m_editingCommand->addPoint(m_editingPoint); |
544 | 546 |
545 SparseTimeValueModel::PointList points = getLocalPoints(e->x()); | 547 SparseTimeValueModel::PointList points = getLocalPoints(e->x()); |
546 if (points.empty()) return; | 548 if (points.empty()) return; |
547 | 549 |
548 m_editingPoint = *points.begin(); | 550 m_editingPoint = *points.begin(); |
551 m_originalPoint = m_editingPoint; | |
549 | 552 |
550 if (m_editingCommand) { | 553 if (m_editingCommand) { |
551 m_editingCommand->finish(); | 554 m_editingCommand->finish(); |
552 m_editingCommand = 0; | 555 m_editingCommand = 0; |
553 } | 556 } |
582 void | 585 void |
583 TimeValueLayer::editEnd(QMouseEvent *e) | 586 TimeValueLayer::editEnd(QMouseEvent *e) |
584 { | 587 { |
585 std::cerr << "TimeValueLayer::editEnd(" << e->x() << "," << e->y() << ")" << std::endl; | 588 std::cerr << "TimeValueLayer::editEnd(" << e->x() << "," << e->y() << ")" << std::endl; |
586 if (!m_model || !m_editing) return; | 589 if (!m_model || !m_editing) return; |
587 if (m_editingCommand) m_editingCommand->finish(); | 590 |
591 if (m_editingCommand) { | |
592 | |
593 QString newName = m_editingCommand->getName(); | |
594 | |
595 if (m_editingPoint.frame != m_originalPoint.frame) { | |
596 if (m_editingPoint.value != m_originalPoint.value) { | |
597 newName = tr("Edit Point"); | |
598 } else { | |
599 newName = tr("Relocate Point"); | |
600 } | |
601 } else { | |
602 newName = tr("Change Point Value"); | |
603 } | |
604 | |
605 m_editingCommand->setName(newName); | |
606 m_editingCommand->finish(); | |
607 } | |
608 | |
588 m_editingCommand = 0; | 609 m_editingCommand = 0; |
589 m_editing = false; | 610 m_editing = false; |
590 } | 611 } |
591 | 612 |
592 QString | 613 QString |