Mercurial > hg > svgui
comparison layer/TimeInstantLayer.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 | 705f05ab42e3 |
children | 45ba0b381c5d |
comparison
equal
deleted
inserted
replaced
69:6dad2724f3aa | 70:bf306158803d |
---|---|
20 #include "base/View.h" | 20 #include "base/View.h" |
21 #include "base/Profiler.h" | 21 #include "base/Profiler.h" |
22 | 22 |
23 #include "model/SparseOneDimensionalModel.h" | 23 #include "model/SparseOneDimensionalModel.h" |
24 | 24 |
25 #include "widgets/ItemEditDialog.h" | |
26 | |
25 #include <QPainter> | 27 #include <QPainter> |
26 #include <QMouseEvent> | 28 #include <QMouseEvent> |
27 | 29 |
28 #include <iostream> | 30 #include <iostream> |
29 #include <cmath> | 31 #include <cmath> |
578 m_editingCommand = 0; | 580 m_editingCommand = 0; |
579 m_editing = false; | 581 m_editing = false; |
580 } | 582 } |
581 | 583 |
582 void | 584 void |
585 TimeInstantLayer::editOpen(View *v, QMouseEvent *e) | |
586 { | |
587 if (!m_model) return; | |
588 | |
589 SparseOneDimensionalModel::PointList points = getLocalPoints(v, e->x()); | |
590 if (points.empty()) return; | |
591 | |
592 SparseOneDimensionalModel::Point point = *points.begin(); | |
593 | |
594 ItemEditDialog *dialog = new ItemEditDialog | |
595 (m_model->getSampleRate(), | |
596 ItemEditDialog::ShowTime | | |
597 ItemEditDialog::ShowText); | |
598 | |
599 dialog->setFrameTime(point.frame); | |
600 dialog->setText(point.label); | |
601 | |
602 if (dialog->exec() == QDialog::Accepted) { | |
603 | |
604 SparseOneDimensionalModel::Point newPoint = point; | |
605 newPoint.frame = dialog->getFrameTime(); | |
606 newPoint.label = dialog->getText(); | |
607 | |
608 SparseOneDimensionalModel::EditCommand *command = | |
609 new SparseOneDimensionalModel::EditCommand(m_model, tr("Edit Point")); | |
610 command->deletePoint(point); | |
611 command->addPoint(newPoint); | |
612 command->finish(); | |
613 } | |
614 | |
615 delete dialog; | |
616 } | |
617 | |
618 void | |
583 TimeInstantLayer::moveSelection(Selection s, size_t newStartFrame) | 619 TimeInstantLayer::moveSelection(Selection s, size_t newStartFrame) |
584 { | 620 { |
585 SparseOneDimensionalModel::EditCommand *command = | 621 SparseOneDimensionalModel::EditCommand *command = |
586 new SparseOneDimensionalModel::EditCommand(m_model, | 622 new SparseOneDimensionalModel::EditCommand(m_model, |
587 tr("Drag Selection")); | 623 tr("Drag Selection")); |