comparison 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
comparison
equal deleted inserted replaced
334:0a74248af622 335:2f83b6e3b8ca
446 m_editingCommand = 0; 446 m_editingCommand = 0;
447 m_editing = false; 447 m_editing = false;
448 } 448 }
449 449
450 void 450 void
451 TextLayer::eraseStart(View *v, QMouseEvent *e)
452 {
453 if (!m_model) return;
454
455 TextModel::PointList points = getLocalPoints(v, e->x(), e->y());
456 if (points.empty()) return;
457
458 m_editingPoint = *points.begin();
459
460 if (m_editingCommand) {
461 m_editingCommand->finish();
462 m_editingCommand = 0;
463 }
464
465 m_editing = true;
466 }
467
468 void
469 TextLayer::eraseDrag(View *v, QMouseEvent *e)
470 {
471 }
472
473 void
474 TextLayer::eraseEnd(View *v, QMouseEvent *e)
475 {
476 if (!m_model || !m_editing) return;
477
478 m_editing = false;
479
480 TextModel::PointList points = getLocalPoints(v, e->x(), e->y());
481 if (points.empty()) return;
482 if (points.begin()->frame != m_editingPoint.frame ||
483 points.begin()->height != m_editingPoint.height) return;
484
485 m_editingCommand = new TextModel::EditCommand
486 (m_model, tr("Erase Point"));
487
488 m_editingCommand->deletePoint(m_editingPoint);
489
490 m_editingCommand->finish();
491 m_editingCommand = 0;
492 m_editing = false;
493 }
494
495 void
451 TextLayer::editStart(View *v, QMouseEvent *e) 496 TextLayer::editStart(View *v, QMouseEvent *e)
452 { 497 {
453 // std::cerr << "TextLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl; 498 // std::cerr << "TextLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl;
454 499
455 if (!m_model) return; 500 if (!m_model) return;
635 680
636 for (TextModel::PointList::iterator i = points.begin(); 681 for (TextModel::PointList::iterator i = points.begin();
637 i != points.end(); ++i) { 682 i != points.end(); ++i) {
638 if (s.contains(i->frame)) { 683 if (s.contains(i->frame)) {
639 Clipboard::Point point(i->frame, i->height, i->label); 684 Clipboard::Point point(i->frame, i->height, i->label);
685 point.setReferenceFrame(m_model->alignToReference(i->frame));
640 to.addPoint(point); 686 to.addPoint(point);
641 } 687 }
642 } 688 }
643 } 689 }
644 690