Mercurial > hg > svgui
comparison layer/NoteLayer.cpp @ 70:bf306158803d
* Add stub for item-edit dialog (for editing properties of an item on double-
click) -- doesn't actually do anything yet
* Add code to invoke said non-working item-edit dialog on double-click in
time-value, time-instants and note layers
* Add overlay mode (no text, basic text, all text)
author | Chris Cannam |
---|---|
date | Thu, 30 Mar 2006 15:00:22 +0000 |
parents | e9eac9368e29 |
children | 45ba0b381c5d |
comparison
equal
deleted
inserted
replaced
69:6dad2724f3aa | 70:bf306158803d |
---|---|
21 #include "base/Pitch.h" | 21 #include "base/Pitch.h" |
22 #include "base/View.h" | 22 #include "base/View.h" |
23 | 23 |
24 #include "model/NoteModel.h" | 24 #include "model/NoteModel.h" |
25 | 25 |
26 #include "widgets/ItemEditDialog.h" | |
27 | |
26 #include "SpectrogramLayer.h" // for optional frequency alignment | 28 #include "SpectrogramLayer.h" // for optional frequency alignment |
27 | 29 |
28 #include <QPainter> | 30 #include <QPainter> |
29 #include <QPainterPath> | 31 #include <QPainterPath> |
30 #include <QMouseEvent> | 32 #include <QMouseEvent> |
624 m_editingCommand = 0; | 626 m_editingCommand = 0; |
625 m_editing = false; | 627 m_editing = false; |
626 } | 628 } |
627 | 629 |
628 void | 630 void |
631 NoteLayer::editOpen(View *v, QMouseEvent *e) | |
632 { | |
633 if (!m_model) return; | |
634 | |
635 NoteModel::PointList points = getLocalPoints(v, e->x()); | |
636 if (points.empty()) return; | |
637 | |
638 NoteModel::Point note = *points.begin(); | |
639 | |
640 ItemEditDialog *dialog = new ItemEditDialog | |
641 (m_model->getSampleRate(), | |
642 ItemEditDialog::ShowTime | | |
643 ItemEditDialog::ShowDuration | | |
644 ItemEditDialog::ShowValue | | |
645 ItemEditDialog::ShowText); | |
646 | |
647 dialog->setFrameTime(note.frame); | |
648 dialog->setValue(note.value); | |
649 dialog->setFrameDuration(note.duration); | |
650 dialog->setText(note.label); | |
651 | |
652 if (dialog->exec() == QDialog::Accepted) { | |
653 | |
654 NoteModel::Point newNote = note; | |
655 newNote.frame = dialog->getFrameTime(); | |
656 newNote.value = dialog->getValue(); | |
657 newNote.duration = dialog->getFrameDuration(); | |
658 newNote.label = dialog->getText(); | |
659 | |
660 NoteModel::EditCommand *command = new NoteModel::EditCommand | |
661 (m_model, tr("Edit Point")); | |
662 command->deletePoint(note); | |
663 command->addPoint(newNote); | |
664 command->finish(); | |
665 } | |
666 | |
667 delete dialog; | |
668 } | |
669 | |
670 void | |
629 NoteLayer::moveSelection(Selection s, size_t newStartFrame) | 671 NoteLayer::moveSelection(Selection s, size_t newStartFrame) |
630 { | 672 { |
631 NoteModel::EditCommand *command = | 673 NoteModel::EditCommand *command = |
632 new NoteModel::EditCommand(m_model, tr("Drag Selection")); | 674 new NoteModel::EditCommand(m_model, tr("Drag Selection")); |
633 | 675 |