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