Mercurial > hg > svgui
diff 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 |
line wrap: on
line diff
--- a/layer/TimeInstantLayer.cpp Thu Mar 30 13:18:11 2006 +0000 +++ b/layer/TimeInstantLayer.cpp Thu Mar 30 15:00:22 2006 +0000 @@ -22,6 +22,8 @@ #include "model/SparseOneDimensionalModel.h" +#include "widgets/ItemEditDialog.h" + #include <QPainter> #include <QMouseEvent> @@ -580,6 +582,40 @@ } void +TimeInstantLayer::editOpen(View *v, QMouseEvent *e) +{ + if (!m_model) return; + + SparseOneDimensionalModel::PointList points = getLocalPoints(v, e->x()); + if (points.empty()) return; + + SparseOneDimensionalModel::Point point = *points.begin(); + + ItemEditDialog *dialog = new ItemEditDialog + (m_model->getSampleRate(), + ItemEditDialog::ShowTime | + ItemEditDialog::ShowText); + + dialog->setFrameTime(point.frame); + dialog->setText(point.label); + + if (dialog->exec() == QDialog::Accepted) { + + SparseOneDimensionalModel::Point newPoint = point; + newPoint.frame = dialog->getFrameTime(); + newPoint.label = dialog->getText(); + + SparseOneDimensionalModel::EditCommand *command = + new SparseOneDimensionalModel::EditCommand(m_model, tr("Edit Point")); + command->deletePoint(point); + command->addPoint(newPoint); + command->finish(); + } + + delete dialog; +} + +void TimeInstantLayer::moveSelection(Selection s, size_t newStartFrame) { SparseOneDimensionalModel::EditCommand *command =